From 0ad3ab6c52829fd198f7aa7f1a0f4f8999a33eaa Mon Sep 17 00:00:00 2001 From: cb-karthikp Date: Sun, 21 Jun 2026 20:47:24 +0530 Subject: [PATCH 1/7] Otel core changes Otel core chagnes --- README.md | 133 ++++++++++ .../chargebee/v4/client/ChargebeeClient.java | 29 +++ .../v4/client/request/RequestOptions.java | 24 +- .../v4/telemetry/RequestTelemetryContext.java | 100 ++++++++ .../v4/telemetry/RequestTelemetryError.java | 44 ++++ .../v4/telemetry/RequestTelemetryResult.java | 49 ++++ .../v4/telemetry/TelemetryAdapter.java | 39 +++ .../v4/telemetry/TelemetryAttributeKeys.java | 43 ++++ .../v4/telemetry/TelemetryExecutor.java | 162 ++++++++++++ .../v4/telemetry/TelemetrySupport.java | 209 +++++++++++++++ .../com/chargebee/v4/transport/Request.java | 44 ++++ .../v4/telemetry/TelemetryExecutorTest.java | 241 ++++++++++++++++++ 12 files changed, 1112 insertions(+), 5 deletions(-) create mode 100644 src/main/java/com/chargebee/v4/telemetry/RequestTelemetryContext.java create mode 100644 src/main/java/com/chargebee/v4/telemetry/RequestTelemetryError.java create mode 100644 src/main/java/com/chargebee/v4/telemetry/RequestTelemetryResult.java create mode 100644 src/main/java/com/chargebee/v4/telemetry/TelemetryAdapter.java create mode 100644 src/main/java/com/chargebee/v4/telemetry/TelemetryAttributeKeys.java create mode 100644 src/main/java/com/chargebee/v4/telemetry/TelemetryExecutor.java create mode 100644 src/main/java/com/chargebee/v4/telemetry/TelemetrySupport.java create mode 100644 src/test/java/com/chargebee/v4/telemetry/TelemetryExecutorTest.java diff --git a/README.md b/README.md index 1f7874ea0..a37d4be33 100644 --- a/README.md +++ b/README.md @@ -691,6 +691,139 @@ public class Sample { } ``` +### Telemetry (OpenTelemetry) + +Optional. Pass a `telemetryAdapter` when you want Chargebee API calls traced in your observability stack (Datadog, Splunk, Honeycomb, Jaeger, etc.). OpenTelemetry is not bundled with `chargebee-java` — add and configure it in your app, implement `TelemetryAdapter`, and wire it on the client. + +The SDK builds standardized span attributes (`ctx.getStartAttributes()`, `result.getEndAttributes()`) following the stable [OpenTelemetry HTTP semantic conventions](https://opentelemetry.io/docs/specs/semconv/http/http-spans/) (`url.full`, `http.request.method`, `http.response.status_code`, `server.address`, `error.type`) plus Chargebee-specific `chargebee.*` attributes — use them as-is so spans render correctly in your APM and stay consistent across SDKs. + +Spans are named `chargebee.{resource}.{operation}` (e.g. `chargebee.subscription.create`). + +#### OpenTelemetry example + +```kotlin +dependencies { + implementation("io.opentelemetry:opentelemetry-api:1.49.0") + implementation("io.opentelemetry:opentelemetry-sdk:1.49.0") + implementation("io.opentelemetry:opentelemetry-exporter-otlp:1.49.0") +} +``` + +Configure OpenTelemetry at app startup, then pass your adapter: + +```java +import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.common.AttributeKey; +import io.opentelemetry.api.common.Attributes; +import io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporter; +import io.opentelemetry.sdk.OpenTelemetrySdk; +import io.opentelemetry.sdk.resources.Resource; +import io.opentelemetry.sdk.trace.SdkTracerProvider; +import io.opentelemetry.sdk.trace.export.BatchSpanProcessor; + +// App startup — configure once +OtlpGrpcSpanExporter spanExporter = + OtlpGrpcSpanExporter.builder() + .setEndpoint(System.getenv().getOrDefault("OTEL_EXPORTER_OTLP_ENDPOINT", "http://localhost:4317")) + .build(); + +SdkTracerProvider tracerProvider = + SdkTracerProvider.builder() + .addSpanProcessor(BatchSpanProcessor.builder(spanExporter).build()) + .setResource( + Resource.getDefault() + .merge( + Resource.create( + Attributes.of(AttributeKey.stringKey("service.name"), "billing-service")))) + .build(); + +OpenTelemetry openTelemetry = + OpenTelemetrySdk.builder().setTracerProvider(tracerProvider).buildAndRegisterGlobal(); +``` + +```java +import com.chargebee.v4.client.ChargebeeClient; +import com.chargebee.v4.telemetry.RequestTelemetryContext; +import com.chargebee.v4.telemetry.RequestTelemetryResult; +import com.chargebee.v4.telemetry.TelemetryAdapter; +import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.common.AttributeKey; +import io.opentelemetry.api.common.Attributes; +import io.opentelemetry.api.common.AttributesBuilder; +import io.opentelemetry.api.trace.Span; +import io.opentelemetry.api.trace.SpanKind; +import io.opentelemetry.api.trace.StatusCode; +import io.opentelemetry.api.trace.Tracer; +import io.opentelemetry.context.Context; +import java.util.Map; + +class OtelTelemetryAdapter implements TelemetryAdapter { + private final OpenTelemetry openTelemetry; + private final Tracer tracer; + + OtelTelemetryAdapter(OpenTelemetry openTelemetry) { + this.openTelemetry = openTelemetry; + this.tracer = openTelemetry.getTracer("chargebee-java"); + } + + @Override + public Object onRequestStart(RequestTelemetryContext ctx, Map requestHeaders) { + AttributesBuilder attrs = Attributes.builder(); + ctx.getStartAttributes().forEach((k, v) -> attrs.put(AttributeKey.stringKey(k), v)); + + Span span = + tracer + .spanBuilder(ctx.getSpanName()) + .setSpanKind(SpanKind.CLIENT) + .setAllAttributes(attrs.build()) + .startSpan(); + + Context context = Context.current().with(span); + openTelemetry + .getPropagators() + .getTextMapPropagator() + .inject(context, requestHeaders, (carrier, key, value) -> carrier.put(key, value)); + + return span; + } + + @Override + public void onRequestEnd(Object handle, RequestTelemetryResult result) { + if (!(handle instanceof Span)) { + return; + } + Span span = (Span) handle; + result + .getEndAttributes() + .forEach( + (k, v) -> { + if (v instanceof String) { + span.setAttribute(k, (String) v); + } else if (v instanceof Long) { + span.setAttribute(k, (Long) v); + } else if (v instanceof Integer) { + span.setAttribute(k, ((Integer) v).longValue()); + } + }); + if (result.getError() != null) { + span.setStatus(StatusCode.ERROR, result.getError().getMessage()); + } else { + span.setStatus(StatusCode.OK); + } + span.end(); + } +} + +ChargebeeClient client = + ChargebeeClient.builder() + .apiKey("{{api-key}}") + .siteName("{{site}}") + .telemetryAdapter(new OtelTelemetryAdapter(openTelemetry)) + .build(); +``` + +Spans are exported by your own OpenTelemetry setup, so they flow to whatever backend you've configured (Datadog, Splunk, Honeycomb, Jaeger, etc.). The Chargebee config above stays the same regardless of backend — refer to your APM vendor's OpenTelemetry/OTLP documentation for exporter endpoints. + ## Features ### SDK Features diff --git a/src/main/java/com/chargebee/v4/client/ChargebeeClient.java b/src/main/java/com/chargebee/v4/client/ChargebeeClient.java index 387793f0a..27a09f0ae 100644 --- a/src/main/java/com/chargebee/v4/client/ChargebeeClient.java +++ b/src/main/java/com/chargebee/v4/client/ChargebeeClient.java @@ -9,6 +9,8 @@ import com.chargebee.v4.exceptions.TimeoutException; import com.chargebee.v4.exceptions.TransportException; import com.chargebee.v4.internal.RetryConfig; +import com.chargebee.v4.telemetry.TelemetryAdapter; +import com.chargebee.v4.telemetry.TelemetryExecutor; import com.chargebee.v4.transport.*; import com.chargebee.v4.transport.Transport; @@ -40,6 +42,7 @@ public final class ChargebeeClient extends ClientMethodsImpl implements AutoClos private final String protocol; private final RequestInterceptor requestInterceptor; private final RequestContext clientHeaders; + private final TelemetryAdapter telemetryAdapter; private final ScheduledExecutorService retryScheduler; // Auto-generated service registry for lazy loading @@ -57,6 +60,7 @@ private ChargebeeClient(Builder builder) { this.protocol = builder.protocol; this.requestInterceptor = builder.requestInterceptor; this.clientHeaders = new RequestContext(builder.clientHeaders.getHeaders()); + this.telemetryAdapter = builder.telemetryAdapter; this.retryScheduler = Executors.newSingleThreadScheduledExecutor(r -> { Thread t = new Thread(r, "chargebee-retry-scheduler"); t.setDaemon(true); @@ -92,6 +96,11 @@ public static Builder builder(String apiKey, String siteName) { public String getProtocol() { return protocol; } public RequestInterceptor getRequestInterceptor() { return requestInterceptor; } public RequestContext getClientHeaders() { return clientHeaders; } + public TelemetryAdapter getTelemetryAdapter() { return telemetryAdapter; } + + public String getSdkVersion() { + return getVersion(); + } @Override public void close() { @@ -303,6 +312,10 @@ public CompletableFuture executeWithInterceptorAsync(Request request) * Send a request with retry logic based on the configured RetryConfig. */ public Response sendWithRetry(Request request) { + return TelemetryExecutor.execute(this, request, this::sendWithRetryInternal); + } + + private Response sendWithRetryInternal(Request request) { Request enrichedRequest = addDefaultHeaders(request); Integer overrideRetries = enrichedRequest.getMaxNetworkRetriesOverride(); @@ -370,6 +383,16 @@ private Request addDefaultHeaders(Request request) { builder.followRedirectsOverride(request.getFollowRedirectsOverride()); } + if (request.getTelemetryResource() != null) { + builder.telemetryResource(request.getTelemetryResource()); + } + if (request.getTelemetryOperation() != null) { + builder.telemetryOperation(request.getTelemetryOperation()); + } + if (request.getTelemetryAdapterOverride() != null) { + builder.telemetryAdapterOverride(request.getTelemetryAdapterOverride()); + } + addStandardHeaders(builder); for (Map.Entry header : request.getHeaders().entrySet()) { @@ -456,6 +479,10 @@ private long calculateBackoffDelay(int attempt) { * Send a request asynchronously with retry logic based on the configured RetryConfig. */ public CompletableFuture sendWithRetryAsync(Request request) { + return TelemetryExecutor.executeAsync(this, request, this::sendWithRetryAsyncInternal); + } + + private CompletableFuture sendWithRetryAsyncInternal(Request request) { Request enrichedRequest = addDefaultHeaders(request); Integer overrideRetries = enrichedRequest.getMaxNetworkRetriesOverride(); @@ -549,6 +576,7 @@ public static final class Builder { private String domainSuffix = "chargebee.com"; private String protocol = "https"; private RequestInterceptor requestInterceptor; + private TelemetryAdapter telemetryAdapter; private final RequestContext clientHeaders = new RequestContext(); private Builder() {} @@ -571,6 +599,7 @@ public Builder timeout(int connectTimeoutMs, int readTimeoutMs) { public Builder domainSuffix(String domainSuffix) { this.domainSuffix = domainSuffix; return this; } public Builder protocol(String protocol) { this.protocol = protocol; return this; } public Builder requestInterceptor(RequestInterceptor requestInterceptor) { this.requestInterceptor = requestInterceptor; return this; } + public Builder telemetryAdapter(TelemetryAdapter telemetryAdapter) { this.telemetryAdapter = telemetryAdapter; return this; } // Header helpers public Builder header(String name, String value) { diff --git a/src/main/java/com/chargebee/v4/client/request/RequestOptions.java b/src/main/java/com/chargebee/v4/client/request/RequestOptions.java index 501b037d1..f0b8123ad 100644 --- a/src/main/java/com/chargebee/v4/client/request/RequestOptions.java +++ b/src/main/java/com/chargebee/v4/client/request/RequestOptions.java @@ -1,6 +1,7 @@ package com.chargebee.v4.client.request; import com.chargebee.v4.transport.RequestLogger; +import com.chargebee.v4.telemetry.TelemetryAdapter; import java.util.HashMap; import java.util.HashSet; import java.util.Map; @@ -21,6 +22,7 @@ public final class RequestOptions { private final Boolean followRedirects; private final Boolean gzipCompression; private final RequestLogger requestLogger; + private final TelemetryAdapter telemetryAdapter; private RequestOptions( Map headers, @@ -32,7 +34,8 @@ private RequestOptions( Integer readTimeoutMs, Boolean followRedirects, Boolean gzipCompression, - RequestLogger requestLogger + RequestLogger requestLogger, + TelemetryAdapter telemetryAdapter ) { // Java 8 compatibility - use HashMap constructor instead of Map.copyOf this.headers = new HashMap<>(headers); @@ -45,10 +48,11 @@ private RequestOptions( this.followRedirects = followRedirects; this.gzipCompression = gzipCompression; this.requestLogger = requestLogger; + this.telemetryAdapter = telemetryAdapter; } public static RequestOptions empty() { - return new RequestOptions(new HashMap<>(), null, null, null, null, null, null, null, null, null); + return new RequestOptions(new HashMap<>(), null, null, null, null, null, null, null, null, null, null); } public static Builder builder() { @@ -58,13 +62,13 @@ public static Builder builder() { public RequestOptions withHeader(String key, String value) { Map copy = new HashMap<>(headers); copy.put(key, value); - return new RequestOptions(copy, maxNetworkRetries, retryEnabled, retryBaseDelayMs, retryOnStatus, connectTimeoutMs, readTimeoutMs, followRedirects, gzipCompression, requestLogger); + return new RequestOptions(copy, maxNetworkRetries, retryEnabled, retryBaseDelayMs, retryOnStatus, connectTimeoutMs, readTimeoutMs, followRedirects, gzipCompression, requestLogger, telemetryAdapter); } public RequestOptions withHeaders(Map newHeaders) { Map copy = new HashMap<>(headers); copy.putAll(newHeaders); - return new RequestOptions(copy, maxNetworkRetries, retryEnabled, retryBaseDelayMs, retryOnStatus, connectTimeoutMs, readTimeoutMs, followRedirects, gzipCompression, requestLogger); + return new RequestOptions(copy, maxNetworkRetries, retryEnabled, retryBaseDelayMs, retryOnStatus, connectTimeoutMs, readTimeoutMs, followRedirects, gzipCompression, requestLogger, telemetryAdapter); } public Map getHeaders() { @@ -116,6 +120,10 @@ public RequestLogger getRequestLogger() { return requestLogger; } + public TelemetryAdapter getTelemetryAdapter() { + return telemetryAdapter; + } + public static final class Builder { private final Map headers = new HashMap<>(); private Integer maxNetworkRetries; @@ -127,6 +135,7 @@ public static final class Builder { private Boolean followRedirects; private Boolean gzipCompression; private RequestLogger requestLogger; + private TelemetryAdapter telemetryAdapter; public Builder header(String name, String value) { if (name != null && value != null) { @@ -222,8 +231,13 @@ public Builder requestLogger(RequestLogger requestLogger) { return this; } + public Builder telemetryAdapter(TelemetryAdapter telemetryAdapter) { + this.telemetryAdapter = telemetryAdapter; + return this; + } + public RequestOptions build() { - return new RequestOptions(headers, maxNetworkRetries, retryEnabled, retryBaseDelayMs, retryOnStatus, connectTimeoutMs, readTimeoutMs, followRedirects, gzipCompression, requestLogger); + return new RequestOptions(headers, maxNetworkRetries, retryEnabled, retryBaseDelayMs, retryOnStatus, connectTimeoutMs, readTimeoutMs, followRedirects, gzipCompression, requestLogger, telemetryAdapter); } } } \ No newline at end of file diff --git a/src/main/java/com/chargebee/v4/telemetry/RequestTelemetryContext.java b/src/main/java/com/chargebee/v4/telemetry/RequestTelemetryContext.java new file mode 100644 index 000000000..b73db0185 --- /dev/null +++ b/src/main/java/com/chargebee/v4/telemetry/RequestTelemetryContext.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 2026 Chargebee Inc. + */ + +package com.chargebee.v4.telemetry; + +import java.util.Collections; +import java.util.Map; + +/** Context passed to {@link TelemetryAdapter#onRequestStart}. */ +public final class RequestTelemetryContext { + + private final String spanName; + private final String resource; + private final String operation; + private final String httpMethod; + private final String httpUrl; + private final String serverAddress; + private final String chargebeeSite; + private final String chargebeeApiVersion; + private final String sdkName; + private final String sdkVersion; + private final Map startAttributes; + + public RequestTelemetryContext( + String spanName, + String resource, + String operation, + String httpMethod, + String httpUrl, + String serverAddress, + String chargebeeSite, + String chargebeeApiVersion, + String sdkName, + String sdkVersion, + Map startAttributes) { + this.spanName = spanName; + this.resource = resource; + this.operation = operation; + this.httpMethod = httpMethod; + this.httpUrl = httpUrl; + this.serverAddress = serverAddress; + this.chargebeeSite = chargebeeSite; + this.chargebeeApiVersion = chargebeeApiVersion; + this.sdkName = sdkName; + this.sdkVersion = sdkVersion; + this.startAttributes = + startAttributes == null + ? Collections.emptyMap() + : Collections.unmodifiableMap(startAttributes); + } + + public String getSpanName() { + return spanName; + } + + public String getResource() { + return resource; + } + + public String getOperation() { + return operation; + } + + public String getHttpMethod() { + return httpMethod; + } + + public String getHttpUrl() { + return httpUrl; + } + + public String getServerAddress() { + return serverAddress; + } + + public String getChargebeeSite() { + return chargebeeSite; + } + + public String getChargebeeApiVersion() { + return chargebeeApiVersion; + } + + public String getSdkName() { + return sdkName; + } + + public String getSdkVersion() { + return sdkVersion; + } + + /** Prebuilt span attributes — pass these to your tracer. */ + public Map getStartAttributes() { + return startAttributes; + } +} diff --git a/src/main/java/com/chargebee/v4/telemetry/RequestTelemetryError.java b/src/main/java/com/chargebee/v4/telemetry/RequestTelemetryError.java new file mode 100644 index 000000000..82c8cff67 --- /dev/null +++ b/src/main/java/com/chargebee/v4/telemetry/RequestTelemetryError.java @@ -0,0 +1,44 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2026 Chargebee Inc. + */ + +package com.chargebee.v4.telemetry; + +/** Error details attached to {@link RequestTelemetryResult} on failed requests. */ +public final class RequestTelemetryError { + + private final String message; + private final String chargebeeErrorCode; + private final String chargebeeApiErrorType; + private final String chargebeeErrorParam; + + public RequestTelemetryError( + String message, + String chargebeeErrorCode, + String chargebeeApiErrorType, + String chargebeeErrorParam) { + this.message = message; + this.chargebeeErrorCode = chargebeeErrorCode; + this.chargebeeApiErrorType = chargebeeApiErrorType; + this.chargebeeErrorParam = chargebeeErrorParam; + } + + public String getMessage() { + return message; + } + + public String getChargebeeErrorCode() { + return chargebeeErrorCode; + } + + public String getChargebeeApiErrorType() { + return chargebeeApiErrorType; + } + + public String getChargebeeErrorParam() { + return chargebeeErrorParam; + } +} diff --git a/src/main/java/com/chargebee/v4/telemetry/RequestTelemetryResult.java b/src/main/java/com/chargebee/v4/telemetry/RequestTelemetryResult.java new file mode 100644 index 000000000..e949d9228 --- /dev/null +++ b/src/main/java/com/chargebee/v4/telemetry/RequestTelemetryResult.java @@ -0,0 +1,49 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2026 Chargebee Inc. + */ + +package com.chargebee.v4.telemetry; + +import java.util.Collections; +import java.util.Map; + +/** Result passed to {@link TelemetryAdapter#onRequestEnd}. */ +public final class RequestTelemetryResult { + + private final int httpStatusCode; + private final long durationMs; + private final RequestTelemetryError error; + private final Map endAttributes; + + public RequestTelemetryResult( + int httpStatusCode, + long durationMs, + RequestTelemetryError error, + Map endAttributes) { + this.httpStatusCode = httpStatusCode; + this.durationMs = durationMs; + this.error = error; + this.endAttributes = + endAttributes == null ? Collections.emptyMap() : Collections.unmodifiableMap(endAttributes); + } + + public int getHttpStatusCode() { + return httpStatusCode; + } + + public long getDurationMs() { + return durationMs; + } + + public RequestTelemetryError getError() { + return error; + } + + /** Prebuilt span attributes — pass these to your tracer. */ + public Map getEndAttributes() { + return endAttributes; + } +} diff --git a/src/main/java/com/chargebee/v4/telemetry/TelemetryAdapter.java b/src/main/java/com/chargebee/v4/telemetry/TelemetryAdapter.java new file mode 100644 index 000000000..4d5c5c254 --- /dev/null +++ b/src/main/java/com/chargebee/v4/telemetry/TelemetryAdapter.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 2026 Chargebee Inc. + */ + +package com.chargebee.v4.telemetry; + +import java.util.Map; + +/** + * Optional telemetry adapter for observability integrations (e.g. OpenTelemetry). + * + *

When not configured, the SDK skips all telemetry work — zero overhead. The SDK stores the + * adapter by reference and never clones or deep-copies it. + * + *

Implementations may inject W3C trace context headers ({@code traceparent}, {@code tracestate}) + * into {@code requestHeaders} during {@link #onRequestStart}. + */ +public interface TelemetryAdapter { + + /** + * Called once per SDK API call before the request is sent (including before retries). + * + * @param context telemetry context with prebuilt start attributes + * @param requestHeaders mutable headers map for trace propagation injection + * @return an opaque handle passed back to {@link #onRequestEnd}, or {@code null} + */ + Object onRequestStart(RequestTelemetryContext context, Map requestHeaders); + + /** + * Called once per SDK API call after the final response or terminal failure. + * + * @param handle value returned from {@link #onRequestStart}, may be {@code null} + * @param result telemetry result with prebuilt end attributes + */ + void onRequestEnd(Object handle, RequestTelemetryResult result); +} diff --git a/src/main/java/com/chargebee/v4/telemetry/TelemetryAttributeKeys.java b/src/main/java/com/chargebee/v4/telemetry/TelemetryAttributeKeys.java new file mode 100644 index 000000000..8d2e1539f --- /dev/null +++ b/src/main/java/com/chargebee/v4/telemetry/TelemetryAttributeKeys.java @@ -0,0 +1,43 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2026 Chargebee Inc. + */ + +package com.chargebee.v4.telemetry; + +/** + * Span attribute keys shared across Chargebee SDKs. + * + *

Follows stable OpenTelemetry HTTP semantic conventions where applicable, plus the {@code + * chargebee.*} namespace for Chargebee-specific data. See docs/otel-request-telemetry-schema.yaml + * for the cross-SDK contract. + */ +public final class TelemetryAttributeKeys { + + /** SDK identifier value recorded on {@code chargebee.sdk.name} spans. */ + public static final String SDK_NAME = "chargebee-java"; + + /** Standard span name prefix: chargebee.{resource}.{operation} */ + public static final String TELEMETRY_SPAN_NAME_PREFIX = "chargebee"; + + public static final String URL_FULL = "url.full"; + public static final String HTTP_REQUEST_METHOD = "http.request.method"; + public static final String HTTP_RESPONSE_STATUS_CODE = "http.response.status_code"; + public static final String SERVER_ADDRESS = "server.address"; + public static final String ERROR_TYPE = "error.type"; + public static final String CHARGEBEE_SITE = "chargebee.site"; + public static final String CHARGEBEE_API_VERSION = "chargebee.api_version"; + public static final String CHARGEBEE_RESOURCE = "chargebee.resource"; + public static final String CHARGEBEE_OPERATION = "chargebee.operation"; + public static final String CHARGEBEE_SDK_NAME = "chargebee.sdk.name"; + public static final String CHARGEBEE_SDK_VERSION = "chargebee.sdk.version"; + public static final String CHARGEBEE_ERROR_CODE = "chargebee.error.code"; + public static final String CHARGEBEE_ERROR_TYPE = "chargebee.error.type"; + public static final String CHARGEBEE_ERROR_PARAM = "chargebee.error.param"; + + private TelemetryAttributeKeys() { + // constants only + } +} diff --git a/src/main/java/com/chargebee/v4/telemetry/TelemetryExecutor.java b/src/main/java/com/chargebee/v4/telemetry/TelemetryExecutor.java new file mode 100644 index 000000000..1e146cfbb --- /dev/null +++ b/src/main/java/com/chargebee/v4/telemetry/TelemetryExecutor.java @@ -0,0 +1,162 @@ +/* + * Copyright 2026 Chargebee Inc. + */ + +package com.chargebee.v4.telemetry; + +import com.chargebee.v4.client.ChargebeeClient; +import com.chargebee.v4.transport.Request; +import com.chargebee.v4.transport.Response; +import java.net.URI; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** Executes Chargebee API calls with optional telemetry adapter hooks. */ +public final class TelemetryExecutor { + + private static final Logger LOGGER = Logger.getLogger(TelemetryExecutor.class.getName()); + + private TelemetryExecutor() {} + + public static Response execute( + ChargebeeClient client, Request request, Function action) { + TelemetryAdapter adapter = resolveAdapter(client, request); + if (adapter == null || !request.hasTelemetryMetadata()) { + return action.apply(request); + } + + long startTime = System.currentTimeMillis(); + Map telemetryHeaders = new HashMap<>(); + Object handle = startTelemetry(client, adapter, request, telemetryHeaders); + Request requestWithHeaders = withHeaders(request, telemetryHeaders); + + try { + Response response = action.apply(requestWithHeaders); + endTelemetrySuccess(adapter, handle, startTime, response.getStatusCode()); + return response; + } catch (RuntimeException e) { + endTelemetryFailure(adapter, handle, startTime, e); + throw e; + } + } + + public static CompletableFuture executeAsync( + ChargebeeClient client, + Request request, + Function> action) { + TelemetryAdapter adapter = resolveAdapter(client, request); + if (adapter == null || !request.hasTelemetryMetadata()) { + return action.apply(request); + } + + long startTime = System.currentTimeMillis(); + Map telemetryHeaders = new HashMap<>(); + Object handle = startTelemetry(client, adapter, request, telemetryHeaders); + Request requestWithHeaders = withHeaders(request, telemetryHeaders); + + return action + .apply(requestWithHeaders) + .whenComplete( + (response, throwable) -> { + if (throwable != null) { + Throwable cause = throwable.getCause() != null ? throwable.getCause() : throwable; + endTelemetryFailure(adapter, handle, startTime, cause); + } else { + endTelemetrySuccess(adapter, handle, startTime, response.getStatusCode()); + } + }); + } + + public static TelemetryAdapter resolveAdapter(ChargebeeClient client, Request request) { + if (request.getTelemetryAdapterOverride() != null) { + return request.getTelemetryAdapterOverride(); + } + return client.getTelemetryAdapter(); + } + + private static Object startTelemetry( + ChargebeeClient client, + TelemetryAdapter adapter, + Request request, + Map telemetryHeaders) { + try { + RequestTelemetryContext context = buildContext(client, request); + return adapter.onRequestStart(context, telemetryHeaders); + } catch (Exception err) { + LOGGER.log( + Level.WARNING, + "Telemetry adapter onRequestStart failed: " + + err.getMessage() + + ". Continuing without telemetry.", + err); + return null; + } + } + + private static void endTelemetrySuccess( + TelemetryAdapter adapter, Object handle, long startTime, int httpStatusCode) { + try { + adapter.onRequestEnd( + handle, + TelemetrySupport.buildRequestTelemetryResult( + new TelemetrySupport.RequestTelemetryResultInput( + httpStatusCode, System.currentTimeMillis() - startTime, null))); + } catch (Exception err) { + LOGGER.log(Level.WARNING, "Telemetry adapter onRequestEnd failed: " + err.getMessage(), err); + } + } + + private static void endTelemetryFailure( + TelemetryAdapter adapter, Object handle, long startTime, Throwable err) { + Integer status = TelemetrySupport.extractHttpStatusCode(err); + int httpStatusCode = status != null ? status : 500; + try { + adapter.onRequestEnd( + handle, + TelemetrySupport.buildRequestTelemetryResult( + new TelemetrySupport.RequestTelemetryResultInput( + httpStatusCode, + System.currentTimeMillis() - startTime, + TelemetrySupport.extractRequestTelemetryError(err)))); + } catch (Exception telemetryErr) { + LOGGER.log( + Level.WARNING, + "Telemetry adapter onRequestEnd failed: " + telemetryErr.getMessage(), + telemetryErr); + } + } + + static RequestTelemetryContext buildContext(ChargebeeClient client, Request request) { + URI uri = URI.create(request.getUrl()); + String httpUrl = uri.getScheme() + "://" + uri.getHost() + uri.getPath(); + String apiPath = extractApiPath(client.getBaseUrl()); + return TelemetrySupport.buildRequestTelemetryContext( + new TelemetrySupport.BuildRequestTelemetryContextInput( + request.getTelemetryResource(), + request.getTelemetryOperation(), + request.getMethod(), + httpUrl, + uri.getHost(), + client.getSiteName(), + TelemetrySupport.resolveChargebeeApiVersion(apiPath), + client.getSdkVersion())); + } + + private static String extractApiPath(String baseUrl) { + URI uri = URI.create(baseUrl); + String path = uri.getPath(); + return path != null && !path.isEmpty() ? path : "/api/v2"; + } + + static Request withHeaders(Request request, Map headers) { + Request updated = request; + for (Map.Entry header : headers.entrySet()) { + updated = updated.withHeader(header.getKey(), header.getValue()); + } + return updated; + } +} diff --git a/src/main/java/com/chargebee/v4/telemetry/TelemetrySupport.java b/src/main/java/com/chargebee/v4/telemetry/TelemetrySupport.java new file mode 100644 index 000000000..13809fb5b --- /dev/null +++ b/src/main/java/com/chargebee/v4/telemetry/TelemetrySupport.java @@ -0,0 +1,209 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2026 Chargebee Inc. + */ + +package com.chargebee.v4.telemetry; + +import com.chargebee.v4.exceptions.APIException; +import com.chargebee.v4.exceptions.HttpException; +import java.util.HashMap; +import java.util.Map; + +/** Helpers for building standardized Chargebee telemetry context and results. */ +public final class TelemetrySupport { + + private TelemetrySupport() { + // utility class + } + + /** Input for {@link #buildRequestTelemetryContext(BuildRequestTelemetryContextInput)}. */ + public static final class BuildRequestTelemetryContextInput { + private final String resource; + private final String operation; + private final String httpMethod; + private final String httpUrl; + private final String serverAddress; + private final String chargebeeSite; + private final String chargebeeApiVersion; + private final String sdkVersion; + + public BuildRequestTelemetryContextInput( + String resource, + String operation, + String httpMethod, + String httpUrl, + String serverAddress, + String chargebeeSite, + String chargebeeApiVersion, + String sdkVersion) { + this.resource = resource; + this.operation = operation; + this.httpMethod = httpMethod; + this.httpUrl = httpUrl; + this.serverAddress = serverAddress; + this.chargebeeSite = chargebeeSite; + this.chargebeeApiVersion = chargebeeApiVersion; + this.sdkVersion = sdkVersion; + } + + public String getResource() { + return resource; + } + + public String getOperation() { + return operation; + } + + public String getHttpMethod() { + return httpMethod; + } + + public String getHttpUrl() { + return httpUrl; + } + + public String getServerAddress() { + return serverAddress; + } + + public String getChargebeeSite() { + return chargebeeSite; + } + + public String getChargebeeApiVersion() { + return chargebeeApiVersion; + } + + public String getSdkVersion() { + return sdkVersion; + } + } + + /** Input for {@link #buildRequestTelemetryResult(RequestTelemetryResultInput)}. */ + public static final class RequestTelemetryResultInput { + private final int httpStatusCode; + private final long durationMs; + private final RequestTelemetryError error; + + public RequestTelemetryResultInput( + int httpStatusCode, long durationMs, RequestTelemetryError error) { + this.httpStatusCode = httpStatusCode; + this.durationMs = durationMs; + this.error = error; + } + + public int getHttpStatusCode() { + return httpStatusCode; + } + + public long getDurationMs() { + return durationMs; + } + + public RequestTelemetryError getError() { + return error; + } + } + + public static String buildSpanName(String resource, String operation) { + return TelemetryAttributeKeys.TELEMETRY_SPAN_NAME_PREFIX + "." + resource + "." + operation; + } + + public static String resolveChargebeeApiVersion(String apiPath) { + return "/api/v1".equals(apiPath) ? "v1" : "v2"; + } + + public static Map buildRequestStartSpanAttributes( + BuildRequestTelemetryContextInput input) { + Map attributes = new HashMap<>(); + attributes.put(TelemetryAttributeKeys.URL_FULL, input.getHttpUrl()); + attributes.put(TelemetryAttributeKeys.HTTP_REQUEST_METHOD, input.getHttpMethod()); + attributes.put(TelemetryAttributeKeys.SERVER_ADDRESS, input.getServerAddress()); + attributes.put(TelemetryAttributeKeys.CHARGEBEE_SITE, input.getChargebeeSite()); + attributes.put(TelemetryAttributeKeys.CHARGEBEE_API_VERSION, input.getChargebeeApiVersion()); + attributes.put(TelemetryAttributeKeys.CHARGEBEE_RESOURCE, input.getResource()); + attributes.put(TelemetryAttributeKeys.CHARGEBEE_OPERATION, input.getOperation()); + attributes.put(TelemetryAttributeKeys.CHARGEBEE_SDK_NAME, TelemetryAttributeKeys.SDK_NAME); + attributes.put(TelemetryAttributeKeys.CHARGEBEE_SDK_VERSION, input.getSdkVersion()); + return attributes; + } + + public static Map buildRequestEndSpanAttributes( + RequestTelemetryResultInput result) { + Map attributes = new HashMap<>(); + attributes.put(TelemetryAttributeKeys.HTTP_RESPONSE_STATUS_CODE, result.getHttpStatusCode()); + + RequestTelemetryError error = result.getError(); + if (error != null) { + attributes.put(TelemetryAttributeKeys.ERROR_TYPE, String.valueOf(result.getHttpStatusCode())); + + if (error.getChargebeeErrorCode() != null) { + attributes.put(TelemetryAttributeKeys.CHARGEBEE_ERROR_CODE, error.getChargebeeErrorCode()); + } + if (error.getChargebeeApiErrorType() != null) { + attributes.put( + TelemetryAttributeKeys.CHARGEBEE_ERROR_TYPE, error.getChargebeeApiErrorType()); + } + if (error.getChargebeeErrorParam() != null) { + attributes.put( + TelemetryAttributeKeys.CHARGEBEE_ERROR_PARAM, error.getChargebeeErrorParam()); + } + } + + return attributes; + } + + public static RequestTelemetryContext buildRequestTelemetryContext( + BuildRequestTelemetryContextInput input) { + return new RequestTelemetryContext( + buildSpanName(input.getResource(), input.getOperation()), + input.getResource(), + input.getOperation(), + input.getHttpMethod(), + input.getHttpUrl(), + input.getServerAddress(), + input.getChargebeeSite(), + input.getChargebeeApiVersion(), + TelemetryAttributeKeys.SDK_NAME, + input.getSdkVersion(), + buildRequestStartSpanAttributes(input)); + } + + public static RequestTelemetryResult buildRequestTelemetryResult( + RequestTelemetryResultInput result) { + return new RequestTelemetryResult( + result.getHttpStatusCode(), + result.getDurationMs(), + result.getError(), + buildRequestEndSpanAttributes(result)); + } + + public static RequestTelemetryError extractRequestTelemetryError(Throwable err) { + if (err == null) { + return null; + } + + String message = err.getMessage() != null ? err.getMessage() : "Chargebee API request failed"; + + if (err instanceof APIException) { + APIException apiException = (APIException) err; + return new RequestTelemetryError( + message, + apiException.getApiErrorCodeRaw(), + apiException.getType(), + apiException.getParam()); + } + + return new RequestTelemetryError(message, null, null, null); + } + + public static Integer extractHttpStatusCode(Throwable err) { + if (err instanceof HttpException) { + return ((HttpException) err).getStatusCode(); + } + return null; + } +} diff --git a/src/main/java/com/chargebee/v4/transport/Request.java b/src/main/java/com/chargebee/v4/transport/Request.java index f10474f4f..016997aaf 100644 --- a/src/main/java/com/chargebee/v4/transport/Request.java +++ b/src/main/java/com/chargebee/v4/transport/Request.java @@ -1,5 +1,6 @@ package com.chargebee.v4.transport; +import com.chargebee.v4.telemetry.TelemetryAdapter; import java.util.*; /** @@ -15,6 +16,9 @@ public final class Request { private final RequestBody body; private final Integer maxNetworkRetriesOverride; private final Boolean followRedirectsOverride; + private final String telemetryResource; + private final String telemetryOperation; + private final TelemetryAdapter telemetryAdapterOverride; private Request(Builder builder) { this.method = builder.method; @@ -24,6 +28,9 @@ private Request(Builder builder) { this.body = builder.body; this.maxNetworkRetriesOverride = builder.maxNetworkRetriesOverride; this.followRedirectsOverride = builder.followRedirectsOverride; + this.telemetryResource = builder.telemetryResource; + this.telemetryOperation = builder.telemetryOperation; + this.telemetryAdapterOverride = builder.telemetryAdapterOverride; } public String getMethod() { @@ -53,6 +60,22 @@ public Integer getMaxNetworkRetriesOverride() { public Boolean getFollowRedirectsOverride() { return followRedirectsOverride; } + + public String getTelemetryResource() { + return telemetryResource; + } + + public String getTelemetryOperation() { + return telemetryOperation; + } + + public TelemetryAdapter getTelemetryAdapterOverride() { + return telemetryAdapterOverride; + } + + public boolean hasTelemetryMetadata() { + return telemetryResource != null && telemetryOperation != null; + } public Request withHeader(String key, String value) { Map newHeaders = new HashMap<>(this.headers); @@ -68,6 +91,9 @@ private Request(Request source, Map newHeaders) { this.body = source.body; this.maxNetworkRetriesOverride = source.maxNetworkRetriesOverride; this.followRedirectsOverride = source.followRedirectsOverride; + this.telemetryResource = source.telemetryResource; + this.telemetryOperation = source.telemetryOperation; + this.telemetryAdapterOverride = source.telemetryAdapterOverride; } public static Builder builder() { @@ -82,6 +108,9 @@ public static class Builder { private RequestBody body; private Integer maxNetworkRetriesOverride; private Boolean followRedirectsOverride; + private String telemetryResource; + private String telemetryOperation; + private TelemetryAdapter telemetryAdapterOverride; public Builder method(String method) { this.method = method; @@ -142,6 +171,21 @@ public Builder followRedirectsOverride(Boolean followRedirects) { this.followRedirectsOverride = followRedirects; return this; } + + public Builder telemetryResource(String telemetryResource) { + this.telemetryResource = telemetryResource; + return this; + } + + public Builder telemetryOperation(String telemetryOperation) { + this.telemetryOperation = telemetryOperation; + return this; + } + + public Builder telemetryAdapterOverride(TelemetryAdapter telemetryAdapterOverride) { + this.telemetryAdapterOverride = telemetryAdapterOverride; + return this; + } public Request build() { if (url == null) { diff --git a/src/test/java/com/chargebee/v4/telemetry/TelemetryExecutorTest.java b/src/test/java/com/chargebee/v4/telemetry/TelemetryExecutorTest.java new file mode 100644 index 000000000..bd5ed3aec --- /dev/null +++ b/src/test/java/com/chargebee/v4/telemetry/TelemetryExecutorTest.java @@ -0,0 +1,241 @@ +package com.chargebee.v4.telemetry; + +import static org.junit.jupiter.api.Assertions.*; + +import com.chargebee.v4.client.ChargebeeClient; +import com.chargebee.v4.exceptions.NetworkException; +import com.chargebee.v4.internal.RetryConfig; +import com.chargebee.v4.transport.Request; +import com.chargebee.v4.transport.Response; +import com.chargebee.v4.transport.Transport; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.LogRecord; +import java.util.logging.Logger; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +@DisplayName("Telemetry integration") +class TelemetryExecutorTest { + + private static final class RecordingTransport implements Transport { + private final List requests = new ArrayList<>(); + + @Override + public Response send(Request request) { + requests.add(request); + return new Response(200, new HashMap<>(), "{}".getBytes()); + } + + @Override + public CompletableFuture sendAsync(Request request) { + return CompletableFuture.completedFuture(send(request)); + } + } + + @Test + @DisplayName("Should skip telemetry when no adapter is configured") + void shouldSkipWhenNoAdapter() { + RecordingTransport transport = new RecordingTransport(); + ChargebeeClient client = + ChargebeeClient.builder("key_test", "acme") + .transport(transport) + .retry(RetryConfig.builder().enabled(false).build()) + .build(); + + Request request = + Request.builder() + .method("GET") + .url("https://acme.chargebee.com/api/v2/customers") + .telemetryResource("customer") + .telemetryOperation("list") + .build(); + + client.sendWithRetry(request); + assertEquals(1, transport.requests.size()); + } + + @Test + @DisplayName("Should call adapter once per API call including retries") + void shouldCallAdapterOnceIncludingRetries() { + RecordingTransport transport = new RecordingTransport(); + List events = new ArrayList<>(); + List allRequests = new ArrayList<>(); + RequestTelemetryContext[] capturedContext = new RequestTelemetryContext[1]; + RequestTelemetryResult[] capturedResult = new RequestTelemetryResult[1]; + + TelemetryAdapter adapter = + new TelemetryAdapter() { + @Override + public Object onRequestStart( + RequestTelemetryContext context, Map requestHeaders) { + events.add("start"); + capturedContext[0] = context; + requestHeaders.put("traceparent", "00-test-trace"); + return "span-1"; + } + + @Override + public void onRequestEnd(Object handle, RequestTelemetryResult result) { + events.add("end"); + capturedResult[0] = result; + } + }; + + ChargebeeClient client = + ChargebeeClient.builder("key_test", "acme") + .transport( + new Transport() { + private int attempt; + + @Override + public Response send(Request request) { + allRequests.add(request); + attempt++; + if (attempt == 1) { + throw new NetworkException("connection reset", new Exception(), request); + } + transport.requests.add(request); + return new Response(200, new HashMap<>(), "{\"list\":[]}".getBytes()); + } + + @Override + public CompletableFuture sendAsync(Request request) { + return CompletableFuture.completedFuture(send(request)); + } + }) + .retry(RetryConfig.builder().enabled(true).maxRetries(2).baseDelayMs(0).build()) + .telemetryAdapter(adapter) + .build(); + + Request request = + Request.builder() + .method("GET") + .url("https://acme.chargebee.com/api/v2/customers") + .telemetryResource("customer") + .telemetryOperation("list") + .build(); + + client.sendWithRetry(request); + + assertEquals(List.of("start", "end"), events); + assertEquals("chargebee.customer.list", capturedContext[0].getSpanName()); + assertEquals("customer", capturedContext[0].getResource()); + assertEquals("list", capturedContext[0].getOperation()); + assertEquals("acme", capturedContext[0].getChargebeeSite()); + assertTrue(capturedContext[0].getStartAttributes().get("url.full").startsWith("https://acme.chargebee.com")); + assertEquals(200, capturedResult[0].getHttpStatusCode()); + assertEquals(2, allRequests.size()); + assertEquals("00-test-trace", allRequests.get(0).getHeaders().get("traceparent")); + assertEquals("00-test-trace", allRequests.get(1).getHeaders().get("traceparent")); + } + + @Test + @DisplayName("Should not fail API call when adapter hooks throw") + void shouldNotFailWhenAdapterThrows() { + ChargebeeClient client = + ChargebeeClient.builder("key_test", "acme") + .transport(new RecordingTransport()) + .retry(RetryConfig.builder().enabled(false).build()) + .telemetryAdapter( + new TelemetryAdapter() { + @Override + public Object onRequestStart( + RequestTelemetryContext context, Map requestHeaders) { + throw new RuntimeException("start failed"); + } + + @Override + public void onRequestEnd(Object handle, RequestTelemetryResult result) { + throw new RuntimeException("end failed"); + } + }) + .build(); + + Request request = + Request.builder() + .method("GET") + .url("https://acme.chargebee.com/api/v2/customers") + .telemetryResource("customer") + .telemetryOperation("list") + .build(); + + assertDoesNotThrow(() -> client.sendWithRetry(request)); + } + + @Test + @DisplayName("Should log adapter failures at WARNING (not SEVERE) and still return the response") + void shouldLogAdapterFailureAtWarning() { + Logger logger = Logger.getLogger(TelemetryExecutor.class.getName()); + List records = new ArrayList<>(); + Handler captor = + new Handler() { + @Override + public void publish(LogRecord record) { + records.add(record); + } + + @Override + public void flush() {} + + @Override + public void close() {} + }; + Level previousLevel = logger.getLevel(); + boolean previousUseParent = logger.getUseParentHandlers(); + logger.addHandler(captor); + logger.setLevel(Level.ALL); + // Suppress propagation so the captured exception is not also printed to the console during tests. + logger.setUseParentHandlers(false); + + try { + ChargebeeClient client = + ChargebeeClient.builder("key_test", "acme") + .transport(new RecordingTransport()) + .retry(RetryConfig.builder().enabled(false).build()) + .telemetryAdapter( + new TelemetryAdapter() { + @Override + public Object onRequestStart( + RequestTelemetryContext context, Map requestHeaders) { + throw new RuntimeException("start failed"); + } + + @Override + public void onRequestEnd(Object handle, RequestTelemetryResult result) {} + }) + .build(); + + Request request = + Request.builder() + .method("GET") + .url("https://acme.chargebee.com/api/v2/customers") + .telemetryResource("customer") + .telemetryOperation("list") + .build(); + + Response response = client.sendWithRetry(request); + + assertEquals(200, response.getStatusCode()); + assertTrue( + records.stream() + .anyMatch( + r -> + r.getLevel() == Level.WARNING + && r.getMessage().contains("onRequestStart failed")), + "expected a WARNING log for the adapter failure"); + assertTrue( + records.stream().noneMatch(r -> r.getLevel() == Level.SEVERE), + "telemetry failures must not be logged at SEVERE"); + } finally { + logger.removeHandler(captor); + logger.setLevel(previousLevel); + logger.setUseParentHandlers(previousUseParent); + } + } +} From 68343d76ddaccfc3ac9cc8c3c16405284685bc64 Mon Sep 17 00:00:00 2001 From: cb-karthikp Date: Sun, 21 Jun 2026 21:56:04 +0530 Subject: [PATCH 2/7] Service wrapper change --- .../AdditionalBillingLogiqService.java | 16 +- .../chargebee/v4/services/AddonService.java | 42 +- .../chargebee/v4/services/AddressService.java | 11 +- .../chargebee/v4/services/AlertService.java | 48 ++- .../v4/services/AlertStatusService.java | 32 +- .../v4/services/AttachedItemService.java | 41 +- .../services/BrandConfigurationService.java | 16 +- .../v4/services/BusinessEntityService.java | 31 +- .../v4/services/BusinessProfileService.java | 16 +- .../chargebee/v4/services/CardService.java | 32 +- .../chargebee/v4/services/CommentService.java | 22 +- .../v4/services/ConfigurationService.java | 13 +- .../v4/services/CouponCodeService.java | 26 +- .../chargebee/v4/services/CouponService.java | 66 +-- .../v4/services/CouponSetService.java | 48 +-- .../v4/services/CreditNoteService.java | 128 +++--- .../v4/services/CsvTaxRuleService.java | 8 +- .../v4/services/CurrencyService.java | 41 +- .../services/CustomerEntitlementService.java | 16 +- .../v4/services/CustomerService.java | 223 +++++----- .../v4/services/DifferentialPriceService.java | 50 ++- .../services/EntitlementOverrideService.java | 32 +- .../v4/services/EntitlementService.java | 18 +- .../v4/services/EstimateService.java | 254 ++++++++---- .../chargebee/v4/services/EventService.java | 12 +- .../chargebee/v4/services/ExportService.java | 199 ++++++--- .../chargebee/v4/services/FeatureService.java | 44 +- .../v4/services/FullExportService.java | 12 +- .../chargebee/v4/services/GiftService.java | 61 ++- .../v4/services/HostedPageService.java | 280 ++++++++++--- .../v4/services/InAppSubscriptionService.java | 34 +- .../chargebee/v4/services/InvoiceService.java | 383 ++++++++++-------- .../v4/services/ItemEntitlementService.java | 50 ++- .../v4/services/ItemFamilyService.java | 36 +- .../v4/services/ItemPriceService.java | 63 +-- .../chargebee/v4/services/ItemService.java | 32 +- .../chargebee/v4/services/MediaService.java | 8 +- .../v4/services/NonSubscriptionService.java | 8 +- .../v4/services/OfferEventService.java | 11 +- .../v4/services/OfferFulfillmentService.java | 39 +- .../OmnichannelOneTimeOrderService.java | 20 +- .../OmnichannelSubscriptionItemService.java | 18 +- .../OmnichannelSubscriptionService.java | 49 ++- .../chargebee/v4/services/OrderService.java | 97 +++-- .../v4/services/PaymentIntentService.java | 25 +- .../PaymentScheduleSchemeService.java | 22 +- .../v4/services/PaymentSourceService.java | 163 +++++--- .../v4/services/PaymentVoucherService.java | 50 ++- .../Pc2MigrationItemFamilyService.java | 49 ++- .../Pc2MigrationItemPriceService.java | 34 +- .../v4/services/Pc2MigrationItemService.java | 67 ++- .../v4/services/Pc2MigrationService.java | 23 +- .../v4/services/PersonalizedOfferService.java | 11 +- .../chargebee/v4/services/PlanService.java | 42 +- .../v4/services/PortalSessionService.java | 27 +- .../v4/services/PriceVariantService.java | 42 +- .../services/PricingPageSessionService.java | 20 +- .../chargebee/v4/services/ProductService.java | 42 +- .../v4/services/PromotionalCreditService.java | 62 ++- .../v4/services/PurchaseService.java | 18 +- .../chargebee/v4/services/QuoteService.java | 236 ++++++----- .../chargebee/v4/services/RampService.java | 32 +- .../v4/services/RecordedPurchaseService.java | 18 +- .../v4/services/ResourceMigrationService.java | 10 +- .../chargebee/v4/services/RuleService.java | 4 +- .../services/SiteMigrationDetailService.java | 16 +- .../SubscriptionEntitlementService.java | 34 +- .../v4/services/SubscriptionService.java | 331 ++++++++------- .../services/SubscriptionSettingService.java | 15 +- .../ThirdPartyConfigurationService.java | 31 +- .../ThirdPartyEntityMappingService.java | 49 ++- .../services/ThirdPartySyncDetailService.java | 42 +- .../v4/services/TimeMachineService.java | 24 +- .../v4/services/TpSiteUserService.java | 40 +- .../v4/services/TransactionService.java | 119 ++++-- .../v4/services/UnbilledChargeService.java | 78 +++- .../UnbilledChargesSettingService.java | 16 +- .../v4/services/UsageChargeService.java | 16 +- .../v4/services/UsageEventService.java | 18 +- .../v4/services/UsageFileService.java | 16 +- .../chargebee/v4/services/UsageService.java | 38 +- .../v4/services/UsageSummaryService.java | 16 +- .../chargebee/v4/services/VariantService.java | 36 +- .../services/VirtualBankAccountService.java | 56 ++- .../v4/services/WebhookEndpointService.java | 48 ++- 85 files changed, 3001 insertions(+), 1721 deletions(-) diff --git a/src/main/java/com/chargebee/v4/services/AdditionalBillingLogiqService.java b/src/main/java/com/chargebee/v4/services/AdditionalBillingLogiqService.java index c02a61dc9..0cf186a93 100644 --- a/src/main/java/com/chargebee/v4/services/AdditionalBillingLogiqService.java +++ b/src/main/java/com/chargebee/v4/services/AdditionalBillingLogiqService.java @@ -59,7 +59,11 @@ public AdditionalBillingLogiqService withOptions(RequestOptions options) { */ Response retrieveRaw(AdditionalBillingLogiqRetrieveParams params) throws ChargebeeException { - return get("/additional_billing_logiqs", params != null ? params.toQueryParams() : null); + return get( + "additionalBillingLogiq", + "retrieve", + "/additional_billing_logiqs", + params != null ? params.toQueryParams() : null); } /** @@ -67,7 +71,7 @@ Response retrieveRaw(AdditionalBillingLogiqRetrieveParams params) throws Chargeb */ Response retrieveRaw() throws ChargebeeException { - return get("/additional_billing_logiqs", null); + return get("additionalBillingLogiq", "retrieve", "/additional_billing_logiqs", null); } /** @@ -90,7 +94,11 @@ public AdditionalBillingLogiqRetrieveResponse retrieve( public CompletableFuture retrieveAsync( AdditionalBillingLogiqRetrieveParams params) { - return getAsync("/additional_billing_logiqs", params != null ? params.toQueryParams() : null) + return getAsync( + "additionalBillingLogiq", + "retrieve", + "/additional_billing_logiqs", + params != null ? params.toQueryParams() : null) .thenApply( response -> AdditionalBillingLogiqRetrieveResponse.fromJson( @@ -106,7 +114,7 @@ public AdditionalBillingLogiqRetrieveResponse retrieve() throws ChargebeeExcepti /** Async variant of retrieve for additionalBillingLogiq without params. */ public CompletableFuture retrieveAsync() { - return getAsync("/additional_billing_logiqs", null) + return getAsync("additionalBillingLogiq", "retrieve", "/additional_billing_logiqs", null) .thenApply( response -> AdditionalBillingLogiqRetrieveResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/AddonService.java b/src/main/java/com/chargebee/v4/services/AddonService.java index 88acc89ab..7c4241906 100644 --- a/src/main/java/com/chargebee/v4/services/AddonService.java +++ b/src/main/java/com/chargebee/v4/services/AddonService.java @@ -72,13 +72,13 @@ public AddonService withOptions(RequestOptions options) { /** copy a addon using immutable params (executes immediately) - returns raw Response. */ Response copyRaw(AddonCopyParams params) throws ChargebeeException { - return post("/addons/copy", params != null ? params.toFormData() : null); + return post("addon", "copy", "/addons/copy", params != null ? params.toFormData() : null); } /** copy a addon using raw JSON payload (executes immediately) - returns raw Response. */ Response copyRaw(String jsonPayload) throws ChargebeeException { - return postJson("/addons/copy", jsonPayload); + return postJson("addon", "copy", "/addons/copy", jsonPayload); } public AddonCopyResponse copy(AddonCopyParams params) throws ChargebeeException { @@ -90,7 +90,7 @@ public AddonCopyResponse copy(AddonCopyParams params) throws ChargebeeException /** Async variant of copy for addon with params. */ public CompletableFuture copyAsync(AddonCopyParams params) { - return postAsync("/addons/copy", params != null ? params.toFormData() : null) + return postAsync("addon", "copy", "/addons/copy", params != null ? params.toFormData() : null) .thenApply(response -> AddonCopyResponse.fromJson(response.getBodyAsString(), response)); } @@ -98,7 +98,7 @@ public CompletableFuture copyAsync(AddonCopyParams params) { Response unarchiveRaw(String addonId) throws ChargebeeException { String path = buildPathWithParams("/addons/{addon-id}/unarchive", "addon-id", addonId); - return post(path, null); + return post("addon", "unarchive", path, null); } public AddonUnarchiveResponse unarchive(String addonId) throws ChargebeeException { @@ -110,7 +110,7 @@ public AddonUnarchiveResponse unarchive(String addonId) throws ChargebeeExceptio public CompletableFuture unarchiveAsync(String addonId) { String path = buildPathWithParams("/addons/{addon-id}/unarchive", "addon-id", addonId); - return postAsync(path, null) + return postAsync("addon", "unarchive", path, null) .thenApply( response -> AddonUnarchiveResponse.fromJson(response.getBodyAsString(), response)); } @@ -119,7 +119,7 @@ public CompletableFuture unarchiveAsync(String addonId) Response retrieveRaw(String addonId) throws ChargebeeException { String path = buildPathWithParams("/addons/{addon-id}", "addon-id", addonId); - return get(path, null); + return get("addon", "retrieve", path, null); } public AddonRetrieveResponse retrieve(String addonId) throws ChargebeeException { @@ -131,7 +131,7 @@ public AddonRetrieveResponse retrieve(String addonId) throws ChargebeeException public CompletableFuture retrieveAsync(String addonId) { String path = buildPathWithParams("/addons/{addon-id}", "addon-id", addonId); - return getAsync(path, null) + return getAsync("addon", "retrieve", path, null) .thenApply( response -> AddonRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -140,19 +140,19 @@ public CompletableFuture retrieveAsync(String addonId) { Response updateRaw(String addonId) throws ChargebeeException { String path = buildPathWithParams("/addons/{addon-id}", "addon-id", addonId); - return post(path, null); + return post("addon", "update", path, null); } /** update a addon using immutable params (executes immediately) - returns raw Response. */ Response updateRaw(String addonId, AddonUpdateParams params) throws ChargebeeException { String path = buildPathWithParams("/addons/{addon-id}", "addon-id", addonId); - return post(path, params.toFormData()); + return post("addon", "update", path, params.toFormData()); } /** update a addon using raw JSON payload (executes immediately) - returns raw Response. */ Response updateRaw(String addonId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/addons/{addon-id}", "addon-id", addonId); - return postJson(path, jsonPayload); + return postJson("addon", "update", path, jsonPayload); } public AddonUpdateResponse update(String addonId, AddonUpdateParams params) @@ -165,7 +165,7 @@ public AddonUpdateResponse update(String addonId, AddonUpdateParams params) public CompletableFuture updateAsync( String addonId, AddonUpdateParams params) { String path = buildPathWithParams("/addons/{addon-id}", "addon-id", addonId); - return postAsync(path, params.toFormData()) + return postAsync("addon", "update", path, params.toFormData()) .thenApply(response -> AddonUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -178,20 +178,20 @@ public AddonUpdateResponse update(String addonId) throws ChargebeeException { public CompletableFuture updateAsync(String addonId) { String path = buildPathWithParams("/addons/{addon-id}", "addon-id", addonId); - return postAsync(path, null) + return postAsync("addon", "update", path, null) .thenApply(response -> AddonUpdateResponse.fromJson(response.getBodyAsString(), response)); } /** list a addon using immutable params (executes immediately) - returns raw Response. */ Response listRaw(AddonListParams params) throws ChargebeeException { - return get("/addons", params != null ? params.toQueryParams() : null); + return get("addon", "list", "/addons", params != null ? params.toQueryParams() : null); } /** list a addon without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/addons", null); + return get("addon", "list", "/addons", null); } /** list a addon using raw JSON payload (executes immediately) - returns raw Response. */ @@ -209,7 +209,7 @@ public AddonListResponse list(AddonListParams params) throws ChargebeeException /** Async variant of list for addon with params. */ public CompletableFuture listAsync(AddonListParams params) { - return getAsync("/addons", params != null ? params.toQueryParams() : null) + return getAsync("addon", "list", "/addons", params != null ? params.toQueryParams() : null) .thenApply( response -> AddonListResponse.fromJson(response.getBodyAsString(), this, params, response)); @@ -224,7 +224,7 @@ public AddonListResponse list() throws ChargebeeException { /** Async variant of list for addon without params. */ public CompletableFuture listAsync() { - return getAsync("/addons", null) + return getAsync("addon", "list", "/addons", null) .thenApply( response -> AddonListResponse.fromJson(response.getBodyAsString(), this, null, response)); @@ -233,13 +233,13 @@ public CompletableFuture listAsync() { /** create a addon using immutable params (executes immediately) - returns raw Response. */ Response createRaw(AddonCreateParams params) throws ChargebeeException { - return post("/addons", params != null ? params.toFormData() : null); + return post("addon", "create", "/addons", params != null ? params.toFormData() : null); } /** create a addon using raw JSON payload (executes immediately) - returns raw Response. */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/addons", jsonPayload); + return postJson("addon", "create", "/addons", jsonPayload); } public AddonCreateResponse create(AddonCreateParams params) throws ChargebeeException { @@ -251,7 +251,7 @@ public AddonCreateResponse create(AddonCreateParams params) throws ChargebeeExce /** Async variant of create for addon with params. */ public CompletableFuture createAsync(AddonCreateParams params) { - return postAsync("/addons", params != null ? params.toFormData() : null) + return postAsync("addon", "create", "/addons", params != null ? params.toFormData() : null) .thenApply(response -> AddonCreateResponse.fromJson(response.getBodyAsString(), response)); } @@ -259,7 +259,7 @@ public CompletableFuture createAsync(AddonCreateParams para Response deleteRaw(String addonId) throws ChargebeeException { String path = buildPathWithParams("/addons/{addon-id}/delete", "addon-id", addonId); - return post(path, null); + return post("addon", "delete", path, null); } public AddonDeleteResponse delete(String addonId) throws ChargebeeException { @@ -271,7 +271,7 @@ public AddonDeleteResponse delete(String addonId) throws ChargebeeException { public CompletableFuture deleteAsync(String addonId) { String path = buildPathWithParams("/addons/{addon-id}/delete", "addon-id", addonId); - return postAsync(path, null) + return postAsync("addon", "delete", path, null) .thenApply(response -> 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 af875f049..455679312 100644 --- a/src/main/java/com/chargebee/v4/services/AddressService.java +++ b/src/main/java/com/chargebee/v4/services/AddressService.java @@ -58,7 +58,7 @@ public AddressService withOptions(RequestOptions options) { /** 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); + return get("address", "retrieve", "/addresses", params != null ? params.toQueryParams() : null); } /** retrieve a address using raw JSON payload (executes immediately) - returns raw Response. */ @@ -76,7 +76,8 @@ public AddressRetrieveResponse retrieve(AddressRetrieveParams params) throws Cha /** Async variant of retrieve for address with params. */ public CompletableFuture retrieveAsync(AddressRetrieveParams params) { - return getAsync("/addresses", params != null ? params.toQueryParams() : null) + return getAsync( + "address", "retrieve", "/addresses", params != null ? params.toQueryParams() : null) .thenApply( response -> AddressRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -84,13 +85,13 @@ public CompletableFuture retrieveAsync(AddressRetrieveP /** 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); + return post("address", "update", "/addresses", params != null ? params.toFormData() : null); } /** update a address using raw JSON payload (executes immediately) - returns raw Response. */ Response updateRaw(String jsonPayload) throws ChargebeeException { - return postJson("/addresses", jsonPayload); + return postJson("address", "update", "/addresses", jsonPayload); } public AddressUpdateResponse update(AddressUpdateParams params) throws ChargebeeException { @@ -102,7 +103,7 @@ public AddressUpdateResponse update(AddressUpdateParams params) throws Chargebee /** Async variant of update for address with params. */ public CompletableFuture updateAsync(AddressUpdateParams params) { - return postAsync("/addresses", params != null ? params.toFormData() : null) + return postAsync("address", "update", "/addresses", params != null ? params.toFormData() : null) .thenApply( response -> AddressUpdateResponse.fromJson(response.getBodyAsString(), response)); } diff --git a/src/main/java/com/chargebee/v4/services/AlertService.java b/src/main/java/com/chargebee/v4/services/AlertService.java index ad1fee4f9..9b4688d2c 100644 --- a/src/main/java/com/chargebee/v4/services/AlertService.java +++ b/src/main/java/com/chargebee/v4/services/AlertService.java @@ -79,7 +79,11 @@ Response applicationAlertsForSubscriptionRaw( "/subscriptions/{subscription-id}/applicable_alerts", "subscription-id", subscriptionId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "alert", + "applicationAlertsForSubscription", + path, + params != null ? params.toQueryParams() : null); } /** @@ -92,7 +96,7 @@ Response applicationAlertsForSubscriptionRaw(String subscriptionId) throws Charg "/subscriptions/{subscription-id}/applicable_alerts", "subscription-id", subscriptionId); - return get(path, null); + return get("alert", "applicationAlertsForSubscription", path, null); } /** @@ -133,7 +137,11 @@ public ApplicationAlertsForSubscriptionResponse applicationAlertsForSubscription "/subscriptions/{subscription-id}/applicable_alerts", "subscription-id", subscriptionId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "alert", + "applicationAlertsForSubscription", + path, + params != null ? params.toQueryParams() : null) .thenApply( response -> ApplicationAlertsForSubscriptionResponse.fromJson( @@ -148,7 +156,7 @@ public ApplicationAlertsForSubscriptionResponse applicationAlertsForSubscription "/subscriptions/{subscription-id}/applicable_alerts", "subscription-id", subscriptionId); - return getAsync(path, null) + return getAsync("alert", "applicationAlertsForSubscription", path, null) .thenApply( response -> ApplicationAlertsForSubscriptionResponse.fromJson( @@ -159,7 +167,7 @@ public ApplicationAlertsForSubscriptionResponse applicationAlertsForSubscription Response retrieveRaw(String alertId) throws ChargebeeException { String path = buildPathWithParams("/alerts/{alert-id}", "alert-id", alertId); - return get(path, null); + return get("alert", "retrieve", path, null); } public AlertRetrieveResponse retrieve(String alertId) throws ChargebeeException { @@ -171,7 +179,7 @@ public AlertRetrieveResponse retrieve(String alertId) throws ChargebeeException public CompletableFuture retrieveAsync(String alertId) { String path = buildPathWithParams("/alerts/{alert-id}", "alert-id", alertId); - return getAsync(path, null) + return getAsync("alert", "retrieve", path, null) .thenApply( response -> AlertRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -180,19 +188,19 @@ public CompletableFuture retrieveAsync(String alertId) { Response updateRaw(String alertId) throws ChargebeeException { String path = buildPathWithParams("/alerts/{alert-id}", "alert-id", alertId); - return post(path, null); + return post("alert", "update", path, null); } /** update a alert using immutable params (executes immediately) - returns raw Response. */ Response updateRaw(String alertId, AlertUpdateParams params) throws ChargebeeException { String path = buildPathWithParams("/alerts/{alert-id}", "alert-id", alertId); - return post(path, params.toFormData()); + return post("alert", "update", path, params.toFormData()); } /** update a alert using raw JSON payload (executes immediately) - returns raw Response. */ Response updateRaw(String alertId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/alerts/{alert-id}", "alert-id", alertId); - return postJson(path, jsonPayload); + return postJson("alert", "update", path, jsonPayload); } public AlertUpdateResponse update(String alertId, AlertUpdateParams params) @@ -205,7 +213,7 @@ public AlertUpdateResponse update(String alertId, AlertUpdateParams params) public CompletableFuture updateAsync( String alertId, AlertUpdateParams params) { String path = buildPathWithParams("/alerts/{alert-id}", "alert-id", alertId); - return postAsync(path, params.toFormData()) + return postAsync("alert", "update", path, params.toFormData()) .thenApply(response -> AlertUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -218,7 +226,7 @@ public AlertUpdateResponse update(String alertId) throws ChargebeeException { public CompletableFuture updateAsync(String alertId) { String path = buildPathWithParams("/alerts/{alert-id}", "alert-id", alertId); - return postAsync(path, null) + return postAsync("alert", "update", path, null) .thenApply(response -> AlertUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -226,7 +234,7 @@ public CompletableFuture updateAsync(String alertId) { Response deleteRaw(String alertId) throws ChargebeeException { String path = buildPathWithParams("/alerts/{alert-id}/delete", "alert-id", alertId); - return post(path, null); + return post("alert", "delete", path, null); } public AlertDeleteResponse delete(String alertId) throws ChargebeeException { @@ -238,20 +246,20 @@ public AlertDeleteResponse delete(String alertId) throws ChargebeeException { public CompletableFuture deleteAsync(String alertId) { String path = buildPathWithParams("/alerts/{alert-id}/delete", "alert-id", alertId); - return postAsync(path, null) + return postAsync("alert", "delete", path, null) .thenApply(response -> AlertDeleteResponse.fromJson(response.getBodyAsString(), response)); } /** list a alert using immutable params (executes immediately) - returns raw Response. */ Response listRaw(AlertListParams params) throws ChargebeeException { - return get("/alerts", params != null ? params.toQueryParams() : null); + return get("alert", "list", "/alerts", params != null ? params.toQueryParams() : null); } /** list a alert without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/alerts", null); + return get("alert", "list", "/alerts", null); } /** list a alert using raw JSON payload (executes immediately) - returns raw Response. */ @@ -269,7 +277,7 @@ public AlertListResponse list(AlertListParams params) throws ChargebeeException /** Async variant of list for alert with params. */ public CompletableFuture listAsync(AlertListParams params) { - return getAsync("/alerts", params != null ? params.toQueryParams() : null) + return getAsync("alert", "list", "/alerts", params != null ? params.toQueryParams() : null) .thenApply( response -> AlertListResponse.fromJson(response.getBodyAsString(), this, params, response)); @@ -284,7 +292,7 @@ public AlertListResponse list() throws ChargebeeException { /** Async variant of list for alert without params. */ public CompletableFuture listAsync() { - return getAsync("/alerts", null) + return getAsync("alert", "list", "/alerts", null) .thenApply( response -> AlertListResponse.fromJson(response.getBodyAsString(), this, null, response)); @@ -293,13 +301,13 @@ public CompletableFuture listAsync() { /** create a alert using immutable params (executes immediately) - returns raw Response. */ Response createRaw(AlertCreateParams params) throws ChargebeeException { - return post("/alerts", params != null ? params.toFormData() : null); + return post("alert", "create", "/alerts", params != null ? params.toFormData() : null); } /** create a alert using raw JSON payload (executes immediately) - returns raw Response. */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/alerts", jsonPayload); + return postJson("alert", "create", "/alerts", jsonPayload); } public AlertCreateResponse create(AlertCreateParams params) throws ChargebeeException { @@ -311,7 +319,7 @@ public AlertCreateResponse create(AlertCreateParams params) throws ChargebeeExce /** Async variant of create for alert with params. */ public CompletableFuture createAsync(AlertCreateParams params) { - return postAsync("/alerts", params != null ? params.toFormData() : null) + return postAsync("alert", "create", "/alerts", params != null ? params.toFormData() : null) .thenApply(response -> AlertCreateResponse.fromJson(response.getBodyAsString(), response)); } } diff --git a/src/main/java/com/chargebee/v4/services/AlertStatusService.java b/src/main/java/com/chargebee/v4/services/AlertStatusService.java index 3499b33c3..070d3d410 100644 --- a/src/main/java/com/chargebee/v4/services/AlertStatusService.java +++ b/src/main/java/com/chargebee/v4/services/AlertStatusService.java @@ -64,7 +64,11 @@ Response alertStatusesForSubscriptionRaw( String path = buildPathWithParams( "/subscriptions/{subscription-id}/alert_statuses", "subscription-id", subscriptionId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "alertStatus", + "alertStatusesForSubscription", + path, + params != null ? params.toQueryParams() : null); } /** @@ -75,7 +79,7 @@ Response alertStatusesForSubscriptionRaw(String subscriptionId) throws Chargebee String path = buildPathWithParams( "/subscriptions/{subscription-id}/alert_statuses", "subscription-id", subscriptionId); - return get(path, null); + return get("alertStatus", "alertStatusesForSubscription", path, null); } /** @@ -110,7 +114,11 @@ public CompletableFuture alertStatusesForS String path = buildPathWithParams( "/subscriptions/{subscription-id}/alert_statuses", "subscription-id", subscriptionId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "alertStatus", + "alertStatusesForSubscription", + path, + params != null ? params.toQueryParams() : null) .thenApply( response -> AlertStatusesForSubscriptionResponse.fromJson( @@ -123,7 +131,7 @@ public CompletableFuture alertStatusesForS String path = buildPathWithParams( "/subscriptions/{subscription-id}/alert_statuses", "subscription-id", subscriptionId); - return getAsync(path, null) + return getAsync("alertStatus", "alertStatusesForSubscription", path, null) .thenApply( response -> AlertStatusesForSubscriptionResponse.fromJson( @@ -137,7 +145,11 @@ public CompletableFuture alertStatusesForS Response alertStatusesForAlertRaw(String alertId, AlertStatusesForAlertParams params) throws ChargebeeException { String path = buildPathWithParams("/alerts/{alert-id}/alert_statuses", "alert-id", alertId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "alertStatus", + "alertStatusesForAlert", + path, + params != null ? params.toQueryParams() : null); } /** @@ -146,7 +158,7 @@ Response alertStatusesForAlertRaw(String alertId, AlertStatusesForAlertParams pa */ Response alertStatusesForAlertRaw(String alertId) throws ChargebeeException { String path = buildPathWithParams("/alerts/{alert-id}/alert_statuses", "alert-id", alertId); - return get(path, null); + return get("alertStatus", "alertStatusesForAlert", path, null); } /** @@ -176,7 +188,11 @@ public AlertStatusesForAlertResponse alertStatusesForAlert(String alertId) public CompletableFuture alertStatusesForAlertAsync( String alertId, AlertStatusesForAlertParams params) { String path = buildPathWithParams("/alerts/{alert-id}/alert_statuses", "alert-id", alertId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "alertStatus", + "alertStatusesForAlert", + path, + params != null ? params.toQueryParams() : null) .thenApply( response -> AlertStatusesForAlertResponse.fromJson( @@ -187,7 +203,7 @@ public CompletableFuture alertStatusesForAlertAsy public CompletableFuture alertStatusesForAlertAsync( String alertId) { String path = buildPathWithParams("/alerts/{alert-id}/alert_statuses", "alert-id", alertId); - return getAsync(path, null) + return getAsync("alertStatus", "alertStatusesForAlert", path, null) .thenApply( response -> AlertStatusesForAlertResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/AttachedItemService.java b/src/main/java/com/chargebee/v4/services/AttachedItemService.java index 96188ad10..b395eff06 100644 --- a/src/main/java/com/chargebee/v4/services/AttachedItemService.java +++ b/src/main/java/com/chargebee/v4/services/AttachedItemService.java @@ -74,7 +74,7 @@ Response retrieveRaw(String attachedItemId) throws ChargebeeException { buildPathWithParams( "/attached_items/{attached-item-id}", "attached-item-id", attachedItemId); - return get(path, null); + return get("attachedItem", "retrieve", path, null); } /** @@ -85,7 +85,7 @@ Response retrieveRaw(String attachedItemId, AttachedItemRetrieveParams params) String path = buildPathWithParams( "/attached_items/{attached-item-id}", "attached-item-id", attachedItemId); - return get(path, params != null ? params.toQueryParams() : null); + return get("attachedItem", "retrieve", path, params != null ? params.toQueryParams() : null); } public AttachedItemRetrieveResponse retrieve( @@ -100,7 +100,8 @@ public CompletableFuture retrieveAsync( String path = buildPathWithParams( "/attached_items/{attached-item-id}", "attached-item-id", attachedItemId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "attachedItem", "retrieve", path, params != null ? params.toQueryParams() : null) .thenApply( response -> AttachedItemRetrieveResponse.fromJson(response.getBodyAsString(), response)); @@ -117,7 +118,7 @@ public CompletableFuture retrieveAsync(String atta buildPathWithParams( "/attached_items/{attached-item-id}", "attached-item-id", attachedItemId); - return getAsync(path, null) + return getAsync("attachedItem", "retrieve", path, null) .thenApply( response -> AttachedItemRetrieveResponse.fromJson(response.getBodyAsString(), response)); @@ -129,7 +130,7 @@ Response updateRaw(String attachedItemId) throws ChargebeeException { buildPathWithParams( "/attached_items/{attached-item-id}", "attached-item-id", attachedItemId); - return post(path, null); + return post("attachedItem", "update", path, null); } /** update a attachedItem using immutable params (executes immediately) - returns raw Response. */ @@ -138,7 +139,7 @@ Response updateRaw(String attachedItemId, AttachedItemUpdateParams params) String path = buildPathWithParams( "/attached_items/{attached-item-id}", "attached-item-id", attachedItemId); - return post(path, params.toFormData()); + return post("attachedItem", "update", path, params.toFormData()); } /** update a attachedItem using raw JSON payload (executes immediately) - returns raw Response. */ @@ -146,7 +147,7 @@ Response updateRaw(String attachedItemId, String jsonPayload) throws ChargebeeEx String path = buildPathWithParams( "/attached_items/{attached-item-id}", "attached-item-id", attachedItemId); - return postJson(path, jsonPayload); + return postJson("attachedItem", "update", path, jsonPayload); } public AttachedItemUpdateResponse update(String attachedItemId, AttachedItemUpdateParams params) @@ -161,7 +162,7 @@ public CompletableFuture updateAsync( String path = buildPathWithParams( "/attached_items/{attached-item-id}", "attached-item-id", attachedItemId); - return postAsync(path, params.toFormData()) + return postAsync("attachedItem", "update", path, params.toFormData()) .thenApply( response -> AttachedItemUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -169,13 +170,13 @@ public CompletableFuture updateAsync( /** 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); + return get("attachedItem", "list", path, params != null ? params.toQueryParams() : null); } /** 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); + return get("attachedItem", "list", path, null); } /** list a attachedItem using raw JSON payload (executes immediately) - returns raw Response. */ @@ -201,7 +202,7 @@ public AttachedItemListResponse list(String itemId) throws ChargebeeException { public CompletableFuture listAsync( String itemId, AttachedItemListParams params) { String path = buildPathWithParams("/items/{item-id}/attached_items", "item-id", itemId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync("attachedItem", "list", path, params != null ? params.toQueryParams() : null) .thenApply( response -> AttachedItemListResponse.fromJson( @@ -211,7 +212,7 @@ public CompletableFuture listAsync( /** Async variant of list for attachedItem without params. */ public CompletableFuture listAsync(String itemId) { String path = buildPathWithParams("/items/{item-id}/attached_items", "item-id", itemId); - return getAsync(path, null) + return getAsync("attachedItem", "list", path, null) .thenApply( response -> AttachedItemListResponse.fromJson( @@ -222,19 +223,19 @@ public CompletableFuture listAsync(String itemId) { Response createRaw(String itemId) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}/attached_items", "item-id", itemId); - return post(path, null); + return post("attachedItem", "create", path, null); } /** 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()); + return post("attachedItem", "create", path, params.toFormData()); } /** 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); + return postJson("attachedItem", "create", path, jsonPayload); } public AttachedItemCreateResponse create(String itemId, AttachedItemCreateParams params) @@ -247,7 +248,7 @@ public AttachedItemCreateResponse create(String itemId, AttachedItemCreateParams public CompletableFuture createAsync( String itemId, AttachedItemCreateParams params) { String path = buildPathWithParams("/items/{item-id}/attached_items", "item-id", itemId); - return postAsync(path, params.toFormData()) + return postAsync("attachedItem", "create", path, params.toFormData()) .thenApply( response -> AttachedItemCreateResponse.fromJson(response.getBodyAsString(), response)); } @@ -258,7 +259,7 @@ Response deleteRaw(String attachedItemId) throws ChargebeeException { buildPathWithParams( "/attached_items/{attached-item-id}/delete", "attached-item-id", attachedItemId); - return post(path, null); + return post("attachedItem", "delete", path, null); } /** delete a attachedItem using immutable params (executes immediately) - returns raw Response. */ @@ -267,7 +268,7 @@ Response deleteRaw(String attachedItemId, AttachedItemDeleteParams params) String path = buildPathWithParams( "/attached_items/{attached-item-id}/delete", "attached-item-id", attachedItemId); - return post(path, params.toFormData()); + return post("attachedItem", "delete", path, params.toFormData()); } /** delete a attachedItem using raw JSON payload (executes immediately) - returns raw Response. */ @@ -275,7 +276,7 @@ Response deleteRaw(String attachedItemId, String jsonPayload) throws ChargebeeEx String path = buildPathWithParams( "/attached_items/{attached-item-id}/delete", "attached-item-id", attachedItemId); - return postJson(path, jsonPayload); + return postJson("attachedItem", "delete", path, jsonPayload); } public AttachedItemDeleteResponse delete(String attachedItemId, AttachedItemDeleteParams params) @@ -290,7 +291,7 @@ public CompletableFuture deleteAsync( String path = buildPathWithParams( "/attached_items/{attached-item-id}/delete", "attached-item-id", attachedItemId); - return postAsync(path, params.toFormData()) + return postAsync("attachedItem", "delete", path, params.toFormData()) .thenApply( response -> AttachedItemDeleteResponse.fromJson(response.getBodyAsString(), response)); } diff --git a/src/main/java/com/chargebee/v4/services/BrandConfigurationService.java b/src/main/java/com/chargebee/v4/services/BrandConfigurationService.java index 399ce0c89..c30f7560d 100644 --- a/src/main/java/com/chargebee/v4/services/BrandConfigurationService.java +++ b/src/main/java/com/chargebee/v4/services/BrandConfigurationService.java @@ -58,13 +58,17 @@ public BrandConfigurationService withOptions(RequestOptions options) { */ Response retrieveRaw(BrandConfigurationRetrieveParams params) throws ChargebeeException { - return get("/brand_configurations", params != null ? params.toQueryParams() : null); + return get( + "brandConfiguration", + "retrieve", + "/brand_configurations", + params != null ? params.toQueryParams() : null); } /** retrieve a brandConfiguration without params (executes immediately) - returns raw Response. */ Response retrieveRaw() throws ChargebeeException { - return get("/brand_configurations", null); + return get("brandConfiguration", "retrieve", "/brand_configurations", null); } /** @@ -87,7 +91,11 @@ public BrandConfigurationRetrieveResponse retrieve(BrandConfigurationRetrievePar public CompletableFuture retrieveAsync( BrandConfigurationRetrieveParams params) { - return getAsync("/brand_configurations", params != null ? params.toQueryParams() : null) + return getAsync( + "brandConfiguration", + "retrieve", + "/brand_configurations", + params != null ? params.toQueryParams() : null) .thenApply( response -> BrandConfigurationRetrieveResponse.fromJson(response.getBodyAsString(), response)); @@ -102,7 +110,7 @@ public BrandConfigurationRetrieveResponse retrieve() throws ChargebeeException { /** Async variant of retrieve for brandConfiguration without params. */ public CompletableFuture retrieveAsync() { - return getAsync("/brand_configurations", null) + return getAsync("brandConfiguration", "retrieve", "/brand_configurations", null) .thenApply( response -> 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 1b348eccc..cc87687e5 100644 --- a/src/main/java/com/chargebee/v4/services/BusinessEntityService.java +++ b/src/main/java/com/chargebee/v4/services/BusinessEntityService.java @@ -62,13 +62,17 @@ public BusinessEntityService withOptions(RequestOptions options) { */ Response getTransfersRaw(BusinessEntityGetTransfersParams params) throws ChargebeeException { - return get("/business_entities/transfers", params != null ? params.toQueryParams() : null); + return get( + "businessEntity", + "getTransfers", + "/business_entities/transfers", + params != null ? params.toQueryParams() : null); } /** getTransfers a businessEntity without params (executes immediately) - returns raw Response. */ Response getTransfersRaw() throws ChargebeeException { - return get("/business_entities/transfers", null); + return get("businessEntity", "getTransfers", "/business_entities/transfers", null); } /** @@ -92,7 +96,11 @@ public BusinessEntityGetTransfersResponse getTransfers(BusinessEntityGetTransfer public CompletableFuture getTransfersAsync( BusinessEntityGetTransfersParams params) { - return getAsync("/business_entities/transfers", params != null ? params.toQueryParams() : null) + return getAsync( + "businessEntity", + "getTransfers", + "/business_entities/transfers", + params != null ? params.toQueryParams() : null) .thenApply( response -> BusinessEntityGetTransfersResponse.fromJson( @@ -109,7 +117,7 @@ public BusinessEntityGetTransfersResponse getTransfers() throws ChargebeeExcepti /** Async variant of getTransfers for businessEntity without params. */ public CompletableFuture getTransfersAsync() { - return getAsync("/business_entities/transfers", null) + return getAsync("businessEntity", "getTransfers", "/business_entities/transfers", null) .thenApply( response -> BusinessEntityGetTransfersResponse.fromJson( @@ -123,7 +131,11 @@ public CompletableFuture getTransfersAsync() Response createTransfersRaw(BusinessEntityCreateTransfersParams params) throws ChargebeeException { - return post("/business_entities/transfers", params != null ? params.toFormData() : null); + return post( + "businessEntity", + "createTransfers", + "/business_entities/transfers", + params != null ? params.toFormData() : null); } /** @@ -132,7 +144,8 @@ Response createTransfersRaw(BusinessEntityCreateTransfersParams params) */ Response createTransfersRaw(String jsonPayload) throws ChargebeeException { - return postJson("/business_entities/transfers", jsonPayload); + return postJson( + "businessEntity", "createTransfers", "/business_entities/transfers", jsonPayload); } public BusinessEntityCreateTransfersResponse createTransfers( @@ -146,7 +159,11 @@ public BusinessEntityCreateTransfersResponse createTransfers( public CompletableFuture createTransfersAsync( BusinessEntityCreateTransfersParams params) { - return postAsync("/business_entities/transfers", params != null ? params.toFormData() : null) + return postAsync( + "businessEntity", + "createTransfers", + "/business_entities/transfers", + params != null ? params.toFormData() : null) .thenApply( response -> BusinessEntityCreateTransfersResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/BusinessProfileService.java b/src/main/java/com/chargebee/v4/services/BusinessProfileService.java index 76517abba..5b347e691 100644 --- a/src/main/java/com/chargebee/v4/services/BusinessProfileService.java +++ b/src/main/java/com/chargebee/v4/services/BusinessProfileService.java @@ -58,13 +58,17 @@ public BusinessProfileService withOptions(RequestOptions options) { */ Response retrieveRaw(BusinessProfileRetrieveParams params) throws ChargebeeException { - return get("/business_profiles", params != null ? params.toQueryParams() : null); + return get( + "businessProfile", + "retrieve", + "/business_profiles", + params != null ? params.toQueryParams() : null); } /** retrieve a businessProfile without params (executes immediately) - returns raw Response. */ Response retrieveRaw() throws ChargebeeException { - return get("/business_profiles", null); + return get("businessProfile", "retrieve", "/business_profiles", null); } /** @@ -87,7 +91,11 @@ public BusinessProfileRetrieveResponse retrieve(BusinessProfileRetrieveParams pa public CompletableFuture retrieveAsync( BusinessProfileRetrieveParams params) { - return getAsync("/business_profiles", params != null ? params.toQueryParams() : null) + return getAsync( + "businessProfile", + "retrieve", + "/business_profiles", + params != null ? params.toQueryParams() : null) .thenApply( response -> BusinessProfileRetrieveResponse.fromJson(response.getBodyAsString(), response)); @@ -102,7 +110,7 @@ public BusinessProfileRetrieveResponse retrieve() throws ChargebeeException { /** Async variant of retrieve for businessProfile without params. */ public CompletableFuture retrieveAsync() { - return getAsync("/business_profiles", null) + return getAsync("businessProfile", "retrieve", "/business_profiles", null) .thenApply( response -> 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 10f401591..c43af770f 100644 --- a/src/main/java/com/chargebee/v4/services/CardService.java +++ b/src/main/java/com/chargebee/v4/services/CardService.java @@ -68,7 +68,7 @@ Response copyCardForCustomerRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/copy_card", "customer-id", customerId); - return post(path, null); + return post("card", "copyCardForCustomer", path, null); } /** @@ -79,7 +79,7 @@ Response copyCardForCustomerRaw(String customerId, CopyCardForCustomerParams par throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/copy_card", "customer-id", customerId); - return post(path, params.toFormData()); + return post("card", "copyCardForCustomer", path, params.toFormData()); } /** @@ -89,7 +89,7 @@ Response copyCardForCustomerRaw(String customerId, CopyCardForCustomerParams par Response copyCardForCustomerRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/copy_card", "customer-id", customerId); - return postJson(path, jsonPayload); + return postJson("card", "copyCardForCustomer", path, jsonPayload); } public CopyCardForCustomerResponse copyCardForCustomer( @@ -103,7 +103,7 @@ public CompletableFuture copyCardForCustomerAsync( String customerId, CopyCardForCustomerParams params) { String path = buildPathWithParams("/customers/{customer-id}/copy_card", "customer-id", customerId); - return postAsync(path, params.toFormData()) + return postAsync("card", "copyCardForCustomer", path, params.toFormData()) .thenApply( response -> CopyCardForCustomerResponse.fromJson(response.getBodyAsString(), response)); } @@ -112,7 +112,7 @@ public CompletableFuture copyCardForCustomerAsync( Response retrieveRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/cards/{customer-id}", "customer-id", customerId); - return get(path, null); + return get("card", "retrieve", path, null); } public CardRetrieveResponse retrieve(String customerId) throws ChargebeeException { @@ -124,7 +124,7 @@ public CardRetrieveResponse retrieve(String customerId) throws ChargebeeExceptio public CompletableFuture retrieveAsync(String customerId) { String path = buildPathWithParams("/cards/{customer-id}", "customer-id", customerId); - return getAsync(path, null) + return getAsync("card", "retrieve", path, null) .thenApply(response -> CardRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -133,7 +133,7 @@ Response switchGatewayForCustomerRaw(String customerId) throws ChargebeeExceptio String path = buildPathWithParams("/customers/{customer-id}/switch_gateway", "customer-id", customerId); - return post(path, null); + return post("card", "switchGatewayForCustomer", path, null); } /** @@ -144,7 +144,7 @@ Response switchGatewayForCustomerRaw(String customerId, CardSwitchGatewayForCust throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/switch_gateway", "customer-id", customerId); - return post(path, params.toFormData()); + return post("card", "switchGatewayForCustomer", path, params.toFormData()); } /** @@ -155,7 +155,7 @@ Response switchGatewayForCustomerRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/switch_gateway", "customer-id", customerId); - return postJson(path, jsonPayload); + return postJson("card", "switchGatewayForCustomer", path, jsonPayload); } public CardSwitchGatewayForCustomerResponse switchGatewayForCustomer( @@ -169,7 +169,7 @@ public CompletableFuture switchGatewayForC String customerId, CardSwitchGatewayForCustomerParams params) { String path = buildPathWithParams("/customers/{customer-id}/switch_gateway", "customer-id", customerId); - return postAsync(path, params.toFormData()) + return postAsync("card", "switchGatewayForCustomer", path, params.toFormData()) .thenApply( response -> CardSwitchGatewayForCustomerResponse.fromJson( @@ -181,7 +181,7 @@ Response deleteCardForCustomerRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/delete_card", "customer-id", customerId); - return post(path, null); + return post("card", "deleteCardForCustomer", path, null); } public DeleteCardForCustomerResponse deleteCardForCustomer(String customerId) @@ -196,7 +196,7 @@ public CompletableFuture deleteCardForCustomerAsy String path = buildPathWithParams("/customers/{customer-id}/delete_card", "customer-id", customerId); - return postAsync(path, null) + return postAsync("card", "deleteCardForCustomer", path, null) .thenApply( response -> DeleteCardForCustomerResponse.fromJson(response.getBodyAsString(), response)); @@ -207,7 +207,7 @@ Response updateCardForCustomerRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/credit_card", "customer-id", customerId); - return post(path, null); + return post("card", "updateCardForCustomer", path, null); } /** @@ -218,7 +218,7 @@ Response updateCardForCustomerRaw(String customerId, UpdateCardForCustomerParams throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/credit_card", "customer-id", customerId); - return post(path, params.toFormData()); + return post("card", "updateCardForCustomer", path, params.toFormData()); } /** @@ -229,7 +229,7 @@ Response updateCardForCustomerRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/credit_card", "customer-id", customerId); - return postJson(path, jsonPayload); + return postJson("card", "updateCardForCustomer", path, jsonPayload); } public UpdateCardForCustomerResponse updateCardForCustomer( @@ -243,7 +243,7 @@ public CompletableFuture updateCardForCustomerAsy String customerId, UpdateCardForCustomerParams params) { String path = buildPathWithParams("/customers/{customer-id}/credit_card", "customer-id", customerId); - return postAsync(path, params.toFormData()) + return postAsync("card", "updateCardForCustomer", path, params.toFormData()) .thenApply( response -> 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 5246caa93..b96252612 100644 --- a/src/main/java/com/chargebee/v4/services/CommentService.java +++ b/src/main/java/com/chargebee/v4/services/CommentService.java @@ -63,7 +63,7 @@ public CommentService withOptions(RequestOptions options) { Response deleteRaw(String commentId) throws ChargebeeException { String path = buildPathWithParams("/comments/{comment-id}/delete", "comment-id", commentId); - return post(path, null); + return post("comment", "delete", path, null); } public CommentDeleteResponse delete(String commentId) throws ChargebeeException { @@ -75,7 +75,7 @@ public CommentDeleteResponse delete(String commentId) throws ChargebeeException public CompletableFuture deleteAsync(String commentId) { String path = buildPathWithParams("/comments/{comment-id}/delete", "comment-id", commentId); - return postAsync(path, null) + return postAsync("comment", "delete", path, null) .thenApply( response -> CommentDeleteResponse.fromJson(response.getBodyAsString(), response)); } @@ -84,7 +84,7 @@ public CompletableFuture deleteAsync(String commentId) { Response retrieveRaw(String commentId) throws ChargebeeException { String path = buildPathWithParams("/comments/{comment-id}", "comment-id", commentId); - return get(path, null); + return get("comment", "retrieve", path, null); } public CommentRetrieveResponse retrieve(String commentId) throws ChargebeeException { @@ -96,7 +96,7 @@ public CommentRetrieveResponse retrieve(String commentId) throws ChargebeeExcept public CompletableFuture retrieveAsync(String commentId) { String path = buildPathWithParams("/comments/{comment-id}", "comment-id", commentId); - return getAsync(path, null) + return getAsync("comment", "retrieve", path, null) .thenApply( response -> CommentRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -104,13 +104,13 @@ public CompletableFuture retrieveAsync(String commentId /** list a comment using immutable params (executes immediately) - returns raw Response. */ Response listRaw(CommentListParams params) throws ChargebeeException { - return get("/comments", params != null ? params.toQueryParams() : null); + return get("comment", "list", "/comments", params != null ? params.toQueryParams() : null); } /** list a comment without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/comments", null); + return get("comment", "list", "/comments", null); } /** list a comment using raw JSON payload (executes immediately) - returns raw Response. */ @@ -128,7 +128,7 @@ public CommentListResponse list(CommentListParams params) throws ChargebeeExcept /** Async variant of list for comment with params. */ public CompletableFuture listAsync(CommentListParams params) { - return getAsync("/comments", params != null ? params.toQueryParams() : null) + return getAsync("comment", "list", "/comments", params != null ? params.toQueryParams() : null) .thenApply( response -> CommentListResponse.fromJson(response.getBodyAsString(), this, params, response)); @@ -143,7 +143,7 @@ public CommentListResponse list() throws ChargebeeException { /** Async variant of list for comment without params. */ public CompletableFuture listAsync() { - return getAsync("/comments", null) + return getAsync("comment", "list", "/comments", null) .thenApply( response -> CommentListResponse.fromJson(response.getBodyAsString(), this, null, response)); @@ -152,13 +152,13 @@ public CompletableFuture listAsync() { /** create a comment using immutable params (executes immediately) - returns raw Response. */ Response createRaw(CommentCreateParams params) throws ChargebeeException { - return post("/comments", params != null ? params.toFormData() : null); + return post("comment", "create", "/comments", params != null ? params.toFormData() : null); } /** create a comment using raw JSON payload (executes immediately) - returns raw Response. */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/comments", jsonPayload); + return postJson("comment", "create", "/comments", jsonPayload); } public CommentCreateResponse create(CommentCreateParams params) throws ChargebeeException { @@ -170,7 +170,7 @@ public CommentCreateResponse create(CommentCreateParams params) throws Chargebee /** Async variant of create for comment with params. */ public CompletableFuture createAsync(CommentCreateParams params) { - return postAsync("/comments", params != null ? params.toFormData() : null) + return postAsync("comment", "create", "/comments", params != null ? params.toFormData() : null) .thenApply( response -> 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 cb51c0432..4e769ab3d 100644 --- a/src/main/java/com/chargebee/v4/services/ConfigurationService.java +++ b/src/main/java/com/chargebee/v4/services/ConfigurationService.java @@ -55,13 +55,14 @@ public ConfigurationService withOptions(RequestOptions options) { /** 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); + return get( + "configuration", "list", "/configurations", params != null ? params.toQueryParams() : null); } /** list a configuration without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/configurations", null); + return get("configuration", "list", "/configurations", null); } /** list a configuration using raw JSON payload (executes immediately) - returns raw Response. */ @@ -79,7 +80,11 @@ public ConfigurationListResponse list(ConfigurationListParams params) throws Cha /** Async variant of list for configuration with params. */ public CompletableFuture listAsync(ConfigurationListParams params) { - return getAsync("/configurations", params != null ? params.toQueryParams() : null) + return getAsync( + "configuration", + "list", + "/configurations", + params != null ? params.toQueryParams() : null) .thenApply( response -> ConfigurationListResponse.fromJson(response.getBodyAsString(), response)); } @@ -93,7 +98,7 @@ public ConfigurationListResponse list() throws ChargebeeException { /** Async variant of list for configuration without params. */ public CompletableFuture listAsync() { - return getAsync("/configurations", null) + return getAsync("configuration", "list", "/configurations", null) .thenApply( response -> 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 c84d29706..3a976b332 100644 --- a/src/main/java/com/chargebee/v4/services/CouponCodeService.java +++ b/src/main/java/com/chargebee/v4/services/CouponCodeService.java @@ -62,13 +62,14 @@ public CouponCodeService withOptions(RequestOptions options) { /** list a couponCode using immutable params (executes immediately) - returns raw Response. */ Response listRaw(CouponCodeListParams params) throws ChargebeeException { - return get("/coupon_codes", params != null ? params.toQueryParams() : null); + return get( + "couponCode", "list", "/coupon_codes", params != null ? params.toQueryParams() : null); } /** list a couponCode without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/coupon_codes", null); + return get("couponCode", "list", "/coupon_codes", null); } /** list a couponCode using raw JSON payload (executes immediately) - returns raw Response. */ @@ -86,7 +87,8 @@ public CouponCodeListResponse list(CouponCodeListParams params) throws Chargebee /** Async variant of list for couponCode with params. */ public CompletableFuture listAsync(CouponCodeListParams params) { - return getAsync("/coupon_codes", params != null ? params.toQueryParams() : null) + return getAsync( + "couponCode", "list", "/coupon_codes", params != null ? params.toQueryParams() : null) .thenApply( response -> CouponCodeListResponse.fromJson( @@ -102,7 +104,7 @@ public CouponCodeListResponse list() throws ChargebeeException { /** Async variant of list for couponCode without params. */ public CompletableFuture listAsync() { - return getAsync("/coupon_codes", null) + return getAsync("couponCode", "list", "/coupon_codes", null) .thenApply( response -> CouponCodeListResponse.fromJson(response.getBodyAsString(), this, null, response)); @@ -111,13 +113,14 @@ public CompletableFuture listAsync() { /** create a couponCode using immutable params (executes immediately) - returns raw Response. */ Response createRaw(CouponCodeCreateParams params) throws ChargebeeException { - return post("/coupon_codes", params != null ? params.toFormData() : null); + return post( + "couponCode", "create", "/coupon_codes", params != null ? params.toFormData() : null); } /** create a couponCode using raw JSON payload (executes immediately) - returns raw Response. */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/coupon_codes", jsonPayload); + return postJson("couponCode", "create", "/coupon_codes", jsonPayload); } public CouponCodeCreateResponse create(CouponCodeCreateParams params) throws ChargebeeException { @@ -129,7 +132,8 @@ public CouponCodeCreateResponse create(CouponCodeCreateParams params) throws Cha /** Async variant of create for couponCode with params. */ public CompletableFuture createAsync(CouponCodeCreateParams params) { - return postAsync("/coupon_codes", params != null ? params.toFormData() : null) + return postAsync( + "couponCode", "create", "/coupon_codes", params != null ? params.toFormData() : null) .thenApply( response -> CouponCodeCreateResponse.fromJson(response.getBodyAsString(), response)); } @@ -139,7 +143,7 @@ Response retrieveRaw(String couponCodeCode) throws ChargebeeException { String path = buildPathWithParams("/coupon_codes/{coupon-code-code}", "coupon-code-code", couponCodeCode); - return get(path, null); + return get("couponCode", "retrieve", path, null); } public CouponCodeRetrieveResponse retrieve(String couponCodeCode) throws ChargebeeException { @@ -152,7 +156,7 @@ public CompletableFuture retrieveAsync(String coupon String path = buildPathWithParams("/coupon_codes/{coupon-code-code}", "coupon-code-code", couponCodeCode); - return getAsync(path, null) + return getAsync("couponCode", "retrieve", path, null) .thenApply( response -> CouponCodeRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -163,7 +167,7 @@ Response archiveRaw(String couponCodeCode) throws ChargebeeException { buildPathWithParams( "/coupon_codes/{coupon-code-code}/archive", "coupon-code-code", couponCodeCode); - return post(path, null); + return post("couponCode", "archive", path, null); } public CouponCodeArchiveResponse archive(String couponCodeCode) throws ChargebeeException { @@ -177,7 +181,7 @@ public CompletableFuture archiveAsync(String couponCo buildPathWithParams( "/coupon_codes/{coupon-code-code}/archive", "coupon-code-code", couponCodeCode); - return postAsync(path, null) + return postAsync("couponCode", "archive", path, null) .thenApply( response -> 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 6e9ff55c0..ca43d19a9 100644 --- a/src/main/java/com/chargebee/v4/services/CouponService.java +++ b/src/main/java/com/chargebee/v4/services/CouponService.java @@ -80,13 +80,13 @@ public CouponService withOptions(RequestOptions options) { /** list a coupon using immutable params (executes immediately) - returns raw Response. */ Response listRaw(CouponListParams params) throws ChargebeeException { - return get("/coupons", params != null ? params.toQueryParams() : null); + return get("coupon", "list", "/coupons", params != null ? params.toQueryParams() : null); } /** list a coupon without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/coupons", null); + return get("coupon", "list", "/coupons", null); } /** list a coupon using raw JSON payload (executes immediately) - returns raw Response. */ @@ -104,7 +104,7 @@ public CouponListResponse list(CouponListParams params) throws ChargebeeExceptio /** Async variant of list for coupon with params. */ public CompletableFuture listAsync(CouponListParams params) { - return getAsync("/coupons", params != null ? params.toQueryParams() : null) + return getAsync("coupon", "list", "/coupons", params != null ? params.toQueryParams() : null) .thenApply( response -> CouponListResponse.fromJson(response.getBodyAsString(), this, params, response)); @@ -119,7 +119,7 @@ public CouponListResponse list() throws ChargebeeException { /** Async variant of list for coupon without params. */ public CompletableFuture listAsync() { - return getAsync("/coupons", null) + return getAsync("coupon", "list", "/coupons", null) .thenApply( response -> CouponListResponse.fromJson(response.getBodyAsString(), this, null, response)); @@ -128,13 +128,13 @@ public CompletableFuture listAsync() { /** create a coupon using immutable params (executes immediately) - returns raw Response. */ Response createRaw(CouponCreateParams params) throws ChargebeeException { - return post("/coupons", params != null ? params.toFormData() : null); + return post("coupon", "create", "/coupons", params != null ? params.toFormData() : null); } /** create a coupon using raw JSON payload (executes immediately) - returns raw Response. */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/coupons", jsonPayload); + return postJson("coupon", "create", "/coupons", jsonPayload); } public CouponCreateResponse create(CouponCreateParams params) throws ChargebeeException { @@ -146,7 +146,7 @@ public CouponCreateResponse create(CouponCreateParams params) throws ChargebeeEx /** Async variant of create for coupon with params. */ public CompletableFuture createAsync(CouponCreateParams params) { - return postAsync("/coupons", params != null ? params.toFormData() : null) + return postAsync("coupon", "create", "/coupons", params != null ? params.toFormData() : null) .thenApply(response -> CouponCreateResponse.fromJson(response.getBodyAsString(), response)); } @@ -155,7 +155,7 @@ Response updateForItemsRaw(String couponId) throws ChargebeeException { String path = buildPathWithParams("/coupons/{coupon-id}/update_for_items", "coupon-id", couponId); - return post(path, null); + return post("coupon", "updateForItems", path, null); } /** @@ -165,7 +165,7 @@ 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()); + return post("coupon", "updateForItems", path, params.toFormData()); } /** @@ -174,7 +174,7 @@ Response updateForItemsRaw(String couponId, CouponUpdateForItemsParams params) Response updateForItemsRaw(String couponId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/coupons/{coupon-id}/update_for_items", "coupon-id", couponId); - return postJson(path, jsonPayload); + return postJson("coupon", "updateForItems", path, jsonPayload); } public CouponUpdateForItemsResponse updateForItems( @@ -188,7 +188,7 @@ public CompletableFuture updateForItemsAsync( String couponId, CouponUpdateForItemsParams params) { String path = buildPathWithParams("/coupons/{coupon-id}/update_for_items", "coupon-id", couponId); - return postAsync(path, params.toFormData()) + return postAsync("coupon", "updateForItems", path, params.toFormData()) .thenApply( response -> CouponUpdateForItemsResponse.fromJson(response.getBodyAsString(), response)); @@ -204,7 +204,7 @@ public CompletableFuture updateForItemsAsync(Strin String path = buildPathWithParams("/coupons/{coupon-id}/update_for_items", "coupon-id", couponId); - return postAsync(path, null) + return postAsync("coupon", "updateForItems", path, null) .thenApply( response -> CouponUpdateForItemsResponse.fromJson(response.getBodyAsString(), response)); @@ -214,7 +214,7 @@ public CompletableFuture updateForItemsAsync(Strin Response unarchiveRaw(String couponId) throws ChargebeeException { String path = buildPathWithParams("/coupons/{coupon-id}/unarchive", "coupon-id", couponId); - return post(path, null); + return post("coupon", "unarchive", path, null); } public CouponUnarchiveResponse unarchive(String couponId) throws ChargebeeException { @@ -226,7 +226,7 @@ public CouponUnarchiveResponse unarchive(String couponId) throws ChargebeeExcept public CompletableFuture unarchiveAsync(String couponId) { String path = buildPathWithParams("/coupons/{coupon-id}/unarchive", "coupon-id", couponId); - return postAsync(path, null) + return postAsync("coupon", "unarchive", path, null) .thenApply( response -> CouponUnarchiveResponse.fromJson(response.getBodyAsString(), response)); } @@ -235,7 +235,7 @@ public CompletableFuture unarchiveAsync(String couponId Response deleteRaw(String couponId) throws ChargebeeException { String path = buildPathWithParams("/coupons/{coupon-id}/delete", "coupon-id", couponId); - return post(path, null); + return post("coupon", "delete", path, null); } public CouponDeleteResponse delete(String couponId) throws ChargebeeException { @@ -247,20 +247,20 @@ public CouponDeleteResponse delete(String couponId) throws ChargebeeException { public CompletableFuture deleteAsync(String couponId) { String path = buildPathWithParams("/coupons/{coupon-id}/delete", "coupon-id", couponId); - return postAsync(path, null) + return postAsync("coupon", "delete", path, null) .thenApply(response -> CouponDeleteResponse.fromJson(response.getBodyAsString(), response)); } /** copy a coupon using immutable params (executes immediately) - returns raw Response. */ Response copyRaw(CouponCopyParams params) throws ChargebeeException { - return post("/coupons/copy", params != null ? params.toFormData() : null); + return post("coupon", "copy", "/coupons/copy", params != null ? params.toFormData() : null); } /** copy a coupon using raw JSON payload (executes immediately) - returns raw Response. */ Response copyRaw(String jsonPayload) throws ChargebeeException { - return postJson("/coupons/copy", jsonPayload); + return postJson("coupon", "copy", "/coupons/copy", jsonPayload); } public CouponCopyResponse copy(CouponCopyParams params) throws ChargebeeException { @@ -272,7 +272,7 @@ public CouponCopyResponse copy(CouponCopyParams params) throws ChargebeeExceptio /** Async variant of copy for coupon with params. */ public CompletableFuture copyAsync(CouponCopyParams params) { - return postAsync("/coupons/copy", params != null ? params.toFormData() : null) + return postAsync("coupon", "copy", "/coupons/copy", params != null ? params.toFormData() : null) .thenApply(response -> CouponCopyResponse.fromJson(response.getBodyAsString(), response)); } @@ -280,7 +280,7 @@ public CompletableFuture copyAsync(CouponCopyParams params) Response retrieveRaw(String couponId) throws ChargebeeException { String path = buildPathWithParams("/coupons/{coupon-id}", "coupon-id", couponId); - return get(path, null); + return get("coupon", "retrieve", path, null); } public CouponRetrieveResponse retrieve(String couponId) throws ChargebeeException { @@ -292,7 +292,7 @@ public CouponRetrieveResponse retrieve(String couponId) throws ChargebeeExceptio public CompletableFuture retrieveAsync(String couponId) { String path = buildPathWithParams("/coupons/{coupon-id}", "coupon-id", couponId); - return getAsync(path, null) + return getAsync("coupon", "retrieve", path, null) .thenApply( response -> CouponRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -301,19 +301,19 @@ public CompletableFuture retrieveAsync(String couponId) Response updateRaw(String couponId) throws ChargebeeException { String path = buildPathWithParams("/coupons/{coupon-id}", "coupon-id", couponId); - return post(path, null); + return post("coupon", "update", path, null); } /** update a coupon using immutable params (executes immediately) - returns raw Response. */ Response updateRaw(String couponId, CouponUpdateParams params) throws ChargebeeException { String path = buildPathWithParams("/coupons/{coupon-id}", "coupon-id", couponId); - return post(path, params.toFormData()); + return post("coupon", "update", path, params.toFormData()); } /** update a coupon using raw JSON payload (executes immediately) - returns raw Response. */ Response updateRaw(String couponId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/coupons/{coupon-id}", "coupon-id", couponId); - return postJson(path, jsonPayload); + return postJson("coupon", "update", path, jsonPayload); } public CouponUpdateResponse update(String couponId, CouponUpdateParams params) @@ -326,7 +326,7 @@ public CouponUpdateResponse update(String couponId, CouponUpdateParams params) public CompletableFuture updateAsync( String couponId, CouponUpdateParams params) { String path = buildPathWithParams("/coupons/{coupon-id}", "coupon-id", couponId); - return postAsync(path, params.toFormData()) + return postAsync("coupon", "update", path, params.toFormData()) .thenApply(response -> CouponUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -339,7 +339,7 @@ public CouponUpdateResponse update(String couponId) throws ChargebeeException { public CompletableFuture updateAsync(String couponId) { String path = buildPathWithParams("/coupons/{coupon-id}", "coupon-id", couponId); - return postAsync(path, null) + return postAsync("coupon", "update", path, null) .thenApply(response -> CouponUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -348,7 +348,11 @@ public CompletableFuture updateAsync(String couponId) { */ Response createForItemsRaw(CouponCreateForItemsParams params) throws ChargebeeException { - return post("/coupons/create_for_items", params != null ? params.toFormData() : null); + return post( + "coupon", + "createForItems", + "/coupons/create_for_items", + params != null ? params.toFormData() : null); } /** @@ -356,7 +360,7 @@ Response createForItemsRaw(CouponCreateForItemsParams params) throws ChargebeeEx */ Response createForItemsRaw(String jsonPayload) throws ChargebeeException { - return postJson("/coupons/create_for_items", jsonPayload); + return postJson("coupon", "createForItems", "/coupons/create_for_items", jsonPayload); } public CouponCreateForItemsResponse createForItems(CouponCreateForItemsParams params) @@ -370,7 +374,11 @@ public CouponCreateForItemsResponse createForItems(CouponCreateForItemsParams pa public CompletableFuture createForItemsAsync( CouponCreateForItemsParams params) { - return postAsync("/coupons/create_for_items", params != null ? params.toFormData() : null) + return postAsync( + "coupon", + "createForItems", + "/coupons/create_for_items", + params != null ? params.toFormData() : null) .thenApply( response -> 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 ef39960c6..f745f942b 100644 --- a/src/main/java/com/chargebee/v4/services/CouponSetService.java +++ b/src/main/java/com/chargebee/v4/services/CouponSetService.java @@ -72,13 +72,13 @@ public CouponSetService withOptions(RequestOptions options) { /** list a couponSet using immutable params (executes immediately) - returns raw Response. */ Response listRaw(CouponSetListParams params) throws ChargebeeException { - return get("/coupon_sets", params != null ? params.toQueryParams() : null); + return get("couponSet", "list", "/coupon_sets", params != null ? params.toQueryParams() : null); } /** list a couponSet without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/coupon_sets", null); + return get("couponSet", "list", "/coupon_sets", null); } /** list a couponSet using raw JSON payload (executes immediately) - returns raw Response. */ @@ -96,7 +96,8 @@ public CouponSetListResponse list(CouponSetListParams params) throws ChargebeeEx /** Async variant of list for couponSet with params. */ public CompletableFuture listAsync(CouponSetListParams params) { - return getAsync("/coupon_sets", params != null ? params.toQueryParams() : null) + return getAsync( + "couponSet", "list", "/coupon_sets", params != null ? params.toQueryParams() : null) .thenApply( response -> CouponSetListResponse.fromJson(response.getBodyAsString(), this, params, response)); @@ -111,7 +112,7 @@ public CouponSetListResponse list() throws ChargebeeException { /** Async variant of list for couponSet without params. */ public CompletableFuture listAsync() { - return getAsync("/coupon_sets", null) + return getAsync("couponSet", "list", "/coupon_sets", null) .thenApply( response -> CouponSetListResponse.fromJson(response.getBodyAsString(), this, null, response)); @@ -120,13 +121,13 @@ public CompletableFuture listAsync() { /** create a couponSet using immutable params (executes immediately) - returns raw Response. */ Response createRaw(CouponSetCreateParams params) throws ChargebeeException { - return post("/coupon_sets", params != null ? params.toFormData() : null); + return post("couponSet", "create", "/coupon_sets", params != null ? params.toFormData() : null); } /** create a couponSet using raw JSON payload (executes immediately) - returns raw Response. */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/coupon_sets", jsonPayload); + return postJson("couponSet", "create", "/coupon_sets", jsonPayload); } public CouponSetCreateResponse create(CouponSetCreateParams params) throws ChargebeeException { @@ -138,7 +139,8 @@ public CouponSetCreateResponse create(CouponSetCreateParams params) throws Charg /** Async variant of create for couponSet with params. */ public CompletableFuture createAsync(CouponSetCreateParams params) { - return postAsync("/coupon_sets", params != null ? params.toFormData() : null) + return postAsync( + "couponSet", "create", "/coupon_sets", params != null ? params.toFormData() : null) .thenApply( response -> CouponSetCreateResponse.fromJson(response.getBodyAsString(), response)); } @@ -148,21 +150,21 @@ Response updateRaw(String couponSetId) throws ChargebeeException { String path = buildPathWithParams("/coupon_sets/{coupon-set-id}/update", "coupon-set-id", couponSetId); - return post(path, null); + return post("couponSet", "update", path, null); } /** 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()); + return post("couponSet", "update", path, params.toFormData()); } /** 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); + return postJson("couponSet", "update", path, jsonPayload); } public CouponSetUpdateResponse update(String couponSetId, CouponSetUpdateParams params) @@ -176,7 +178,7 @@ public CompletableFuture updateAsync( String couponSetId, CouponSetUpdateParams params) { String path = buildPathWithParams("/coupon_sets/{coupon-set-id}/update", "coupon-set-id", couponSetId); - return postAsync(path, params.toFormData()) + return postAsync("couponSet", "update", path, params.toFormData()) .thenApply( response -> CouponSetUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -191,7 +193,7 @@ public CompletableFuture updateAsync(String couponSetId String path = buildPathWithParams("/coupon_sets/{coupon-set-id}/update", "coupon-set-id", couponSetId); - return postAsync(path, null) + return postAsync("couponSet", "update", path, null) .thenApply( response -> CouponSetUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -200,7 +202,7 @@ public CompletableFuture updateAsync(String couponSetId Response retrieveRaw(String couponSetId) throws ChargebeeException { String path = buildPathWithParams("/coupon_sets/{coupon-set-id}", "coupon-set-id", couponSetId); - return get(path, null); + return get("couponSet", "retrieve", path, null); } public CouponSetRetrieveResponse retrieve(String couponSetId) throws ChargebeeException { @@ -212,7 +214,7 @@ public CouponSetRetrieveResponse retrieve(String couponSetId) throws ChargebeeEx public CompletableFuture retrieveAsync(String couponSetId) { String path = buildPathWithParams("/coupon_sets/{coupon-set-id}", "coupon-set-id", couponSetId); - return getAsync(path, null) + return getAsync("couponSet", "retrieve", path, null) .thenApply( response -> CouponSetRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -223,7 +225,7 @@ Response addCouponCodesRaw(String couponSetId) throws ChargebeeException { buildPathWithParams( "/coupon_sets/{coupon-set-id}/add_coupon_codes", "coupon-set-id", couponSetId); - return post(path, null); + return post("couponSet", "addCouponCodes", path, null); } /** @@ -235,7 +237,7 @@ Response addCouponCodesRaw(String couponSetId, CouponSetAddCouponCodesParams par String path = buildPathWithParams( "/coupon_sets/{coupon-set-id}/add_coupon_codes", "coupon-set-id", couponSetId); - return post(path, params.toFormData()); + return post("couponSet", "addCouponCodes", path, params.toFormData()); } /** @@ -246,7 +248,7 @@ Response addCouponCodesRaw(String couponSetId, String jsonPayload) throws Charge String path = buildPathWithParams( "/coupon_sets/{coupon-set-id}/add_coupon_codes", "coupon-set-id", couponSetId); - return postJson(path, jsonPayload); + return postJson("couponSet", "addCouponCodes", path, jsonPayload); } public CouponSetAddCouponCodesResponse addCouponCodes( @@ -261,7 +263,7 @@ public CompletableFuture addCouponCodesAsync( String path = buildPathWithParams( "/coupon_sets/{coupon-set-id}/add_coupon_codes", "coupon-set-id", couponSetId); - return postAsync(path, params.toFormData()) + return postAsync("couponSet", "addCouponCodes", path, params.toFormData()) .thenApply( response -> CouponSetAddCouponCodesResponse.fromJson(response.getBodyAsString(), response)); @@ -280,7 +282,7 @@ public CompletableFuture addCouponCodesAsync( buildPathWithParams( "/coupon_sets/{coupon-set-id}/add_coupon_codes", "coupon-set-id", couponSetId); - return postAsync(path, null) + return postAsync("couponSet", "addCouponCodes", path, null) .thenApply( response -> CouponSetAddCouponCodesResponse.fromJson(response.getBodyAsString(), response)); @@ -294,7 +296,7 @@ Response deleteUnusedCouponCodesRaw(String couponSetId) throws ChargebeeExceptio "coupon-set-id", couponSetId); - return post(path, null); + return post("couponSet", "deleteUnusedCouponCodes", path, null); } public CouponSetDeleteUnusedCouponCodesResponse deleteUnusedCouponCodes(String couponSetId) @@ -312,7 +314,7 @@ public CompletableFuture deleteUnusedC "coupon-set-id", couponSetId); - return postAsync(path, null) + return postAsync("couponSet", "deleteUnusedCouponCodes", path, null) .thenApply( response -> CouponSetDeleteUnusedCouponCodesResponse.fromJson( @@ -324,7 +326,7 @@ Response deleteRaw(String couponSetId) throws ChargebeeException { String path = buildPathWithParams("/coupon_sets/{coupon-set-id}/delete", "coupon-set-id", couponSetId); - return post(path, null); + return post("couponSet", "delete", path, null); } public CouponSetDeleteResponse delete(String couponSetId) throws ChargebeeException { @@ -337,7 +339,7 @@ public CompletableFuture deleteAsync(String couponSetId String path = buildPathWithParams("/coupon_sets/{coupon-set-id}/delete", "coupon-set-id", couponSetId); - return postAsync(path, null) + return postAsync("couponSet", "delete", path, null) .thenApply( response -> 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 2c58f577f..2b3b52456 100644 --- a/src/main/java/com/chargebee/v4/services/CreditNoteService.java +++ b/src/main/java/com/chargebee/v4/services/CreditNoteService.java @@ -103,7 +103,7 @@ Response recordRefundRaw(String creditNoteId) throws ChargebeeException { buildPathWithParams( "/credit_notes/{credit-note-id}/record_refund", "credit-note-id", creditNoteId); - return post(path, null); + return post("creditNote", "recordRefund", path, null); } /** @@ -114,7 +114,7 @@ Response recordRefundRaw(String creditNoteId, CreditNoteRecordRefundParams param String path = buildPathWithParams( "/credit_notes/{credit-note-id}/record_refund", "credit-note-id", creditNoteId); - return post(path, params.toFormData()); + return post("creditNote", "recordRefund", path, params.toFormData()); } /** @@ -124,7 +124,7 @@ Response recordRefundRaw(String creditNoteId, String jsonPayload) throws Chargeb String path = buildPathWithParams( "/credit_notes/{credit-note-id}/record_refund", "credit-note-id", creditNoteId); - return postJson(path, jsonPayload); + return postJson("creditNote", "recordRefund", path, jsonPayload); } public CreditNoteRecordRefundResponse recordRefund( @@ -139,7 +139,7 @@ public CompletableFuture recordRefundAsync( String path = buildPathWithParams( "/credit_notes/{credit-note-id}/record_refund", "credit-note-id", creditNoteId); - return postAsync(path, params.toFormData()) + return postAsync("creditNote", "recordRefund", path, params.toFormData()) .thenApply( response -> CreditNoteRecordRefundResponse.fromJson(response.getBodyAsString(), response)); @@ -157,7 +157,7 @@ public CompletableFuture recordRefundAsync(Strin buildPathWithParams( "/credit_notes/{credit-note-id}/record_refund", "credit-note-id", creditNoteId); - return postAsync(path, null) + return postAsync("creditNote", "recordRefund", path, null) .thenApply( response -> CreditNoteRecordRefundResponse.fromJson(response.getBodyAsString(), response)); @@ -169,7 +169,11 @@ public CompletableFuture recordRefundAsync(Strin */ Response importCreditNoteRaw(ImportCreditNoteParams params) throws ChargebeeException { - return post("/credit_notes/import_credit_note", params != null ? params.toFormData() : null); + return post( + "creditNote", + "importCreditNote", + "/credit_notes/import_credit_note", + params != null ? params.toFormData() : null); } /** @@ -178,7 +182,8 @@ Response importCreditNoteRaw(ImportCreditNoteParams params) throws ChargebeeExce */ Response importCreditNoteRaw(String jsonPayload) throws ChargebeeException { - return postJson("/credit_notes/import_credit_note", jsonPayload); + return postJson( + "creditNote", "importCreditNote", "/credit_notes/import_credit_note", jsonPayload); } public ImportCreditNoteResponse importCreditNote(ImportCreditNoteParams params) @@ -193,7 +198,10 @@ public CompletableFuture importCreditNoteAsync( ImportCreditNoteParams params) { return postAsync( - "/credit_notes/import_credit_note", params != null ? params.toFormData() : null) + "creditNote", + "importCreditNote", + "/credit_notes/import_credit_note", + params != null ? params.toFormData() : null) .thenApply( response -> ImportCreditNoteResponse.fromJson(response.getBodyAsString(), response)); } @@ -204,7 +212,7 @@ Response deleteRaw(String creditNoteId) throws ChargebeeException { buildPathWithParams( "/credit_notes/{credit-note-id}/delete", "credit-note-id", creditNoteId); - return post(path, null); + return post("creditNote", "delete", path, null); } /** delete a creditNote using immutable params (executes immediately) - returns raw Response. */ @@ -212,7 +220,7 @@ Response deleteRaw(String creditNoteId, CreditNoteDeleteParams params) throws Ch String path = buildPathWithParams( "/credit_notes/{credit-note-id}/delete", "credit-note-id", creditNoteId); - return post(path, params.toFormData()); + return post("creditNote", "delete", path, params.toFormData()); } /** delete a creditNote using raw JSON payload (executes immediately) - returns raw Response. */ @@ -220,7 +228,7 @@ Response deleteRaw(String creditNoteId, String jsonPayload) throws ChargebeeExce String path = buildPathWithParams( "/credit_notes/{credit-note-id}/delete", "credit-note-id", creditNoteId); - return postJson(path, jsonPayload); + return postJson("creditNote", "delete", path, jsonPayload); } public CreditNoteDeleteResponse delete(String creditNoteId, CreditNoteDeleteParams params) @@ -235,7 +243,7 @@ public CompletableFuture deleteAsync( String path = buildPathWithParams( "/credit_notes/{credit-note-id}/delete", "credit-note-id", creditNoteId); - return postAsync(path, params.toFormData()) + return postAsync("creditNote", "delete", path, params.toFormData()) .thenApply( response -> CreditNoteDeleteResponse.fromJson(response.getBodyAsString(), response)); } @@ -251,7 +259,7 @@ public CompletableFuture deleteAsync(String creditNote buildPathWithParams( "/credit_notes/{credit-note-id}/delete", "credit-note-id", creditNoteId); - return postAsync(path, null) + return postAsync("creditNote", "delete", path, null) .thenApply( response -> CreditNoteDeleteResponse.fromJson(response.getBodyAsString(), response)); } @@ -264,7 +272,11 @@ Response creditNotesForCustomerRaw(String customerId, CreditNotesForCustomerPara throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/credit_notes", "customer-id", customerId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "creditNote", + "creditNotesForCustomer", + path, + params != null ? params.toQueryParams() : null); } /** @@ -274,7 +286,7 @@ Response creditNotesForCustomerRaw(String customerId, CreditNotesForCustomerPara Response creditNotesForCustomerRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/credit_notes", "customer-id", customerId); - return get(path, null); + return get("creditNote", "creditNotesForCustomer", path, null); } /** @@ -307,7 +319,11 @@ public CompletableFuture creditNotesForCustomerA String customerId, CreditNotesForCustomerParams params) { String path = buildPathWithParams("/customers/{customer-id}/credit_notes", "customer-id", customerId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "creditNote", + "creditNotesForCustomer", + path, + params != null ? params.toQueryParams() : null) .thenApply( response -> CreditNotesForCustomerResponse.fromJson( @@ -319,7 +335,7 @@ public CompletableFuture creditNotesForCustomerA String customerId) { String path = buildPathWithParams("/customers/{customer-id}/credit_notes", "customer-id", customerId); - return getAsync(path, null) + return getAsync("creditNote", "creditNotesForCustomer", path, null) .thenApply( response -> CreditNotesForCustomerResponse.fromJson( @@ -331,21 +347,21 @@ Response pdfRaw(String creditNoteId) throws ChargebeeException { String path = buildPathWithParams("/credit_notes/{credit-note-id}/pdf", "credit-note-id", creditNoteId); - return post(path, null); + return post("creditNote", "pdf", path, null); } /** 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()); + return post("creditNote", "pdf", path, params.toFormData()); } /** 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); + return postJson("creditNote", "pdf", path, jsonPayload); } public CreditNotePdfResponse pdf(String creditNoteId, CreditNotePdfParams params) @@ -359,7 +375,7 @@ public CompletableFuture pdfAsync( String creditNoteId, CreditNotePdfParams params) { String path = buildPathWithParams("/credit_notes/{credit-note-id}/pdf", "credit-note-id", creditNoteId); - return postAsync(path, params.toFormData()) + return postAsync("creditNote", "pdf", path, params.toFormData()) .thenApply( response -> CreditNotePdfResponse.fromJson(response.getBodyAsString(), response)); } @@ -374,7 +390,7 @@ public CompletableFuture pdfAsync(String creditNoteId) { String path = buildPathWithParams("/credit_notes/{credit-note-id}/pdf", "credit-note-id", creditNoteId); - return postAsync(path, null) + return postAsync("creditNote", "pdf", path, null) .thenApply( response -> CreditNotePdfResponse.fromJson(response.getBodyAsString(), response)); } @@ -385,7 +401,7 @@ Response sendEinvoiceRaw(String creditNoteId) throws ChargebeeException { buildPathWithParams( "/credit_notes/{credit-note-id}/send_einvoice", "credit-note-id", creditNoteId); - return post(path, null); + return post("creditNote", "sendEinvoice", path, null); } public CreditNoteSendEinvoiceResponse sendEinvoice(String creditNoteId) @@ -400,7 +416,7 @@ public CompletableFuture sendEinvoiceAsync(Strin buildPathWithParams( "/credit_notes/{credit-note-id}/send_einvoice", "credit-note-id", creditNoteId); - return postAsync(path, null) + return postAsync("creditNote", "sendEinvoice", path, null) .thenApply( response -> CreditNoteSendEinvoiceResponse.fromJson(response.getBodyAsString(), response)); @@ -411,7 +427,7 @@ Response voidCreditNoteRaw(String creditNoteId) throws ChargebeeException { String path = buildPathWithParams("/credit_notes/{credit-note-id}/void", "credit-note-id", creditNoteId); - return post(path, null); + return post("creditNote", "voidCreditNote", path, null); } /** @@ -422,7 +438,7 @@ 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()); + return post("creditNote", "voidCreditNote", path, params.toFormData()); } /** @@ -432,7 +448,7 @@ Response voidCreditNoteRaw(String creditNoteId, VoidCreditNoteParams params) 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); + return postJson("creditNote", "voidCreditNote", path, jsonPayload); } public VoidCreditNoteResponse voidCreditNote(String creditNoteId, VoidCreditNoteParams params) @@ -446,7 +462,7 @@ public CompletableFuture voidCreditNoteAsync( String creditNoteId, VoidCreditNoteParams params) { String path = buildPathWithParams("/credit_notes/{credit-note-id}/void", "credit-note-id", creditNoteId); - return postAsync(path, params.toFormData()) + return postAsync("creditNote", "voidCreditNote", path, params.toFormData()) .thenApply( response -> VoidCreditNoteResponse.fromJson(response.getBodyAsString(), response)); } @@ -461,7 +477,7 @@ public CompletableFuture voidCreditNoteAsync(String cred String path = buildPathWithParams("/credit_notes/{credit-note-id}/void", "credit-note-id", creditNoteId); - return postAsync(path, null) + return postAsync("creditNote", "voidCreditNote", path, null) .thenApply( response -> VoidCreditNoteResponse.fromJson(response.getBodyAsString(), response)); } @@ -472,7 +488,7 @@ Response refundRaw(String creditNoteId) throws ChargebeeException { buildPathWithParams( "/credit_notes/{credit-note-id}/refund", "credit-note-id", creditNoteId); - return post(path, null); + return post("creditNote", "refund", path, null); } /** refund a creditNote using immutable params (executes immediately) - returns raw Response. */ @@ -480,7 +496,7 @@ Response refundRaw(String creditNoteId, CreditNoteRefundParams params) throws Ch String path = buildPathWithParams( "/credit_notes/{credit-note-id}/refund", "credit-note-id", creditNoteId); - return post(path, params.toFormData()); + return post("creditNote", "refund", path, params.toFormData()); } /** refund a creditNote using raw JSON payload (executes immediately) - returns raw Response. */ @@ -488,7 +504,7 @@ Response refundRaw(String creditNoteId, String jsonPayload) throws ChargebeeExce String path = buildPathWithParams( "/credit_notes/{credit-note-id}/refund", "credit-note-id", creditNoteId); - return postJson(path, jsonPayload); + return postJson("creditNote", "refund", path, jsonPayload); } public CreditNoteRefundResponse refund(String creditNoteId, CreditNoteRefundParams params) @@ -503,7 +519,7 @@ public CompletableFuture refundAsync( String path = buildPathWithParams( "/credit_notes/{credit-note-id}/refund", "credit-note-id", creditNoteId); - return postAsync(path, params.toFormData()) + return postAsync("creditNote", "refund", path, params.toFormData()) .thenApply( response -> CreditNoteRefundResponse.fromJson(response.getBodyAsString(), response)); } @@ -519,7 +535,7 @@ public CompletableFuture refundAsync(String creditNote buildPathWithParams( "/credit_notes/{credit-note-id}/refund", "credit-note-id", creditNoteId); - return postAsync(path, null) + return postAsync("creditNote", "refund", path, null) .thenApply( response -> CreditNoteRefundResponse.fromJson(response.getBodyAsString(), response)); } @@ -527,13 +543,14 @@ public CompletableFuture refundAsync(String creditNote /** list a creditNote using immutable params (executes immediately) - returns raw Response. */ Response listRaw(CreditNoteListParams params) throws ChargebeeException { - return get("/credit_notes", params != null ? params.toQueryParams() : null); + return get( + "creditNote", "list", "/credit_notes", params != null ? params.toQueryParams() : null); } /** list a creditNote without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/credit_notes", null); + return get("creditNote", "list", "/credit_notes", null); } /** list a creditNote using raw JSON payload (executes immediately) - returns raw Response. */ @@ -551,7 +568,8 @@ public CreditNoteListResponse list(CreditNoteListParams params) throws Chargebee /** Async variant of list for creditNote with params. */ public CompletableFuture listAsync(CreditNoteListParams params) { - return getAsync("/credit_notes", params != null ? params.toQueryParams() : null) + return getAsync( + "creditNote", "list", "/credit_notes", params != null ? params.toQueryParams() : null) .thenApply( response -> CreditNoteListResponse.fromJson( @@ -567,7 +585,7 @@ public CreditNoteListResponse list() throws ChargebeeException { /** Async variant of list for creditNote without params. */ public CompletableFuture listAsync() { - return getAsync("/credit_notes", null) + return getAsync("creditNote", "list", "/credit_notes", null) .thenApply( response -> CreditNoteListResponse.fromJson(response.getBodyAsString(), this, null, response)); @@ -576,13 +594,14 @@ public CompletableFuture listAsync() { /** create a creditNote using immutable params (executes immediately) - returns raw Response. */ Response createRaw(CreditNoteCreateParams params) throws ChargebeeException { - return post("/credit_notes", params != null ? params.toFormData() : null); + return post( + "creditNote", "create", "/credit_notes", params != null ? params.toFormData() : null); } /** create a creditNote using raw JSON payload (executes immediately) - returns raw Response. */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/credit_notes", jsonPayload); + return postJson("creditNote", "create", "/credit_notes", jsonPayload); } public CreditNoteCreateResponse create(CreditNoteCreateParams params) throws ChargebeeException { @@ -594,7 +613,8 @@ public CreditNoteCreateResponse create(CreditNoteCreateParams params) throws Cha /** Async variant of create for creditNote with params. */ public CompletableFuture createAsync(CreditNoteCreateParams params) { - return postAsync("/credit_notes", params != null ? params.toFormData() : null) + return postAsync( + "creditNote", "create", "/credit_notes", params != null ? params.toFormData() : null) .thenApply( response -> CreditNoteCreateResponse.fromJson(response.getBodyAsString(), response)); } @@ -605,7 +625,7 @@ Response downloadEinvoiceRaw(String creditNoteId) throws ChargebeeException { buildPathWithParams( "/credit_notes/{credit-note-id}/download_einvoice", "credit-note-id", creditNoteId); - return get(path, null); + return get("creditNote", "downloadEinvoice", path, null); } public CreditNoteDownloadEinvoiceResponse downloadEinvoice(String creditNoteId) @@ -621,7 +641,7 @@ public CompletableFuture downloadEinvoiceAsy buildPathWithParams( "/credit_notes/{credit-note-id}/download_einvoice", "credit-note-id", creditNoteId); - return getAsync(path, null) + return getAsync("creditNote", "downloadEinvoice", path, null) .thenApply( response -> CreditNoteDownloadEinvoiceResponse.fromJson(response.getBodyAsString(), response)); @@ -633,7 +653,7 @@ Response resendEinvoiceRaw(String creditNoteId) throws ChargebeeException { buildPathWithParams( "/credit_notes/{credit-note-id}/resend_einvoice", "credit-note-id", creditNoteId); - return post(path, null); + return post("creditNote", "resendEinvoice", path, null); } public CreditNoteResendEinvoiceResponse resendEinvoice(String creditNoteId) @@ -649,7 +669,7 @@ public CompletableFuture resendEinvoiceAsync( buildPathWithParams( "/credit_notes/{credit-note-id}/resend_einvoice", "credit-note-id", creditNoteId); - return postAsync(path, null) + return postAsync("creditNote", "resendEinvoice", path, null) .thenApply( response -> CreditNoteResendEinvoiceResponse.fromJson(response.getBodyAsString(), response)); @@ -663,7 +683,7 @@ Response removeTaxWithheldRefundRaw(String creditNoteId) throws ChargebeeExcepti "credit-note-id", creditNoteId); - return post(path, null); + return post("creditNote", "removeTaxWithheldRefund", path, null); } /** @@ -678,7 +698,7 @@ Response removeTaxWithheldRefundRaw( "/credit_notes/{credit-note-id}/remove_tax_withheld_refund", "credit-note-id", creditNoteId); - return post(path, params.toFormData()); + return post("creditNote", "removeTaxWithheldRefund", path, params.toFormData()); } /** @@ -692,7 +712,7 @@ Response removeTaxWithheldRefundRaw(String creditNoteId, String jsonPayload) "/credit_notes/{credit-note-id}/remove_tax_withheld_refund", "credit-note-id", creditNoteId); - return postJson(path, jsonPayload); + return postJson("creditNote", "removeTaxWithheldRefund", path, jsonPayload); } public CreditNoteRemoveTaxWithheldRefundResponse removeTaxWithheldRefund( @@ -710,7 +730,7 @@ public CompletableFuture removeTaxWit "/credit_notes/{credit-note-id}/remove_tax_withheld_refund", "credit-note-id", creditNoteId); - return postAsync(path, params.toFormData()) + return postAsync("creditNote", "removeTaxWithheldRefund", path, params.toFormData()) .thenApply( response -> CreditNoteRemoveTaxWithheldRefundResponse.fromJson( @@ -732,7 +752,7 @@ public CompletableFuture removeTaxWit "credit-note-id", creditNoteId); - return postAsync(path, null) + return postAsync("creditNote", "removeTaxWithheldRefund", path, null) .thenApply( response -> CreditNoteRemoveTaxWithheldRefundResponse.fromJson( @@ -744,7 +764,7 @@ Response retrieveRaw(String creditNoteId) throws ChargebeeException { String path = buildPathWithParams("/credit_notes/{credit-note-id}", "credit-note-id", creditNoteId); - return get(path, null); + return get("creditNote", "retrieve", path, null); } /** retrieve a creditNote using immutable params (executes immediately) - returns raw Response. */ @@ -752,7 +772,7 @@ 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); + return get("creditNote", "retrieve", path, params != null ? params.toQueryParams() : null); } public CreditNoteRetrieveResponse retrieve(String creditNoteId, CreditNoteRetrieveParams params) @@ -766,7 +786,7 @@ public CompletableFuture retrieveAsync( String creditNoteId, CreditNoteRetrieveParams params) { String path = buildPathWithParams("/credit_notes/{credit-note-id}", "credit-note-id", creditNoteId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync("creditNote", "retrieve", path, params != null ? params.toQueryParams() : null) .thenApply( response -> CreditNoteRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -781,7 +801,7 @@ public CompletableFuture retrieveAsync(String credit String path = buildPathWithParams("/credit_notes/{credit-note-id}", "credit-note-id", creditNoteId); - return getAsync(path, null) + return getAsync("creditNote", "retrieve", path, null) .thenApply( response -> 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 fba8beb34..312afde5e 100644 --- a/src/main/java/com/chargebee/v4/services/CsvTaxRuleService.java +++ b/src/main/java/com/chargebee/v4/services/CsvTaxRuleService.java @@ -54,13 +54,14 @@ public CsvTaxRuleService withOptions(RequestOptions options) { /** create a csvTaxRule using immutable params (executes immediately) - returns raw Response. */ Response createRaw(CsvTaxRuleCreateParams params) throws ChargebeeException { - return post("/csv_tax_rules", params != null ? params.toFormData() : null); + return post( + "csvTaxRule", "create", "/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 ChargebeeException { - return postJson("/csv_tax_rules", jsonPayload); + return postJson("csvTaxRule", "create", "/csv_tax_rules", jsonPayload); } public CsvTaxRuleCreateResponse create(CsvTaxRuleCreateParams params) throws ChargebeeException { @@ -72,7 +73,8 @@ public CsvTaxRuleCreateResponse create(CsvTaxRuleCreateParams params) throws Cha /** Async variant of create for csvTaxRule with params. */ public CompletableFuture createAsync(CsvTaxRuleCreateParams params) { - return postAsync("/csv_tax_rules", params != null ? params.toFormData() : null) + return postAsync( + "csvTaxRule", "create", "/csv_tax_rules", params != null ? params.toFormData() : null) .thenApply( response -> 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 47f2dc593..61847cd70 100644 --- a/src/main/java/com/chargebee/v4/services/CurrencyService.java +++ b/src/main/java/com/chargebee/v4/services/CurrencyService.java @@ -73,7 +73,7 @@ Response addScheduleRaw(String siteCurrencyId) throws ChargebeeException { buildPathWithParams( "/currencies/{site-currency-id}/add_schedule", "site-currency-id", siteCurrencyId); - return post(path, null); + return post("currency", "addSchedule", path, null); } /** @@ -84,7 +84,7 @@ Response addScheduleRaw(String siteCurrencyId, CurrencyAddScheduleParams params) String path = buildPathWithParams( "/currencies/{site-currency-id}/add_schedule", "site-currency-id", siteCurrencyId); - return post(path, params.toFormData()); + return post("currency", "addSchedule", path, params.toFormData()); } /** @@ -94,7 +94,7 @@ Response addScheduleRaw(String siteCurrencyId, String jsonPayload) throws Charge String path = buildPathWithParams( "/currencies/{site-currency-id}/add_schedule", "site-currency-id", siteCurrencyId); - return postJson(path, jsonPayload); + return postJson("currency", "addSchedule", path, jsonPayload); } public CurrencyAddScheduleResponse addSchedule( @@ -109,7 +109,7 @@ public CompletableFuture addScheduleAsync( String path = buildPathWithParams( "/currencies/{site-currency-id}/add_schedule", "site-currency-id", siteCurrencyId); - return postAsync(path, params.toFormData()) + return postAsync("currency", "addSchedule", path, params.toFormData()) .thenApply( response -> CurrencyAddScheduleResponse.fromJson(response.getBodyAsString(), response)); } @@ -117,13 +117,13 @@ public CompletableFuture addScheduleAsync( /** create a currency using immutable params (executes immediately) - returns raw Response. */ Response createRaw(CurrencyCreateParams params) throws ChargebeeException { - return post("/currencies", params != null ? params.toFormData() : null); + return post("currency", "create", "/currencies", params != null ? params.toFormData() : null); } /** create a currency using raw JSON payload (executes immediately) - returns raw Response. */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/currencies", jsonPayload); + return postJson("currency", "create", "/currencies", jsonPayload); } public CurrencyCreateResponse create(CurrencyCreateParams params) throws ChargebeeException { @@ -135,7 +135,8 @@ public CurrencyCreateResponse create(CurrencyCreateParams params) throws Chargeb /** Async variant of create for currency with params. */ public CompletableFuture createAsync(CurrencyCreateParams params) { - return postAsync("/currencies", params != null ? params.toFormData() : null) + return postAsync( + "currency", "create", "/currencies", params != null ? params.toFormData() : null) .thenApply( response -> CurrencyCreateResponse.fromJson(response.getBodyAsString(), response)); } @@ -145,7 +146,7 @@ Response retrieveRaw(String siteCurrencyId) throws ChargebeeException { String path = buildPathWithParams("/currencies/{site-currency-id}", "site-currency-id", siteCurrencyId); - return get(path, null); + return get("currency", "retrieve", path, null); } public CurrencyRetrieveResponse retrieve(String siteCurrencyId) throws ChargebeeException { @@ -158,7 +159,7 @@ public CompletableFuture retrieveAsync(String siteCurr String path = buildPathWithParams("/currencies/{site-currency-id}", "site-currency-id", siteCurrencyId); - return getAsync(path, null) + return getAsync("currency", "retrieve", path, null) .thenApply( response -> CurrencyRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -168,21 +169,21 @@ Response updateRaw(String siteCurrencyId) throws ChargebeeException { String path = buildPathWithParams("/currencies/{site-currency-id}", "site-currency-id", siteCurrencyId); - return post(path, null); + return post("currency", "update", path, null); } /** update a currency using immutable params (executes immediately) - returns raw Response. */ Response updateRaw(String siteCurrencyId, CurrencyUpdateParams params) throws ChargebeeException { String path = buildPathWithParams("/currencies/{site-currency-id}", "site-currency-id", siteCurrencyId); - return post(path, params.toFormData()); + return post("currency", "update", path, params.toFormData()); } /** update a currency using raw JSON payload (executes immediately) - returns raw Response. */ Response updateRaw(String siteCurrencyId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/currencies/{site-currency-id}", "site-currency-id", siteCurrencyId); - return postJson(path, jsonPayload); + return postJson("currency", "update", path, jsonPayload); } public CurrencyUpdateResponse update(String siteCurrencyId, CurrencyUpdateParams params) @@ -196,7 +197,7 @@ public CompletableFuture updateAsync( String siteCurrencyId, CurrencyUpdateParams params) { String path = buildPathWithParams("/currencies/{site-currency-id}", "site-currency-id", siteCurrencyId); - return postAsync(path, params.toFormData()) + return postAsync("currency", "update", path, params.toFormData()) .thenApply( response -> CurrencyUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -207,7 +208,7 @@ Response removeScheduleRaw(String siteCurrencyId) throws ChargebeeException { buildPathWithParams( "/currencies/{site-currency-id}/remove_schedule", "site-currency-id", siteCurrencyId); - return post(path, null); + return post("currency", "removeSchedule", path, null); } public CurrencyRemoveScheduleResponse removeSchedule(String siteCurrencyId) @@ -223,7 +224,7 @@ public CompletableFuture removeScheduleAsync( buildPathWithParams( "/currencies/{site-currency-id}/remove_schedule", "site-currency-id", siteCurrencyId); - return postAsync(path, null) + return postAsync("currency", "removeSchedule", path, null) .thenApply( response -> CurrencyRemoveScheduleResponse.fromJson(response.getBodyAsString(), response)); @@ -232,13 +233,14 @@ public CompletableFuture removeScheduleAsync( /** 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); + return get( + "currency", "list", "/currencies/list", params != null ? params.toQueryParams() : null); } /** list a currency without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/currencies/list", null); + return get("currency", "list", "/currencies/list", null); } /** list a currency using raw JSON payload (executes immediately) - returns raw Response. */ @@ -256,7 +258,8 @@ public CurrencyListResponse list(CurrencyListParams params) throws ChargebeeExce /** Async variant of list for currency with params. */ public CompletableFuture listAsync(CurrencyListParams params) { - return getAsync("/currencies/list", params != null ? params.toQueryParams() : null) + return getAsync( + "currency", "list", "/currencies/list", params != null ? params.toQueryParams() : null) .thenApply( response -> CurrencyListResponse.fromJson(response.getBodyAsString(), this, params, response)); @@ -271,7 +274,7 @@ public CurrencyListResponse list() throws ChargebeeException { /** Async variant of list for currency without params. */ public CompletableFuture listAsync() { - return getAsync("/currencies/list", null) + return getAsync("currency", "list", "/currencies/list", null) .thenApply( response -> 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 44d6369a6..0f51a8217 100644 --- a/src/main/java/com/chargebee/v4/services/CustomerEntitlementService.java +++ b/src/main/java/com/chargebee/v4/services/CustomerEntitlementService.java @@ -62,7 +62,11 @@ Response entitlementsForCustomerRaw( String path = buildPathWithParams( "/customers/{customer-id}/customer_entitlements", "customer-id", customerId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "customerEntitlement", + "entitlementsForCustomer", + path, + params != null ? params.toQueryParams() : null); } /** @@ -73,7 +77,7 @@ Response entitlementsForCustomerRaw(String customerId) throws ChargebeeException String path = buildPathWithParams( "/customers/{customer-id}/customer_entitlements", "customer-id", customerId); - return get(path, null); + return get("customerEntitlement", "entitlementsForCustomer", path, null); } /** @@ -110,7 +114,11 @@ public CustomerEntitlementEntitlementsForCustomerResponse entitlementsForCustome String path = buildPathWithParams( "/customers/{customer-id}/customer_entitlements", "customer-id", customerId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "customerEntitlement", + "entitlementsForCustomer", + path, + params != null ? params.toQueryParams() : null) .thenApply( response -> CustomerEntitlementEntitlementsForCustomerResponse.fromJson( @@ -123,7 +131,7 @@ public CustomerEntitlementEntitlementsForCustomerResponse entitlementsForCustome String path = buildPathWithParams( "/customers/{customer-id}/customer_entitlements", "customer-id", customerId); - return getAsync(path, null) + return getAsync("customerEntitlement", "entitlementsForCustomer", path, null) .thenApply( response -> CustomerEntitlementEntitlementsForCustomerResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/CustomerService.java b/src/main/java/com/chargebee/v4/services/CustomerService.java index 6522451d8..b8b888fc6 100644 --- a/src/main/java/com/chargebee/v4/services/CustomerService.java +++ b/src/main/java/com/chargebee/v4/services/CustomerService.java @@ -149,19 +149,19 @@ public CustomerService withOptions(RequestOptions options) { Response deleteRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/delete", "customer-id", customerId); - return post(path, null); + return post("customer", "delete", path, null); } /** 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()); + return post("customer", "delete", path, params.toFormData()); } /** 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); + return postJson("customer", "delete", path, jsonPayload); } public CustomerDeleteResponse delete(String customerId, CustomerDeleteParams params) @@ -174,7 +174,7 @@ public CustomerDeleteResponse delete(String customerId, CustomerDeleteParams par public CompletableFuture deleteAsync( String customerId, CustomerDeleteParams params) { String path = buildPathWithParams("/customers/{customer-id}/delete", "customer-id", customerId); - return postAsync(path, params.toFormData()) + return postAsync("customer", "delete", path, params.toFormData()) .thenApply( response -> CustomerDeleteResponse.fromJson(response.getBodyAsString(), response)); } @@ -188,7 +188,7 @@ public CustomerDeleteResponse delete(String customerId) throws ChargebeeExceptio public CompletableFuture deleteAsync(String customerId) { String path = buildPathWithParams("/customers/{customer-id}/delete", "customer-id", customerId); - return postAsync(path, null) + return postAsync("customer", "delete", path, null) .thenApply( response -> CustomerDeleteResponse.fromJson(response.getBodyAsString(), response)); } @@ -199,7 +199,7 @@ Response addPromotionalCreditsRaw(String customerId) throws ChargebeeException { buildPathWithParams( "/customers/{customer-id}/add_promotional_credits", "customer-id", customerId); - return post(path, null); + return post("customer", "addPromotionalCredits", path, null); } /** @@ -211,7 +211,7 @@ Response addPromotionalCreditsRaw(String customerId, CustomerAddPromotionalCredi String path = buildPathWithParams( "/customers/{customer-id}/add_promotional_credits", "customer-id", customerId); - return post(path, params.toFormData()); + return post("customer", "addPromotionalCredits", path, params.toFormData()); } /** @@ -223,7 +223,7 @@ Response addPromotionalCreditsRaw(String customerId, String jsonPayload) String path = buildPathWithParams( "/customers/{customer-id}/add_promotional_credits", "customer-id", customerId); - return postJson(path, jsonPayload); + return postJson("customer", "addPromotionalCredits", path, jsonPayload); } public CustomerAddPromotionalCreditsResponse addPromotionalCredits( @@ -238,7 +238,7 @@ public CompletableFuture addPromotionalCr String path = buildPathWithParams( "/customers/{customer-id}/add_promotional_credits", "customer-id", customerId); - return postAsync(path, params.toFormData()) + return postAsync("customer", "addPromotionalCredits", path, params.toFormData()) .thenApply( response -> CustomerAddPromotionalCreditsResponse.fromJson( @@ -250,7 +250,7 @@ Response relationshipsRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/relationships", "customer-id", customerId); - return post(path, null); + return post("customer", "relationships", path, null); } /** @@ -260,7 +260,7 @@ Response relationshipsRaw(String customerId, CustomerRelationshipsParams params) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/relationships", "customer-id", customerId); - return post(path, params.toFormData()); + return post("customer", "relationships", path, params.toFormData()); } /** @@ -269,7 +269,7 @@ Response relationshipsRaw(String customerId, CustomerRelationshipsParams params) Response relationshipsRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/relationships", "customer-id", customerId); - return postJson(path, jsonPayload); + return postJson("customer", "relationships", path, jsonPayload); } public CustomerRelationshipsResponse relationships( @@ -283,7 +283,7 @@ public CompletableFuture relationshipsAsync( String customerId, CustomerRelationshipsParams params) { String path = buildPathWithParams("/customers/{customer-id}/relationships", "customer-id", customerId); - return postAsync(path, params.toFormData()) + return postAsync("customer", "relationships", path, params.toFormData()) .thenApply( response -> CustomerRelationshipsResponse.fromJson(response.getBodyAsString(), response)); @@ -299,7 +299,7 @@ public CompletableFuture relationshipsAsync(Strin String path = buildPathWithParams("/customers/{customer-id}/relationships", "customer-id", customerId); - return postAsync(path, null) + return postAsync("customer", "relationships", path, null) .thenApply( response -> CustomerRelationshipsResponse.fromJson(response.getBodyAsString(), response)); @@ -311,7 +311,7 @@ Response deleteRelationshipRaw(String customerId) throws ChargebeeException { buildPathWithParams( "/customers/{customer-id}/delete_relationship", "customer-id", customerId); - return post(path, null); + return post("customer", "deleteRelationship", path, null); } public CustomerDeleteRelationshipResponse deleteRelationship(String customerId) @@ -327,7 +327,7 @@ public CompletableFuture deleteRelationshipA buildPathWithParams( "/customers/{customer-id}/delete_relationship", "customer-id", customerId); - return postAsync(path, null) + return postAsync("customer", "deleteRelationship", path, null) .thenApply( response -> CustomerDeleteRelationshipResponse.fromJson(response.getBodyAsString(), response)); @@ -338,7 +338,7 @@ Response deleteContactRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/delete_contact", "customer-id", customerId); - return post(path, null); + return post("customer", "deleteContact", path, null); } /** @@ -348,7 +348,7 @@ Response deleteContactRaw(String customerId, CustomerDeleteContactParams params) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/delete_contact", "customer-id", customerId); - return post(path, params.toFormData()); + return post("customer", "deleteContact", path, params.toFormData()); } /** @@ -357,7 +357,7 @@ Response deleteContactRaw(String customerId, CustomerDeleteContactParams params) Response deleteContactRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/delete_contact", "customer-id", customerId); - return postJson(path, jsonPayload); + return postJson("customer", "deleteContact", path, jsonPayload); } public CustomerDeleteContactResponse deleteContact( @@ -371,7 +371,7 @@ public CompletableFuture deleteContactAsync( String customerId, CustomerDeleteContactParams params) { String path = buildPathWithParams("/customers/{customer-id}/delete_contact", "customer-id", customerId); - return postAsync(path, params.toFormData()) + return postAsync("customer", "deleteContact", path, params.toFormData()) .thenApply( response -> CustomerDeleteContactResponse.fromJson(response.getBodyAsString(), response)); @@ -387,7 +387,7 @@ public CompletableFuture deleteContactAsync(Strin String path = buildPathWithParams("/customers/{customer-id}/delete_contact", "customer-id", customerId); - return postAsync(path, null) + return postAsync("customer", "deleteContact", path, null) .thenApply( response -> CustomerDeleteContactResponse.fromJson(response.getBodyAsString(), response)); @@ -399,7 +399,7 @@ Response assignPaymentRoleRaw(String customerId) throws ChargebeeException { buildPathWithParams( "/customers/{customer-id}/assign_payment_role", "customer-id", customerId); - return post(path, null); + return post("customer", "assignPaymentRole", path, null); } /** @@ -411,7 +411,7 @@ Response assignPaymentRoleRaw(String customerId, CustomerAssignPaymentRoleParams String path = buildPathWithParams( "/customers/{customer-id}/assign_payment_role", "customer-id", customerId); - return post(path, params.toFormData()); + return post("customer", "assignPaymentRole", path, params.toFormData()); } /** @@ -422,7 +422,7 @@ Response assignPaymentRoleRaw(String customerId, String jsonPayload) throws Char String path = buildPathWithParams( "/customers/{customer-id}/assign_payment_role", "customer-id", customerId); - return postJson(path, jsonPayload); + return postJson("customer", "assignPaymentRole", path, jsonPayload); } public CustomerAssignPaymentRoleResponse assignPaymentRole( @@ -437,7 +437,7 @@ public CompletableFuture assignPaymentRoleAsy String path = buildPathWithParams( "/customers/{customer-id}/assign_payment_role", "customer-id", customerId); - return postAsync(path, params.toFormData()) + return postAsync("customer", "assignPaymentRole", path, params.toFormData()) .thenApply( response -> CustomerAssignPaymentRoleResponse.fromJson(response.getBodyAsString(), response)); @@ -446,13 +446,13 @@ public CompletableFuture assignPaymentRoleAsy /** move a customer using immutable params (executes immediately) - returns raw Response. */ Response moveRaw(CustomerMoveParams params) throws ChargebeeException { - return post("/customers/move", params != null ? params.toFormData() : null); + return post("customer", "move", "/customers/move", params != null ? params.toFormData() : null); } /** move a customer using raw JSON payload (executes immediately) - returns raw Response. */ Response moveRaw(String jsonPayload) throws ChargebeeException { - return postJson("/customers/move", jsonPayload); + return postJson("customer", "move", "/customers/move", jsonPayload); } public CustomerMoveResponse move(CustomerMoveParams params) throws ChargebeeException { @@ -464,7 +464,8 @@ public CustomerMoveResponse move(CustomerMoveParams params) throws ChargebeeExce /** Async variant of move for customer with params. */ public CompletableFuture moveAsync(CustomerMoveParams params) { - return postAsync("/customers/move", params != null ? params.toFormData() : null) + return postAsync( + "customer", "move", "/customers/move", params != null ? params.toFormData() : null) .thenApply(response -> CustomerMoveResponse.fromJson(response.getBodyAsString(), response)); } @@ -473,7 +474,7 @@ Response hierarchyRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/hierarchy", "customer-id", customerId); - return get(path, null); + return get("customer", "hierarchy", path, null); } /** hierarchy a customer using immutable params (executes immediately) - returns raw Response. */ @@ -481,7 +482,7 @@ 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); + return get("customer", "hierarchy", path, params != null ? params.toQueryParams() : null); } public CustomerHierarchyResponse hierarchy(String customerId, CustomerHierarchyParams params) @@ -495,7 +496,7 @@ public CompletableFuture hierarchyAsync( String customerId, CustomerHierarchyParams params) { String path = buildPathWithParams("/customers/{customer-id}/hierarchy", "customer-id", customerId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync("customer", "hierarchy", path, params != null ? params.toQueryParams() : null) .thenApply( response -> CustomerHierarchyResponse.fromJson(response.getBodyAsString(), response)); } @@ -510,7 +511,7 @@ public CompletableFuture hierarchyAsync(String custom String path = buildPathWithParams("/customers/{customer-id}/hierarchy", "customer-id", customerId); - return getAsync(path, null) + return getAsync("customer", "hierarchy", path, null) .thenApply( response -> CustomerHierarchyResponse.fromJson(response.getBodyAsString(), response)); } @@ -521,7 +522,7 @@ Response updatePaymentMethodRaw(String customerId) throws ChargebeeException { buildPathWithParams( "/customers/{customer-id}/update_payment_method", "customer-id", customerId); - return post(path, null); + return post("customer", "updatePaymentMethod", path, null); } /** @@ -533,7 +534,7 @@ Response updatePaymentMethodRaw(String customerId, CustomerUpdatePaymentMethodPa String path = buildPathWithParams( "/customers/{customer-id}/update_payment_method", "customer-id", customerId); - return post(path, params.toFormData()); + return post("customer", "updatePaymentMethod", path, params.toFormData()); } /** @@ -544,7 +545,7 @@ Response updatePaymentMethodRaw(String customerId, String jsonPayload) throws Ch String path = buildPathWithParams( "/customers/{customer-id}/update_payment_method", "customer-id", customerId); - return postJson(path, jsonPayload); + return postJson("customer", "updatePaymentMethod", path, jsonPayload); } public CustomerUpdatePaymentMethodResponse updatePaymentMethod( @@ -559,7 +560,7 @@ public CompletableFuture updatePaymentMetho String path = buildPathWithParams( "/customers/{customer-id}/update_payment_method", "customer-id", customerId); - return postAsync(path, params.toFormData()) + return postAsync("customer", "updatePaymentMethod", path, params.toFormData()) .thenApply( response -> CustomerUpdatePaymentMethodResponse.fromJson(response.getBodyAsString(), response)); @@ -578,7 +579,7 @@ public CompletableFuture updatePaymentMetho buildPathWithParams( "/customers/{customer-id}/update_payment_method", "customer-id", customerId); - return postAsync(path, null) + return postAsync("customer", "updatePaymentMethod", path, null) .thenApply( response -> CustomerUpdatePaymentMethodResponse.fromJson(response.getBodyAsString(), response)); @@ -588,7 +589,7 @@ public CompletableFuture updatePaymentMetho Response retrieveRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}", "customer-id", customerId); - return get(path, null); + return get("customer", "retrieve", path, null); } public CustomerRetrieveResponse retrieve(String customerId) throws ChargebeeException { @@ -600,7 +601,7 @@ public CustomerRetrieveResponse retrieve(String customerId) throws ChargebeeExce public CompletableFuture retrieveAsync(String customerId) { String path = buildPathWithParams("/customers/{customer-id}", "customer-id", customerId); - return getAsync(path, null) + return getAsync("customer", "retrieve", path, null) .thenApply( response -> CustomerRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -609,19 +610,19 @@ public CompletableFuture retrieveAsync(String customer Response updateRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}", "customer-id", customerId); - return post(path, null); + return post("customer", "update", path, null); } /** update a customer using immutable params (executes immediately) - returns raw Response. */ Response updateRaw(String customerId, CustomerUpdateParams params) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}", "customer-id", customerId); - return post(path, params.toFormData()); + return post("customer", "update", path, params.toFormData()); } /** update a customer using raw JSON payload (executes immediately) - returns raw Response. */ Response updateRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}", "customer-id", customerId); - return postJson(path, jsonPayload); + return postJson("customer", "update", path, jsonPayload); } public CustomerUpdateResponse update(String customerId, CustomerUpdateParams params) @@ -634,7 +635,7 @@ public CustomerUpdateResponse update(String customerId, CustomerUpdateParams par public CompletableFuture updateAsync( String customerId, CustomerUpdateParams params) { String path = buildPathWithParams("/customers/{customer-id}", "customer-id", customerId); - return postAsync(path, params.toFormData()) + return postAsync("customer", "update", path, params.toFormData()) .thenApply( response -> CustomerUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -648,7 +649,7 @@ public CustomerUpdateResponse update(String customerId) throws ChargebeeExceptio public CompletableFuture updateAsync(String customerId) { String path = buildPathWithParams("/customers/{customer-id}", "customer-id", customerId); - return postAsync(path, null) + return postAsync("customer", "update", path, null) .thenApply( response -> CustomerUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -661,7 +662,8 @@ Response listHierarchyDetailRaw(String customerId, CustomerListHierarchyDetailPa throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/hierarchy_detail", "customer-id", customerId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "customer", "listHierarchyDetail", path, params != null ? params.toQueryParams() : null); } /** @@ -670,7 +672,7 @@ Response listHierarchyDetailRaw(String customerId, CustomerListHierarchyDetailPa Response listHierarchyDetailRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/hierarchy_detail", "customer-id", customerId); - return get(path, null); + return get("customer", "listHierarchyDetail", path, null); } /** @@ -702,7 +704,8 @@ public CompletableFuture listHierarchyDetai String customerId, CustomerListHierarchyDetailParams params) { String path = buildPathWithParams("/customers/{customer-id}/hierarchy_detail", "customer-id", customerId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "customer", "listHierarchyDetail", path, params != null ? params.toQueryParams() : null) .thenApply( response -> CustomerListHierarchyDetailResponse.fromJson( @@ -714,7 +717,7 @@ public CompletableFuture listHierarchyDetai String customerId) { String path = buildPathWithParams("/customers/{customer-id}/hierarchy_detail", "customer-id", customerId); - return getAsync(path, null) + return getAsync("customer", "listHierarchyDetail", path, null) .thenApply( response -> CustomerListHierarchyDetailResponse.fromJson( @@ -727,7 +730,7 @@ Response changeBillingDateRaw(String customerId) throws ChargebeeException { buildPathWithParams( "/customers/{customer-id}/change_billing_date", "customer-id", customerId); - return post(path, null); + return post("customer", "changeBillingDate", path, null); } /** @@ -739,7 +742,7 @@ Response changeBillingDateRaw(String customerId, CustomerChangeBillingDateParams String path = buildPathWithParams( "/customers/{customer-id}/change_billing_date", "customer-id", customerId); - return post(path, params.toFormData()); + return post("customer", "changeBillingDate", path, params.toFormData()); } /** @@ -750,7 +753,7 @@ Response changeBillingDateRaw(String customerId, String jsonPayload) throws Char String path = buildPathWithParams( "/customers/{customer-id}/change_billing_date", "customer-id", customerId); - return postJson(path, jsonPayload); + return postJson("customer", "changeBillingDate", path, jsonPayload); } public CustomerChangeBillingDateResponse changeBillingDate( @@ -765,7 +768,7 @@ public CompletableFuture changeBillingDateAsy String path = buildPathWithParams( "/customers/{customer-id}/change_billing_date", "customer-id", customerId); - return postAsync(path, params.toFormData()) + return postAsync("customer", "changeBillingDate", path, params.toFormData()) .thenApply( response -> CustomerChangeBillingDateResponse.fromJson(response.getBodyAsString(), response)); @@ -784,7 +787,7 @@ public CompletableFuture changeBillingDateAsy buildPathWithParams( "/customers/{customer-id}/change_billing_date", "customer-id", customerId); - return postAsync(path, null) + return postAsync("customer", "changeBillingDate", path, null) .thenApply( response -> CustomerChangeBillingDateResponse.fromJson(response.getBodyAsString(), response)); @@ -793,13 +796,13 @@ public CompletableFuture changeBillingDateAsy /** list a customer using immutable params (executes immediately) - returns raw Response. */ Response listRaw(CustomerListParams params) throws ChargebeeException { - return get("/customers", params != null ? params.toQueryParams() : null); + return get("customer", "list", "/customers", params != null ? params.toQueryParams() : null); } /** list a customer without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/customers", null); + return get("customer", "list", "/customers", null); } /** list a customer using raw JSON payload (executes immediately) - returns raw Response. */ @@ -817,7 +820,8 @@ public CustomerListResponse list(CustomerListParams params) throws ChargebeeExce /** Async variant of list for customer with params. */ public CompletableFuture listAsync(CustomerListParams params) { - return getAsync("/customers", params != null ? params.toQueryParams() : null) + return getAsync( + "customer", "list", "/customers", params != null ? params.toQueryParams() : null) .thenApply( response -> CustomerListResponse.fromJson(response.getBodyAsString(), this, params, response)); @@ -832,7 +836,7 @@ public CustomerListResponse list() throws ChargebeeException { /** Async variant of list for customer without params. */ public CompletableFuture listAsync() { - return getAsync("/customers", null) + return getAsync("customer", "list", "/customers", null) .thenApply( response -> CustomerListResponse.fromJson(response.getBodyAsString(), this, null, response)); @@ -841,13 +845,13 @@ public CompletableFuture listAsync() { /** create a customer using immutable params (executes immediately) - returns raw Response. */ Response createRaw(CustomerCreateParams params) throws ChargebeeException { - return post("/customers", params != null ? params.toFormData() : null); + return post("customer", "create", "/customers", params != null ? params.toFormData() : null); } /** create a customer using raw JSON payload (executes immediately) - returns raw Response. */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/customers", jsonPayload); + return postJson("customer", "create", "/customers", jsonPayload); } public CustomerCreateResponse create(CustomerCreateParams params) throws ChargebeeException { @@ -859,7 +863,8 @@ public CustomerCreateResponse create(CustomerCreateParams params) throws Chargeb /** Async variant of create for customer with params. */ public CompletableFuture createAsync(CustomerCreateParams params) { - return postAsync("/customers", params != null ? params.toFormData() : null) + return postAsync( + "customer", "create", "/customers", params != null ? params.toFormData() : null) .thenApply( response -> CustomerCreateResponse.fromJson(response.getBodyAsString(), response)); } @@ -869,7 +874,7 @@ Response addContactRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/add_contact", "customer-id", customerId); - return post(path, null); + return post("customer", "addContact", path, null); } /** addContact a customer using immutable params (executes immediately) - returns raw Response. */ @@ -877,14 +882,14 @@ Response addContactRaw(String customerId, CustomerAddContactParams params) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/add_contact", "customer-id", customerId); - return post(path, params.toFormData()); + return post("customer", "addContact", path, params.toFormData()); } /** 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); + return postJson("customer", "addContact", path, jsonPayload); } public CustomerAddContactResponse addContact(String customerId, CustomerAddContactParams params) @@ -898,7 +903,7 @@ public CompletableFuture addContactAsync( String customerId, CustomerAddContactParams params) { String path = buildPathWithParams("/customers/{customer-id}/add_contact", "customer-id", customerId); - return postAsync(path, params.toFormData()) + return postAsync("customer", "addContact", path, params.toFormData()) .thenApply( response -> CustomerAddContactResponse.fromJson(response.getBodyAsString(), response)); } @@ -913,7 +918,7 @@ public CompletableFuture addContactAsync(String cust String path = buildPathWithParams("/customers/{customer-id}/add_contact", "customer-id", customerId); - return postAsync(path, null) + return postAsync("customer", "addContact", path, null) .thenApply( response -> CustomerAddContactResponse.fromJson(response.getBodyAsString(), response)); } @@ -926,7 +931,8 @@ Response contactsForCustomerRaw(String customerId, ContactsForCustomerParams par throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/contacts", "customer-id", customerId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "customer", "contactsForCustomer", path, params != null ? params.toQueryParams() : null); } /** @@ -935,7 +941,7 @@ Response contactsForCustomerRaw(String customerId, ContactsForCustomerParams par Response contactsForCustomerRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/contacts", "customer-id", customerId); - return get(path, null); + return get("customer", "contactsForCustomer", path, null); } /** @@ -967,7 +973,8 @@ public CompletableFuture contactsForCustomerAsync( String customerId, ContactsForCustomerParams params) { String path = buildPathWithParams("/customers/{customer-id}/contacts", "customer-id", customerId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "customer", "contactsForCustomer", path, params != null ? params.toQueryParams() : null) .thenApply( response -> ContactsForCustomerResponse.fromJson( @@ -979,7 +986,7 @@ public CompletableFuture contactsForCustomerAsync( String customerId) { String path = buildPathWithParams("/customers/{customer-id}/contacts", "customer-id", customerId); - return getAsync(path, null) + return getAsync("customer", "contactsForCustomer", path, null) .thenApply( response -> ContactsForCustomerResponse.fromJson( @@ -992,7 +999,7 @@ Response deductPromotionalCreditsRaw(String customerId) throws ChargebeeExceptio buildPathWithParams( "/customers/{customer-id}/deduct_promotional_credits", "customer-id", customerId); - return post(path, null); + return post("customer", "deductPromotionalCredits", path, null); } /** @@ -1004,7 +1011,7 @@ Response deductPromotionalCreditsRaw( String path = buildPathWithParams( "/customers/{customer-id}/deduct_promotional_credits", "customer-id", customerId); - return post(path, params.toFormData()); + return post("customer", "deductPromotionalCredits", path, params.toFormData()); } /** @@ -1016,7 +1023,7 @@ Response deductPromotionalCreditsRaw(String customerId, String jsonPayload) String path = buildPathWithParams( "/customers/{customer-id}/deduct_promotional_credits", "customer-id", customerId); - return postJson(path, jsonPayload); + return postJson("customer", "deductPromotionalCredits", path, jsonPayload); } public CustomerDeductPromotionalCreditsResponse deductPromotionalCredits( @@ -1031,7 +1038,7 @@ public CompletableFuture deductPromoti String path = buildPathWithParams( "/customers/{customer-id}/deduct_promotional_credits", "customer-id", customerId); - return postAsync(path, params.toFormData()) + return postAsync("customer", "deductPromotionalCredits", path, params.toFormData()) .thenApply( response -> CustomerDeductPromotionalCreditsResponse.fromJson( @@ -1044,7 +1051,7 @@ Response clearPersonalDataRaw(String customerId) throws ChargebeeException { buildPathWithParams( "/customers/{customer-id}/clear_personal_data", "customer-id", customerId); - return post(path, null); + return post("customer", "clearPersonalData", path, null); } public CustomerClearPersonalDataResponse clearPersonalData(String customerId) @@ -1060,7 +1067,7 @@ public CompletableFuture clearPersonalDataAsy buildPathWithParams( "/customers/{customer-id}/clear_personal_data", "customer-id", customerId); - return postAsync(path, null) + return postAsync("customer", "clearPersonalData", path, null) .thenApply( response -> CustomerClearPersonalDataResponse.fromJson(response.getBodyAsString(), response)); @@ -1069,13 +1076,14 @@ public CompletableFuture clearPersonalDataAsy /** merge a customer using immutable params (executes immediately) - returns raw Response. */ Response mergeRaw(CustomerMergeParams params) throws ChargebeeException { - return post("/customers/merge", params != null ? params.toFormData() : null); + return post( + "customer", "merge", "/customers/merge", params != null ? params.toFormData() : null); } /** merge a customer using raw JSON payload (executes immediately) - returns raw Response. */ Response mergeRaw(String jsonPayload) throws ChargebeeException { - return postJson("/customers/merge", jsonPayload); + return postJson("customer", "merge", "/customers/merge", jsonPayload); } public CustomerMergeResponse merge(CustomerMergeParams params) throws ChargebeeException { @@ -1087,7 +1095,8 @@ public CustomerMergeResponse merge(CustomerMergeParams params) throws ChargebeeE /** Async variant of merge for customer with params. */ public CompletableFuture mergeAsync(CustomerMergeParams params) { - return postAsync("/customers/merge", params != null ? params.toFormData() : null) + return postAsync( + "customer", "merge", "/customers/merge", params != null ? params.toFormData() : null) .thenApply( response -> CustomerMergeResponse.fromJson(response.getBodyAsString(), response)); } @@ -1097,7 +1106,7 @@ Response collectPaymentRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/collect_payment", "customer-id", customerId); - return post(path, null); + return post("customer", "collectPayment", path, null); } /** @@ -1107,7 +1116,7 @@ Response collectPaymentRaw(String customerId, CustomerCollectPaymentParams param throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/collect_payment", "customer-id", customerId); - return post(path, params.toFormData()); + return post("customer", "collectPayment", path, params.toFormData()); } /** @@ -1116,7 +1125,7 @@ Response collectPaymentRaw(String customerId, CustomerCollectPaymentParams param Response collectPaymentRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/collect_payment", "customer-id", customerId); - return postJson(path, jsonPayload); + return postJson("customer", "collectPayment", path, jsonPayload); } public CustomerCollectPaymentResponse collectPayment( @@ -1130,7 +1139,7 @@ public CompletableFuture collectPaymentAsync( String customerId, CustomerCollectPaymentParams params) { String path = buildPathWithParams("/customers/{customer-id}/collect_payment", "customer-id", customerId); - return postAsync(path, params.toFormData()) + return postAsync("customer", "collectPayment", path, params.toFormData()) .thenApply( response -> CustomerCollectPaymentResponse.fromJson(response.getBodyAsString(), response)); @@ -1147,7 +1156,7 @@ public CompletableFuture collectPaymentAsync(Str String path = buildPathWithParams("/customers/{customer-id}/collect_payment", "customer-id", customerId); - return postAsync(path, null) + return postAsync("customer", "collectPayment", path, null) .thenApply( response -> CustomerCollectPaymentResponse.fromJson(response.getBodyAsString(), response)); @@ -1159,7 +1168,7 @@ Response recordExcessPaymentRaw(String customerId) throws ChargebeeException { buildPathWithParams( "/customers/{customer-id}/record_excess_payment", "customer-id", customerId); - return post(path, null); + return post("customer", "recordExcessPayment", path, null); } /** @@ -1171,7 +1180,7 @@ Response recordExcessPaymentRaw(String customerId, CustomerRecordExcessPaymentPa String path = buildPathWithParams( "/customers/{customer-id}/record_excess_payment", "customer-id", customerId); - return post(path, params.toFormData()); + return post("customer", "recordExcessPayment", path, params.toFormData()); } /** @@ -1182,7 +1191,7 @@ Response recordExcessPaymentRaw(String customerId, String jsonPayload) throws Ch String path = buildPathWithParams( "/customers/{customer-id}/record_excess_payment", "customer-id", customerId); - return postJson(path, jsonPayload); + return postJson("customer", "recordExcessPayment", path, jsonPayload); } public CustomerRecordExcessPaymentResponse recordExcessPayment( @@ -1197,7 +1206,7 @@ public CompletableFuture recordExcessPaymen String path = buildPathWithParams( "/customers/{customer-id}/record_excess_payment", "customer-id", customerId); - return postAsync(path, params.toFormData()) + return postAsync("customer", "recordExcessPayment", path, params.toFormData()) .thenApply( response -> CustomerRecordExcessPaymentResponse.fromJson(response.getBodyAsString(), response)); @@ -1216,7 +1225,7 @@ public CompletableFuture recordExcessPaymen buildPathWithParams( "/customers/{customer-id}/record_excess_payment", "customer-id", customerId); - return postAsync(path, null) + return postAsync("customer", "recordExcessPayment", path, null) .thenApply( response -> CustomerRecordExcessPaymentResponse.fromJson(response.getBodyAsString(), response)); @@ -1228,7 +1237,7 @@ Response setPromotionalCreditsRaw(String customerId) throws ChargebeeException { buildPathWithParams( "/customers/{customer-id}/set_promotional_credits", "customer-id", customerId); - return post(path, null); + return post("customer", "setPromotionalCredits", path, null); } /** @@ -1240,7 +1249,7 @@ Response setPromotionalCreditsRaw(String customerId, CustomerSetPromotionalCredi String path = buildPathWithParams( "/customers/{customer-id}/set_promotional_credits", "customer-id", customerId); - return post(path, params.toFormData()); + return post("customer", "setPromotionalCredits", path, params.toFormData()); } /** @@ -1252,7 +1261,7 @@ Response setPromotionalCreditsRaw(String customerId, String jsonPayload) String path = buildPathWithParams( "/customers/{customer-id}/set_promotional_credits", "customer-id", customerId); - return postJson(path, jsonPayload); + return postJson("customer", "setPromotionalCredits", path, jsonPayload); } public CustomerSetPromotionalCreditsResponse setPromotionalCredits( @@ -1267,7 +1276,7 @@ public CompletableFuture setPromotionalCr String path = buildPathWithParams( "/customers/{customer-id}/set_promotional_credits", "customer-id", customerId); - return postAsync(path, params.toFormData()) + return postAsync("customer", "setPromotionalCredits", path, params.toFormData()) .thenApply( response -> CustomerSetPromotionalCreditsResponse.fromJson( @@ -1279,7 +1288,7 @@ Response updateContactRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/update_contact", "customer-id", customerId); - return post(path, null); + return post("customer", "updateContact", path, null); } /** @@ -1289,7 +1298,7 @@ Response updateContactRaw(String customerId, CustomerUpdateContactParams params) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/update_contact", "customer-id", customerId); - return post(path, params.toFormData()); + return post("customer", "updateContact", path, params.toFormData()); } /** @@ -1298,7 +1307,7 @@ Response updateContactRaw(String customerId, CustomerUpdateContactParams params) Response updateContactRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/update_contact", "customer-id", customerId); - return postJson(path, jsonPayload); + return postJson("customer", "updateContact", path, jsonPayload); } public CustomerUpdateContactResponse updateContact( @@ -1312,7 +1321,7 @@ public CompletableFuture updateContactAsync( String customerId, CustomerUpdateContactParams params) { String path = buildPathWithParams("/customers/{customer-id}/update_contact", "customer-id", customerId); - return postAsync(path, params.toFormData()) + return postAsync("customer", "updateContact", path, params.toFormData()) .thenApply( response -> CustomerUpdateContactResponse.fromJson(response.getBodyAsString(), response)); @@ -1328,7 +1337,7 @@ public CompletableFuture updateContactAsync(Strin String path = buildPathWithParams("/customers/{customer-id}/update_contact", "customer-id", customerId); - return postAsync(path, null) + return postAsync("customer", "updateContact", path, null) .thenApply( response -> CustomerUpdateContactResponse.fromJson(response.getBodyAsString(), response)); @@ -1340,7 +1349,7 @@ Response updateHierarchySettingsRaw(String customerId) throws ChargebeeException buildPathWithParams( "/customers/{customer-id}/update_hierarchy_settings", "customer-id", customerId); - return post(path, null); + return post("customer", "updateHierarchySettings", path, null); } /** @@ -1352,7 +1361,7 @@ Response updateHierarchySettingsRaw( String path = buildPathWithParams( "/customers/{customer-id}/update_hierarchy_settings", "customer-id", customerId); - return post(path, params.toFormData()); + return post("customer", "updateHierarchySettings", path, params.toFormData()); } /** @@ -1364,7 +1373,7 @@ Response updateHierarchySettingsRaw(String customerId, String jsonPayload) String path = buildPathWithParams( "/customers/{customer-id}/update_hierarchy_settings", "customer-id", customerId); - return postJson(path, jsonPayload); + return postJson("customer", "updateHierarchySettings", path, jsonPayload); } public CustomerUpdateHierarchySettingsResponse updateHierarchySettings( @@ -1379,7 +1388,7 @@ public CompletableFuture updateHierarch String path = buildPathWithParams( "/customers/{customer-id}/update_hierarchy_settings", "customer-id", customerId); - return postAsync(path, params.toFormData()) + return postAsync("customer", "updateHierarchySettings", path, params.toFormData()) .thenApply( response -> CustomerUpdateHierarchySettingsResponse.fromJson( @@ -1399,7 +1408,7 @@ public CompletableFuture updateHierarch buildPathWithParams( "/customers/{customer-id}/update_hierarchy_settings", "customer-id", customerId); - return postAsync(path, null) + return postAsync("customer", "updateHierarchySettings", path, null) .thenApply( response -> CustomerUpdateHierarchySettingsResponse.fromJson( @@ -1412,7 +1421,7 @@ Response updateBillingInfoRaw(String customerId) throws ChargebeeException { buildPathWithParams( "/customers/{customer-id}/update_billing_info", "customer-id", customerId); - return post(path, null); + return post("customer", "updateBillingInfo", path, null); } /** @@ -1424,7 +1433,7 @@ Response updateBillingInfoRaw(String customerId, CustomerUpdateBillingInfoParams String path = buildPathWithParams( "/customers/{customer-id}/update_billing_info", "customer-id", customerId); - return post(path, params.toFormData()); + return post("customer", "updateBillingInfo", path, params.toFormData()); } /** @@ -1435,7 +1444,7 @@ Response updateBillingInfoRaw(String customerId, String jsonPayload) throws Char String path = buildPathWithParams( "/customers/{customer-id}/update_billing_info", "customer-id", customerId); - return postJson(path, jsonPayload); + return postJson("customer", "updateBillingInfo", path, jsonPayload); } public CustomerUpdateBillingInfoResponse updateBillingInfo( @@ -1450,7 +1459,7 @@ public CompletableFuture updateBillingInfoAsy String path = buildPathWithParams( "/customers/{customer-id}/update_billing_info", "customer-id", customerId); - return postAsync(path, params.toFormData()) + return postAsync("customer", "updateBillingInfo", path, params.toFormData()) .thenApply( response -> CustomerUpdateBillingInfoResponse.fromJson(response.getBodyAsString(), response)); @@ -1469,7 +1478,7 @@ public CompletableFuture updateBillingInfoAsy buildPathWithParams( "/customers/{customer-id}/update_billing_info", "customer-id", customerId); - return postAsync(path, null) + return postAsync("customer", "updateBillingInfo", path, null) .thenApply( response -> 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 d329924b8..fce490c75 100644 --- a/src/main/java/com/chargebee/v4/services/DifferentialPriceService.java +++ b/src/main/java/com/chargebee/v4/services/DifferentialPriceService.java @@ -76,7 +76,7 @@ Response deleteRaw(String differentialPriceId) throws ChargebeeException { "differential-price-id", differentialPriceId); - return post(path, null); + return post("differentialPrice", "delete", path, null); } /** @@ -90,7 +90,7 @@ Response deleteRaw(String differentialPriceId, DifferentialPriceDeleteParams par "/differential_prices/{differential-price-id}/delete", "differential-price-id", differentialPriceId); - return post(path, params.toFormData()); + return post("differentialPrice", "delete", path, params.toFormData()); } /** @@ -103,7 +103,7 @@ Response deleteRaw(String differentialPriceId, String jsonPayload) throws Charge "/differential_prices/{differential-price-id}/delete", "differential-price-id", differentialPriceId); - return postJson(path, jsonPayload); + return postJson("differentialPrice", "delete", path, jsonPayload); } public DifferentialPriceDeleteResponse delete( @@ -120,7 +120,7 @@ public CompletableFuture deleteAsync( "/differential_prices/{differential-price-id}/delete", "differential-price-id", differentialPriceId); - return postAsync(path, params.toFormData()) + return postAsync("differentialPrice", "delete", path, params.toFormData()) .thenApply( response -> DifferentialPriceDeleteResponse.fromJson(response.getBodyAsString(), response)); @@ -132,7 +132,7 @@ Response createRaw(String itemPriceId) throws ChargebeeException { buildPathWithParams( "/item_prices/{item-price-id}/differential_prices", "item-price-id", itemPriceId); - return post(path, null); + return post("differentialPrice", "create", path, null); } /** @@ -144,7 +144,7 @@ Response createRaw(String itemPriceId, DifferentialPriceCreateParams params) String path = buildPathWithParams( "/item_prices/{item-price-id}/differential_prices", "item-price-id", itemPriceId); - return post(path, params.toFormData()); + return post("differentialPrice", "create", path, params.toFormData()); } /** @@ -155,7 +155,7 @@ Response createRaw(String itemPriceId, String jsonPayload) throws ChargebeeExcep String path = buildPathWithParams( "/item_prices/{item-price-id}/differential_prices", "item-price-id", itemPriceId); - return postJson(path, jsonPayload); + return postJson("differentialPrice", "create", path, jsonPayload); } public DifferentialPriceCreateResponse create( @@ -170,7 +170,7 @@ public CompletableFuture createAsync( String path = buildPathWithParams( "/item_prices/{item-price-id}/differential_prices", "item-price-id", itemPriceId); - return postAsync(path, params.toFormData()) + return postAsync("differentialPrice", "create", path, params.toFormData()) .thenApply( response -> DifferentialPriceCreateResponse.fromJson(response.getBodyAsString(), response)); @@ -181,13 +181,17 @@ public CompletableFuture createAsync( */ Response listRaw(DifferentialPriceListParams params) throws ChargebeeException { - return get("/differential_prices", params != null ? params.toQueryParams() : null); + return get( + "differentialPrice", + "list", + "/differential_prices", + params != null ? params.toQueryParams() : null); } /** list a differentialPrice without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/differential_prices", null); + return get("differentialPrice", "list", "/differential_prices", null); } /** @@ -210,7 +214,11 @@ public DifferentialPriceListResponse list(DifferentialPriceListParams params) public CompletableFuture listAsync( DifferentialPriceListParams params) { - return getAsync("/differential_prices", params != null ? params.toQueryParams() : null) + return getAsync( + "differentialPrice", + "list", + "/differential_prices", + params != null ? params.toQueryParams() : null) .thenApply( response -> DifferentialPriceListResponse.fromJson( @@ -226,7 +234,7 @@ public DifferentialPriceListResponse list() throws ChargebeeException { /** Async variant of list for differentialPrice without params. */ public CompletableFuture listAsync() { - return getAsync("/differential_prices", null) + return getAsync("differentialPrice", "list", "/differential_prices", null) .thenApply( response -> DifferentialPriceListResponse.fromJson( @@ -241,7 +249,7 @@ Response retrieveRaw(String differentialPriceId) throws ChargebeeException { "differential-price-id", differentialPriceId); - return get(path, null); + return get("differentialPrice", "retrieve", path, null); } /** @@ -255,7 +263,8 @@ Response retrieveRaw(String differentialPriceId, DifferentialPriceRetrieveParams "/differential_prices/{differential-price-id}", "differential-price-id", differentialPriceId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "differentialPrice", "retrieve", path, params != null ? params.toQueryParams() : null); } public DifferentialPriceRetrieveResponse retrieve( @@ -273,7 +282,8 @@ public CompletableFuture retrieveAsync( "/differential_prices/{differential-price-id}", "differential-price-id", differentialPriceId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "differentialPrice", "retrieve", path, params != null ? params.toQueryParams() : null) .thenApply( response -> DifferentialPriceRetrieveResponse.fromJson(response.getBodyAsString(), response)); @@ -294,7 +304,7 @@ public CompletableFuture retrieveAsync( "differential-price-id", differentialPriceId); - return getAsync(path, null) + return getAsync("differentialPrice", "retrieve", path, null) .thenApply( response -> DifferentialPriceRetrieveResponse.fromJson(response.getBodyAsString(), response)); @@ -308,7 +318,7 @@ Response updateRaw(String differentialPriceId) throws ChargebeeException { "differential-price-id", differentialPriceId); - return post(path, null); + return post("differentialPrice", "update", path, null); } /** @@ -322,7 +332,7 @@ Response updateRaw(String differentialPriceId, DifferentialPriceUpdateParams par "/differential_prices/{differential-price-id}", "differential-price-id", differentialPriceId); - return post(path, params.toFormData()); + return post("differentialPrice", "update", path, params.toFormData()); } /** @@ -335,7 +345,7 @@ Response updateRaw(String differentialPriceId, String jsonPayload) throws Charge "/differential_prices/{differential-price-id}", "differential-price-id", differentialPriceId); - return postJson(path, jsonPayload); + return postJson("differentialPrice", "update", path, jsonPayload); } public DifferentialPriceUpdateResponse update( @@ -352,7 +362,7 @@ public CompletableFuture updateAsync( "/differential_prices/{differential-price-id}", "differential-price-id", differentialPriceId); - return postAsync(path, params.toFormData()) + return postAsync("differentialPrice", "update", path, params.toFormData()) .thenApply( response -> 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 a614d9a17..0e04521c8 100644 --- a/src/main/java/com/chargebee/v4/services/EntitlementOverrideService.java +++ b/src/main/java/com/chargebee/v4/services/EntitlementOverrideService.java @@ -68,7 +68,11 @@ Response listEntitlementOverrideForSubscriptionRaw( "/subscriptions/{subscription-id}/entitlement_overrides", "subscription-id", subscriptionId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "entitlementOverride", + "listEntitlementOverrideForSubscription", + path, + params != null ? params.toQueryParams() : null); } /** @@ -82,7 +86,7 @@ Response listEntitlementOverrideForSubscriptionRaw(String subscriptionId) "/subscriptions/{subscription-id}/entitlement_overrides", "subscription-id", subscriptionId); - return get(path, null); + return get("entitlementOverride", "listEntitlementOverrideForSubscription", path, null); } /** @@ -125,7 +129,11 @@ public ListEntitlementOverrideForSubscriptionResponse listEntitlementOverrideFor "/subscriptions/{subscription-id}/entitlement_overrides", "subscription-id", subscriptionId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "entitlementOverride", + "listEntitlementOverrideForSubscription", + path, + params != null ? params.toQueryParams() : null) .thenApply( response -> ListEntitlementOverrideForSubscriptionResponse.fromJson( @@ -142,7 +150,7 @@ public ListEntitlementOverrideForSubscriptionResponse listEntitlementOverrideFor "/subscriptions/{subscription-id}/entitlement_overrides", "subscription-id", subscriptionId); - return getAsync(path, null) + return getAsync("entitlementOverride", "listEntitlementOverrideForSubscription", path, null) .thenApply( response -> ListEntitlementOverrideForSubscriptionResponse.fromJson( @@ -161,7 +169,7 @@ Response addEntitlementOverrideForSubscriptionRaw(String subscriptionId) "subscription-id", subscriptionId); - return post(path, null); + return post("entitlementOverride", "addEntitlementOverrideForSubscription", path, null); } /** @@ -176,7 +184,8 @@ Response addEntitlementOverrideForSubscriptionRaw( "/subscriptions/{subscription-id}/entitlement_overrides", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post( + "entitlementOverride", "addEntitlementOverrideForSubscription", path, params.toFormData()); } /** @@ -190,7 +199,8 @@ Response addEntitlementOverrideForSubscriptionRaw(String subscriptionId, String "/subscriptions/{subscription-id}/entitlement_overrides", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson( + "entitlementOverride", "addEntitlementOverrideForSubscription", path, jsonPayload); } public AddEntitlementOverrideForSubscriptionResponse addEntitlementOverrideForSubscription( @@ -210,7 +220,11 @@ public AddEntitlementOverrideForSubscriptionResponse addEntitlementOverrideForSu "/subscriptions/{subscription-id}/entitlement_overrides", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync( + "entitlementOverride", + "addEntitlementOverrideForSubscription", + path, + params.toFormData()) .thenApply( response -> AddEntitlementOverrideForSubscriptionResponse.fromJson( @@ -235,7 +249,7 @@ public AddEntitlementOverrideForSubscriptionResponse addEntitlementOverrideForSu "subscription-id", subscriptionId); - return postAsync(path, null) + return postAsync("entitlementOverride", "addEntitlementOverrideForSubscription", path, null) .thenApply( response -> AddEntitlementOverrideForSubscriptionResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/EntitlementService.java b/src/main/java/com/chargebee/v4/services/EntitlementService.java index 661233c48..a32d4a2e0 100644 --- a/src/main/java/com/chargebee/v4/services/EntitlementService.java +++ b/src/main/java/com/chargebee/v4/services/EntitlementService.java @@ -58,13 +58,14 @@ public EntitlementService withOptions(RequestOptions options) { /** list a entitlement using immutable params (executes immediately) - returns raw Response. */ Response listRaw(EntitlementListParams params) throws ChargebeeException { - return get("/entitlements", params != null ? params.toQueryParams() : null); + return get( + "entitlement", "list", "/entitlements", params != null ? params.toQueryParams() : null); } /** list a entitlement without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/entitlements", null); + return get("entitlement", "list", "/entitlements", null); } /** list a entitlement using raw JSON payload (executes immediately) - returns raw Response. */ @@ -82,7 +83,8 @@ public EntitlementListResponse list(EntitlementListParams params) throws Chargeb /** Async variant of list for entitlement with params. */ public CompletableFuture listAsync(EntitlementListParams params) { - return getAsync("/entitlements", params != null ? params.toQueryParams() : null) + return getAsync( + "entitlement", "list", "/entitlements", params != null ? params.toQueryParams() : null) .thenApply( response -> EntitlementListResponse.fromJson( @@ -98,7 +100,7 @@ public EntitlementListResponse list() throws ChargebeeException { /** Async variant of list for entitlement without params. */ public CompletableFuture listAsync() { - return getAsync("/entitlements", null) + return getAsync("entitlement", "list", "/entitlements", null) .thenApply( response -> EntitlementListResponse.fromJson(response.getBodyAsString(), this, null, response)); @@ -107,13 +109,14 @@ public CompletableFuture listAsync() { /** create a entitlement using immutable params (executes immediately) - returns raw Response. */ Response createRaw(EntitlementCreateParams params) throws ChargebeeException { - return post("/entitlements", params != null ? params.toFormData() : null); + return post( + "entitlement", "create", "/entitlements", params != null ? params.toFormData() : null); } /** create a entitlement using raw JSON payload (executes immediately) - returns raw Response. */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/entitlements", jsonPayload); + return postJson("entitlement", "create", "/entitlements", jsonPayload); } public EntitlementCreateResponse create(EntitlementCreateParams params) @@ -126,7 +129,8 @@ public EntitlementCreateResponse create(EntitlementCreateParams params) /** Async variant of create for entitlement with params. */ public CompletableFuture createAsync(EntitlementCreateParams params) { - return postAsync("/entitlements", params != null ? params.toFormData() : null) + return postAsync( + "entitlement", "create", "/entitlements", params != null ? params.toFormData() : null) .thenApply( response -> 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 1b927bb89..da8c13a43 100644 --- a/src/main/java/com/chargebee/v4/services/EstimateService.java +++ b/src/main/java/com/chargebee/v4/services/EstimateService.java @@ -133,7 +133,7 @@ Response renewalEstimateRaw(String subscriptionId) throws ChargebeeException { buildPathWithParams( "/subscriptions/{subscription-id}/renewal_estimate", "subscription-id", subscriptionId); - return get(path, null); + return get("estimate", "renewalEstimate", path, null); } /** @@ -145,7 +145,7 @@ Response renewalEstimateRaw(String subscriptionId, RenewalEstimateParams params) String path = buildPathWithParams( "/subscriptions/{subscription-id}/renewal_estimate", "subscription-id", subscriptionId); - return get(path, params != null ? params.toQueryParams() : null); + return get("estimate", "renewalEstimate", path, params != null ? params.toQueryParams() : null); } public RenewalEstimateResponse renewalEstimate( @@ -160,7 +160,8 @@ public CompletableFuture renewalEstimateAsync( String path = buildPathWithParams( "/subscriptions/{subscription-id}/renewal_estimate", "subscription-id", subscriptionId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "estimate", "renewalEstimate", path, params != null ? params.toQueryParams() : null) .thenApply( response -> RenewalEstimateResponse.fromJson(response.getBodyAsString(), response)); } @@ -176,7 +177,7 @@ public CompletableFuture renewalEstimateAsync(String su buildPathWithParams( "/subscriptions/{subscription-id}/renewal_estimate", "subscription-id", subscriptionId); - return getAsync(path, null) + return getAsync("estimate", "renewalEstimate", path, null) .thenApply( response -> RenewalEstimateResponse.fromJson(response.getBodyAsString(), response)); } @@ -189,7 +190,10 @@ Response createSubscriptionItemEstimateRaw(CreateSubscriptionItemEstimateParams throws ChargebeeException { return post( - "/estimates/create_subscription_for_items", params != null ? params.toFormData() : null); + "estimate", + "createSubscriptionItemEstimate", + "/estimates/create_subscription_for_items", + params != null ? params.toFormData() : null); } /** @@ -198,7 +202,11 @@ Response createSubscriptionItemEstimateRaw(CreateSubscriptionItemEstimateParams */ Response createSubscriptionItemEstimateRaw(String jsonPayload) throws ChargebeeException { - return postJson("/estimates/create_subscription_for_items", jsonPayload); + return postJson( + "estimate", + "createSubscriptionItemEstimate", + "/estimates/create_subscription_for_items", + jsonPayload); } public CreateSubscriptionItemEstimateResponse createSubscriptionItemEstimate( @@ -213,7 +221,10 @@ public CreateSubscriptionItemEstimateResponse createSubscriptionItemEstimate( createSubscriptionItemEstimateAsync(CreateSubscriptionItemEstimateParams params) { return postAsync( - "/estimates/create_subscription_for_items", params != null ? params.toFormData() : null) + "estimate", + "createSubscriptionItemEstimate", + "/estimates/create_subscription_for_items", + params != null ? params.toFormData() : null) .thenApply( response -> CreateSubscriptionItemEstimateResponse.fromJson( @@ -226,7 +237,11 @@ public CreateSubscriptionItemEstimateResponse createSubscriptionItemEstimate( */ Response paymentSchedulesRaw(EstimatePaymentSchedulesParams params) throws ChargebeeException { - return post("/estimates/payment_schedules", params != null ? params.toFormData() : null); + return post( + "estimate", + "paymentSchedules", + "/estimates/payment_schedules", + params != null ? params.toFormData() : null); } /** @@ -235,7 +250,7 @@ Response paymentSchedulesRaw(EstimatePaymentSchedulesParams params) throws Charg */ Response paymentSchedulesRaw(String jsonPayload) throws ChargebeeException { - return postJson("/estimates/payment_schedules", jsonPayload); + return postJson("estimate", "paymentSchedules", "/estimates/payment_schedules", jsonPayload); } public EstimatePaymentSchedulesResponse paymentSchedules(EstimatePaymentSchedulesParams params) @@ -249,7 +264,11 @@ public EstimatePaymentSchedulesResponse paymentSchedules(EstimatePaymentSchedule public CompletableFuture paymentSchedulesAsync( EstimatePaymentSchedulesParams params) { - return postAsync("/estimates/payment_schedules", params != null ? params.toFormData() : null) + return postAsync( + "estimate", + "paymentSchedules", + "/estimates/payment_schedules", + params != null ? params.toFormData() : null) .thenApply( response -> EstimatePaymentSchedulesResponse.fromJson(response.getBodyAsString(), response)); @@ -263,7 +282,7 @@ Response cancelSubscriptionForItemsRaw(String subscriptionId) throws ChargebeeEx "subscription-id", subscriptionId); - return post(path, null); + return post("estimate", "cancelSubscriptionForItems", path, null); } /** @@ -278,7 +297,7 @@ Response cancelSubscriptionForItemsRaw( "/subscriptions/{subscription-id}/cancel_subscription_for_items_estimate", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("estimate", "cancelSubscriptionForItems", path, params.toFormData()); } /** @@ -292,7 +311,7 @@ Response cancelSubscriptionForItemsRaw(String subscriptionId, String jsonPayload "/subscriptions/{subscription-id}/cancel_subscription_for_items_estimate", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("estimate", "cancelSubscriptionForItems", path, jsonPayload); } public EstimateCancelSubscriptionForItemsResponse cancelSubscriptionForItems( @@ -312,7 +331,7 @@ public EstimateCancelSubscriptionForItemsResponse cancelSubscriptionForItems( "/subscriptions/{subscription-id}/cancel_subscription_for_items_estimate", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("estimate", "cancelSubscriptionForItems", path, params.toFormData()) .thenApply( response -> EstimateCancelSubscriptionForItemsResponse.fromJson( @@ -335,7 +354,7 @@ public EstimateCancelSubscriptionForItemsResponse cancelSubscriptionForItems( "subscription-id", subscriptionId); - return postAsync(path, null) + return postAsync("estimate", "cancelSubscriptionForItems", path, null) .thenApply( response -> EstimateCancelSubscriptionForItemsResponse.fromJson( @@ -350,7 +369,7 @@ Response resumeSubscriptionRaw(String subscriptionId) throws ChargebeeException "subscription-id", subscriptionId); - return post(path, null); + return post("estimate", "resumeSubscription", path, null); } /** @@ -364,7 +383,7 @@ Response resumeSubscriptionRaw(String subscriptionId, EstimateResumeSubscription "/subscriptions/{subscription-id}/resume_subscription_estimate", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("estimate", "resumeSubscription", path, params.toFormData()); } /** @@ -378,7 +397,7 @@ Response resumeSubscriptionRaw(String subscriptionId, String jsonPayload) "/subscriptions/{subscription-id}/resume_subscription_estimate", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("estimate", "resumeSubscription", path, jsonPayload); } public EstimateResumeSubscriptionResponse resumeSubscription( @@ -395,7 +414,7 @@ public CompletableFuture resumeSubscriptionA "/subscriptions/{subscription-id}/resume_subscription_estimate", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("estimate", "resumeSubscription", path, params.toFormData()) .thenApply( response -> EstimateResumeSubscriptionResponse.fromJson(response.getBodyAsString(), response)); @@ -416,7 +435,7 @@ public CompletableFuture resumeSubscriptionA "subscription-id", subscriptionId); - return postAsync(path, null) + return postAsync("estimate", "resumeSubscription", path, null) .thenApply( response -> EstimateResumeSubscriptionResponse.fromJson(response.getBodyAsString(), response)); @@ -429,7 +448,11 @@ public CompletableFuture resumeSubscriptionA Response createInvoiceForItemsRaw(EstimateCreateInvoiceForItemsParams params) throws ChargebeeException { - return post("/estimates/create_invoice_for_items", params != null ? params.toFormData() : null); + return post( + "estimate", + "createInvoiceForItems", + "/estimates/create_invoice_for_items", + params != null ? params.toFormData() : null); } /** @@ -438,7 +461,8 @@ Response createInvoiceForItemsRaw(EstimateCreateInvoiceForItemsParams params) */ Response createInvoiceForItemsRaw(String jsonPayload) throws ChargebeeException { - return postJson("/estimates/create_invoice_for_items", jsonPayload); + return postJson( + "estimate", "createInvoiceForItems", "/estimates/create_invoice_for_items", jsonPayload); } public EstimateCreateInvoiceForItemsResponse createInvoiceForItems( @@ -453,7 +477,10 @@ public CompletableFuture createInvoiceFor EstimateCreateInvoiceForItemsParams params) { return postAsync( - "/estimates/create_invoice_for_items", params != null ? params.toFormData() : null) + "estimate", + "createInvoiceForItems", + "/estimates/create_invoice_for_items", + params != null ? params.toFormData() : null) .thenApply( response -> EstimateCreateInvoiceForItemsResponse.fromJson( @@ -468,7 +495,10 @@ Response giftSubscriptionForItemsRaw(EstimateGiftSubscriptionForItemsParams para throws ChargebeeException { return post( - "/estimates/gift_subscription_for_items", params != null ? params.toFormData() : null); + "estimate", + "giftSubscriptionForItems", + "/estimates/gift_subscription_for_items", + params != null ? params.toFormData() : null); } /** @@ -477,7 +507,11 @@ Response giftSubscriptionForItemsRaw(EstimateGiftSubscriptionForItemsParams para */ Response giftSubscriptionForItemsRaw(String jsonPayload) throws ChargebeeException { - return postJson("/estimates/gift_subscription_for_items", jsonPayload); + return postJson( + "estimate", + "giftSubscriptionForItems", + "/estimates/gift_subscription_for_items", + jsonPayload); } public EstimateGiftSubscriptionForItemsResponse giftSubscriptionForItems( @@ -492,7 +526,10 @@ public CompletableFuture giftSubscript EstimateGiftSubscriptionForItemsParams params) { return postAsync( - "/estimates/gift_subscription_for_items", params != null ? params.toFormData() : null) + "estimate", + "giftSubscriptionForItems", + "/estimates/gift_subscription_for_items", + params != null ? params.toFormData() : null) .thenApply( response -> EstimateGiftSubscriptionForItemsResponse.fromJson( @@ -507,7 +544,10 @@ Response updateSubscriptionForItemsRaw(EstimateUpdateSubscriptionForItemsParams throws ChargebeeException { return post( - "/estimates/update_subscription_for_items", params != null ? params.toFormData() : null); + "estimate", + "updateSubscriptionForItems", + "/estimates/update_subscription_for_items", + params != null ? params.toFormData() : null); } /** @@ -516,7 +556,11 @@ Response updateSubscriptionForItemsRaw(EstimateUpdateSubscriptionForItemsParams */ Response updateSubscriptionForItemsRaw(String jsonPayload) throws ChargebeeException { - return postJson("/estimates/update_subscription_for_items", jsonPayload); + return postJson( + "estimate", + "updateSubscriptionForItems", + "/estimates/update_subscription_for_items", + jsonPayload); } public EstimateUpdateSubscriptionForItemsResponse updateSubscriptionForItems( @@ -532,7 +576,10 @@ public EstimateUpdateSubscriptionForItemsResponse updateSubscriptionForItems( updateSubscriptionForItemsAsync(EstimateUpdateSubscriptionForItemsParams params) { return postAsync( - "/estimates/update_subscription_for_items", params != null ? params.toFormData() : null) + "estimate", + "updateSubscriptionForItems", + "/estimates/update_subscription_for_items", + params != null ? params.toFormData() : null) .thenApply( response -> EstimateUpdateSubscriptionForItemsResponse.fromJson( @@ -545,7 +592,7 @@ Response upcomingInvoicesEstimateRaw(String customerId) throws ChargebeeExceptio buildPathWithParams( "/customers/{customer-id}/upcoming_invoices_estimate", "customer-id", customerId); - return get(path, null); + return get("estimate", "upcomingInvoicesEstimate", path, null); } /** @@ -557,7 +604,11 @@ Response upcomingInvoicesEstimateRaw(String customerId, UpcomingInvoicesEstimate String path = buildPathWithParams( "/customers/{customer-id}/upcoming_invoices_estimate", "customer-id", customerId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "estimate", + "upcomingInvoicesEstimate", + path, + params != null ? params.toQueryParams() : null); } public UpcomingInvoicesEstimateResponse upcomingInvoicesEstimate( @@ -572,7 +623,11 @@ public CompletableFuture upcomingInvoicesEstim String path = buildPathWithParams( "/customers/{customer-id}/upcoming_invoices_estimate", "customer-id", customerId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "estimate", + "upcomingInvoicesEstimate", + path, + params != null ? params.toQueryParams() : null) .thenApply( response -> UpcomingInvoicesEstimateResponse.fromJson(response.getBodyAsString(), response)); @@ -591,7 +646,7 @@ public CompletableFuture upcomingInvoicesEstim buildPathWithParams( "/customers/{customer-id}/upcoming_invoices_estimate", "customer-id", customerId); - return getAsync(path, null) + return getAsync("estimate", "upcomingInvoicesEstimate", path, null) .thenApply( response -> UpcomingInvoicesEstimateResponse.fromJson(response.getBodyAsString(), response)); @@ -605,7 +660,7 @@ Response regenerateInvoiceEstimateRaw(String subscriptionId) throws ChargebeeExc "subscription-id", subscriptionId); - return post(path, null); + return post("estimate", "regenerateInvoiceEstimate", path, null); } /** @@ -619,7 +674,7 @@ Response regenerateInvoiceEstimateRaw( "/subscriptions/{subscription-id}/regenerate_invoice_estimate", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("estimate", "regenerateInvoiceEstimate", path, params.toFormData()); } /** @@ -633,7 +688,7 @@ Response regenerateInvoiceEstimateRaw(String subscriptionId, String jsonPayload) "/subscriptions/{subscription-id}/regenerate_invoice_estimate", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("estimate", "regenerateInvoiceEstimate", path, jsonPayload); } public RegenerateInvoiceEstimateResponse regenerateInvoiceEstimate( @@ -650,7 +705,7 @@ public CompletableFuture regenerateInvoiceEst "/subscriptions/{subscription-id}/regenerate_invoice_estimate", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("estimate", "regenerateInvoiceEstimate", path, params.toFormData()) .thenApply( response -> RegenerateInvoiceEstimateResponse.fromJson(response.getBodyAsString(), response)); @@ -671,7 +726,7 @@ public CompletableFuture regenerateInvoiceEst "subscription-id", subscriptionId); - return postAsync(path, null) + return postAsync("estimate", "regenerateInvoiceEstimate", path, null) .thenApply( response -> RegenerateInvoiceEstimateResponse.fromJson(response.getBodyAsString(), response)); @@ -689,7 +744,7 @@ Response createSubscriptionItemForCustomerEstimateRaw(String customerId) "customer-id", customerId); - return post(path, null); + return post("estimate", "createSubscriptionItemForCustomerEstimate", path, null); } /** @@ -704,7 +759,7 @@ Response createSubscriptionItemForCustomerEstimateRaw( "/customers/{customer-id}/create_subscription_for_items_estimate", "customer-id", customerId); - return post(path, params.toFormData()); + return post("estimate", "createSubscriptionItemForCustomerEstimate", path, params.toFormData()); } /** @@ -718,7 +773,7 @@ Response createSubscriptionItemForCustomerEstimateRaw(String customerId, String "/customers/{customer-id}/create_subscription_for_items_estimate", "customer-id", customerId); - return postJson(path, jsonPayload); + return postJson("estimate", "createSubscriptionItemForCustomerEstimate", path, jsonPayload); } public CreateSubscriptionItemForCustomerEstimateResponse @@ -739,7 +794,8 @@ Response createSubscriptionItemForCustomerEstimateRaw(String customerId, String "/customers/{customer-id}/create_subscription_for_items_estimate", "customer-id", customerId); - return postAsync(path, params.toFormData()) + return postAsync( + "estimate", "createSubscriptionItemForCustomerEstimate", path, params.toFormData()) .thenApply( response -> CreateSubscriptionItemForCustomerEstimateResponse.fromJson( @@ -762,7 +818,7 @@ Response createSubscriptionItemForCustomerEstimateRaw(String customerId, String "customer-id", customerId); - return postAsync(path, null) + return postAsync("estimate", "createSubscriptionItemForCustomerEstimate", path, null) .thenApply( response -> CreateSubscriptionItemForCustomerEstimateResponse.fromJson( @@ -777,7 +833,7 @@ Response changeTermEndRaw(String subscriptionId) throws ChargebeeException { "subscription-id", subscriptionId); - return post(path, null); + return post("estimate", "changeTermEnd", path, null); } /** @@ -790,7 +846,7 @@ Response changeTermEndRaw(String subscriptionId, EstimateChangeTermEndParams par "/subscriptions/{subscription-id}/change_term_end_estimate", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("estimate", "changeTermEnd", path, params.toFormData()); } /** @@ -802,7 +858,7 @@ Response changeTermEndRaw(String subscriptionId, String jsonPayload) throws Char "/subscriptions/{subscription-id}/change_term_end_estimate", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("estimate", "changeTermEnd", path, jsonPayload); } public EstimateChangeTermEndResponse changeTermEnd( @@ -819,7 +875,7 @@ public CompletableFuture changeTermEndAsync( "/subscriptions/{subscription-id}/change_term_end_estimate", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("estimate", "changeTermEnd", path, params.toFormData()) .thenApply( response -> EstimateChangeTermEndResponse.fromJson(response.getBodyAsString(), response)); @@ -833,7 +889,7 @@ Response pauseSubscriptionRaw(String subscriptionId) throws ChargebeeException { "subscription-id", subscriptionId); - return post(path, null); + return post("estimate", "pauseSubscription", path, null); } /** @@ -847,7 +903,7 @@ Response pauseSubscriptionRaw(String subscriptionId, EstimatePauseSubscriptionPa "/subscriptions/{subscription-id}/pause_subscription_estimate", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("estimate", "pauseSubscription", path, params.toFormData()); } /** @@ -861,7 +917,7 @@ Response pauseSubscriptionRaw(String subscriptionId, String jsonPayload) "/subscriptions/{subscription-id}/pause_subscription_estimate", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("estimate", "pauseSubscription", path, jsonPayload); } public EstimatePauseSubscriptionResponse pauseSubscription( @@ -878,7 +934,7 @@ public CompletableFuture pauseSubscriptionAsy "/subscriptions/{subscription-id}/pause_subscription_estimate", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("estimate", "pauseSubscription", path, params.toFormData()) .thenApply( response -> EstimatePauseSubscriptionResponse.fromJson(response.getBodyAsString(), response)); @@ -899,7 +955,7 @@ public CompletableFuture pauseSubscriptionAsy "subscription-id", subscriptionId); - return postAsync(path, null) + return postAsync("estimate", "pauseSubscription", path, null) .thenApply( response -> EstimatePauseSubscriptionResponse.fromJson(response.getBodyAsString(), response)); @@ -913,7 +969,7 @@ Response advanceInvoiceEstimateRaw(String subscriptionId) throws ChargebeeExcept "subscription-id", subscriptionId); - return post(path, null); + return post("estimate", "advanceInvoiceEstimate", path, null); } /** @@ -927,7 +983,7 @@ Response advanceInvoiceEstimateRaw(String subscriptionId, AdvanceInvoiceEstimate "/subscriptions/{subscription-id}/advance_invoice_estimate", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("estimate", "advanceInvoiceEstimate", path, params.toFormData()); } /** @@ -941,7 +997,7 @@ Response advanceInvoiceEstimateRaw(String subscriptionId, String jsonPayload) "/subscriptions/{subscription-id}/advance_invoice_estimate", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("estimate", "advanceInvoiceEstimate", path, jsonPayload); } public AdvanceInvoiceEstimateResponse advanceInvoiceEstimate( @@ -958,7 +1014,7 @@ public CompletableFuture advanceInvoiceEstimateA "/subscriptions/{subscription-id}/advance_invoice_estimate", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("estimate", "advanceInvoiceEstimate", path, params.toFormData()) .thenApply( response -> AdvanceInvoiceEstimateResponse.fromJson(response.getBodyAsString(), response)); @@ -979,7 +1035,7 @@ public CompletableFuture advanceInvoiceEstimateA "subscription-id", subscriptionId); - return postAsync(path, null) + return postAsync("estimate", "advanceInvoiceEstimate", path, null) .thenApply( response -> AdvanceInvoiceEstimateResponse.fromJson(response.getBodyAsString(), response)); @@ -992,7 +1048,11 @@ public CompletableFuture advanceInvoiceEstimateA Response updateSubscriptionRaw(EstimateUpdateSubscriptionParams params) throws ChargebeeException { - return post("/estimates/update_subscription", params != null ? params.toFormData() : null); + return post( + "estimate", + "updateSubscription", + "/estimates/update_subscription", + params != null ? params.toFormData() : null); } /** @@ -1001,7 +1061,8 @@ Response updateSubscriptionRaw(EstimateUpdateSubscriptionParams params) */ Response updateSubscriptionRaw(String jsonPayload) throws ChargebeeException { - return postJson("/estimates/update_subscription", jsonPayload); + return postJson( + "estimate", "updateSubscription", "/estimates/update_subscription", jsonPayload); } public EstimateUpdateSubscriptionResponse updateSubscription( @@ -1015,7 +1076,11 @@ public EstimateUpdateSubscriptionResponse updateSubscription( public CompletableFuture updateSubscriptionAsync( EstimateUpdateSubscriptionParams params) { - return postAsync("/estimates/update_subscription", params != null ? params.toFormData() : null) + return postAsync( + "estimate", + "updateSubscription", + "/estimates/update_subscription", + params != null ? params.toFormData() : null) .thenApply( response -> EstimateUpdateSubscriptionResponse.fromJson(response.getBodyAsString(), response)); @@ -1027,7 +1092,11 @@ public CompletableFuture updateSubscriptionA */ Response giftSubscriptionRaw(EstimateGiftSubscriptionParams params) throws ChargebeeException { - return post("/estimates/gift_subscription", params != null ? params.toFormData() : null); + return post( + "estimate", + "giftSubscription", + "/estimates/gift_subscription", + params != null ? params.toFormData() : null); } /** @@ -1036,7 +1105,7 @@ Response giftSubscriptionRaw(EstimateGiftSubscriptionParams params) throws Charg */ Response giftSubscriptionRaw(String jsonPayload) throws ChargebeeException { - return postJson("/estimates/gift_subscription", jsonPayload); + return postJson("estimate", "giftSubscription", "/estimates/gift_subscription", jsonPayload); } public EstimateGiftSubscriptionResponse giftSubscription(EstimateGiftSubscriptionParams params) @@ -1050,7 +1119,11 @@ public EstimateGiftSubscriptionResponse giftSubscription(EstimateGiftSubscriptio public CompletableFuture giftSubscriptionAsync( EstimateGiftSubscriptionParams params) { - return postAsync("/estimates/gift_subscription", params != null ? params.toFormData() : null) + return postAsync( + "estimate", + "giftSubscription", + "/estimates/gift_subscription", + params != null ? params.toFormData() : null) .thenApply( response -> EstimateGiftSubscriptionResponse.fromJson(response.getBodyAsString(), response)); @@ -1064,7 +1137,7 @@ Response createSubscriptionForCustomerEstimateRaw(String customerId) throws Char buildPathWithParams( "/customers/{customer-id}/create_subscription_estimate", "customer-id", customerId); - return get(path, null); + return get("estimate", "createSubscriptionForCustomerEstimate", path, null); } /** @@ -1077,7 +1150,11 @@ Response createSubscriptionForCustomerEstimateRaw( String path = buildPathWithParams( "/customers/{customer-id}/create_subscription_estimate", "customer-id", customerId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "estimate", + "createSubscriptionForCustomerEstimate", + path, + params != null ? params.toQueryParams() : null); } public CreateSubscriptionForCustomerEstimateResponse createSubscriptionForCustomerEstimate( @@ -1095,7 +1172,11 @@ public CreateSubscriptionForCustomerEstimateResponse createSubscriptionForCustom String path = buildPathWithParams( "/customers/{customer-id}/create_subscription_estimate", "customer-id", customerId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "estimate", + "createSubscriptionForCustomerEstimate", + path, + params != null ? params.toQueryParams() : null) .thenApply( response -> CreateSubscriptionForCustomerEstimateResponse.fromJson( @@ -1116,7 +1197,7 @@ public CreateSubscriptionForCustomerEstimateResponse createSubscriptionForCustom buildPathWithParams( "/customers/{customer-id}/create_subscription_estimate", "customer-id", customerId); - return getAsync(path, null) + return getAsync("estimate", "createSubscriptionForCustomerEstimate", path, null) .thenApply( response -> CreateSubscriptionForCustomerEstimateResponse.fromJson( @@ -1130,7 +1211,11 @@ public CreateSubscriptionForCustomerEstimateResponse createSubscriptionForCustom Response createSubscriptionRaw(EstimateCreateSubscriptionParams params) throws ChargebeeException { - return post("/estimates/create_subscription", params != null ? params.toFormData() : null); + return post( + "estimate", + "createSubscription", + "/estimates/create_subscription", + params != null ? params.toFormData() : null); } /** @@ -1139,7 +1224,8 @@ Response createSubscriptionRaw(EstimateCreateSubscriptionParams params) */ Response createSubscriptionRaw(String jsonPayload) throws ChargebeeException { - return postJson("/estimates/create_subscription", jsonPayload); + return postJson( + "estimate", "createSubscription", "/estimates/create_subscription", jsonPayload); } public EstimateCreateSubscriptionResponse createSubscription( @@ -1153,7 +1239,11 @@ public EstimateCreateSubscriptionResponse createSubscription( public CompletableFuture createSubscriptionAsync( EstimateCreateSubscriptionParams params) { - return postAsync("/estimates/create_subscription", params != null ? params.toFormData() : null) + return postAsync( + "estimate", + "createSubscription", + "/estimates/create_subscription", + params != null ? params.toFormData() : null) .thenApply( response -> EstimateCreateSubscriptionResponse.fromJson(response.getBodyAsString(), response)); @@ -1164,7 +1254,11 @@ public CompletableFuture createSubscriptionA */ Response createInvoiceRaw(EstimateCreateInvoiceParams params) throws ChargebeeException { - return post("/estimates/create_invoice", params != null ? params.toFormData() : null); + return post( + "estimate", + "createInvoice", + "/estimates/create_invoice", + params != null ? params.toFormData() : null); } /** @@ -1172,7 +1266,7 @@ Response createInvoiceRaw(EstimateCreateInvoiceParams params) throws ChargebeeEx */ Response createInvoiceRaw(String jsonPayload) throws ChargebeeException { - return postJson("/estimates/create_invoice", jsonPayload); + return postJson("estimate", "createInvoice", "/estimates/create_invoice", jsonPayload); } public EstimateCreateInvoiceResponse createInvoice(EstimateCreateInvoiceParams params) @@ -1186,7 +1280,11 @@ public EstimateCreateInvoiceResponse createInvoice(EstimateCreateInvoiceParams p public CompletableFuture createInvoiceAsync( EstimateCreateInvoiceParams params) { - return postAsync("/estimates/create_invoice", params != null ? params.toFormData() : null) + return postAsync( + "estimate", + "createInvoice", + "/estimates/create_invoice", + params != null ? params.toFormData() : null) .thenApply( response -> EstimateCreateInvoiceResponse.fromJson(response.getBodyAsString(), response)); @@ -1200,7 +1298,7 @@ Response cancelSubscriptionRaw(String subscriptionId) throws ChargebeeException "subscription-id", subscriptionId); - return post(path, null); + return post("estimate", "cancelSubscription", path, null); } /** @@ -1214,7 +1312,7 @@ Response cancelSubscriptionRaw(String subscriptionId, EstimateCancelSubscription "/subscriptions/{subscription-id}/cancel_subscription_estimate", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("estimate", "cancelSubscription", path, params.toFormData()); } /** @@ -1228,7 +1326,7 @@ Response cancelSubscriptionRaw(String subscriptionId, String jsonPayload) "/subscriptions/{subscription-id}/cancel_subscription_estimate", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("estimate", "cancelSubscription", path, jsonPayload); } public EstimateCancelSubscriptionResponse cancelSubscription( @@ -1245,7 +1343,7 @@ public CompletableFuture cancelSubscriptionA "/subscriptions/{subscription-id}/cancel_subscription_estimate", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("estimate", "cancelSubscription", path, params.toFormData()) .thenApply( response -> EstimateCancelSubscriptionResponse.fromJson(response.getBodyAsString(), response)); @@ -1266,7 +1364,7 @@ public CompletableFuture cancelSubscriptionA "subscription-id", subscriptionId); - return postAsync(path, null) + return postAsync("estimate", "cancelSubscription", path, null) .thenApply( response -> 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 4b2bf31d8..54da11746 100644 --- a/src/main/java/com/chargebee/v4/services/EventService.java +++ b/src/main/java/com/chargebee/v4/services/EventService.java @@ -56,13 +56,13 @@ public EventService withOptions(RequestOptions options) { /** list a event using immutable params (executes immediately) - returns raw Response. */ Response listRaw(EventListParams params) throws ChargebeeException { - return get("/events", params != null ? params.toQueryParams() : null); + return get("event", "list", "/events", params != null ? params.toQueryParams() : null); } /** list a event without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/events", null); + return get("event", "list", "/events", null); } /** list a event using raw JSON payload (executes immediately) - returns raw Response. */ @@ -80,7 +80,7 @@ public EventListResponse list(EventListParams params) throws ChargebeeException /** Async variant of list for event with params. */ public CompletableFuture listAsync(EventListParams params) { - return getAsync("/events", params != null ? params.toQueryParams() : null) + return getAsync("event", "list", "/events", params != null ? params.toQueryParams() : null) .thenApply( response -> EventListResponse.fromJson(response.getBodyAsString(), this, params, response)); @@ -95,7 +95,7 @@ public EventListResponse list() throws ChargebeeException { /** Async variant of list for event without params. */ public CompletableFuture listAsync() { - return getAsync("/events", null) + return getAsync("event", "list", "/events", null) .thenApply( response -> EventListResponse.fromJson(response.getBodyAsString(), this, null, response)); @@ -105,7 +105,7 @@ public CompletableFuture listAsync() { Response retrieveRaw(String eventId) throws ChargebeeException { String path = buildPathWithParams("/events/{event-id}", "event-id", eventId); - return get(path, null); + return get("event", "retrieve", path, null); } public EventRetrieveResponse retrieve(String eventId) throws ChargebeeException { @@ -117,7 +117,7 @@ public EventRetrieveResponse retrieve(String eventId) throws ChargebeeException public CompletableFuture retrieveAsync(String eventId) { String path = buildPathWithParams("/events/{event-id}", "event-id", eventId); - return getAsync(path, null) + return getAsync("event", "retrieve", path, null) .thenApply( response -> 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 36d40f88e..2ca2851ff 100644 --- a/src/main/java/com/chargebee/v4/services/ExportService.java +++ b/src/main/java/com/chargebee/v4/services/ExportService.java @@ -120,13 +120,14 @@ public ExportService withOptions(RequestOptions options) { /** customers a export using immutable params (executes immediately) - returns raw Response. */ Response customersRaw(ExportCustomersParams params) throws ChargebeeException { - return post("/exports/customers", params != null ? params.toFormData() : null); + return post( + "export", "customers", "/exports/customers", params != null ? params.toFormData() : null); } /** customers a export using raw JSON payload (executes immediately) - returns raw Response. */ Response customersRaw(String jsonPayload) throws ChargebeeException { - return postJson("/exports/customers", jsonPayload); + return postJson("export", "customers", "/exports/customers", jsonPayload); } public ExportCustomersResponse customers(ExportCustomersParams params) throws ChargebeeException { @@ -138,7 +139,11 @@ public ExportCustomersResponse customers(ExportCustomersParams params) throws Ch /** Async variant of customers for export with params. */ public CompletableFuture customersAsync(ExportCustomersParams params) { - return postAsync("/exports/customers", params != null ? params.toFormData() : null) + return postAsync( + "export", + "customers", + "/exports/customers", + params != null ? params.toFormData() : null) .thenApply( response -> ExportCustomersResponse.fromJson(response.getBodyAsString(), response)); } @@ -148,7 +153,11 @@ public CompletableFuture customersAsync(ExportCustomers */ Response attachedItemsRaw(ExportAttachedItemsParams params) throws ChargebeeException { - return post("/exports/attached_items", params != null ? params.toFormData() : null); + return post( + "export", + "attachedItems", + "/exports/attached_items", + params != null ? params.toFormData() : null); } /** @@ -156,7 +165,7 @@ Response attachedItemsRaw(ExportAttachedItemsParams params) throws ChargebeeExce */ Response attachedItemsRaw(String jsonPayload) throws ChargebeeException { - return postJson("/exports/attached_items", jsonPayload); + return postJson("export", "attachedItems", "/exports/attached_items", jsonPayload); } public ExportAttachedItemsResponse attachedItems(ExportAttachedItemsParams params) @@ -170,7 +179,11 @@ public ExportAttachedItemsResponse attachedItems(ExportAttachedItemsParams param public CompletableFuture attachedItemsAsync( ExportAttachedItemsParams params) { - return postAsync("/exports/attached_items", params != null ? params.toFormData() : null) + return postAsync( + "export", + "attachedItems", + "/exports/attached_items", + params != null ? params.toFormData() : null) .thenApply( response -> ExportAttachedItemsResponse.fromJson(response.getBodyAsString(), response)); } @@ -178,13 +191,17 @@ public CompletableFuture attachedItemsAsync( /** transactions a export using immutable params (executes immediately) - returns raw Response. */ Response transactionsRaw(ExportTransactionsParams params) throws ChargebeeException { - return post("/exports/transactions", params != null ? params.toFormData() : null); + return post( + "export", + "transactions", + "/exports/transactions", + params != null ? params.toFormData() : null); } /** transactions a export using raw JSON payload (executes immediately) - returns raw Response. */ Response transactionsRaw(String jsonPayload) throws ChargebeeException { - return postJson("/exports/transactions", jsonPayload); + return postJson("export", "transactions", "/exports/transactions", jsonPayload); } public ExportTransactionsResponse transactions(ExportTransactionsParams params) @@ -198,7 +215,11 @@ public ExportTransactionsResponse transactions(ExportTransactionsParams params) public CompletableFuture transactionsAsync( ExportTransactionsParams params) { - return postAsync("/exports/transactions", params != null ? params.toFormData() : null) + return postAsync( + "export", + "transactions", + "/exports/transactions", + params != null ? params.toFormData() : null) .thenApply( response -> ExportTransactionsResponse.fromJson(response.getBodyAsString(), response)); } @@ -209,7 +230,11 @@ public CompletableFuture transactionsAsync( */ Response differentialPricesRaw(ExportDifferentialPricesParams params) throws ChargebeeException { - return post("/exports/differential_prices", params != null ? params.toFormData() : null); + return post( + "export", + "differentialPrices", + "/exports/differential_prices", + params != null ? params.toFormData() : null); } /** @@ -218,7 +243,7 @@ Response differentialPricesRaw(ExportDifferentialPricesParams params) throws Cha */ Response differentialPricesRaw(String jsonPayload) throws ChargebeeException { - return postJson("/exports/differential_prices", jsonPayload); + return postJson("export", "differentialPrices", "/exports/differential_prices", jsonPayload); } public ExportDifferentialPricesResponse differentialPrices(ExportDifferentialPricesParams params) @@ -232,7 +257,11 @@ public ExportDifferentialPricesResponse differentialPrices(ExportDifferentialPri public CompletableFuture differentialPricesAsync( ExportDifferentialPricesParams params) { - return postAsync("/exports/differential_prices", params != null ? params.toFormData() : null) + return postAsync( + "export", + "differentialPrices", + "/exports/differential_prices", + params != null ? params.toFormData() : null) .thenApply( response -> ExportDifferentialPricesResponse.fromJson(response.getBodyAsString(), response)); @@ -241,13 +270,17 @@ public CompletableFuture differentialPricesAsy /** itemFamilies a export using immutable params (executes immediately) - returns raw Response. */ Response itemFamiliesRaw(ExportItemFamiliesParams params) throws ChargebeeException { - return post("/exports/item_families", params != null ? params.toFormData() : null); + return post( + "export", + "itemFamilies", + "/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 ChargebeeException { - return postJson("/exports/item_families", jsonPayload); + return postJson("export", "itemFamilies", "/exports/item_families", jsonPayload); } public ExportItemFamiliesResponse itemFamilies(ExportItemFamiliesParams params) @@ -261,7 +294,11 @@ public ExportItemFamiliesResponse itemFamilies(ExportItemFamiliesParams params) public CompletableFuture itemFamiliesAsync( ExportItemFamiliesParams params) { - return postAsync("/exports/item_families", params != null ? params.toFormData() : null) + return postAsync( + "export", + "itemFamilies", + "/exports/item_families", + params != null ? params.toFormData() : null) .thenApply( response -> ExportItemFamiliesResponse.fromJson(response.getBodyAsString(), response)); } @@ -269,13 +306,14 @@ public CompletableFuture itemFamiliesAsync( /** invoices a export using immutable params (executes immediately) - returns raw Response. */ Response invoicesRaw(ExportInvoicesParams params) throws ChargebeeException { - return post("/exports/invoices", params != null ? params.toFormData() : null); + return post( + "export", "invoices", "/exports/invoices", params != null ? params.toFormData() : null); } /** invoices a export using raw JSON payload (executes immediately) - returns raw Response. */ Response invoicesRaw(String jsonPayload) throws ChargebeeException { - return postJson("/exports/invoices", jsonPayload); + return postJson("export", "invoices", "/exports/invoices", jsonPayload); } public ExportInvoicesResponse invoices(ExportInvoicesParams params) throws ChargebeeException { @@ -287,7 +325,8 @@ public ExportInvoicesResponse invoices(ExportInvoicesParams params) throws Charg /** Async variant of invoices for export with params. */ public CompletableFuture invoicesAsync(ExportInvoicesParams params) { - return postAsync("/exports/invoices", params != null ? params.toFormData() : null) + return postAsync( + "export", "invoices", "/exports/invoices", params != null ? params.toFormData() : null) .thenApply( response -> ExportInvoicesResponse.fromJson(response.getBodyAsString(), response)); } @@ -296,7 +335,7 @@ public CompletableFuture invoicesAsync(ExportInvoicesPar Response retrieveRaw(String exportId) throws ChargebeeException { String path = buildPathWithParams("/exports/{export-id}", "export-id", exportId); - return get(path, null); + return get("export", "retrieve", path, null); } public ExportRetrieveResponse retrieve(String exportId) throws ChargebeeException { @@ -308,7 +347,7 @@ public ExportRetrieveResponse retrieve(String exportId) throws ChargebeeExceptio public CompletableFuture retrieveAsync(String exportId) { String path = buildPathWithParams("/exports/{export-id}", "export-id", exportId); - return getAsync(path, null) + return getAsync("export", "retrieve", path, null) .thenApply( response -> ExportRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -318,7 +357,11 @@ public CompletableFuture retrieveAsync(String exportId) */ Response priceVariantsRaw(ExportPriceVariantsParams params) throws ChargebeeException { - return post("/exports/price_variants", params != null ? params.toFormData() : null); + return post( + "export", + "priceVariants", + "/exports/price_variants", + params != null ? params.toFormData() : null); } /** @@ -326,7 +369,7 @@ Response priceVariantsRaw(ExportPriceVariantsParams params) throws ChargebeeExce */ Response priceVariantsRaw(String jsonPayload) throws ChargebeeException { - return postJson("/exports/price_variants", jsonPayload); + return postJson("export", "priceVariants", "/exports/price_variants", jsonPayload); } public ExportPriceVariantsResponse priceVariants(ExportPriceVariantsParams params) @@ -340,7 +383,11 @@ public ExportPriceVariantsResponse priceVariants(ExportPriceVariantsParams param public CompletableFuture priceVariantsAsync( ExportPriceVariantsParams params) { - return postAsync("/exports/price_variants", params != null ? params.toFormData() : null) + return postAsync( + "export", + "priceVariants", + "/exports/price_variants", + params != null ? params.toFormData() : null) .thenApply( response -> ExportPriceVariantsResponse.fromJson(response.getBodyAsString(), response)); } @@ -348,13 +395,13 @@ public CompletableFuture priceVariantsAsync( /** items a export using immutable params (executes immediately) - returns raw Response. */ Response itemsRaw(ExportItemsParams params) throws ChargebeeException { - return post("/exports/items", params != null ? params.toFormData() : null); + return post("export", "items", "/exports/items", params != null ? params.toFormData() : null); } /** items a export using raw JSON payload (executes immediately) - returns raw Response. */ Response itemsRaw(String jsonPayload) throws ChargebeeException { - return postJson("/exports/items", jsonPayload); + return postJson("export", "items", "/exports/items", jsonPayload); } public ExportItemsResponse items(ExportItemsParams params) throws ChargebeeException { @@ -366,7 +413,8 @@ public ExportItemsResponse items(ExportItemsParams params) throws ChargebeeExcep /** Async variant of items for export with params. */ public CompletableFuture itemsAsync(ExportItemsParams params) { - return postAsync("/exports/items", params != null ? params.toFormData() : null) + return postAsync( + "export", "items", "/exports/items", params != null ? params.toFormData() : null) .thenApply(response -> ExportItemsResponse.fromJson(response.getBodyAsString(), response)); } @@ -375,7 +423,11 @@ public CompletableFuture itemsAsync(ExportItemsParams param */ Response deferredRevenueRaw(ExportDeferredRevenueParams params) throws ChargebeeException { - return post("/exports/deferred_revenue", params != null ? params.toFormData() : null); + return post( + "export", + "deferredRevenue", + "/exports/deferred_revenue", + params != null ? params.toFormData() : null); } /** @@ -383,7 +435,7 @@ Response deferredRevenueRaw(ExportDeferredRevenueParams params) throws Chargebee */ Response deferredRevenueRaw(String jsonPayload) throws ChargebeeException { - return postJson("/exports/deferred_revenue", jsonPayload); + return postJson("export", "deferredRevenue", "/exports/deferred_revenue", jsonPayload); } public ExportDeferredRevenueResponse deferredRevenue(ExportDeferredRevenueParams params) @@ -397,7 +449,11 @@ public ExportDeferredRevenueResponse deferredRevenue(ExportDeferredRevenueParams public CompletableFuture deferredRevenueAsync( ExportDeferredRevenueParams params) { - return postAsync("/exports/deferred_revenue", params != null ? params.toFormData() : null) + return postAsync( + "export", + "deferredRevenue", + "/exports/deferred_revenue", + params != null ? params.toFormData() : null) .thenApply( response -> ExportDeferredRevenueResponse.fromJson(response.getBodyAsString(), response)); @@ -409,7 +465,11 @@ public CompletableFuture deferredRevenueAsync( */ Response revenueRecognitionRaw(ExportRevenueRecognitionParams params) throws ChargebeeException { - return post("/exports/revenue_recognition", params != null ? params.toFormData() : null); + return post( + "export", + "revenueRecognition", + "/exports/revenue_recognition", + params != null ? params.toFormData() : null); } /** @@ -418,7 +478,7 @@ Response revenueRecognitionRaw(ExportRevenueRecognitionParams params) throws Cha */ Response revenueRecognitionRaw(String jsonPayload) throws ChargebeeException { - return postJson("/exports/revenue_recognition", jsonPayload); + return postJson("export", "revenueRecognition", "/exports/revenue_recognition", jsonPayload); } public ExportRevenueRecognitionResponse revenueRecognition(ExportRevenueRecognitionParams params) @@ -432,7 +492,11 @@ public ExportRevenueRecognitionResponse revenueRecognition(ExportRevenueRecognit public CompletableFuture revenueRecognitionAsync( ExportRevenueRecognitionParams params) { - return postAsync("/exports/revenue_recognition", params != null ? params.toFormData() : null) + return postAsync( + "export", + "revenueRecognition", + "/exports/revenue_recognition", + params != null ? params.toFormData() : null) .thenApply( response -> ExportRevenueRecognitionResponse.fromJson(response.getBodyAsString(), response)); @@ -441,13 +505,17 @@ public CompletableFuture revenueRecognitionAsy /** creditNotes a export using immutable params (executes immediately) - returns raw Response. */ Response creditNotesRaw(ExportCreditNotesParams params) throws ChargebeeException { - return post("/exports/credit_notes", params != null ? params.toFormData() : null); + return post( + "export", + "creditNotes", + "/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 ChargebeeException { - return postJson("/exports/credit_notes", jsonPayload); + return postJson("export", "creditNotes", "/exports/credit_notes", jsonPayload); } public ExportCreditNotesResponse creditNotes(ExportCreditNotesParams params) @@ -461,7 +529,11 @@ public ExportCreditNotesResponse creditNotes(ExportCreditNotesParams params) public CompletableFuture creditNotesAsync( ExportCreditNotesParams params) { - return postAsync("/exports/credit_notes", params != null ? params.toFormData() : null) + return postAsync( + "export", + "creditNotes", + "/exports/credit_notes", + params != null ? params.toFormData() : null) .thenApply( response -> ExportCreditNotesResponse.fromJson(response.getBodyAsString(), response)); } @@ -469,13 +541,14 @@ public CompletableFuture creditNotesAsync( /** coupons a export using immutable params (executes immediately) - returns raw Response. */ Response couponsRaw(ExportCouponsParams params) throws ChargebeeException { - return post("/exports/coupons", params != null ? params.toFormData() : null); + return post( + "export", "coupons", "/exports/coupons", params != null ? params.toFormData() : null); } /** coupons a export using raw JSON payload (executes immediately) - returns raw Response. */ Response couponsRaw(String jsonPayload) throws ChargebeeException { - return postJson("/exports/coupons", jsonPayload); + return postJson("export", "coupons", "/exports/coupons", jsonPayload); } public ExportCouponsResponse coupons(ExportCouponsParams params) throws ChargebeeException { @@ -487,7 +560,8 @@ public ExportCouponsResponse coupons(ExportCouponsParams params) throws Chargebe /** Async variant of coupons for export with params. */ public CompletableFuture couponsAsync(ExportCouponsParams params) { - return postAsync("/exports/coupons", params != null ? params.toFormData() : null) + return postAsync( + "export", "coupons", "/exports/coupons", params != null ? params.toFormData() : null) .thenApply( response -> ExportCouponsResponse.fromJson(response.getBodyAsString(), response)); } @@ -495,13 +569,13 @@ public CompletableFuture couponsAsync(ExportCouponsParams /** orders a export using immutable params (executes immediately) - returns raw Response. */ Response ordersRaw(ExportOrdersParams params) throws ChargebeeException { - return post("/exports/orders", params != null ? params.toFormData() : null); + return post("export", "orders", "/exports/orders", params != null ? params.toFormData() : null); } /** orders a export using raw JSON payload (executes immediately) - returns raw Response. */ Response ordersRaw(String jsonPayload) throws ChargebeeException { - return postJson("/exports/orders", jsonPayload); + return postJson("export", "orders", "/exports/orders", jsonPayload); } public ExportOrdersResponse orders(ExportOrdersParams params) throws ChargebeeException { @@ -513,20 +587,25 @@ public ExportOrdersResponse orders(ExportOrdersParams params) throws ChargebeeEx /** Async variant of orders for export with params. */ public CompletableFuture ordersAsync(ExportOrdersParams params) { - return postAsync("/exports/orders", params != null ? params.toFormData() : null) + return postAsync( + "export", "orders", "/exports/orders", params != null ? params.toFormData() : null) .thenApply(response -> ExportOrdersResponse.fromJson(response.getBodyAsString(), response)); } /** itemPrices a export using immutable params (executes immediately) - returns raw Response. */ Response itemPricesRaw(ExportItemPricesParams params) throws ChargebeeException { - return post("/exports/item_prices", params != null ? params.toFormData() : null); + return post( + "export", + "itemPrices", + "/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 ChargebeeException { - return postJson("/exports/item_prices", jsonPayload); + return postJson("export", "itemPrices", "/exports/item_prices", jsonPayload); } public ExportItemPricesResponse itemPrices(ExportItemPricesParams params) @@ -540,7 +619,11 @@ public ExportItemPricesResponse itemPrices(ExportItemPricesParams params) public CompletableFuture itemPricesAsync( ExportItemPricesParams params) { - return postAsync("/exports/item_prices", params != null ? params.toFormData() : null) + return postAsync( + "export", + "itemPrices", + "/exports/item_prices", + params != null ? params.toFormData() : null) .thenApply( response -> ExportItemPricesResponse.fromJson(response.getBodyAsString(), response)); } @@ -550,7 +633,11 @@ public CompletableFuture itemPricesAsync( */ Response subscriptionsRaw(ExportSubscriptionsParams params) throws ChargebeeException { - return post("/exports/subscriptions", params != null ? params.toFormData() : null); + return post( + "export", + "subscriptions", + "/exports/subscriptions", + params != null ? params.toFormData() : null); } /** @@ -558,7 +645,7 @@ Response subscriptionsRaw(ExportSubscriptionsParams params) throws ChargebeeExce */ Response subscriptionsRaw(String jsonPayload) throws ChargebeeException { - return postJson("/exports/subscriptions", jsonPayload); + return postJson("export", "subscriptions", "/exports/subscriptions", jsonPayload); } public ExportSubscriptionsResponse subscriptions(ExportSubscriptionsParams params) @@ -572,7 +659,11 @@ public ExportSubscriptionsResponse subscriptions(ExportSubscriptionsParams param public CompletableFuture subscriptionsAsync( ExportSubscriptionsParams params) { - return postAsync("/exports/subscriptions", params != null ? params.toFormData() : null) + return postAsync( + "export", + "subscriptions", + "/exports/subscriptions", + params != null ? params.toFormData() : null) .thenApply( response -> ExportSubscriptionsResponse.fromJson(response.getBodyAsString(), response)); } @@ -580,13 +671,13 @@ public CompletableFuture subscriptionsAsync( /** addons a export using immutable params (executes immediately) - returns raw Response. */ Response addonsRaw(ExportAddonsParams params) throws ChargebeeException { - return post("/exports/addons", params != null ? params.toFormData() : null); + return post("export", "addons", "/exports/addons", params != null ? params.toFormData() : null); } /** addons a export using raw JSON payload (executes immediately) - returns raw Response. */ Response addonsRaw(String jsonPayload) throws ChargebeeException { - return postJson("/exports/addons", jsonPayload); + return postJson("export", "addons", "/exports/addons", jsonPayload); } public ExportAddonsResponse addons(ExportAddonsParams params) throws ChargebeeException { @@ -598,20 +689,21 @@ public ExportAddonsResponse addons(ExportAddonsParams params) throws ChargebeeEx /** Async variant of addons for export with params. */ public CompletableFuture addonsAsync(ExportAddonsParams params) { - return postAsync("/exports/addons", params != null ? params.toFormData() : null) + return postAsync( + "export", "addons", "/exports/addons", params != null ? params.toFormData() : null) .thenApply(response -> ExportAddonsResponse.fromJson(response.getBodyAsString(), response)); } /** plans a export using immutable params (executes immediately) - returns raw Response. */ Response plansRaw(ExportPlansParams params) throws ChargebeeException { - return post("/exports/plans", params != null ? params.toFormData() : null); + return post("export", "plans", "/exports/plans", params != null ? params.toFormData() : null); } /** plans a export using raw JSON payload (executes immediately) - returns raw Response. */ Response plansRaw(String jsonPayload) throws ChargebeeException { - return postJson("/exports/plans", jsonPayload); + return postJson("export", "plans", "/exports/plans", jsonPayload); } public ExportPlansResponse plans(ExportPlansParams params) throws ChargebeeException { @@ -623,7 +715,8 @@ public ExportPlansResponse plans(ExportPlansParams params) throws ChargebeeExcep /** Async variant of plans for export with params. */ public CompletableFuture plansAsync(ExportPlansParams params) { - return postAsync("/exports/plans", params != null ? params.toFormData() : null) + return postAsync( + "export", "plans", "/exports/plans", params != null ? params.toFormData() : null) .thenApply(response -> 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 a9cfb33df..ad88738b5 100644 --- a/src/main/java/com/chargebee/v4/services/FeatureService.java +++ b/src/main/java/com/chargebee/v4/services/FeatureService.java @@ -72,13 +72,13 @@ public FeatureService withOptions(RequestOptions options) { /** list a feature using immutable params (executes immediately) - returns raw Response. */ Response listRaw(FeatureListParams params) throws ChargebeeException { - return get("/features", params != null ? params.toQueryParams() : null); + return get("feature", "list", "/features", params != null ? params.toQueryParams() : null); } /** list a feature without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/features", null); + return get("feature", "list", "/features", null); } /** list a feature using raw JSON payload (executes immediately) - returns raw Response. */ @@ -96,7 +96,7 @@ public FeatureListResponse list(FeatureListParams params) throws ChargebeeExcept /** Async variant of list for feature with params. */ public CompletableFuture listAsync(FeatureListParams params) { - return getAsync("/features", params != null ? params.toQueryParams() : null) + return getAsync("feature", "list", "/features", params != null ? params.toQueryParams() : null) .thenApply( response -> FeatureListResponse.fromJson(response.getBodyAsString(), this, params, response)); @@ -111,7 +111,7 @@ public FeatureListResponse list() throws ChargebeeException { /** Async variant of list for feature without params. */ public CompletableFuture listAsync() { - return getAsync("/features", null) + return getAsync("feature", "list", "/features", null) .thenApply( response -> FeatureListResponse.fromJson(response.getBodyAsString(), this, null, response)); @@ -120,13 +120,13 @@ public CompletableFuture listAsync() { /** create a feature using immutable params (executes immediately) - returns raw Response. */ Response createRaw(FeatureCreateParams params) throws ChargebeeException { - return post("/features", params != null ? params.toFormData() : null); + return post("feature", "create", "/features", params != null ? params.toFormData() : null); } /** create a feature using raw JSON payload (executes immediately) - returns raw Response. */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/features", jsonPayload); + return postJson("feature", "create", "/features", jsonPayload); } public FeatureCreateResponse create(FeatureCreateParams params) throws ChargebeeException { @@ -138,7 +138,7 @@ public FeatureCreateResponse create(FeatureCreateParams params) throws Chargebee /** Async variant of create for feature with params. */ public CompletableFuture createAsync(FeatureCreateParams params) { - return postAsync("/features", params != null ? params.toFormData() : null) + return postAsync("feature", "create", "/features", params != null ? params.toFormData() : null) .thenApply( response -> FeatureCreateResponse.fromJson(response.getBodyAsString(), response)); } @@ -147,7 +147,7 @@ public CompletableFuture createAsync(FeatureCreateParams Response deleteRaw(String featureId) throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}/delete", "feature-id", featureId); - return post(path, null); + return post("feature", "delete", path, null); } public FeatureDeleteResponse delete(String featureId) throws ChargebeeException { @@ -159,7 +159,7 @@ public FeatureDeleteResponse delete(String featureId) throws ChargebeeException public CompletableFuture deleteAsync(String featureId) { String path = buildPathWithParams("/features/{feature-id}/delete", "feature-id", featureId); - return postAsync(path, null) + return postAsync("feature", "delete", path, null) .thenApply( response -> FeatureDeleteResponse.fromJson(response.getBodyAsString(), response)); } @@ -168,7 +168,7 @@ public CompletableFuture deleteAsync(String featureId) { Response retrieveRaw(String featureId) throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}", "feature-id", featureId); - return get(path, null); + return get("feature", "retrieve", path, null); } public FeatureRetrieveResponse retrieve(String featureId) throws ChargebeeException { @@ -180,7 +180,7 @@ public FeatureRetrieveResponse retrieve(String featureId) throws ChargebeeExcept public CompletableFuture retrieveAsync(String featureId) { String path = buildPathWithParams("/features/{feature-id}", "feature-id", featureId); - return getAsync(path, null) + return getAsync("feature", "retrieve", path, null) .thenApply( response -> FeatureRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -189,19 +189,19 @@ public CompletableFuture retrieveAsync(String featureId Response updateRaw(String featureId) throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}", "feature-id", featureId); - return post(path, null); + return post("feature", "update", path, null); } /** update a feature using immutable params (executes immediately) - returns raw Response. */ Response updateRaw(String featureId, FeatureUpdateParams params) throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}", "feature-id", featureId); - return post(path, params.toFormData()); + return post("feature", "update", path, params.toFormData()); } /** update a feature using raw JSON payload (executes immediately) - returns raw Response. */ Response updateRaw(String featureId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}", "feature-id", featureId); - return postJson(path, jsonPayload); + return postJson("feature", "update", path, jsonPayload); } public FeatureUpdateResponse update(String featureId, FeatureUpdateParams params) @@ -214,7 +214,7 @@ public FeatureUpdateResponse update(String featureId, FeatureUpdateParams params public CompletableFuture updateAsync( String featureId, FeatureUpdateParams params) { String path = buildPathWithParams("/features/{feature-id}", "feature-id", featureId); - return postAsync(path, params.toFormData()) + return postAsync("feature", "update", path, params.toFormData()) .thenApply( response -> FeatureUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -228,7 +228,7 @@ public FeatureUpdateResponse update(String featureId) throws ChargebeeException public CompletableFuture updateAsync(String featureId) { String path = buildPathWithParams("/features/{feature-id}", "feature-id", featureId); - return postAsync(path, null) + return postAsync("feature", "update", path, null) .thenApply( response -> FeatureUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -238,7 +238,7 @@ Response archiveRaw(String featureId) throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}/archive_command", "feature-id", featureId); - return post(path, null); + return post("feature", "archive", path, null); } public FeatureArchiveResponse archive(String featureId) throws ChargebeeException { @@ -251,7 +251,7 @@ public CompletableFuture archiveAsync(String featureId) String path = buildPathWithParams("/features/{feature-id}/archive_command", "feature-id", featureId); - return postAsync(path, null) + return postAsync("feature", "archive", path, null) .thenApply( response -> FeatureArchiveResponse.fromJson(response.getBodyAsString(), response)); } @@ -261,7 +261,7 @@ Response activateRaw(String featureId) throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}/activate_command", "feature-id", featureId); - return post(path, null); + return post("feature", "activate", path, null); } public FeatureActivateResponse activate(String featureId) throws ChargebeeException { @@ -274,7 +274,7 @@ public CompletableFuture activateAsync(String featureId String path = buildPathWithParams("/features/{feature-id}/activate_command", "feature-id", featureId); - return postAsync(path, null) + return postAsync("feature", "activate", path, null) .thenApply( response -> FeatureActivateResponse.fromJson(response.getBodyAsString(), response)); } @@ -284,7 +284,7 @@ Response reactivateRaw(String featureId) throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}/reactivate_command", "feature-id", featureId); - return post(path, null); + return post("feature", "reactivate", path, null); } public FeatureReactivateResponse reactivate(String featureId) throws ChargebeeException { @@ -297,7 +297,7 @@ public CompletableFuture reactivateAsync(String featu String path = buildPathWithParams("/features/{feature-id}/reactivate_command", "feature-id", featureId); - return postAsync(path, null) + return postAsync("feature", "reactivate", path, null) .thenApply( response -> 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 52b245db3..f307b7848 100644 --- a/src/main/java/com/chargebee/v4/services/FullExportService.java +++ b/src/main/java/com/chargebee/v4/services/FullExportService.java @@ -54,7 +54,11 @@ public FullExportService withOptions(RequestOptions options) { /** status a fullExport using immutable params (executes immediately) - returns raw Response. */ Response statusRaw(FullExportStatusParams params) throws ChargebeeException { - return get("/full_exports/status", params != null ? params.toQueryParams() : null); + return get( + "fullExport", + "status", + "/full_exports/status", + params != null ? params.toQueryParams() : null); } /** status a fullExport using raw JSON payload (executes immediately) - returns raw Response. */ @@ -72,7 +76,11 @@ public FullExportStatusResponse status(FullExportStatusParams params) throws Cha /** Async variant of status for fullExport with params. */ public CompletableFuture statusAsync(FullExportStatusParams params) { - return getAsync("/full_exports/status", params != null ? params.toQueryParams() : null) + return getAsync( + "fullExport", + "status", + "/full_exports/status", + params != null ? params.toQueryParams() : null) .thenApply( response -> 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 943baed90..28f691b5b 100644 --- a/src/main/java/com/chargebee/v4/services/GiftService.java +++ b/src/main/java/com/chargebee/v4/services/GiftService.java @@ -72,13 +72,17 @@ public GiftService withOptions(RequestOptions options) { /** createForItems a gift using immutable params (executes immediately) - returns raw Response. */ Response createForItemsRaw(GiftCreateForItemsParams params) throws ChargebeeException { - return post("/gifts/create_for_items", params != null ? params.toFormData() : null); + return post( + "gift", + "createForItems", + "/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 ChargebeeException { - return postJson("/gifts/create_for_items", jsonPayload); + return postJson("gift", "createForItems", "/gifts/create_for_items", jsonPayload); } public GiftCreateForItemsResponse createForItems(GiftCreateForItemsParams params) @@ -92,7 +96,11 @@ public GiftCreateForItemsResponse createForItems(GiftCreateForItemsParams params public CompletableFuture createForItemsAsync( GiftCreateForItemsParams params) { - return postAsync("/gifts/create_for_items", params != null ? params.toFormData() : null) + return postAsync( + "gift", + "createForItems", + "/gifts/create_for_items", + params != null ? params.toFormData() : null) .thenApply( response -> GiftCreateForItemsResponse.fromJson(response.getBodyAsString(), response)); } @@ -101,7 +109,7 @@ public CompletableFuture createForItemsAsync( Response cancelRaw(String giftId) throws ChargebeeException { String path = buildPathWithParams("/gifts/{gift-id}/cancel", "gift-id", giftId); - return post(path, null); + return post("gift", "cancel", path, null); } public GiftCancelResponse cancel(String giftId) throws ChargebeeException { @@ -113,7 +121,7 @@ public GiftCancelResponse cancel(String giftId) throws ChargebeeException { public CompletableFuture cancelAsync(String giftId) { String path = buildPathWithParams("/gifts/{gift-id}/cancel", "gift-id", giftId); - return postAsync(path, null) + return postAsync("gift", "cancel", path, null) .thenApply(response -> GiftCancelResponse.fromJson(response.getBodyAsString(), response)); } @@ -121,19 +129,19 @@ public CompletableFuture cancelAsync(String giftId) { Response updateGiftRaw(String giftId) throws ChargebeeException { String path = buildPathWithParams("/gifts/{gift-id}/update_gift", "gift-id", giftId); - return post(path, null); + return post("gift", "updateGift", path, null); } /** 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()); + return post("gift", "updateGift", path, params.toFormData()); } /** 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); + return postJson("gift", "updateGift", path, jsonPayload); } public UpdateGiftResponse updateGift(String giftId, UpdateGiftParams params) @@ -146,33 +154,20 @@ public UpdateGiftResponse updateGift(String giftId, UpdateGiftParams params) public CompletableFuture updateGiftAsync( String giftId, UpdateGiftParams params) { String path = buildPathWithParams("/gifts/{gift-id}/update_gift", "gift-id", giftId); - return postAsync(path, params.toFormData()) - .thenApply(response -> UpdateGiftResponse.fromJson(response.getBodyAsString(), response)); - } - - public UpdateGiftResponse updateGift(String giftId) throws ChargebeeException { - Response response = updateGiftRaw(giftId); - return UpdateGiftResponse.fromJson(response.getBodyAsString(), response); - } - - /** Async variant of updateGift for gift without params. */ - public CompletableFuture updateGiftAsync(String giftId) { - String path = buildPathWithParams("/gifts/{gift-id}/update_gift", "gift-id", giftId); - - return postAsync(path, null) + return postAsync("gift", "updateGift", path, params.toFormData()) .thenApply(response -> UpdateGiftResponse.fromJson(response.getBodyAsString(), response)); } /** list a gift using immutable params (executes immediately) - returns raw Response. */ Response listRaw(GiftListParams params) throws ChargebeeException { - return get("/gifts", params != null ? params.toQueryParams() : null); + return get("gift", "list", "/gifts", params != null ? params.toQueryParams() : null); } /** list a gift without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/gifts", null); + return get("gift", "list", "/gifts", null); } /** list a gift using raw JSON payload (executes immediately) - returns raw Response. */ @@ -190,7 +185,7 @@ public GiftListResponse list(GiftListParams params) throws ChargebeeException { /** Async variant of list for gift with params. */ public CompletableFuture listAsync(GiftListParams params) { - return getAsync("/gifts", params != null ? params.toQueryParams() : null) + return getAsync("gift", "list", "/gifts", params != null ? params.toQueryParams() : null) .thenApply( response -> GiftListResponse.fromJson(response.getBodyAsString(), this, params, response)); @@ -205,7 +200,7 @@ public GiftListResponse list() throws ChargebeeException { /** Async variant of list for gift without params. */ public CompletableFuture listAsync() { - return getAsync("/gifts", null) + return getAsync("gift", "list", "/gifts", null) .thenApply( response -> GiftListResponse.fromJson(response.getBodyAsString(), this, null, response)); @@ -214,13 +209,13 @@ public CompletableFuture listAsync() { /** create a gift using immutable params (executes immediately) - returns raw Response. */ Response createRaw(GiftCreateParams params) throws ChargebeeException { - return post("/gifts", params != null ? params.toFormData() : null); + return post("gift", "create", "/gifts", params != null ? params.toFormData() : null); } /** create a gift using raw JSON payload (executes immediately) - returns raw Response. */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/gifts", jsonPayload); + return postJson("gift", "create", "/gifts", jsonPayload); } public GiftCreateResponse create(GiftCreateParams params) throws ChargebeeException { @@ -232,7 +227,7 @@ public GiftCreateResponse create(GiftCreateParams params) throws ChargebeeExcept /** Async variant of create for gift with params. */ public CompletableFuture createAsync(GiftCreateParams params) { - return postAsync("/gifts", params != null ? params.toFormData() : null) + return postAsync("gift", "create", "/gifts", params != null ? params.toFormData() : null) .thenApply(response -> GiftCreateResponse.fromJson(response.getBodyAsString(), response)); } @@ -240,7 +235,7 @@ public CompletableFuture createAsync(GiftCreateParams params Response retrieveRaw(String giftId) throws ChargebeeException { String path = buildPathWithParams("/gifts/{gift-id}", "gift-id", giftId); - return get(path, null); + return get("gift", "retrieve", path, null); } public GiftRetrieveResponse retrieve(String giftId) throws ChargebeeException { @@ -252,7 +247,7 @@ public GiftRetrieveResponse retrieve(String giftId) throws ChargebeeException { public CompletableFuture retrieveAsync(String giftId) { String path = buildPathWithParams("/gifts/{gift-id}", "gift-id", giftId); - return getAsync(path, null) + return getAsync("gift", "retrieve", path, null) .thenApply(response -> GiftRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -260,7 +255,7 @@ public CompletableFuture retrieveAsync(String giftId) { Response claimRaw(String giftId) throws ChargebeeException { String path = buildPathWithParams("/gifts/{gift-id}/claim", "gift-id", giftId); - return post(path, null); + return post("gift", "claim", path, null); } public GiftClaimResponse claim(String giftId) throws ChargebeeException { @@ -272,7 +267,7 @@ public GiftClaimResponse claim(String giftId) throws ChargebeeException { public CompletableFuture claimAsync(String giftId) { String path = buildPathWithParams("/gifts/{gift-id}/claim", "gift-id", giftId); - return postAsync(path, null) + return postAsync("gift", "claim", path, null) .thenApply(response -> 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 a0276403b..3d5f266e3 100644 --- a/src/main/java/com/chargebee/v4/services/HostedPageService.java +++ b/src/main/java/com/chargebee/v4/services/HostedPageService.java @@ -139,7 +139,10 @@ Response checkoutOneTimeForItemsRaw(HostedPageCheckoutOneTimeForItemsParams para throws ChargebeeException { return post( - "/hosted_pages/checkout_one_time_for_items", params != null ? params.toFormData() : null); + "hostedPage", + "checkoutOneTimeForItems", + "/hosted_pages/checkout_one_time_for_items", + params != null ? params.toFormData() : null); } /** @@ -148,7 +151,11 @@ Response checkoutOneTimeForItemsRaw(HostedPageCheckoutOneTimeForItemsParams para */ Response checkoutOneTimeForItemsRaw(String jsonPayload) throws ChargebeeException { - return postJson("/hosted_pages/checkout_one_time_for_items", jsonPayload); + return postJson( + "hostedPage", + "checkoutOneTimeForItems", + "/hosted_pages/checkout_one_time_for_items", + jsonPayload); } public HostedPageCheckoutOneTimeForItemsResponse checkoutOneTimeForItems( @@ -163,6 +170,8 @@ public CompletableFuture checkoutOneT HostedPageCheckoutOneTimeForItemsParams params) { return postAsync( + "hostedPage", + "checkoutOneTimeForItems", "/hosted_pages/checkout_one_time_for_items", params != null ? params.toFormData() : null) .thenApply( @@ -178,7 +187,11 @@ public CompletableFuture checkoutOneT Response updatePaymentMethodRaw(HostedPageUpdatePaymentMethodParams params) throws ChargebeeException { - return post("/hosted_pages/update_payment_method", params != null ? params.toFormData() : null); + return post( + "hostedPage", + "updatePaymentMethod", + "/hosted_pages/update_payment_method", + params != null ? params.toFormData() : null); } /** @@ -187,7 +200,8 @@ Response updatePaymentMethodRaw(HostedPageUpdatePaymentMethodParams params) */ Response updatePaymentMethodRaw(String jsonPayload) throws ChargebeeException { - return postJson("/hosted_pages/update_payment_method", jsonPayload); + return postJson( + "hostedPage", "updatePaymentMethod", "/hosted_pages/update_payment_method", jsonPayload); } public HostedPageUpdatePaymentMethodResponse updatePaymentMethod( @@ -202,7 +216,10 @@ public CompletableFuture updatePaymentMet HostedPageUpdatePaymentMethodParams params) { return postAsync( - "/hosted_pages/update_payment_method", params != null ? params.toFormData() : null) + "hostedPage", + "updatePaymentMethod", + "/hosted_pages/update_payment_method", + params != null ? params.toFormData() : null) .thenApply( response -> HostedPageUpdatePaymentMethodResponse.fromJson( @@ -214,7 +231,11 @@ public CompletableFuture updatePaymentMet */ Response updateCardRaw(HostedPageUpdateCardParams params) throws ChargebeeException { - return post("/hosted_pages/update_card", params != null ? params.toFormData() : null); + return post( + "hostedPage", + "updateCard", + "/hosted_pages/update_card", + params != null ? params.toFormData() : null); } /** @@ -222,7 +243,7 @@ Response updateCardRaw(HostedPageUpdateCardParams params) throws ChargebeeExcept */ Response updateCardRaw(String jsonPayload) throws ChargebeeException { - return postJson("/hosted_pages/update_card", jsonPayload); + return postJson("hostedPage", "updateCard", "/hosted_pages/update_card", jsonPayload); } public HostedPageUpdateCardResponse updateCard(HostedPageUpdateCardParams params) @@ -236,7 +257,11 @@ public HostedPageUpdateCardResponse updateCard(HostedPageUpdateCardParams params public CompletableFuture updateCardAsync( HostedPageUpdateCardParams params) { - return postAsync("/hosted_pages/update_card", params != null ? params.toFormData() : null) + return postAsync( + "hostedPage", + "updateCard", + "/hosted_pages/update_card", + params != null ? params.toFormData() : null) .thenApply( response -> HostedPageUpdateCardResponse.fromJson(response.getBodyAsString(), response)); @@ -249,7 +274,11 @@ public CompletableFuture updateCardAsync( Response extendSubscriptionRaw(HostedPageExtendSubscriptionParams params) throws ChargebeeException { - return post("/hosted_pages/extend_subscription", params != null ? params.toFormData() : null); + return post( + "hostedPage", + "extendSubscription", + "/hosted_pages/extend_subscription", + params != null ? params.toFormData() : null); } /** @@ -258,7 +287,8 @@ Response extendSubscriptionRaw(HostedPageExtendSubscriptionParams params) */ Response extendSubscriptionRaw(String jsonPayload) throws ChargebeeException { - return postJson("/hosted_pages/extend_subscription", jsonPayload); + return postJson( + "hostedPage", "extendSubscription", "/hosted_pages/extend_subscription", jsonPayload); } public HostedPageExtendSubscriptionResponse extendSubscription( @@ -273,7 +303,10 @@ public CompletableFuture extendSubscriptio HostedPageExtendSubscriptionParams params) { return postAsync( - "/hosted_pages/extend_subscription", params != null ? params.toFormData() : null) + "hostedPage", + "extendSubscription", + "/hosted_pages/extend_subscription", + params != null ? params.toFormData() : null) .thenApply( response -> HostedPageExtendSubscriptionResponse.fromJson( @@ -283,13 +316,17 @@ public CompletableFuture extendSubscriptio /** events a hostedPage using immutable params (executes immediately) - returns raw Response. */ Response eventsRaw(HostedPageEventsParams params) throws ChargebeeException { - return post("/hosted_pages/events", params != null ? params.toFormData() : null); + return post( + "hostedPage", + "events", + "/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 ChargebeeException { - return postJson("/hosted_pages/events", jsonPayload); + return postJson("hostedPage", "events", "/hosted_pages/events", jsonPayload); } public HostedPageEventsResponse events(HostedPageEventsParams params) throws ChargebeeException { @@ -301,7 +338,11 @@ public HostedPageEventsResponse events(HostedPageEventsParams params) throws Cha /** Async variant of events for hostedPage with params. */ public CompletableFuture eventsAsync(HostedPageEventsParams params) { - return postAsync("/hosted_pages/events", params != null ? params.toFormData() : null) + return postAsync( + "hostedPage", + "events", + "/hosted_pages/events", + params != null ? params.toFormData() : null) .thenApply( response -> HostedPageEventsResponse.fromJson(response.getBodyAsString(), response)); } @@ -314,7 +355,10 @@ Response checkoutGiftForItemsRaw(HostedPageCheckoutGiftForItemsParams params) throws ChargebeeException { return post( - "/hosted_pages/checkout_gift_for_items", params != null ? params.toFormData() : null); + "hostedPage", + "checkoutGiftForItems", + "/hosted_pages/checkout_gift_for_items", + params != null ? params.toFormData() : null); } /** @@ -323,7 +367,8 @@ Response checkoutGiftForItemsRaw(HostedPageCheckoutGiftForItemsParams params) */ Response checkoutGiftForItemsRaw(String jsonPayload) throws ChargebeeException { - return postJson("/hosted_pages/checkout_gift_for_items", jsonPayload); + return postJson( + "hostedPage", "checkoutGiftForItems", "/hosted_pages/checkout_gift_for_items", jsonPayload); } public HostedPageCheckoutGiftForItemsResponse checkoutGiftForItems( @@ -338,7 +383,10 @@ public CompletableFuture checkoutGiftFor HostedPageCheckoutGiftForItemsParams params) { return postAsync( - "/hosted_pages/checkout_gift_for_items", params != null ? params.toFormData() : null) + "hostedPage", + "checkoutGiftForItems", + "/hosted_pages/checkout_gift_for_items", + params != null ? params.toFormData() : null) .thenApply( response -> HostedPageCheckoutGiftForItemsResponse.fromJson( @@ -348,13 +396,14 @@ public CompletableFuture checkoutGiftFor /** list a hostedPage using immutable params (executes immediately) - returns raw Response. */ Response listRaw(HostedPageListParams params) throws ChargebeeException { - return get("/hosted_pages", params != null ? params.toQueryParams() : null); + return get( + "hostedPage", "list", "/hosted_pages", params != null ? params.toQueryParams() : null); } /** list a hostedPage without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/hosted_pages", null); + return get("hostedPage", "list", "/hosted_pages", null); } /** list a hostedPage using raw JSON payload (executes immediately) - returns raw Response. */ @@ -372,7 +421,8 @@ public HostedPageListResponse list(HostedPageListParams params) throws Chargebee /** Async variant of list for hostedPage with params. */ public CompletableFuture listAsync(HostedPageListParams params) { - return getAsync("/hosted_pages", params != null ? params.toQueryParams() : null) + return getAsync( + "hostedPage", "list", "/hosted_pages", params != null ? params.toQueryParams() : null) .thenApply( response -> HostedPageListResponse.fromJson( @@ -388,7 +438,7 @@ public HostedPageListResponse list() throws ChargebeeException { /** Async variant of list for hostedPage without params. */ public CompletableFuture listAsync() { - return getAsync("/hosted_pages", null) + return getAsync("hostedPage", "list", "/hosted_pages", null) .thenApply( response -> HostedPageListResponse.fromJson(response.getBodyAsString(), this, null, response)); @@ -399,7 +449,11 @@ public CompletableFuture listAsync() { */ Response viewVoucherRaw(HostedPageViewVoucherParams params) throws ChargebeeException { - return post("/hosted_pages/view_voucher", params != null ? params.toFormData() : null); + return post( + "hostedPage", + "viewVoucher", + "/hosted_pages/view_voucher", + params != null ? params.toFormData() : null); } /** @@ -407,7 +461,7 @@ Response viewVoucherRaw(HostedPageViewVoucherParams params) throws ChargebeeExce */ Response viewVoucherRaw(String jsonPayload) throws ChargebeeException { - return postJson("/hosted_pages/view_voucher", jsonPayload); + return postJson("hostedPage", "viewVoucher", "/hosted_pages/view_voucher", jsonPayload); } public HostedPageViewVoucherResponse viewVoucher(HostedPageViewVoucherParams params) @@ -421,7 +475,11 @@ public HostedPageViewVoucherResponse viewVoucher(HostedPageViewVoucherParams par public CompletableFuture viewVoucherAsync( HostedPageViewVoucherParams params) { - return postAsync("/hosted_pages/view_voucher", params != null ? params.toFormData() : null) + return postAsync( + "hostedPage", + "viewVoucher", + "/hosted_pages/view_voucher", + params != null ? params.toFormData() : null) .thenApply( response -> HostedPageViewVoucherResponse.fromJson(response.getBodyAsString(), response)); @@ -432,7 +490,11 @@ public CompletableFuture viewVoucherAsync( */ Response collectNowRaw(HostedPageCollectNowParams params) throws ChargebeeException { - return post("/hosted_pages/collect_now", params != null ? params.toFormData() : null); + return post( + "hostedPage", + "collectNow", + "/hosted_pages/collect_now", + params != null ? params.toFormData() : null); } /** @@ -440,7 +502,7 @@ Response collectNowRaw(HostedPageCollectNowParams params) throws ChargebeeExcept */ Response collectNowRaw(String jsonPayload) throws ChargebeeException { - return postJson("/hosted_pages/collect_now", jsonPayload); + return postJson("hostedPage", "collectNow", "/hosted_pages/collect_now", jsonPayload); } public HostedPageCollectNowResponse collectNow(HostedPageCollectNowParams params) @@ -454,7 +516,11 @@ public HostedPageCollectNowResponse collectNow(HostedPageCollectNowParams params public CompletableFuture collectNowAsync( HostedPageCollectNowParams params) { - return postAsync("/hosted_pages/collect_now", params != null ? params.toFormData() : null) + return postAsync( + "hostedPage", + "collectNow", + "/hosted_pages/collect_now", + params != null ? params.toFormData() : null) .thenApply( response -> HostedPageCollectNowResponse.fromJson(response.getBodyAsString(), response)); @@ -465,7 +531,11 @@ public CompletableFuture collectNowAsync( */ Response acceptQuoteRaw(HostedPageAcceptQuoteParams params) throws ChargebeeException { - return post("/hosted_pages/accept_quote", params != null ? params.toFormData() : null); + return post( + "hostedPage", + "acceptQuote", + "/hosted_pages/accept_quote", + params != null ? params.toFormData() : null); } /** @@ -473,7 +543,7 @@ Response acceptQuoteRaw(HostedPageAcceptQuoteParams params) throws ChargebeeExce */ Response acceptQuoteRaw(String jsonPayload) throws ChargebeeException { - return postJson("/hosted_pages/accept_quote", jsonPayload); + return postJson("hostedPage", "acceptQuote", "/hosted_pages/accept_quote", jsonPayload); } public HostedPageAcceptQuoteResponse acceptQuote(HostedPageAcceptQuoteParams params) @@ -487,7 +557,11 @@ public HostedPageAcceptQuoteResponse acceptQuote(HostedPageAcceptQuoteParams par public CompletableFuture acceptQuoteAsync( HostedPageAcceptQuoteParams params) { - return postAsync("/hosted_pages/accept_quote", params != null ? params.toFormData() : null) + return postAsync( + "hostedPage", + "acceptQuote", + "/hosted_pages/accept_quote", + params != null ? params.toFormData() : null) .thenApply( response -> HostedPageAcceptQuoteResponse.fromJson(response.getBodyAsString(), response)); @@ -501,7 +575,10 @@ Response checkoutNewForItemsRaw(HostedPageCheckoutNewForItemsParams params) throws ChargebeeException { return post( - "/hosted_pages/checkout_new_for_items", params != null ? params.toFormData() : null); + "hostedPage", + "checkoutNewForItems", + "/hosted_pages/checkout_new_for_items", + params != null ? params.toFormData() : null); } /** @@ -510,7 +587,8 @@ Response checkoutNewForItemsRaw(HostedPageCheckoutNewForItemsParams params) */ Response checkoutNewForItemsRaw(String jsonPayload) throws ChargebeeException { - return postJson("/hosted_pages/checkout_new_for_items", jsonPayload); + return postJson( + "hostedPage", "checkoutNewForItems", "/hosted_pages/checkout_new_for_items", jsonPayload); } public HostedPageCheckoutNewForItemsResponse checkoutNewForItems( @@ -525,7 +603,10 @@ public CompletableFuture checkoutNewForIt HostedPageCheckoutNewForItemsParams params) { return postAsync( - "/hosted_pages/checkout_new_for_items", params != null ? params.toFormData() : null) + "hostedPage", + "checkoutNewForItems", + "/hosted_pages/checkout_new_for_items", + params != null ? params.toFormData() : null) .thenApply( response -> HostedPageCheckoutNewForItemsResponse.fromJson( @@ -537,7 +618,11 @@ public CompletableFuture checkoutNewForIt */ Response claimGiftRaw(HostedPageClaimGiftParams params) throws ChargebeeException { - return post("/hosted_pages/claim_gift", params != null ? params.toFormData() : null); + return post( + "hostedPage", + "claimGift", + "/hosted_pages/claim_gift", + params != null ? params.toFormData() : null); } /** @@ -545,7 +630,7 @@ Response claimGiftRaw(HostedPageClaimGiftParams params) throws ChargebeeExceptio */ Response claimGiftRaw(String jsonPayload) throws ChargebeeException { - return postJson("/hosted_pages/claim_gift", jsonPayload); + return postJson("hostedPage", "claimGift", "/hosted_pages/claim_gift", jsonPayload); } public HostedPageClaimGiftResponse claimGift(HostedPageClaimGiftParams params) @@ -559,7 +644,11 @@ public HostedPageClaimGiftResponse claimGift(HostedPageClaimGiftParams params) public CompletableFuture claimGiftAsync( HostedPageClaimGiftParams params) { - return postAsync("/hosted_pages/claim_gift", params != null ? params.toFormData() : null) + return postAsync( + "hostedPage", + "claimGift", + "/hosted_pages/claim_gift", + params != null ? params.toFormData() : null) .thenApply( response -> HostedPageClaimGiftResponse.fromJson(response.getBodyAsString(), response)); } @@ -572,7 +661,10 @@ Response checkoutExistingForItemsRaw(HostedPageCheckoutExistingForItemsParams pa throws ChargebeeException { return post( - "/hosted_pages/checkout_existing_for_items", params != null ? params.toFormData() : null); + "hostedPage", + "checkoutExistingForItems", + "/hosted_pages/checkout_existing_for_items", + params != null ? params.toFormData() : null); } /** @@ -581,7 +673,11 @@ Response checkoutExistingForItemsRaw(HostedPageCheckoutExistingForItemsParams pa */ Response checkoutExistingForItemsRaw(String jsonPayload) throws ChargebeeException { - return postJson("/hosted_pages/checkout_existing_for_items", jsonPayload); + return postJson( + "hostedPage", + "checkoutExistingForItems", + "/hosted_pages/checkout_existing_for_items", + jsonPayload); } public HostedPageCheckoutExistingForItemsResponse checkoutExistingForItems( @@ -597,6 +693,8 @@ public HostedPageCheckoutExistingForItemsResponse checkoutExistingForItems( checkoutExistingForItemsAsync(HostedPageCheckoutExistingForItemsParams params) { return postAsync( + "hostedPage", + "checkoutExistingForItems", "/hosted_pages/checkout_existing_for_items", params != null ? params.toFormData() : null) .thenApply( @@ -610,7 +708,11 @@ public HostedPageCheckoutExistingForItemsResponse checkoutExistingForItems( */ Response preCancelRaw(HostedPagePreCancelParams params) throws ChargebeeException { - return post("/hosted_pages/pre_cancel", params != null ? params.toFormData() : null); + return post( + "hostedPage", + "preCancel", + "/hosted_pages/pre_cancel", + params != null ? params.toFormData() : null); } /** @@ -618,7 +720,7 @@ Response preCancelRaw(HostedPagePreCancelParams params) throws ChargebeeExceptio */ Response preCancelRaw(String jsonPayload) throws ChargebeeException { - return postJson("/hosted_pages/pre_cancel", jsonPayload); + return postJson("hostedPage", "preCancel", "/hosted_pages/pre_cancel", jsonPayload); } public HostedPagePreCancelResponse preCancel(HostedPagePreCancelParams params) @@ -632,7 +734,11 @@ public HostedPagePreCancelResponse preCancel(HostedPagePreCancelParams params) public CompletableFuture preCancelAsync( HostedPagePreCancelParams params) { - return postAsync("/hosted_pages/pre_cancel", params != null ? params.toFormData() : null) + return postAsync( + "hostedPage", + "preCancel", + "/hosted_pages/pre_cancel", + params != null ? params.toFormData() : null) .thenApply( response -> HostedPagePreCancelResponse.fromJson(response.getBodyAsString(), response)); } @@ -643,7 +749,7 @@ Response acknowledgeRaw(String hostedPageId) throws ChargebeeException { buildPathWithParams( "/hosted_pages/{hosted-page-id}/acknowledge", "hosted-page-id", hostedPageId); - return post(path, null); + return post("hostedPage", "acknowledge", path, null); } public HostedPageAcknowledgeResponse acknowledge(String hostedPageId) throws ChargebeeException { @@ -657,7 +763,7 @@ public CompletableFuture acknowledgeAsync(String buildPathWithParams( "/hosted_pages/{hosted-page-id}/acknowledge", "hosted-page-id", hostedPageId); - return postAsync(path, null) + return postAsync("hostedPage", "acknowledge", path, null) .thenApply( response -> HostedPageAcknowledgeResponse.fromJson(response.getBodyAsString(), response)); @@ -671,7 +777,10 @@ Response retrieveAgreementPdfRaw(HostedPageRetrieveAgreementPdfParams params) throws ChargebeeException { return post( - "/hosted_pages/retrieve_agreement_pdf", params != null ? params.toFormData() : null); + "hostedPage", + "retrieveAgreementPdf", + "/hosted_pages/retrieve_agreement_pdf", + params != null ? params.toFormData() : null); } /** @@ -680,7 +789,8 @@ Response retrieveAgreementPdfRaw(HostedPageRetrieveAgreementPdfParams params) */ Response retrieveAgreementPdfRaw(String jsonPayload) throws ChargebeeException { - return postJson("/hosted_pages/retrieve_agreement_pdf", jsonPayload); + return postJson( + "hostedPage", "retrieveAgreementPdf", "/hosted_pages/retrieve_agreement_pdf", jsonPayload); } public HostedPageRetrieveAgreementPdfResponse retrieveAgreementPdf( @@ -695,7 +805,10 @@ public CompletableFuture retrieveAgreeme HostedPageRetrieveAgreementPdfParams params) { return postAsync( - "/hosted_pages/retrieve_agreement_pdf", params != null ? params.toFormData() : null) + "hostedPage", + "retrieveAgreementPdf", + "/hosted_pages/retrieve_agreement_pdf", + params != null ? params.toFormData() : null) .thenApply( response -> HostedPageRetrieveAgreementPdfResponse.fromJson( @@ -707,7 +820,7 @@ Response retrieveRaw(String hostedPageId) throws ChargebeeException { String path = buildPathWithParams("/hosted_pages/{hosted-page-id}", "hosted-page-id", hostedPageId); - return get(path, null); + return get("hostedPage", "retrieve", path, null); } public HostedPageRetrieveResponse retrieve(String hostedPageId) throws ChargebeeException { @@ -720,7 +833,7 @@ public CompletableFuture retrieveAsync(String hosted String path = buildPathWithParams("/hosted_pages/{hosted-page-id}", "hosted-page-id", hostedPageId); - return getAsync(path, null) + return getAsync("hostedPage", "retrieve", path, null) .thenApply( response -> HostedPageRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -733,7 +846,10 @@ Response managePaymentSourcesRaw(HostedPageManagePaymentSourcesParams params) throws ChargebeeException { return post( - "/hosted_pages/manage_payment_sources", params != null ? params.toFormData() : null); + "hostedPage", + "managePaymentSources", + "/hosted_pages/manage_payment_sources", + params != null ? params.toFormData() : null); } /** @@ -742,7 +858,8 @@ Response managePaymentSourcesRaw(HostedPageManagePaymentSourcesParams params) */ Response managePaymentSourcesRaw(String jsonPayload) throws ChargebeeException { - return postJson("/hosted_pages/manage_payment_sources", jsonPayload); + return postJson( + "hostedPage", "managePaymentSources", "/hosted_pages/manage_payment_sources", jsonPayload); } public HostedPageManagePaymentSourcesResponse managePaymentSources( @@ -757,7 +874,10 @@ public CompletableFuture managePaymentSo HostedPageManagePaymentSourcesParams params) { return postAsync( - "/hosted_pages/manage_payment_sources", params != null ? params.toFormData() : null) + "hostedPage", + "managePaymentSources", + "/hosted_pages/manage_payment_sources", + params != null ? params.toFormData() : null) .thenApply( response -> HostedPageManagePaymentSourcesResponse.fromJson( @@ -770,7 +890,11 @@ public CompletableFuture managePaymentSo */ Response checkoutOneTimeRaw(HostedPageCheckoutOneTimeParams params) throws ChargebeeException { - return post("/hosted_pages/checkout_one_time", params != null ? params.toFormData() : null); + return post( + "hostedPage", + "checkoutOneTime", + "/hosted_pages/checkout_one_time", + params != null ? params.toFormData() : null); } /** @@ -779,7 +903,8 @@ Response checkoutOneTimeRaw(HostedPageCheckoutOneTimeParams params) throws Charg */ Response checkoutOneTimeRaw(String jsonPayload) throws ChargebeeException { - return postJson("/hosted_pages/checkout_one_time", jsonPayload); + return postJson( + "hostedPage", "checkoutOneTime", "/hosted_pages/checkout_one_time", jsonPayload); } public HostedPageCheckoutOneTimeResponse checkoutOneTime(HostedPageCheckoutOneTimeParams params) @@ -793,7 +918,11 @@ public HostedPageCheckoutOneTimeResponse checkoutOneTime(HostedPageCheckoutOneTi public CompletableFuture checkoutOneTimeAsync( HostedPageCheckoutOneTimeParams params) { - return postAsync("/hosted_pages/checkout_one_time", params != null ? params.toFormData() : null) + return postAsync( + "hostedPage", + "checkoutOneTime", + "/hosted_pages/checkout_one_time", + params != null ? params.toFormData() : null) .thenApply( response -> HostedPageCheckoutOneTimeResponse.fromJson(response.getBodyAsString(), response)); @@ -804,7 +933,11 @@ public CompletableFuture checkoutOneTimeAsync */ Response checkoutNewRaw(HostedPageCheckoutNewParams params) throws ChargebeeException { - return post("/hosted_pages/checkout_new", params != null ? params.toFormData() : null); + return post( + "hostedPage", + "checkoutNew", + "/hosted_pages/checkout_new", + params != null ? params.toFormData() : null); } /** @@ -812,7 +945,7 @@ Response checkoutNewRaw(HostedPageCheckoutNewParams params) throws ChargebeeExce */ Response checkoutNewRaw(String jsonPayload) throws ChargebeeException { - return postJson("/hosted_pages/checkout_new", jsonPayload); + return postJson("hostedPage", "checkoutNew", "/hosted_pages/checkout_new", jsonPayload); } public HostedPageCheckoutNewResponse checkoutNew(HostedPageCheckoutNewParams params) @@ -826,7 +959,11 @@ public HostedPageCheckoutNewResponse checkoutNew(HostedPageCheckoutNewParams par public CompletableFuture checkoutNewAsync( HostedPageCheckoutNewParams params) { - return postAsync("/hosted_pages/checkout_new", params != null ? params.toFormData() : null) + return postAsync( + "hostedPage", + "checkoutNew", + "/hosted_pages/checkout_new", + params != null ? params.toFormData() : null) .thenApply( response -> HostedPageCheckoutNewResponse.fromJson(response.getBodyAsString(), response)); @@ -837,7 +974,11 @@ public CompletableFuture checkoutNewAsync( */ Response checkoutGiftRaw(HostedPageCheckoutGiftParams params) throws ChargebeeException { - return post("/hosted_pages/checkout_gift", params != null ? params.toFormData() : null); + return post( + "hostedPage", + "checkoutGift", + "/hosted_pages/checkout_gift", + params != null ? params.toFormData() : null); } /** @@ -845,7 +986,7 @@ Response checkoutGiftRaw(HostedPageCheckoutGiftParams params) throws ChargebeeEx */ Response checkoutGiftRaw(String jsonPayload) throws ChargebeeException { - return postJson("/hosted_pages/checkout_gift", jsonPayload); + return postJson("hostedPage", "checkoutGift", "/hosted_pages/checkout_gift", jsonPayload); } public HostedPageCheckoutGiftResponse checkoutGift(HostedPageCheckoutGiftParams params) @@ -859,7 +1000,11 @@ public HostedPageCheckoutGiftResponse checkoutGift(HostedPageCheckoutGiftParams public CompletableFuture checkoutGiftAsync( HostedPageCheckoutGiftParams params) { - return postAsync("/hosted_pages/checkout_gift", params != null ? params.toFormData() : null) + return postAsync( + "hostedPage", + "checkoutGift", + "/hosted_pages/checkout_gift", + params != null ? params.toFormData() : null) .thenApply( response -> HostedPageCheckoutGiftResponse.fromJson(response.getBodyAsString(), response)); @@ -871,7 +1016,11 @@ public CompletableFuture checkoutGiftAsync( */ Response checkoutExistingRaw(HostedPageCheckoutExistingParams params) throws ChargebeeException { - return post("/hosted_pages/checkout_existing", params != null ? params.toFormData() : null); + return post( + "hostedPage", + "checkoutExisting", + "/hosted_pages/checkout_existing", + params != null ? params.toFormData() : null); } /** @@ -880,7 +1029,8 @@ Response checkoutExistingRaw(HostedPageCheckoutExistingParams params) throws Cha */ Response checkoutExistingRaw(String jsonPayload) throws ChargebeeException { - return postJson("/hosted_pages/checkout_existing", jsonPayload); + return postJson( + "hostedPage", "checkoutExisting", "/hosted_pages/checkout_existing", jsonPayload); } public HostedPageCheckoutExistingResponse checkoutExisting( @@ -894,7 +1044,11 @@ public HostedPageCheckoutExistingResponse checkoutExisting( public CompletableFuture checkoutExistingAsync( HostedPageCheckoutExistingParams params) { - return postAsync("/hosted_pages/checkout_existing", params != null ? params.toFormData() : null) + return postAsync( + "hostedPage", + "checkoutExisting", + "/hosted_pages/checkout_existing", + params != null ? params.toFormData() : null) .thenApply( response -> 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 2c34f416b..258e737d0 100644 --- a/src/main/java/com/chargebee/v4/services/InAppSubscriptionService.java +++ b/src/main/java/com/chargebee/v4/services/InAppSubscriptionService.java @@ -74,7 +74,7 @@ Response retrieveStoreSubscriptionsRaw(String inAppSubscriptionAppId) throws Cha "in-app-subscription-app-id", inAppSubscriptionAppId); - return post(path, null); + return post("inAppSubscription", "retrieveStoreSubscriptions", path, null); } /** @@ -89,7 +89,7 @@ Response retrieveStoreSubscriptionsRaw( "/in_app_subscriptions/{in-app-subscription-app-id}/retrieve", "in-app-subscription-app-id", inAppSubscriptionAppId); - return post(path, params.toFormData()); + return post("inAppSubscription", "retrieveStoreSubscriptions", path, params.toFormData()); } /** @@ -103,7 +103,7 @@ Response retrieveStoreSubscriptionsRaw(String inAppSubscriptionAppId, String jso "/in_app_subscriptions/{in-app-subscription-app-id}/retrieve", "in-app-subscription-app-id", inAppSubscriptionAppId); - return postJson(path, jsonPayload); + return postJson("inAppSubscription", "retrieveStoreSubscriptions", path, jsonPayload); } public InAppSubscriptionRetrieveStoreSubscriptionsResponse retrieveStoreSubscriptions( @@ -123,7 +123,7 @@ public InAppSubscriptionRetrieveStoreSubscriptionsResponse retrieveStoreSubscrip "/in_app_subscriptions/{in-app-subscription-app-id}/retrieve", "in-app-subscription-app-id", inAppSubscriptionAppId); - return postAsync(path, params.toFormData()) + return postAsync("inAppSubscription", "retrieveStoreSubscriptions", path, params.toFormData()) .thenApply( response -> InAppSubscriptionRetrieveStoreSubscriptionsResponse.fromJson( @@ -138,7 +138,7 @@ Response importReceiptRaw(String inAppSubscriptionAppId) throws ChargebeeExcepti "in-app-subscription-app-id", inAppSubscriptionAppId); - return post(path, null); + return post("inAppSubscription", "importReceipt", path, null); } /** @@ -153,7 +153,7 @@ Response importReceiptRaw( "/in_app_subscriptions/{in-app-subscription-app-id}/import_receipt", "in-app-subscription-app-id", inAppSubscriptionAppId); - return post(path, params.toFormData()); + return post("inAppSubscription", "importReceipt", path, params.toFormData()); } /** @@ -167,7 +167,7 @@ Response importReceiptRaw(String inAppSubscriptionAppId, String jsonPayload) "/in_app_subscriptions/{in-app-subscription-app-id}/import_receipt", "in-app-subscription-app-id", inAppSubscriptionAppId); - return postJson(path, jsonPayload); + return postJson("inAppSubscription", "importReceipt", path, jsonPayload); } public InAppSubscriptionImportReceiptResponse importReceipt( @@ -185,7 +185,7 @@ public CompletableFuture importReceiptAs "/in_app_subscriptions/{in-app-subscription-app-id}/import_receipt", "in-app-subscription-app-id", inAppSubscriptionAppId); - return postAsync(path, params.toFormData()) + return postAsync("inAppSubscription", "importReceipt", path, params.toFormData()) .thenApply( response -> InAppSubscriptionImportReceiptResponse.fromJson( @@ -200,7 +200,7 @@ Response importSubscriptionRaw(String inAppSubscriptionAppId) throws ChargebeeEx "in-app-subscription-app-id", inAppSubscriptionAppId); - return post(path, null); + return post("inAppSubscription", "importSubscription", path, null); } /** @@ -215,7 +215,7 @@ Response importSubscriptionRaw( "/in_app_subscriptions/{in-app-subscription-app-id}/import_subscription", "in-app-subscription-app-id", inAppSubscriptionAppId); - return post(path, params.toFormData()); + return post("inAppSubscription", "importSubscription", path, params.toFormData()); } /** @@ -229,7 +229,7 @@ Response importSubscriptionRaw(String inAppSubscriptionAppId, String jsonPayload "/in_app_subscriptions/{in-app-subscription-app-id}/import_subscription", "in-app-subscription-app-id", inAppSubscriptionAppId); - return postJson(path, jsonPayload); + return postJson("inAppSubscription", "importSubscription", path, jsonPayload); } public InAppSubscriptionImportSubscriptionResponse importSubscription( @@ -248,7 +248,7 @@ public CompletableFuture importSubs "/in_app_subscriptions/{in-app-subscription-app-id}/import_subscription", "in-app-subscription-app-id", inAppSubscriptionAppId); - return postAsync(path, params.toFormData()) + return postAsync("inAppSubscription", "importSubscription", path, params.toFormData()) .thenApply( response -> InAppSubscriptionImportSubscriptionResponse.fromJson( @@ -271,7 +271,7 @@ public CompletableFuture importSubs "in-app-subscription-app-id", inAppSubscriptionAppId); - return postAsync(path, null) + return postAsync("inAppSubscription", "importSubscription", path, null) .thenApply( response -> InAppSubscriptionImportSubscriptionResponse.fromJson( @@ -286,7 +286,7 @@ Response processReceiptRaw(String inAppSubscriptionAppId) throws ChargebeeExcept "in-app-subscription-app-id", inAppSubscriptionAppId); - return post(path, null); + return post("inAppSubscription", "processReceipt", path, null); } /** @@ -301,7 +301,7 @@ Response processReceiptRaw( "/in_app_subscriptions/{in-app-subscription-app-id}/process_purchase_command", "in-app-subscription-app-id", inAppSubscriptionAppId); - return post(path, params.toFormData()); + return post("inAppSubscription", "processReceipt", path, params.toFormData()); } /** @@ -315,7 +315,7 @@ Response processReceiptRaw(String inAppSubscriptionAppId, String jsonPayload) "/in_app_subscriptions/{in-app-subscription-app-id}/process_purchase_command", "in-app-subscription-app-id", inAppSubscriptionAppId); - return postJson(path, jsonPayload); + return postJson("inAppSubscription", "processReceipt", path, jsonPayload); } public InAppSubscriptionProcessReceiptResponse processReceipt( @@ -333,7 +333,7 @@ public CompletableFuture processReceipt "/in_app_subscriptions/{in-app-subscription-app-id}/process_purchase_command", "in-app-subscription-app-id", inAppSubscriptionAppId); - return postAsync(path, params.toFormData()) + return postAsync("inAppSubscription", "processReceipt", path, params.toFormData()) .thenApply( response -> InAppSubscriptionProcessReceiptResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/InvoiceService.java b/src/main/java/com/chargebee/v4/services/InvoiceService.java index 7f09dc8d0..4e22ceb9f 100644 --- a/src/main/java/com/chargebee/v4/services/InvoiceService.java +++ b/src/main/java/com/chargebee/v4/services/InvoiceService.java @@ -206,7 +206,7 @@ Response deleteLineItemsRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/delete_line_items", "invoice-id", invoiceId); - return post(path, null); + return post("invoice", "deleteLineItems", path, null); } /** @@ -216,7 +216,7 @@ Response deleteLineItemsRaw(String invoiceId, InvoiceDeleteLineItemsParams param throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/delete_line_items", "invoice-id", invoiceId); - return post(path, params.toFormData()); + return post("invoice", "deleteLineItems", path, params.toFormData()); } /** @@ -225,7 +225,7 @@ Response deleteLineItemsRaw(String invoiceId, InvoiceDeleteLineItemsParams param Response deleteLineItemsRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/delete_line_items", "invoice-id", invoiceId); - return postJson(path, jsonPayload); + return postJson("invoice", "deleteLineItems", path, jsonPayload); } public InvoiceDeleteLineItemsResponse deleteLineItems( @@ -239,7 +239,7 @@ public CompletableFuture deleteLineItemsAsync( String invoiceId, InvoiceDeleteLineItemsParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/delete_line_items", "invoice-id", invoiceId); - return postAsync(path, params.toFormData()) + return postAsync("invoice", "deleteLineItems", path, params.toFormData()) .thenApply( response -> InvoiceDeleteLineItemsResponse.fromJson(response.getBodyAsString(), response)); @@ -256,7 +256,7 @@ public CompletableFuture deleteLineItemsAsync(St String path = buildPathWithParams("/invoices/{invoice-id}/delete_line_items", "invoice-id", invoiceId); - return postAsync(path, null) + return postAsync("invoice", "deleteLineItems", path, null) .thenApply( response -> InvoiceDeleteLineItemsResponse.fromJson(response.getBodyAsString(), response)); @@ -267,7 +267,7 @@ Response removeCreditNoteRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/remove_credit_note", "invoice-id", invoiceId); - return post(path, null); + return post("invoice", "removeCreditNote", path, null); } /** @@ -278,7 +278,7 @@ Response removeCreditNoteRaw(String invoiceId, InvoiceRemoveCreditNoteParams par throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/remove_credit_note", "invoice-id", invoiceId); - return post(path, params.toFormData()); + return post("invoice", "removeCreditNote", path, params.toFormData()); } /** @@ -288,7 +288,7 @@ Response removeCreditNoteRaw(String invoiceId, InvoiceRemoveCreditNoteParams par Response removeCreditNoteRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/remove_credit_note", "invoice-id", invoiceId); - return postJson(path, jsonPayload); + return postJson("invoice", "removeCreditNote", path, jsonPayload); } public InvoiceRemoveCreditNoteResponse removeCreditNote( @@ -302,7 +302,7 @@ public CompletableFuture removeCreditNoteAsync( String invoiceId, InvoiceRemoveCreditNoteParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/remove_credit_note", "invoice-id", invoiceId); - return postAsync(path, params.toFormData()) + return postAsync("invoice", "removeCreditNote", path, params.toFormData()) .thenApply( response -> InvoiceRemoveCreditNoteResponse.fromJson(response.getBodyAsString(), response)); @@ -320,7 +320,7 @@ public CompletableFuture removeCreditNoteAsync( String path = buildPathWithParams("/invoices/{invoice-id}/remove_credit_note", "invoice-id", invoiceId); - return postAsync(path, null) + return postAsync("invoice", "removeCreditNote", path, null) .thenApply( response -> InvoiceRemoveCreditNoteResponse.fromJson(response.getBodyAsString(), response)); @@ -331,7 +331,7 @@ Response removePaymentRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/remove_payment", "invoice-id", invoiceId); - return post(path, null); + return post("invoice", "removePayment", path, null); } /** @@ -341,7 +341,7 @@ Response removePaymentRaw(String invoiceId, InvoiceRemovePaymentParams params) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/remove_payment", "invoice-id", invoiceId); - return post(path, params.toFormData()); + return post("invoice", "removePayment", path, params.toFormData()); } /** @@ -350,7 +350,7 @@ Response removePaymentRaw(String invoiceId, InvoiceRemovePaymentParams params) Response removePaymentRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/remove_payment", "invoice-id", invoiceId); - return postJson(path, jsonPayload); + return postJson("invoice", "removePayment", path, jsonPayload); } public InvoiceRemovePaymentResponse removePayment( @@ -364,7 +364,7 @@ public CompletableFuture removePaymentAsync( String invoiceId, InvoiceRemovePaymentParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/remove_payment", "invoice-id", invoiceId); - return postAsync(path, params.toFormData()) + return postAsync("invoice", "removePayment", path, params.toFormData()) .thenApply( response -> InvoiceRemovePaymentResponse.fromJson(response.getBodyAsString(), response)); @@ -380,7 +380,7 @@ public CompletableFuture removePaymentAsync(String String path = buildPathWithParams("/invoices/{invoice-id}/remove_payment", "invoice-id", invoiceId); - return postAsync(path, null) + return postAsync("invoice", "removePayment", path, null) .thenApply( response -> InvoiceRemovePaymentResponse.fromJson(response.getBodyAsString(), response)); @@ -391,7 +391,7 @@ Response stopDunningRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/stop_dunning", "invoice-id", invoiceId); - return post(path, null); + return post("invoice", "stopDunning", path, null); } /** stopDunning a invoice using immutable params (executes immediately) - returns raw Response. */ @@ -399,14 +399,14 @@ Response stopDunningRaw(String invoiceId, InvoiceStopDunningParams params) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/stop_dunning", "invoice-id", invoiceId); - return post(path, params.toFormData()); + return post("invoice", "stopDunning", path, params.toFormData()); } /** 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); + return postJson("invoice", "stopDunning", path, jsonPayload); } public InvoiceStopDunningResponse stopDunning(String invoiceId, InvoiceStopDunningParams params) @@ -420,7 +420,7 @@ public CompletableFuture stopDunningAsync( String invoiceId, InvoiceStopDunningParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/stop_dunning", "invoice-id", invoiceId); - return postAsync(path, params.toFormData()) + return postAsync("invoice", "stopDunning", path, params.toFormData()) .thenApply( response -> InvoiceStopDunningResponse.fromJson(response.getBodyAsString(), response)); } @@ -435,7 +435,7 @@ public CompletableFuture stopDunningAsync(String inv String path = buildPathWithParams("/invoices/{invoice-id}/stop_dunning", "invoice-id", invoiceId); - return postAsync(path, null) + return postAsync("invoice", "stopDunning", path, null) .thenApply( response -> InvoiceStopDunningResponse.fromJson(response.getBodyAsString(), response)); } @@ -445,7 +445,7 @@ Response applyPaymentsRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/apply_payments", "invoice-id", invoiceId); - return post(path, null); + return post("invoice", "applyPayments", path, null); } /** @@ -455,7 +455,7 @@ Response applyPaymentsRaw(String invoiceId, InvoiceApplyPaymentsParams params) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/apply_payments", "invoice-id", invoiceId); - return post(path, params.toFormData()); + return post("invoice", "applyPayments", path, params.toFormData()); } /** @@ -464,7 +464,7 @@ Response applyPaymentsRaw(String invoiceId, InvoiceApplyPaymentsParams params) Response applyPaymentsRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/apply_payments", "invoice-id", invoiceId); - return postJson(path, jsonPayload); + return postJson("invoice", "applyPayments", path, jsonPayload); } public InvoiceApplyPaymentsResponse applyPayments( @@ -478,7 +478,7 @@ public CompletableFuture applyPaymentsAsync( String invoiceId, InvoiceApplyPaymentsParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/apply_payments", "invoice-id", invoiceId); - return postAsync(path, params.toFormData()) + return postAsync("invoice", "applyPayments", path, params.toFormData()) .thenApply( response -> InvoiceApplyPaymentsResponse.fromJson(response.getBodyAsString(), response)); @@ -494,7 +494,7 @@ public CompletableFuture applyPaymentsAsync(String String path = buildPathWithParams("/invoices/{invoice-id}/apply_payments", "invoice-id", invoiceId); - return postAsync(path, null) + return postAsync("invoice", "applyPayments", path, null) .thenApply( response -> InvoiceApplyPaymentsResponse.fromJson(response.getBodyAsString(), response)); @@ -506,7 +506,7 @@ Response applyPaymentScheduleSchemeRaw(String invoiceId) throws ChargebeeExcepti buildPathWithParams( "/invoices/{invoice-id}/apply_payment_schedule_scheme", "invoice-id", invoiceId); - return post(path, null); + return post("invoice", "applyPaymentScheduleScheme", path, null); } /** @@ -518,7 +518,7 @@ Response applyPaymentScheduleSchemeRaw( String path = buildPathWithParams( "/invoices/{invoice-id}/apply_payment_schedule_scheme", "invoice-id", invoiceId); - return post(path, params.toFormData()); + return post("invoice", "applyPaymentScheduleScheme", path, params.toFormData()); } /** @@ -530,7 +530,7 @@ Response applyPaymentScheduleSchemeRaw(String invoiceId, String jsonPayload) String path = buildPathWithParams( "/invoices/{invoice-id}/apply_payment_schedule_scheme", "invoice-id", invoiceId); - return postJson(path, jsonPayload); + return postJson("invoice", "applyPaymentScheduleScheme", path, jsonPayload); } public InvoiceApplyPaymentScheduleSchemeResponse applyPaymentScheduleScheme( @@ -546,7 +546,7 @@ public InvoiceApplyPaymentScheduleSchemeResponse applyPaymentScheduleScheme( String path = buildPathWithParams( "/invoices/{invoice-id}/apply_payment_schedule_scheme", "invoice-id", invoiceId); - return postAsync(path, params.toFormData()) + return postAsync("invoice", "applyPaymentScheduleScheme", path, params.toFormData()) .thenApply( response -> InvoiceApplyPaymentScheduleSchemeResponse.fromJson( @@ -557,19 +557,19 @@ public InvoiceApplyPaymentScheduleSchemeResponse applyPaymentScheduleScheme( Response voidInvoiceRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/void", "invoice-id", invoiceId); - return post(path, null); + return post("invoice", "voidInvoice", path, null); } /** voidInvoice a invoice using immutable params (executes immediately) - returns raw Response. */ Response voidInvoiceRaw(String invoiceId, VoidInvoiceParams params) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/void", "invoice-id", invoiceId); - return post(path, params.toFormData()); + return post("invoice", "voidInvoice", path, params.toFormData()); } /** voidInvoice a invoice using raw JSON payload (executes immediately) - returns raw Response. */ Response voidInvoiceRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/void", "invoice-id", invoiceId); - return postJson(path, jsonPayload); + return postJson("invoice", "voidInvoice", path, jsonPayload); } public VoidInvoiceResponse voidInvoice(String invoiceId, VoidInvoiceParams params) @@ -582,7 +582,7 @@ public VoidInvoiceResponse voidInvoice(String invoiceId, VoidInvoiceParams param public CompletableFuture voidInvoiceAsync( String invoiceId, VoidInvoiceParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/void", "invoice-id", invoiceId); - return postAsync(path, params.toFormData()) + return postAsync("invoice", "voidInvoice", path, params.toFormData()) .thenApply(response -> VoidInvoiceResponse.fromJson(response.getBodyAsString(), response)); } @@ -595,7 +595,7 @@ public VoidInvoiceResponse voidInvoice(String invoiceId) throws ChargebeeExcepti public CompletableFuture voidInvoiceAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/void", "invoice-id", invoiceId); - return postAsync(path, null) + return postAsync("invoice", "voidInvoice", path, null) .thenApply(response -> VoidInvoiceResponse.fromJson(response.getBodyAsString(), response)); } @@ -603,19 +603,19 @@ public CompletableFuture voidInvoiceAsync(String invoiceId) Response addChargeRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/add_charge", "invoice-id", invoiceId); - return post(path, null); + return post("invoice", "addCharge", path, null); } /** 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()); + return post("invoice", "addCharge", path, params.toFormData()); } /** 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); + return postJson("invoice", "addCharge", path, jsonPayload); } public InvoiceAddChargeResponse addCharge(String invoiceId, InvoiceAddChargeParams params) @@ -628,7 +628,7 @@ public InvoiceAddChargeResponse addCharge(String invoiceId, InvoiceAddChargePara public CompletableFuture addChargeAsync( String invoiceId, InvoiceAddChargeParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/add_charge", "invoice-id", invoiceId); - return postAsync(path, params.toFormData()) + return postAsync("invoice", "addCharge", path, params.toFormData()) .thenApply( response -> InvoiceAddChargeResponse.fromJson(response.getBodyAsString(), response)); } @@ -638,7 +638,7 @@ Response sendEinvoiceRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/send_einvoice", "invoice-id", invoiceId); - return post(path, null); + return post("invoice", "sendEinvoice", path, null); } public SendEinvoiceResponse sendEinvoice(String invoiceId) throws ChargebeeException { @@ -651,7 +651,7 @@ public CompletableFuture sendEinvoiceAsync(String invoiceI String path = buildPathWithParams("/invoices/{invoice-id}/send_einvoice", "invoice-id", invoiceId); - return postAsync(path, null) + return postAsync("invoice", "sendEinvoice", path, null) .thenApply(response -> SendEinvoiceResponse.fromJson(response.getBodyAsString(), response)); } @@ -660,7 +660,7 @@ Response paymentSchedulesRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/payment_schedules", "invoice-id", invoiceId); - return get(path, null); + return get("invoice", "paymentSchedules", path, null); } public InvoicePaymentSchedulesResponse paymentSchedules(String invoiceId) @@ -675,7 +675,7 @@ public CompletableFuture paymentSchedulesAsync( String path = buildPathWithParams("/invoices/{invoice-id}/payment_schedules", "invoice-id", invoiceId); - return getAsync(path, null) + return getAsync("invoice", "paymentSchedules", path, null) .thenApply( response -> InvoicePaymentSchedulesResponse.fromJson(response.getBodyAsString(), response)); @@ -685,19 +685,19 @@ public CompletableFuture paymentSchedulesAsync( Response writeOffRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/write_off", "invoice-id", invoiceId); - return post(path, null); + return post("invoice", "writeOff", path, null); } /** 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()); + return post("invoice", "writeOff", path, params.toFormData()); } /** 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); + return postJson("invoice", "writeOff", path, jsonPayload); } public InvoiceWriteOffResponse writeOff(String invoiceId, InvoiceWriteOffParams params) @@ -710,7 +710,7 @@ public InvoiceWriteOffResponse writeOff(String invoiceId, InvoiceWriteOffParams public CompletableFuture writeOffAsync( String invoiceId, InvoiceWriteOffParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/write_off", "invoice-id", invoiceId); - return postAsync(path, params.toFormData()) + return postAsync("invoice", "writeOff", path, params.toFormData()) .thenApply( response -> InvoiceWriteOffResponse.fromJson(response.getBodyAsString(), response)); } @@ -724,7 +724,7 @@ public InvoiceWriteOffResponse writeOff(String invoiceId) throws ChargebeeExcept public CompletableFuture writeOffAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/write_off", "invoice-id", invoiceId); - return postAsync(path, null) + return postAsync("invoice", "writeOff", path, null) .thenApply( response -> InvoiceWriteOffResponse.fromJson(response.getBodyAsString(), response)); } @@ -734,7 +734,7 @@ Response addChargeItemRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/add_charge_item", "invoice-id", invoiceId); - return post(path, null); + return post("invoice", "addChargeItem", path, null); } /** @@ -744,7 +744,7 @@ 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()); + return post("invoice", "addChargeItem", path, params.toFormData()); } /** @@ -753,7 +753,7 @@ Response addChargeItemRaw(String invoiceId, InvoiceAddChargeItemParams params) Response addChargeItemRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/add_charge_item", "invoice-id", invoiceId); - return postJson(path, jsonPayload); + return postJson("invoice", "addChargeItem", path, jsonPayload); } public InvoiceAddChargeItemResponse addChargeItem( @@ -767,7 +767,7 @@ public CompletableFuture addChargeItemAsync( String invoiceId, InvoiceAddChargeItemParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/add_charge_item", "invoice-id", invoiceId); - return postAsync(path, params.toFormData()) + return postAsync("invoice", "addChargeItem", path, params.toFormData()) .thenApply( response -> InvoiceAddChargeItemResponse.fromJson(response.getBodyAsString(), response)); @@ -783,7 +783,7 @@ public CompletableFuture addChargeItemAsync(String String path = buildPathWithParams("/invoices/{invoice-id}/add_charge_item", "invoice-id", invoiceId); - return postAsync(path, null) + return postAsync("invoice", "addChargeItem", path, null) .thenApply( response -> InvoiceAddChargeItemResponse.fromJson(response.getBodyAsString(), response)); @@ -794,7 +794,7 @@ Response pauseDunningRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/pause_dunning", "invoice-id", invoiceId); - return post(path, null); + return post("invoice", "pauseDunning", path, null); } /** @@ -804,7 +804,7 @@ Response pauseDunningRaw(String invoiceId, InvoicePauseDunningParams params) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/pause_dunning", "invoice-id", invoiceId); - return post(path, params.toFormData()); + return post("invoice", "pauseDunning", path, params.toFormData()); } /** @@ -813,7 +813,7 @@ Response pauseDunningRaw(String invoiceId, InvoicePauseDunningParams params) Response pauseDunningRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/pause_dunning", "invoice-id", invoiceId); - return postJson(path, jsonPayload); + return postJson("invoice", "pauseDunning", path, jsonPayload); } public InvoicePauseDunningResponse pauseDunning( @@ -827,7 +827,7 @@ public CompletableFuture pauseDunningAsync( String invoiceId, InvoicePauseDunningParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/pause_dunning", "invoice-id", invoiceId); - return postAsync(path, params.toFormData()) + return postAsync("invoice", "pauseDunning", path, params.toFormData()) .thenApply( response -> InvoicePauseDunningResponse.fromJson(response.getBodyAsString(), response)); } @@ -835,13 +835,13 @@ public CompletableFuture pauseDunningAsync( /** list a invoice using immutable params (executes immediately) - returns raw Response. */ Response listRaw(InvoiceListParams params) throws ChargebeeException { - return get("/invoices", params != null ? params.toQueryParams() : null); + return get("invoice", "list", "/invoices", params != null ? params.toQueryParams() : null); } /** list a invoice without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/invoices", null); + return get("invoice", "list", "/invoices", null); } /** list a invoice using raw JSON payload (executes immediately) - returns raw Response. */ @@ -859,7 +859,7 @@ public InvoiceListResponse list(InvoiceListParams params) throws ChargebeeExcept /** Async variant of list for invoice with params. */ public CompletableFuture listAsync(InvoiceListParams params) { - return getAsync("/invoices", params != null ? params.toQueryParams() : null) + return getAsync("invoice", "list", "/invoices", params != null ? params.toQueryParams() : null) .thenApply( response -> InvoiceListResponse.fromJson(response.getBodyAsString(), this, params, response)); @@ -874,7 +874,7 @@ public InvoiceListResponse list() throws ChargebeeException { /** Async variant of list for invoice without params. */ public CompletableFuture listAsync() { - return getAsync("/invoices", null) + return getAsync("invoice", "list", "/invoices", null) .thenApply( response -> InvoiceListResponse.fromJson(response.getBodyAsString(), this, null, response)); @@ -883,13 +883,13 @@ public CompletableFuture listAsync() { /** create a invoice using immutable params (executes immediately) - returns raw Response. */ Response createRaw(InvoiceCreateParams params) throws ChargebeeException { - return post("/invoices", params != null ? params.toFormData() : null); + return post("invoice", "create", "/invoices", params != null ? params.toFormData() : null); } /** create a invoice using raw JSON payload (executes immediately) - returns raw Response. */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/invoices", jsonPayload); + return postJson("invoice", "create", "/invoices", jsonPayload); } public InvoiceCreateResponse create(InvoiceCreateParams params) throws ChargebeeException { @@ -901,7 +901,7 @@ public InvoiceCreateResponse create(InvoiceCreateParams params) throws Chargebee /** Async variant of create for invoice with params. */ public CompletableFuture createAsync(InvoiceCreateParams params) { - return postAsync("/invoices", params != null ? params.toFormData() : null) + return postAsync("invoice", "create", "/invoices", params != null ? params.toFormData() : null) .thenApply( response -> InvoiceCreateResponse.fromJson(response.getBodyAsString(), response)); } @@ -910,19 +910,19 @@ public CompletableFuture createAsync(InvoiceCreateParams Response closeRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/close", "invoice-id", invoiceId); - return post(path, null); + return post("invoice", "close", path, null); } /** 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()); + return post("invoice", "close", path, params.toFormData()); } /** 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); + return postJson("invoice", "close", path, jsonPayload); } public InvoiceCloseResponse close(String invoiceId, InvoiceCloseParams params) @@ -935,7 +935,7 @@ public InvoiceCloseResponse close(String invoiceId, InvoiceCloseParams params) public CompletableFuture closeAsync( String invoiceId, InvoiceCloseParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/close", "invoice-id", invoiceId); - return postAsync(path, params.toFormData()) + return postAsync("invoice", "close", path, params.toFormData()) .thenApply(response -> InvoiceCloseResponse.fromJson(response.getBodyAsString(), response)); } @@ -948,7 +948,7 @@ public InvoiceCloseResponse close(String invoiceId) throws ChargebeeException { public CompletableFuture closeAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/close", "invoice-id", invoiceId); - return postAsync(path, null) + return postAsync("invoice", "close", path, null) .thenApply(response -> InvoiceCloseResponse.fromJson(response.getBodyAsString(), response)); } @@ -957,7 +957,7 @@ Response applyCreditsRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/apply_credits", "invoice-id", invoiceId); - return post(path, null); + return post("invoice", "applyCredits", path, null); } /** @@ -967,7 +967,7 @@ Response applyCreditsRaw(String invoiceId, InvoiceApplyCreditsParams params) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/apply_credits", "invoice-id", invoiceId); - return post(path, params.toFormData()); + return post("invoice", "applyCredits", path, params.toFormData()); } /** @@ -976,7 +976,7 @@ Response applyCreditsRaw(String invoiceId, InvoiceApplyCreditsParams params) Response applyCreditsRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/apply_credits", "invoice-id", invoiceId); - return postJson(path, jsonPayload); + return postJson("invoice", "applyCredits", path, jsonPayload); } public InvoiceApplyCreditsResponse applyCredits( @@ -990,7 +990,7 @@ public CompletableFuture applyCreditsAsync( String invoiceId, InvoiceApplyCreditsParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/apply_credits", "invoice-id", invoiceId); - return postAsync(path, params.toFormData()) + return postAsync("invoice", "applyCredits", path, params.toFormData()) .thenApply( response -> InvoiceApplyCreditsResponse.fromJson(response.getBodyAsString(), response)); } @@ -1005,7 +1005,7 @@ public CompletableFuture applyCreditsAsync(String i String path = buildPathWithParams("/invoices/{invoice-id}/apply_credits", "invoice-id", invoiceId); - return postAsync(path, null) + return postAsync("invoice", "applyCredits", path, null) .thenApply( response -> InvoiceApplyCreditsResponse.fromJson(response.getBodyAsString(), response)); } @@ -1014,13 +1014,13 @@ public CompletableFuture applyCreditsAsync(String i Response retrieveRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}", "invoice-id", invoiceId); - return get(path, null); + return get("invoice", "retrieve", path, null); } /** 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); + return get("invoice", "retrieve", path, params != null ? params.toQueryParams() : null); } public InvoiceRetrieveResponse retrieve(String invoiceId, InvoiceRetrieveParams params) @@ -1033,7 +1033,7 @@ public InvoiceRetrieveResponse retrieve(String invoiceId, InvoiceRetrieveParams public CompletableFuture retrieveAsync( String invoiceId, InvoiceRetrieveParams params) { String path = buildPathWithParams("/invoices/{invoice-id}", "invoice-id", invoiceId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync("invoice", "retrieve", path, params != null ? params.toQueryParams() : null) .thenApply( response -> InvoiceRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -1047,7 +1047,7 @@ public InvoiceRetrieveResponse retrieve(String invoiceId) throws ChargebeeExcept public CompletableFuture retrieveAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}", "invoice-id", invoiceId); - return getAsync(path, null) + return getAsync("invoice", "retrieve", path, null) .thenApply( response -> InvoiceRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -1059,7 +1059,11 @@ public CompletableFuture retrieveAsync(String invoiceId Response createForChargeItemRaw(InvoiceCreateForChargeItemParams params) throws ChargebeeException { - return post("/invoices/create_for_charge_item", params != null ? params.toFormData() : null); + return post( + "invoice", + "createForChargeItem", + "/invoices/create_for_charge_item", + params != null ? params.toFormData() : null); } /** @@ -1068,7 +1072,8 @@ Response createForChargeItemRaw(InvoiceCreateForChargeItemParams params) */ Response createForChargeItemRaw(String jsonPayload) throws ChargebeeException { - return postJson("/invoices/create_for_charge_item", jsonPayload); + return postJson( + "invoice", "createForChargeItem", "/invoices/create_for_charge_item", jsonPayload); } public InvoiceCreateForChargeItemResponse createForChargeItem( @@ -1083,7 +1088,10 @@ public CompletableFuture createForChargeItem InvoiceCreateForChargeItemParams params) { return postAsync( - "/invoices/create_for_charge_item", params != null ? params.toFormData() : null) + "invoice", + "createForChargeItem", + "/invoices/create_for_charge_item", + params != null ? params.toFormData() : null) .thenApply( response -> InvoiceCreateForChargeItemResponse.fromJson(response.getBodyAsString(), response)); @@ -1097,6 +1105,8 @@ Response createForChargeItemsAndChargesRaw(InvoiceCreateForChargeItemsAndCharges throws ChargebeeException { return post( + "invoice", + "createForChargeItemsAndCharges", "/invoices/create_for_charge_items_and_charges", params != null ? params.toFormData() : null); } @@ -1107,7 +1117,11 @@ Response createForChargeItemsAndChargesRaw(InvoiceCreateForChargeItemsAndCharges */ Response createForChargeItemsAndChargesRaw(String jsonPayload) throws ChargebeeException { - return postJson("/invoices/create_for_charge_items_and_charges", jsonPayload); + return postJson( + "invoice", + "createForChargeItemsAndCharges", + "/invoices/create_for_charge_items_and_charges", + jsonPayload); } public InvoiceCreateForChargeItemsAndChargesResponse createForChargeItemsAndCharges( @@ -1123,6 +1137,8 @@ public InvoiceCreateForChargeItemsAndChargesResponse createForChargeItemsAndChar createForChargeItemsAndChargesAsync(InvoiceCreateForChargeItemsAndChargesParams params) { return postAsync( + "invoice", + "createForChargeItemsAndCharges", "/invoices/create_for_charge_items_and_charges", params != null ? params.toFormData() : null) .thenApply( @@ -1136,7 +1152,7 @@ Response deleteImportedRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/delete_imported", "invoice-id", invoiceId); - return post(path, null); + return post("invoice", "deleteImported", path, null); } /** @@ -1146,7 +1162,7 @@ Response deleteImportedRaw(String invoiceId, InvoiceDeleteImportedParams params) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/delete_imported", "invoice-id", invoiceId); - return post(path, params.toFormData()); + return post("invoice", "deleteImported", path, params.toFormData()); } /** @@ -1155,7 +1171,7 @@ Response deleteImportedRaw(String invoiceId, InvoiceDeleteImportedParams params) Response deleteImportedRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/delete_imported", "invoice-id", invoiceId); - return postJson(path, jsonPayload); + return postJson("invoice", "deleteImported", path, jsonPayload); } public InvoiceDeleteImportedResponse deleteImported( @@ -1169,7 +1185,7 @@ public CompletableFuture deleteImportedAsync( String invoiceId, InvoiceDeleteImportedParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/delete_imported", "invoice-id", invoiceId); - return postAsync(path, params.toFormData()) + return postAsync("invoice", "deleteImported", path, params.toFormData()) .thenApply( response -> InvoiceDeleteImportedResponse.fromJson(response.getBodyAsString(), response)); @@ -1185,7 +1201,7 @@ public CompletableFuture deleteImportedAsync(Stri String path = buildPathWithParams("/invoices/{invoice-id}/delete_imported", "invoice-id", invoiceId); - return postAsync(path, null) + return postAsync("invoice", "deleteImported", path, null) .thenApply( response -> InvoiceDeleteImportedResponse.fromJson(response.getBodyAsString(), response)); @@ -1196,7 +1212,7 @@ Response updateDetailsRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/update_details", "invoice-id", invoiceId); - return post(path, null); + return post("invoice", "updateDetails", path, null); } /** @@ -1206,7 +1222,7 @@ Response updateDetailsRaw(String invoiceId, InvoiceUpdateDetailsParams params) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/update_details", "invoice-id", invoiceId); - return post(path, params.toFormData()); + return post("invoice", "updateDetails", path, params.toFormData()); } /** @@ -1215,7 +1231,7 @@ Response updateDetailsRaw(String invoiceId, InvoiceUpdateDetailsParams params) Response updateDetailsRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/update_details", "invoice-id", invoiceId); - return postJson(path, jsonPayload); + return postJson("invoice", "updateDetails", path, jsonPayload); } public InvoiceUpdateDetailsResponse updateDetails( @@ -1229,7 +1245,7 @@ public CompletableFuture updateDetailsAsync( String invoiceId, InvoiceUpdateDetailsParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/update_details", "invoice-id", invoiceId); - return postAsync(path, params.toFormData()) + return postAsync("invoice", "updateDetails", path, params.toFormData()) .thenApply( response -> InvoiceUpdateDetailsResponse.fromJson(response.getBodyAsString(), response)); @@ -1245,7 +1261,7 @@ public CompletableFuture updateDetailsAsync(String String path = buildPathWithParams("/invoices/{invoice-id}/update_details", "invoice-id", invoiceId); - return postAsync(path, null) + return postAsync("invoice", "updateDetails", path, null) .thenApply( response -> InvoiceUpdateDetailsResponse.fromJson(response.getBodyAsString(), response)); @@ -1259,14 +1275,15 @@ Response invoicesForCustomerRaw(String customerId, InvoicesForCustomerParams par throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/invoices", "customer-id", customerId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "invoice", "invoicesForCustomer", path, params != null ? params.toQueryParams() : null); } /** invoicesForCustomer a invoice without params (executes immediately) - returns raw Response. */ Response invoicesForCustomerRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/invoices", "customer-id", customerId); - return get(path, null); + return get("invoice", "invoicesForCustomer", path, null); } /** @@ -1298,7 +1315,8 @@ public CompletableFuture invoicesForCustomerAsync( String customerId, InvoicesForCustomerParams params) { String path = buildPathWithParams("/customers/{customer-id}/invoices", "customer-id", customerId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "invoice", "invoicesForCustomer", path, params != null ? params.toQueryParams() : null) .thenApply( response -> InvoicesForCustomerResponse.fromJson( @@ -1310,7 +1328,7 @@ public CompletableFuture invoicesForCustomerAsync( String customerId) { String path = buildPathWithParams("/customers/{customer-id}/invoices", "customer-id", customerId); - return getAsync(path, null) + return getAsync("invoice", "invoicesForCustomer", path, null) .thenApply( response -> InvoicesForCustomerResponse.fromJson( @@ -1322,7 +1340,7 @@ Response recordPaymentRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/record_payment", "invoice-id", invoiceId); - return post(path, null); + return post("invoice", "recordPayment", path, null); } /** @@ -1332,7 +1350,7 @@ Response recordPaymentRaw(String invoiceId, InvoiceRecordPaymentParams params) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/record_payment", "invoice-id", invoiceId); - return post(path, params.toFormData()); + return post("invoice", "recordPayment", path, params.toFormData()); } /** @@ -1341,7 +1359,7 @@ Response recordPaymentRaw(String invoiceId, InvoiceRecordPaymentParams params) Response recordPaymentRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/record_payment", "invoice-id", invoiceId); - return postJson(path, jsonPayload); + return postJson("invoice", "recordPayment", path, jsonPayload); } public InvoiceRecordPaymentResponse recordPayment( @@ -1355,7 +1373,7 @@ public CompletableFuture recordPaymentAsync( String invoiceId, InvoiceRecordPaymentParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/record_payment", "invoice-id", invoiceId); - return postAsync(path, params.toFormData()) + return postAsync("invoice", "recordPayment", path, params.toFormData()) .thenApply( response -> InvoiceRecordPaymentResponse.fromJson(response.getBodyAsString(), response)); @@ -1371,7 +1389,7 @@ public CompletableFuture recordPaymentAsync(String String path = buildPathWithParams("/invoices/{invoice-id}/record_payment", "invoice-id", invoiceId); - return postAsync(path, null) + return postAsync("invoice", "recordPayment", path, null) .thenApply( response -> InvoiceRecordPaymentResponse.fromJson(response.getBodyAsString(), response)); @@ -1381,19 +1399,19 @@ public CompletableFuture recordPaymentAsync(String Response deleteRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/delete", "invoice-id", invoiceId); - return post(path, null); + return post("invoice", "delete", path, null); } /** 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()); + return post("invoice", "delete", path, params.toFormData()); } /** 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); + return postJson("invoice", "delete", path, jsonPayload); } public InvoiceDeleteResponse delete(String invoiceId, InvoiceDeleteParams params) @@ -1406,7 +1424,7 @@ public InvoiceDeleteResponse delete(String invoiceId, InvoiceDeleteParams params public CompletableFuture deleteAsync( String invoiceId, InvoiceDeleteParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/delete", "invoice-id", invoiceId); - return postAsync(path, params.toFormData()) + return postAsync("invoice", "delete", path, params.toFormData()) .thenApply( response -> InvoiceDeleteResponse.fromJson(response.getBodyAsString(), response)); } @@ -1420,7 +1438,7 @@ public InvoiceDeleteResponse delete(String invoiceId) throws ChargebeeException public CompletableFuture deleteAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/delete", "invoice-id", invoiceId); - return postAsync(path, null) + return postAsync("invoice", "delete", path, null) .thenApply( response -> InvoiceDeleteResponse.fromJson(response.getBodyAsString(), response)); } @@ -1430,7 +1448,11 @@ public CompletableFuture deleteAsync(String invoiceId) { */ Response importInvoiceRaw(ImportInvoiceParams params) throws ChargebeeException { - return post("/invoices/import_invoice", params != null ? params.toFormData() : null); + return post( + "invoice", + "importInvoice", + "/invoices/import_invoice", + params != null ? params.toFormData() : null); } /** @@ -1438,7 +1460,7 @@ Response importInvoiceRaw(ImportInvoiceParams params) throws ChargebeeException */ Response importInvoiceRaw(String jsonPayload) throws ChargebeeException { - return postJson("/invoices/import_invoice", jsonPayload); + return postJson("invoice", "importInvoice", "/invoices/import_invoice", jsonPayload); } public ImportInvoiceResponse importInvoice(ImportInvoiceParams params) throws ChargebeeException { @@ -1450,7 +1472,11 @@ public ImportInvoiceResponse importInvoice(ImportInvoiceParams params) throws Ch /** Async variant of importInvoice for invoice with params. */ public CompletableFuture importInvoiceAsync(ImportInvoiceParams params) { - return postAsync("/invoices/import_invoice", params != null ? params.toFormData() : null) + return postAsync( + "invoice", + "importInvoice", + "/invoices/import_invoice", + params != null ? params.toFormData() : null) .thenApply( response -> ImportInvoiceResponse.fromJson(response.getBodyAsString(), response)); } @@ -1460,7 +1486,7 @@ Response resumeDunningRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/resume_dunning", "invoice-id", invoiceId); - return post(path, null); + return post("invoice", "resumeDunning", path, null); } /** @@ -1470,7 +1496,7 @@ Response resumeDunningRaw(String invoiceId, InvoiceResumeDunningParams params) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/resume_dunning", "invoice-id", invoiceId); - return post(path, params.toFormData()); + return post("invoice", "resumeDunning", path, params.toFormData()); } /** @@ -1479,7 +1505,7 @@ Response resumeDunningRaw(String invoiceId, InvoiceResumeDunningParams params) Response resumeDunningRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/resume_dunning", "invoice-id", invoiceId); - return postJson(path, jsonPayload); + return postJson("invoice", "resumeDunning", path, jsonPayload); } public InvoiceResumeDunningResponse resumeDunning( @@ -1493,7 +1519,7 @@ public CompletableFuture resumeDunningAsync( String invoiceId, InvoiceResumeDunningParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/resume_dunning", "invoice-id", invoiceId); - return postAsync(path, params.toFormData()) + return postAsync("invoice", "resumeDunning", path, params.toFormData()) .thenApply( response -> InvoiceResumeDunningResponse.fromJson(response.getBodyAsString(), response)); @@ -1509,7 +1535,7 @@ public CompletableFuture resumeDunningAsync(String String path = buildPathWithParams("/invoices/{invoice-id}/resume_dunning", "invoice-id", invoiceId); - return postAsync(path, null) + return postAsync("invoice", "resumeDunning", path, null) .thenApply( response -> InvoiceResumeDunningResponse.fromJson(response.getBodyAsString(), response)); @@ -1520,7 +1546,7 @@ Response recordTaxWithheldRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/record_tax_withheld", "invoice-id", invoiceId); - return post(path, null); + return post("invoice", "recordTaxWithheld", path, null); } /** @@ -1531,7 +1557,7 @@ Response recordTaxWithheldRaw(String invoiceId, InvoiceRecordTaxWithheldParams p throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/record_tax_withheld", "invoice-id", invoiceId); - return post(path, params.toFormData()); + return post("invoice", "recordTaxWithheld", path, params.toFormData()); } /** @@ -1541,7 +1567,7 @@ Response recordTaxWithheldRaw(String invoiceId, InvoiceRecordTaxWithheldParams p Response recordTaxWithheldRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/record_tax_withheld", "invoice-id", invoiceId); - return postJson(path, jsonPayload); + return postJson("invoice", "recordTaxWithheld", path, jsonPayload); } public InvoiceRecordTaxWithheldResponse recordTaxWithheld( @@ -1555,7 +1581,7 @@ public CompletableFuture recordTaxWithheldAsyn String invoiceId, InvoiceRecordTaxWithheldParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/record_tax_withheld", "invoice-id", invoiceId); - return postAsync(path, params.toFormData()) + return postAsync("invoice", "recordTaxWithheld", path, params.toFormData()) .thenApply( response -> InvoiceRecordTaxWithheldResponse.fromJson(response.getBodyAsString(), response)); @@ -1573,7 +1599,7 @@ public CompletableFuture recordTaxWithheldAsyn String path = buildPathWithParams("/invoices/{invoice-id}/record_tax_withheld", "invoice-id", invoiceId); - return postAsync(path, null) + return postAsync("invoice", "recordTaxWithheld", path, null) .thenApply( response -> InvoiceRecordTaxWithheldResponse.fromJson(response.getBodyAsString(), response)); @@ -1584,7 +1610,7 @@ Response resendEinvoiceRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/resend_einvoice", "invoice-id", invoiceId); - return post(path, null); + return post("invoice", "resendEinvoice", path, null); } public ResendEinvoiceResponse resendEinvoice(String invoiceId) throws ChargebeeException { @@ -1597,7 +1623,7 @@ public CompletableFuture resendEinvoiceAsync(String invo String path = buildPathWithParams("/invoices/{invoice-id}/resend_einvoice", "invoice-id", invoiceId); - return postAsync(path, null) + return postAsync("invoice", "resendEinvoice", path, null) .thenApply( response -> ResendEinvoiceResponse.fromJson(response.getBodyAsString(), response)); } @@ -1607,7 +1633,7 @@ Response removeTaxWithheldRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/remove_tax_withheld", "invoice-id", invoiceId); - return post(path, null); + return post("invoice", "removeTaxWithheld", path, null); } /** @@ -1618,7 +1644,7 @@ Response removeTaxWithheldRaw(String invoiceId, InvoiceRemoveTaxWithheldParams p throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/remove_tax_withheld", "invoice-id", invoiceId); - return post(path, params.toFormData()); + return post("invoice", "removeTaxWithheld", path, params.toFormData()); } /** @@ -1628,7 +1654,7 @@ Response removeTaxWithheldRaw(String invoiceId, InvoiceRemoveTaxWithheldParams p Response removeTaxWithheldRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/remove_tax_withheld", "invoice-id", invoiceId); - return postJson(path, jsonPayload); + return postJson("invoice", "removeTaxWithheld", path, jsonPayload); } public InvoiceRemoveTaxWithheldResponse removeTaxWithheld( @@ -1642,7 +1668,7 @@ public CompletableFuture removeTaxWithheldAsyn String invoiceId, InvoiceRemoveTaxWithheldParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/remove_tax_withheld", "invoice-id", invoiceId); - return postAsync(path, params.toFormData()) + return postAsync("invoice", "removeTaxWithheld", path, params.toFormData()) .thenApply( response -> InvoiceRemoveTaxWithheldResponse.fromJson(response.getBodyAsString(), response)); @@ -1660,7 +1686,7 @@ public CompletableFuture removeTaxWithheldAsyn String path = buildPathWithParams("/invoices/{invoice-id}/remove_tax_withheld", "invoice-id", invoiceId); - return postAsync(path, null) + return postAsync("invoice", "removeTaxWithheld", path, null) .thenApply( response -> InvoiceRemoveTaxWithheldResponse.fromJson(response.getBodyAsString(), response)); @@ -1674,7 +1700,10 @@ Response listPaymentReferenceNumbersRaw(InvoiceListPaymentReferenceNumbersParams throws ChargebeeException { return get( - "/invoices/payment_reference_numbers", params != null ? params.toQueryParams() : null); + "invoice", + "listPaymentReferenceNumbers", + "/invoices/payment_reference_numbers", + params != null ? params.toQueryParams() : null); } /** @@ -1683,7 +1712,8 @@ Response listPaymentReferenceNumbersRaw(InvoiceListPaymentReferenceNumbersParams */ Response listPaymentReferenceNumbersRaw() throws ChargebeeException { - return get("/invoices/payment_reference_numbers", null); + return get( + "invoice", "listPaymentReferenceNumbers", "/invoices/payment_reference_numbers", null); } /** @@ -1708,7 +1738,10 @@ public InvoiceListPaymentReferenceNumbersResponse listPaymentReferenceNumbers( listPaymentReferenceNumbersAsync(InvoiceListPaymentReferenceNumbersParams params) { return getAsync( - "/invoices/payment_reference_numbers", params != null ? params.toQueryParams() : null) + "invoice", + "listPaymentReferenceNumbers", + "/invoices/payment_reference_numbers", + params != null ? params.toQueryParams() : null) .thenApply( response -> InvoiceListPaymentReferenceNumbersResponse.fromJson( @@ -1727,7 +1760,8 @@ public InvoiceListPaymentReferenceNumbersResponse listPaymentReferenceNumbers() public CompletableFuture listPaymentReferenceNumbersAsync() { - return getAsync("/invoices/payment_reference_numbers", null) + return getAsync( + "invoice", "listPaymentReferenceNumbers", "/invoices/payment_reference_numbers", null) .thenApply( response -> InvoiceListPaymentReferenceNumbersResponse.fromJson( @@ -1739,7 +1773,7 @@ Response collectPaymentRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/collect_payment", "invoice-id", invoiceId); - return post(path, null); + return post("invoice", "collectPayment", path, null); } /** @@ -1749,7 +1783,7 @@ Response collectPaymentRaw(String invoiceId, InvoiceCollectPaymentParams params) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/collect_payment", "invoice-id", invoiceId); - return post(path, params.toFormData()); + return post("invoice", "collectPayment", path, params.toFormData()); } /** @@ -1758,7 +1792,7 @@ Response collectPaymentRaw(String invoiceId, InvoiceCollectPaymentParams params) Response collectPaymentRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/collect_payment", "invoice-id", invoiceId); - return postJson(path, jsonPayload); + return postJson("invoice", "collectPayment", path, jsonPayload); } public InvoiceCollectPaymentResponse collectPayment( @@ -1772,7 +1806,7 @@ public CompletableFuture collectPaymentAsync( String invoiceId, InvoiceCollectPaymentParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/collect_payment", "invoice-id", invoiceId); - return postAsync(path, params.toFormData()) + return postAsync("invoice", "collectPayment", path, params.toFormData()) .thenApply( response -> InvoiceCollectPaymentResponse.fromJson(response.getBodyAsString(), response)); @@ -1788,7 +1822,7 @@ public CompletableFuture collectPaymentAsync(Stri String path = buildPathWithParams("/invoices/{invoice-id}/collect_payment", "invoice-id", invoiceId); - return postAsync(path, null) + return postAsync("invoice", "collectPayment", path, null) .thenApply( response -> InvoiceCollectPaymentResponse.fromJson(response.getBodyAsString(), response)); @@ -1799,7 +1833,7 @@ Response syncUsagesRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/sync_usages", "invoice-id", invoiceId); - return post(path, null); + return post("invoice", "syncUsages", path, null); } public InvoiceSyncUsagesResponse syncUsages(String invoiceId) throws ChargebeeException { @@ -1812,7 +1846,7 @@ public CompletableFuture syncUsagesAsync(String invoi String path = buildPathWithParams("/invoices/{invoice-id}/sync_usages", "invoice-id", invoiceId); - return postAsync(path, null) + return postAsync("invoice", "syncUsages", path, null) .thenApply( response -> InvoiceSyncUsagesResponse.fromJson(response.getBodyAsString(), response)); } @@ -1821,19 +1855,19 @@ public CompletableFuture syncUsagesAsync(String invoi Response refundRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/refund", "invoice-id", invoiceId); - return post(path, null); + return post("invoice", "refund", path, null); } /** 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()); + return post("invoice", "refund", path, params.toFormData()); } /** 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); + return postJson("invoice", "refund", path, jsonPayload); } public InvoiceRefundResponse refund(String invoiceId, InvoiceRefundParams params) @@ -1846,7 +1880,7 @@ public InvoiceRefundResponse refund(String invoiceId, InvoiceRefundParams params public CompletableFuture refundAsync( String invoiceId, InvoiceRefundParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/refund", "invoice-id", invoiceId); - return postAsync(path, params.toFormData()) + return postAsync("invoice", "refund", path, params.toFormData()) .thenApply( response -> InvoiceRefundResponse.fromJson(response.getBodyAsString(), response)); } @@ -1860,7 +1894,7 @@ public InvoiceRefundResponse refund(String invoiceId) throws ChargebeeException public CompletableFuture refundAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/refund", "invoice-id", invoiceId); - return postAsync(path, null) + return postAsync("invoice", "refund", path, null) .thenApply( response -> InvoiceRefundResponse.fromJson(response.getBodyAsString(), response)); } @@ -1870,7 +1904,7 @@ Response recordRefundRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/record_refund", "invoice-id", invoiceId); - return post(path, null); + return post("invoice", "recordRefund", path, null); } /** @@ -1880,7 +1914,7 @@ Response recordRefundRaw(String invoiceId, InvoiceRecordRefundParams params) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/record_refund", "invoice-id", invoiceId); - return post(path, params.toFormData()); + return post("invoice", "recordRefund", path, params.toFormData()); } /** @@ -1889,7 +1923,7 @@ Response recordRefundRaw(String invoiceId, InvoiceRecordRefundParams params) Response recordRefundRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/record_refund", "invoice-id", invoiceId); - return postJson(path, jsonPayload); + return postJson("invoice", "recordRefund", path, jsonPayload); } public InvoiceRecordRefundResponse recordRefund( @@ -1903,7 +1937,7 @@ public CompletableFuture recordRefundAsync( String invoiceId, InvoiceRecordRefundParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/record_refund", "invoice-id", invoiceId); - return postAsync(path, params.toFormData()) + return postAsync("invoice", "recordRefund", path, params.toFormData()) .thenApply( response -> InvoiceRecordRefundResponse.fromJson(response.getBodyAsString(), response)); } @@ -1918,7 +1952,7 @@ public CompletableFuture recordRefundAsync(String i String path = buildPathWithParams("/invoices/{invoice-id}/record_refund", "invoice-id", invoiceId); - return postAsync(path, null) + return postAsync("invoice", "recordRefund", path, null) .thenApply( response -> InvoiceRecordRefundResponse.fromJson(response.getBodyAsString(), response)); } @@ -1927,19 +1961,19 @@ public CompletableFuture recordRefundAsync(String i Response pdfRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/pdf", "invoice-id", invoiceId); - return post(path, null); + return post("invoice", "pdf", path, null); } /** 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()); + return post("invoice", "pdf", path, params.toFormData()); } /** 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); + return postJson("invoice", "pdf", path, jsonPayload); } public InvoicePdfResponse pdf(String invoiceId, InvoicePdfParams params) @@ -1951,7 +1985,7 @@ public InvoicePdfResponse pdf(String invoiceId, InvoicePdfParams params) /** Async variant of pdf for invoice with params. */ public CompletableFuture pdfAsync(String invoiceId, InvoicePdfParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/pdf", "invoice-id", invoiceId); - return postAsync(path, params.toFormData()) + return postAsync("invoice", "pdf", path, params.toFormData()) .thenApply(response -> InvoicePdfResponse.fromJson(response.getBodyAsString(), response)); } @@ -1964,7 +1998,7 @@ public InvoicePdfResponse pdf(String invoiceId) throws ChargebeeException { public CompletableFuture pdfAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/pdf", "invoice-id", invoiceId); - return postAsync(path, null) + return postAsync("invoice", "pdf", path, null) .thenApply(response -> InvoicePdfResponse.fromJson(response.getBodyAsString(), response)); } @@ -1977,7 +2011,8 @@ Response invoicesForSubscriptionRaw(String subscriptionId, InvoicesForSubscripti String path = buildPathWithParams( "/subscriptions/{subscription-id}/invoices", "subscription-id", subscriptionId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "invoice", "invoicesForSubscription", path, params != null ? params.toQueryParams() : null); } /** @@ -1987,7 +2022,7 @@ Response invoicesForSubscriptionRaw(String subscriptionId) throws ChargebeeExcep String path = buildPathWithParams( "/subscriptions/{subscription-id}/invoices", "subscription-id", subscriptionId); - return get(path, null); + return get("invoice", "invoicesForSubscription", path, null); } /** @@ -2022,7 +2057,11 @@ public CompletableFuture invoicesForSubscriptio String path = buildPathWithParams( "/subscriptions/{subscription-id}/invoices", "subscription-id", subscriptionId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "invoice", + "invoicesForSubscription", + path, + params != null ? params.toQueryParams() : null) .thenApply( response -> InvoicesForSubscriptionResponse.fromJson( @@ -2035,7 +2074,7 @@ public CompletableFuture invoicesForSubscriptio String path = buildPathWithParams( "/subscriptions/{subscription-id}/invoices", "subscription-id", subscriptionId); - return getAsync(path, null) + return getAsync("invoice", "invoicesForSubscription", path, null) .thenApply( response -> InvoicesForSubscriptionResponse.fromJson( @@ -2047,7 +2086,7 @@ Response downloadEinvoiceRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/download_einvoice", "invoice-id", invoiceId); - return get(path, null); + return get("invoice", "downloadEinvoice", path, null); } public DownloadEinvoiceResponse downloadEinvoice(String invoiceId) throws ChargebeeException { @@ -2060,7 +2099,7 @@ public CompletableFuture downloadEinvoiceAsync(String String path = buildPathWithParams("/invoices/{invoice-id}/download_einvoice", "invoice-id", invoiceId); - return getAsync(path, null) + return getAsync("invoice", "downloadEinvoice", path, null) .thenApply( response -> DownloadEinvoiceResponse.fromJson(response.getBodyAsString(), response)); } @@ -2068,13 +2107,17 @@ public CompletableFuture downloadEinvoiceAsync(String /** chargeAddon a invoice using immutable params (executes immediately) - returns raw Response. */ Response chargeAddonRaw(InvoiceChargeAddonParams params) throws ChargebeeException { - return post("/invoices/charge_addon", params != null ? params.toFormData() : null); + return post( + "invoice", + "chargeAddon", + "/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 ChargebeeException { - return postJson("/invoices/charge_addon", jsonPayload); + return postJson("invoice", "chargeAddon", "/invoices/charge_addon", jsonPayload); } public InvoiceChargeAddonResponse chargeAddon(InvoiceChargeAddonParams params) @@ -2088,7 +2131,11 @@ public InvoiceChargeAddonResponse chargeAddon(InvoiceChargeAddonParams params) public CompletableFuture chargeAddonAsync( InvoiceChargeAddonParams params) { - return postAsync("/invoices/charge_addon", params != null ? params.toFormData() : null) + return postAsync( + "invoice", + "chargeAddon", + "/invoices/charge_addon", + params != null ? params.toFormData() : null) .thenApply( response -> InvoiceChargeAddonResponse.fromJson(response.getBodyAsString(), response)); } @@ -2098,7 +2145,7 @@ Response addAddonChargeRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/add_addon_charge", "invoice-id", invoiceId); - return post(path, null); + return post("invoice", "addAddonCharge", path, null); } /** @@ -2108,7 +2155,7 @@ 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()); + return post("invoice", "addAddonCharge", path, params.toFormData()); } /** @@ -2117,7 +2164,7 @@ Response addAddonChargeRaw(String invoiceId, InvoiceAddAddonChargeParams params) Response addAddonChargeRaw(String invoiceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/add_addon_charge", "invoice-id", invoiceId); - return postJson(path, jsonPayload); + return postJson("invoice", "addAddonCharge", path, jsonPayload); } public InvoiceAddAddonChargeResponse addAddonCharge( @@ -2131,7 +2178,7 @@ public CompletableFuture addAddonChargeAsync( String invoiceId, InvoiceAddAddonChargeParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/add_addon_charge", "invoice-id", invoiceId); - return postAsync(path, params.toFormData()) + return postAsync("invoice", "addAddonCharge", path, params.toFormData()) .thenApply( response -> InvoiceAddAddonChargeResponse.fromJson(response.getBodyAsString(), response)); @@ -2140,13 +2187,14 @@ public CompletableFuture addAddonChargeAsync( /** charge a invoice using immutable params (executes immediately) - returns raw Response. */ Response chargeRaw(InvoiceChargeParams params) throws ChargebeeException { - return post("/invoices/charge", params != null ? params.toFormData() : null); + return post( + "invoice", "charge", "/invoices/charge", params != null ? params.toFormData() : null); } /** charge a invoice using raw JSON payload (executes immediately) - returns raw Response. */ Response chargeRaw(String jsonPayload) throws ChargebeeException { - return postJson("/invoices/charge", jsonPayload); + return postJson("invoice", "charge", "/invoices/charge", jsonPayload); } public InvoiceChargeResponse charge(InvoiceChargeParams params) throws ChargebeeException { @@ -2158,7 +2206,8 @@ public InvoiceChargeResponse charge(InvoiceChargeParams params) throws Chargebee /** Async variant of charge for invoice with params. */ public CompletableFuture chargeAsync(InvoiceChargeParams params) { - return postAsync("/invoices/charge", params != null ? params.toFormData() : null) + return postAsync( + "invoice", "charge", "/invoices/charge", params != null ? params.toFormData() : null) .thenApply( response -> 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 aba621e53..7a63a6042 100644 --- a/src/main/java/com/chargebee/v4/services/ItemEntitlementService.java +++ b/src/main/java/com/chargebee/v4/services/ItemEntitlementService.java @@ -72,7 +72,11 @@ Response itemEntitlementsForFeatureRaw(String featureId, ItemEntitlementsForFeat throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}/item_entitlements", "feature-id", featureId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "itemEntitlement", + "itemEntitlementsForFeature", + path, + params != null ? params.toQueryParams() : null); } /** @@ -82,7 +86,7 @@ Response itemEntitlementsForFeatureRaw(String featureId, ItemEntitlementsForFeat Response itemEntitlementsForFeatureRaw(String featureId) throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}/item_entitlements", "feature-id", featureId); - return get(path, null); + return get("itemEntitlement", "itemEntitlementsForFeature", path, null); } /** @@ -115,7 +119,11 @@ public CompletableFuture itemEntitlementsFor String featureId, ItemEntitlementsForFeatureParams params) { String path = buildPathWithParams("/features/{feature-id}/item_entitlements", "feature-id", featureId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "itemEntitlement", + "itemEntitlementsForFeature", + path, + params != null ? params.toQueryParams() : null) .thenApply( response -> ItemEntitlementsForFeatureResponse.fromJson( @@ -127,7 +135,7 @@ public CompletableFuture itemEntitlementsFor String featureId) { String path = buildPathWithParams("/features/{feature-id}/item_entitlements", "feature-id", featureId); - return getAsync(path, null) + return getAsync("itemEntitlement", "itemEntitlementsForFeature", path, null) .thenApply( response -> ItemEntitlementsForFeatureResponse.fromJson( @@ -139,7 +147,7 @@ Response addItemEntitlementsRaw(String featureId) throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}/item_entitlements", "feature-id", featureId); - return post(path, null); + return post("itemEntitlement", "addItemEntitlements", path, null); } /** @@ -150,7 +158,7 @@ Response addItemEntitlementsRaw(String featureId, AddItemEntitlementsParams para throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}/item_entitlements", "feature-id", featureId); - return post(path, params.toFormData()); + return post("itemEntitlement", "addItemEntitlements", path, params.toFormData()); } /** @@ -160,7 +168,7 @@ Response addItemEntitlementsRaw(String featureId, AddItemEntitlementsParams para Response addItemEntitlementsRaw(String featureId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}/item_entitlements", "feature-id", featureId); - return postJson(path, jsonPayload); + return postJson("itemEntitlement", "addItemEntitlements", path, jsonPayload); } public AddItemEntitlementsResponse addItemEntitlements( @@ -174,7 +182,7 @@ public CompletableFuture addItemEntitlementsAsync( String featureId, AddItemEntitlementsParams params) { String path = buildPathWithParams("/features/{feature-id}/item_entitlements", "feature-id", featureId); - return postAsync(path, params.toFormData()) + return postAsync("itemEntitlement", "addItemEntitlements", path, params.toFormData()) .thenApply( response -> AddItemEntitlementsResponse.fromJson(response.getBodyAsString(), response)); } @@ -186,7 +194,11 @@ public CompletableFuture addItemEntitlementsAsync( Response itemEntitlementsForItemRaw(String itemId, ItemEntitlementsForItemParams params) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}/item_entitlements", "item-id", itemId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "itemEntitlement", + "itemEntitlementsForItem", + path, + params != null ? params.toQueryParams() : null); } /** @@ -195,7 +207,7 @@ Response itemEntitlementsForItemRaw(String itemId, ItemEntitlementsForItemParams */ Response itemEntitlementsForItemRaw(String itemId) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}/item_entitlements", "item-id", itemId); - return get(path, null); + return get("itemEntitlement", "itemEntitlementsForItem", path, null); } /** @@ -225,7 +237,11 @@ public ItemEntitlementsForItemResponse itemEntitlementsForItem(String itemId) public CompletableFuture itemEntitlementsForItemAsync( String itemId, ItemEntitlementsForItemParams params) { String path = buildPathWithParams("/items/{item-id}/item_entitlements", "item-id", itemId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "itemEntitlement", + "itemEntitlementsForItem", + path, + params != null ? params.toQueryParams() : null) .thenApply( response -> ItemEntitlementsForItemResponse.fromJson( @@ -236,7 +252,7 @@ public CompletableFuture itemEntitlementsForIte public CompletableFuture itemEntitlementsForItemAsync( String itemId) { String path = buildPathWithParams("/items/{item-id}/item_entitlements", "item-id", itemId); - return getAsync(path, null) + return getAsync("itemEntitlement", "itemEntitlementsForItem", path, null) .thenApply( response -> ItemEntitlementsForItemResponse.fromJson( @@ -250,7 +266,7 @@ public CompletableFuture itemEntitlementsForIte Response upsertOrRemoveItemEntitlementsForItemRaw(String itemId) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}/item_entitlements", "item-id", itemId); - return post(path, null); + return post("itemEntitlement", "upsertOrRemoveItemEntitlementsForItem", path, null); } /** @@ -260,7 +276,8 @@ Response upsertOrRemoveItemEntitlementsForItemRaw(String itemId) throws Chargebe Response upsertOrRemoveItemEntitlementsForItemRaw( String itemId, UpsertOrRemoveItemEntitlementsForItemParams params) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}/item_entitlements", "item-id", itemId); - return post(path, params.toFormData()); + return post( + "itemEntitlement", "upsertOrRemoveItemEntitlementsForItem", path, params.toFormData()); } /** @@ -270,7 +287,7 @@ Response upsertOrRemoveItemEntitlementsForItemRaw( Response upsertOrRemoveItemEntitlementsForItemRaw(String itemId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}/item_entitlements", "item-id", itemId); - return postJson(path, jsonPayload); + return postJson("itemEntitlement", "upsertOrRemoveItemEntitlementsForItem", path, jsonPayload); } public UpsertOrRemoveItemEntitlementsForItemResponse upsertOrRemoveItemEntitlementsForItem( @@ -285,7 +302,8 @@ public UpsertOrRemoveItemEntitlementsForItemResponse upsertOrRemoveItemEntitleme upsertOrRemoveItemEntitlementsForItemAsync( String itemId, UpsertOrRemoveItemEntitlementsForItemParams params) { String path = buildPathWithParams("/items/{item-id}/item_entitlements", "item-id", itemId); - return postAsync(path, params.toFormData()) + return postAsync( + "itemEntitlement", "upsertOrRemoveItemEntitlementsForItem", path, params.toFormData()) .thenApply( response -> UpsertOrRemoveItemEntitlementsForItemResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/ItemFamilyService.java b/src/main/java/com/chargebee/v4/services/ItemFamilyService.java index 9a31f2f2c..d0a7eb5a5 100644 --- a/src/main/java/com/chargebee/v4/services/ItemFamilyService.java +++ b/src/main/java/com/chargebee/v4/services/ItemFamilyService.java @@ -69,7 +69,7 @@ Response deleteRaw(String itemFamilyId) throws ChargebeeException { buildPathWithParams( "/item_families/{item-family-id}/delete", "item-family-id", itemFamilyId); - return post(path, null); + return post("itemFamily", "delete", path, null); } public ItemFamilyDeleteResponse delete(String itemFamilyId) throws ChargebeeException { @@ -83,7 +83,7 @@ public CompletableFuture deleteAsync(String itemFamily buildPathWithParams( "/item_families/{item-family-id}/delete", "item-family-id", itemFamilyId); - return postAsync(path, null) + return postAsync("itemFamily", "delete", path, null) .thenApply( response -> ItemFamilyDeleteResponse.fromJson(response.getBodyAsString(), response)); } @@ -91,13 +91,14 @@ public CompletableFuture deleteAsync(String itemFamily /** list a itemFamily using immutable params (executes immediately) - returns raw Response. */ Response listRaw(ItemFamilyListParams params) throws ChargebeeException { - return get("/item_families", params != null ? params.toQueryParams() : null); + return get( + "itemFamily", "list", "/item_families", params != null ? params.toQueryParams() : null); } /** list a itemFamily without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/item_families", null); + return get("itemFamily", "list", "/item_families", null); } /** list a itemFamily using raw JSON payload (executes immediately) - returns raw Response. */ @@ -115,7 +116,8 @@ public ItemFamilyListResponse list(ItemFamilyListParams params) throws Chargebee /** Async variant of list for itemFamily with params. */ public CompletableFuture listAsync(ItemFamilyListParams params) { - return getAsync("/item_families", params != null ? params.toQueryParams() : null) + return getAsync( + "itemFamily", "list", "/item_families", params != null ? params.toQueryParams() : null) .thenApply( response -> ItemFamilyListResponse.fromJson( @@ -131,7 +133,7 @@ public ItemFamilyListResponse list() throws ChargebeeException { /** Async variant of list for itemFamily without params. */ public CompletableFuture listAsync() { - return getAsync("/item_families", null) + return getAsync("itemFamily", "list", "/item_families", null) .thenApply( response -> ItemFamilyListResponse.fromJson(response.getBodyAsString(), this, null, response)); @@ -140,13 +142,14 @@ public CompletableFuture listAsync() { /** create a itemFamily using immutable params (executes immediately) - returns raw Response. */ Response createRaw(ItemFamilyCreateParams params) throws ChargebeeException { - return post("/item_families", params != null ? params.toFormData() : null); + return post( + "itemFamily", "create", "/item_families", params != null ? params.toFormData() : null); } /** create a itemFamily using raw JSON payload (executes immediately) - returns raw Response. */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/item_families", jsonPayload); + return postJson("itemFamily", "create", "/item_families", jsonPayload); } public ItemFamilyCreateResponse create(ItemFamilyCreateParams params) throws ChargebeeException { @@ -158,7 +161,8 @@ public ItemFamilyCreateResponse create(ItemFamilyCreateParams params) throws Cha /** Async variant of create for itemFamily with params. */ public CompletableFuture createAsync(ItemFamilyCreateParams params) { - return postAsync("/item_families", params != null ? params.toFormData() : null) + return postAsync( + "itemFamily", "create", "/item_families", params != null ? params.toFormData() : null) .thenApply( response -> ItemFamilyCreateResponse.fromJson(response.getBodyAsString(), response)); } @@ -168,7 +172,7 @@ Response retrieveRaw(String itemFamilyId) throws ChargebeeException { String path = buildPathWithParams("/item_families/{item-family-id}", "item-family-id", itemFamilyId); - return get(path, null); + return get("itemFamily", "retrieve", path, null); } public ItemFamilyRetrieveResponse retrieve(String itemFamilyId) throws ChargebeeException { @@ -181,7 +185,7 @@ public CompletableFuture retrieveAsync(String itemFa String path = buildPathWithParams("/item_families/{item-family-id}", "item-family-id", itemFamilyId); - return getAsync(path, null) + return getAsync("itemFamily", "retrieve", path, null) .thenApply( response -> ItemFamilyRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -191,21 +195,21 @@ Response updateRaw(String itemFamilyId) throws ChargebeeException { String path = buildPathWithParams("/item_families/{item-family-id}", "item-family-id", itemFamilyId); - return post(path, null); + return post("itemFamily", "update", path, null); } /** update a itemFamily using immutable params (executes immediately) - returns raw Response. */ 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()); + return post("itemFamily", "update", path, params.toFormData()); } /** update a itemFamily using raw JSON payload (executes immediately) - returns raw Response. */ Response updateRaw(String itemFamilyId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/item_families/{item-family-id}", "item-family-id", itemFamilyId); - return postJson(path, jsonPayload); + return postJson("itemFamily", "update", path, jsonPayload); } public ItemFamilyUpdateResponse update(String itemFamilyId, ItemFamilyUpdateParams params) @@ -219,7 +223,7 @@ public CompletableFuture updateAsync( String itemFamilyId, ItemFamilyUpdateParams params) { String path = buildPathWithParams("/item_families/{item-family-id}", "item-family-id", itemFamilyId); - return postAsync(path, params.toFormData()) + return postAsync("itemFamily", "update", path, params.toFormData()) .thenApply( response -> ItemFamilyUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -234,7 +238,7 @@ public CompletableFuture updateAsync(String itemFamily String path = buildPathWithParams("/item_families/{item-family-id}", "item-family-id", itemFamilyId); - return postAsync(path, null) + return postAsync("itemFamily", "update", path, null) .thenApply( response -> 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 018e6bad5..132816d15 100644 --- a/src/main/java/com/chargebee/v4/services/ItemPriceService.java +++ b/src/main/java/com/chargebee/v4/services/ItemPriceService.java @@ -75,7 +75,7 @@ public ItemPriceService withOptions(RequestOptions options) { Response retrieveRaw(String itemPriceId) throws ChargebeeException { String path = buildPathWithParams("/item_prices/{item-price-id}", "item-price-id", itemPriceId); - return get(path, null); + return get("itemPrice", "retrieve", path, null); } public ItemPriceRetrieveResponse retrieve(String itemPriceId) throws ChargebeeException { @@ -87,7 +87,7 @@ public ItemPriceRetrieveResponse retrieve(String itemPriceId) throws ChargebeeEx public CompletableFuture retrieveAsync(String itemPriceId) { String path = buildPathWithParams("/item_prices/{item-price-id}", "item-price-id", itemPriceId); - return getAsync(path, null) + return getAsync("itemPrice", "retrieve", path, null) .thenApply( response -> ItemPriceRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -96,19 +96,19 @@ public CompletableFuture retrieveAsync(String itemPri Response updateRaw(String itemPriceId) throws ChargebeeException { String path = buildPathWithParams("/item_prices/{item-price-id}", "item-price-id", itemPriceId); - return post(path, null); + return post("itemPrice", "update", path, null); } /** update a itemPrice using immutable params (executes immediately) - returns raw Response. */ 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()); + return post("itemPrice", "update", path, params.toFormData()); } /** update a itemPrice using raw JSON payload (executes immediately) - returns raw Response. */ Response updateRaw(String itemPriceId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/item_prices/{item-price-id}", "item-price-id", itemPriceId); - return postJson(path, jsonPayload); + return postJson("itemPrice", "update", path, jsonPayload); } public ItemPriceUpdateResponse update(String itemPriceId, ItemPriceUpdateParams params) @@ -121,7 +121,7 @@ public ItemPriceUpdateResponse update(String itemPriceId, ItemPriceUpdateParams public CompletableFuture updateAsync( String itemPriceId, ItemPriceUpdateParams params) { String path = buildPathWithParams("/item_prices/{item-price-id}", "item-price-id", itemPriceId); - return postAsync(path, params.toFormData()) + return postAsync("itemPrice", "update", path, params.toFormData()) .thenApply( response -> ItemPriceUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -135,7 +135,7 @@ public ItemPriceUpdateResponse update(String itemPriceId) throws ChargebeeExcept public CompletableFuture updateAsync(String itemPriceId) { String path = buildPathWithParams("/item_prices/{item-price-id}", "item-price-id", itemPriceId); - return postAsync(path, null) + return postAsync("itemPrice", "update", path, null) .thenApply( response -> ItemPriceUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -145,7 +145,7 @@ Response deleteRaw(String itemPriceId) throws ChargebeeException { String path = buildPathWithParams("/item_prices/{item-price-id}/delete", "item-price-id", itemPriceId); - return post(path, null); + return post("itemPrice", "delete", path, null); } public ItemPriceDeleteResponse delete(String itemPriceId) throws ChargebeeException { @@ -158,7 +158,7 @@ public CompletableFuture deleteAsync(String itemPriceId String path = buildPathWithParams("/item_prices/{item-price-id}/delete", "item-price-id", itemPriceId); - return postAsync(path, null) + return postAsync("itemPrice", "delete", path, null) .thenApply( response -> ItemPriceDeleteResponse.fromJson(response.getBodyAsString(), response)); } @@ -172,7 +172,11 @@ Response findApplicableItemPricesRaw(String itemPriceId, FindApplicableItemPrice String path = buildPathWithParams( "/item_prices/{item-price-id}/applicable_item_prices", "item-price-id", itemPriceId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "itemPrice", + "findApplicableItemPrices", + path, + params != null ? params.toQueryParams() : null); } /** @@ -183,7 +187,7 @@ Response findApplicableItemPricesRaw(String itemPriceId) throws ChargebeeExcepti String path = buildPathWithParams( "/item_prices/{item-price-id}/applicable_item_prices", "item-price-id", itemPriceId); - return get(path, null); + return get("itemPrice", "findApplicableItemPrices", path, null); } /** @@ -218,7 +222,11 @@ public CompletableFuture findApplicableItemPri String path = buildPathWithParams( "/item_prices/{item-price-id}/applicable_item_prices", "item-price-id", itemPriceId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "itemPrice", + "findApplicableItemPrices", + path, + params != null ? params.toQueryParams() : null) .thenApply( response -> FindApplicableItemPricesResponse.fromJson( @@ -231,7 +239,7 @@ public CompletableFuture findApplicableItemPri String path = buildPathWithParams( "/item_prices/{item-price-id}/applicable_item_prices", "item-price-id", itemPriceId); - return getAsync(path, null) + return getAsync("itemPrice", "findApplicableItemPrices", path, null) .thenApply( response -> FindApplicableItemPricesResponse.fromJson( @@ -247,7 +255,8 @@ Response findApplicableItemsRaw(String itemPriceId, ItemPriceFindApplicableItems String path = buildPathWithParams( "/item_prices/{item-price-id}/applicable_items", "item-price-id", itemPriceId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "itemPrice", "findApplicableItems", path, params != null ? params.toQueryParams() : null); } /** @@ -257,7 +266,7 @@ Response findApplicableItemsRaw(String itemPriceId) throws ChargebeeException { String path = buildPathWithParams( "/item_prices/{item-price-id}/applicable_items", "item-price-id", itemPriceId); - return get(path, null); + return get("itemPrice", "findApplicableItems", path, null); } /** @@ -292,7 +301,11 @@ public CompletableFuture findApplicableIte String path = buildPathWithParams( "/item_prices/{item-price-id}/applicable_items", "item-price-id", itemPriceId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "itemPrice", + "findApplicableItems", + path, + params != null ? params.toQueryParams() : null) .thenApply( response -> ItemPriceFindApplicableItemsResponse.fromJson( @@ -305,7 +318,7 @@ public CompletableFuture findApplicableIte String path = buildPathWithParams( "/item_prices/{item-price-id}/applicable_items", "item-price-id", itemPriceId); - return getAsync(path, null) + return getAsync("itemPrice", "findApplicableItems", path, null) .thenApply( response -> ItemPriceFindApplicableItemsResponse.fromJson( @@ -315,13 +328,13 @@ public CompletableFuture findApplicableIte /** list a itemPrice using immutable params (executes immediately) - returns raw Response. */ Response listRaw(ItemPriceListParams params) throws ChargebeeException { - return get("/item_prices", params != null ? params.toQueryParams() : null); + return get("itemPrice", "list", "/item_prices", params != null ? params.toQueryParams() : null); } /** list a itemPrice without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/item_prices", null); + return get("itemPrice", "list", "/item_prices", null); } /** list a itemPrice using raw JSON payload (executes immediately) - returns raw Response. */ @@ -339,7 +352,8 @@ public ItemPriceListResponse list(ItemPriceListParams params) throws ChargebeeEx /** Async variant of list for itemPrice with params. */ public CompletableFuture listAsync(ItemPriceListParams params) { - return getAsync("/item_prices", params != null ? params.toQueryParams() : null) + return getAsync( + "itemPrice", "list", "/item_prices", params != null ? params.toQueryParams() : null) .thenApply( response -> ItemPriceListResponse.fromJson(response.getBodyAsString(), this, params, response)); @@ -354,7 +368,7 @@ public ItemPriceListResponse list() throws ChargebeeException { /** Async variant of list for itemPrice without params. */ public CompletableFuture listAsync() { - return getAsync("/item_prices", null) + return getAsync("itemPrice", "list", "/item_prices", null) .thenApply( response -> ItemPriceListResponse.fromJson(response.getBodyAsString(), this, null, response)); @@ -363,13 +377,13 @@ public CompletableFuture listAsync() { /** create a itemPrice using immutable params (executes immediately) - returns raw Response. */ Response createRaw(ItemPriceCreateParams params) throws ChargebeeException { - return post("/item_prices", params != null ? params.toFormData() : null); + return post("itemPrice", "create", "/item_prices", params != null ? params.toFormData() : null); } /** create a itemPrice using raw JSON payload (executes immediately) - returns raw Response. */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/item_prices", jsonPayload); + return postJson("itemPrice", "create", "/item_prices", jsonPayload); } public ItemPriceCreateResponse create(ItemPriceCreateParams params) throws ChargebeeException { @@ -381,7 +395,8 @@ public ItemPriceCreateResponse create(ItemPriceCreateParams params) throws Charg /** Async variant of create for itemPrice with params. */ public CompletableFuture createAsync(ItemPriceCreateParams params) { - return postAsync("/item_prices", params != null ? params.toFormData() : null) + return postAsync( + "itemPrice", "create", "/item_prices", params != null ? params.toFormData() : null) .thenApply( response -> 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 ac3be22de..2a0fd15e5 100644 --- a/src/main/java/com/chargebee/v4/services/ItemService.java +++ b/src/main/java/com/chargebee/v4/services/ItemService.java @@ -66,13 +66,13 @@ public ItemService withOptions(RequestOptions options) { /** list a item using immutable params (executes immediately) - returns raw Response. */ Response listRaw(ItemListParams params) throws ChargebeeException { - return get("/items", params != null ? params.toQueryParams() : null); + return get("item", "list", "/items", params != null ? params.toQueryParams() : null); } /** list a item without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/items", null); + return get("item", "list", "/items", null); } /** list a item using raw JSON payload (executes immediately) - returns raw Response. */ @@ -90,7 +90,7 @@ public ItemListResponse list(ItemListParams params) throws ChargebeeException { /** Async variant of list for item with params. */ public CompletableFuture listAsync(ItemListParams params) { - return getAsync("/items", params != null ? params.toQueryParams() : null) + return getAsync("item", "list", "/items", params != null ? params.toQueryParams() : null) .thenApply( response -> ItemListResponse.fromJson(response.getBodyAsString(), this, params, response)); @@ -105,7 +105,7 @@ public ItemListResponse list() throws ChargebeeException { /** Async variant of list for item without params. */ public CompletableFuture listAsync() { - return getAsync("/items", null) + return getAsync("item", "list", "/items", null) .thenApply( response -> ItemListResponse.fromJson(response.getBodyAsString(), this, null, response)); @@ -114,13 +114,13 @@ public CompletableFuture listAsync() { /** create a item using immutable params (executes immediately) - returns raw Response. */ Response createRaw(ItemCreateParams params) throws ChargebeeException { - return post("/items", params != null ? params.toFormData() : null); + return post("item", "create", "/items", params != null ? params.toFormData() : null); } /** create a item using raw JSON payload (executes immediately) - returns raw Response. */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/items", jsonPayload); + return postJson("item", "create", "/items", jsonPayload); } public ItemCreateResponse create(ItemCreateParams params) throws ChargebeeException { @@ -132,7 +132,7 @@ public ItemCreateResponse create(ItemCreateParams params) throws ChargebeeExcept /** Async variant of create for item with params. */ public CompletableFuture createAsync(ItemCreateParams params) { - return postAsync("/items", params != null ? params.toFormData() : null) + return postAsync("item", "create", "/items", params != null ? params.toFormData() : null) .thenApply(response -> ItemCreateResponse.fromJson(response.getBodyAsString(), response)); } @@ -140,7 +140,7 @@ public CompletableFuture createAsync(ItemCreateParams params Response deleteRaw(String itemId) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}/delete", "item-id", itemId); - return post(path, null); + return post("item", "delete", path, null); } public ItemDeleteResponse delete(String itemId) throws ChargebeeException { @@ -152,7 +152,7 @@ public ItemDeleteResponse delete(String itemId) throws ChargebeeException { public CompletableFuture deleteAsync(String itemId) { String path = buildPathWithParams("/items/{item-id}/delete", "item-id", itemId); - return postAsync(path, null) + return postAsync("item", "delete", path, null) .thenApply(response -> ItemDeleteResponse.fromJson(response.getBodyAsString(), response)); } @@ -160,7 +160,7 @@ public CompletableFuture deleteAsync(String itemId) { Response retrieveRaw(String itemId) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}", "item-id", itemId); - return get(path, null); + return get("item", "retrieve", path, null); } public ItemRetrieveResponse retrieve(String itemId) throws ChargebeeException { @@ -172,7 +172,7 @@ public ItemRetrieveResponse retrieve(String itemId) throws ChargebeeException { public CompletableFuture retrieveAsync(String itemId) { String path = buildPathWithParams("/items/{item-id}", "item-id", itemId); - return getAsync(path, null) + return getAsync("item", "retrieve", path, null) .thenApply(response -> ItemRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -180,19 +180,19 @@ public CompletableFuture retrieveAsync(String itemId) { Response updateRaw(String itemId) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}", "item-id", itemId); - return post(path, null); + return post("item", "update", path, null); } /** update a item using immutable params (executes immediately) - returns raw Response. */ Response updateRaw(String itemId, ItemUpdateParams params) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}", "item-id", itemId); - return post(path, params.toFormData()); + return post("item", "update", path, params.toFormData()); } /** update a item using raw JSON payload (executes immediately) - returns raw Response. */ Response updateRaw(String itemId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}", "item-id", itemId); - return postJson(path, jsonPayload); + return postJson("item", "update", path, jsonPayload); } public ItemUpdateResponse update(String itemId, ItemUpdateParams params) @@ -204,7 +204,7 @@ public ItemUpdateResponse update(String itemId, ItemUpdateParams params) /** Async variant of update for item with params. */ public CompletableFuture updateAsync(String itemId, ItemUpdateParams params) { String path = buildPathWithParams("/items/{item-id}", "item-id", itemId); - return postAsync(path, params.toFormData()) + return postAsync("item", "update", path, params.toFormData()) .thenApply(response -> ItemUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -217,7 +217,7 @@ public ItemUpdateResponse update(String itemId) throws ChargebeeException { public CompletableFuture updateAsync(String itemId) { String path = buildPathWithParams("/items/{item-id}", "item-id", itemId); - return postAsync(path, null) + return postAsync("item", "update", path, null) .thenApply(response -> 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 0ce354675..e05afd7d7 100644 --- a/src/main/java/com/chargebee/v4/services/MediaService.java +++ b/src/main/java/com/chargebee/v4/services/MediaService.java @@ -55,7 +55,7 @@ public MediaService withOptions(RequestOptions options) { Response createMediaAndAttachToItemRaw(String itemId) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}/media", "item-id", itemId); - return post(path, null); + return post("media", "createMediaAndAttachToItem", path, null); } /** @@ -65,7 +65,7 @@ Response createMediaAndAttachToItemRaw(String itemId) throws ChargebeeException Response createMediaAndAttachToItemRaw(String itemId, CreateMediaAndAttachToItemParams params) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}/media", "item-id", itemId); - return post(path, params.toFormData()); + return post("media", "createMediaAndAttachToItem", path, params.toFormData()); } /** @@ -75,7 +75,7 @@ Response createMediaAndAttachToItemRaw(String itemId, CreateMediaAndAttachToItem Response createMediaAndAttachToItemRaw(String itemId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}/media", "item-id", itemId); - return postJson(path, jsonPayload); + return postJson("media", "createMediaAndAttachToItem", path, jsonPayload); } public CreateMediaAndAttachToItemResponse createMediaAndAttachToItem( @@ -88,7 +88,7 @@ public CreateMediaAndAttachToItemResponse createMediaAndAttachToItem( public CompletableFuture createMediaAndAttachToItemAsync( String itemId, CreateMediaAndAttachToItemParams params) { String path = buildPathWithParams("/items/{item-id}/media", "item-id", itemId); - return postAsync(path, params.toFormData()) + return postAsync("media", "createMediaAndAttachToItem", path, params.toFormData()) .thenApply( response -> 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 dbd3e6f23..59697a365 100644 --- a/src/main/java/com/chargebee/v4/services/NonSubscriptionService.java +++ b/src/main/java/com/chargebee/v4/services/NonSubscriptionService.java @@ -60,7 +60,7 @@ Response processReceiptRaw(String nonSubscriptionAppId) throws ChargebeeExceptio "non-subscription-app-id", nonSubscriptionAppId); - return post(path, null); + return post("nonSubscription", "processReceipt", path, null); } /** @@ -75,7 +75,7 @@ Response processReceiptRaw( "/non_subscriptions/{non-subscription-app-id}/one_time_purchase", "non-subscription-app-id", nonSubscriptionAppId); - return post(path, params.toFormData()); + return post("nonSubscription", "processReceipt", path, params.toFormData()); } /** @@ -89,7 +89,7 @@ Response processReceiptRaw(String nonSubscriptionAppId, String jsonPayload) "/non_subscriptions/{non-subscription-app-id}/one_time_purchase", "non-subscription-app-id", nonSubscriptionAppId); - return postJson(path, jsonPayload); + return postJson("nonSubscription", "processReceipt", path, jsonPayload); } public NonSubscriptionProcessReceiptResponse processReceipt( @@ -107,7 +107,7 @@ public CompletableFuture processReceiptAs "/non_subscriptions/{non-subscription-app-id}/one_time_purchase", "non-subscription-app-id", nonSubscriptionAppId); - return postAsync(path, params.toFormData()) + return postAsync("nonSubscription", "processReceipt", path, params.toFormData()) .thenApply( response -> NonSubscriptionProcessReceiptResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/OfferEventService.java b/src/main/java/com/chargebee/v4/services/OfferEventService.java index f4c75ba01..1c79fc58d 100644 --- a/src/main/java/com/chargebee/v4/services/OfferEventService.java +++ b/src/main/java/com/chargebee/v4/services/OfferEventService.java @@ -59,7 +59,11 @@ public OfferEventService withOptions(RequestOptions options) { Response offerEventsRaw(OfferEventsParams params) throws ChargebeeException { return postJsonWithSubDomain( - "/offer_events", SubDomain.GROW.getValue(), params != null ? params.toJsonString() : null); + "offerEvent", + "offerEvents", + "/offer_events", + SubDomain.GROW.getValue(), + params != null ? params.toJsonString() : null); } /** @@ -67,7 +71,8 @@ Response offerEventsRaw(OfferEventsParams params) throws ChargebeeException { */ Response offerEventsRaw(String jsonPayload) throws ChargebeeException { - return postJsonWithSubDomain("/offer_events", SubDomain.GROW.getValue(), jsonPayload); + return postJsonWithSubDomain( + "offerEvent", "offerEvents", "/offer_events", SubDomain.GROW.getValue(), jsonPayload); } public OfferEventsResponse offerEvents(OfferEventsParams params) throws ChargebeeException { @@ -80,6 +85,8 @@ public OfferEventsResponse offerEvents(OfferEventsParams params) throws Chargebe public CompletableFuture offerEventsAsync(OfferEventsParams params) { return postJsonWithSubDomainAsync( + "offerEvent", + "offerEvents", "/offer_events", SubDomain.GROW.getValue(), params != null ? params.toJsonString() : null) diff --git a/src/main/java/com/chargebee/v4/services/OfferFulfillmentService.java b/src/main/java/com/chargebee/v4/services/OfferFulfillmentService.java index 40fbbe946..d95e804c1 100644 --- a/src/main/java/com/chargebee/v4/services/OfferFulfillmentService.java +++ b/src/main/java/com/chargebee/v4/services/OfferFulfillmentService.java @@ -67,6 +67,8 @@ public OfferFulfillmentService withOptions(RequestOptions options) { Response offerFulfillmentsRaw(OfferFulfillmentsParams params) throws ChargebeeException { return postJsonWithSubDomain( + "offerFulfillment", + "offerFulfillments", "/offer_fulfillments", SubDomain.GROW.getValue(), params != null ? params.toJsonString() : null); @@ -78,7 +80,12 @@ Response offerFulfillmentsRaw(OfferFulfillmentsParams params) throws ChargebeeEx */ Response offerFulfillmentsRaw(String jsonPayload) throws ChargebeeException { - return postJsonWithSubDomain("/offer_fulfillments", SubDomain.GROW.getValue(), jsonPayload); + return postJsonWithSubDomain( + "offerFulfillment", + "offerFulfillments", + "/offer_fulfillments", + SubDomain.GROW.getValue(), + jsonPayload); } public OfferFulfillmentsResponse offerFulfillments(OfferFulfillmentsParams params) @@ -93,6 +100,8 @@ public CompletableFuture offerFulfillmentsAsync( OfferFulfillmentsParams params) { return postJsonWithSubDomainAsync( + "offerFulfillment", + "offerFulfillments", "/offer_fulfillments", SubDomain.GROW.getValue(), params != null ? params.toJsonString() : null) @@ -108,7 +117,8 @@ Response offerFulfillmentsGetRaw(String offerFulfillmentId) throws ChargebeeExce "offer-fulfillment-id", offerFulfillmentId); - return getWithSubDomain(path, SubDomain.GROW.getValue(), null); + return getWithSubDomain( + "offerFulfillment", "offerFulfillmentsGet", path, SubDomain.GROW.getValue(), null); } public OfferFulfillmentsGetResponse offerFulfillmentsGet(String offerFulfillmentId) @@ -126,7 +136,8 @@ public CompletableFuture offerFulfillmentsGetAsync "offer-fulfillment-id", offerFulfillmentId); - return getWithSubDomainAsync(path, SubDomain.GROW.getValue(), null) + return getWithSubDomainAsync( + "offerFulfillment", "offerFulfillmentsGet", path, SubDomain.GROW.getValue(), null) .thenApply( response -> OfferFulfillmentsGetResponse.fromJson(response.getBodyAsString(), response)); @@ -140,7 +151,8 @@ Response offerFulfillmentsUpdateRaw(String offerFulfillmentId) throws ChargebeeE "offer-fulfillment-id", offerFulfillmentId); - return postWithSubDomain(path, SubDomain.GROW.getValue(), null); + return postWithSubDomain( + "offerFulfillment", "offerFulfillmentsUpdate", path, SubDomain.GROW.getValue(), null); } /** @@ -155,7 +167,11 @@ Response offerFulfillmentsUpdateRaw( "offer-fulfillment-id", offerFulfillmentId); return postJsonWithSubDomain( - path, SubDomain.GROW.getValue(), params != null ? params.toJsonString() : null); + "offerFulfillment", + "offerFulfillmentsUpdate", + path, + SubDomain.GROW.getValue(), + params != null ? params.toJsonString() : null); } /** @@ -169,7 +185,12 @@ Response offerFulfillmentsUpdateRaw(String offerFulfillmentId, String jsonPayloa "/offer_fulfillments/{offer-fulfillment-id}", "offer-fulfillment-id", offerFulfillmentId); - return postJsonWithSubDomain(path, SubDomain.GROW.getValue(), jsonPayload); + return postJsonWithSubDomain( + "offerFulfillment", + "offerFulfillmentsUpdate", + path, + SubDomain.GROW.getValue(), + jsonPayload); } public OfferFulfillmentsUpdateResponse offerFulfillmentsUpdate( @@ -187,7 +208,11 @@ public CompletableFuture offerFulfillmentsUpdat "offer-fulfillment-id", offerFulfillmentId); return postJsonWithSubDomainAsync( - path, SubDomain.GROW.getValue(), params != null ? params.toJsonString() : null) + "offerFulfillment", + "offerFulfillmentsUpdate", + path, + SubDomain.GROW.getValue(), + params != null ? params.toJsonString() : null) .thenApply( response -> 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 c7fef5af0..d42f5bbba 100644 --- a/src/main/java/com/chargebee/v4/services/OmnichannelOneTimeOrderService.java +++ b/src/main/java/com/chargebee/v4/services/OmnichannelOneTimeOrderService.java @@ -61,7 +61,11 @@ public OmnichannelOneTimeOrderService withOptions(RequestOptions options) { */ Response listRaw(OmnichannelOneTimeOrderListParams params) throws ChargebeeException { - return get("/omnichannel_one_time_orders", params != null ? params.toQueryParams() : null); + return get( + "omnichannelOneTimeOrder", + "list", + "/omnichannel_one_time_orders", + params != null ? params.toQueryParams() : null); } /** @@ -69,7 +73,7 @@ Response listRaw(OmnichannelOneTimeOrderListParams params) throws ChargebeeExcep */ Response listRaw() throws ChargebeeException { - return get("/omnichannel_one_time_orders", null); + return get("omnichannelOneTimeOrder", "list", "/omnichannel_one_time_orders", null); } /** @@ -93,7 +97,11 @@ public OmnichannelOneTimeOrderListResponse list(OmnichannelOneTimeOrderListParam public CompletableFuture listAsync( OmnichannelOneTimeOrderListParams params) { - return getAsync("/omnichannel_one_time_orders", params != null ? params.toQueryParams() : null) + return getAsync( + "omnichannelOneTimeOrder", + "list", + "/omnichannel_one_time_orders", + params != null ? params.toQueryParams() : null) .thenApply( response -> OmnichannelOneTimeOrderListResponse.fromJson( @@ -110,7 +118,7 @@ public OmnichannelOneTimeOrderListResponse list() throws ChargebeeException { /** Async variant of list for omnichannelOneTimeOrder without params. */ public CompletableFuture listAsync() { - return getAsync("/omnichannel_one_time_orders", null) + return getAsync("omnichannelOneTimeOrder", "list", "/omnichannel_one_time_orders", null) .thenApply( response -> OmnichannelOneTimeOrderListResponse.fromJson( @@ -125,7 +133,7 @@ Response retrieveRaw(String omnichannelOneTimeOrderId) throws ChargebeeException "omnichannel-one-time-order-id", omnichannelOneTimeOrderId); - return get(path, null); + return get("omnichannelOneTimeOrder", "retrieve", path, null); } public OmnichannelOneTimeOrderRetrieveResponse retrieve(String omnichannelOneTimeOrderId) @@ -143,7 +151,7 @@ public CompletableFuture retrieveAsync( "omnichannel-one-time-order-id", omnichannelOneTimeOrderId); - return getAsync(path, null) + return getAsync("omnichannelOneTimeOrder", "retrieve", path, null) .thenApply( response -> OmnichannelOneTimeOrderRetrieveResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionItemService.java b/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionItemService.java index 2db0c4e70..dabb93ace 100644 --- a/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionItemService.java +++ b/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionItemService.java @@ -66,7 +66,11 @@ Response listOmniSubscriptionItemScheduleChangesRaw( "/omnichannel_subscription_items/{omnichannel-subscription-item-id}/scheduled_changes", "omnichannel-subscription-item-id", omnichannelSubscriptionItemId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "omnichannelSubscriptionItem", + "listOmniSubscriptionItemScheduleChanges", + path, + params != null ? params.toQueryParams() : null); } /** @@ -80,7 +84,8 @@ Response listOmniSubscriptionItemScheduleChangesRaw(String omnichannelSubscripti "/omnichannel_subscription_items/{omnichannel-subscription-item-id}/scheduled_changes", "omnichannel-subscription-item-id", omnichannelSubscriptionItemId); - return get(path, null); + return get( + "omnichannelSubscriptionItem", "listOmniSubscriptionItemScheduleChanges", path, null); } /** @@ -130,7 +135,11 @@ Response listOmniSubscriptionItemScheduleChangesRaw( "/omnichannel_subscription_items/{omnichannel-subscription-item-id}/scheduled_changes", "omnichannel-subscription-item-id", omnichannelSubscriptionItemId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "omnichannelSubscriptionItem", + "listOmniSubscriptionItemScheduleChanges", + path, + params != null ? params.toQueryParams() : null) .thenApply( response -> OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesResponse.fromJson( @@ -153,7 +162,8 @@ Response listOmniSubscriptionItemScheduleChangesRaw( "/omnichannel_subscription_items/{omnichannel-subscription-item-id}/scheduled_changes", "omnichannel-subscription-item-id", omnichannelSubscriptionItemId); - return getAsync(path, null) + return getAsync( + "omnichannelSubscriptionItem", "listOmniSubscriptionItemScheduleChanges", path, null) .thenApply( response -> OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionService.java b/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionService.java index 37e63871e..60862b39b 100644 --- a/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionService.java +++ b/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionService.java @@ -71,7 +71,7 @@ Response moveRaw(String omnichannelSubscriptionId) throws ChargebeeException { "omnichannel-subscription-id", omnichannelSubscriptionId); - return post(path, null); + return post("omnichannelSubscription", "move", path, null); } /** @@ -85,7 +85,7 @@ Response moveRaw(String omnichannelSubscriptionId, OmnichannelSubscriptionMovePa "/omnichannel_subscriptions/{omnichannel-subscription-id}/move", "omnichannel-subscription-id", omnichannelSubscriptionId); - return post(path, params.toFormData()); + return post("omnichannelSubscription", "move", path, params.toFormData()); } /** @@ -98,7 +98,7 @@ Response moveRaw(String omnichannelSubscriptionId, String jsonPayload) throws Ch "/omnichannel_subscriptions/{omnichannel-subscription-id}/move", "omnichannel-subscription-id", omnichannelSubscriptionId); - return postJson(path, jsonPayload); + return postJson("omnichannelSubscription", "move", path, jsonPayload); } public OmnichannelSubscriptionMoveResponse move( @@ -116,7 +116,7 @@ public CompletableFuture moveAsync( "/omnichannel_subscriptions/{omnichannel-subscription-id}/move", "omnichannel-subscription-id", omnichannelSubscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("omnichannelSubscription", "move", path, params.toFormData()) .thenApply( response -> OmnichannelSubscriptionMoveResponse.fromJson(response.getBodyAsString(), response)); @@ -130,7 +130,7 @@ Response retrieveRaw(String omnichannelSubscriptionId) throws ChargebeeException "omnichannel-subscription-id", omnichannelSubscriptionId); - return get(path, null); + return get("omnichannelSubscription", "retrieve", path, null); } public OmnichannelSubscriptionRetrieveResponse retrieve(String omnichannelSubscriptionId) @@ -148,7 +148,7 @@ public CompletableFuture retrieveAsync( "omnichannel-subscription-id", omnichannelSubscriptionId); - return getAsync(path, null) + return getAsync("omnichannelSubscription", "retrieve", path, null) .thenApply( response -> OmnichannelSubscriptionRetrieveResponse.fromJson( @@ -168,7 +168,11 @@ Response omnichannelTransactionsForOmnichannelSubscriptionRaw( "/omnichannel_subscriptions/{omnichannel-subscription-id}/omnichannel_transactions", "omnichannel-subscription-id", omnichannelSubscriptionId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "omnichannelSubscription", + "omnichannelTransactionsForOmnichannelSubscription", + path, + params != null ? params.toQueryParams() : null); } /** @@ -182,7 +186,8 @@ Response omnichannelTransactionsForOmnichannelSubscriptionRaw(String omnichannel "/omnichannel_subscriptions/{omnichannel-subscription-id}/omnichannel_transactions", "omnichannel-subscription-id", omnichannelSubscriptionId); - return get(path, null); + return get( + "omnichannelSubscription", "omnichannelTransactionsForOmnichannelSubscription", path, null); } /** @@ -232,7 +237,11 @@ Response omnichannelTransactionsForOmnichannelSubscriptionRaw( "/omnichannel_subscriptions/{omnichannel-subscription-id}/omnichannel_transactions", "omnichannel-subscription-id", omnichannelSubscriptionId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "omnichannelSubscription", + "omnichannelTransactionsForOmnichannelSubscription", + path, + params != null ? params.toQueryParams() : null) .thenApply( response -> OmnichannelTransactionsForOmnichannelSubscriptionResponse.fromJson( @@ -250,7 +259,11 @@ Response omnichannelTransactionsForOmnichannelSubscriptionRaw( "/omnichannel_subscriptions/{omnichannel-subscription-id}/omnichannel_transactions", "omnichannel-subscription-id", omnichannelSubscriptionId); - return getAsync(path, null) + return getAsync( + "omnichannelSubscription", + "omnichannelTransactionsForOmnichannelSubscription", + path, + null) .thenApply( response -> OmnichannelTransactionsForOmnichannelSubscriptionResponse.fromJson( @@ -263,7 +276,11 @@ Response omnichannelTransactionsForOmnichannelSubscriptionRaw( */ Response listRaw(OmnichannelSubscriptionListParams params) throws ChargebeeException { - return get("/omnichannel_subscriptions", params != null ? params.toQueryParams() : null); + return get( + "omnichannelSubscription", + "list", + "/omnichannel_subscriptions", + params != null ? params.toQueryParams() : null); } /** @@ -271,7 +288,7 @@ Response listRaw(OmnichannelSubscriptionListParams params) throws ChargebeeExcep */ Response listRaw() throws ChargebeeException { - return get("/omnichannel_subscriptions", null); + return get("omnichannelSubscription", "list", "/omnichannel_subscriptions", null); } /** @@ -295,7 +312,11 @@ public OmnichannelSubscriptionListResponse list(OmnichannelSubscriptionListParam public CompletableFuture listAsync( OmnichannelSubscriptionListParams params) { - return getAsync("/omnichannel_subscriptions", params != null ? params.toQueryParams() : null) + return getAsync( + "omnichannelSubscription", + "list", + "/omnichannel_subscriptions", + params != null ? params.toQueryParams() : null) .thenApply( response -> OmnichannelSubscriptionListResponse.fromJson( @@ -312,7 +333,7 @@ public OmnichannelSubscriptionListResponse list() throws ChargebeeException { /** Async variant of list for omnichannelSubscription without params. */ public CompletableFuture listAsync() { - return getAsync("/omnichannel_subscriptions", null) + return getAsync("omnichannelSubscription", "list", "/omnichannel_subscriptions", null) .thenApply( response -> OmnichannelSubscriptionListResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/OrderService.java b/src/main/java/com/chargebee/v4/services/OrderService.java index 8d16fe94e..366f60883 100644 --- a/src/main/java/com/chargebee/v4/services/OrderService.java +++ b/src/main/java/com/chargebee/v4/services/OrderService.java @@ -92,13 +92,13 @@ public OrderService withOptions(RequestOptions options) { /** list a order using immutable params (executes immediately) - returns raw Response. */ Response listRaw(OrderListParams params) throws ChargebeeException { - return get("/orders", params != null ? params.toQueryParams() : null); + return get("order", "list", "/orders", params != null ? params.toQueryParams() : null); } /** list a order without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/orders", null); + return get("order", "list", "/orders", null); } /** list a order using raw JSON payload (executes immediately) - returns raw Response. */ @@ -116,7 +116,7 @@ public OrderListResponse list(OrderListParams params) throws ChargebeeException /** Async variant of list for order with params. */ public CompletableFuture listAsync(OrderListParams params) { - return getAsync("/orders", params != null ? params.toQueryParams() : null) + return getAsync("order", "list", "/orders", params != null ? params.toQueryParams() : null) .thenApply( response -> OrderListResponse.fromJson(response.getBodyAsString(), this, params, response)); @@ -131,7 +131,7 @@ public OrderListResponse list() throws ChargebeeException { /** Async variant of list for order without params. */ public CompletableFuture listAsync() { - return getAsync("/orders", null) + return getAsync("order", "list", "/orders", null) .thenApply( response -> OrderListResponse.fromJson(response.getBodyAsString(), this, null, response)); @@ -140,13 +140,13 @@ public CompletableFuture listAsync() { /** create a order using immutable params (executes immediately) - returns raw Response. */ Response createRaw(OrderCreateParams params) throws ChargebeeException { - return post("/orders", params != null ? params.toFormData() : null); + return post("order", "create", "/orders", params != null ? params.toFormData() : null); } /** create a order using raw JSON payload (executes immediately) - returns raw Response. */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/orders", jsonPayload); + return postJson("order", "create", "/orders", jsonPayload); } public OrderCreateResponse create(OrderCreateParams params) throws ChargebeeException { @@ -158,20 +158,24 @@ public OrderCreateResponse create(OrderCreateParams params) throws ChargebeeExce /** Async variant of create for order with params. */ public CompletableFuture createAsync(OrderCreateParams params) { - return postAsync("/orders", params != null ? params.toFormData() : null) + return postAsync("order", "create", "/orders", params != null ? params.toFormData() : null) .thenApply(response -> OrderCreateResponse.fromJson(response.getBodyAsString(), response)); } /** importOrder a order using immutable params (executes immediately) - returns raw Response. */ Response importOrderRaw(ImportOrderParams params) throws ChargebeeException { - return post("/orders/import_order", params != null ? params.toFormData() : null); + return post( + "order", + "importOrder", + "/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 ChargebeeException { - return postJson("/orders/import_order", jsonPayload); + return postJson("order", "importOrder", "/orders/import_order", jsonPayload); } public ImportOrderResponse importOrder(ImportOrderParams params) throws ChargebeeException { @@ -183,7 +187,11 @@ public ImportOrderResponse importOrder(ImportOrderParams params) throws Chargebe /** Async variant of importOrder for order with params. */ public CompletableFuture importOrderAsync(ImportOrderParams params) { - return postAsync("/orders/import_order", params != null ? params.toFormData() : null) + return postAsync( + "order", + "importOrder", + "/orders/import_order", + params != null ? params.toFormData() : null) .thenApply(response -> ImportOrderResponse.fromJson(response.getBodyAsString(), response)); } @@ -192,7 +200,7 @@ Response assignOrderNumberRaw(String orderId) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}/assign_order_number", "order-id", orderId); - return post(path, null); + return post("order", "assignOrderNumber", path, null); } public AssignOrderNumberResponse assignOrderNumber(String orderId) throws ChargebeeException { @@ -205,7 +213,7 @@ public CompletableFuture assignOrderNumberAsync(Strin String path = buildPathWithParams("/orders/{order-id}/assign_order_number", "order-id", orderId); - return postAsync(path, null) + return postAsync("order", "assignOrderNumber", path, null) .thenApply( response -> AssignOrderNumberResponse.fromJson(response.getBodyAsString(), response)); } @@ -214,19 +222,19 @@ public CompletableFuture assignOrderNumberAsync(Strin Response resendRaw(String orderId) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}/resend", "order-id", orderId); - return post(path, null); + return post("order", "resend", path, null); } /** 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()); + return post("order", "resend", path, params.toFormData()); } /** 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); + return postJson("order", "resend", path, jsonPayload); } public OrderResendResponse resend(String orderId, OrderResendParams params) @@ -239,7 +247,7 @@ public OrderResendResponse resend(String orderId, OrderResendParams params) public CompletableFuture resendAsync( String orderId, OrderResendParams params) { String path = buildPathWithParams("/orders/{order-id}/resend", "order-id", orderId); - return postAsync(path, params.toFormData()) + return postAsync("order", "resend", path, params.toFormData()) .thenApply(response -> OrderResendResponse.fromJson(response.getBodyAsString(), response)); } @@ -252,7 +260,7 @@ public OrderResendResponse resend(String orderId) throws ChargebeeException { public CompletableFuture resendAsync(String orderId) { String path = buildPathWithParams("/orders/{order-id}/resend", "order-id", orderId); - return postAsync(path, null) + return postAsync("order", "resend", path, null) .thenApply(response -> OrderResendResponse.fromJson(response.getBodyAsString(), response)); } @@ -260,19 +268,19 @@ public CompletableFuture resendAsync(String orderId) { Response reopenRaw(String orderId) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}/reopen", "order-id", orderId); - return post(path, null); + return post("order", "reopen", path, null); } /** 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()); + return post("order", "reopen", path, params.toFormData()); } /** 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); + return postJson("order", "reopen", path, jsonPayload); } public OrderReopenResponse reopen(String orderId, OrderReopenParams params) @@ -285,7 +293,7 @@ public OrderReopenResponse reopen(String orderId, OrderReopenParams params) public CompletableFuture reopenAsync( String orderId, OrderReopenParams params) { String path = buildPathWithParams("/orders/{order-id}/reopen", "order-id", orderId); - return postAsync(path, params.toFormData()) + return postAsync("order", "reopen", path, params.toFormData()) .thenApply(response -> OrderReopenResponse.fromJson(response.getBodyAsString(), response)); } @@ -298,7 +306,7 @@ public OrderReopenResponse reopen(String orderId) throws ChargebeeException { public CompletableFuture reopenAsync(String orderId) { String path = buildPathWithParams("/orders/{order-id}/reopen", "order-id", orderId); - return postAsync(path, null) + return postAsync("order", "reopen", path, null) .thenApply(response -> OrderReopenResponse.fromJson(response.getBodyAsString(), response)); } @@ -308,13 +316,13 @@ public CompletableFuture reopenAsync(String orderId) { 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); + return get("order", "ordersForInvoice", path, params != null ? params.toQueryParams() : null); } /** ordersForInvoice a order without params (executes immediately) - returns raw Response. */ Response ordersForInvoiceRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/orders", "invoice-id", invoiceId); - return get(path, null); + return get("order", "ordersForInvoice", path, null); } /** @@ -342,7 +350,8 @@ public OrdersForInvoiceResponse ordersForInvoice(String invoiceId) throws Charge public CompletableFuture ordersForInvoiceAsync( String invoiceId, OrdersForInvoiceParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/orders", "invoice-id", invoiceId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "order", "ordersForInvoice", path, params != null ? params.toQueryParams() : null) .thenApply( response -> OrdersForInvoiceResponse.fromJson( @@ -352,7 +361,7 @@ public CompletableFuture ordersForInvoiceAsync( /** Async variant of ordersForInvoice for order without params. */ public CompletableFuture ordersForInvoiceAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/orders", "invoice-id", invoiceId); - return getAsync(path, null) + return getAsync("order", "ordersForInvoice", path, null) .thenApply( response -> OrdersForInvoiceResponse.fromJson( @@ -363,19 +372,19 @@ public CompletableFuture ordersForInvoiceAsync(String Response cancelRaw(String orderId) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}/cancel", "order-id", orderId); - return post(path, null); + return post("order", "cancel", path, null); } /** 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()); + return post("order", "cancel", path, params.toFormData()); } /** 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); + return postJson("order", "cancel", path, jsonPayload); } public OrderCancelResponse cancel(String orderId, OrderCancelParams params) @@ -388,7 +397,7 @@ public OrderCancelResponse cancel(String orderId, OrderCancelParams params) public CompletableFuture cancelAsync( String orderId, OrderCancelParams params) { String path = buildPathWithParams("/orders/{order-id}/cancel", "order-id", orderId); - return postAsync(path, params.toFormData()) + return postAsync("order", "cancel", path, params.toFormData()) .thenApply(response -> OrderCancelResponse.fromJson(response.getBodyAsString(), response)); } @@ -396,7 +405,7 @@ public CompletableFuture cancelAsync( Response retrieveRaw(String orderId) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}", "order-id", orderId); - return get(path, null); + return get("order", "retrieve", path, null); } public OrderRetrieveResponse retrieve(String orderId) throws ChargebeeException { @@ -408,7 +417,7 @@ public OrderRetrieveResponse retrieve(String orderId) throws ChargebeeException public CompletableFuture retrieveAsync(String orderId) { String path = buildPathWithParams("/orders/{order-id}", "order-id", orderId); - return getAsync(path, null) + return getAsync("order", "retrieve", path, null) .thenApply( response -> OrderRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -417,19 +426,19 @@ public CompletableFuture retrieveAsync(String orderId) { Response updateRaw(String orderId) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}", "order-id", orderId); - return post(path, null); + return post("order", "update", path, null); } /** update a order using immutable params (executes immediately) - returns raw Response. */ Response updateRaw(String orderId, OrderUpdateParams params) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}", "order-id", orderId); - return post(path, params.toFormData()); + return post("order", "update", path, params.toFormData()); } /** update a order using raw JSON payload (executes immediately) - returns raw Response. */ Response updateRaw(String orderId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}", "order-id", orderId); - return postJson(path, jsonPayload); + return postJson("order", "update", path, jsonPayload); } public OrderUpdateResponse update(String orderId, OrderUpdateParams params) @@ -442,7 +451,7 @@ public OrderUpdateResponse update(String orderId, OrderUpdateParams params) public CompletableFuture updateAsync( String orderId, OrderUpdateParams params) { String path = buildPathWithParams("/orders/{order-id}", "order-id", orderId); - return postAsync(path, params.toFormData()) + return postAsync("order", "update", path, params.toFormData()) .thenApply(response -> OrderUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -455,7 +464,7 @@ public OrderUpdateResponse update(String orderId) throws ChargebeeException { public CompletableFuture updateAsync(String orderId) { String path = buildPathWithParams("/orders/{order-id}", "order-id", orderId); - return postAsync(path, null) + return postAsync("order", "update", path, null) .thenApply(response -> OrderUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -463,7 +472,7 @@ public CompletableFuture updateAsync(String orderId) { Response deleteRaw(String orderId) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}/delete", "order-id", orderId); - return post(path, null); + return post("order", "delete", path, null); } public OrderDeleteResponse delete(String orderId) throws ChargebeeException { @@ -475,7 +484,7 @@ public OrderDeleteResponse delete(String orderId) throws ChargebeeException { public CompletableFuture deleteAsync(String orderId) { String path = buildPathWithParams("/orders/{order-id}/delete", "order-id", orderId); - return postAsync(path, null) + return postAsync("order", "delete", path, null) .thenApply(response -> OrderDeleteResponse.fromJson(response.getBodyAsString(), response)); } @@ -485,7 +494,7 @@ Response createRefundableCreditNoteRaw(String orderId) throws ChargebeeException buildPathWithParams( "/orders/{order-id}/create_refundable_credit_note", "order-id", orderId); - return post(path, null); + return post("order", "createRefundableCreditNote", path, null); } /** @@ -497,7 +506,7 @@ Response createRefundableCreditNoteRaw( String path = buildPathWithParams( "/orders/{order-id}/create_refundable_credit_note", "order-id", orderId); - return post(path, params.toFormData()); + return post("order", "createRefundableCreditNote", path, params.toFormData()); } /** @@ -509,7 +518,7 @@ Response createRefundableCreditNoteRaw(String orderId, String jsonPayload) String path = buildPathWithParams( "/orders/{order-id}/create_refundable_credit_note", "order-id", orderId); - return postJson(path, jsonPayload); + return postJson("order", "createRefundableCreditNote", path, jsonPayload); } public OrderCreateRefundableCreditNoteResponse createRefundableCreditNote( @@ -524,7 +533,7 @@ public CompletableFuture createRefundab String path = buildPathWithParams( "/orders/{order-id}/create_refundable_credit_note", "order-id", orderId); - return postAsync(path, params.toFormData()) + return postAsync("order", "createRefundableCreditNote", path, params.toFormData()) .thenApply( response -> OrderCreateRefundableCreditNoteResponse.fromJson( @@ -544,7 +553,7 @@ public CompletableFuture createRefundab buildPathWithParams( "/orders/{order-id}/create_refundable_credit_note", "order-id", orderId); - return postAsync(path, null) + return postAsync("order", "createRefundableCreditNote", path, null) .thenApply( response -> OrderCreateRefundableCreditNoteResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/PaymentIntentService.java b/src/main/java/com/chargebee/v4/services/PaymentIntentService.java index 6f753e29b..290759766 100644 --- a/src/main/java/com/chargebee/v4/services/PaymentIntentService.java +++ b/src/main/java/com/chargebee/v4/services/PaymentIntentService.java @@ -64,7 +64,7 @@ Response retrieveRaw(String paymentIntentId) throws ChargebeeException { buildPathWithParams( "/payment_intents/{payment-intent-id}", "payment-intent-id", paymentIntentId); - return get(path, null); + return get("paymentIntent", "retrieve", path, null); } public PaymentIntentRetrieveResponse retrieve(String paymentIntentId) throws ChargebeeException { @@ -78,7 +78,7 @@ public CompletableFuture retrieveAsync(String pay buildPathWithParams( "/payment_intents/{payment-intent-id}", "payment-intent-id", paymentIntentId); - return getAsync(path, null) + return getAsync("paymentIntent", "retrieve", path, null) .thenApply( response -> PaymentIntentRetrieveResponse.fromJson(response.getBodyAsString(), response)); @@ -90,7 +90,7 @@ Response updateRaw(String paymentIntentId) throws ChargebeeException { buildPathWithParams( "/payment_intents/{payment-intent-id}", "payment-intent-id", paymentIntentId); - return post(path, null); + return post("paymentIntent", "update", path, null); } /** @@ -101,7 +101,7 @@ Response updateRaw(String paymentIntentId, PaymentIntentUpdateParams params) String path = buildPathWithParams( "/payment_intents/{payment-intent-id}", "payment-intent-id", paymentIntentId); - return post(path, params.toFormData()); + return post("paymentIntent", "update", path, params.toFormData()); } /** @@ -111,7 +111,7 @@ Response updateRaw(String paymentIntentId, String jsonPayload) throws ChargebeeE String path = buildPathWithParams( "/payment_intents/{payment-intent-id}", "payment-intent-id", paymentIntentId); - return postJson(path, jsonPayload); + return postJson("paymentIntent", "update", path, jsonPayload); } public PaymentIntentUpdateResponse update( @@ -126,7 +126,7 @@ public CompletableFuture updateAsync( String path = buildPathWithParams( "/payment_intents/{payment-intent-id}", "payment-intent-id", paymentIntentId); - return postAsync(path, params.toFormData()) + return postAsync("paymentIntent", "update", path, params.toFormData()) .thenApply( response -> PaymentIntentUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -142,7 +142,7 @@ public CompletableFuture updateAsync(String payment buildPathWithParams( "/payment_intents/{payment-intent-id}", "payment-intent-id", paymentIntentId); - return postAsync(path, null) + return postAsync("paymentIntent", "update", path, null) .thenApply( response -> PaymentIntentUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -152,7 +152,8 @@ public CompletableFuture updateAsync(String payment */ Response createRaw(PaymentIntentCreateParams params) throws ChargebeeException { - return post("/payment_intents", params != null ? params.toFormData() : null); + return post( + "paymentIntent", "create", "/payment_intents", params != null ? params.toFormData() : null); } /** @@ -160,7 +161,7 @@ Response createRaw(PaymentIntentCreateParams params) throws ChargebeeException { */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/payment_intents", jsonPayload); + return postJson("paymentIntent", "create", "/payment_intents", jsonPayload); } public PaymentIntentCreateResponse create(PaymentIntentCreateParams params) @@ -174,7 +175,11 @@ public PaymentIntentCreateResponse create(PaymentIntentCreateParams params) public CompletableFuture createAsync( PaymentIntentCreateParams params) { - return postAsync("/payment_intents", params != null ? params.toFormData() : null) + return postAsync( + "paymentIntent", + "create", + "/payment_intents", + params != null ? params.toFormData() : null) .thenApply( response -> 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 72908e1f4..a719cf3cf 100644 --- a/src/main/java/com/chargebee/v4/services/PaymentScheduleSchemeService.java +++ b/src/main/java/com/chargebee/v4/services/PaymentScheduleSchemeService.java @@ -64,7 +64,7 @@ Response retrieveRaw(String paymentScheduleSchemeId) throws ChargebeeException { "payment-schedule-scheme-id", paymentScheduleSchemeId); - return get(path, null); + return get("paymentScheduleScheme", "retrieve", path, null); } public PaymentScheduleSchemeRetrieveResponse retrieve(String paymentScheduleSchemeId) @@ -82,7 +82,7 @@ public CompletableFuture retrieveAsync( "payment-schedule-scheme-id", paymentScheduleSchemeId); - return getAsync(path, null) + return getAsync("paymentScheduleScheme", "retrieve", path, null) .thenApply( response -> PaymentScheduleSchemeRetrieveResponse.fromJson( @@ -95,7 +95,11 @@ public CompletableFuture retrieveAsync( */ Response createRaw(PaymentScheduleSchemeCreateParams params) throws ChargebeeException { - return post("/payment_schedule_schemes", params != null ? params.toFormData() : null); + return post( + "paymentScheduleScheme", + "create", + "/payment_schedule_schemes", + params != null ? params.toFormData() : null); } /** @@ -104,7 +108,7 @@ Response createRaw(PaymentScheduleSchemeCreateParams params) throws ChargebeeExc */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/payment_schedule_schemes", jsonPayload); + return postJson("paymentScheduleScheme", "create", "/payment_schedule_schemes", jsonPayload); } public PaymentScheduleSchemeCreateResponse create(PaymentScheduleSchemeCreateParams params) @@ -118,7 +122,11 @@ public PaymentScheduleSchemeCreateResponse create(PaymentScheduleSchemeCreatePar public CompletableFuture createAsync( PaymentScheduleSchemeCreateParams params) { - return postAsync("/payment_schedule_schemes", params != null ? params.toFormData() : null) + return postAsync( + "paymentScheduleScheme", + "create", + "/payment_schedule_schemes", + params != null ? params.toFormData() : null) .thenApply( response -> PaymentScheduleSchemeCreateResponse.fromJson(response.getBodyAsString(), response)); @@ -132,7 +140,7 @@ Response deleteRaw(String paymentScheduleSchemeId) throws ChargebeeException { "payment-schedule-scheme-id", paymentScheduleSchemeId); - return post(path, null); + return post("paymentScheduleScheme", "delete", path, null); } public PaymentScheduleSchemeDeleteResponse delete(String paymentScheduleSchemeId) @@ -150,7 +158,7 @@ public CompletableFuture deleteAsync( "payment-schedule-scheme-id", paymentScheduleSchemeId); - return postAsync(path, null) + return postAsync("paymentScheduleScheme", "delete", path, null) .thenApply( response -> 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 d131a3f45..3cd692967 100644 --- a/src/main/java/com/chargebee/v4/services/PaymentSourceService.java +++ b/src/main/java/com/chargebee/v4/services/PaymentSourceService.java @@ -116,6 +116,8 @@ Response createUsingPermanentTokenRaw(PaymentSourceCreateUsingPermanentTokenPara throws ChargebeeException { return post( + "paymentSource", + "createUsingPermanentToken", "/payment_sources/create_using_permanent_token", params != null ? params.toFormData() : null); } @@ -126,7 +128,11 @@ Response createUsingPermanentTokenRaw(PaymentSourceCreateUsingPermanentTokenPara */ Response createUsingPermanentTokenRaw(String jsonPayload) throws ChargebeeException { - return postJson("/payment_sources/create_using_permanent_token", jsonPayload); + return postJson( + "paymentSource", + "createUsingPermanentToken", + "/payment_sources/create_using_permanent_token", + jsonPayload); } public PaymentSourceCreateUsingPermanentTokenResponse createUsingPermanentToken( @@ -142,6 +148,8 @@ public PaymentSourceCreateUsingPermanentTokenResponse createUsingPermanentToken( createUsingPermanentTokenAsync(PaymentSourceCreateUsingPermanentTokenParams params) { return postAsync( + "paymentSource", + "createUsingPermanentToken", "/payment_sources/create_using_permanent_token", params != null ? params.toFormData() : null) .thenApply( @@ -158,7 +166,7 @@ Response deleteRaw(String custPaymentSourceId) throws ChargebeeException { "cust-payment-source-id", custPaymentSourceId); - return post(path, null); + return post("paymentSource", "delete", path, null); } public PaymentSourceDeleteResponse delete(String custPaymentSourceId) throws ChargebeeException { @@ -174,7 +182,7 @@ public CompletableFuture deleteAsync(String custPay "cust-payment-source-id", custPaymentSourceId); - return postAsync(path, null) + return postAsync("paymentSource", "delete", path, null) .thenApply( response -> PaymentSourceDeleteResponse.fromJson(response.getBodyAsString(), response)); } @@ -185,7 +193,11 @@ public CompletableFuture deleteAsync(String custPay */ Response createCardRaw(PaymentSourceCreateCardParams params) throws ChargebeeException { - return post("/payment_sources/create_card", params != null ? params.toFormData() : null); + return post( + "paymentSource", + "createCard", + "/payment_sources/create_card", + params != null ? params.toFormData() : null); } /** @@ -194,7 +206,7 @@ Response createCardRaw(PaymentSourceCreateCardParams params) throws ChargebeeExc */ Response createCardRaw(String jsonPayload) throws ChargebeeException { - return postJson("/payment_sources/create_card", jsonPayload); + return postJson("paymentSource", "createCard", "/payment_sources/create_card", jsonPayload); } public PaymentSourceCreateCardResponse createCard(PaymentSourceCreateCardParams params) @@ -208,7 +220,11 @@ public PaymentSourceCreateCardResponse createCard(PaymentSourceCreateCardParams public CompletableFuture createCardAsync( PaymentSourceCreateCardParams params) { - return postAsync("/payment_sources/create_card", params != null ? params.toFormData() : null) + return postAsync( + "paymentSource", + "createCard", + "/payment_sources/create_card", + params != null ? params.toFormData() : null) .thenApply( response -> PaymentSourceCreateCardResponse.fromJson(response.getBodyAsString(), response)); @@ -222,7 +238,7 @@ Response verifyBankAccountRaw(String custPaymentSourceId) throws ChargebeeExcept "cust-payment-source-id", custPaymentSourceId); - return post(path, null); + return post("paymentSource", "verifyBankAccount", path, null); } /** @@ -237,7 +253,7 @@ Response verifyBankAccountRaw( "/payment_sources/{cust-payment-source-id}/verify_bank_account", "cust-payment-source-id", custPaymentSourceId); - return post(path, params.toFormData()); + return post("paymentSource", "verifyBankAccount", path, params.toFormData()); } /** @@ -251,7 +267,7 @@ Response verifyBankAccountRaw(String custPaymentSourceId, String jsonPayload) "/payment_sources/{cust-payment-source-id}/verify_bank_account", "cust-payment-source-id", custPaymentSourceId); - return postJson(path, jsonPayload); + return postJson("paymentSource", "verifyBankAccount", path, jsonPayload); } public PaymentSourceVerifyBankAccountResponse verifyBankAccount( @@ -269,7 +285,7 @@ public CompletableFuture verifyBankAccou "/payment_sources/{cust-payment-source-id}/verify_bank_account", "cust-payment-source-id", custPaymentSourceId); - return postAsync(path, params.toFormData()) + return postAsync("paymentSource", "verifyBankAccount", path, params.toFormData()) .thenApply( response -> PaymentSourceVerifyBankAccountResponse.fromJson( @@ -279,13 +295,17 @@ public CompletableFuture verifyBankAccou /** list a paymentSource using immutable params (executes immediately) - returns raw Response. */ Response listRaw(PaymentSourceListParams params) throws ChargebeeException { - return get("/payment_sources", params != null ? params.toQueryParams() : null); + return get( + "paymentSource", + "list", + "/payment_sources", + params != null ? params.toQueryParams() : null); } /** list a paymentSource without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/payment_sources", null); + return get("paymentSource", "list", "/payment_sources", null); } /** list a paymentSource using raw JSON payload (executes immediately) - returns raw Response. */ @@ -303,7 +323,11 @@ public PaymentSourceListResponse list(PaymentSourceListParams params) throws Cha /** Async variant of list for paymentSource with params. */ public CompletableFuture listAsync(PaymentSourceListParams params) { - return getAsync("/payment_sources", params != null ? params.toQueryParams() : null) + return getAsync( + "paymentSource", + "list", + "/payment_sources", + params != null ? params.toQueryParams() : null) .thenApply( response -> PaymentSourceListResponse.fromJson( @@ -319,7 +343,7 @@ public PaymentSourceListResponse list() throws ChargebeeException { /** Async variant of list for paymentSource without params. */ public CompletableFuture listAsync() { - return getAsync("/payment_sources", null) + return getAsync("paymentSource", "list", "/payment_sources", null) .thenApply( response -> PaymentSourceListResponse.fromJson( @@ -334,7 +358,7 @@ Response exportPaymentSourceRaw(String custPaymentSourceId) throws ChargebeeExce "cust-payment-source-id", custPaymentSourceId); - return post(path, null); + return post("paymentSource", "exportPaymentSource", path, null); } /** @@ -348,7 +372,7 @@ Response exportPaymentSourceRaw(String custPaymentSourceId, ExportPaymentSourceP "/payment_sources/{cust-payment-source-id}/export_payment_source", "cust-payment-source-id", custPaymentSourceId); - return post(path, params.toFormData()); + return post("paymentSource", "exportPaymentSource", path, params.toFormData()); } /** @@ -362,7 +386,7 @@ Response exportPaymentSourceRaw(String custPaymentSourceId, String jsonPayload) "/payment_sources/{cust-payment-source-id}/export_payment_source", "cust-payment-source-id", custPaymentSourceId); - return postJson(path, jsonPayload); + return postJson("paymentSource", "exportPaymentSource", path, jsonPayload); } public ExportPaymentSourceResponse exportPaymentSource( @@ -379,7 +403,7 @@ public CompletableFuture exportPaymentSourceAsync( "/payment_sources/{cust-payment-source-id}/export_payment_source", "cust-payment-source-id", custPaymentSourceId); - return postAsync(path, params.toFormData()) + return postAsync("paymentSource", "exportPaymentSource", path, params.toFormData()) .thenApply( response -> ExportPaymentSourceResponse.fromJson(response.getBodyAsString(), response)); } @@ -392,6 +416,8 @@ Response createUsingPaymentIntentRaw(PaymentSourceCreateUsingPaymentIntentParams throws ChargebeeException { return post( + "paymentSource", + "createUsingPaymentIntent", "/payment_sources/create_using_payment_intent", params != null ? params.toFormData() : null); } @@ -402,7 +428,11 @@ Response createUsingPaymentIntentRaw(PaymentSourceCreateUsingPaymentIntentParams */ Response createUsingPaymentIntentRaw(String jsonPayload) throws ChargebeeException { - return postJson("/payment_sources/create_using_payment_intent", jsonPayload); + return postJson( + "paymentSource", + "createUsingPaymentIntent", + "/payment_sources/create_using_payment_intent", + jsonPayload); } public PaymentSourceCreateUsingPaymentIntentResponse createUsingPaymentIntent( @@ -418,6 +448,8 @@ public PaymentSourceCreateUsingPaymentIntentResponse createUsingPaymentIntent( createUsingPaymentIntentAsync(PaymentSourceCreateUsingPaymentIntentParams params) { return postAsync( + "paymentSource", + "createUsingPaymentIntent", "/payment_sources/create_using_payment_intent", params != null ? params.toFormData() : null) .thenApply( @@ -434,7 +466,7 @@ Response agreementPdfRaw(String custPaymentSourceId) throws ChargebeeException { "cust-payment-source-id", custPaymentSourceId); - return post(path, null); + return post("paymentSource", "agreementPdf", path, null); } public PaymentSourceAgreementPdfResponse agreementPdf(String custPaymentSourceId) @@ -452,7 +484,7 @@ public CompletableFuture agreementPdfAsync( "cust-payment-source-id", custPaymentSourceId); - return postAsync(path, null) + return postAsync("paymentSource", "agreementPdf", path, null) .thenApply( response -> PaymentSourceAgreementPdfResponse.fromJson(response.getBodyAsString(), response)); @@ -466,7 +498,7 @@ Response retrieveRaw(String custPaymentSourceId) throws ChargebeeException { "cust-payment-source-id", custPaymentSourceId); - return get(path, null); + return get("paymentSource", "retrieve", path, null); } public PaymentSourceRetrieveResponse retrieve(String custPaymentSourceId) @@ -484,7 +516,7 @@ public CompletableFuture retrieveAsync( "cust-payment-source-id", custPaymentSourceId); - return getAsync(path, null) + return getAsync("paymentSource", "retrieve", path, null) .thenApply( response -> PaymentSourceRetrieveResponse.fromJson(response.getBodyAsString(), response)); @@ -498,6 +530,8 @@ Response createVoucherPaymentSourceRaw(CreateVoucherPaymentSourceParams params) throws ChargebeeException { return post( + "paymentSource", + "createVoucherPaymentSource", "/payment_sources/create_voucher_payment_source", params != null ? params.toFormData() : null); } @@ -508,7 +542,11 @@ Response createVoucherPaymentSourceRaw(CreateVoucherPaymentSourceParams params) */ Response createVoucherPaymentSourceRaw(String jsonPayload) throws ChargebeeException { - return postJson("/payment_sources/create_voucher_payment_source", jsonPayload); + return postJson( + "paymentSource", + "createVoucherPaymentSource", + "/payment_sources/create_voucher_payment_source", + jsonPayload); } public CreateVoucherPaymentSourceResponse createVoucherPaymentSource( @@ -523,6 +561,8 @@ public CompletableFuture createVoucherPaymen CreateVoucherPaymentSourceParams params) { return postAsync( + "paymentSource", + "createVoucherPaymentSource", "/payment_sources/create_voucher_payment_source", params != null ? params.toFormData() : null) .thenApply( @@ -538,7 +578,10 @@ Response createUsingTempTokenRaw(PaymentSourceCreateUsingTempTokenParams params) throws ChargebeeException { return post( - "/payment_sources/create_using_temp_token", params != null ? params.toFormData() : null); + "paymentSource", + "createUsingTempToken", + "/payment_sources/create_using_temp_token", + params != null ? params.toFormData() : null); } /** @@ -547,7 +590,11 @@ Response createUsingTempTokenRaw(PaymentSourceCreateUsingTempTokenParams params) */ Response createUsingTempTokenRaw(String jsonPayload) throws ChargebeeException { - return postJson("/payment_sources/create_using_temp_token", jsonPayload); + return postJson( + "paymentSource", + "createUsingTempToken", + "/payment_sources/create_using_temp_token", + jsonPayload); } public PaymentSourceCreateUsingTempTokenResponse createUsingTempToken( @@ -562,7 +609,10 @@ public CompletableFuture createUsingT PaymentSourceCreateUsingTempTokenParams params) { return postAsync( - "/payment_sources/create_using_temp_token", params != null ? params.toFormData() : null) + "paymentSource", + "createUsingTempToken", + "/payment_sources/create_using_temp_token", + params != null ? params.toFormData() : null) .thenApply( response -> PaymentSourceCreateUsingTempTokenResponse.fromJson( @@ -577,7 +627,7 @@ Response updateCardRaw(String custPaymentSourceId) throws ChargebeeException { "cust-payment-source-id", custPaymentSourceId); - return post(path, null); + return post("paymentSource", "updateCard", path, null); } /** @@ -591,7 +641,7 @@ Response updateCardRaw(String custPaymentSourceId, PaymentSourceUpdateCardParams "/payment_sources/{cust-payment-source-id}/update_card", "cust-payment-source-id", custPaymentSourceId); - return post(path, params.toFormData()); + return post("paymentSource", "updateCard", path, params.toFormData()); } /** @@ -604,7 +654,7 @@ Response updateCardRaw(String custPaymentSourceId, String jsonPayload) throws Ch "/payment_sources/{cust-payment-source-id}/update_card", "cust-payment-source-id", custPaymentSourceId); - return postJson(path, jsonPayload); + return postJson("paymentSource", "updateCard", path, jsonPayload); } public PaymentSourceUpdateCardResponse updateCard( @@ -621,7 +671,7 @@ public CompletableFuture updateCardAsync( "/payment_sources/{cust-payment-source-id}/update_card", "cust-payment-source-id", custPaymentSourceId); - return postAsync(path, params.toFormData()) + return postAsync("paymentSource", "updateCard", path, params.toFormData()) .thenApply( response -> PaymentSourceUpdateCardResponse.fromJson(response.getBodyAsString(), response)); @@ -642,7 +692,7 @@ public CompletableFuture updateCardAsync( "cust-payment-source-id", custPaymentSourceId); - return postAsync(path, null) + return postAsync("paymentSource", "updateCard", path, null) .thenApply( response -> PaymentSourceUpdateCardResponse.fromJson(response.getBodyAsString(), response)); @@ -656,7 +706,7 @@ Response switchGatewayAccountRaw(String custPaymentSourceId) throws ChargebeeExc "cust-payment-source-id", custPaymentSourceId); - return post(path, null); + return post("paymentSource", "switchGatewayAccount", path, null); } /** @@ -671,7 +721,7 @@ Response switchGatewayAccountRaw( "/payment_sources/{cust-payment-source-id}/switch_gateway_account", "cust-payment-source-id", custPaymentSourceId); - return post(path, params.toFormData()); + return post("paymentSource", "switchGatewayAccount", path, params.toFormData()); } /** @@ -685,7 +735,7 @@ Response switchGatewayAccountRaw(String custPaymentSourceId, String jsonPayload) "/payment_sources/{cust-payment-source-id}/switch_gateway_account", "cust-payment-source-id", custPaymentSourceId); - return postJson(path, jsonPayload); + return postJson("paymentSource", "switchGatewayAccount", path, jsonPayload); } public PaymentSourceSwitchGatewayAccountResponse switchGatewayAccount( @@ -703,7 +753,7 @@ public CompletableFuture switchGatewa "/payment_sources/{cust-payment-source-id}/switch_gateway_account", "cust-payment-source-id", custPaymentSourceId); - return postAsync(path, params.toFormData()) + return postAsync("paymentSource", "switchGatewayAccount", path, params.toFormData()) .thenApply( response -> PaymentSourceSwitchGatewayAccountResponse.fromJson( @@ -717,7 +767,11 @@ public CompletableFuture switchGatewa Response createUsingTokenRaw(PaymentSourceCreateUsingTokenParams params) throws ChargebeeException { - return post("/payment_sources/create_using_token", params != null ? params.toFormData() : null); + return post( + "paymentSource", + "createUsingToken", + "/payment_sources/create_using_token", + params != null ? params.toFormData() : null); } /** @@ -726,7 +780,8 @@ Response createUsingTokenRaw(PaymentSourceCreateUsingTokenParams params) */ Response createUsingTokenRaw(String jsonPayload) throws ChargebeeException { - return postJson("/payment_sources/create_using_token", jsonPayload); + return postJson( + "paymentSource", "createUsingToken", "/payment_sources/create_using_token", jsonPayload); } public PaymentSourceCreateUsingTokenResponse createUsingToken( @@ -741,7 +796,10 @@ public CompletableFuture createUsingToken PaymentSourceCreateUsingTokenParams params) { return postAsync( - "/payment_sources/create_using_token", params != null ? params.toFormData() : null) + "paymentSource", + "createUsingToken", + "/payment_sources/create_using_token", + params != null ? params.toFormData() : null) .thenApply( response -> PaymentSourceCreateUsingTokenResponse.fromJson( @@ -756,7 +814,7 @@ Response deleteLocalRaw(String custPaymentSourceId) throws ChargebeeException { "cust-payment-source-id", custPaymentSourceId); - return post(path, null); + return post("paymentSource", "deleteLocal", path, null); } public PaymentSourceDeleteLocalResponse deleteLocal(String custPaymentSourceId) @@ -774,7 +832,7 @@ public CompletableFuture deleteLocalAsync( "cust-payment-source-id", custPaymentSourceId); - return postAsync(path, null) + return postAsync("paymentSource", "deleteLocal", path, null) .thenApply( response -> PaymentSourceDeleteLocalResponse.fromJson(response.getBodyAsString(), response)); @@ -788,7 +846,10 @@ Response createBankAccountRaw(PaymentSourceCreateBankAccountParams params) throws ChargebeeException { return post( - "/payment_sources/create_bank_account", params != null ? params.toFormData() : null); + "paymentSource", + "createBankAccount", + "/payment_sources/create_bank_account", + params != null ? params.toFormData() : null); } /** @@ -797,7 +858,8 @@ Response createBankAccountRaw(PaymentSourceCreateBankAccountParams params) */ Response createBankAccountRaw(String jsonPayload) throws ChargebeeException { - return postJson("/payment_sources/create_bank_account", jsonPayload); + return postJson( + "paymentSource", "createBankAccount", "/payment_sources/create_bank_account", jsonPayload); } public PaymentSourceCreateBankAccountResponse createBankAccount( @@ -812,7 +874,10 @@ public CompletableFuture createBankAccou PaymentSourceCreateBankAccountParams params) { return postAsync( - "/payment_sources/create_bank_account", params != null ? params.toFormData() : null) + "paymentSource", + "createBankAccount", + "/payment_sources/create_bank_account", + params != null ? params.toFormData() : null) .thenApply( response -> PaymentSourceCreateBankAccountResponse.fromJson( @@ -827,7 +892,7 @@ Response updateBankAccountRaw(String custPaymentSourceId) throws ChargebeeExcept "cust-payment-source-id", custPaymentSourceId); - return post(path, null); + return post("paymentSource", "updateBankAccount", path, null); } /** @@ -842,7 +907,7 @@ Response updateBankAccountRaw( "/payment_sources/{cust-payment-source-id}/update_bank_account", "cust-payment-source-id", custPaymentSourceId); - return post(path, params.toFormData()); + return post("paymentSource", "updateBankAccount", path, params.toFormData()); } /** @@ -856,7 +921,7 @@ Response updateBankAccountRaw(String custPaymentSourceId, String jsonPayload) "/payment_sources/{cust-payment-source-id}/update_bank_account", "cust-payment-source-id", custPaymentSourceId); - return postJson(path, jsonPayload); + return postJson("paymentSource", "updateBankAccount", path, jsonPayload); } public PaymentSourceUpdateBankAccountResponse updateBankAccount( @@ -874,7 +939,7 @@ public CompletableFuture updateBankAccou "/payment_sources/{cust-payment-source-id}/update_bank_account", "cust-payment-source-id", custPaymentSourceId); - return postAsync(path, params.toFormData()) + return postAsync("paymentSource", "updateBankAccount", path, params.toFormData()) .thenApply( response -> PaymentSourceUpdateBankAccountResponse.fromJson( @@ -896,7 +961,7 @@ public CompletableFuture updateBankAccou "cust-payment-source-id", custPaymentSourceId); - return postAsync(path, null) + return postAsync("paymentSource", "updateBankAccount", path, null) .thenApply( response -> PaymentSourceUpdateBankAccountResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/PaymentVoucherService.java b/src/main/java/com/chargebee/v4/services/PaymentVoucherService.java index eeb9e7643..9ab48d7af 100644 --- a/src/main/java/com/chargebee/v4/services/PaymentVoucherService.java +++ b/src/main/java/com/chargebee/v4/services/PaymentVoucherService.java @@ -70,7 +70,11 @@ Response paymentVouchersForCustomerRaw(String customerId, PaymentVouchersForCust throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/payment_vouchers", "customer-id", customerId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "paymentVoucher", + "paymentVouchersForCustomer", + path, + params != null ? params.toQueryParams() : null); } /** @@ -80,7 +84,7 @@ Response paymentVouchersForCustomerRaw(String customerId, PaymentVouchersForCust Response paymentVouchersForCustomerRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/payment_vouchers", "customer-id", customerId); - return get(path, null); + return get("paymentVoucher", "paymentVouchersForCustomer", path, null); } /** @@ -113,7 +117,11 @@ public CompletableFuture paymentVouchersForC String customerId, PaymentVouchersForCustomerParams params) { String path = buildPathWithParams("/customers/{customer-id}/payment_vouchers", "customer-id", customerId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "paymentVoucher", + "paymentVouchersForCustomer", + path, + params != null ? params.toQueryParams() : null) .thenApply( response -> PaymentVouchersForCustomerResponse.fromJson( @@ -125,7 +133,7 @@ public CompletableFuture paymentVouchersForC String customerId) { String path = buildPathWithParams("/customers/{customer-id}/payment_vouchers", "customer-id", customerId); - return getAsync(path, null) + return getAsync("paymentVoucher", "paymentVouchersForCustomer", path, null) .thenApply( response -> PaymentVouchersForCustomerResponse.fromJson( @@ -140,7 +148,11 @@ Response paymentVouchersForInvoiceRaw(String invoiceId, PaymentVouchersForInvoic throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/payment_vouchers", "invoice-id", invoiceId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "paymentVoucher", + "paymentVouchersForInvoice", + path, + params != null ? params.toQueryParams() : null); } /** @@ -150,7 +162,7 @@ Response paymentVouchersForInvoiceRaw(String invoiceId, PaymentVouchersForInvoic Response paymentVouchersForInvoiceRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/payment_vouchers", "invoice-id", invoiceId); - return get(path, null); + return get("paymentVoucher", "paymentVouchersForInvoice", path, null); } /** @@ -183,7 +195,11 @@ public CompletableFuture paymentVouchersForIn String invoiceId, PaymentVouchersForInvoiceParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/payment_vouchers", "invoice-id", invoiceId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "paymentVoucher", + "paymentVouchersForInvoice", + path, + params != null ? params.toQueryParams() : null) .thenApply( response -> PaymentVouchersForInvoiceResponse.fromJson( @@ -195,7 +211,7 @@ public CompletableFuture paymentVouchersForIn String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/payment_vouchers", "invoice-id", invoiceId); - return getAsync(path, null) + return getAsync("paymentVoucher", "paymentVouchersForInvoice", path, null) .thenApply( response -> PaymentVouchersForInvoiceResponse.fromJson( @@ -208,7 +224,7 @@ Response retrieveRaw(String paymentVoucherId) throws ChargebeeException { buildPathWithParams( "/payment_vouchers/{payment-voucher-id}", "payment-voucher-id", paymentVoucherId); - return get(path, null); + return get("paymentVoucher", "retrieve", path, null); } public PaymentVoucherRetrieveResponse retrieve(String paymentVoucherId) @@ -223,7 +239,7 @@ public CompletableFuture retrieveAsync(String pa buildPathWithParams( "/payment_vouchers/{payment-voucher-id}", "payment-voucher-id", paymentVoucherId); - return getAsync(path, null) + return getAsync("paymentVoucher", "retrieve", path, null) .thenApply( response -> PaymentVoucherRetrieveResponse.fromJson(response.getBodyAsString(), response)); @@ -234,7 +250,11 @@ public CompletableFuture retrieveAsync(String pa */ Response createRaw(PaymentVoucherCreateParams params) throws ChargebeeException { - return post("/payment_vouchers", params != null ? params.toFormData() : null); + return post( + "paymentVoucher", + "create", + "/payment_vouchers", + params != null ? params.toFormData() : null); } /** @@ -242,7 +262,7 @@ Response createRaw(PaymentVoucherCreateParams params) throws ChargebeeException */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/payment_vouchers", jsonPayload); + return postJson("paymentVoucher", "create", "/payment_vouchers", jsonPayload); } public PaymentVoucherCreateResponse create(PaymentVoucherCreateParams params) @@ -256,7 +276,11 @@ public PaymentVoucherCreateResponse create(PaymentVoucherCreateParams params) public CompletableFuture createAsync( PaymentVoucherCreateParams params) { - return postAsync("/payment_vouchers", params != null ? params.toFormData() : null) + return postAsync( + "paymentVoucher", + "create", + "/payment_vouchers", + params != null ? params.toFormData() : null) .thenApply( response -> 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 b6def44f4..04f2e4dc6 100644 --- a/src/main/java/com/chargebee/v4/services/Pc2MigrationItemFamilyService.java +++ b/src/main/java/com/chargebee/v4/services/Pc2MigrationItemFamilyService.java @@ -73,7 +73,7 @@ Response deleteRaw(String pc2MigrationItemFamilyId) throws ChargebeeException { "pc2-migration-item-family-id", pc2MigrationItemFamilyId); - return post(path, null); + return post("pc2MigrationItemFamily", "delete", path, null); } public Pc2MigrationItemFamilyDeleteResponse delete(String pc2MigrationItemFamilyId) @@ -91,7 +91,7 @@ public CompletableFuture deleteAsync( "pc2-migration-item-family-id", pc2MigrationItemFamilyId); - return postAsync(path, null) + return postAsync("pc2MigrationItemFamily", "delete", path, null) .thenApply( response -> Pc2MigrationItemFamilyDeleteResponse.fromJson( @@ -106,7 +106,7 @@ Response retrieveRaw(String pc2MigrationItemFamilyId) throws ChargebeeException "pc2-migration-item-family-id", pc2MigrationItemFamilyId); - return get(path, null); + return get("pc2MigrationItemFamily", "retrieve", path, null); } public Pc2MigrationItemFamilyRetrieveResponse retrieve(String pc2MigrationItemFamilyId) @@ -124,7 +124,7 @@ public CompletableFuture retrieveAsync( "pc2-migration-item-family-id", pc2MigrationItemFamilyId); - return getAsync(path, null) + return getAsync("pc2MigrationItemFamily", "retrieve", path, null) .thenApply( response -> Pc2MigrationItemFamilyRetrieveResponse.fromJson( @@ -139,7 +139,7 @@ Response updateRaw(String pc2MigrationItemFamilyId) throws ChargebeeException { "pc2-migration-item-family-id", pc2MigrationItemFamilyId); - return post(path, null); + return post("pc2MigrationItemFamily", "update", path, null); } /** @@ -153,7 +153,7 @@ Response updateRaw(String pc2MigrationItemFamilyId, Pc2MigrationItemFamilyUpdate "/pc2_migration_item_families/{pc2-migration-item-family-id}", "pc2-migration-item-family-id", pc2MigrationItemFamilyId); - return post(path, params.toFormData()); + return post("pc2MigrationItemFamily", "update", path, params.toFormData()); } /** @@ -167,7 +167,7 @@ Response updateRaw(String pc2MigrationItemFamilyId, String jsonPayload) "/pc2_migration_item_families/{pc2-migration-item-family-id}", "pc2-migration-item-family-id", pc2MigrationItemFamilyId); - return postJson(path, jsonPayload); + return postJson("pc2MigrationItemFamily", "update", path, jsonPayload); } public Pc2MigrationItemFamilyUpdateResponse update( @@ -185,7 +185,7 @@ public CompletableFuture updateAsync( "/pc2_migration_item_families/{pc2-migration-item-family-id}", "pc2-migration-item-family-id", pc2MigrationItemFamilyId); - return postAsync(path, params.toFormData()) + return postAsync("pc2MigrationItemFamily", "update", path, params.toFormData()) .thenApply( response -> Pc2MigrationItemFamilyUpdateResponse.fromJson( @@ -207,7 +207,7 @@ public CompletableFuture updateAsync( "pc2-migration-item-family-id", pc2MigrationItemFamilyId); - return postAsync(path, null) + return postAsync("pc2MigrationItemFamily", "update", path, null) .thenApply( response -> Pc2MigrationItemFamilyUpdateResponse.fromJson( @@ -220,13 +220,17 @@ public CompletableFuture updateAsync( */ Response listRaw(Pc2MigrationItemFamilyListParams params) throws ChargebeeException { - return get("/pc2_migration_item_families", params != null ? params.toQueryParams() : null); + return get( + "pc2MigrationItemFamily", + "list", + "/pc2_migration_item_families", + params != null ? params.toQueryParams() : null); } /** list a pc2MigrationItemFamily without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/pc2_migration_item_families", null); + return get("pc2MigrationItemFamily", "list", "/pc2_migration_item_families", null); } /** @@ -250,7 +254,11 @@ public Pc2MigrationItemFamilyListResponse list(Pc2MigrationItemFamilyListParams public CompletableFuture listAsync( Pc2MigrationItemFamilyListParams params) { - return getAsync("/pc2_migration_item_families", params != null ? params.toQueryParams() : null) + return getAsync( + "pc2MigrationItemFamily", + "list", + "/pc2_migration_item_families", + params != null ? params.toQueryParams() : null) .thenApply( response -> Pc2MigrationItemFamilyListResponse.fromJson( @@ -267,7 +275,7 @@ public Pc2MigrationItemFamilyListResponse list() throws ChargebeeException { /** Async variant of list for pc2MigrationItemFamily without params. */ public CompletableFuture listAsync() { - return getAsync("/pc2_migration_item_families", null) + return getAsync("pc2MigrationItemFamily", "list", "/pc2_migration_item_families", null) .thenApply( response -> Pc2MigrationItemFamilyListResponse.fromJson( @@ -280,7 +288,11 @@ public CompletableFuture listAsync() { */ Response createRaw(Pc2MigrationItemFamilyCreateParams params) throws ChargebeeException { - return post("/pc2_migration_item_families", params != null ? params.toFormData() : null); + return post( + "pc2MigrationItemFamily", + "create", + "/pc2_migration_item_families", + params != null ? params.toFormData() : null); } /** @@ -289,7 +301,8 @@ Response createRaw(Pc2MigrationItemFamilyCreateParams params) throws ChargebeeEx */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/pc2_migration_item_families", jsonPayload); + return postJson( + "pc2MigrationItemFamily", "create", "/pc2_migration_item_families", jsonPayload); } public Pc2MigrationItemFamilyCreateResponse create(Pc2MigrationItemFamilyCreateParams params) @@ -303,7 +316,11 @@ public Pc2MigrationItemFamilyCreateResponse create(Pc2MigrationItemFamilyCreateP public CompletableFuture createAsync( Pc2MigrationItemFamilyCreateParams params) { - return postAsync("/pc2_migration_item_families", params != null ? params.toFormData() : null) + return postAsync( + "pc2MigrationItemFamily", + "create", + "/pc2_migration_item_families", + params != null ? params.toFormData() : null) .thenApply( response -> Pc2MigrationItemFamilyCreateResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/Pc2MigrationItemPriceService.java b/src/main/java/com/chargebee/v4/services/Pc2MigrationItemPriceService.java index 6e1e3a7fb..82cd4a338 100644 --- a/src/main/java/com/chargebee/v4/services/Pc2MigrationItemPriceService.java +++ b/src/main/java/com/chargebee/v4/services/Pc2MigrationItemPriceService.java @@ -66,13 +66,17 @@ public Pc2MigrationItemPriceService withOptions(RequestOptions options) { */ Response listRaw(Pc2MigrationItemPriceListParams params) throws ChargebeeException { - return get("/pc2_migration_item_prices", params != null ? params.toQueryParams() : null); + return get( + "pc2MigrationItemPrice", + "list", + "/pc2_migration_item_prices", + params != null ? params.toQueryParams() : null); } /** list a pc2MigrationItemPrice without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/pc2_migration_item_prices", null); + return get("pc2MigrationItemPrice", "list", "/pc2_migration_item_prices", null); } /** @@ -96,7 +100,11 @@ public Pc2MigrationItemPriceListResponse list(Pc2MigrationItemPriceListParams pa public CompletableFuture listAsync( Pc2MigrationItemPriceListParams params) { - return getAsync("/pc2_migration_item_prices", params != null ? params.toQueryParams() : null) + return getAsync( + "pc2MigrationItemPrice", + "list", + "/pc2_migration_item_prices", + params != null ? params.toQueryParams() : null) .thenApply( response -> Pc2MigrationItemPriceListResponse.fromJson( @@ -113,7 +121,7 @@ public Pc2MigrationItemPriceListResponse list() throws ChargebeeException { /** Async variant of list for pc2MigrationItemPrice without params. */ public CompletableFuture listAsync() { - return getAsync("/pc2_migration_item_prices", null) + return getAsync("pc2MigrationItemPrice", "list", "/pc2_migration_item_prices", null) .thenApply( response -> Pc2MigrationItemPriceListResponse.fromJson( @@ -128,7 +136,7 @@ Response deleteRaw(String pc2MigrationItemPriceId) throws ChargebeeException { "pc2-migration-item-price-id", pc2MigrationItemPriceId); - return post(path, null); + return post("pc2MigrationItemPrice", "delete", path, null); } public Pc2MigrationItemPriceDeleteResponse delete(String pc2MigrationItemPriceId) @@ -146,7 +154,7 @@ public CompletableFuture deleteAsync( "pc2-migration-item-price-id", pc2MigrationItemPriceId); - return postAsync(path, null) + return postAsync("pc2MigrationItemPrice", "delete", path, null) .thenApply( response -> Pc2MigrationItemPriceDeleteResponse.fromJson(response.getBodyAsString(), response)); @@ -160,7 +168,7 @@ Response retrieveRaw(String pc2MigrationItemPriceId) throws ChargebeeException { "pc2-migration-item-price-id", pc2MigrationItemPriceId); - return get(path, null); + return get("pc2MigrationItemPrice", "retrieve", path, null); } public Pc2MigrationItemPriceRetrieveResponse retrieve(String pc2MigrationItemPriceId) @@ -178,7 +186,7 @@ public CompletableFuture retrieveAsync( "pc2-migration-item-price-id", pc2MigrationItemPriceId); - return getAsync(path, null) + return getAsync("pc2MigrationItemPrice", "retrieve", path, null) .thenApply( response -> Pc2MigrationItemPriceRetrieveResponse.fromJson( @@ -193,7 +201,7 @@ Response updateRaw(String pc2MigrationItemPriceId) throws ChargebeeException { "pc2-migration-item-price-id", pc2MigrationItemPriceId); - return post(path, null); + return post("pc2MigrationItemPrice", "update", path, null); } /** @@ -207,7 +215,7 @@ Response updateRaw(String pc2MigrationItemPriceId, Pc2MigrationItemPriceUpdatePa "/pc2_migration_item_prices/{pc2-migration-item-price-id}", "pc2-migration-item-price-id", pc2MigrationItemPriceId); - return post(path, params.toFormData()); + return post("pc2MigrationItemPrice", "update", path, params.toFormData()); } /** @@ -220,7 +228,7 @@ Response updateRaw(String pc2MigrationItemPriceId, String jsonPayload) throws Ch "/pc2_migration_item_prices/{pc2-migration-item-price-id}", "pc2-migration-item-price-id", pc2MigrationItemPriceId); - return postJson(path, jsonPayload); + return postJson("pc2MigrationItemPrice", "update", path, jsonPayload); } public Pc2MigrationItemPriceUpdateResponse update( @@ -238,7 +246,7 @@ public CompletableFuture updateAsync( "/pc2_migration_item_prices/{pc2-migration-item-price-id}", "pc2-migration-item-price-id", pc2MigrationItemPriceId); - return postAsync(path, params.toFormData()) + return postAsync("pc2MigrationItemPrice", "update", path, params.toFormData()) .thenApply( response -> Pc2MigrationItemPriceUpdateResponse.fromJson(response.getBodyAsString(), response)); @@ -259,7 +267,7 @@ public CompletableFuture updateAsync( "pc2-migration-item-price-id", pc2MigrationItemPriceId); - return postAsync(path, null) + return postAsync("pc2MigrationItemPrice", "update", path, null) .thenApply( response -> 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 940a08b5b..0919f6288 100644 --- a/src/main/java/com/chargebee/v4/services/Pc2MigrationItemService.java +++ b/src/main/java/com/chargebee/v4/services/Pc2MigrationItemService.java @@ -76,7 +76,7 @@ Response retrieveRaw(String pc2MigrationItemId) throws ChargebeeException { "pc2-migration-item-id", pc2MigrationItemId); - return get(path, null); + return get("pc2MigrationItem", "retrieve", path, null); } public Pc2MigrationItemRetrieveResponse retrieve(String pc2MigrationItemId) @@ -94,7 +94,7 @@ public CompletableFuture retrieveAsync( "pc2-migration-item-id", pc2MigrationItemId); - return getAsync(path, null) + return getAsync("pc2MigrationItem", "retrieve", path, null) .thenApply( response -> Pc2MigrationItemRetrieveResponse.fromJson(response.getBodyAsString(), response)); @@ -108,7 +108,7 @@ Response updateRaw(String pc2MigrationItemId) throws ChargebeeException { "pc2-migration-item-id", pc2MigrationItemId); - return post(path, null); + return post("pc2MigrationItem", "update", path, null); } /** @@ -121,7 +121,7 @@ Response updateRaw(String pc2MigrationItemId, Pc2MigrationItemUpdateParams param "/pc2_migration_items/{pc2-migration-item-id}", "pc2-migration-item-id", pc2MigrationItemId); - return post(path, params.toFormData()); + return post("pc2MigrationItem", "update", path, params.toFormData()); } /** @@ -133,7 +133,7 @@ Response updateRaw(String pc2MigrationItemId, String jsonPayload) throws Chargeb "/pc2_migration_items/{pc2-migration-item-id}", "pc2-migration-item-id", pc2MigrationItemId); - return postJson(path, jsonPayload); + return postJson("pc2MigrationItem", "update", path, jsonPayload); } public Pc2MigrationItemUpdateResponse update( @@ -150,7 +150,7 @@ public CompletableFuture updateAsync( "/pc2_migration_items/{pc2-migration-item-id}", "pc2-migration-item-id", pc2MigrationItemId); - return postAsync(path, params.toFormData()) + return postAsync("pc2MigrationItem", "update", path, params.toFormData()) .thenApply( response -> Pc2MigrationItemUpdateResponse.fromJson(response.getBodyAsString(), response)); @@ -170,7 +170,7 @@ public CompletableFuture updateAsync(String pc2M "pc2-migration-item-id", pc2MigrationItemId); - return postAsync(path, null) + return postAsync("pc2MigrationItem", "update", path, null) .thenApply( response -> Pc2MigrationItemUpdateResponse.fromJson(response.getBodyAsString(), response)); @@ -184,7 +184,7 @@ Response deleteRaw(String pc2MigrationItemId) throws ChargebeeException { "pc2-migration-item-id", pc2MigrationItemId); - return post(path, null); + return post("pc2MigrationItem", "delete", path, null); } public Pc2MigrationItemDeleteResponse delete(String pc2MigrationItemId) @@ -201,7 +201,7 @@ public CompletableFuture deleteAsync(String pc2M "pc2-migration-item-id", pc2MigrationItemId); - return postAsync(path, null) + return postAsync("pc2MigrationItem", "delete", path, null) .thenApply( response -> Pc2MigrationItemDeleteResponse.fromJson(response.getBodyAsString(), response)); @@ -212,13 +212,17 @@ public CompletableFuture deleteAsync(String pc2M */ Response listRaw(Pc2MigrationItemListParams params) throws ChargebeeException { - return get("/pc2_migration_items", params != null ? params.toQueryParams() : null); + return get( + "pc2MigrationItem", + "list", + "/pc2_migration_items", + params != null ? params.toQueryParams() : null); } /** list a pc2MigrationItem without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/pc2_migration_items", null); + return get("pc2MigrationItem", "list", "/pc2_migration_items", null); } /** @@ -241,7 +245,11 @@ public Pc2MigrationItemListResponse list(Pc2MigrationItemListParams params) public CompletableFuture listAsync( Pc2MigrationItemListParams params) { - return getAsync("/pc2_migration_items", params != null ? params.toQueryParams() : null) + return getAsync( + "pc2MigrationItem", + "list", + "/pc2_migration_items", + params != null ? params.toQueryParams() : null) .thenApply( response -> Pc2MigrationItemListResponse.fromJson( @@ -257,7 +265,7 @@ public Pc2MigrationItemListResponse list() throws ChargebeeException { /** Async variant of list for pc2MigrationItem without params. */ public CompletableFuture listAsync() { - return getAsync("/pc2_migration_items", null) + return getAsync("pc2MigrationItem", "list", "/pc2_migration_items", null) .thenApply( response -> Pc2MigrationItemListResponse.fromJson( @@ -269,7 +277,11 @@ public CompletableFuture listAsync() { */ Response createRaw(Pc2MigrationItemCreateParams params) throws ChargebeeException { - return post("/pc2_migration_items", params != null ? params.toFormData() : null); + return post( + "pc2MigrationItem", + "create", + "/pc2_migration_items", + params != null ? params.toFormData() : null); } /** @@ -277,7 +289,7 @@ Response createRaw(Pc2MigrationItemCreateParams params) throws ChargebeeExceptio */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/pc2_migration_items", jsonPayload); + return postJson("pc2MigrationItem", "create", "/pc2_migration_items", jsonPayload); } public Pc2MigrationItemCreateResponse create(Pc2MigrationItemCreateParams params) @@ -291,7 +303,11 @@ public Pc2MigrationItemCreateResponse create(Pc2MigrationItemCreateParams params public CompletableFuture createAsync( Pc2MigrationItemCreateParams params) { - return postAsync("/pc2_migration_items", params != null ? params.toFormData() : null) + return postAsync( + "pc2MigrationItem", + "create", + "/pc2_migration_items", + params != null ? params.toFormData() : null) .thenApply( response -> Pc2MigrationItemCreateResponse.fromJson(response.getBodyAsString(), response)); @@ -305,7 +321,10 @@ Response listApplicableAddonsRaw(Pc2MigrationItemListApplicableAddonsParams para throws ChargebeeException { return get( - "/pc2_migration_items/applicable_items", params != null ? params.toQueryParams() : null); + "pc2MigrationItem", + "listApplicableAddons", + "/pc2_migration_items/applicable_items", + params != null ? params.toQueryParams() : null); } /** @@ -314,7 +333,8 @@ Response listApplicableAddonsRaw(Pc2MigrationItemListApplicableAddonsParams para */ Response listApplicableAddonsRaw() throws ChargebeeException { - return get("/pc2_migration_items/applicable_items", null); + return get( + "pc2MigrationItem", "listApplicableAddons", "/pc2_migration_items/applicable_items", null); } /** @@ -339,7 +359,10 @@ public CompletableFuture listAppli Pc2MigrationItemListApplicableAddonsParams params) { return getAsync( - "/pc2_migration_items/applicable_items", params != null ? params.toQueryParams() : null) + "pc2MigrationItem", + "listApplicableAddons", + "/pc2_migration_items/applicable_items", + params != null ? params.toQueryParams() : null) .thenApply( response -> Pc2MigrationItemListApplicableAddonsResponse.fromJson( @@ -358,7 +381,11 @@ public Pc2MigrationItemListApplicableAddonsResponse listApplicableAddons() public CompletableFuture listApplicableAddonsAsync() { - return getAsync("/pc2_migration_items/applicable_items", null) + return getAsync( + "pc2MigrationItem", + "listApplicableAddons", + "/pc2_migration_items/applicable_items", + null) .thenApply( response -> Pc2MigrationItemListApplicableAddonsResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/Pc2MigrationService.java b/src/main/java/com/chargebee/v4/services/Pc2MigrationService.java index d97569286..19e3bd832 100644 --- a/src/main/java/com/chargebee/v4/services/Pc2MigrationService.java +++ b/src/main/java/com/chargebee/v4/services/Pc2MigrationService.java @@ -66,7 +66,7 @@ Response contactSupportRaw(String pc2MigrationId) throws ChargebeeException { "pc2-migration-id", pc2MigrationId); - return post(path, null); + return post("pc2Migration", "contactSupport", path, null); } public Pc2MigrationContactSupportResponse contactSupport(String pc2MigrationId) @@ -84,7 +84,7 @@ public CompletableFuture contactSupportAsync "pc2-migration-id", pc2MigrationId); - return postAsync(path, null) + return postAsync("pc2Migration", "contactSupport", path, null) .thenApply( response -> Pc2MigrationContactSupportResponse.fromJson(response.getBodyAsString(), response)); @@ -96,7 +96,7 @@ Response retrieveRaw(String pc2MigrationId) throws ChargebeeException { buildPathWithParams( "/pc2_migrations/{pc2-migration-id}", "pc2-migration-id", pc2MigrationId); - return get(path, null); + return get("pc2Migration", "retrieve", path, null); } public Pc2MigrationRetrieveResponse retrieve(String pc2MigrationId) throws ChargebeeException { @@ -110,7 +110,7 @@ public CompletableFuture retrieveAsync(String pc2M buildPathWithParams( "/pc2_migrations/{pc2-migration-id}", "pc2-migration-id", pc2MigrationId); - return getAsync(path, null) + return getAsync("pc2Migration", "retrieve", path, null) .thenApply( response -> Pc2MigrationRetrieveResponse.fromJson(response.getBodyAsString(), response)); @@ -119,13 +119,14 @@ public CompletableFuture retrieveAsync(String pc2M /** create a pc2Migration using immutable params (executes immediately) - returns raw Response. */ Response createRaw(Pc2MigrationCreateParams params) throws ChargebeeException { - return post("/pc2_migrations", params != null ? params.toFormData() : null); + return post( + "pc2Migration", "create", "/pc2_migrations", params != null ? params.toFormData() : null); } /** create a pc2Migration using raw JSON payload (executes immediately) - returns raw Response. */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/pc2_migrations", jsonPayload); + return postJson("pc2Migration", "create", "/pc2_migrations", jsonPayload); } public Pc2MigrationCreateResponse create(Pc2MigrationCreateParams params) @@ -139,7 +140,11 @@ public Pc2MigrationCreateResponse create(Pc2MigrationCreateParams params) public CompletableFuture createAsync( Pc2MigrationCreateParams params) { - return postAsync("/pc2_migrations", params != null ? params.toFormData() : null) + return postAsync( + "pc2Migration", + "create", + "/pc2_migrations", + params != null ? params.toFormData() : null) .thenApply( response -> Pc2MigrationCreateResponse.fromJson(response.getBodyAsString(), response)); } @@ -150,7 +155,7 @@ Response initiateRaw(String pc2MigrationId) throws ChargebeeException { buildPathWithParams( "/pc2_migrations/{pc2-migration-id}/initiate", "pc2-migration-id", pc2MigrationId); - return post(path, null); + return post("pc2Migration", "initiate", path, null); } public Pc2MigrationInitiateResponse initiate(String pc2MigrationId) throws ChargebeeException { @@ -164,7 +169,7 @@ public CompletableFuture initiateAsync(String pc2M buildPathWithParams( "/pc2_migrations/{pc2-migration-id}/initiate", "pc2-migration-id", pc2MigrationId); - return postAsync(path, null) + return postAsync("pc2Migration", "initiate", path, null) .thenApply( response -> 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 226f6cc8a..59f5155a6 100644 --- a/src/main/java/com/chargebee/v4/services/PersonalizedOfferService.java +++ b/src/main/java/com/chargebee/v4/services/PersonalizedOfferService.java @@ -61,6 +61,8 @@ public PersonalizedOfferService withOptions(RequestOptions options) { Response personalizedOffersRaw(PersonalizedOffersParams params) throws ChargebeeException { return postJsonWithSubDomain( + "personalizedOffer", + "personalizedOffers", "/personalized_offers", SubDomain.GROW.getValue(), params != null ? params.toJsonString() : null); @@ -72,7 +74,12 @@ Response personalizedOffersRaw(PersonalizedOffersParams params) throws Chargebee */ Response personalizedOffersRaw(String jsonPayload) throws ChargebeeException { - return postJsonWithSubDomain("/personalized_offers", SubDomain.GROW.getValue(), jsonPayload); + return postJsonWithSubDomain( + "personalizedOffer", + "personalizedOffers", + "/personalized_offers", + SubDomain.GROW.getValue(), + jsonPayload); } public PersonalizedOffersResponse personalizedOffers(PersonalizedOffersParams params) @@ -87,6 +94,8 @@ public CompletableFuture personalizedOffersAsync( PersonalizedOffersParams params) { return postJsonWithSubDomainAsync( + "personalizedOffer", + "personalizedOffers", "/personalized_offers", SubDomain.GROW.getValue(), params != null ? params.toJsonString() : null) diff --git a/src/main/java/com/chargebee/v4/services/PlanService.java b/src/main/java/com/chargebee/v4/services/PlanService.java index 1e5c75454..ca6a5e3cd 100644 --- a/src/main/java/com/chargebee/v4/services/PlanService.java +++ b/src/main/java/com/chargebee/v4/services/PlanService.java @@ -73,7 +73,7 @@ public PlanService withOptions(RequestOptions options) { Response unarchiveRaw(String planId) throws ChargebeeException { String path = buildPathWithParams("/plans/{plan-id}/unarchive", "plan-id", planId); - return post(path, null); + return post("plan", "unarchive", path, null); } public PlanUnarchiveResponse unarchive(String planId) throws ChargebeeException { @@ -85,7 +85,7 @@ public PlanUnarchiveResponse unarchive(String planId) throws ChargebeeException public CompletableFuture unarchiveAsync(String planId) { String path = buildPathWithParams("/plans/{plan-id}/unarchive", "plan-id", planId); - return postAsync(path, null) + return postAsync("plan", "unarchive", path, null) .thenApply( response -> PlanUnarchiveResponse.fromJson(response.getBodyAsString(), response)); } @@ -94,7 +94,7 @@ public CompletableFuture unarchiveAsync(String planId) { Response deleteRaw(String planId) throws ChargebeeException { String path = buildPathWithParams("/plans/{plan-id}/delete", "plan-id", planId); - return post(path, null); + return post("plan", "delete", path, null); } public PlanDeleteResponse delete(String planId) throws ChargebeeException { @@ -106,20 +106,20 @@ public PlanDeleteResponse delete(String planId) throws ChargebeeException { public CompletableFuture deleteAsync(String planId) { String path = buildPathWithParams("/plans/{plan-id}/delete", "plan-id", planId); - return postAsync(path, null) + return postAsync("plan", "delete", path, null) .thenApply(response -> PlanDeleteResponse.fromJson(response.getBodyAsString(), response)); } /** copy a plan using immutable params (executes immediately) - returns raw Response. */ Response copyRaw(PlanCopyParams params) throws ChargebeeException { - return post("/plans/copy", params != null ? params.toFormData() : null); + return post("plan", "copy", "/plans/copy", params != null ? params.toFormData() : null); } /** copy a plan using raw JSON payload (executes immediately) - returns raw Response. */ Response copyRaw(String jsonPayload) throws ChargebeeException { - return postJson("/plans/copy", jsonPayload); + return postJson("plan", "copy", "/plans/copy", jsonPayload); } public PlanCopyResponse copy(PlanCopyParams params) throws ChargebeeException { @@ -131,20 +131,20 @@ public PlanCopyResponse copy(PlanCopyParams params) throws ChargebeeException { /** Async variant of copy for plan with params. */ public CompletableFuture copyAsync(PlanCopyParams params) { - return postAsync("/plans/copy", params != null ? params.toFormData() : null) + return postAsync("plan", "copy", "/plans/copy", params != null ? params.toFormData() : null) .thenApply(response -> PlanCopyResponse.fromJson(response.getBodyAsString(), response)); } /** list a plan using immutable params (executes immediately) - returns raw Response. */ Response listRaw(PlanListParams params) throws ChargebeeException { - return get("/plans", params != null ? params.toQueryParams() : null); + return get("plan", "list", "/plans", params != null ? params.toQueryParams() : null); } /** list a plan without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/plans", null); + return get("plan", "list", "/plans", null); } /** list a plan using raw JSON payload (executes immediately) - returns raw Response. */ @@ -162,7 +162,7 @@ public PlanListResponse list(PlanListParams params) throws ChargebeeException { /** Async variant of list for plan with params. */ public CompletableFuture listAsync(PlanListParams params) { - return getAsync("/plans", params != null ? params.toQueryParams() : null) + return getAsync("plan", "list", "/plans", params != null ? params.toQueryParams() : null) .thenApply( response -> PlanListResponse.fromJson(response.getBodyAsString(), this, params, response)); @@ -177,7 +177,7 @@ public PlanListResponse list() throws ChargebeeException { /** Async variant of list for plan without params. */ public CompletableFuture listAsync() { - return getAsync("/plans", null) + return getAsync("plan", "list", "/plans", null) .thenApply( response -> PlanListResponse.fromJson(response.getBodyAsString(), this, null, response)); @@ -186,13 +186,13 @@ public CompletableFuture listAsync() { /** create a plan using immutable params (executes immediately) - returns raw Response. */ Response createRaw(PlanCreateParams params) throws ChargebeeException { - return post("/plans", params != null ? params.toFormData() : null); + return post("plan", "create", "/plans", params != null ? params.toFormData() : null); } /** create a plan using raw JSON payload (executes immediately) - returns raw Response. */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/plans", jsonPayload); + return postJson("plan", "create", "/plans", jsonPayload); } public PlanCreateResponse create(PlanCreateParams params) throws ChargebeeException { @@ -204,7 +204,7 @@ public PlanCreateResponse create(PlanCreateParams params) throws ChargebeeExcept /** Async variant of create for plan with params. */ public CompletableFuture createAsync(PlanCreateParams params) { - return postAsync("/plans", params != null ? params.toFormData() : null) + return postAsync("plan", "create", "/plans", params != null ? params.toFormData() : null) .thenApply(response -> PlanCreateResponse.fromJson(response.getBodyAsString(), response)); } @@ -212,7 +212,7 @@ public CompletableFuture createAsync(PlanCreateParams params Response retrieveRaw(String planId) throws ChargebeeException { String path = buildPathWithParams("/plans/{plan-id}", "plan-id", planId); - return get(path, null); + return get("plan", "retrieve", path, null); } public PlanRetrieveResponse retrieve(String planId) throws ChargebeeException { @@ -224,7 +224,7 @@ public PlanRetrieveResponse retrieve(String planId) throws ChargebeeException { public CompletableFuture retrieveAsync(String planId) { String path = buildPathWithParams("/plans/{plan-id}", "plan-id", planId); - return getAsync(path, null) + return getAsync("plan", "retrieve", path, null) .thenApply(response -> PlanRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -232,19 +232,19 @@ public CompletableFuture retrieveAsync(String planId) { Response updateRaw(String planId) throws ChargebeeException { String path = buildPathWithParams("/plans/{plan-id}", "plan-id", planId); - return post(path, null); + return post("plan", "update", path, null); } /** update a plan using immutable params (executes immediately) - returns raw Response. */ Response updateRaw(String planId, PlanUpdateParams params) throws ChargebeeException { String path = buildPathWithParams("/plans/{plan-id}", "plan-id", planId); - return post(path, params.toFormData()); + return post("plan", "update", path, params.toFormData()); } /** update a plan using raw JSON payload (executes immediately) - returns raw Response. */ Response updateRaw(String planId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/plans/{plan-id}", "plan-id", planId); - return postJson(path, jsonPayload); + return postJson("plan", "update", path, jsonPayload); } public PlanUpdateResponse update(String planId, PlanUpdateParams params) @@ -256,7 +256,7 @@ public PlanUpdateResponse update(String planId, PlanUpdateParams params) /** Async variant of update for plan with params. */ public CompletableFuture updateAsync(String planId, PlanUpdateParams params) { String path = buildPathWithParams("/plans/{plan-id}", "plan-id", planId); - return postAsync(path, params.toFormData()) + return postAsync("plan", "update", path, params.toFormData()) .thenApply(response -> PlanUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -269,7 +269,7 @@ public PlanUpdateResponse update(String planId) throws ChargebeeException { public CompletableFuture updateAsync(String planId) { String path = buildPathWithParams("/plans/{plan-id}", "plan-id", planId); - return postAsync(path, null) + return postAsync("plan", "update", path, null) .thenApply(response -> 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 33b835b5f..79aa00249 100644 --- a/src/main/java/com/chargebee/v4/services/PortalSessionService.java +++ b/src/main/java/com/chargebee/v4/services/PortalSessionService.java @@ -65,7 +65,8 @@ public PortalSessionService withOptions(RequestOptions options) { */ Response createRaw(PortalSessionCreateParams params) throws ChargebeeException { - return post("/portal_sessions", params != null ? params.toFormData() : null); + return post( + "portalSession", "create", "/portal_sessions", params != null ? params.toFormData() : null); } /** @@ -73,7 +74,7 @@ Response createRaw(PortalSessionCreateParams params) throws ChargebeeException { */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/portal_sessions", jsonPayload); + return postJson("portalSession", "create", "/portal_sessions", jsonPayload); } public PortalSessionCreateResponse create(PortalSessionCreateParams params) @@ -87,7 +88,11 @@ public PortalSessionCreateResponse create(PortalSessionCreateParams params) public CompletableFuture createAsync( PortalSessionCreateParams params) { - return postAsync("/portal_sessions", params != null ? params.toFormData() : null) + return postAsync( + "portalSession", + "create", + "/portal_sessions", + params != null ? params.toFormData() : null) .thenApply( response -> PortalSessionCreateResponse.fromJson(response.getBodyAsString(), response)); } @@ -98,7 +103,7 @@ Response activateRaw(String portalSessionId) throws ChargebeeException { buildPathWithParams( "/portal_sessions/{portal-session-id}/activate", "portal-session-id", portalSessionId); - return post(path, null); + return post("portalSession", "activate", path, null); } /** @@ -109,7 +114,7 @@ Response activateRaw(String portalSessionId, PortalSessionActivateParams params) String path = buildPathWithParams( "/portal_sessions/{portal-session-id}/activate", "portal-session-id", portalSessionId); - return post(path, params.toFormData()); + return post("portalSession", "activate", path, params.toFormData()); } /** @@ -119,7 +124,7 @@ Response activateRaw(String portalSessionId, String jsonPayload) throws Chargebe String path = buildPathWithParams( "/portal_sessions/{portal-session-id}/activate", "portal-session-id", portalSessionId); - return postJson(path, jsonPayload); + return postJson("portalSession", "activate", path, jsonPayload); } public PortalSessionActivateResponse activate( @@ -134,7 +139,7 @@ public CompletableFuture activateAsync( String path = buildPathWithParams( "/portal_sessions/{portal-session-id}/activate", "portal-session-id", portalSessionId); - return postAsync(path, params.toFormData()) + return postAsync("portalSession", "activate", path, params.toFormData()) .thenApply( response -> PortalSessionActivateResponse.fromJson(response.getBodyAsString(), response)); @@ -146,7 +151,7 @@ Response logoutRaw(String portalSessionId) throws ChargebeeException { buildPathWithParams( "/portal_sessions/{portal-session-id}/logout", "portal-session-id", portalSessionId); - return post(path, null); + return post("portalSession", "logout", path, null); } public PortalSessionLogoutResponse logout(String portalSessionId) throws ChargebeeException { @@ -160,7 +165,7 @@ public CompletableFuture logoutAsync(String portalS buildPathWithParams( "/portal_sessions/{portal-session-id}/logout", "portal-session-id", portalSessionId); - return postAsync(path, null) + return postAsync("portalSession", "logout", path, null) .thenApply( response -> PortalSessionLogoutResponse.fromJson(response.getBodyAsString(), response)); } @@ -171,7 +176,7 @@ Response retrieveRaw(String portalSessionId) throws ChargebeeException { buildPathWithParams( "/portal_sessions/{portal-session-id}", "portal-session-id", portalSessionId); - return get(path, null); + return get("portalSession", "retrieve", path, null); } public PortalSessionRetrieveResponse retrieve(String portalSessionId) throws ChargebeeException { @@ -185,7 +190,7 @@ public CompletableFuture retrieveAsync(String por buildPathWithParams( "/portal_sessions/{portal-session-id}", "portal-session-id", portalSessionId); - return getAsync(path, null) + return getAsync("portalSession", "retrieve", path, null) .thenApply( response -> 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 da76fa087..1f7d36b84 100644 --- a/src/main/java/com/chargebee/v4/services/PriceVariantService.java +++ b/src/main/java/com/chargebee/v4/services/PriceVariantService.java @@ -70,7 +70,7 @@ Response deleteRaw(String priceVariantId) throws ChargebeeException { buildPathWithParams( "/price_variants/{price-variant-id}/delete", "price-variant-id", priceVariantId); - return post(path, null); + return post("priceVariant", "delete", path, null); } public PriceVariantDeleteResponse delete(String priceVariantId) throws ChargebeeException { @@ -84,7 +84,7 @@ public CompletableFuture deleteAsync(String priceVar buildPathWithParams( "/price_variants/{price-variant-id}/delete", "price-variant-id", priceVariantId); - return postAsync(path, null) + return postAsync("priceVariant", "delete", path, null) .thenApply( response -> PriceVariantDeleteResponse.fromJson(response.getBodyAsString(), response)); } @@ -92,13 +92,14 @@ public CompletableFuture deleteAsync(String priceVar /** list a priceVariant using immutable params (executes immediately) - returns raw Response. */ Response listRaw(PriceVariantListParams params) throws ChargebeeException { - return get("/price_variants", params != null ? params.toQueryParams() : null); + return get( + "priceVariant", "list", "/price_variants", params != null ? params.toQueryParams() : null); } /** list a priceVariant without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/price_variants", null); + return get("priceVariant", "list", "/price_variants", null); } /** list a priceVariant using raw JSON payload (executes immediately) - returns raw Response. */ @@ -116,7 +117,11 @@ public PriceVariantListResponse list(PriceVariantListParams params) throws Charg /** Async variant of list for priceVariant with params. */ public CompletableFuture listAsync(PriceVariantListParams params) { - return getAsync("/price_variants", params != null ? params.toQueryParams() : null) + return getAsync( + "priceVariant", + "list", + "/price_variants", + params != null ? params.toQueryParams() : null) .thenApply( response -> PriceVariantListResponse.fromJson( @@ -132,7 +137,7 @@ public PriceVariantListResponse list() throws ChargebeeException { /** Async variant of list for priceVariant without params. */ public CompletableFuture listAsync() { - return getAsync("/price_variants", null) + return getAsync("priceVariant", "list", "/price_variants", null) .thenApply( response -> PriceVariantListResponse.fromJson( @@ -142,13 +147,14 @@ public CompletableFuture listAsync() { /** create a priceVariant using immutable params (executes immediately) - returns raw Response. */ Response createRaw(PriceVariantCreateParams params) throws ChargebeeException { - return post("/price_variants", params != null ? params.toFormData() : null); + return post( + "priceVariant", "create", "/price_variants", params != null ? params.toFormData() : null); } /** create a priceVariant using raw JSON payload (executes immediately) - returns raw Response. */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/price_variants", jsonPayload); + return postJson("priceVariant", "create", "/price_variants", jsonPayload); } public PriceVariantCreateResponse create(PriceVariantCreateParams params) @@ -162,7 +168,11 @@ public PriceVariantCreateResponse create(PriceVariantCreateParams params) public CompletableFuture createAsync( PriceVariantCreateParams params) { - return postAsync("/price_variants", params != null ? params.toFormData() : null) + return postAsync( + "priceVariant", + "create", + "/price_variants", + params != null ? params.toFormData() : null) .thenApply( response -> PriceVariantCreateResponse.fromJson(response.getBodyAsString(), response)); } @@ -173,7 +183,7 @@ Response retrieveRaw(String priceVariantId) throws ChargebeeException { buildPathWithParams( "/price_variants/{price-variant-id}", "price-variant-id", priceVariantId); - return get(path, null); + return get("priceVariant", "retrieve", path, null); } public PriceVariantRetrieveResponse retrieve(String priceVariantId) throws ChargebeeException { @@ -187,7 +197,7 @@ public CompletableFuture retrieveAsync(String pric buildPathWithParams( "/price_variants/{price-variant-id}", "price-variant-id", priceVariantId); - return getAsync(path, null) + return getAsync("priceVariant", "retrieve", path, null) .thenApply( response -> PriceVariantRetrieveResponse.fromJson(response.getBodyAsString(), response)); @@ -199,7 +209,7 @@ Response updateRaw(String priceVariantId) throws ChargebeeException { buildPathWithParams( "/price_variants/{price-variant-id}", "price-variant-id", priceVariantId); - return post(path, null); + return post("priceVariant", "update", path, null); } /** update a priceVariant using immutable params (executes immediately) - returns raw Response. */ @@ -208,7 +218,7 @@ Response updateRaw(String priceVariantId, PriceVariantUpdateParams params) String path = buildPathWithParams( "/price_variants/{price-variant-id}", "price-variant-id", priceVariantId); - return post(path, params.toFormData()); + return post("priceVariant", "update", path, params.toFormData()); } /** update a priceVariant using raw JSON payload (executes immediately) - returns raw Response. */ @@ -216,7 +226,7 @@ Response updateRaw(String priceVariantId, String jsonPayload) throws ChargebeeEx String path = buildPathWithParams( "/price_variants/{price-variant-id}", "price-variant-id", priceVariantId); - return postJson(path, jsonPayload); + return postJson("priceVariant", "update", path, jsonPayload); } public PriceVariantUpdateResponse update(String priceVariantId, PriceVariantUpdateParams params) @@ -231,7 +241,7 @@ public CompletableFuture updateAsync( String path = buildPathWithParams( "/price_variants/{price-variant-id}", "price-variant-id", priceVariantId); - return postAsync(path, params.toFormData()) + return postAsync("priceVariant", "update", path, params.toFormData()) .thenApply( response -> PriceVariantUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -247,7 +257,7 @@ public CompletableFuture updateAsync(String priceVar buildPathWithParams( "/price_variants/{price-variant-id}", "price-variant-id", priceVariantId); - return postAsync(path, null) + return postAsync("priceVariant", "update", path, null) .thenApply( response -> 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 6e2f925b7..c33bdc543 100644 --- a/src/main/java/com/chargebee/v4/services/PricingPageSessionService.java +++ b/src/main/java/com/chargebee/v4/services/PricingPageSessionService.java @@ -64,6 +64,8 @@ Response createForExistingSubscriptionRaw( PricingPageSessionCreateForExistingSubscriptionParams params) throws ChargebeeException { return post( + "pricingPageSession", + "createForExistingSubscription", "/pricing_page_sessions/create_for_existing_subscription", params != null ? params.toFormData() : null); } @@ -74,7 +76,11 @@ Response createForExistingSubscriptionRaw( */ Response createForExistingSubscriptionRaw(String jsonPayload) throws ChargebeeException { - return postJson("/pricing_page_sessions/create_for_existing_subscription", jsonPayload); + return postJson( + "pricingPageSession", + "createForExistingSubscription", + "/pricing_page_sessions/create_for_existing_subscription", + jsonPayload); } public PricingPageSessionCreateForExistingSubscriptionResponse createForExistingSubscription( @@ -91,6 +97,8 @@ public PricingPageSessionCreateForExistingSubscriptionResponse createForExisting PricingPageSessionCreateForExistingSubscriptionParams params) { return postAsync( + "pricingPageSession", + "createForExistingSubscription", "/pricing_page_sessions/create_for_existing_subscription", params != null ? params.toFormData() : null) .thenApply( @@ -107,6 +115,8 @@ Response createForNewSubscriptionRaw(PricingPageSessionCreateForNewSubscriptionP throws ChargebeeException { return post( + "pricingPageSession", + "createForNewSubscription", "/pricing_page_sessions/create_for_new_subscription", params != null ? params.toFormData() : null); } @@ -117,7 +127,11 @@ Response createForNewSubscriptionRaw(PricingPageSessionCreateForNewSubscriptionP */ Response createForNewSubscriptionRaw(String jsonPayload) throws ChargebeeException { - return postJson("/pricing_page_sessions/create_for_new_subscription", jsonPayload); + return postJson( + "pricingPageSession", + "createForNewSubscription", + "/pricing_page_sessions/create_for_new_subscription", + jsonPayload); } public PricingPageSessionCreateForNewSubscriptionResponse createForNewSubscription( @@ -133,6 +147,8 @@ public PricingPageSessionCreateForNewSubscriptionResponse createForNewSubscripti createForNewSubscriptionAsync(PricingPageSessionCreateForNewSubscriptionParams params) { return postAsync( + "pricingPageSession", + "createForNewSubscription", "/pricing_page_sessions/create_for_new_subscription", params != null ? params.toFormData() : null) .thenApply( diff --git a/src/main/java/com/chargebee/v4/services/ProductService.java b/src/main/java/com/chargebee/v4/services/ProductService.java index 1a91f535d..5e4829e39 100644 --- a/src/main/java/com/chargebee/v4/services/ProductService.java +++ b/src/main/java/com/chargebee/v4/services/ProductService.java @@ -71,7 +71,7 @@ public ProductService withOptions(RequestOptions options) { Response retrieveRaw(String productId) throws ChargebeeException { String path = buildPathWithParams("/products/{product-id}", "product-id", productId); - return get(path, null); + return get("product", "retrieve", path, null); } public ProductRetrieveResponse retrieve(String productId) throws ChargebeeException { @@ -83,7 +83,7 @@ public ProductRetrieveResponse retrieve(String productId) throws ChargebeeExcept public CompletableFuture retrieveAsync(String productId) { String path = buildPathWithParams("/products/{product-id}", "product-id", productId); - return getAsync(path, null) + return getAsync("product", "retrieve", path, null) .thenApply( response -> ProductRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -92,19 +92,19 @@ public CompletableFuture retrieveAsync(String productId Response updateRaw(String productId) throws ChargebeeException { String path = buildPathWithParams("/products/{product-id}", "product-id", productId); - return post(path, null); + return post("product", "update", path, null); } /** update a product using immutable params (executes immediately) - returns raw Response. */ Response updateRaw(String productId, ProductUpdateParams params) throws ChargebeeException { String path = buildPathWithParams("/products/{product-id}", "product-id", productId); - return post(path, params.toFormData()); + return post("product", "update", path, params.toFormData()); } /** update a product using raw JSON payload (executes immediately) - returns raw Response. */ Response updateRaw(String productId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/products/{product-id}", "product-id", productId); - return postJson(path, jsonPayload); + return postJson("product", "update", path, jsonPayload); } public ProductUpdateResponse update(String productId, ProductUpdateParams params) @@ -117,7 +117,7 @@ public ProductUpdateResponse update(String productId, ProductUpdateParams params public CompletableFuture updateAsync( String productId, ProductUpdateParams params) { String path = buildPathWithParams("/products/{product-id}", "product-id", productId); - return postAsync(path, params.toFormData()) + return postAsync("product", "update", path, params.toFormData()) .thenApply( response -> ProductUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -131,7 +131,7 @@ public ProductUpdateResponse update(String productId) throws ChargebeeException public CompletableFuture updateAsync(String productId) { String path = buildPathWithParams("/products/{product-id}", "product-id", productId); - return postAsync(path, null) + return postAsync("product", "update", path, null) .thenApply( response -> ProductUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -140,7 +140,7 @@ public CompletableFuture updateAsync(String productId) { Response deleteRaw(String productId) throws ChargebeeException { String path = buildPathWithParams("/products/{product-id}/delete", "product-id", productId); - return post(path, null); + return post("product", "delete", path, null); } public ProductDeleteResponse delete(String productId) throws ChargebeeException { @@ -152,7 +152,7 @@ public ProductDeleteResponse delete(String productId) throws ChargebeeException public CompletableFuture deleteAsync(String productId) { String path = buildPathWithParams("/products/{product-id}/delete", "product-id", productId); - return postAsync(path, null) + return postAsync("product", "delete", path, null) .thenApply( response -> ProductDeleteResponse.fromJson(response.getBodyAsString(), response)); } @@ -162,7 +162,7 @@ Response updateOptionsRaw(String productId) throws ChargebeeException { String path = buildPathWithParams("/products/{product-id}/update_options", "product-id", productId); - return post(path, null); + return post("product", "updateOptions", path, null); } /** @@ -172,7 +172,7 @@ Response updateOptionsRaw(String productId, ProductUpdateOptionsParams params) throws ChargebeeException { String path = buildPathWithParams("/products/{product-id}/update_options", "product-id", productId); - return post(path, params.toFormData()); + return post("product", "updateOptions", path, params.toFormData()); } /** @@ -181,7 +181,7 @@ Response updateOptionsRaw(String productId, ProductUpdateOptionsParams params) Response updateOptionsRaw(String productId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/products/{product-id}/update_options", "product-id", productId); - return postJson(path, jsonPayload); + return postJson("product", "updateOptions", path, jsonPayload); } public ProductUpdateOptionsResponse updateOptions( @@ -195,7 +195,7 @@ public CompletableFuture updateOptionsAsync( String productId, ProductUpdateOptionsParams params) { String path = buildPathWithParams("/products/{product-id}/update_options", "product-id", productId); - return postAsync(path, params.toFormData()) + return postAsync("product", "updateOptions", path, params.toFormData()) .thenApply( response -> ProductUpdateOptionsResponse.fromJson(response.getBodyAsString(), response)); @@ -211,7 +211,7 @@ public CompletableFuture updateOptionsAsync(String String path = buildPathWithParams("/products/{product-id}/update_options", "product-id", productId); - return postAsync(path, null) + return postAsync("product", "updateOptions", path, null) .thenApply( response -> ProductUpdateOptionsResponse.fromJson(response.getBodyAsString(), response)); @@ -220,13 +220,13 @@ public CompletableFuture updateOptionsAsync(String /** list a product using immutable params (executes immediately) - returns raw Response. */ Response listRaw(ProductListParams params) throws ChargebeeException { - return get("/products", params != null ? params.toQueryParams() : null); + return get("product", "list", "/products", params != null ? params.toQueryParams() : null); } /** list a product without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/products", null); + return get("product", "list", "/products", null); } /** list a product using raw JSON payload (executes immediately) - returns raw Response. */ @@ -244,7 +244,7 @@ public ProductListResponse list(ProductListParams params) throws ChargebeeExcept /** Async variant of list for product with params. */ public CompletableFuture listAsync(ProductListParams params) { - return getAsync("/products", params != null ? params.toQueryParams() : null) + return getAsync("product", "list", "/products", params != null ? params.toQueryParams() : null) .thenApply( response -> ProductListResponse.fromJson(response.getBodyAsString(), this, params, response)); @@ -259,7 +259,7 @@ public ProductListResponse list() throws ChargebeeException { /** Async variant of list for product without params. */ public CompletableFuture listAsync() { - return getAsync("/products", null) + return getAsync("product", "list", "/products", null) .thenApply( response -> ProductListResponse.fromJson(response.getBodyAsString(), this, null, response)); @@ -268,13 +268,13 @@ public CompletableFuture listAsync() { /** create a product using immutable params (executes immediately) - returns raw Response. */ Response createRaw(ProductCreateParams params) throws ChargebeeException { - return post("/products", params != null ? params.toFormData() : null); + return post("product", "create", "/products", params != null ? params.toFormData() : null); } /** create a product using raw JSON payload (executes immediately) - returns raw Response. */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/products", jsonPayload); + return postJson("product", "create", "/products", jsonPayload); } public ProductCreateResponse create(ProductCreateParams params) throws ChargebeeException { @@ -286,7 +286,7 @@ public ProductCreateResponse create(ProductCreateParams params) throws Chargebee /** Async variant of create for product with params. */ public CompletableFuture createAsync(ProductCreateParams params) { - return postAsync("/products", params != null ? params.toFormData() : null) + return postAsync("product", "create", "/products", params != null ? params.toFormData() : null) .thenApply( response -> 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 5e63ba190..aa9139024 100644 --- a/src/main/java/com/chargebee/v4/services/PromotionalCreditService.java +++ b/src/main/java/com/chargebee/v4/services/PromotionalCreditService.java @@ -72,7 +72,7 @@ Response retrieveRaw(String accountCreditId) throws ChargebeeException { buildPathWithParams( "/promotional_credits/{account-credit-id}", "account-credit-id", accountCreditId); - return get(path, null); + return get("promotionalCredit", "retrieve", path, null); } public PromotionalCreditRetrieveResponse retrieve(String accountCreditId) @@ -88,7 +88,7 @@ public CompletableFuture retrieveAsync( buildPathWithParams( "/promotional_credits/{account-credit-id}", "account-credit-id", accountCreditId); - return getAsync(path, null) + return getAsync("promotionalCredit", "retrieve", path, null) .thenApply( response -> PromotionalCreditRetrieveResponse.fromJson(response.getBodyAsString(), response)); @@ -99,13 +99,17 @@ public CompletableFuture retrieveAsync( */ Response listRaw(PromotionalCreditListParams params) throws ChargebeeException { - return get("/promotional_credits", params != null ? params.toQueryParams() : null); + return get( + "promotionalCredit", + "list", + "/promotional_credits", + params != null ? params.toQueryParams() : null); } /** list a promotionalCredit without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/promotional_credits", null); + return get("promotionalCredit", "list", "/promotional_credits", null); } /** @@ -128,7 +132,11 @@ public PromotionalCreditListResponse list(PromotionalCreditListParams params) public CompletableFuture listAsync( PromotionalCreditListParams params) { - return getAsync("/promotional_credits", params != null ? params.toQueryParams() : null) + return getAsync( + "promotionalCredit", + "list", + "/promotional_credits", + params != null ? params.toQueryParams() : null) .thenApply( response -> PromotionalCreditListResponse.fromJson( @@ -144,7 +152,7 @@ public PromotionalCreditListResponse list() throws ChargebeeException { /** Async variant of list for promotionalCredit without params. */ public CompletableFuture listAsync() { - return getAsync("/promotional_credits", null) + return getAsync("promotionalCredit", "list", "/promotional_credits", null) .thenApply( response -> PromotionalCreditListResponse.fromJson( @@ -157,7 +165,11 @@ public CompletableFuture listAsync() { */ Response deductRaw(PromotionalCreditDeductParams params) throws ChargebeeException { - return post("/promotional_credits/deduct", params != null ? params.toFormData() : null); + return post( + "promotionalCredit", + "deduct", + "/promotional_credits/deduct", + params != null ? params.toFormData() : null); } /** @@ -166,7 +178,7 @@ Response deductRaw(PromotionalCreditDeductParams params) throws ChargebeeExcepti */ Response deductRaw(String jsonPayload) throws ChargebeeException { - return postJson("/promotional_credits/deduct", jsonPayload); + return postJson("promotionalCredit", "deduct", "/promotional_credits/deduct", jsonPayload); } public PromotionalCreditDeductResponse deduct(PromotionalCreditDeductParams params) @@ -180,7 +192,11 @@ public PromotionalCreditDeductResponse deduct(PromotionalCreditDeductParams para public CompletableFuture deductAsync( PromotionalCreditDeductParams params) { - return postAsync("/promotional_credits/deduct", params != null ? params.toFormData() : null) + return postAsync( + "promotionalCredit", + "deduct", + "/promotional_credits/deduct", + params != null ? params.toFormData() : null) .thenApply( response -> PromotionalCreditDeductResponse.fromJson(response.getBodyAsString(), response)); @@ -191,7 +207,11 @@ public CompletableFuture deductAsync( */ Response setRaw(PromotionalCreditSetParams params) throws ChargebeeException { - return post("/promotional_credits/set", params != null ? params.toFormData() : null); + return post( + "promotionalCredit", + "set", + "/promotional_credits/set", + params != null ? params.toFormData() : null); } /** @@ -199,7 +219,7 @@ Response setRaw(PromotionalCreditSetParams params) throws ChargebeeException { */ Response setRaw(String jsonPayload) throws ChargebeeException { - return postJson("/promotional_credits/set", jsonPayload); + return postJson("promotionalCredit", "set", "/promotional_credits/set", jsonPayload); } public PromotionalCreditSetResponse set(PromotionalCreditSetParams params) @@ -213,7 +233,11 @@ public PromotionalCreditSetResponse set(PromotionalCreditSetParams params) public CompletableFuture setAsync( PromotionalCreditSetParams params) { - return postAsync("/promotional_credits/set", params != null ? params.toFormData() : null) + return postAsync( + "promotionalCredit", + "set", + "/promotional_credits/set", + params != null ? params.toFormData() : null) .thenApply( response -> PromotionalCreditSetResponse.fromJson(response.getBodyAsString(), response)); @@ -224,7 +248,11 @@ public CompletableFuture setAsync( */ Response addRaw(PromotionalCreditAddParams params) throws ChargebeeException { - return post("/promotional_credits/add", params != null ? params.toFormData() : null); + return post( + "promotionalCredit", + "add", + "/promotional_credits/add", + params != null ? params.toFormData() : null); } /** @@ -232,7 +260,7 @@ Response addRaw(PromotionalCreditAddParams params) throws ChargebeeException { */ Response addRaw(String jsonPayload) throws ChargebeeException { - return postJson("/promotional_credits/add", jsonPayload); + return postJson("promotionalCredit", "add", "/promotional_credits/add", jsonPayload); } public PromotionalCreditAddResponse add(PromotionalCreditAddParams params) @@ -246,7 +274,11 @@ public PromotionalCreditAddResponse add(PromotionalCreditAddParams params) public CompletableFuture addAsync( PromotionalCreditAddParams params) { - return postAsync("/promotional_credits/add", params != null ? params.toFormData() : null) + return postAsync( + "promotionalCredit", + "add", + "/promotional_credits/add", + params != null ? params.toFormData() : null) .thenApply( response -> 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 c0e87713c..4e9d731ef 100644 --- a/src/main/java/com/chargebee/v4/services/PurchaseService.java +++ b/src/main/java/com/chargebee/v4/services/PurchaseService.java @@ -58,13 +58,13 @@ public PurchaseService withOptions(RequestOptions options) { /** create a purchase using immutable params (executes immediately) - returns raw Response. */ Response createRaw(PurchaseCreateParams params) throws ChargebeeException { - return post("/purchases", params != null ? params.toFormData() : null); + return post("purchase", "create", "/purchases", params != null ? params.toFormData() : null); } /** create a purchase using raw JSON payload (executes immediately) - returns raw Response. */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/purchases", jsonPayload); + return postJson("purchase", "create", "/purchases", jsonPayload); } public PurchaseCreateResponse create(PurchaseCreateParams params) throws ChargebeeException { @@ -76,7 +76,8 @@ public PurchaseCreateResponse create(PurchaseCreateParams params) throws Chargeb /** Async variant of create for purchase with params. */ public CompletableFuture createAsync(PurchaseCreateParams params) { - return postAsync("/purchases", params != null ? params.toFormData() : null) + return postAsync( + "purchase", "create", "/purchases", params != null ? params.toFormData() : null) .thenApply( response -> PurchaseCreateResponse.fromJson(response.getBodyAsString(), response)); } @@ -84,13 +85,14 @@ public CompletableFuture createAsync(PurchaseCreateParam /** estimate a purchase using immutable params (executes immediately) - returns raw Response. */ Response estimateRaw(PurchaseEstimateParams params) throws ChargebeeException { - return post("/purchases/estimate", params != null ? params.toFormData() : null); + return post( + "purchase", "estimate", "/purchases/estimate", params != null ? params.toFormData() : null); } /** estimate a purchase using raw JSON payload (executes immediately) - returns raw Response. */ Response estimateRaw(String jsonPayload) throws ChargebeeException { - return postJson("/purchases/estimate", jsonPayload); + return postJson("purchase", "estimate", "/purchases/estimate", jsonPayload); } public PurchaseEstimateResponse estimate(PurchaseEstimateParams params) @@ -103,7 +105,11 @@ public PurchaseEstimateResponse estimate(PurchaseEstimateParams params) /** Async variant of estimate for purchase with params. */ public CompletableFuture estimateAsync(PurchaseEstimateParams params) { - return postAsync("/purchases/estimate", params != null ? params.toFormData() : null) + return postAsync( + "purchase", + "estimate", + "/purchases/estimate", + params != null ? params.toFormData() : null) .thenApply( response -> 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 bd35a93b8..24fb5a4a3 100644 --- a/src/main/java/com/chargebee/v4/services/QuoteService.java +++ b/src/main/java/com/chargebee/v4/services/QuoteService.java @@ -149,7 +149,7 @@ Response createSubscriptionItemsForCustomerQuoteRaw(String customerId) throws Ch "customer-id", customerId); - return post(path, null); + return post("quote", "createSubscriptionItemsForCustomerQuote", path, null); } /** @@ -164,7 +164,7 @@ Response createSubscriptionItemsForCustomerQuoteRaw( "/customers/{customer-id}/create_subscription_quote_for_items", "customer-id", customerId); - return post(path, params.toFormData()); + return post("quote", "createSubscriptionItemsForCustomerQuote", path, params.toFormData()); } /** @@ -178,7 +178,7 @@ Response createSubscriptionItemsForCustomerQuoteRaw(String customerId, String js "/customers/{customer-id}/create_subscription_quote_for_items", "customer-id", customerId); - return postJson(path, jsonPayload); + return postJson("quote", "createSubscriptionItemsForCustomerQuote", path, jsonPayload); } public CreateSubscriptionItemsForCustomerQuoteResponse createSubscriptionItemsForCustomerQuote( @@ -198,7 +198,7 @@ public CreateSubscriptionItemsForCustomerQuoteResponse createSubscriptionItemsFo "/customers/{customer-id}/create_subscription_quote_for_items", "customer-id", customerId); - return postAsync(path, params.toFormData()) + return postAsync("quote", "createSubscriptionItemsForCustomerQuote", path, params.toFormData()) .thenApply( response -> CreateSubscriptionItemsForCustomerQuoteResponse.fromJson( @@ -221,7 +221,7 @@ public CreateSubscriptionItemsForCustomerQuoteResponse createSubscriptionItemsFo "customer-id", customerId); - return postAsync(path, null) + return postAsync("quote", "createSubscriptionItemsForCustomerQuote", path, null) .thenApply( response -> CreateSubscriptionItemsForCustomerQuoteResponse.fromJson( @@ -232,7 +232,7 @@ public CreateSubscriptionItemsForCustomerQuoteResponse createSubscriptionItemsFo Response retrieveRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}", "quote-id", quoteId); - return get(path, null); + return get("quote", "retrieve", path, null); } public QuoteRetrieveResponse retrieve(String quoteId) throws ChargebeeException { @@ -244,7 +244,7 @@ public QuoteRetrieveResponse retrieve(String quoteId) throws ChargebeeException public CompletableFuture retrieveAsync(String quoteId) { String path = buildPathWithParams("/quotes/{quote-id}", "quote-id", quoteId); - return getAsync(path, null) + return getAsync("quote", "retrieve", path, null) .thenApply( response -> QuoteRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -254,7 +254,7 @@ Response updateSignatureStatusRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/update_signature_status", "quote-id", quoteId); - return post(path, null); + return post("quote", "updateSignatureStatus", path, null); } /** @@ -265,7 +265,7 @@ Response updateSignatureStatusRaw(String quoteId, QuoteUpdateSignatureStatusPara throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/update_signature_status", "quote-id", quoteId); - return post(path, params.toFormData()); + return post("quote", "updateSignatureStatus", path, params.toFormData()); } /** @@ -275,7 +275,7 @@ Response updateSignatureStatusRaw(String quoteId, QuoteUpdateSignatureStatusPara Response updateSignatureStatusRaw(String quoteId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/update_signature_status", "quote-id", quoteId); - return postJson(path, jsonPayload); + return postJson("quote", "updateSignatureStatus", path, jsonPayload); } public QuoteUpdateSignatureStatusResponse updateSignatureStatus( @@ -289,7 +289,7 @@ public CompletableFuture updateSignatureStat String quoteId, QuoteUpdateSignatureStatusParams params) { String path = buildPathWithParams("/quotes/{quote-id}/update_signature_status", "quote-id", quoteId); - return postAsync(path, params.toFormData()) + return postAsync("quote", "updateSignatureStatus", path, params.toFormData()) .thenApply( response -> QuoteUpdateSignatureStatusResponse.fromJson(response.getBodyAsString(), response)); @@ -307,7 +307,7 @@ public CompletableFuture updateSignatureStat String path = buildPathWithParams("/quotes/{quote-id}/update_signature_status", "quote-id", quoteId); - return postAsync(path, null) + return postAsync("quote", "updateSignatureStatus", path, null) .thenApply( response -> QuoteUpdateSignatureStatusResponse.fromJson(response.getBodyAsString(), response)); @@ -317,7 +317,7 @@ public CompletableFuture updateSignatureStat Response updateSignatureRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/update_signature", "quote-id", quoteId); - return post(path, null); + return post("quote", "updateSignature", path, null); } public QuoteUpdateSignatureResponse updateSignature(String quoteId) throws ChargebeeException { @@ -329,7 +329,7 @@ public QuoteUpdateSignatureResponse updateSignature(String quoteId) throws Charg public CompletableFuture updateSignatureAsync(String quoteId) { String path = buildPathWithParams("/quotes/{quote-id}/update_signature", "quote-id", quoteId); - return postAsync(path, null) + return postAsync("quote", "updateSignature", path, null) .thenApply( response -> QuoteUpdateSignatureResponse.fromJson(response.getBodyAsString(), response)); @@ -339,20 +339,20 @@ public CompletableFuture updateSignatureAsync(Stri Response updateStatusRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/update_status", "quote-id", quoteId); - return post(path, null); + return post("quote", "updateStatus", path, null); } /** 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()); + return post("quote", "updateStatus", path, params.toFormData()); } /** 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); + return postJson("quote", "updateStatus", path, jsonPayload); } public QuoteUpdateStatusResponse updateStatus(String quoteId, QuoteUpdateStatusParams params) @@ -365,7 +365,7 @@ public QuoteUpdateStatusResponse updateStatus(String quoteId, QuoteUpdateStatusP public CompletableFuture updateStatusAsync( String quoteId, QuoteUpdateStatusParams params) { String path = buildPathWithParams("/quotes/{quote-id}/update_status", "quote-id", quoteId); - return postAsync(path, params.toFormData()) + return postAsync("quote", "updateStatus", path, params.toFormData()) .thenApply( response -> QuoteUpdateStatusResponse.fromJson(response.getBodyAsString(), response)); } @@ -374,7 +374,7 @@ public CompletableFuture updateStatusAsync( Response extendExpiryDateRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/extend_expiry_date", "quote-id", quoteId); - return post(path, null); + return post("quote", "extendExpiryDate", path, null); } /** @@ -383,7 +383,7 @@ Response extendExpiryDateRaw(String quoteId) throws ChargebeeException { 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()); + return post("quote", "extendExpiryDate", path, params.toFormData()); } /** @@ -391,7 +391,7 @@ Response extendExpiryDateRaw(String quoteId, QuoteExtendExpiryDateParams params) */ Response extendExpiryDateRaw(String quoteId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/extend_expiry_date", "quote-id", quoteId); - return postJson(path, jsonPayload); + return postJson("quote", "extendExpiryDate", path, jsonPayload); } public QuoteExtendExpiryDateResponse extendExpiryDate( @@ -404,7 +404,7 @@ public QuoteExtendExpiryDateResponse extendExpiryDate( public CompletableFuture extendExpiryDateAsync( String quoteId, QuoteExtendExpiryDateParams params) { String path = buildPathWithParams("/quotes/{quote-id}/extend_expiry_date", "quote-id", quoteId); - return postAsync(path, params.toFormData()) + return postAsync("quote", "extendExpiryDate", path, params.toFormData()) .thenApply( response -> QuoteExtendExpiryDateResponse.fromJson(response.getBodyAsString(), response)); @@ -415,7 +415,7 @@ Response retrieveSignedPdfRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/retrieve_signed_pdf", "quote-id", quoteId); - return post(path, null); + return post("quote", "retrieveSignedPdf", path, null); } public QuoteRetrieveSignedPdfResponse retrieveSignedPdf(String quoteId) @@ -429,7 +429,7 @@ public CompletableFuture retrieveSignedPdfAsync( String path = buildPathWithParams("/quotes/{quote-id}/retrieve_signed_pdf", "quote-id", quoteId); - return postAsync(path, null) + return postAsync("quote", "retrieveSignedPdf", path, null) .thenApply( response -> QuoteRetrieveSignedPdfResponse.fromJson(response.getBodyAsString(), response)); @@ -441,7 +441,7 @@ Response editUpdateSubscriptionQuoteForItemsRaw(String quoteId) throws Chargebee buildPathWithParams( "/quotes/{quote-id}/edit_update_subscription_quote_for_items", "quote-id", quoteId); - return post(path, null); + return post("quote", "editUpdateSubscriptionQuoteForItems", path, null); } /** @@ -453,7 +453,7 @@ Response editUpdateSubscriptionQuoteForItemsRaw( String path = buildPathWithParams( "/quotes/{quote-id}/edit_update_subscription_quote_for_items", "quote-id", quoteId); - return post(path, params.toFormData()); + return post("quote", "editUpdateSubscriptionQuoteForItems", path, params.toFormData()); } /** @@ -465,7 +465,7 @@ Response editUpdateSubscriptionQuoteForItemsRaw(String quoteId, String jsonPaylo String path = buildPathWithParams( "/quotes/{quote-id}/edit_update_subscription_quote_for_items", "quote-id", quoteId); - return postJson(path, jsonPayload); + return postJson("quote", "editUpdateSubscriptionQuoteForItems", path, jsonPayload); } public EditUpdateSubscriptionQuoteForItemsResponse editUpdateSubscriptionQuoteForItems( @@ -482,7 +482,7 @@ public EditUpdateSubscriptionQuoteForItemsResponse editUpdateSubscriptionQuoteFo String path = buildPathWithParams( "/quotes/{quote-id}/edit_update_subscription_quote_for_items", "quote-id", quoteId); - return postAsync(path, params.toFormData()) + return postAsync("quote", "editUpdateSubscriptionQuoteForItems", path, params.toFormData()) .thenApply( response -> EditUpdateSubscriptionQuoteForItemsResponse.fromJson( @@ -503,7 +503,7 @@ public EditUpdateSubscriptionQuoteForItemsResponse editUpdateSubscriptionQuoteFo buildPathWithParams( "/quotes/{quote-id}/edit_update_subscription_quote_for_items", "quote-id", quoteId); - return postAsync(path, null) + return postAsync("quote", "editUpdateSubscriptionQuoteForItems", path, null) .thenApply( response -> EditUpdateSubscriptionQuoteForItemsResponse.fromJson( @@ -513,13 +513,13 @@ public EditUpdateSubscriptionQuoteForItemsResponse editUpdateSubscriptionQuoteFo /** list a quote using immutable params (executes immediately) - returns raw Response. */ Response listRaw(QuoteListParams params) throws ChargebeeException { - return get("/quotes", params != null ? params.toQueryParams() : null); + return get("quote", "list", "/quotes", params != null ? params.toQueryParams() : null); } /** list a quote without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/quotes", null); + return get("quote", "list", "/quotes", null); } /** list a quote using raw JSON payload (executes immediately) - returns raw Response. */ @@ -537,7 +537,7 @@ public QuoteListResponse list(QuoteListParams params) throws ChargebeeException /** Async variant of list for quote with params. */ public CompletableFuture listAsync(QuoteListParams params) { - return getAsync("/quotes", params != null ? params.toQueryParams() : null) + return getAsync("quote", "list", "/quotes", params != null ? params.toQueryParams() : null) .thenApply( response -> QuoteListResponse.fromJson(response.getBodyAsString(), this, params, response)); @@ -552,7 +552,7 @@ public QuoteListResponse list() throws ChargebeeException { /** Async variant of list for quote without params. */ public CompletableFuture listAsync() { - return getAsync("/quotes", null) + return getAsync("quote", "list", "/quotes", null) .thenApply( response -> QuoteListResponse.fromJson(response.getBodyAsString(), this, null, response)); @@ -562,7 +562,7 @@ public CompletableFuture listAsync() { Response retrieveSignatureRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/retrieve_signature", "quote-id", quoteId); - return get(path, null); + return get("quote", "retrieveSignature", path, null); } public QuoteRetrieveSignatureResponse retrieveSignature(String quoteId) @@ -575,7 +575,7 @@ public QuoteRetrieveSignatureResponse retrieveSignature(String quoteId) public CompletableFuture retrieveSignatureAsync(String quoteId) { String path = buildPathWithParams("/quotes/{quote-id}/retrieve_signature", "quote-id", quoteId); - return getAsync(path, null) + return getAsync("quote", "retrieveSignature", path, null) .thenApply( response -> QuoteRetrieveSignatureResponse.fromJson(response.getBodyAsString(), response)); @@ -585,19 +585,19 @@ public CompletableFuture retrieveSignatureAsync( Response convertRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/convert", "quote-id", quoteId); - return post(path, null); + return post("quote", "convert", path, null); } /** 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()); + return post("quote", "convert", path, params.toFormData()); } /** 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); + return postJson("quote", "convert", path, jsonPayload); } public QuoteConvertResponse convert(String quoteId, QuoteConvertParams params) @@ -610,7 +610,7 @@ public QuoteConvertResponse convert(String quoteId, QuoteConvertParams params) public CompletableFuture convertAsync( String quoteId, QuoteConvertParams params) { String path = buildPathWithParams("/quotes/{quote-id}/convert", "quote-id", quoteId); - return postAsync(path, params.toFormData()) + return postAsync("quote", "convert", path, params.toFormData()) .thenApply(response -> QuoteConvertResponse.fromJson(response.getBodyAsString(), response)); } @@ -623,7 +623,7 @@ public QuoteConvertResponse convert(String quoteId) throws ChargebeeException { public CompletableFuture convertAsync(String quoteId) { String path = buildPathWithParams("/quotes/{quote-id}/convert", "quote-id", quoteId); - return postAsync(path, null) + return postAsync("quote", "convert", path, null) .thenApply(response -> QuoteConvertResponse.fromJson(response.getBodyAsString(), response)); } @@ -631,19 +631,19 @@ public CompletableFuture convertAsync(String quoteId) { Response deleteRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/delete", "quote-id", quoteId); - return post(path, null); + return post("quote", "delete", path, null); } /** 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()); + return post("quote", "delete", path, params.toFormData()); } /** 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); + return postJson("quote", "delete", path, jsonPayload); } public QuoteDeleteResponse delete(String quoteId, QuoteDeleteParams params) @@ -656,7 +656,7 @@ public QuoteDeleteResponse delete(String quoteId, QuoteDeleteParams params) public CompletableFuture deleteAsync( String quoteId, QuoteDeleteParams params) { String path = buildPathWithParams("/quotes/{quote-id}/delete", "quote-id", quoteId); - return postAsync(path, params.toFormData()) + return postAsync("quote", "delete", path, params.toFormData()) .thenApply(response -> QuoteDeleteResponse.fromJson(response.getBodyAsString(), response)); } @@ -669,7 +669,7 @@ public QuoteDeleteResponse delete(String quoteId) throws ChargebeeException { public CompletableFuture deleteAsync(String quoteId) { String path = buildPathWithParams("/quotes/{quote-id}/delete", "quote-id", quoteId); - return postAsync(path, null) + return postAsync("quote", "delete", path, null) .thenApply(response -> QuoteDeleteResponse.fromJson(response.getBodyAsString(), response)); } @@ -683,7 +683,7 @@ Response editCreateSubscriptionCustomerQuoteForItemsRaw(String quoteId) buildPathWithParams( "/quotes/{quote-id}/edit_create_subscription_quote_for_items", "quote-id", quoteId); - return post(path, null); + return post("quote", "editCreateSubscriptionCustomerQuoteForItems", path, null); } /** @@ -696,7 +696,7 @@ Response editCreateSubscriptionCustomerQuoteForItemsRaw( String path = buildPathWithParams( "/quotes/{quote-id}/edit_create_subscription_quote_for_items", "quote-id", quoteId); - return post(path, params.toFormData()); + return post("quote", "editCreateSubscriptionCustomerQuoteForItems", path, params.toFormData()); } /** @@ -708,7 +708,7 @@ Response editCreateSubscriptionCustomerQuoteForItemsRaw(String quoteId, String j String path = buildPathWithParams( "/quotes/{quote-id}/edit_create_subscription_quote_for_items", "quote-id", quoteId); - return postJson(path, jsonPayload); + return postJson("quote", "editCreateSubscriptionCustomerQuoteForItems", path, jsonPayload); } public EditCreateSubscriptionCustomerQuoteForItemsResponse @@ -727,7 +727,8 @@ Response editCreateSubscriptionCustomerQuoteForItemsRaw(String quoteId, String j String path = buildPathWithParams( "/quotes/{quote-id}/edit_create_subscription_quote_for_items", "quote-id", quoteId); - return postAsync(path, params.toFormData()) + return postAsync( + "quote", "editCreateSubscriptionCustomerQuoteForItems", path, params.toFormData()) .thenApply( response -> EditCreateSubscriptionCustomerQuoteForItemsResponse.fromJson( @@ -748,7 +749,7 @@ Response editCreateSubscriptionCustomerQuoteForItemsRaw(String quoteId, String j buildPathWithParams( "/quotes/{quote-id}/edit_create_subscription_quote_for_items", "quote-id", quoteId); - return postAsync(path, null) + return postAsync("quote", "editCreateSubscriptionCustomerQuoteForItems", path, null) .thenApply( response -> EditCreateSubscriptionCustomerQuoteForItemsResponse.fromJson( @@ -763,7 +764,10 @@ Response updateSubscriptionQuoteForItemsRaw(UpdateSubscriptionQuoteForItemsParam throws ChargebeeException { return post( - "/quotes/update_subscription_quote_for_items", params != null ? params.toFormData() : null); + "quote", + "updateSubscriptionQuoteForItems", + "/quotes/update_subscription_quote_for_items", + params != null ? params.toFormData() : null); } /** @@ -772,7 +776,11 @@ Response updateSubscriptionQuoteForItemsRaw(UpdateSubscriptionQuoteForItemsParam */ Response updateSubscriptionQuoteForItemsRaw(String jsonPayload) throws ChargebeeException { - return postJson("/quotes/update_subscription_quote_for_items", jsonPayload); + return postJson( + "quote", + "updateSubscriptionQuoteForItems", + "/quotes/update_subscription_quote_for_items", + jsonPayload); } public UpdateSubscriptionQuoteForItemsResponse updateSubscriptionQuoteForItems( @@ -787,6 +795,8 @@ public UpdateSubscriptionQuoteForItemsResponse updateSubscriptionQuoteForItems( updateSubscriptionQuoteForItemsAsync(UpdateSubscriptionQuoteForItemsParams params) { return postAsync( + "quote", + "updateSubscriptionQuoteForItems", "/quotes/update_subscription_quote_for_items", params != null ? params.toFormData() : null) .thenApply( @@ -802,7 +812,8 @@ public UpdateSubscriptionQuoteForItemsResponse updateSubscriptionQuoteForItems( Response quoteLineGroupsForQuoteRaw(String quoteId, QuoteLineGroupsForQuoteParams params) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/quote_line_groups", "quote-id", quoteId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "quote", "quoteLineGroupsForQuote", path, params != null ? params.toQueryParams() : null); } /** @@ -810,7 +821,7 @@ Response quoteLineGroupsForQuoteRaw(String quoteId, QuoteLineGroupsForQuoteParam */ Response quoteLineGroupsForQuoteRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/quote_line_groups", "quote-id", quoteId); - return get(path, null); + return get("quote", "quoteLineGroupsForQuote", path, null); } /** @@ -841,7 +852,11 @@ public QuoteLineGroupsForQuoteResponse quoteLineGroupsForQuote(String quoteId) public CompletableFuture quoteLineGroupsForQuoteAsync( String quoteId, QuoteLineGroupsForQuoteParams params) { String path = buildPathWithParams("/quotes/{quote-id}/quote_line_groups", "quote-id", quoteId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "quote", + "quoteLineGroupsForQuote", + path, + params != null ? params.toQueryParams() : null) .thenApply( response -> QuoteLineGroupsForQuoteResponse.fromJson( @@ -852,7 +867,7 @@ public CompletableFuture quoteLineGroupsForQuot public CompletableFuture quoteLineGroupsForQuoteAsync( String quoteId) { String path = buildPathWithParams("/quotes/{quote-id}/quote_line_groups", "quote-id", quoteId); - return getAsync(path, null) + return getAsync("quote", "quoteLineGroupsForQuote", path, null) .thenApply( response -> QuoteLineGroupsForQuoteResponse.fromJson( @@ -865,7 +880,7 @@ Response editForChargeItemsAndChargesRaw(String quoteId) throws ChargebeeExcepti buildPathWithParams( "/quotes/{quote-id}/edit_for_charge_items_and_charges", "quote-id", quoteId); - return post(path, null); + return post("quote", "editForChargeItemsAndCharges", path, null); } /** @@ -877,7 +892,7 @@ Response editForChargeItemsAndChargesRaw( String path = buildPathWithParams( "/quotes/{quote-id}/edit_for_charge_items_and_charges", "quote-id", quoteId); - return post(path, params.toFormData()); + return post("quote", "editForChargeItemsAndCharges", path, params.toFormData()); } /** @@ -889,7 +904,7 @@ Response editForChargeItemsAndChargesRaw(String quoteId, String jsonPayload) String path = buildPathWithParams( "/quotes/{quote-id}/edit_for_charge_items_and_charges", "quote-id", quoteId); - return postJson(path, jsonPayload); + return postJson("quote", "editForChargeItemsAndCharges", path, jsonPayload); } public QuoteEditForChargeItemsAndChargesResponse editForChargeItemsAndCharges( @@ -905,7 +920,7 @@ public QuoteEditForChargeItemsAndChargesResponse editForChargeItemsAndCharges( String path = buildPathWithParams( "/quotes/{quote-id}/edit_for_charge_items_and_charges", "quote-id", quoteId); - return postAsync(path, params.toFormData()) + return postAsync("quote", "editForChargeItemsAndCharges", path, params.toFormData()) .thenApply( response -> QuoteEditForChargeItemsAndChargesResponse.fromJson( @@ -925,7 +940,7 @@ public QuoteEditForChargeItemsAndChargesResponse editForChargeItemsAndCharges(St buildPathWithParams( "/quotes/{quote-id}/edit_for_charge_items_and_charges", "quote-id", quoteId); - return postAsync(path, null) + return postAsync("quote", "editForChargeItemsAndCharges", path, null) .thenApply( response -> QuoteEditForChargeItemsAndChargesResponse.fromJson( @@ -936,7 +951,7 @@ public QuoteEditForChargeItemsAndChargesResponse editForChargeItemsAndCharges(St Response createSignatureRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/create_signature", "quote-id", quoteId); - return post(path, null); + return post("quote", "createSignature", path, null); } public QuoteCreateSignatureResponse createSignature(String quoteId) throws ChargebeeException { @@ -948,7 +963,7 @@ public QuoteCreateSignatureResponse createSignature(String quoteId) throws Charg public CompletableFuture createSignatureAsync(String quoteId) { String path = buildPathWithParams("/quotes/{quote-id}/create_signature", "quote-id", quoteId); - return postAsync(path, null) + return postAsync("quote", "createSignature", path, null) .thenApply( response -> QuoteCreateSignatureResponse.fromJson(response.getBodyAsString(), response)); @@ -959,7 +974,7 @@ Response refreshSignatureLinkRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/refresh_signature_link", "quote-id", quoteId); - return post(path, null); + return post("quote", "refreshSignatureLink", path, null); } public QuoteRefreshSignatureLinkResponse refreshSignatureLink(String quoteId) @@ -974,7 +989,7 @@ public CompletableFuture refreshSignatureLink String path = buildPathWithParams("/quotes/{quote-id}/refresh_signature_link", "quote-id", quoteId); - return postAsync(path, null) + return postAsync("quote", "refreshSignatureLink", path, null) .thenApply( response -> QuoteRefreshSignatureLinkResponse.fromJson(response.getBodyAsString(), response)); @@ -984,19 +999,19 @@ public CompletableFuture refreshSignatureLink Response pdfRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/pdf", "quote-id", quoteId); - return post(path, null); + return post("quote", "pdf", path, null); } /** 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()); + return post("quote", "pdf", path, params.toFormData()); } /** 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); + return postJson("quote", "pdf", path, jsonPayload); } public QuotePdfResponse pdf(String quoteId, QuotePdfParams params) throws ChargebeeException { @@ -1007,7 +1022,7 @@ public QuotePdfResponse pdf(String quoteId, QuotePdfParams params) throws Charge /** Async variant of pdf for quote with params. */ public CompletableFuture pdfAsync(String quoteId, QuotePdfParams params) { String path = buildPathWithParams("/quotes/{quote-id}/pdf", "quote-id", quoteId); - return postAsync(path, params.toFormData()) + return postAsync("quote", "pdf", path, params.toFormData()) .thenApply(response -> QuotePdfResponse.fromJson(response.getBodyAsString(), response)); } @@ -1020,7 +1035,7 @@ public QuotePdfResponse pdf(String quoteId) throws ChargebeeException { public CompletableFuture pdfAsync(String quoteId) { String path = buildPathWithParams("/quotes/{quote-id}/pdf", "quote-id", quoteId); - return postAsync(path, null) + return postAsync("quote", "pdf", path, null) .thenApply(response -> QuotePdfResponse.fromJson(response.getBodyAsString(), response)); } @@ -1032,7 +1047,10 @@ Response createForChargeItemsAndChargesRaw(QuoteCreateForChargeItemsAndChargesPa throws ChargebeeException { return post( - "/quotes/create_for_charge_items_and_charges", params != null ? params.toFormData() : null); + "quote", + "createForChargeItemsAndCharges", + "/quotes/create_for_charge_items_and_charges", + params != null ? params.toFormData() : null); } /** @@ -1041,7 +1059,11 @@ Response createForChargeItemsAndChargesRaw(QuoteCreateForChargeItemsAndChargesPa */ Response createForChargeItemsAndChargesRaw(String jsonPayload) throws ChargebeeException { - return postJson("/quotes/create_for_charge_items_and_charges", jsonPayload); + return postJson( + "quote", + "createForChargeItemsAndCharges", + "/quotes/create_for_charge_items_and_charges", + jsonPayload); } public QuoteCreateForChargeItemsAndChargesResponse createForChargeItemsAndCharges( @@ -1057,6 +1079,8 @@ public QuoteCreateForChargeItemsAndChargesResponse createForChargeItemsAndCharge createForChargeItemsAndChargesAsync(QuoteCreateForChargeItemsAndChargesParams params) { return postAsync( + "quote", + "createForChargeItemsAndCharges", "/quotes/create_for_charge_items_and_charges", params != null ? params.toFormData() : null) .thenApply( @@ -1070,7 +1094,7 @@ Response editOneTimeQuoteRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/edit_one_time_quote", "quote-id", quoteId); - return post(path, null); + return post("quote", "editOneTimeQuote", path, null); } /** @@ -1080,7 +1104,7 @@ 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()); + return post("quote", "editOneTimeQuote", path, params.toFormData()); } /** @@ -1089,7 +1113,7 @@ Response editOneTimeQuoteRaw(String quoteId, EditOneTimeQuoteParams params) 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); + return postJson("quote", "editOneTimeQuote", path, jsonPayload); } public EditOneTimeQuoteResponse editOneTimeQuote(String quoteId, EditOneTimeQuoteParams params) @@ -1103,7 +1127,7 @@ public CompletableFuture editOneTimeQuoteAsync( String quoteId, EditOneTimeQuoteParams params) { String path = buildPathWithParams("/quotes/{quote-id}/edit_one_time_quote", "quote-id", quoteId); - return postAsync(path, params.toFormData()) + return postAsync("quote", "editOneTimeQuote", path, params.toFormData()) .thenApply( response -> EditOneTimeQuoteResponse.fromJson(response.getBodyAsString(), response)); } @@ -1118,7 +1142,7 @@ public CompletableFuture editOneTimeQuoteAsync(String String path = buildPathWithParams("/quotes/{quote-id}/edit_one_time_quote", "quote-id", quoteId); - return postAsync(path, null) + return postAsync("quote", "editOneTimeQuote", path, null) .thenApply( response -> EditOneTimeQuoteResponse.fromJson(response.getBodyAsString(), response)); } @@ -1130,7 +1154,11 @@ public CompletableFuture editOneTimeQuoteAsync(String Response updateSubscriptionQuoteRaw(UpdateSubscriptionQuoteParams params) throws ChargebeeException { - return post("/quotes/update_subscription_quote", params != null ? params.toFormData() : null); + return post( + "quote", + "updateSubscriptionQuote", + "/quotes/update_subscription_quote", + params != null ? params.toFormData() : null); } /** @@ -1139,7 +1167,8 @@ Response updateSubscriptionQuoteRaw(UpdateSubscriptionQuoteParams params) */ Response updateSubscriptionQuoteRaw(String jsonPayload) throws ChargebeeException { - return postJson("/quotes/update_subscription_quote", jsonPayload); + return postJson( + "quote", "updateSubscriptionQuote", "/quotes/update_subscription_quote", jsonPayload); } public UpdateSubscriptionQuoteResponse updateSubscriptionQuote( @@ -1154,7 +1183,10 @@ public CompletableFuture updateSubscriptionQuot UpdateSubscriptionQuoteParams params) { return postAsync( - "/quotes/update_subscription_quote", params != null ? params.toFormData() : null) + "quote", + "updateSubscriptionQuote", + "/quotes/update_subscription_quote", + params != null ? params.toFormData() : null) .thenApply( response -> UpdateSubscriptionQuoteResponse.fromJson(response.getBodyAsString(), response)); @@ -1167,7 +1199,11 @@ public CompletableFuture updateSubscriptionQuot Response createForOnetimeChargesRaw(QuoteCreateForOnetimeChargesParams params) throws ChargebeeException { - return post("/quotes/create_for_onetime_charges", params != null ? params.toFormData() : null); + return post( + "quote", + "createForOnetimeCharges", + "/quotes/create_for_onetime_charges", + params != null ? params.toFormData() : null); } /** @@ -1176,7 +1212,8 @@ Response createForOnetimeChargesRaw(QuoteCreateForOnetimeChargesParams params) */ Response createForOnetimeChargesRaw(String jsonPayload) throws ChargebeeException { - return postJson("/quotes/create_for_onetime_charges", jsonPayload); + return postJson( + "quote", "createForOnetimeCharges", "/quotes/create_for_onetime_charges", jsonPayload); } public QuoteCreateForOnetimeChargesResponse createForOnetimeCharges( @@ -1191,7 +1228,10 @@ public CompletableFuture createForOnetimeC QuoteCreateForOnetimeChargesParams params) { return postAsync( - "/quotes/create_for_onetime_charges", params != null ? params.toFormData() : null) + "quote", + "createForOnetimeCharges", + "/quotes/create_for_onetime_charges", + params != null ? params.toFormData() : null) .thenApply( response -> QuoteCreateForOnetimeChargesResponse.fromJson( @@ -1204,7 +1244,7 @@ Response createSubscriptionForCustomerQuoteRaw(String customerId) throws Chargeb buildPathWithParams( "/customers/{customer-id}/create_subscription_quote", "customer-id", customerId); - return post(path, null); + return post("quote", "createSubscriptionForCustomerQuote", path, null); } /** @@ -1217,7 +1257,7 @@ Response createSubscriptionForCustomerQuoteRaw( String path = buildPathWithParams( "/customers/{customer-id}/create_subscription_quote", "customer-id", customerId); - return post(path, params.toFormData()); + return post("quote", "createSubscriptionForCustomerQuote", path, params.toFormData()); } /** @@ -1229,7 +1269,7 @@ Response createSubscriptionForCustomerQuoteRaw(String customerId, String jsonPay String path = buildPathWithParams( "/customers/{customer-id}/create_subscription_quote", "customer-id", customerId); - return postJson(path, jsonPayload); + return postJson("quote", "createSubscriptionForCustomerQuote", path, jsonPayload); } public CreateSubscriptionForCustomerQuoteResponse createSubscriptionForCustomerQuote( @@ -1247,7 +1287,7 @@ public CreateSubscriptionForCustomerQuoteResponse createSubscriptionForCustomerQ String path = buildPathWithParams( "/customers/{customer-id}/create_subscription_quote", "customer-id", customerId); - return postAsync(path, params.toFormData()) + return postAsync("quote", "createSubscriptionForCustomerQuote", path, params.toFormData()) .thenApply( response -> CreateSubscriptionForCustomerQuoteResponse.fromJson( @@ -1268,7 +1308,7 @@ public CreateSubscriptionForCustomerQuoteResponse createSubscriptionForCustomerQ buildPathWithParams( "/customers/{customer-id}/create_subscription_quote", "customer-id", customerId); - return postAsync(path, null) + return postAsync("quote", "createSubscriptionForCustomerQuote", path, null) .thenApply( response -> CreateSubscriptionForCustomerQuoteResponse.fromJson( @@ -1281,7 +1321,7 @@ Response editUpdateSubscriptionQuoteRaw(String quoteId) throws ChargebeeExceptio buildPathWithParams( "/quotes/{quote-id}/edit_update_subscription_quote", "quote-id", quoteId); - return post(path, null); + return post("quote", "editUpdateSubscriptionQuote", path, null); } /** @@ -1293,7 +1333,7 @@ Response editUpdateSubscriptionQuoteRaw(String quoteId, EditUpdateSubscriptionQu String path = buildPathWithParams( "/quotes/{quote-id}/edit_update_subscription_quote", "quote-id", quoteId); - return post(path, params.toFormData()); + return post("quote", "editUpdateSubscriptionQuote", path, params.toFormData()); } /** @@ -1305,7 +1345,7 @@ Response editUpdateSubscriptionQuoteRaw(String quoteId, String jsonPayload) String path = buildPathWithParams( "/quotes/{quote-id}/edit_update_subscription_quote", "quote-id", quoteId); - return postJson(path, jsonPayload); + return postJson("quote", "editUpdateSubscriptionQuote", path, jsonPayload); } public EditUpdateSubscriptionQuoteResponse editUpdateSubscriptionQuote( @@ -1320,7 +1360,7 @@ public CompletableFuture editUpdateSubscrip String path = buildPathWithParams( "/quotes/{quote-id}/edit_update_subscription_quote", "quote-id", quoteId); - return postAsync(path, params.toFormData()) + return postAsync("quote", "editUpdateSubscriptionQuote", path, params.toFormData()) .thenApply( response -> EditUpdateSubscriptionQuoteResponse.fromJson(response.getBodyAsString(), response)); @@ -1339,7 +1379,7 @@ public CompletableFuture editUpdateSubscrip buildPathWithParams( "/quotes/{quote-id}/edit_update_subscription_quote", "quote-id", quoteId); - return postAsync(path, null) + return postAsync("quote", "editUpdateSubscriptionQuote", path, null) .thenApply( response -> EditUpdateSubscriptionQuoteResponse.fromJson(response.getBodyAsString(), response)); @@ -1353,7 +1393,7 @@ Response editCreateSubscriptionForCustomerQuoteRaw(String quoteId) throws Charge buildPathWithParams( "/quotes/{quote-id}/edit_create_subscription_quote", "quote-id", quoteId); - return post(path, null); + return post("quote", "editCreateSubscriptionForCustomerQuote", path, null); } /** @@ -1366,7 +1406,7 @@ Response editCreateSubscriptionForCustomerQuoteRaw( String path = buildPathWithParams( "/quotes/{quote-id}/edit_create_subscription_quote", "quote-id", quoteId); - return post(path, params.toFormData()); + return post("quote", "editCreateSubscriptionForCustomerQuote", path, params.toFormData()); } /** @@ -1378,7 +1418,7 @@ Response editCreateSubscriptionForCustomerQuoteRaw(String quoteId, String jsonPa String path = buildPathWithParams( "/quotes/{quote-id}/edit_create_subscription_quote", "quote-id", quoteId); - return postJson(path, jsonPayload); + return postJson("quote", "editCreateSubscriptionForCustomerQuote", path, jsonPayload); } public EditCreateSubscriptionForCustomerQuoteResponse editCreateSubscriptionForCustomerQuote( @@ -1396,7 +1436,7 @@ public EditCreateSubscriptionForCustomerQuoteResponse editCreateSubscriptionForC String path = buildPathWithParams( "/quotes/{quote-id}/edit_create_subscription_quote", "quote-id", quoteId); - return postAsync(path, params.toFormData()) + return postAsync("quote", "editCreateSubscriptionForCustomerQuote", path, params.toFormData()) .thenApply( response -> EditCreateSubscriptionForCustomerQuoteResponse.fromJson( @@ -1417,7 +1457,7 @@ public EditCreateSubscriptionForCustomerQuoteResponse editCreateSubscriptionForC buildPathWithParams( "/quotes/{quote-id}/edit_create_subscription_quote", "quote-id", quoteId); - return postAsync(path, null) + return postAsync("quote", "editCreateSubscriptionForCustomerQuote", path, null) .thenApply( response -> EditCreateSubscriptionForCustomerQuoteResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/RampService.java b/src/main/java/com/chargebee/v4/services/RampService.java index 8a5e3cda0..3baae33e6 100644 --- a/src/main/java/com/chargebee/v4/services/RampService.java +++ b/src/main/java/com/chargebee/v4/services/RampService.java @@ -67,7 +67,7 @@ public RampService withOptions(RequestOptions options) { Response retrieveRaw(String rampId) throws ChargebeeException { String path = buildPathWithParams("/ramps/{ramp-id}", "ramp-id", rampId); - return get(path, null); + return get("ramp", "retrieve", path, null); } public RampRetrieveResponse retrieve(String rampId) throws ChargebeeException { @@ -79,7 +79,7 @@ public RampRetrieveResponse retrieve(String rampId) throws ChargebeeException { public CompletableFuture retrieveAsync(String rampId) { String path = buildPathWithParams("/ramps/{ramp-id}", "ramp-id", rampId); - return getAsync(path, null) + return getAsync("ramp", "retrieve", path, null) .thenApply(response -> RampRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -89,7 +89,7 @@ Response createForSubscriptionRaw(String subscriptionId) throws ChargebeeExcepti buildPathWithParams( "/subscriptions/{subscription-id}/create_ramp", "subscription-id", subscriptionId); - return post(path, null); + return post("ramp", "createForSubscription", path, null); } /** @@ -101,7 +101,7 @@ Response createForSubscriptionRaw(String subscriptionId, RampCreateForSubscripti String path = buildPathWithParams( "/subscriptions/{subscription-id}/create_ramp", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("ramp", "createForSubscription", path, params.toFormData()); } /** @@ -113,7 +113,7 @@ Response createForSubscriptionRaw(String subscriptionId, String jsonPayload) String path = buildPathWithParams( "/subscriptions/{subscription-id}/create_ramp", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("ramp", "createForSubscription", path, jsonPayload); } public RampCreateForSubscriptionResponse createForSubscription( @@ -128,7 +128,7 @@ public CompletableFuture createForSubscriptio String path = buildPathWithParams( "/subscriptions/{subscription-id}/create_ramp", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("ramp", "createForSubscription", path, params.toFormData()) .thenApply( response -> RampCreateForSubscriptionResponse.fromJson(response.getBodyAsString(), response)); @@ -137,13 +137,13 @@ public CompletableFuture createForSubscriptio /** list a ramp using immutable params (executes immediately) - returns raw Response. */ Response listRaw(RampListParams params) throws ChargebeeException { - return get("/ramps", params != null ? params.toQueryParams() : null); + return get("ramp", "list", "/ramps", params != null ? params.toQueryParams() : null); } /** list a ramp without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/ramps", null); + return get("ramp", "list", "/ramps", null); } /** list a ramp using raw JSON payload (executes immediately) - returns raw Response. */ @@ -161,7 +161,7 @@ public RampListResponse list(RampListParams params) throws ChargebeeException { /** Async variant of list for ramp with params. */ public CompletableFuture listAsync(RampListParams params) { - return getAsync("/ramps", params != null ? params.toQueryParams() : null) + return getAsync("ramp", "list", "/ramps", params != null ? params.toQueryParams() : null) .thenApply( response -> RampListResponse.fromJson(response.getBodyAsString(), this, params, response)); @@ -176,7 +176,7 @@ public RampListResponse list() throws ChargebeeException { /** Async variant of list for ramp without params. */ public CompletableFuture listAsync() { - return getAsync("/ramps", null) + return getAsync("ramp", "list", "/ramps", null) .thenApply( response -> RampListResponse.fromJson(response.getBodyAsString(), this, null, response)); @@ -186,19 +186,19 @@ public CompletableFuture listAsync() { Response updateRaw(String rampId) throws ChargebeeException { String path = buildPathWithParams("/ramps/{ramp-id}/update", "ramp-id", rampId); - return post(path, null); + return post("ramp", "update", path, null); } /** 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()); + return post("ramp", "update", path, params.toFormData()); } /** 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); + return postJson("ramp", "update", path, jsonPayload); } public RampUpdateResponse update(String rampId, RampUpdateParams params) @@ -210,7 +210,7 @@ public RampUpdateResponse update(String rampId, RampUpdateParams params) /** Async variant of update for ramp with params. */ public CompletableFuture updateAsync(String rampId, RampUpdateParams params) { String path = buildPathWithParams("/ramps/{ramp-id}/update", "ramp-id", rampId); - return postAsync(path, params.toFormData()) + return postAsync("ramp", "update", path, params.toFormData()) .thenApply(response -> RampUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -218,7 +218,7 @@ public CompletableFuture updateAsync(String rampId, RampUpda Response deleteRaw(String rampId) throws ChargebeeException { String path = buildPathWithParams("/ramps/{ramp-id}/delete", "ramp-id", rampId); - return post(path, null); + return post("ramp", "delete", path, null); } public RampDeleteResponse delete(String rampId) throws ChargebeeException { @@ -230,7 +230,7 @@ public RampDeleteResponse delete(String rampId) throws ChargebeeException { public CompletableFuture deleteAsync(String rampId) { String path = buildPathWithParams("/ramps/{ramp-id}/delete", "ramp-id", rampId); - return postAsync(path, null) + return postAsync("ramp", "delete", path, null) .thenApply(response -> 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 b43ea108c..f69202b20 100644 --- a/src/main/java/com/chargebee/v4/services/RecordedPurchaseService.java +++ b/src/main/java/com/chargebee/v4/services/RecordedPurchaseService.java @@ -62,7 +62,7 @@ Response retrieveRaw(String recordedPurchaseId) throws ChargebeeException { "recorded-purchase-id", recordedPurchaseId); - return get(path, null); + return get("recordedPurchase", "retrieve", path, null); } public RecordedPurchaseRetrieveResponse retrieve(String recordedPurchaseId) @@ -80,7 +80,7 @@ public CompletableFuture retrieveAsync( "recorded-purchase-id", recordedPurchaseId); - return getAsync(path, null) + return getAsync("recordedPurchase", "retrieve", path, null) .thenApply( response -> RecordedPurchaseRetrieveResponse.fromJson(response.getBodyAsString(), response)); @@ -91,7 +91,11 @@ public CompletableFuture retrieveAsync( */ Response createRaw(RecordedPurchaseCreateParams params) throws ChargebeeException { - return post("/recorded_purchases", params != null ? params.toFormData() : null); + return post( + "recordedPurchase", + "create", + "/recorded_purchases", + params != null ? params.toFormData() : null); } /** @@ -99,7 +103,7 @@ Response createRaw(RecordedPurchaseCreateParams params) throws ChargebeeExceptio */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/recorded_purchases", jsonPayload); + return postJson("recordedPurchase", "create", "/recorded_purchases", jsonPayload); } public RecordedPurchaseCreateResponse create(RecordedPurchaseCreateParams params) @@ -113,7 +117,11 @@ public RecordedPurchaseCreateResponse create(RecordedPurchaseCreateParams params public CompletableFuture createAsync( RecordedPurchaseCreateParams params) { - return postAsync("/recorded_purchases", params != null ? params.toFormData() : null) + return postAsync( + "recordedPurchase", + "create", + "/recorded_purchases", + params != null ? params.toFormData() : null) .thenApply( response -> 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 bafac52e5..c49f82a0d 100644 --- a/src/main/java/com/chargebee/v4/services/ResourceMigrationService.java +++ b/src/main/java/com/chargebee/v4/services/ResourceMigrationService.java @@ -60,7 +60,10 @@ Response retrieveLatestRaw(ResourceMigrationRetrieveLatestParams params) throws ChargebeeException { return get( - "/resource_migrations/retrieve_latest", params != null ? params.toQueryParams() : null); + "resourceMigration", + "retrieveLatest", + "/resource_migrations/retrieve_latest", + params != null ? params.toQueryParams() : null); } /** @@ -84,7 +87,10 @@ public CompletableFuture retrieveLatest ResourceMigrationRetrieveLatestParams params) { return getAsync( - "/resource_migrations/retrieve_latest", params != null ? params.toQueryParams() : null) + "resourceMigration", + "retrieveLatest", + "/resource_migrations/retrieve_latest", + params != null ? params.toQueryParams() : null) .thenApply( response -> ResourceMigrationRetrieveLatestResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/RuleService.java b/src/main/java/com/chargebee/v4/services/RuleService.java index 9940ef4b7..608cbe15b 100644 --- a/src/main/java/com/chargebee/v4/services/RuleService.java +++ b/src/main/java/com/chargebee/v4/services/RuleService.java @@ -53,7 +53,7 @@ public RuleService withOptions(RequestOptions options) { Response retrieveRaw(String ruleId) throws ChargebeeException { String path = buildPathWithParams("/rules/{rule-id}", "rule-id", ruleId); - return get(path, null); + return get("rule", "retrieve", path, null); } public RuleRetrieveResponse retrieve(String ruleId) throws ChargebeeException { @@ -65,7 +65,7 @@ public RuleRetrieveResponse retrieve(String ruleId) throws ChargebeeException { public CompletableFuture retrieveAsync(String ruleId) { String path = buildPathWithParams("/rules/{rule-id}", "rule-id", ruleId); - return getAsync(path, null) + return getAsync("rule", "retrieve", path, null) .thenApply(response -> 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 deff5d62a..f39318deb 100644 --- a/src/main/java/com/chargebee/v4/services/SiteMigrationDetailService.java +++ b/src/main/java/com/chargebee/v4/services/SiteMigrationDetailService.java @@ -58,13 +58,17 @@ public SiteMigrationDetailService withOptions(RequestOptions options) { */ Response listRaw(SiteMigrationDetailListParams params) throws ChargebeeException { - return get("/site_migration_details", params != null ? params.toQueryParams() : null); + return get( + "siteMigrationDetail", + "list", + "/site_migration_details", + params != null ? params.toQueryParams() : null); } /** list a siteMigrationDetail without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/site_migration_details", null); + return get("siteMigrationDetail", "list", "/site_migration_details", null); } /** @@ -88,7 +92,11 @@ public SiteMigrationDetailListResponse list(SiteMigrationDetailListParams params public CompletableFuture listAsync( SiteMigrationDetailListParams params) { - return getAsync("/site_migration_details", params != null ? params.toQueryParams() : null) + return getAsync( + "siteMigrationDetail", + "list", + "/site_migration_details", + params != null ? params.toQueryParams() : null) .thenApply( response -> SiteMigrationDetailListResponse.fromJson( @@ -105,7 +113,7 @@ public SiteMigrationDetailListResponse list() throws ChargebeeException { /** Async variant of list for siteMigrationDetail without params. */ public CompletableFuture listAsync() { - return getAsync("/site_migration_details", null) + return getAsync("siteMigrationDetail", "list", "/site_migration_details", null) .thenApply( response -> SiteMigrationDetailListResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/SubscriptionEntitlementService.java b/src/main/java/com/chargebee/v4/services/SubscriptionEntitlementService.java index 27ef58263..2b4df7036 100644 --- a/src/main/java/com/chargebee/v4/services/SubscriptionEntitlementService.java +++ b/src/main/java/com/chargebee/v4/services/SubscriptionEntitlementService.java @@ -69,7 +69,7 @@ Response setSubscriptionEntitlementAvailabilityRaw(String subscriptionId) "subscription-id", subscriptionId); - return post(path, null); + return post("subscriptionEntitlement", "setSubscriptionEntitlementAvailability", path, null); } /** @@ -84,7 +84,11 @@ Response setSubscriptionEntitlementAvailabilityRaw( "/subscriptions/{subscription-id}/subscription_entitlements/set_availability", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post( + "subscriptionEntitlement", + "setSubscriptionEntitlementAvailability", + path, + params.toFormData()); } /** @@ -98,7 +102,8 @@ Response setSubscriptionEntitlementAvailabilityRaw(String subscriptionId, String "/subscriptions/{subscription-id}/subscription_entitlements/set_availability", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson( + "subscriptionEntitlement", "setSubscriptionEntitlementAvailability", path, jsonPayload); } public SetSubscriptionEntitlementAvailabilityResponse setSubscriptionEntitlementAvailability( @@ -121,7 +126,11 @@ public SetSubscriptionEntitlementAvailabilityResponse setSubscriptionEntitlement "/subscriptions/{subscription-id}/subscription_entitlements/set_availability", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync( + "subscriptionEntitlement", + "setSubscriptionEntitlementAvailability", + path, + params.toFormData()) .thenApply( response -> SetSubscriptionEntitlementAvailabilityResponse.fromJson( @@ -140,7 +149,11 @@ Response subscriptionEntitlementsForSubscriptionRaw( "/subscriptions/{subscription-id}/subscription_entitlements", "subscription-id", subscriptionId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "subscriptionEntitlement", + "subscriptionEntitlementsForSubscription", + path, + params != null ? params.toQueryParams() : null); } /** @@ -154,7 +167,7 @@ Response subscriptionEntitlementsForSubscriptionRaw(String subscriptionId) "/subscriptions/{subscription-id}/subscription_entitlements", "subscription-id", subscriptionId); - return get(path, null); + return get("subscriptionEntitlement", "subscriptionEntitlementsForSubscription", path, null); } /** @@ -198,7 +211,11 @@ public SubscriptionEntitlementsForSubscriptionResponse subscriptionEntitlementsF "/subscriptions/{subscription-id}/subscription_entitlements", "subscription-id", subscriptionId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "subscriptionEntitlement", + "subscriptionEntitlementsForSubscription", + path, + params != null ? params.toQueryParams() : null) .thenApply( response -> SubscriptionEntitlementsForSubscriptionResponse.fromJson( @@ -216,7 +233,8 @@ public SubscriptionEntitlementsForSubscriptionResponse subscriptionEntitlementsF "/subscriptions/{subscription-id}/subscription_entitlements", "subscription-id", subscriptionId); - return getAsync(path, null) + return getAsync( + "subscriptionEntitlement", "subscriptionEntitlementsForSubscription", path, null) .thenApply( response -> SubscriptionEntitlementsForSubscriptionResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/SubscriptionService.java b/src/main/java/com/chargebee/v4/services/SubscriptionService.java index 083f75642..c1f06c468 100644 --- a/src/main/java/com/chargebee/v4/services/SubscriptionService.java +++ b/src/main/java/com/chargebee/v4/services/SubscriptionService.java @@ -190,7 +190,7 @@ Response removeAdvanceInvoiceScheduleRaw(String subscriptionId) throws Chargebee "subscription-id", subscriptionId); - return post(path, null); + return post("subscription", "removeAdvanceInvoiceSchedule", path, null); } /** @@ -205,7 +205,7 @@ Response removeAdvanceInvoiceScheduleRaw( "/subscriptions/{subscription-id}/remove_advance_invoice_schedule", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("subscription", "removeAdvanceInvoiceSchedule", path, params.toFormData()); } /** @@ -219,7 +219,7 @@ Response removeAdvanceInvoiceScheduleRaw(String subscriptionId, String jsonPaylo "/subscriptions/{subscription-id}/remove_advance_invoice_schedule", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("subscription", "removeAdvanceInvoiceSchedule", path, jsonPayload); } public SubscriptionRemoveAdvanceInvoiceScheduleResponse removeAdvanceInvoiceSchedule( @@ -239,7 +239,7 @@ public SubscriptionRemoveAdvanceInvoiceScheduleResponse removeAdvanceInvoiceSche "/subscriptions/{subscription-id}/remove_advance_invoice_schedule", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("subscription", "removeAdvanceInvoiceSchedule", path, params.toFormData()) .thenApply( response -> SubscriptionRemoveAdvanceInvoiceScheduleResponse.fromJson( @@ -262,7 +262,7 @@ public SubscriptionRemoveAdvanceInvoiceScheduleResponse removeAdvanceInvoiceSche "subscription-id", subscriptionId); - return postAsync(path, null) + return postAsync("subscription", "removeAdvanceInvoiceSchedule", path, null) .thenApply( response -> SubscriptionRemoveAdvanceInvoiceScheduleResponse.fromJson( @@ -275,7 +275,7 @@ Response updateForItemsRaw(String subscriptionId) throws ChargebeeException { buildPathWithParams( "/subscriptions/{subscription-id}/update_for_items", "subscription-id", subscriptionId); - return post(path, null); + return post("subscription", "updateForItems", path, null); } /** @@ -287,7 +287,7 @@ Response updateForItemsRaw(String subscriptionId, SubscriptionUpdateForItemsPara String path = buildPathWithParams( "/subscriptions/{subscription-id}/update_for_items", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("subscription", "updateForItems", path, params.toFormData()); } /** @@ -298,7 +298,7 @@ Response updateForItemsRaw(String subscriptionId, String jsonPayload) throws Cha String path = buildPathWithParams( "/subscriptions/{subscription-id}/update_for_items", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("subscription", "updateForItems", path, jsonPayload); } public SubscriptionUpdateForItemsResponse updateForItems( @@ -313,7 +313,7 @@ public CompletableFuture updateForItemsAsync String path = buildPathWithParams( "/subscriptions/{subscription-id}/update_for_items", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("subscription", "updateForItems", path, params.toFormData()) .thenApply( response -> SubscriptionUpdateForItemsResponse.fromJson(response.getBodyAsString(), response)); @@ -332,7 +332,7 @@ public CompletableFuture updateForItemsAsync buildPathWithParams( "/subscriptions/{subscription-id}/update_for_items", "subscription-id", subscriptionId); - return postAsync(path, null) + return postAsync("subscription", "updateForItems", path, null) .thenApply( response -> SubscriptionUpdateForItemsResponse.fromJson(response.getBodyAsString(), response)); @@ -344,7 +344,7 @@ Response removeCouponsRaw(String subscriptionId) throws ChargebeeException { buildPathWithParams( "/subscriptions/{subscription-id}/remove_coupons", "subscription-id", subscriptionId); - return post(path, null); + return post("subscription", "removeCoupons", path, null); } /** @@ -356,7 +356,7 @@ Response removeCouponsRaw(String subscriptionId, SubscriptionRemoveCouponsParams String path = buildPathWithParams( "/subscriptions/{subscription-id}/remove_coupons", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("subscription", "removeCoupons", path, params.toFormData()); } /** @@ -367,7 +367,7 @@ Response removeCouponsRaw(String subscriptionId, String jsonPayload) throws Char String path = buildPathWithParams( "/subscriptions/{subscription-id}/remove_coupons", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("subscription", "removeCoupons", path, jsonPayload); } public SubscriptionRemoveCouponsResponse removeCoupons( @@ -382,7 +382,7 @@ public CompletableFuture removeCouponsAsync( String path = buildPathWithParams( "/subscriptions/{subscription-id}/remove_coupons", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("subscription", "removeCoupons", path, params.toFormData()) .thenApply( response -> SubscriptionRemoveCouponsResponse.fromJson(response.getBodyAsString(), response)); @@ -401,7 +401,7 @@ public CompletableFuture removeCouponsAsync( buildPathWithParams( "/subscriptions/{subscription-id}/remove_coupons", "subscription-id", subscriptionId); - return postAsync(path, null) + return postAsync("subscription", "removeCoupons", path, null) .thenApply( response -> SubscriptionRemoveCouponsResponse.fromJson(response.getBodyAsString(), response)); @@ -413,7 +413,7 @@ Response resumeRaw(String subscriptionId) throws ChargebeeException { buildPathWithParams( "/subscriptions/{subscription-id}/resume", "subscription-id", subscriptionId); - return post(path, null); + return post("subscription", "resume", path, null); } /** resume a subscription using immutable params (executes immediately) - returns raw Response. */ @@ -422,7 +422,7 @@ Response resumeRaw(String subscriptionId, SubscriptionResumeParams params) String path = buildPathWithParams( "/subscriptions/{subscription-id}/resume", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("subscription", "resume", path, params.toFormData()); } /** resume a subscription using raw JSON payload (executes immediately) - returns raw Response. */ @@ -430,7 +430,7 @@ Response resumeRaw(String subscriptionId, String jsonPayload) throws ChargebeeEx String path = buildPathWithParams( "/subscriptions/{subscription-id}/resume", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("subscription", "resume", path, jsonPayload); } public SubscriptionResumeResponse resume(String subscriptionId, SubscriptionResumeParams params) @@ -445,7 +445,7 @@ public CompletableFuture resumeAsync( String path = buildPathWithParams( "/subscriptions/{subscription-id}/resume", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("subscription", "resume", path, params.toFormData()) .thenApply( response -> SubscriptionResumeResponse.fromJson(response.getBodyAsString(), response)); } @@ -461,7 +461,7 @@ public CompletableFuture resumeAsync(String subscrip buildPathWithParams( "/subscriptions/{subscription-id}/resume", "subscription-id", subscriptionId); - return postAsync(path, null) + return postAsync("subscription", "resume", path, null) .thenApply( response -> SubscriptionResumeResponse.fromJson(response.getBodyAsString(), response)); } @@ -472,7 +472,7 @@ Response cancelForItemsRaw(String subscriptionId) throws ChargebeeException { buildPathWithParams( "/subscriptions/{subscription-id}/cancel_for_items", "subscription-id", subscriptionId); - return post(path, null); + return post("subscription", "cancelForItems", path, null); } /** @@ -484,7 +484,7 @@ Response cancelForItemsRaw(String subscriptionId, SubscriptionCancelForItemsPara String path = buildPathWithParams( "/subscriptions/{subscription-id}/cancel_for_items", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("subscription", "cancelForItems", path, params.toFormData()); } /** @@ -495,7 +495,7 @@ Response cancelForItemsRaw(String subscriptionId, String jsonPayload) throws Cha String path = buildPathWithParams( "/subscriptions/{subscription-id}/cancel_for_items", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("subscription", "cancelForItems", path, jsonPayload); } public SubscriptionCancelForItemsResponse cancelForItems( @@ -510,7 +510,7 @@ public CompletableFuture cancelForItemsAsync String path = buildPathWithParams( "/subscriptions/{subscription-id}/cancel_for_items", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("subscription", "cancelForItems", path, params.toFormData()) .thenApply( response -> SubscriptionCancelForItemsResponse.fromJson(response.getBodyAsString(), response)); @@ -529,7 +529,7 @@ public CompletableFuture cancelForItemsAsync buildPathWithParams( "/subscriptions/{subscription-id}/cancel_for_items", "subscription-id", subscriptionId); - return postAsync(path, null) + return postAsync("subscription", "cancelForItems", path, null) .thenApply( response -> SubscriptionCancelForItemsResponse.fromJson(response.getBodyAsString(), response)); @@ -543,7 +543,7 @@ Response regenerateInvoiceRaw(String subscriptionId) throws ChargebeeException { "subscription-id", subscriptionId); - return post(path, null); + return post("subscription", "regenerateInvoice", path, null); } /** @@ -557,7 +557,7 @@ Response regenerateInvoiceRaw(String subscriptionId, SubscriptionRegenerateInvoi "/subscriptions/{subscription-id}/regenerate_invoice", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("subscription", "regenerateInvoice", path, params.toFormData()); } /** @@ -571,7 +571,7 @@ Response regenerateInvoiceRaw(String subscriptionId, String jsonPayload) "/subscriptions/{subscription-id}/regenerate_invoice", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("subscription", "regenerateInvoice", path, jsonPayload); } public SubscriptionRegenerateInvoiceResponse regenerateInvoice( @@ -588,7 +588,7 @@ public CompletableFuture regenerateInvoic "/subscriptions/{subscription-id}/regenerate_invoice", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("subscription", "regenerateInvoice", path, params.toFormData()) .thenApply( response -> SubscriptionRegenerateInvoiceResponse.fromJson( @@ -610,7 +610,7 @@ public CompletableFuture regenerateInvoic "subscription-id", subscriptionId); - return postAsync(path, null) + return postAsync("subscription", "regenerateInvoice", path, null) .thenApply( response -> SubscriptionRegenerateInvoiceResponse.fromJson( @@ -620,13 +620,14 @@ public CompletableFuture regenerateInvoic /** list a subscription using immutable params (executes immediately) - returns raw Response. */ Response listRaw(SubscriptionListParams params) throws ChargebeeException { - return get("/subscriptions", params != null ? params.toQueryParams() : null); + return get( + "subscription", "list", "/subscriptions", params != null ? params.toQueryParams() : null); } /** list a subscription without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/subscriptions", null); + return get("subscription", "list", "/subscriptions", null); } /** list a subscription using raw JSON payload (executes immediately) - returns raw Response. */ @@ -644,7 +645,11 @@ public SubscriptionListResponse list(SubscriptionListParams params) throws Charg /** Async variant of list for subscription with params. */ public CompletableFuture listAsync(SubscriptionListParams params) { - return getAsync("/subscriptions", params != null ? params.toQueryParams() : null) + return getAsync( + "subscription", + "list", + "/subscriptions", + params != null ? params.toQueryParams() : null) .thenApply( response -> SubscriptionListResponse.fromJson( @@ -660,7 +665,7 @@ public SubscriptionListResponse list() throws ChargebeeException { /** Async variant of list for subscription without params. */ public CompletableFuture listAsync() { - return getAsync("/subscriptions", null) + return getAsync("subscription", "list", "/subscriptions", null) .thenApply( response -> SubscriptionListResponse.fromJson( @@ -670,13 +675,14 @@ public CompletableFuture listAsync() { /** create a subscription using immutable params (executes immediately) - returns raw Response. */ Response createRaw(SubscriptionCreateParams params) throws ChargebeeException { - return post("/subscriptions", params != null ? params.toFormData() : null); + return post( + "subscription", "create", "/subscriptions", params != null ? params.toFormData() : null); } /** create a subscription using raw JSON payload (executes immediately) - returns raw Response. */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/subscriptions", jsonPayload); + return postJson("subscription", "create", "/subscriptions", jsonPayload); } public SubscriptionCreateResponse create(SubscriptionCreateParams params) @@ -690,7 +696,8 @@ public SubscriptionCreateResponse create(SubscriptionCreateParams params) public CompletableFuture createAsync( SubscriptionCreateParams params) { - return postAsync("/subscriptions", params != null ? params.toFormData() : null) + return postAsync( + "subscription", "create", "/subscriptions", params != null ? params.toFormData() : null) .thenApply( response -> SubscriptionCreateResponse.fromJson(response.getBodyAsString(), response)); } @@ -701,7 +708,7 @@ Response moveRaw(String subscriptionId) throws ChargebeeException { buildPathWithParams( "/subscriptions/{subscription-id}/move", "subscription-id", subscriptionId); - return post(path, null); + return post("subscription", "move", path, null); } /** move a subscription using immutable params (executes immediately) - returns raw Response. */ @@ -709,7 +716,7 @@ Response moveRaw(String subscriptionId, SubscriptionMoveParams params) throws Ch String path = buildPathWithParams( "/subscriptions/{subscription-id}/move", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("subscription", "move", path, params.toFormData()); } /** move a subscription using raw JSON payload (executes immediately) - returns raw Response. */ @@ -717,7 +724,7 @@ Response moveRaw(String subscriptionId, String jsonPayload) throws ChargebeeExce String path = buildPathWithParams( "/subscriptions/{subscription-id}/move", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("subscription", "move", path, jsonPayload); } public SubscriptionMoveResponse move(String subscriptionId, SubscriptionMoveParams params) @@ -732,7 +739,7 @@ public CompletableFuture moveAsync( String path = buildPathWithParams( "/subscriptions/{subscription-id}/move", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("subscription", "move", path, params.toFormData()) .thenApply( response -> SubscriptionMoveResponse.fromJson(response.getBodyAsString(), response)); } @@ -745,7 +752,11 @@ Response subscriptionsForCustomerRaw(String customerId, SubscriptionsForCustomer throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/subscriptions", "customer-id", customerId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "subscription", + "subscriptionsForCustomer", + path, + params != null ? params.toQueryParams() : null); } /** @@ -755,7 +766,7 @@ Response subscriptionsForCustomerRaw(String customerId, SubscriptionsForCustomer Response subscriptionsForCustomerRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/subscriptions", "customer-id", customerId); - return get(path, null); + return get("subscription", "subscriptionsForCustomer", path, null); } /** @@ -788,7 +799,11 @@ public CompletableFuture subscriptionsForCusto String customerId, SubscriptionsForCustomerParams params) { String path = buildPathWithParams("/customers/{customer-id}/subscriptions", "customer-id", customerId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "subscription", + "subscriptionsForCustomer", + path, + params != null ? params.toQueryParams() : null) .thenApply( response -> SubscriptionsForCustomerResponse.fromJson( @@ -800,7 +815,7 @@ public CompletableFuture subscriptionsForCusto String customerId) { String path = buildPathWithParams("/customers/{customer-id}/subscriptions", "customer-id", customerId); - return getAsync(path, null) + return getAsync("subscription", "subscriptionsForCustomer", path, null) .thenApply( response -> SubscriptionsForCustomerResponse.fromJson( @@ -812,7 +827,7 @@ Response createForCustomerRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/subscriptions", "customer-id", customerId); - return post(path, null); + return post("subscription", "createForCustomer", path, null); } /** @@ -823,7 +838,7 @@ Response createForCustomerRaw(String customerId, SubscriptionCreateForCustomerPa throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/subscriptions", "customer-id", customerId); - return post(path, params.toFormData()); + return post("subscription", "createForCustomer", path, params.toFormData()); } /** @@ -833,7 +848,7 @@ Response createForCustomerRaw(String customerId, SubscriptionCreateForCustomerPa Response createForCustomerRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/subscriptions", "customer-id", customerId); - return postJson(path, jsonPayload); + return postJson("subscription", "createForCustomer", path, jsonPayload); } public SubscriptionCreateForCustomerResponse createForCustomer( @@ -847,7 +862,7 @@ public CompletableFuture createForCustome String customerId, SubscriptionCreateForCustomerParams params) { String path = buildPathWithParams("/customers/{customer-id}/subscriptions", "customer-id", customerId); - return postAsync(path, params.toFormData()) + return postAsync("subscription", "createForCustomer", path, params.toFormData()) .thenApply( response -> SubscriptionCreateForCustomerResponse.fromJson( @@ -859,7 +874,7 @@ Response importForItemsRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/import_for_items", "customer-id", customerId); - return post(path, null); + return post("subscription", "importForItems", path, null); } /** @@ -870,7 +885,7 @@ Response importForItemsRaw(String customerId, SubscriptionImportForItemsParams p throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/import_for_items", "customer-id", customerId); - return post(path, params.toFormData()); + return post("subscription", "importForItems", path, params.toFormData()); } /** @@ -880,7 +895,7 @@ Response importForItemsRaw(String customerId, SubscriptionImportForItemsParams p Response importForItemsRaw(String customerId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/import_for_items", "customer-id", customerId); - return postJson(path, jsonPayload); + return postJson("subscription", "importForItems", path, jsonPayload); } public SubscriptionImportForItemsResponse importForItems( @@ -894,7 +909,7 @@ public CompletableFuture importForItemsAsync String customerId, SubscriptionImportForItemsParams params) { String path = buildPathWithParams("/customers/{customer-id}/import_for_items", "customer-id", customerId); - return postAsync(path, params.toFormData()) + return postAsync("subscription", "importForItems", path, params.toFormData()) .thenApply( response -> SubscriptionImportForItemsResponse.fromJson(response.getBodyAsString(), response)); @@ -910,7 +925,7 @@ Response retrieveAdvanceInvoiceScheduleRaw(String subscriptionId) throws Chargeb "subscription-id", subscriptionId); - return get(path, null); + return get("subscription", "retrieveAdvanceInvoiceSchedule", path, null); } public SubscriptionRetrieveAdvanceInvoiceScheduleResponse retrieveAdvanceInvoiceSchedule( @@ -929,7 +944,7 @@ public SubscriptionRetrieveAdvanceInvoiceScheduleResponse retrieveAdvanceInvoice "subscription-id", subscriptionId); - return getAsync(path, null) + return getAsync("subscription", "retrieveAdvanceInvoiceSchedule", path, null) .thenApply( response -> SubscriptionRetrieveAdvanceInvoiceScheduleResponse.fromJson( @@ -944,7 +959,7 @@ Response removeScheduledCancellationRaw(String subscriptionId) throws ChargebeeE "subscription-id", subscriptionId); - return post(path, null); + return post("subscription", "removeScheduledCancellation", path, null); } /** @@ -959,7 +974,7 @@ Response removeScheduledCancellationRaw( "/subscriptions/{subscription-id}/remove_scheduled_cancellation", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("subscription", "removeScheduledCancellation", path, params.toFormData()); } /** @@ -973,7 +988,7 @@ Response removeScheduledCancellationRaw(String subscriptionId, String jsonPayloa "/subscriptions/{subscription-id}/remove_scheduled_cancellation", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("subscription", "removeScheduledCancellation", path, jsonPayload); } public SubscriptionRemoveScheduledCancellationResponse removeScheduledCancellation( @@ -993,7 +1008,7 @@ public SubscriptionRemoveScheduledCancellationResponse removeScheduledCancellati "/subscriptions/{subscription-id}/remove_scheduled_cancellation", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("subscription", "removeScheduledCancellation", path, params.toFormData()) .thenApply( response -> SubscriptionRemoveScheduledCancellationResponse.fromJson( @@ -1016,7 +1031,7 @@ public SubscriptionRemoveScheduledCancellationResponse removeScheduledCancellati "subscription-id", subscriptionId); - return postAsync(path, null) + return postAsync("subscription", "removeScheduledCancellation", path, null) .thenApply( response -> SubscriptionRemoveScheduledCancellationResponse.fromJson( @@ -1031,7 +1046,7 @@ Response retrieveWithScheduledChangesRaw(String subscriptionId) throws Chargebee "subscription-id", subscriptionId); - return get(path, null); + return get("subscription", "retrieveWithScheduledChanges", path, null); } public SubscriptionRetrieveWithScheduledChangesResponse retrieveWithScheduledChanges( @@ -1050,7 +1065,7 @@ public SubscriptionRetrieveWithScheduledChangesResponse retrieveWithScheduledCha "subscription-id", subscriptionId); - return getAsync(path, null) + return getAsync("subscription", "retrieveWithScheduledChanges", path, null) .thenApply( response -> SubscriptionRetrieveWithScheduledChangesResponse.fromJson( @@ -1063,7 +1078,7 @@ Response reactivateRaw(String subscriptionId) throws ChargebeeException { buildPathWithParams( "/subscriptions/{subscription-id}/reactivate", "subscription-id", subscriptionId); - return post(path, null); + return post("subscription", "reactivate", path, null); } /** @@ -1074,7 +1089,7 @@ Response reactivateRaw(String subscriptionId, SubscriptionReactivateParams param String path = buildPathWithParams( "/subscriptions/{subscription-id}/reactivate", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("subscription", "reactivate", path, params.toFormData()); } /** @@ -1084,7 +1099,7 @@ Response reactivateRaw(String subscriptionId, String jsonPayload) throws Chargeb String path = buildPathWithParams( "/subscriptions/{subscription-id}/reactivate", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("subscription", "reactivate", path, jsonPayload); } public SubscriptionReactivateResponse reactivate( @@ -1099,7 +1114,7 @@ public CompletableFuture reactivateAsync( String path = buildPathWithParams( "/subscriptions/{subscription-id}/reactivate", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("subscription", "reactivate", path, params.toFormData()) .thenApply( response -> SubscriptionReactivateResponse.fromJson(response.getBodyAsString(), response)); @@ -1117,7 +1132,7 @@ public CompletableFuture reactivateAsync(String buildPathWithParams( "/subscriptions/{subscription-id}/reactivate", "subscription-id", subscriptionId); - return postAsync(path, null) + return postAsync("subscription", "reactivate", path, null) .thenApply( response -> SubscriptionReactivateResponse.fromJson(response.getBodyAsString(), response)); @@ -1131,7 +1146,7 @@ Response chargeFutureRenewalsRaw(String subscriptionId) throws ChargebeeExceptio "subscription-id", subscriptionId); - return post(path, null); + return post("subscription", "chargeFutureRenewals", path, null); } /** @@ -1146,7 +1161,7 @@ Response chargeFutureRenewalsRaw( "/subscriptions/{subscription-id}/charge_future_renewals", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("subscription", "chargeFutureRenewals", path, params.toFormData()); } /** @@ -1160,7 +1175,7 @@ Response chargeFutureRenewalsRaw(String subscriptionId, String jsonPayload) "/subscriptions/{subscription-id}/charge_future_renewals", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("subscription", "chargeFutureRenewals", path, jsonPayload); } public SubscriptionChargeFutureRenewalsResponse chargeFutureRenewals( @@ -1178,7 +1193,7 @@ public CompletableFuture chargeFutureR "/subscriptions/{subscription-id}/charge_future_renewals", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("subscription", "chargeFutureRenewals", path, params.toFormData()) .thenApply( response -> SubscriptionChargeFutureRenewalsResponse.fromJson( @@ -1200,7 +1215,7 @@ public CompletableFuture chargeFutureR "subscription-id", subscriptionId); - return postAsync(path, null) + return postAsync("subscription", "chargeFutureRenewals", path, null) .thenApply( response -> SubscriptionChargeFutureRenewalsResponse.fromJson( @@ -1215,7 +1230,7 @@ Response addChargeAtTermEndRaw(String subscriptionId) throws ChargebeeException "subscription-id", subscriptionId); - return post(path, null); + return post("subscription", "addChargeAtTermEnd", path, null); } /** @@ -1229,7 +1244,7 @@ Response addChargeAtTermEndRaw(String subscriptionId, SubscriptionAddChargeAtTer "/subscriptions/{subscription-id}/add_charge_at_term_end", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("subscription", "addChargeAtTermEnd", path, params.toFormData()); } /** @@ -1243,7 +1258,7 @@ Response addChargeAtTermEndRaw(String subscriptionId, String jsonPayload) "/subscriptions/{subscription-id}/add_charge_at_term_end", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("subscription", "addChargeAtTermEnd", path, jsonPayload); } public SubscriptionAddChargeAtTermEndResponse addChargeAtTermEnd( @@ -1261,7 +1276,7 @@ public CompletableFuture addChargeAtTerm "/subscriptions/{subscription-id}/add_charge_at_term_end", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("subscription", "addChargeAtTermEnd", path, params.toFormData()) .thenApply( response -> SubscriptionAddChargeAtTermEndResponse.fromJson( @@ -1276,7 +1291,7 @@ Response removeScheduledChangesRaw(String subscriptionId) throws ChargebeeExcept "subscription-id", subscriptionId); - return post(path, null); + return post("subscription", "removeScheduledChanges", path, null); } public SubscriptionRemoveScheduledChangesResponse removeScheduledChanges(String subscriptionId) @@ -1295,7 +1310,7 @@ public CompletableFuture removeSched "subscription-id", subscriptionId); - return postAsync(path, null) + return postAsync("subscription", "removeScheduledChanges", path, null) .thenApply( response -> SubscriptionRemoveScheduledChangesResponse.fromJson( @@ -1308,7 +1323,7 @@ Response changeTermEndRaw(String subscriptionId) throws ChargebeeException { buildPathWithParams( "/subscriptions/{subscription-id}/change_term_end", "subscription-id", subscriptionId); - return post(path, null); + return post("subscription", "changeTermEnd", path, null); } /** @@ -1320,7 +1335,7 @@ Response changeTermEndRaw(String subscriptionId, SubscriptionChangeTermEndParams String path = buildPathWithParams( "/subscriptions/{subscription-id}/change_term_end", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("subscription", "changeTermEnd", path, params.toFormData()); } /** @@ -1331,7 +1346,7 @@ Response changeTermEndRaw(String subscriptionId, String jsonPayload) throws Char String path = buildPathWithParams( "/subscriptions/{subscription-id}/change_term_end", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("subscription", "changeTermEnd", path, jsonPayload); } public SubscriptionChangeTermEndResponse changeTermEnd( @@ -1346,7 +1361,7 @@ public CompletableFuture changeTermEndAsync( String path = buildPathWithParams( "/subscriptions/{subscription-id}/change_term_end", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("subscription", "changeTermEnd", path, params.toFormData()) .thenApply( response -> SubscriptionChangeTermEndResponse.fromJson(response.getBodyAsString(), response)); @@ -1358,7 +1373,7 @@ Response deleteRaw(String subscriptionId) throws ChargebeeException { buildPathWithParams( "/subscriptions/{subscription-id}/delete", "subscription-id", subscriptionId); - return post(path, null); + return post("subscription", "delete", path, null); } public SubscriptionDeleteResponse delete(String subscriptionId) throws ChargebeeException { @@ -1372,7 +1387,7 @@ public CompletableFuture deleteAsync(String subscrip buildPathWithParams( "/subscriptions/{subscription-id}/delete", "subscription-id", subscriptionId); - return postAsync(path, null) + return postAsync("subscription", "delete", path, null) .thenApply( response -> SubscriptionDeleteResponse.fromJson(response.getBodyAsString(), response)); } @@ -1383,7 +1398,7 @@ Response createWithItemsRaw(String customerId) throws ChargebeeException { buildPathWithParams( "/customers/{customer-id}/subscription_for_items", "customer-id", customerId); - return post(path, null); + return post("subscription", "createWithItems", path, null); } /** @@ -1395,7 +1410,7 @@ Response createWithItemsRaw(String customerId, SubscriptionCreateWithItemsParams String path = buildPathWithParams( "/customers/{customer-id}/subscription_for_items", "customer-id", customerId); - return post(path, params.toFormData()); + return post("subscription", "createWithItems", path, params.toFormData()); } /** @@ -1406,7 +1421,7 @@ Response createWithItemsRaw(String customerId, String jsonPayload) throws Charge String path = buildPathWithParams( "/customers/{customer-id}/subscription_for_items", "customer-id", customerId); - return postJson(path, jsonPayload); + return postJson("subscription", "createWithItems", path, jsonPayload); } public SubscriptionCreateWithItemsResponse createWithItems( @@ -1421,7 +1436,7 @@ public CompletableFuture createWithItemsAsy String path = buildPathWithParams( "/customers/{customer-id}/subscription_for_items", "customer-id", customerId); - return postAsync(path, params.toFormData()) + return postAsync("subscription", "createWithItems", path, params.toFormData()) .thenApply( response -> SubscriptionCreateWithItemsResponse.fromJson(response.getBodyAsString(), response)); @@ -1440,7 +1455,7 @@ public CompletableFuture createWithItemsAsy buildPathWithParams( "/customers/{customer-id}/subscription_for_items", "customer-id", customerId); - return postAsync(path, null) + return postAsync("subscription", "createWithItems", path, null) .thenApply( response -> SubscriptionCreateWithItemsResponse.fromJson(response.getBodyAsString(), response)); @@ -1454,7 +1469,7 @@ Response importUnbilledChargesRaw(String subscriptionId) throws ChargebeeExcepti "subscription-id", subscriptionId); - return post(path, null); + return post("subscription", "importUnbilledCharges", path, null); } /** @@ -1469,7 +1484,7 @@ Response importUnbilledChargesRaw( "/subscriptions/{subscription-id}/import_unbilled_charges", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("subscription", "importUnbilledCharges", path, params.toFormData()); } /** @@ -1483,7 +1498,7 @@ Response importUnbilledChargesRaw(String subscriptionId, String jsonPayload) "/subscriptions/{subscription-id}/import_unbilled_charges", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("subscription", "importUnbilledCharges", path, jsonPayload); } public SubscriptionImportUnbilledChargesResponse importUnbilledCharges( @@ -1501,7 +1516,7 @@ public CompletableFuture importUnbill "/subscriptions/{subscription-id}/import_unbilled_charges", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("subscription", "importUnbilledCharges", path, params.toFormData()) .thenApply( response -> SubscriptionImportUnbilledChargesResponse.fromJson( @@ -1523,7 +1538,7 @@ public CompletableFuture importUnbill "subscription-id", subscriptionId); - return postAsync(path, null) + return postAsync("subscription", "importUnbilledCharges", path, null) .thenApply( response -> SubscriptionImportUnbilledChargesResponse.fromJson( @@ -1538,7 +1553,7 @@ Response removeScheduledResumptionRaw(String subscriptionId) throws ChargebeeExc "subscription-id", subscriptionId); - return post(path, null); + return post("subscription", "removeScheduledResumption", path, null); } public SubscriptionRemoveScheduledResumptionResponse removeScheduledResumption( @@ -1557,7 +1572,7 @@ public SubscriptionRemoveScheduledResumptionResponse removeScheduledResumption( "subscription-id", subscriptionId); - return postAsync(path, null) + return postAsync("subscription", "removeScheduledResumption", path, null) .thenApply( response -> SubscriptionRemoveScheduledResumptionResponse.fromJson( @@ -1569,7 +1584,7 @@ Response retrieveRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams("/subscriptions/{subscription-id}", "subscription-id", subscriptionId); - return get(path, null); + return get("subscription", "retrieve", path, null); } public SubscriptionRetrieveResponse retrieve(String subscriptionId) throws ChargebeeException { @@ -1582,7 +1597,7 @@ public CompletableFuture retrieveAsync(String subs String path = buildPathWithParams("/subscriptions/{subscription-id}", "subscription-id", subscriptionId); - return getAsync(path, null) + return getAsync("subscription", "retrieve", path, null) .thenApply( response -> SubscriptionRetrieveResponse.fromJson(response.getBodyAsString(), response)); @@ -1593,7 +1608,7 @@ Response updateRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams("/subscriptions/{subscription-id}", "subscription-id", subscriptionId); - return post(path, null); + return post("subscription", "update", path, null); } /** update a subscription using immutable params (executes immediately) - returns raw Response. */ @@ -1601,14 +1616,14 @@ Response updateRaw(String subscriptionId, SubscriptionUpdateParams params) throws ChargebeeException { String path = buildPathWithParams("/subscriptions/{subscription-id}", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("subscription", "update", path, params.toFormData()); } /** update a subscription using raw JSON payload (executes immediately) - returns raw Response. */ Response updateRaw(String subscriptionId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/subscriptions/{subscription-id}", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("subscription", "update", path, jsonPayload); } public SubscriptionUpdateResponse update(String subscriptionId, SubscriptionUpdateParams params) @@ -1622,7 +1637,7 @@ public CompletableFuture updateAsync( String subscriptionId, SubscriptionUpdateParams params) { String path = buildPathWithParams("/subscriptions/{subscription-id}", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("subscription", "update", path, params.toFormData()) .thenApply( response -> SubscriptionUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -1637,7 +1652,7 @@ public CompletableFuture updateAsync(String subscrip String path = buildPathWithParams("/subscriptions/{subscription-id}", "subscription-id", subscriptionId); - return postAsync(path, null) + return postAsync("subscription", "update", path, null) .thenApply( response -> SubscriptionUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -1650,7 +1665,7 @@ Response importContractTermRaw(String subscriptionId) throws ChargebeeException "subscription-id", subscriptionId); - return post(path, null); + return post("subscription", "importContractTerm", path, null); } /** @@ -1664,7 +1679,7 @@ Response importContractTermRaw(String subscriptionId, SubscriptionImportContract "/subscriptions/{subscription-id}/import_contract_term", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("subscription", "importContractTerm", path, params.toFormData()); } /** @@ -1678,7 +1693,7 @@ Response importContractTermRaw(String subscriptionId, String jsonPayload) "/subscriptions/{subscription-id}/import_contract_term", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("subscription", "importContractTerm", path, jsonPayload); } public SubscriptionImportContractTermResponse importContractTerm( @@ -1696,7 +1711,7 @@ public CompletableFuture importContractT "/subscriptions/{subscription-id}/import_contract_term", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("subscription", "importContractTerm", path, params.toFormData()) .thenApply( response -> SubscriptionImportContractTermResponse.fromJson( @@ -1718,7 +1733,7 @@ public CompletableFuture importContractT "subscription-id", subscriptionId); - return postAsync(path, null) + return postAsync("subscription", "importContractTerm", path, null) .thenApply( response -> SubscriptionImportContractTermResponse.fromJson( @@ -1733,7 +1748,7 @@ Response overrideBillingProfileRaw(String subscriptionId) throws ChargebeeExcept "subscription-id", subscriptionId); - return post(path, null); + return post("subscription", "overrideBillingProfile", path, null); } /** @@ -1748,7 +1763,7 @@ Response overrideBillingProfileRaw( "/subscriptions/{subscription-id}/override_billing_profile", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("subscription", "overrideBillingProfile", path, params.toFormData()); } /** @@ -1762,7 +1777,7 @@ Response overrideBillingProfileRaw(String subscriptionId, String jsonPayload) "/subscriptions/{subscription-id}/override_billing_profile", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("subscription", "overrideBillingProfile", path, jsonPayload); } public SubscriptionOverrideBillingProfileResponse overrideBillingProfile( @@ -1781,7 +1796,7 @@ public CompletableFuture overrideBil "/subscriptions/{subscription-id}/override_billing_profile", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("subscription", "overrideBillingProfile", path, params.toFormData()) .thenApply( response -> SubscriptionOverrideBillingProfileResponse.fromJson( @@ -1804,7 +1819,7 @@ public CompletableFuture overrideBil "subscription-id", subscriptionId); - return postAsync(path, null) + return postAsync("subscription", "overrideBillingProfile", path, null) .thenApply( response -> SubscriptionOverrideBillingProfileResponse.fromJson( @@ -1819,7 +1834,7 @@ Response removeScheduledPauseRaw(String subscriptionId) throws ChargebeeExceptio "subscription-id", subscriptionId); - return post(path, null); + return post("subscription", "removeScheduledPause", path, null); } public SubscriptionRemoveScheduledPauseResponse removeScheduledPause(String subscriptionId) @@ -1837,7 +1852,7 @@ public CompletableFuture removeSchedul "subscription-id", subscriptionId); - return postAsync(path, null) + return postAsync("subscription", "removeScheduledPause", path, null) .thenApply( response -> SubscriptionRemoveScheduledPauseResponse.fromJson( @@ -1852,7 +1867,7 @@ Response editAdvanceInvoiceScheduleRaw(String subscriptionId) throws ChargebeeEx "subscription-id", subscriptionId); - return post(path, null); + return post("subscription", "editAdvanceInvoiceSchedule", path, null); } /** @@ -1867,7 +1882,7 @@ Response editAdvanceInvoiceScheduleRaw( "/subscriptions/{subscription-id}/edit_advance_invoice_schedule", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("subscription", "editAdvanceInvoiceSchedule", path, params.toFormData()); } /** @@ -1881,7 +1896,7 @@ Response editAdvanceInvoiceScheduleRaw(String subscriptionId, String jsonPayload "/subscriptions/{subscription-id}/edit_advance_invoice_schedule", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("subscription", "editAdvanceInvoiceSchedule", path, jsonPayload); } public SubscriptionEditAdvanceInvoiceScheduleResponse editAdvanceInvoiceSchedule( @@ -1901,7 +1916,7 @@ public SubscriptionEditAdvanceInvoiceScheduleResponse editAdvanceInvoiceSchedule "/subscriptions/{subscription-id}/edit_advance_invoice_schedule", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("subscription", "editAdvanceInvoiceSchedule", path, params.toFormData()) .thenApply( response -> SubscriptionEditAdvanceInvoiceScheduleResponse.fromJson( @@ -1924,7 +1939,7 @@ public SubscriptionEditAdvanceInvoiceScheduleResponse editAdvanceInvoiceSchedule "subscription-id", subscriptionId); - return postAsync(path, null) + return postAsync("subscription", "editAdvanceInvoiceSchedule", path, null) .thenApply( response -> SubscriptionEditAdvanceInvoiceScheduleResponse.fromJson( @@ -1940,7 +1955,8 @@ Response listDiscountsRaw(String subscriptionId, SubscriptionListDiscountsParams String path = buildPathWithParams( "/subscriptions/{subscription-id}/discounts", "subscription-id", subscriptionId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "subscription", "listDiscounts", path, params != null ? params.toQueryParams() : null); } /** listDiscounts a subscription without params (executes immediately) - returns raw Response. */ @@ -1948,7 +1964,7 @@ Response listDiscountsRaw(String subscriptionId) throws ChargebeeException { String path = buildPathWithParams( "/subscriptions/{subscription-id}/discounts", "subscription-id", subscriptionId); - return get(path, null); + return get("subscription", "listDiscounts", path, null); } /** @@ -1982,7 +1998,8 @@ public CompletableFuture listDiscountsAsync( String path = buildPathWithParams( "/subscriptions/{subscription-id}/discounts", "subscription-id", subscriptionId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "subscription", "listDiscounts", path, params != null ? params.toQueryParams() : null) .thenApply( response -> SubscriptionListDiscountsResponse.fromJson( @@ -1995,7 +2012,7 @@ public CompletableFuture listDiscountsAsync( String path = buildPathWithParams( "/subscriptions/{subscription-id}/discounts", "subscription-id", subscriptionId); - return getAsync(path, null) + return getAsync("subscription", "listDiscounts", path, null) .thenApply( response -> SubscriptionListDiscountsResponse.fromJson( @@ -2011,7 +2028,11 @@ Response contractTermsForSubscriptionRaw( String path = buildPathWithParams( "/subscriptions/{subscription-id}/contract_terms", "subscription-id", subscriptionId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "subscription", + "contractTermsForSubscription", + path, + params != null ? params.toQueryParams() : null); } /** @@ -2022,7 +2043,7 @@ Response contractTermsForSubscriptionRaw(String subscriptionId) throws Chargebee String path = buildPathWithParams( "/subscriptions/{subscription-id}/contract_terms", "subscription-id", subscriptionId); - return get(path, null); + return get("subscription", "contractTermsForSubscription", path, null); } /** @@ -2057,7 +2078,11 @@ public CompletableFuture contractTermsForS String path = buildPathWithParams( "/subscriptions/{subscription-id}/contract_terms", "subscription-id", subscriptionId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "subscription", + "contractTermsForSubscription", + path, + params != null ? params.toQueryParams() : null) .thenApply( response -> ContractTermsForSubscriptionResponse.fromJson( @@ -2070,7 +2095,7 @@ public CompletableFuture contractTermsForS String path = buildPathWithParams( "/subscriptions/{subscription-id}/contract_terms", "subscription-id", subscriptionId); - return getAsync(path, null) + return getAsync("subscription", "contractTermsForSubscription", path, null) .thenApply( response -> ContractTermsForSubscriptionResponse.fromJson( @@ -2083,7 +2108,7 @@ Response pauseRaw(String subscriptionId) throws ChargebeeException { buildPathWithParams( "/subscriptions/{subscription-id}/pause", "subscription-id", subscriptionId); - return post(path, null); + return post("subscription", "pause", path, null); } /** pause a subscription using immutable params (executes immediately) - returns raw Response. */ @@ -2092,7 +2117,7 @@ Response pauseRaw(String subscriptionId, SubscriptionPauseParams params) String path = buildPathWithParams( "/subscriptions/{subscription-id}/pause", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("subscription", "pause", path, params.toFormData()); } /** pause a subscription using raw JSON payload (executes immediately) - returns raw Response. */ @@ -2100,7 +2125,7 @@ Response pauseRaw(String subscriptionId, String jsonPayload) throws ChargebeeExc String path = buildPathWithParams( "/subscriptions/{subscription-id}/pause", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("subscription", "pause", path, jsonPayload); } public SubscriptionPauseResponse pause(String subscriptionId, SubscriptionPauseParams params) @@ -2115,7 +2140,7 @@ public CompletableFuture pauseAsync( String path = buildPathWithParams( "/subscriptions/{subscription-id}/pause", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("subscription", "pause", path, params.toFormData()) .thenApply( response -> SubscriptionPauseResponse.fromJson(response.getBodyAsString(), response)); } @@ -2131,7 +2156,7 @@ public CompletableFuture pauseAsync(String subscripti buildPathWithParams( "/subscriptions/{subscription-id}/pause", "subscription-id", subscriptionId); - return postAsync(path, null) + return postAsync("subscription", "pause", path, null) .thenApply( response -> SubscriptionPauseResponse.fromJson(response.getBodyAsString(), response)); } @@ -2142,7 +2167,7 @@ Response importForCustomerRaw(String customerId) throws ChargebeeException { buildPathWithParams( "/customers/{customer-id}/import_subscription", "customer-id", customerId); - return post(path, null); + return post("subscription", "importForCustomer", path, null); } /** @@ -2154,7 +2179,7 @@ Response importForCustomerRaw(String customerId, SubscriptionImportForCustomerPa String path = buildPathWithParams( "/customers/{customer-id}/import_subscription", "customer-id", customerId); - return post(path, params.toFormData()); + return post("subscription", "importForCustomer", path, params.toFormData()); } /** @@ -2165,7 +2190,7 @@ Response importForCustomerRaw(String customerId, String jsonPayload) throws Char String path = buildPathWithParams( "/customers/{customer-id}/import_subscription", "customer-id", customerId); - return postJson(path, jsonPayload); + return postJson("subscription", "importForCustomer", path, jsonPayload); } public SubscriptionImportForCustomerResponse importForCustomer( @@ -2180,7 +2205,7 @@ public CompletableFuture importForCustome String path = buildPathWithParams( "/customers/{customer-id}/import_subscription", "customer-id", customerId); - return postAsync(path, params.toFormData()) + return postAsync("subscription", "importForCustomer", path, params.toFormData()) .thenApply( response -> SubscriptionImportForCustomerResponse.fromJson( @@ -2193,7 +2218,11 @@ public CompletableFuture importForCustome */ Response importSubscriptionRaw(ImportSubscriptionParams params) throws ChargebeeException { - return post("/subscriptions/import_subscription", params != null ? params.toFormData() : null); + return post( + "subscription", + "importSubscription", + "/subscriptions/import_subscription", + params != null ? params.toFormData() : null); } /** @@ -2202,7 +2231,8 @@ Response importSubscriptionRaw(ImportSubscriptionParams params) throws Chargebee */ Response importSubscriptionRaw(String jsonPayload) throws ChargebeeException { - return postJson("/subscriptions/import_subscription", jsonPayload); + return postJson( + "subscription", "importSubscription", "/subscriptions/import_subscription", jsonPayload); } public ImportSubscriptionResponse importSubscription(ImportSubscriptionParams params) @@ -2217,7 +2247,10 @@ public CompletableFuture importSubscriptionAsync( ImportSubscriptionParams params) { return postAsync( - "/subscriptions/import_subscription", params != null ? params.toFormData() : null) + "subscription", + "importSubscription", + "/subscriptions/import_subscription", + params != null ? params.toFormData() : null) .thenApply( response -> ImportSubscriptionResponse.fromJson(response.getBodyAsString(), response)); } @@ -2228,7 +2261,7 @@ Response cancelRaw(String subscriptionId) throws ChargebeeException { buildPathWithParams( "/subscriptions/{subscription-id}/cancel", "subscription-id", subscriptionId); - return post(path, null); + return post("subscription", "cancel", path, null); } /** cancel a subscription using immutable params (executes immediately) - returns raw Response. */ @@ -2237,7 +2270,7 @@ Response cancelRaw(String subscriptionId, SubscriptionCancelParams params) String path = buildPathWithParams( "/subscriptions/{subscription-id}/cancel", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("subscription", "cancel", path, params.toFormData()); } /** cancel a subscription using raw JSON payload (executes immediately) - returns raw Response. */ @@ -2245,7 +2278,7 @@ Response cancelRaw(String subscriptionId, String jsonPayload) throws ChargebeeEx String path = buildPathWithParams( "/subscriptions/{subscription-id}/cancel", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("subscription", "cancel", path, jsonPayload); } public SubscriptionCancelResponse cancel(String subscriptionId, SubscriptionCancelParams params) @@ -2260,7 +2293,7 @@ public CompletableFuture cancelAsync( String path = buildPathWithParams( "/subscriptions/{subscription-id}/cancel", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("subscription", "cancel", path, params.toFormData()) .thenApply( response -> SubscriptionCancelResponse.fromJson(response.getBodyAsString(), response)); } @@ -2276,7 +2309,7 @@ public CompletableFuture cancelAsync(String subscrip buildPathWithParams( "/subscriptions/{subscription-id}/cancel", "subscription-id", subscriptionId); - return postAsync(path, null) + return postAsync("subscription", "cancel", path, null) .thenApply( response -> SubscriptionCancelResponse.fromJson(response.getBodyAsString(), response)); } @@ -2289,7 +2322,7 @@ Response chargeAddonAtTermEndRaw(String subscriptionId) throws ChargebeeExceptio "subscription-id", subscriptionId); - return post(path, null); + return post("subscription", "chargeAddonAtTermEnd", path, null); } /** @@ -2304,7 +2337,7 @@ Response chargeAddonAtTermEndRaw( "/subscriptions/{subscription-id}/charge_addon_at_term_end", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("subscription", "chargeAddonAtTermEnd", path, params.toFormData()); } /** @@ -2318,7 +2351,7 @@ Response chargeAddonAtTermEndRaw(String subscriptionId, String jsonPayload) "/subscriptions/{subscription-id}/charge_addon_at_term_end", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("subscription", "chargeAddonAtTermEnd", path, jsonPayload); } public SubscriptionChargeAddonAtTermEndResponse chargeAddonAtTermEnd( @@ -2336,7 +2369,7 @@ public CompletableFuture chargeAddonAt "/subscriptions/{subscription-id}/charge_addon_at_term_end", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("subscription", "chargeAddonAtTermEnd", path, params.toFormData()) .thenApply( response -> SubscriptionChargeAddonAtTermEndResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/SubscriptionSettingService.java b/src/main/java/com/chargebee/v4/services/SubscriptionSettingService.java index 05922cf00..7835b2b41 100644 --- a/src/main/java/com/chargebee/v4/services/SubscriptionSettingService.java +++ b/src/main/java/com/chargebee/v4/services/SubscriptionSettingService.java @@ -58,7 +58,11 @@ public SubscriptionSettingService withOptions(RequestOptions options) { */ Response retrieveRaw(SubscriptionSettingRetrieveParams params) throws ChargebeeException { - return get("/subscription_settings/retrieve", params != null ? params.toQueryParams() : null); + return get( + "subscriptionSetting", + "retrieve", + "/subscription_settings/retrieve", + params != null ? params.toQueryParams() : null); } /** @@ -66,7 +70,7 @@ Response retrieveRaw(SubscriptionSettingRetrieveParams params) throws ChargebeeE */ Response retrieveRaw() throws ChargebeeException { - return get("/subscription_settings/retrieve", null); + return get("subscriptionSetting", "retrieve", "/subscription_settings/retrieve", null); } /** @@ -90,7 +94,10 @@ public CompletableFuture retrieveAsync( SubscriptionSettingRetrieveParams params) { return getAsync( - "/subscription_settings/retrieve", params != null ? params.toQueryParams() : null) + "subscriptionSetting", + "retrieve", + "/subscription_settings/retrieve", + params != null ? params.toQueryParams() : null) .thenApply( response -> SubscriptionSettingRetrieveResponse.fromJson(response.getBodyAsString(), response)); @@ -105,7 +112,7 @@ public SubscriptionSettingRetrieveResponse retrieve() throws ChargebeeException /** Async variant of retrieve for subscriptionSetting without params. */ public CompletableFuture retrieveAsync() { - return getAsync("/subscription_settings/retrieve", null) + return getAsync("subscriptionSetting", "retrieve", "/subscription_settings/retrieve", null) .thenApply( response -> 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 22ec1b125..532dd5651 100644 --- a/src/main/java/com/chargebee/v4/services/ThirdPartyConfigurationService.java +++ b/src/main/java/com/chargebee/v4/services/ThirdPartyConfigurationService.java @@ -69,6 +69,8 @@ Response configurationsRaw(ThirdPartyConfigurationConfigurationsParams params) throws ChargebeeException { return get( + "thirdPartyConfiguration", + "configurations", "/third_party_configurations/configurations", params != null ? params.toQueryParams() : null); } @@ -95,6 +97,8 @@ public CompletableFuture configur ThirdPartyConfigurationConfigurationsParams params) { return getAsync( + "thirdPartyConfiguration", + "configurations", "/third_party_configurations/configurations", params != null ? params.toQueryParams() : null) .thenApply( @@ -109,7 +113,11 @@ public CompletableFuture configur */ Response retrieveRaw(ThirdPartyConfigurationRetrieveParams params) throws ChargebeeException { - return get("/third_party_configurations", params != null ? params.toQueryParams() : null); + return get( + "thirdPartyConfiguration", + "retrieve", + "/third_party_configurations", + params != null ? params.toQueryParams() : null); } /** @@ -132,7 +140,11 @@ public ThirdPartyConfigurationRetrieveResponse retrieve( public CompletableFuture retrieveAsync( ThirdPartyConfigurationRetrieveParams params) { - return getAsync("/third_party_configurations", params != null ? params.toQueryParams() : null) + return getAsync( + "thirdPartyConfiguration", + "retrieve", + "/third_party_configurations", + params != null ? params.toQueryParams() : null) .thenApply( response -> ThirdPartyConfigurationRetrieveResponse.fromJson( @@ -145,7 +157,11 @@ public CompletableFuture retrieveAsync( */ Response updateRaw(ThirdPartyConfigurationUpdateParams params) throws ChargebeeException { - return post("/third_party_configurations", params != null ? params.toFormData() : null); + return post( + "thirdPartyConfiguration", + "update", + "/third_party_configurations", + params != null ? params.toFormData() : null); } /** @@ -154,7 +170,8 @@ Response updateRaw(ThirdPartyConfigurationUpdateParams params) throws ChargebeeE */ Response updateRaw(String jsonPayload) throws ChargebeeException { - return postJson("/third_party_configurations", jsonPayload); + return postJson( + "thirdPartyConfiguration", "update", "/third_party_configurations", jsonPayload); } public ThirdPartyConfigurationUpdateResponse update(ThirdPartyConfigurationUpdateParams params) @@ -168,7 +185,11 @@ public ThirdPartyConfigurationUpdateResponse update(ThirdPartyConfigurationUpdat public CompletableFuture updateAsync( ThirdPartyConfigurationUpdateParams params) { - return postAsync("/third_party_configurations", params != null ? params.toFormData() : null) + return postAsync( + "thirdPartyConfiguration", + "update", + "/third_party_configurations", + params != null ? params.toFormData() : null) .thenApply( response -> ThirdPartyConfigurationUpdateResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/ThirdPartyEntityMappingService.java b/src/main/java/com/chargebee/v4/services/ThirdPartyEntityMappingService.java index 983d6bdc2..706abf7ed 100644 --- a/src/main/java/com/chargebee/v4/services/ThirdPartyEntityMappingService.java +++ b/src/main/java/com/chargebee/v4/services/ThirdPartyEntityMappingService.java @@ -73,7 +73,10 @@ Response retrieveEntityRaw(ThirdPartyEntityMappingRetrieveEntityParams params) throws ChargebeeException { return get( - "/third_party_entity_mappings/retrieve", params != null ? params.toQueryParams() : null); + "thirdPartyEntityMapping", + "retrieveEntity", + "/third_party_entity_mappings/retrieve", + params != null ? params.toQueryParams() : null); } /** @@ -98,7 +101,10 @@ public CompletableFuture retrieve ThirdPartyEntityMappingRetrieveEntityParams params) { return getAsync( - "/third_party_entity_mappings/retrieve", params != null ? params.toQueryParams() : null) + "thirdPartyEntityMapping", + "retrieveEntity", + "/third_party_entity_mappings/retrieve", + params != null ? params.toQueryParams() : null) .thenApply( response -> ThirdPartyEntityMappingRetrieveEntityResponse.fromJson( @@ -112,7 +118,10 @@ public CompletableFuture retrieve Response listAllRaw(ThirdPartyEntityMappingListAllParams params) throws ChargebeeException { return get( - "/third_party_entity_mappings/list_all", params != null ? params.toQueryParams() : null); + "thirdPartyEntityMapping", + "listAll", + "/third_party_entity_mappings/list_all", + params != null ? params.toQueryParams() : null); } /** @@ -136,7 +145,10 @@ public CompletableFuture listAllAsync( ThirdPartyEntityMappingListAllParams params) { return getAsync( - "/third_party_entity_mappings/list_all", params != null ? params.toQueryParams() : null) + "thirdPartyEntityMapping", + "listAll", + "/third_party_entity_mappings/list_all", + params != null ? params.toQueryParams() : null) .thenApply( response -> ThirdPartyEntityMappingListAllResponse.fromJson( @@ -151,7 +163,10 @@ Response updateEntityRaw(ThirdPartyEntityMappingUpdateEntityParams params) throws ChargebeeException { return post( - "/third_party_entity_mappings/update_entity", params != null ? params.toFormData() : null); + "thirdPartyEntityMapping", + "updateEntity", + "/third_party_entity_mappings/update_entity", + params != null ? params.toFormData() : null); } /** @@ -160,7 +175,11 @@ Response updateEntityRaw(ThirdPartyEntityMappingUpdateEntityParams params) */ Response updateEntityRaw(String jsonPayload) throws ChargebeeException { - return postJson("/third_party_entity_mappings/update_entity", jsonPayload); + return postJson( + "thirdPartyEntityMapping", + "updateEntity", + "/third_party_entity_mappings/update_entity", + jsonPayload); } public ThirdPartyEntityMappingUpdateEntityResponse updateEntity( @@ -176,6 +195,8 @@ public CompletableFuture updateEnti ThirdPartyEntityMappingUpdateEntityParams params) { return postAsync( + "thirdPartyEntityMapping", + "updateEntity", "/third_party_entity_mappings/update_entity", params != null ? params.toFormData() : null) .thenApply( @@ -190,7 +211,11 @@ public CompletableFuture updateEnti */ Response listRaw(ThirdPartyEntityMappingListParams params) throws ChargebeeException { - return get("/third_party_entity_mappings", params != null ? params.toQueryParams() : null); + return get( + "thirdPartyEntityMapping", + "list", + "/third_party_entity_mappings", + params != null ? params.toQueryParams() : null); } /** @@ -198,7 +223,7 @@ Response listRaw(ThirdPartyEntityMappingListParams params) throws ChargebeeExcep */ Response listRaw() throws ChargebeeException { - return get("/third_party_entity_mappings", null); + return get("thirdPartyEntityMapping", "list", "/third_party_entity_mappings", null); } /** @@ -222,7 +247,11 @@ public ThirdPartyEntityMappingListResponse list(ThirdPartyEntityMappingListParam public CompletableFuture listAsync( ThirdPartyEntityMappingListParams params) { - return getAsync("/third_party_entity_mappings", params != null ? params.toQueryParams() : null) + return getAsync( + "thirdPartyEntityMapping", + "list", + "/third_party_entity_mappings", + params != null ? params.toQueryParams() : null) .thenApply( response -> ThirdPartyEntityMappingListResponse.fromJson( @@ -239,7 +268,7 @@ public ThirdPartyEntityMappingListResponse list() throws ChargebeeException { /** Async variant of list for thirdPartyEntityMapping without params. */ public CompletableFuture listAsync() { - return getAsync("/third_party_entity_mappings", null) + return getAsync("thirdPartyEntityMapping", "list", "/third_party_entity_mappings", null) .thenApply( response -> ThirdPartyEntityMappingListResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/ThirdPartySyncDetailService.java b/src/main/java/com/chargebee/v4/services/ThirdPartySyncDetailService.java index e1b4ff6ff..52216b0bc 100644 --- a/src/main/java/com/chargebee/v4/services/ThirdPartySyncDetailService.java +++ b/src/main/java/com/chargebee/v4/services/ThirdPartySyncDetailService.java @@ -70,7 +70,7 @@ Response retrieveRaw(String tpIntegSyncDetailId) throws ChargebeeException { "tp-integ-sync-detail-id", tpIntegSyncDetailId); - return get(path, null); + return get("thirdPartySyncDetail", "retrieve", path, null); } public ThirdPartySyncDetailRetrieveResponse retrieve(String tpIntegSyncDetailId) @@ -88,7 +88,7 @@ public CompletableFuture retrieveAsync( "tp-integ-sync-detail-id", tpIntegSyncDetailId); - return getAsync(path, null) + return getAsync("thirdPartySyncDetail", "retrieve", path, null) .thenApply( response -> ThirdPartySyncDetailRetrieveResponse.fromJson( @@ -103,7 +103,7 @@ Response updateRaw(String tpIntegSyncDetailId) throws ChargebeeException { "tp-integ-sync-detail-id", tpIntegSyncDetailId); - return post(path, null); + return post("thirdPartySyncDetail", "update", path, null); } /** @@ -117,7 +117,7 @@ Response updateRaw(String tpIntegSyncDetailId, ThirdPartySyncDetailUpdateParams "/third_party_sync_details/{tp-integ-sync-detail-id}", "tp-integ-sync-detail-id", tpIntegSyncDetailId); - return post(path, params.toFormData()); + return post("thirdPartySyncDetail", "update", path, params.toFormData()); } /** @@ -130,7 +130,7 @@ Response updateRaw(String tpIntegSyncDetailId, String jsonPayload) throws Charge "/third_party_sync_details/{tp-integ-sync-detail-id}", "tp-integ-sync-detail-id", tpIntegSyncDetailId); - return postJson(path, jsonPayload); + return postJson("thirdPartySyncDetail", "update", path, jsonPayload); } public ThirdPartySyncDetailUpdateResponse update( @@ -148,7 +148,7 @@ public CompletableFuture updateAsync( "/third_party_sync_details/{tp-integ-sync-detail-id}", "tp-integ-sync-detail-id", tpIntegSyncDetailId); - return postAsync(path, params.toFormData()) + return postAsync("thirdPartySyncDetail", "update", path, params.toFormData()) .thenApply( response -> ThirdPartySyncDetailUpdateResponse.fromJson(response.getBodyAsString(), response)); @@ -160,7 +160,11 @@ public CompletableFuture updateAsync( */ Response createRaw(ThirdPartySyncDetailCreateParams params) throws ChargebeeException { - return post("/third_party_sync_details", params != null ? params.toFormData() : null); + return post( + "thirdPartySyncDetail", + "create", + "/third_party_sync_details", + params != null ? params.toFormData() : null); } /** @@ -169,7 +173,7 @@ Response createRaw(ThirdPartySyncDetailCreateParams params) throws ChargebeeExce */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/third_party_sync_details", jsonPayload); + return postJson("thirdPartySyncDetail", "create", "/third_party_sync_details", jsonPayload); } public ThirdPartySyncDetailCreateResponse create(ThirdPartySyncDetailCreateParams params) @@ -183,7 +187,11 @@ public ThirdPartySyncDetailCreateResponse create(ThirdPartySyncDetailCreateParam public CompletableFuture createAsync( ThirdPartySyncDetailCreateParams params) { - return postAsync("/third_party_sync_details", params != null ? params.toFormData() : null) + return postAsync( + "thirdPartySyncDetail", + "create", + "/third_party_sync_details", + params != null ? params.toFormData() : null) .thenApply( response -> ThirdPartySyncDetailCreateResponse.fromJson(response.getBodyAsString(), response)); @@ -197,6 +205,8 @@ Response retrieveLatestSyncRaw(ThirdPartySyncDetailRetrieveLatestSyncParams para throws ChargebeeException { return get( + "thirdPartySyncDetail", + "retrieveLatestSync", "/third_party_sync_details/retrieve_latest_sync", params != null ? params.toQueryParams() : null); } @@ -207,7 +217,11 @@ Response retrieveLatestSyncRaw(ThirdPartySyncDetailRetrieveLatestSyncParams para */ Response retrieveLatestSyncRaw() throws ChargebeeException { - return get("/third_party_sync_details/retrieve_latest_sync", null); + return get( + "thirdPartySyncDetail", + "retrieveLatestSync", + "/third_party_sync_details/retrieve_latest_sync", + null); } /** @@ -232,6 +246,8 @@ public CompletableFuture retriev ThirdPartySyncDetailRetrieveLatestSyncParams params) { return getAsync( + "thirdPartySyncDetail", + "retrieveLatestSync", "/third_party_sync_details/retrieve_latest_sync", params != null ? params.toQueryParams() : null) .thenApply( @@ -252,7 +268,11 @@ public ThirdPartySyncDetailRetrieveLatestSyncResponse retrieveLatestSync() public CompletableFuture retrieveLatestSyncAsync() { - return getAsync("/third_party_sync_details/retrieve_latest_sync", null) + return getAsync( + "thirdPartySyncDetail", + "retrieveLatestSync", + "/third_party_sync_details/retrieve_latest_sync", + null) .thenApply( response -> 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 e9213d505..8747aeaa2 100644 --- a/src/main/java/com/chargebee/v4/services/TimeMachineService.java +++ b/src/main/java/com/chargebee/v4/services/TimeMachineService.java @@ -69,7 +69,7 @@ Response retrieveRaw(String timeMachineName) throws ChargebeeException { buildPathWithParams( "/time_machines/{time-machine-name}", "time-machine-name", timeMachineName); - return get(path, null); + return get("timeMachine", "retrieve", path, null); } public TimeMachineRetrieveResponse retrieve(String timeMachineName) throws ChargebeeException { @@ -83,7 +83,7 @@ public CompletableFuture retrieveAsync(String timeM buildPathWithParams( "/time_machines/{time-machine-name}", "time-machine-name", timeMachineName); - return getAsync(path, null) + return getAsync("timeMachine", "retrieve", path, null) .thenApply( response -> TimeMachineRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -96,7 +96,7 @@ Response travelForwardRaw(String timeMachineName) throws ChargebeeException { "time-machine-name", timeMachineName); - return post(path, null); + return post("timeMachine", "travelForward", path, null); } /** @@ -110,7 +110,7 @@ Response travelForwardRaw(String timeMachineName, TimeMachineTravelForwardParams "/time_machines/{time-machine-name}/travel_forward", "time-machine-name", timeMachineName); - return post(path, params.toFormData()); + return post("timeMachine", "travelForward", path, params.toFormData()); } /** @@ -123,7 +123,7 @@ Response travelForwardRaw(String timeMachineName, String jsonPayload) throws Cha "/time_machines/{time-machine-name}/travel_forward", "time-machine-name", timeMachineName); - return postJson(path, jsonPayload); + return postJson("timeMachine", "travelForward", path, jsonPayload); } public TimeMachineTravelForwardResponse travelForward( @@ -140,7 +140,7 @@ public CompletableFuture travelForwardAsync( "/time_machines/{time-machine-name}/travel_forward", "time-machine-name", timeMachineName); - return postAsync(path, params.toFormData()) + return postAsync("timeMachine", "travelForward", path, params.toFormData()) .thenApply( response -> TimeMachineTravelForwardResponse.fromJson(response.getBodyAsString(), response)); @@ -161,7 +161,7 @@ public CompletableFuture travelForwardAsync( "time-machine-name", timeMachineName); - return postAsync(path, null) + return postAsync("timeMachine", "travelForward", path, null) .thenApply( response -> TimeMachineTravelForwardResponse.fromJson(response.getBodyAsString(), response)); @@ -175,7 +175,7 @@ Response startAfreshRaw(String timeMachineName) throws ChargebeeException { "time-machine-name", timeMachineName); - return post(path, null); + return post("timeMachine", "startAfresh", path, null); } /** @@ -188,7 +188,7 @@ Response startAfreshRaw(String timeMachineName, TimeMachineStartAfreshParams par "/time_machines/{time-machine-name}/start_afresh", "time-machine-name", timeMachineName); - return post(path, params.toFormData()); + return post("timeMachine", "startAfresh", path, params.toFormData()); } /** @@ -200,7 +200,7 @@ Response startAfreshRaw(String timeMachineName, String jsonPayload) throws Charg "/time_machines/{time-machine-name}/start_afresh", "time-machine-name", timeMachineName); - return postJson(path, jsonPayload); + return postJson("timeMachine", "startAfresh", path, jsonPayload); } public TimeMachineStartAfreshResponse startAfresh( @@ -217,7 +217,7 @@ public CompletableFuture startAfreshAsync( "/time_machines/{time-machine-name}/start_afresh", "time-machine-name", timeMachineName); - return postAsync(path, params.toFormData()) + return postAsync("timeMachine", "startAfresh", path, params.toFormData()) .thenApply( response -> TimeMachineStartAfreshResponse.fromJson(response.getBodyAsString(), response)); @@ -238,7 +238,7 @@ public CompletableFuture startAfreshAsync( "time-machine-name", timeMachineName); - return postAsync(path, null) + return postAsync("timeMachine", "startAfresh", path, null) .thenApply( response -> 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 4630c1b56..5c23f4ca8 100644 --- a/src/main/java/com/chargebee/v4/services/TpSiteUserService.java +++ b/src/main/java/com/chargebee/v4/services/TpSiteUserService.java @@ -68,7 +68,8 @@ Response usersForTpSiteUserRaw(String tpSiteUserDomain, UsersForTpSiteUserParams String path = buildPathWithParams( "/tp_site_users/{tp-site-user-domain}/users", "tp-site-user-domain", tpSiteUserDomain); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "tpSiteUser", "usersForTpSiteUser", path, params != null ? params.toQueryParams() : null); } /** @@ -78,7 +79,7 @@ Response usersForTpSiteUserRaw(String tpSiteUserDomain) throws ChargebeeExceptio String path = buildPathWithParams( "/tp_site_users/{tp-site-user-domain}/users", "tp-site-user-domain", tpSiteUserDomain); - return get(path, null); + return get("tpSiteUser", "usersForTpSiteUser", path, null); } /** @@ -113,7 +114,11 @@ public CompletableFuture usersForTpSiteUserAsync( String path = buildPathWithParams( "/tp_site_users/{tp-site-user-domain}/users", "tp-site-user-domain", tpSiteUserDomain); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "tpSiteUser", + "usersForTpSiteUser", + path, + params != null ? params.toQueryParams() : null) .thenApply( response -> UsersForTpSiteUserResponse.fromJson( @@ -126,7 +131,7 @@ public CompletableFuture usersForTpSiteUserAsync( String path = buildPathWithParams( "/tp_site_users/{tp-site-user-domain}/users", "tp-site-user-domain", tpSiteUserDomain); - return getAsync(path, null) + return getAsync("tpSiteUser", "usersForTpSiteUser", path, null) .thenApply( response -> UsersForTpSiteUserResponse.fromJson( @@ -139,7 +144,11 @@ public CompletableFuture usersForTpSiteUserAsync( */ Response payNowEnableLiveRaw(TpSiteUserPayNowEnableLiveParams params) throws ChargebeeException { - return post("/tp_site_users/pay_now_enable_live", params != null ? params.toFormData() : null); + return post( + "tpSiteUser", + "payNowEnableLive", + "/tp_site_users/pay_now_enable_live", + params != null ? params.toFormData() : null); } /** @@ -148,7 +157,8 @@ Response payNowEnableLiveRaw(TpSiteUserPayNowEnableLiveParams params) throws Cha */ Response payNowEnableLiveRaw(String jsonPayload) throws ChargebeeException { - return postJson("/tp_site_users/pay_now_enable_live", jsonPayload); + return postJson( + "tpSiteUser", "payNowEnableLive", "/tp_site_users/pay_now_enable_live", jsonPayload); } public TpSiteUserPayNowEnableLiveResponse payNowEnableLive( @@ -163,7 +173,10 @@ public CompletableFuture payNowEnableLiveAsy TpSiteUserPayNowEnableLiveParams params) { return postAsync( - "/tp_site_users/pay_now_enable_live", params != null ? params.toFormData() : null) + "tpSiteUser", + "payNowEnableLive", + "/tp_site_users/pay_now_enable_live", + params != null ? params.toFormData() : null) .thenApply( response -> TpSiteUserPayNowEnableLiveResponse.fromJson(response.getBodyAsString(), response)); @@ -178,7 +191,8 @@ Response guestsForTpSiteUserRaw(String tpSiteUserDomain, GuestsForTpSiteUserPara String path = buildPathWithParams( "/tp_site_users/{tp-site-user-domain}/guests", "tp-site-user-domain", tpSiteUserDomain); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "tpSiteUser", "guestsForTpSiteUser", path, params != null ? params.toQueryParams() : null); } /** @@ -188,7 +202,7 @@ Response guestsForTpSiteUserRaw(String tpSiteUserDomain) throws ChargebeeExcepti String path = buildPathWithParams( "/tp_site_users/{tp-site-user-domain}/guests", "tp-site-user-domain", tpSiteUserDomain); - return get(path, null); + return get("tpSiteUser", "guestsForTpSiteUser", path, null); } /** @@ -223,7 +237,11 @@ public CompletableFuture guestsForTpSiteUserAsync( String path = buildPathWithParams( "/tp_site_users/{tp-site-user-domain}/guests", "tp-site-user-domain", tpSiteUserDomain); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "tpSiteUser", + "guestsForTpSiteUser", + path, + params != null ? params.toQueryParams() : null) .thenApply( response -> GuestsForTpSiteUserResponse.fromJson( @@ -236,7 +254,7 @@ public CompletableFuture guestsForTpSiteUserAsync( String path = buildPathWithParams( "/tp_site_users/{tp-site-user-domain}/guests", "tp-site-user-domain", tpSiteUserDomain); - return getAsync(path, null) + return getAsync("tpSiteUser", "guestsForTpSiteUser", path, null) .thenApply( response -> GuestsForTpSiteUserResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/TransactionService.java b/src/main/java/com/chargebee/v4/services/TransactionService.java index 42d489238..f823db013 100644 --- a/src/main/java/com/chargebee/v4/services/TransactionService.java +++ b/src/main/java/com/chargebee/v4/services/TransactionService.java @@ -92,13 +92,14 @@ public TransactionService withOptions(RequestOptions options) { /** list a transaction using immutable params (executes immediately) - returns raw Response. */ Response listRaw(TransactionListParams params) throws ChargebeeException { - return get("/transactions", params != null ? params.toQueryParams() : null); + return get( + "transaction", "list", "/transactions", params != null ? params.toQueryParams() : null); } /** list a transaction without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/transactions", null); + return get("transaction", "list", "/transactions", null); } /** list a transaction using raw JSON payload (executes immediately) - returns raw Response. */ @@ -116,7 +117,8 @@ public TransactionListResponse list(TransactionListParams params) throws Chargeb /** Async variant of list for transaction with params. */ public CompletableFuture listAsync(TransactionListParams params) { - return getAsync("/transactions", params != null ? params.toQueryParams() : null) + return getAsync( + "transaction", "list", "/transactions", params != null ? params.toQueryParams() : null) .thenApply( response -> TransactionListResponse.fromJson( @@ -132,7 +134,7 @@ public TransactionListResponse list() throws ChargebeeException { /** Async variant of list for transaction without params. */ public CompletableFuture listAsync() { - return getAsync("/transactions", null) + return getAsync("transaction", "list", "/transactions", null) .thenApply( response -> TransactionListResponse.fromJson(response.getBodyAsString(), this, null, response)); @@ -144,7 +146,7 @@ Response reconcileRaw(String transactionId) throws ChargebeeException { buildPathWithParams( "/transactions/{transaction-id}/reconcile", "transaction-id", transactionId); - return post(path, null); + return post("transaction", "reconcile", path, null); } /** @@ -155,7 +157,7 @@ Response reconcileRaw(String transactionId, TransactionReconcileParams params) String path = buildPathWithParams( "/transactions/{transaction-id}/reconcile", "transaction-id", transactionId); - return post(path, params.toFormData()); + return post("transaction", "reconcile", path, params.toFormData()); } /** @@ -165,7 +167,7 @@ Response reconcileRaw(String transactionId, String jsonPayload) throws Chargebee String path = buildPathWithParams( "/transactions/{transaction-id}/reconcile", "transaction-id", transactionId); - return postJson(path, jsonPayload); + return postJson("transaction", "reconcile", path, jsonPayload); } public TransactionReconcileResponse reconcile( @@ -180,7 +182,7 @@ public CompletableFuture reconcileAsync( String path = buildPathWithParams( "/transactions/{transaction-id}/reconcile", "transaction-id", transactionId); - return postAsync(path, params.toFormData()) + return postAsync("transaction", "reconcile", path, params.toFormData()) .thenApply( response -> TransactionReconcileResponse.fromJson(response.getBodyAsString(), response)); @@ -197,7 +199,7 @@ public CompletableFuture reconcileAsync(String tra buildPathWithParams( "/transactions/{transaction-id}/reconcile", "transaction-id", transactionId); - return postAsync(path, null) + return postAsync("transaction", "reconcile", path, null) .thenApply( response -> TransactionReconcileResponse.fromJson(response.getBodyAsString(), response)); @@ -208,7 +210,7 @@ Response retrieveRaw(String transactionId) throws ChargebeeException { String path = buildPathWithParams("/transactions/{transaction-id}", "transaction-id", transactionId); - return get(path, null); + return get("transaction", "retrieve", path, null); } public TransactionRetrieveResponse retrieve(String transactionId) throws ChargebeeException { @@ -221,7 +223,7 @@ public CompletableFuture retrieveAsync(String trans String path = buildPathWithParams("/transactions/{transaction-id}", "transaction-id", transactionId); - return getAsync(path, null) + return getAsync("transaction", "retrieve", path, null) .thenApply( response -> TransactionRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -232,7 +234,7 @@ Response refundRaw(String transactionId) throws ChargebeeException { buildPathWithParams( "/transactions/{transaction-id}/refund", "transaction-id", transactionId); - return post(path, null); + return post("transaction", "refund", path, null); } /** refund a transaction using immutable params (executes immediately) - returns raw Response. */ @@ -241,7 +243,7 @@ Response refundRaw(String transactionId, TransactionRefundParams params) String path = buildPathWithParams( "/transactions/{transaction-id}/refund", "transaction-id", transactionId); - return post(path, params.toFormData()); + return post("transaction", "refund", path, params.toFormData()); } /** refund a transaction using raw JSON payload (executes immediately) - returns raw Response. */ @@ -249,7 +251,7 @@ Response refundRaw(String transactionId, String jsonPayload) throws ChargebeeExc String path = buildPathWithParams( "/transactions/{transaction-id}/refund", "transaction-id", transactionId); - return postJson(path, jsonPayload); + return postJson("transaction", "refund", path, jsonPayload); } public TransactionRefundResponse refund(String transactionId, TransactionRefundParams params) @@ -264,7 +266,7 @@ public CompletableFuture refundAsync( String path = buildPathWithParams( "/transactions/{transaction-id}/refund", "transaction-id", transactionId); - return postAsync(path, params.toFormData()) + return postAsync("transaction", "refund", path, params.toFormData()) .thenApply( response -> TransactionRefundResponse.fromJson(response.getBodyAsString(), response)); } @@ -280,7 +282,7 @@ public CompletableFuture refundAsync(String transacti buildPathWithParams( "/transactions/{transaction-id}/refund", "transaction-id", transactionId); - return postAsync(path, null) + return postAsync("transaction", "refund", path, null) .thenApply( response -> TransactionRefundResponse.fromJson(response.getBodyAsString(), response)); } @@ -293,7 +295,11 @@ Response transactionsForCustomerRaw(String customerId, TransactionsForCustomerPa throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/transactions", "customer-id", customerId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "transaction", + "transactionsForCustomer", + path, + params != null ? params.toQueryParams() : null); } /** @@ -303,7 +309,7 @@ Response transactionsForCustomerRaw(String customerId, TransactionsForCustomerPa Response transactionsForCustomerRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}/transactions", "customer-id", customerId); - return get(path, null); + return get("transaction", "transactionsForCustomer", path, null); } /** @@ -336,7 +342,11 @@ public CompletableFuture transactionsForCustome String customerId, TransactionsForCustomerParams params) { String path = buildPathWithParams("/customers/{customer-id}/transactions", "customer-id", customerId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "transaction", + "transactionsForCustomer", + path, + params != null ? params.toQueryParams() : null) .thenApply( response -> TransactionsForCustomerResponse.fromJson( @@ -348,7 +358,7 @@ public CompletableFuture transactionsForCustome String customerId) { String path = buildPathWithParams("/customers/{customer-id}/transactions", "customer-id", customerId); - return getAsync(path, null) + return getAsync("transaction", "transactionsForCustomer", path, null) .thenApply( response -> TransactionsForCustomerResponse.fromJson( @@ -361,7 +371,7 @@ Response recordRefundRaw(String transactionId) throws ChargebeeException { buildPathWithParams( "/transactions/{transaction-id}/record_refund", "transaction-id", transactionId); - return post(path, null); + return post("transaction", "recordRefund", path, null); } /** @@ -373,7 +383,7 @@ Response recordRefundRaw(String transactionId, TransactionRecordRefundParams par String path = buildPathWithParams( "/transactions/{transaction-id}/record_refund", "transaction-id", transactionId); - return post(path, params.toFormData()); + return post("transaction", "recordRefund", path, params.toFormData()); } /** @@ -384,7 +394,7 @@ Response recordRefundRaw(String transactionId, String jsonPayload) throws Charge String path = buildPathWithParams( "/transactions/{transaction-id}/record_refund", "transaction-id", transactionId); - return postJson(path, jsonPayload); + return postJson("transaction", "recordRefund", path, jsonPayload); } public TransactionRecordRefundResponse recordRefund( @@ -399,7 +409,7 @@ public CompletableFuture recordRefundAsync( String path = buildPathWithParams( "/transactions/{transaction-id}/record_refund", "transaction-id", transactionId); - return postAsync(path, params.toFormData()) + return postAsync("transaction", "recordRefund", path, params.toFormData()) .thenApply( response -> TransactionRecordRefundResponse.fromJson(response.getBodyAsString(), response)); @@ -414,7 +424,11 @@ Response transactionsForSubscriptionRaw( String path = buildPathWithParams( "/subscriptions/{subscription-id}/transactions", "subscription-id", subscriptionId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "transaction", + "transactionsForSubscription", + path, + params != null ? params.toQueryParams() : null); } /** @@ -425,7 +439,7 @@ Response transactionsForSubscriptionRaw(String subscriptionId) throws ChargebeeE String path = buildPathWithParams( "/subscriptions/{subscription-id}/transactions", "subscription-id", subscriptionId); - return get(path, null); + return get("transaction", "transactionsForSubscription", path, null); } /** @@ -460,7 +474,11 @@ public CompletableFuture transactionsForSub String path = buildPathWithParams( "/subscriptions/{subscription-id}/transactions", "subscription-id", subscriptionId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "transaction", + "transactionsForSubscription", + path, + params != null ? params.toQueryParams() : null) .thenApply( response -> TransactionsForSubscriptionResponse.fromJson( @@ -473,7 +491,7 @@ public CompletableFuture transactionsForSub String path = buildPathWithParams( "/subscriptions/{subscription-id}/transactions", "subscription-id", subscriptionId); - return getAsync(path, null) + return getAsync("transaction", "transactionsForSubscription", path, null) .thenApply( response -> TransactionsForSubscriptionResponse.fromJson( @@ -485,7 +503,7 @@ Response voidTransactionRaw(String transactionId) throws ChargebeeException { String path = buildPathWithParams("/transactions/{transaction-id}/void", "transaction-id", transactionId); - return post(path, null); + return post("transaction", "voidTransaction", path, null); } public VoidTransactionResponse voidTransaction(String transactionId) throws ChargebeeException { @@ -498,7 +516,7 @@ public CompletableFuture voidTransactionAsync(String tr String path = buildPathWithParams("/transactions/{transaction-id}/void", "transaction-id", transactionId); - return postAsync(path, null) + return postAsync("transaction", "voidTransaction", path, null) .thenApply( response -> VoidTransactionResponse.fromJson(response.getBodyAsString(), response)); } @@ -508,7 +526,7 @@ Response syncTransactionRaw(String transactionId) throws ChargebeeException { String path = buildPathWithParams("/transactions/{transaction-id}/sync", "transaction-id", transactionId); - return post(path, null); + return post("transaction", "syncTransaction", path, null); } public SyncTransactionResponse syncTransaction(String transactionId) throws ChargebeeException { @@ -521,7 +539,7 @@ public CompletableFuture syncTransactionAsync(String tr String path = buildPathWithParams("/transactions/{transaction-id}/sync", "transaction-id", transactionId); - return postAsync(path, null) + return postAsync("transaction", "syncTransaction", path, null) .thenApply( response -> SyncTransactionResponse.fromJson(response.getBodyAsString(), response)); } @@ -533,7 +551,11 @@ public CompletableFuture syncTransactionAsync(String tr Response createAuthorizationRaw(TransactionCreateAuthorizationParams params) throws ChargebeeException { - return post("/transactions/create_authorization", params != null ? params.toFormData() : null); + return post( + "transaction", + "createAuthorization", + "/transactions/create_authorization", + params != null ? params.toFormData() : null); } /** @@ -542,7 +564,8 @@ Response createAuthorizationRaw(TransactionCreateAuthorizationParams params) */ Response createAuthorizationRaw(String jsonPayload) throws ChargebeeException { - return postJson("/transactions/create_authorization", jsonPayload); + return postJson( + "transaction", "createAuthorization", "/transactions/create_authorization", jsonPayload); } public TransactionCreateAuthorizationResponse createAuthorization( @@ -557,7 +580,10 @@ public CompletableFuture createAuthoriza TransactionCreateAuthorizationParams params) { return postAsync( - "/transactions/create_authorization", params != null ? params.toFormData() : null) + "transaction", + "createAuthorization", + "/transactions/create_authorization", + params != null ? params.toFormData() : null) .thenApply( response -> TransactionCreateAuthorizationResponse.fromJson( @@ -571,7 +597,8 @@ public CompletableFuture createAuthoriza Response paymentsForInvoiceRaw(String invoiceId, TransactionPaymentsForInvoiceParams params) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/payments", "invoice-id", invoiceId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "transaction", "paymentsForInvoice", path, params != null ? params.toQueryParams() : null); } /** @@ -579,7 +606,7 @@ Response paymentsForInvoiceRaw(String invoiceId, TransactionPaymentsForInvoicePa */ Response paymentsForInvoiceRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/payments", "invoice-id", invoiceId); - return get(path, null); + return get("transaction", "paymentsForInvoice", path, null); } /** @@ -609,7 +636,11 @@ public TransactionPaymentsForInvoiceResponse paymentsForInvoice(String invoiceId public CompletableFuture paymentsForInvoiceAsync( String invoiceId, TransactionPaymentsForInvoiceParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/payments", "invoice-id", invoiceId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "transaction", + "paymentsForInvoice", + path, + params != null ? params.toQueryParams() : null) .thenApply( response -> TransactionPaymentsForInvoiceResponse.fromJson( @@ -620,7 +651,7 @@ public CompletableFuture paymentsForInvoi public CompletableFuture paymentsForInvoiceAsync( String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/payments", "invoice-id", invoiceId); - return getAsync(path, null) + return getAsync("transaction", "paymentsForInvoice", path, null) .thenApply( response -> TransactionPaymentsForInvoiceResponse.fromJson( @@ -635,7 +666,7 @@ Response deleteOfflineTransactionRaw(String transactionId) throws ChargebeeExcep "transaction-id", transactionId); - return post(path, null); + return post("transaction", "deleteOfflineTransaction", path, null); } /** @@ -649,7 +680,7 @@ Response deleteOfflineTransactionRaw(String transactionId, DeleteOfflineTransact "/transactions/{transaction-id}/delete_offline_transaction", "transaction-id", transactionId); - return post(path, params.toFormData()); + return post("transaction", "deleteOfflineTransaction", path, params.toFormData()); } /** @@ -663,7 +694,7 @@ Response deleteOfflineTransactionRaw(String transactionId, String jsonPayload) "/transactions/{transaction-id}/delete_offline_transaction", "transaction-id", transactionId); - return postJson(path, jsonPayload); + return postJson("transaction", "deleteOfflineTransaction", path, jsonPayload); } public DeleteOfflineTransactionResponse deleteOfflineTransaction( @@ -680,7 +711,7 @@ public CompletableFuture deleteOfflineTransact "/transactions/{transaction-id}/delete_offline_transaction", "transaction-id", transactionId); - return postAsync(path, params.toFormData()) + return postAsync("transaction", "deleteOfflineTransaction", path, params.toFormData()) .thenApply( response -> DeleteOfflineTransactionResponse.fromJson(response.getBodyAsString(), response)); @@ -701,7 +732,7 @@ public CompletableFuture deleteOfflineTransact "transaction-id", transactionId); - return postAsync(path, null) + return postAsync("transaction", "deleteOfflineTransaction", path, null) .thenApply( response -> 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 17eb874a5..e908fd51b 100644 --- a/src/main/java/com/chargebee/v4/services/UnbilledChargeService.java +++ b/src/main/java/com/chargebee/v4/services/UnbilledChargeService.java @@ -78,7 +78,7 @@ Response deleteRaw(String unbilledChargeId) throws ChargebeeException { "unbilled-charge-id", unbilledChargeId); - return post(path, null); + return post("unbilledCharge", "delete", path, null); } public UnbilledChargeDeleteResponse delete(String unbilledChargeId) throws ChargebeeException { @@ -94,7 +94,7 @@ public CompletableFuture deleteAsync(String unbill "unbilled-charge-id", unbilledChargeId); - return postAsync(path, null) + return postAsync("unbilledCharge", "delete", path, null) .thenApply( response -> UnbilledChargeDeleteResponse.fromJson(response.getBodyAsString(), response)); @@ -108,7 +108,10 @@ Response invoiceNowEstimateRaw(UnbilledChargeInvoiceNowEstimateParams params) throws ChargebeeException { return post( - "/unbilled_charges/invoice_now_estimate", params != null ? params.toFormData() : null); + "unbilledCharge", + "invoiceNowEstimate", + "/unbilled_charges/invoice_now_estimate", + params != null ? params.toFormData() : null); } /** @@ -117,7 +120,11 @@ Response invoiceNowEstimateRaw(UnbilledChargeInvoiceNowEstimateParams params) */ Response invoiceNowEstimateRaw(String jsonPayload) throws ChargebeeException { - return postJson("/unbilled_charges/invoice_now_estimate", jsonPayload); + return postJson( + "unbilledCharge", + "invoiceNowEstimate", + "/unbilled_charges/invoice_now_estimate", + jsonPayload); } public UnbilledChargeInvoiceNowEstimateResponse invoiceNowEstimate( @@ -132,7 +139,10 @@ public CompletableFuture invoiceNowEst UnbilledChargeInvoiceNowEstimateParams params) { return postAsync( - "/unbilled_charges/invoice_now_estimate", params != null ? params.toFormData() : null) + "unbilledCharge", + "invoiceNowEstimate", + "/unbilled_charges/invoice_now_estimate", + params != null ? params.toFormData() : null) .thenApply( response -> UnbilledChargeInvoiceNowEstimateResponse.fromJson( @@ -147,7 +157,10 @@ Response invoiceUnbilledChargesRaw(InvoiceUnbilledChargesParams params) throws ChargebeeException { return post( - "/unbilled_charges/invoice_unbilled_charges", params != null ? params.toFormData() : null); + "unbilledCharge", + "invoiceUnbilledCharges", + "/unbilled_charges/invoice_unbilled_charges", + params != null ? params.toFormData() : null); } /** @@ -156,7 +169,11 @@ Response invoiceUnbilledChargesRaw(InvoiceUnbilledChargesParams params) */ Response invoiceUnbilledChargesRaw(String jsonPayload) throws ChargebeeException { - return postJson("/unbilled_charges/invoice_unbilled_charges", jsonPayload); + return postJson( + "unbilledCharge", + "invoiceUnbilledCharges", + "/unbilled_charges/invoice_unbilled_charges", + jsonPayload); } public InvoiceUnbilledChargesResponse invoiceUnbilledCharges(InvoiceUnbilledChargesParams params) @@ -171,6 +188,8 @@ public CompletableFuture invoiceUnbilledChargesA InvoiceUnbilledChargesParams params) { return postAsync( + "unbilledCharge", + "invoiceUnbilledCharges", "/unbilled_charges/invoice_unbilled_charges", params != null ? params.toFormData() : null) .thenApply( @@ -181,13 +200,17 @@ public CompletableFuture invoiceUnbilledChargesA /** list a unbilledCharge using immutable params (executes immediately) - returns raw Response. */ Response listRaw(UnbilledChargeListParams params) throws ChargebeeException { - return get("/unbilled_charges", params != null ? params.toQueryParams() : null); + return get( + "unbilledCharge", + "list", + "/unbilled_charges", + params != null ? params.toQueryParams() : null); } /** list a unbilledCharge without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/unbilled_charges", null); + return get("unbilledCharge", "list", "/unbilled_charges", null); } /** list a unbilledCharge using raw JSON payload (executes immediately) - returns raw Response. */ @@ -206,7 +229,11 @@ public UnbilledChargeListResponse list(UnbilledChargeListParams params) /** Async variant of list for unbilledCharge with params. */ public CompletableFuture listAsync(UnbilledChargeListParams params) { - return getAsync("/unbilled_charges", params != null ? params.toQueryParams() : null) + return getAsync( + "unbilledCharge", + "list", + "/unbilled_charges", + params != null ? params.toQueryParams() : null) .thenApply( response -> UnbilledChargeListResponse.fromJson( @@ -222,7 +249,7 @@ public UnbilledChargeListResponse list() throws ChargebeeException { /** Async variant of list for unbilledCharge without params. */ public CompletableFuture listAsync() { - return getAsync("/unbilled_charges", null) + return getAsync("unbilledCharge", "list", "/unbilled_charges", null) .thenApply( response -> UnbilledChargeListResponse.fromJson( @@ -234,7 +261,11 @@ public CompletableFuture listAsync() { */ Response createRaw(UnbilledChargeCreateParams params) throws ChargebeeException { - return post("/unbilled_charges", params != null ? params.toFormData() : null); + return post( + "unbilledCharge", + "create", + "/unbilled_charges", + params != null ? params.toFormData() : null); } /** @@ -242,7 +273,7 @@ Response createRaw(UnbilledChargeCreateParams params) throws ChargebeeException */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/unbilled_charges", jsonPayload); + return postJson("unbilledCharge", "create", "/unbilled_charges", jsonPayload); } public UnbilledChargeCreateResponse create(UnbilledChargeCreateParams params) @@ -256,7 +287,11 @@ public UnbilledChargeCreateResponse create(UnbilledChargeCreateParams params) public CompletableFuture createAsync( UnbilledChargeCreateParams params) { - return postAsync("/unbilled_charges", params != null ? params.toFormData() : null) + return postAsync( + "unbilledCharge", + "create", + "/unbilled_charges", + params != null ? params.toFormData() : null) .thenApply( response -> UnbilledChargeCreateResponse.fromJson(response.getBodyAsString(), response)); @@ -268,7 +303,11 @@ public CompletableFuture createAsync( */ Response createUnbilledChargeRaw(CreateUnbilledChargeParams params) throws ChargebeeException { - return post("/unbilled_charges/create", params != null ? params.toFormData() : null); + return post( + "unbilledCharge", + "createUnbilledCharge", + "/unbilled_charges/create", + params != null ? params.toFormData() : null); } /** @@ -277,7 +316,8 @@ Response createUnbilledChargeRaw(CreateUnbilledChargeParams params) throws Charg */ Response createUnbilledChargeRaw(String jsonPayload) throws ChargebeeException { - return postJson("/unbilled_charges/create", jsonPayload); + return postJson( + "unbilledCharge", "createUnbilledCharge", "/unbilled_charges/create", jsonPayload); } public CreateUnbilledChargeResponse createUnbilledCharge(CreateUnbilledChargeParams params) @@ -291,7 +331,11 @@ public CreateUnbilledChargeResponse createUnbilledCharge(CreateUnbilledChargePar public CompletableFuture createUnbilledChargeAsync( CreateUnbilledChargeParams params) { - return postAsync("/unbilled_charges/create", params != null ? params.toFormData() : null) + return postAsync( + "unbilledCharge", + "createUnbilledCharge", + "/unbilled_charges/create", + params != null ? params.toFormData() : null) .thenApply( response -> 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 576c5e576..1cf2d8a07 100644 --- a/src/main/java/com/chargebee/v4/services/UnbilledChargesSettingService.java +++ b/src/main/java/com/chargebee/v4/services/UnbilledChargesSettingService.java @@ -59,7 +59,11 @@ public UnbilledChargesSettingService withOptions(RequestOptions options) { */ Response retrieveRaw(UnbilledChargesSettingRetrieveParams params) throws ChargebeeException { - return get("/unbilled_charges_settings", params != null ? params.toQueryParams() : null); + return get( + "unbilledChargesSetting", + "retrieve", + "/unbilled_charges_settings", + params != null ? params.toQueryParams() : null); } /** @@ -67,7 +71,7 @@ Response retrieveRaw(UnbilledChargesSettingRetrieveParams params) throws Chargeb */ Response retrieveRaw() throws ChargebeeException { - return get("/unbilled_charges_settings", null); + return get("unbilledChargesSetting", "retrieve", "/unbilled_charges_settings", null); } /** @@ -90,7 +94,11 @@ public UnbilledChargesSettingRetrieveResponse retrieve( public CompletableFuture retrieveAsync( UnbilledChargesSettingRetrieveParams params) { - return getAsync("/unbilled_charges_settings", params != null ? params.toQueryParams() : null) + return getAsync( + "unbilledChargesSetting", + "retrieve", + "/unbilled_charges_settings", + params != null ? params.toQueryParams() : null) .thenApply( response -> UnbilledChargesSettingRetrieveResponse.fromJson( @@ -106,7 +114,7 @@ public UnbilledChargesSettingRetrieveResponse retrieve() throws ChargebeeExcepti /** Async variant of retrieve for unbilledChargesSetting without params. */ public CompletableFuture retrieveAsync() { - return getAsync("/unbilled_charges_settings", null) + return getAsync("unbilledChargesSetting", "retrieve", "/unbilled_charges_settings", null) .thenApply( response -> UnbilledChargesSettingRetrieveResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/UsageChargeService.java b/src/main/java/com/chargebee/v4/services/UsageChargeService.java index 7df517ee7..e476723d6 100644 --- a/src/main/java/com/chargebee/v4/services/UsageChargeService.java +++ b/src/main/java/com/chargebee/v4/services/UsageChargeService.java @@ -61,7 +61,11 @@ Response retrieveUsageChargesForSubscriptionRaw( String path = buildPathWithParams( "/subscriptions/{subscription-id}/usage_charges", "subscription-id", subscriptionId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "usageCharge", + "retrieveUsageChargesForSubscription", + path, + params != null ? params.toQueryParams() : null); } /** @@ -72,7 +76,7 @@ Response retrieveUsageChargesForSubscriptionRaw(String subscriptionId) throws Ch String path = buildPathWithParams( "/subscriptions/{subscription-id}/usage_charges", "subscription-id", subscriptionId); - return get(path, null); + return get("usageCharge", "retrieveUsageChargesForSubscription", path, null); } /** @@ -109,7 +113,11 @@ public RetrieveUsageChargesForSubscriptionResponse retrieveUsageChargesForSubscr String path = buildPathWithParams( "/subscriptions/{subscription-id}/usage_charges", "subscription-id", subscriptionId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "usageCharge", + "retrieveUsageChargesForSubscription", + path, + params != null ? params.toQueryParams() : null) .thenApply( response -> RetrieveUsageChargesForSubscriptionResponse.fromJson( @@ -122,7 +130,7 @@ public RetrieveUsageChargesForSubscriptionResponse retrieveUsageChargesForSubscr String path = buildPathWithParams( "/subscriptions/{subscription-id}/usage_charges", "subscription-id", subscriptionId); - return getAsync(path, null) + return getAsync("usageCharge", "retrieveUsageChargesForSubscription", path, null) .thenApply( response -> RetrieveUsageChargesForSubscriptionResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/UsageEventService.java b/src/main/java/com/chargebee/v4/services/UsageEventService.java index 11725acad..a1ed02ac4 100644 --- a/src/main/java/com/chargebee/v4/services/UsageEventService.java +++ b/src/main/java/com/chargebee/v4/services/UsageEventService.java @@ -61,6 +61,8 @@ public UsageEventService withOptions(RequestOptions options) { Response createRaw(UsageEventCreateParams params) throws ChargebeeException { return postJsonWithSubDomain( + "usageEvent", + "create", "/usage_events", SubDomain.INGEST.getValue(), params != null ? params.toJsonString() : null); @@ -69,7 +71,8 @@ Response createRaw(UsageEventCreateParams params) throws ChargebeeException { /** create a usageEvent using raw JSON payload (executes immediately) - returns raw Response. */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJsonWithSubDomain("/usage_events", SubDomain.INGEST.getValue(), jsonPayload); + return postJsonWithSubDomain( + "usageEvent", "create", "/usage_events", SubDomain.INGEST.getValue(), jsonPayload); } public UsageEventCreateResponse create(UsageEventCreateParams params) throws ChargebeeException { @@ -82,6 +85,8 @@ public UsageEventCreateResponse create(UsageEventCreateParams params) throws Cha public CompletableFuture createAsync(UsageEventCreateParams params) { return postJsonWithSubDomainAsync( + "usageEvent", + "create", "/usage_events", SubDomain.INGEST.getValue(), params != null ? params.toJsonString() : null) @@ -95,6 +100,8 @@ public CompletableFuture createAsync(UsageEventCreateP Response batchIngestRaw(UsageEventBatchIngestParams params) throws ChargebeeException { return postJsonWithSubDomain( + "usageEvent", + "batchIngest", "/batch/usage_events", SubDomain.INGEST.getValue(), params != null ? params.toJsonString() : null); @@ -105,7 +112,12 @@ Response batchIngestRaw(UsageEventBatchIngestParams params) throws ChargebeeExce */ Response batchIngestRaw(String jsonPayload) throws ChargebeeException { - return postJsonWithSubDomain("/batch/usage_events", SubDomain.INGEST.getValue(), jsonPayload); + return postJsonWithSubDomain( + "usageEvent", + "batchIngest", + "/batch/usage_events", + SubDomain.INGEST.getValue(), + jsonPayload); } public UsageEventBatchIngestResponse batchIngest(UsageEventBatchIngestParams params) @@ -120,6 +132,8 @@ public CompletableFuture batchIngestAsync( UsageEventBatchIngestParams params) { return postJsonWithSubDomainAsync( + "usageEvent", + "batchIngest", "/batch/usage_events", SubDomain.INGEST.getValue(), params != null ? params.toJsonString() : null) diff --git a/src/main/java/com/chargebee/v4/services/UsageFileService.java b/src/main/java/com/chargebee/v4/services/UsageFileService.java index bda60e5c1..897bab9de 100644 --- a/src/main/java/com/chargebee/v4/services/UsageFileService.java +++ b/src/main/java/com/chargebee/v4/services/UsageFileService.java @@ -61,7 +61,8 @@ Response processingStatusRaw(String usageFileId) throws ChargebeeException { buildPathWithParams( "/usage_files/{usage-file-id}/processing_status", "usage-file-id", usageFileId); - return getWithSubDomain(path, SubDomain.FILE_INGEST.getValue(), null); + return getWithSubDomain( + "usageFile", "processingStatus", path, SubDomain.FILE_INGEST.getValue(), null); } public UsageFileProcessingStatusResponse processingStatus(String usageFileId) @@ -77,7 +78,8 @@ public CompletableFuture processingStatusAsyn buildPathWithParams( "/usage_files/{usage-file-id}/processing_status", "usage-file-id", usageFileId); - return getWithSubDomainAsync(path, SubDomain.FILE_INGEST.getValue(), null) + return getWithSubDomainAsync( + "usageFile", "processingStatus", path, SubDomain.FILE_INGEST.getValue(), null) .thenApply( response -> UsageFileProcessingStatusResponse.fromJson(response.getBodyAsString(), response)); @@ -87,6 +89,8 @@ public CompletableFuture processingStatusAsyn Response uploadUrlRaw(UsageFileUploadUrlParams params) throws ChargebeeException { return postWithSubDomain( + "usageFile", + "uploadUrl", "/usage_files/upload_url", SubDomain.FILE_INGEST.getValue(), params != null ? params.toFormData() : null); @@ -96,7 +100,11 @@ Response uploadUrlRaw(UsageFileUploadUrlParams params) throws ChargebeeException Response uploadUrlRaw(String jsonPayload) throws ChargebeeException { return postJsonWithSubDomain( - "/usage_files/upload_url", SubDomain.FILE_INGEST.getValue(), jsonPayload); + "usageFile", + "uploadUrl", + "/usage_files/upload_url", + SubDomain.FILE_INGEST.getValue(), + jsonPayload); } public UsageFileUploadUrlResponse uploadUrl(UsageFileUploadUrlParams params) @@ -111,6 +119,8 @@ public CompletableFuture uploadUrlAsync( UsageFileUploadUrlParams params) { return postWithSubDomainAsync( + "usageFile", + "uploadUrl", "/usage_files/upload_url", SubDomain.FILE_INGEST.getValue(), params != null ? params.toFormData() : null) diff --git a/src/main/java/com/chargebee/v4/services/UsageService.java b/src/main/java/com/chargebee/v4/services/UsageService.java index 43a1271f6..e9ceb7539 100644 --- a/src/main/java/com/chargebee/v4/services/UsageService.java +++ b/src/main/java/com/chargebee/v4/services/UsageService.java @@ -70,13 +70,13 @@ public UsageService withOptions(RequestOptions options) { /** pdf a usage using immutable params (executes immediately) - returns raw Response. */ Response pdfRaw(UsagePdfParams params) throws ChargebeeException { - return post("/usages/pdf", params != null ? params.toFormData() : null); + return post("usage", "pdf", "/usages/pdf", params != null ? params.toFormData() : null); } /** pdf a usage using raw JSON payload (executes immediately) - returns raw Response. */ Response pdfRaw(String jsonPayload) throws ChargebeeException { - return postJson("/usages/pdf", jsonPayload); + return postJson("usage", "pdf", "/usages/pdf", jsonPayload); } public UsagePdfResponse pdf(UsagePdfParams params) throws ChargebeeException { @@ -88,7 +88,7 @@ public UsagePdfResponse pdf(UsagePdfParams params) throws ChargebeeException { /** Async variant of pdf for usage with params. */ public CompletableFuture pdfAsync(UsagePdfParams params) { - return postAsync("/usages/pdf", params != null ? params.toFormData() : null) + return postAsync("usage", "pdf", "/usages/pdf", params != null ? params.toFormData() : null) .thenApply(response -> UsagePdfResponse.fromJson(response.getBodyAsString(), response)); } @@ -98,7 +98,7 @@ Response retrieveRaw(String subscriptionId) throws ChargebeeException { buildPathWithParams( "/subscriptions/{subscription-id}/usages", "subscription-id", subscriptionId); - return get(path, null); + return get("usage", "retrieve", path, null); } /** retrieve a usage using immutable params (executes immediately) - returns raw Response. */ @@ -107,7 +107,7 @@ Response retrieveRaw(String subscriptionId, UsageRetrieveParams params) String path = buildPathWithParams( "/subscriptions/{subscription-id}/usages", "subscription-id", subscriptionId); - return get(path, params != null ? params.toQueryParams() : null); + return get("usage", "retrieve", path, params != null ? params.toQueryParams() : null); } public UsageRetrieveResponse retrieve(String subscriptionId, UsageRetrieveParams params) @@ -122,7 +122,7 @@ public CompletableFuture retrieveAsync( String path = buildPathWithParams( "/subscriptions/{subscription-id}/usages", "subscription-id", subscriptionId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync("usage", "retrieve", path, params != null ? params.toQueryParams() : null) .thenApply( response -> UsageRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -138,7 +138,7 @@ public CompletableFuture retrieveAsync(String subscriptio buildPathWithParams( "/subscriptions/{subscription-id}/usages", "subscription-id", subscriptionId); - return getAsync(path, null) + return getAsync("usage", "retrieve", path, null) .thenApply( response -> UsageRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -149,7 +149,7 @@ Response createRaw(String subscriptionId) throws ChargebeeException { buildPathWithParams( "/subscriptions/{subscription-id}/usages", "subscription-id", subscriptionId); - return post(path, null); + return post("usage", "create", path, null); } /** create a usage using immutable params (executes immediately) - returns raw Response. */ @@ -157,7 +157,7 @@ Response createRaw(String subscriptionId, UsageCreateParams params) throws Charg String path = buildPathWithParams( "/subscriptions/{subscription-id}/usages", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("usage", "create", path, params.toFormData()); } /** create a usage using raw JSON payload (executes immediately) - returns raw Response. */ @@ -165,7 +165,7 @@ Response createRaw(String subscriptionId, String jsonPayload) throws ChargebeeEx String path = buildPathWithParams( "/subscriptions/{subscription-id}/usages", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("usage", "create", path, jsonPayload); } public UsageCreateResponse create(String subscriptionId, UsageCreateParams params) @@ -180,7 +180,7 @@ public CompletableFuture createAsync( String path = buildPathWithParams( "/subscriptions/{subscription-id}/usages", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("usage", "create", path, params.toFormData()) .thenApply(response -> UsageCreateResponse.fromJson(response.getBodyAsString(), response)); } @@ -190,7 +190,7 @@ Response deleteRaw(String subscriptionId) throws ChargebeeException { buildPathWithParams( "/subscriptions/{subscription-id}/delete_usage", "subscription-id", subscriptionId); - return post(path, null); + return post("usage", "delete", path, null); } /** delete a usage using immutable params (executes immediately) - returns raw Response. */ @@ -198,7 +198,7 @@ Response deleteRaw(String subscriptionId, UsageDeleteParams params) throws Charg String path = buildPathWithParams( "/subscriptions/{subscription-id}/delete_usage", "subscription-id", subscriptionId); - return post(path, params.toFormData()); + return post("usage", "delete", path, params.toFormData()); } /** delete a usage using raw JSON payload (executes immediately) - returns raw Response. */ @@ -206,7 +206,7 @@ Response deleteRaw(String subscriptionId, String jsonPayload) throws ChargebeeEx String path = buildPathWithParams( "/subscriptions/{subscription-id}/delete_usage", "subscription-id", subscriptionId); - return postJson(path, jsonPayload); + return postJson("usage", "delete", path, jsonPayload); } public UsageDeleteResponse delete(String subscriptionId, UsageDeleteParams params) @@ -221,20 +221,20 @@ public CompletableFuture deleteAsync( String path = buildPathWithParams( "/subscriptions/{subscription-id}/delete_usage", "subscription-id", subscriptionId); - return postAsync(path, params.toFormData()) + return postAsync("usage", "delete", path, params.toFormData()) .thenApply(response -> UsageDeleteResponse.fromJson(response.getBodyAsString(), response)); } /** list a usage using immutable params (executes immediately) - returns raw Response. */ Response listRaw(UsageListParams params) throws ChargebeeException { - return get("/usages", params != null ? params.toQueryParams() : null); + return get("usage", "list", "/usages", params != null ? params.toQueryParams() : null); } /** list a usage without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/usages", null); + return get("usage", "list", "/usages", null); } /** list a usage using raw JSON payload (executes immediately) - returns raw Response. */ @@ -252,7 +252,7 @@ public UsageListResponse list(UsageListParams params) throws ChargebeeException /** Async variant of list for usage with params. */ public CompletableFuture listAsync(UsageListParams params) { - return getAsync("/usages", params != null ? params.toQueryParams() : null) + return getAsync("usage", "list", "/usages", params != null ? params.toQueryParams() : null) .thenApply( response -> UsageListResponse.fromJson(response.getBodyAsString(), this, params, response)); @@ -267,7 +267,7 @@ public UsageListResponse list() throws ChargebeeException { /** Async variant of list for usage without params. */ public CompletableFuture listAsync() { - return getAsync("/usages", null) + return getAsync("usage", "list", "/usages", null) .thenApply( response -> UsageListResponse.fromJson(response.getBodyAsString(), this, null, response)); diff --git a/src/main/java/com/chargebee/v4/services/UsageSummaryService.java b/src/main/java/com/chargebee/v4/services/UsageSummaryService.java index 79b7efb8b..8af4044a4 100644 --- a/src/main/java/com/chargebee/v4/services/UsageSummaryService.java +++ b/src/main/java/com/chargebee/v4/services/UsageSummaryService.java @@ -62,7 +62,11 @@ Response retrieveUsageSummaryForSubscriptionRaw( String path = buildPathWithParams( "/subscriptions/{subscription-id}/usage_summary", "subscription-id", subscriptionId); - return get(path, params != null ? params.toQueryParams() : null); + return get( + "usageSummary", + "retrieveUsageSummaryForSubscription", + path, + params != null ? params.toQueryParams() : null); } /** @@ -73,7 +77,7 @@ Response retrieveUsageSummaryForSubscriptionRaw(String subscriptionId) throws Ch String path = buildPathWithParams( "/subscriptions/{subscription-id}/usage_summary", "subscription-id", subscriptionId); - return get(path, null); + return get("usageSummary", "retrieveUsageSummaryForSubscription", path, null); } /** @@ -110,7 +114,11 @@ public RetrieveUsageSummaryForSubscriptionResponse retrieveUsageSummaryForSubscr String path = buildPathWithParams( "/subscriptions/{subscription-id}/usage_summary", "subscription-id", subscriptionId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "usageSummary", + "retrieveUsageSummaryForSubscription", + path, + params != null ? params.toQueryParams() : null) .thenApply( response -> RetrieveUsageSummaryForSubscriptionResponse.fromJson( @@ -123,7 +131,7 @@ public RetrieveUsageSummaryForSubscriptionResponse retrieveUsageSummaryForSubscr String path = buildPathWithParams( "/subscriptions/{subscription-id}/usage_summary", "subscription-id", subscriptionId); - return getAsync(path, null) + return getAsync("usageSummary", "retrieveUsageSummaryForSubscription", path, null) .thenApply( response -> RetrieveUsageSummaryForSubscriptionResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/VariantService.java b/src/main/java/com/chargebee/v4/services/VariantService.java index 870ca60dd..b584f3b02 100644 --- a/src/main/java/com/chargebee/v4/services/VariantService.java +++ b/src/main/java/com/chargebee/v4/services/VariantService.java @@ -70,13 +70,14 @@ public VariantService withOptions(RequestOptions options) { 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); + return get( + "variant", "listProductVariants", path, params != null ? params.toQueryParams() : null); } /** 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); + return get("variant", "listProductVariants", path, null); } /** @@ -106,7 +107,8 @@ public ListProductVariantsResponse listProductVariants(String productId) public CompletableFuture listProductVariantsAsync( String productId, ListProductVariantsParams params) { String path = buildPathWithParams("/products/{product-id}/variants", "product-id", productId); - return getAsync(path, params != null ? params.toQueryParams() : null) + return getAsync( + "variant", "listProductVariants", path, params != null ? params.toQueryParams() : null) .thenApply( response -> ListProductVariantsResponse.fromJson( @@ -116,7 +118,7 @@ public CompletableFuture listProductVariantsAsync( /** Async variant of listProductVariants for variant without params. */ public CompletableFuture listProductVariantsAsync(String productId) { String path = buildPathWithParams("/products/{product-id}/variants", "product-id", productId); - return getAsync(path, null) + return getAsync("variant", "listProductVariants", path, null) .thenApply( response -> ListProductVariantsResponse.fromJson( @@ -127,7 +129,7 @@ public CompletableFuture listProductVariantsAsync(S Response createProductVariantRaw(String productId) throws ChargebeeException { String path = buildPathWithParams("/products/{product-id}/variants", "product-id", productId); - return post(path, null); + return post("variant", "createProductVariant", path, null); } /** @@ -137,7 +139,7 @@ Response createProductVariantRaw(String productId) throws ChargebeeException { Response createProductVariantRaw(String productId, CreateProductVariantParams params) throws ChargebeeException { String path = buildPathWithParams("/products/{product-id}/variants", "product-id", productId); - return post(path, params.toFormData()); + return post("variant", "createProductVariant", path, params.toFormData()); } /** @@ -146,7 +148,7 @@ Response createProductVariantRaw(String productId, CreateProductVariantParams pa */ Response createProductVariantRaw(String productId, String jsonPayload) throws ChargebeeException { String path = buildPathWithParams("/products/{product-id}/variants", "product-id", productId); - return postJson(path, jsonPayload); + return postJson("variant", "createProductVariant", path, jsonPayload); } public CreateProductVariantResponse createProductVariant( @@ -159,7 +161,7 @@ public CreateProductVariantResponse createProductVariant( public CompletableFuture createProductVariantAsync( String productId, CreateProductVariantParams params) { String path = buildPathWithParams("/products/{product-id}/variants", "product-id", productId); - return postAsync(path, params.toFormData()) + return postAsync("variant", "createProductVariant", path, params.toFormData()) .thenApply( response -> CreateProductVariantResponse.fromJson(response.getBodyAsString(), response)); @@ -171,7 +173,7 @@ Response retrieveRaw(String productVariantId) throws ChargebeeException { buildPathWithParams( "/variants/{product-variant-id}", "product-variant-id", productVariantId); - return get(path, null); + return get("variant", "retrieve", path, null); } public VariantRetrieveResponse retrieve(String productVariantId) throws ChargebeeException { @@ -185,7 +187,7 @@ public CompletableFuture retrieveAsync(String productVa buildPathWithParams( "/variants/{product-variant-id}", "product-variant-id", productVariantId); - return getAsync(path, null) + return getAsync("variant", "retrieve", path, null) .thenApply( response -> VariantRetrieveResponse.fromJson(response.getBodyAsString(), response)); } @@ -196,7 +198,7 @@ Response updateRaw(String productVariantId) throws ChargebeeException { buildPathWithParams( "/variants/{product-variant-id}", "product-variant-id", productVariantId); - return post(path, null); + return post("variant", "update", path, null); } /** update a variant using immutable params (executes immediately) - returns raw Response. */ @@ -205,7 +207,7 @@ Response updateRaw(String productVariantId, VariantUpdateParams params) String path = buildPathWithParams( "/variants/{product-variant-id}", "product-variant-id", productVariantId); - return post(path, params.toFormData()); + return post("variant", "update", path, params.toFormData()); } /** update a variant using raw JSON payload (executes immediately) - returns raw Response. */ @@ -213,7 +215,7 @@ Response updateRaw(String productVariantId, String jsonPayload) throws Chargebee String path = buildPathWithParams( "/variants/{product-variant-id}", "product-variant-id", productVariantId); - return postJson(path, jsonPayload); + return postJson("variant", "update", path, jsonPayload); } public VariantUpdateResponse update(String productVariantId, VariantUpdateParams params) @@ -228,7 +230,7 @@ public CompletableFuture updateAsync( String path = buildPathWithParams( "/variants/{product-variant-id}", "product-variant-id", productVariantId); - return postAsync(path, params.toFormData()) + return postAsync("variant", "update", path, params.toFormData()) .thenApply( response -> VariantUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -244,7 +246,7 @@ public CompletableFuture updateAsync(String productVarian buildPathWithParams( "/variants/{product-variant-id}", "product-variant-id", productVariantId); - return postAsync(path, null) + return postAsync("variant", "update", path, null) .thenApply( response -> VariantUpdateResponse.fromJson(response.getBodyAsString(), response)); } @@ -255,7 +257,7 @@ Response deleteRaw(String productVariantId) throws ChargebeeException { buildPathWithParams( "/variants/{product-variant-id}/delete", "product-variant-id", productVariantId); - return post(path, null); + return post("variant", "delete", path, null); } public VariantDeleteResponse delete(String productVariantId) throws ChargebeeException { @@ -269,7 +271,7 @@ public CompletableFuture deleteAsync(String productVarian buildPathWithParams( "/variants/{product-variant-id}/delete", "product-variant-id", productVariantId); - return postAsync(path, null) + return postAsync("variant", "delete", path, null) .thenApply( response -> 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 4998e4998..576dabd7e 100644 --- a/src/main/java/com/chargebee/v4/services/VirtualBankAccountService.java +++ b/src/main/java/com/chargebee/v4/services/VirtualBankAccountService.java @@ -76,7 +76,7 @@ Response deleteLocalRaw(String virtualBankAccountId) throws ChargebeeException { "virtual-bank-account-id", virtualBankAccountId); - return post(path, null); + return post("virtualBankAccount", "deleteLocal", path, null); } public VirtualBankAccountDeleteLocalResponse deleteLocal(String virtualBankAccountId) @@ -94,7 +94,7 @@ public CompletableFuture deleteLocalAsync "virtual-bank-account-id", virtualBankAccountId); - return postAsync(path, null) + return postAsync("virtualBankAccount", "deleteLocal", path, null) .thenApply( response -> VirtualBankAccountDeleteLocalResponse.fromJson( @@ -109,7 +109,7 @@ Response deleteRaw(String virtualBankAccountId) throws ChargebeeException { "virtual-bank-account-id", virtualBankAccountId); - return post(path, null); + return post("virtualBankAccount", "delete", path, null); } public VirtualBankAccountDeleteResponse delete(String virtualBankAccountId) @@ -127,7 +127,7 @@ public CompletableFuture deleteAsync( "virtual-bank-account-id", virtualBankAccountId); - return postAsync(path, null) + return postAsync("virtualBankAccount", "delete", path, null) .thenApply( response -> VirtualBankAccountDeleteResponse.fromJson(response.getBodyAsString(), response)); @@ -138,13 +138,17 @@ public CompletableFuture deleteAsync( */ Response listRaw(VirtualBankAccountListParams params) throws ChargebeeException { - return get("/virtual_bank_accounts", params != null ? params.toQueryParams() : null); + return get( + "virtualBankAccount", + "list", + "/virtual_bank_accounts", + params != null ? params.toQueryParams() : null); } /** list a virtualBankAccount without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/virtual_bank_accounts", null); + return get("virtualBankAccount", "list", "/virtual_bank_accounts", null); } /** @@ -167,7 +171,11 @@ public VirtualBankAccountListResponse list(VirtualBankAccountListParams params) public CompletableFuture listAsync( VirtualBankAccountListParams params) { - return getAsync("/virtual_bank_accounts", params != null ? params.toQueryParams() : null) + return getAsync( + "virtualBankAccount", + "list", + "/virtual_bank_accounts", + params != null ? params.toQueryParams() : null) .thenApply( response -> VirtualBankAccountListResponse.fromJson( @@ -184,7 +192,7 @@ public VirtualBankAccountListResponse list() throws ChargebeeException { /** Async variant of list for virtualBankAccount without params. */ public CompletableFuture listAsync() { - return getAsync("/virtual_bank_accounts", null) + return getAsync("virtualBankAccount", "list", "/virtual_bank_accounts", null) .thenApply( response -> VirtualBankAccountListResponse.fromJson( @@ -197,7 +205,11 @@ public CompletableFuture listAsync() { */ Response createRaw(VirtualBankAccountCreateParams params) throws ChargebeeException { - return post("/virtual_bank_accounts", params != null ? params.toFormData() : null); + return post( + "virtualBankAccount", + "create", + "/virtual_bank_accounts", + params != null ? params.toFormData() : null); } /** @@ -206,7 +218,7 @@ Response createRaw(VirtualBankAccountCreateParams params) throws ChargebeeExcept */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/virtual_bank_accounts", jsonPayload); + return postJson("virtualBankAccount", "create", "/virtual_bank_accounts", jsonPayload); } public VirtualBankAccountCreateResponse create(VirtualBankAccountCreateParams params) @@ -220,7 +232,11 @@ public VirtualBankAccountCreateResponse create(VirtualBankAccountCreateParams pa public CompletableFuture createAsync( VirtualBankAccountCreateParams params) { - return postAsync("/virtual_bank_accounts", params != null ? params.toFormData() : null) + return postAsync( + "virtualBankAccount", + "create", + "/virtual_bank_accounts", + params != null ? params.toFormData() : null) .thenApply( response -> VirtualBankAccountCreateResponse.fromJson(response.getBodyAsString(), response)); @@ -234,7 +250,7 @@ Response syncFundRaw(String virtualBankAccountId) throws ChargebeeException { "virtual-bank-account-id", virtualBankAccountId); - return post(path, null); + return post("virtualBankAccount", "syncFund", path, null); } public VirtualBankAccountSyncFundResponse syncFund(String virtualBankAccountId) @@ -252,7 +268,7 @@ public CompletableFuture syncFundAsync( "virtual-bank-account-id", virtualBankAccountId); - return postAsync(path, null) + return postAsync("virtualBankAccount", "syncFund", path, null) .thenApply( response -> VirtualBankAccountSyncFundResponse.fromJson(response.getBodyAsString(), response)); @@ -266,7 +282,7 @@ Response retrieveRaw(String virtualBankAccountId) throws ChargebeeException { "virtual-bank-account-id", virtualBankAccountId); - return get(path, null); + return get("virtualBankAccount", "retrieve", path, null); } public VirtualBankAccountRetrieveResponse retrieve(String virtualBankAccountId) @@ -284,7 +300,7 @@ public CompletableFuture retrieveAsync( "virtual-bank-account-id", virtualBankAccountId); - return getAsync(path, null) + return getAsync("virtualBankAccount", "retrieve", path, null) .thenApply( response -> VirtualBankAccountRetrieveResponse.fromJson(response.getBodyAsString(), response)); @@ -298,6 +314,8 @@ Response createUsingPermanentTokenRaw(VirtualBankAccountCreateUsingPermanentToke throws ChargebeeException { return post( + "virtualBankAccount", + "createUsingPermanentToken", "/virtual_bank_accounts/create_using_permanent_token", params != null ? params.toFormData() : null); } @@ -308,7 +326,11 @@ Response createUsingPermanentTokenRaw(VirtualBankAccountCreateUsingPermanentToke */ Response createUsingPermanentTokenRaw(String jsonPayload) throws ChargebeeException { - return postJson("/virtual_bank_accounts/create_using_permanent_token", jsonPayload); + return postJson( + "virtualBankAccount", + "createUsingPermanentToken", + "/virtual_bank_accounts/create_using_permanent_token", + jsonPayload); } public VirtualBankAccountCreateUsingPermanentTokenResponse createUsingPermanentToken( @@ -324,6 +346,8 @@ public VirtualBankAccountCreateUsingPermanentTokenResponse createUsingPermanentT createUsingPermanentTokenAsync(VirtualBankAccountCreateUsingPermanentTokenParams params) { return postAsync( + "virtualBankAccount", + "createUsingPermanentToken", "/virtual_bank_accounts/create_using_permanent_token", params != null ? params.toFormData() : null) .thenApply( diff --git a/src/main/java/com/chargebee/v4/services/WebhookEndpointService.java b/src/main/java/com/chargebee/v4/services/WebhookEndpointService.java index c4a5a5995..f35a915b4 100644 --- a/src/main/java/com/chargebee/v4/services/WebhookEndpointService.java +++ b/src/main/java/com/chargebee/v4/services/WebhookEndpointService.java @@ -72,7 +72,7 @@ Response deleteRaw(String webhookEndpointId) throws ChargebeeException { "webhook-endpoint-id", webhookEndpointId); - return post(path, null); + return post("webhookEndpoint", "delete", path, null); } public WebhookEndpointDeleteResponse delete(String webhookEndpointId) throws ChargebeeException { @@ -88,7 +88,7 @@ public CompletableFuture deleteAsync(String webho "webhook-endpoint-id", webhookEndpointId); - return postAsync(path, null) + return postAsync("webhookEndpoint", "delete", path, null) .thenApply( response -> WebhookEndpointDeleteResponse.fromJson(response.getBodyAsString(), response)); @@ -100,7 +100,7 @@ Response retrieveRaw(String webhookEndpointId) throws ChargebeeException { buildPathWithParams( "/webhook_endpoints/{webhook-endpoint-id}", "webhook-endpoint-id", webhookEndpointId); - return get(path, null); + return get("webhookEndpoint", "retrieve", path, null); } public WebhookEndpointRetrieveResponse retrieve(String webhookEndpointId) @@ -116,7 +116,7 @@ public CompletableFuture retrieveAsync( buildPathWithParams( "/webhook_endpoints/{webhook-endpoint-id}", "webhook-endpoint-id", webhookEndpointId); - return getAsync(path, null) + return getAsync("webhookEndpoint", "retrieve", path, null) .thenApply( response -> WebhookEndpointRetrieveResponse.fromJson(response.getBodyAsString(), response)); @@ -128,7 +128,7 @@ Response updateRaw(String webhookEndpointId) throws ChargebeeException { buildPathWithParams( "/webhook_endpoints/{webhook-endpoint-id}", "webhook-endpoint-id", webhookEndpointId); - return post(path, null); + return post("webhookEndpoint", "update", path, null); } /** @@ -139,7 +139,7 @@ Response updateRaw(String webhookEndpointId, WebhookEndpointUpdateParams params) String path = buildPathWithParams( "/webhook_endpoints/{webhook-endpoint-id}", "webhook-endpoint-id", webhookEndpointId); - return post(path, params.toFormData()); + return post("webhookEndpoint", "update", path, params.toFormData()); } /** @@ -149,7 +149,7 @@ Response updateRaw(String webhookEndpointId, String jsonPayload) throws Chargebe String path = buildPathWithParams( "/webhook_endpoints/{webhook-endpoint-id}", "webhook-endpoint-id", webhookEndpointId); - return postJson(path, jsonPayload); + return postJson("webhookEndpoint", "update", path, jsonPayload); } public WebhookEndpointUpdateResponse update( @@ -164,7 +164,7 @@ public CompletableFuture updateAsync( String path = buildPathWithParams( "/webhook_endpoints/{webhook-endpoint-id}", "webhook-endpoint-id", webhookEndpointId); - return postAsync(path, params.toFormData()) + return postAsync("webhookEndpoint", "update", path, params.toFormData()) .thenApply( response -> WebhookEndpointUpdateResponse.fromJson(response.getBodyAsString(), response)); @@ -181,7 +181,7 @@ public CompletableFuture updateAsync(String webho buildPathWithParams( "/webhook_endpoints/{webhook-endpoint-id}", "webhook-endpoint-id", webhookEndpointId); - return postAsync(path, null) + return postAsync("webhookEndpoint", "update", path, null) .thenApply( response -> WebhookEndpointUpdateResponse.fromJson(response.getBodyAsString(), response)); @@ -192,13 +192,17 @@ public CompletableFuture updateAsync(String webho */ Response listRaw(WebhookEndpointListParams params) throws ChargebeeException { - return get("/webhook_endpoints", params != null ? params.toQueryParams() : null); + return get( + "webhookEndpoint", + "list", + "/webhook_endpoints", + params != null ? params.toQueryParams() : null); } /** list a webhookEndpoint without params (executes immediately) - returns raw Response. */ Response listRaw() throws ChargebeeException { - return get("/webhook_endpoints", null); + return get("webhookEndpoint", "list", "/webhook_endpoints", null); } /** @@ -220,7 +224,11 @@ public WebhookEndpointListResponse list(WebhookEndpointListParams params) public CompletableFuture listAsync( WebhookEndpointListParams params) { - return getAsync("/webhook_endpoints", params != null ? params.toQueryParams() : null) + return getAsync( + "webhookEndpoint", + "list", + "/webhook_endpoints", + params != null ? params.toQueryParams() : null) .thenApply( response -> WebhookEndpointListResponse.fromJson( @@ -236,7 +244,7 @@ public WebhookEndpointListResponse list() throws ChargebeeException { /** Async variant of list for webhookEndpoint without params. */ public CompletableFuture listAsync() { - return getAsync("/webhook_endpoints", null) + return getAsync("webhookEndpoint", "list", "/webhook_endpoints", null) .thenApply( response -> WebhookEndpointListResponse.fromJson( @@ -248,7 +256,11 @@ public CompletableFuture listAsync() { */ Response createRaw(WebhookEndpointCreateParams params) throws ChargebeeException { - return post("/webhook_endpoints", params != null ? params.toFormData() : null); + return post( + "webhookEndpoint", + "create", + "/webhook_endpoints", + params != null ? params.toFormData() : null); } /** @@ -256,7 +268,7 @@ Response createRaw(WebhookEndpointCreateParams params) throws ChargebeeException */ Response createRaw(String jsonPayload) throws ChargebeeException { - return postJson("/webhook_endpoints", jsonPayload); + return postJson("webhookEndpoint", "create", "/webhook_endpoints", jsonPayload); } public WebhookEndpointCreateResponse create(WebhookEndpointCreateParams params) @@ -270,7 +282,11 @@ public WebhookEndpointCreateResponse create(WebhookEndpointCreateParams params) public CompletableFuture createAsync( WebhookEndpointCreateParams params) { - return postAsync("/webhook_endpoints", params != null ? params.toFormData() : null) + return postAsync( + "webhookEndpoint", + "create", + "/webhook_endpoints", + params != null ? params.toFormData() : null) .thenApply( response -> WebhookEndpointCreateResponse.fromJson(response.getBodyAsString(), response)); From 436bbf3ad94c8e0b8fae88218f82e09c1bc8c598 Mon Sep 17 00:00:00 2001 From: cb-karthikp Date: Tue, 30 Jun 2026 14:32:06 +0530 Subject: [PATCH 3/7] Regenerate Java v4 SDK services from latest spec --- .../chargebee/v4/services/GiftService.java | 13 ++++ .../v4/services/GrantBlockService.java | 16 +++-- .../services/LedgerAccountBalanceService.java | 18 +++-- .../v4/services/LedgerOperationService.java | 72 ++++++++++++++----- .../v4/services/PromotionalGrantService.java | 14 +++- 5 files changed, 106 insertions(+), 27 deletions(-) diff --git a/src/main/java/com/chargebee/v4/services/GiftService.java b/src/main/java/com/chargebee/v4/services/GiftService.java index 28f691b5b..a11db3e2e 100644 --- a/src/main/java/com/chargebee/v4/services/GiftService.java +++ b/src/main/java/com/chargebee/v4/services/GiftService.java @@ -158,6 +158,19 @@ public CompletableFuture updateGiftAsync( .thenApply(response -> UpdateGiftResponse.fromJson(response.getBodyAsString(), response)); } + public UpdateGiftResponse updateGift(String giftId) throws ChargebeeException { + Response response = updateGiftRaw(giftId); + return UpdateGiftResponse.fromJson(response.getBodyAsString(), response); + } + + /** Async variant of updateGift for gift without params. */ + public CompletableFuture updateGiftAsync(String giftId) { + String path = buildPathWithParams("/gifts/{gift-id}/update_gift", "gift-id", giftId); + + return postAsync("gift", "updateGift", path, null) + .thenApply(response -> UpdateGiftResponse.fromJson(response.getBodyAsString(), response)); + } + /** list a gift using immutable params (executes immediately) - returns raw Response. */ Response listRaw(GiftListParams params) throws ChargebeeException { diff --git a/src/main/java/com/chargebee/v4/services/GrantBlockService.java b/src/main/java/com/chargebee/v4/services/GrantBlockService.java index 20870d596..1675057e7 100644 --- a/src/main/java/com/chargebee/v4/services/GrantBlockService.java +++ b/src/main/java/com/chargebee/v4/services/GrantBlockService.java @@ -57,13 +57,17 @@ public GrantBlockService withOptions(RequestOptions options) { */ Response listGrantBlocksRaw(ListGrantBlocksParams params) throws ChargebeeException { - return get("/grant_blocks", params != null ? params.toQueryParams() : null); + return get( + "grantBlock", + "listGrantBlocks", + "/grant_blocks", + params != null ? params.toQueryParams() : null); } /** listGrantBlocks a grantBlock without params (executes immediately) - returns raw Response. */ Response listGrantBlocksRaw() throws ChargebeeException { - return get("/grant_blocks", null); + return get("grantBlock", "listGrantBlocks", "/grant_blocks", null); } /** @@ -86,7 +90,11 @@ public ListGrantBlocksResponse listGrantBlocks(ListGrantBlocksParams params) public CompletableFuture listGrantBlocksAsync( ListGrantBlocksParams params) { - return getAsync("/grant_blocks", params != null ? params.toQueryParams() : null) + return getAsync( + "grantBlock", + "listGrantBlocks", + "/grant_blocks", + params != null ? params.toQueryParams() : null) .thenApply( response -> ListGrantBlocksResponse.fromJson( @@ -102,7 +110,7 @@ public ListGrantBlocksResponse listGrantBlocks() throws ChargebeeException { /** Async variant of listGrantBlocks for grantBlock without params. */ public CompletableFuture listGrantBlocksAsync() { - return getAsync("/grant_blocks", null) + return getAsync("grantBlock", "listGrantBlocks", "/grant_blocks", null) .thenApply( response -> ListGrantBlocksResponse.fromJson(response.getBodyAsString(), this, null, response)); diff --git a/src/main/java/com/chargebee/v4/services/LedgerAccountBalanceService.java b/src/main/java/com/chargebee/v4/services/LedgerAccountBalanceService.java index e1a895c7e..97c59e511 100644 --- a/src/main/java/com/chargebee/v4/services/LedgerAccountBalanceService.java +++ b/src/main/java/com/chargebee/v4/services/LedgerAccountBalanceService.java @@ -59,7 +59,11 @@ public LedgerAccountBalanceService withOptions(RequestOptions options) { Response listLedgerAccountBalancesRaw(ListLedgerAccountBalancesParams params) throws ChargebeeException { - return get("/ledger_account_balances", params != null ? params.toQueryParams() : null); + return get( + "ledgerAccountBalance", + "listLedgerAccountBalances", + "/ledger_account_balances", + params != null ? params.toQueryParams() : null); } /** @@ -68,7 +72,8 @@ Response listLedgerAccountBalancesRaw(ListLedgerAccountBalancesParams params) */ Response listLedgerAccountBalancesRaw() throws ChargebeeException { - return get("/ledger_account_balances", null); + return get( + "ledgerAccountBalance", "listLedgerAccountBalances", "/ledger_account_balances", null); } /** @@ -92,7 +97,11 @@ public ListLedgerAccountBalancesResponse listLedgerAccountBalances( public CompletableFuture listLedgerAccountBalancesAsync( ListLedgerAccountBalancesParams params) { - return getAsync("/ledger_account_balances", params != null ? params.toQueryParams() : null) + return getAsync( + "ledgerAccountBalance", + "listLedgerAccountBalances", + "/ledger_account_balances", + params != null ? params.toQueryParams() : null) .thenApply( response -> ListLedgerAccountBalancesResponse.fromJson( @@ -109,7 +118,8 @@ public ListLedgerAccountBalancesResponse listLedgerAccountBalances() throws Char /** Async variant of listLedgerAccountBalances for ledgerAccountBalance without params. */ public CompletableFuture listLedgerAccountBalancesAsync() { - return getAsync("/ledger_account_balances", null) + return getAsync( + "ledgerAccountBalance", "listLedgerAccountBalances", "/ledger_account_balances", null) .thenApply( response -> ListLedgerAccountBalancesResponse.fromJson( diff --git a/src/main/java/com/chargebee/v4/services/LedgerOperationService.java b/src/main/java/com/chargebee/v4/services/LedgerOperationService.java index 32afe9ebd..9ab63bbb3 100644 --- a/src/main/java/com/chargebee/v4/services/LedgerOperationService.java +++ b/src/main/java/com/chargebee/v4/services/LedgerOperationService.java @@ -78,7 +78,10 @@ Response releaseAuthorizationRaw(LedgerOperationReleaseAuthorizationParams param throws ChargebeeException { return postJson( - "/ledger_operations/release_authorization", params != null ? params.toJsonString() : null); + "ledgerOperation", + "releaseAuthorization", + "/ledger_operations/release_authorization", + params != null ? params.toJsonString() : null); } /** @@ -87,7 +90,11 @@ Response releaseAuthorizationRaw(LedgerOperationReleaseAuthorizationParams param */ Response releaseAuthorizationRaw(String jsonPayload) throws ChargebeeException { - return postJson("/ledger_operations/release_authorization", jsonPayload); + return postJson( + "ledgerOperation", + "releaseAuthorization", + "/ledger_operations/release_authorization", + jsonPayload); } public LedgerOperationReleaseAuthorizationResponse releaseAuthorization( @@ -103,6 +110,8 @@ public CompletableFuture releaseAut LedgerOperationReleaseAuthorizationParams params) { return postJsonAsync( + "ledgerOperation", + "releaseAuthorization", "/ledger_operations/release_authorization", params != null ? params.toJsonString() : null) .thenApply( @@ -116,7 +125,11 @@ public CompletableFuture releaseAut */ Response captureRaw(LedgerOperationCaptureParams params) throws ChargebeeException { - return postJson("/ledger_operations/capture", params != null ? params.toJsonString() : null); + return postJson( + "ledgerOperation", + "capture", + "/ledger_operations/capture", + params != null ? params.toJsonString() : null); } /** @@ -124,7 +137,7 @@ Response captureRaw(LedgerOperationCaptureParams params) throws ChargebeeExcepti */ Response captureRaw(String jsonPayload) throws ChargebeeException { - return postJson("/ledger_operations/capture", jsonPayload); + return postJson("ledgerOperation", "capture", "/ledger_operations/capture", jsonPayload); } public LedgerOperationCaptureResponse capture(LedgerOperationCaptureParams params) @@ -139,7 +152,10 @@ public CompletableFuture captureAsync( LedgerOperationCaptureParams params) { return postJsonAsync( - "/ledger_operations/capture", params != null ? params.toJsonString() : null) + "ledgerOperation", + "capture", + "/ledger_operations/capture", + params != null ? params.toJsonString() : null) .thenApply( response -> LedgerOperationCaptureResponse.fromJson(response.getBodyAsString(), response)); @@ -151,7 +167,11 @@ public CompletableFuture captureAsync( */ Response authorizeRaw(LedgerOperationAuthorizeParams params) throws ChargebeeException { - return postJson("/ledger_operations/authorize", params != null ? params.toJsonString() : null); + return postJson( + "ledgerOperation", + "authorize", + "/ledger_operations/authorize", + params != null ? params.toJsonString() : null); } /** @@ -160,7 +180,7 @@ Response authorizeRaw(LedgerOperationAuthorizeParams params) throws ChargebeeExc */ Response authorizeRaw(String jsonPayload) throws ChargebeeException { - return postJson("/ledger_operations/authorize", jsonPayload); + return postJson("ledgerOperation", "authorize", "/ledger_operations/authorize", jsonPayload); } public LedgerOperationAuthorizeResponse authorize(LedgerOperationAuthorizeParams params) @@ -175,7 +195,10 @@ public CompletableFuture authorizeAsync( LedgerOperationAuthorizeParams params) { return postJsonAsync( - "/ledger_operations/authorize", params != null ? params.toJsonString() : null) + "ledgerOperation", + "authorize", + "/ledger_operations/authorize", + params != null ? params.toJsonString() : null) .thenApply( response -> LedgerOperationAuthorizeResponse.fromJson(response.getBodyAsString(), response)); @@ -187,7 +210,11 @@ public CompletableFuture authorizeAsync( */ Response listLedgerOperationsRaw(ListLedgerOperationsParams params) throws ChargebeeException { - return get("/ledger_operations", params != null ? params.toQueryParams() : null); + return get( + "ledgerOperation", + "listLedgerOperations", + "/ledger_operations", + params != null ? params.toQueryParams() : null); } /** @@ -196,7 +223,7 @@ Response listLedgerOperationsRaw(ListLedgerOperationsParams params) throws Charg */ Response listLedgerOperationsRaw() throws ChargebeeException { - return get("/ledger_operations", null); + return get("ledgerOperation", "listLedgerOperations", "/ledger_operations", null); } /** @@ -220,7 +247,11 @@ public ListLedgerOperationsResponse listLedgerOperations(ListLedgerOperationsPar public CompletableFuture listLedgerOperationsAsync( ListLedgerOperationsParams params) { - return getAsync("/ledger_operations", params != null ? params.toQueryParams() : null) + return getAsync( + "ledgerOperation", + "listLedgerOperations", + "/ledger_operations", + params != null ? params.toQueryParams() : null) .thenApply( response -> ListLedgerOperationsResponse.fromJson( @@ -236,7 +267,7 @@ public ListLedgerOperationsResponse listLedgerOperations() throws ChargebeeExcep /** Async variant of listLedgerOperations for ledgerOperation without params. */ public CompletableFuture listLedgerOperationsAsync() { - return getAsync("/ledger_operations", null) + return getAsync("ledgerOperation", "listLedgerOperations", "/ledger_operations", null) .thenApply( response -> ListLedgerOperationsResponse.fromJson( @@ -251,7 +282,10 @@ Response captureAuthorizationRaw(LedgerOperationCaptureAuthorizationParams param throws ChargebeeException { return postJson( - "/ledger_operations/capture_authorization", params != null ? params.toJsonString() : null); + "ledgerOperation", + "captureAuthorization", + "/ledger_operations/capture_authorization", + params != null ? params.toJsonString() : null); } /** @@ -260,7 +294,11 @@ Response captureAuthorizationRaw(LedgerOperationCaptureAuthorizationParams param */ Response captureAuthorizationRaw(String jsonPayload) throws ChargebeeException { - return postJson("/ledger_operations/capture_authorization", jsonPayload); + return postJson( + "ledgerOperation", + "captureAuthorization", + "/ledger_operations/capture_authorization", + jsonPayload); } public LedgerOperationCaptureAuthorizationResponse captureAuthorization( @@ -276,6 +314,8 @@ public CompletableFuture captureAut LedgerOperationCaptureAuthorizationParams params) { return postJsonAsync( + "ledgerOperation", + "captureAuthorization", "/ledger_operations/capture_authorization", params != null ? params.toJsonString() : null) .thenApply( @@ -290,7 +330,7 @@ Response retrieveLedgerOperationRaw(String ledgerOperationId) throws ChargebeeEx buildPathWithParams( "/ledger_operations/{ledger-operation-id}", "ledger-operation-id", ledgerOperationId); - return get(path, null); + return get("ledgerOperation", "retrieveLedgerOperation", path, null); } public RetrieveLedgerOperationResponse retrieveLedgerOperation(String ledgerOperationId) @@ -306,7 +346,7 @@ public CompletableFuture retrieveLedgerOperatio buildPathWithParams( "/ledger_operations/{ledger-operation-id}", "ledger-operation-id", ledgerOperationId); - return getAsync(path, null) + return getAsync("ledgerOperation", "retrieveLedgerOperation", path, null) .thenApply( response -> RetrieveLedgerOperationResponse.fromJson(response.getBodyAsString(), response)); diff --git a/src/main/java/com/chargebee/v4/services/PromotionalGrantService.java b/src/main/java/com/chargebee/v4/services/PromotionalGrantService.java index 2f50224e1..343665766 100644 --- a/src/main/java/com/chargebee/v4/services/PromotionalGrantService.java +++ b/src/main/java/com/chargebee/v4/services/PromotionalGrantService.java @@ -58,7 +58,11 @@ public PromotionalGrantService withOptions(RequestOptions options) { */ Response promotionalGrantsRaw(PromotionalGrantsParams params) throws ChargebeeException { - return postJson("/promotional_grants", params != null ? params.toJsonString() : null); + return postJson( + "promotionalGrant", + "promotionalGrants", + "/promotional_grants", + params != null ? params.toJsonString() : null); } /** @@ -67,7 +71,7 @@ Response promotionalGrantsRaw(PromotionalGrantsParams params) throws ChargebeeEx */ Response promotionalGrantsRaw(String jsonPayload) throws ChargebeeException { - return postJson("/promotional_grants", jsonPayload); + return postJson("promotionalGrant", "promotionalGrants", "/promotional_grants", jsonPayload); } public PromotionalGrantsResponse promotionalGrants(PromotionalGrantsParams params) @@ -81,7 +85,11 @@ public PromotionalGrantsResponse promotionalGrants(PromotionalGrantsParams param public CompletableFuture promotionalGrantsAsync( PromotionalGrantsParams params) { - return postJsonAsync("/promotional_grants", params != null ? params.toJsonString() : null) + return postJsonAsync( + "promotionalGrant", + "promotionalGrants", + "/promotional_grants", + params != null ? params.toJsonString() : null) .thenApply( response -> PromotionalGrantsResponse.fromJson(response.getBodyAsString(), response)); } From 5d9cf795678b280519f458193a7792471a0bc883 Mon Sep 17 00:00:00 2001 From: cb-karthikp Date: Tue, 30 Jun 2026 14:39:50 +0530 Subject: [PATCH 4/7] Document telemetry feature in changelog and bump version to 4.12.0 --- CHANGELOG.md | 11 +++++++++++ VERSION | 2 +- build.gradle.kts | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1502792ea..d495f7a47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +### v4.12.0 (2026-06-30) +* * * + +### New Features +* Added an optional `telemetryAdapter` hook for tracing Chargebee API calls via OpenTelemetry (or any APM). Configure it once on the client (`ChargebeeClient.Builder#telemetryAdapter`) or per call (`RequestOptions.Builder#telemetryAdapter`). When unconfigured, the SDK skips all telemetry work — no behavior change for existing integrations. +* Each API call emits one CLIENT span (`chargebee.{resource}.{operation}`) with OpenTelemetry HTTP semantic-convention attributes (`url.full`, `http.request.method`, `server.address`, `http.response.status_code`) plus `chargebee.*` attributes. Adapters may inject W3C trace context (`traceparent`, `tracestate`) into outbound request headers for distributed tracing. +* Exposed the `TelemetryAdapter`, `RequestTelemetryContext`, `RequestTelemetryResult`, `RequestTelemetryError` types, the `TelemetrySupport` helpers, and the `TelemetryAttributeKeys` constants under `com.chargebee.v4.telemetry`. +* Added a convenience `updateGift(String giftId)` overload (and its `updateGiftAsync` async variant) to `GiftService` for invoking `update_gift` without params. + + + ### v4.11.0 (2026-06-29) * * * ### Bug Fixes: diff --git a/VERSION b/VERSION index a162ea75a..815588ef1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.11.0 +4.12.0 diff --git a/build.gradle.kts b/build.gradle.kts index 7406918ef..a6ce87d63 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,7 +7,7 @@ plugins { } group = "com.chargebee" -version = "4.11.0" +version = "4.12.0" description = "Java client library for ChargeBee" // Project metadata From 87f5d313b11e970f52b4f3a91dd6a6969a324bc5 Mon Sep 17 00:00:00 2001 From: cb-karthikp Date: Tue, 30 Jun 2026 16:18:23 +0530 Subject: [PATCH 5/7] Add telemetry-aware request helpers to BaseService --- .../chargebee/v4/services/BaseService.java | 180 ++++++++++++++++++ 1 file changed, 180 insertions(+) diff --git a/src/main/java/com/chargebee/v4/services/BaseService.java b/src/main/java/com/chargebee/v4/services/BaseService.java index 6e6f0e736..b3a03aa97 100644 --- a/src/main/java/com/chargebee/v4/services/BaseService.java +++ b/src/main/java/com/chargebee/v4/services/BaseService.java @@ -284,6 +284,186 @@ protected CompletableFuture getAsync(String path, Map return client.executeWithInterceptorAsync(builder.build()); } + // === Telemetry-aware request helpers === + // These overloads carry the resource/operation names so the configured + // TelemetryAdapter can name spans (chargebee.{resource}.{operation}) and + // record attributes. They mirror the plain helpers above. + + /** + * Stamp telemetry metadata (resource/operation and any per-request adapter override) + * onto the outbound request so {@code TelemetryExecutor} can emit a span. + */ + private void applyTelemetry(Request.Builder builder, String resource, String operation) { + builder.telemetryResource(resource).telemetryOperation(operation); + if (options != null && options.getTelemetryAdapter() != null) { + builder.telemetryAdapterOverride(options.getTelemetryAdapter()); + } + } + + /** + * GET with Object query parameters (telemetry-aware). + */ + protected Response get(String resource, String operation, String path, Map queryParams) throws ChargebeeException { + String fullUrl = UrlBuilder.buildUrl(client.getBaseUrl(), path, queryParams); + Request.Builder builder = Request.builder() + .method("GET") + .url(fullUrl); + applyMergedHeaders(builder); + applyTelemetry(builder, resource, operation); + return client.executeWithInterceptor(builder.build()); + } + + /** + * GET with subdomain routing (telemetry-aware). + */ + protected Response getWithSubDomain(String resource, String operation, String path, String subDomain, Map queryParams) throws ChargebeeException { + String fullUrl = UrlBuilder.buildUrl(baseUrlWithSubDomain(subDomain), path, queryParams); + Request.Builder builder = Request.builder() + .method("GET") + .url(fullUrl); + applyMergedHeaders(builder); + applyTelemetry(builder, resource, operation); + return client.executeWithInterceptor(builder.build()); + } + + /** + * GET async with Object query parameters (telemetry-aware). + */ + protected CompletableFuture getAsync(String resource, String operation, String path, Map queryParams) { + String fullUrl = UrlBuilder.buildUrl(client.getBaseUrl(), path, queryParams); + Request.Builder builder = Request.builder() + .method("GET") + .url(fullUrl); + applyMergedHeaders(builder); + applyTelemetry(builder, resource, operation); + return client.executeWithInterceptorAsync(builder.build()); + } + + /** + * GET async with subdomain routing (telemetry-aware). + */ + protected CompletableFuture getWithSubDomainAsync(String resource, String operation, String path, String subDomain, Map queryParams) { + String fullUrl = UrlBuilder.buildUrl(baseUrlWithSubDomain(subDomain), path, queryParams); + Request.Builder builder = Request.builder() + .method("GET") + .url(fullUrl); + applyMergedHeaders(builder); + applyTelemetry(builder, resource, operation); + return client.executeWithInterceptorAsync(builder.build()); + } + + /** + * POST with optional headers (telemetry-aware). + */ + protected Response post(String resource, String operation, String path, Map formData) throws ChargebeeException { + String fullUrl = UrlBuilder.buildUrl(client.getBaseUrl(), path, null); + Request.Builder builder = Request.builder() + .method("POST") + .url(fullUrl) + .formBody(formData); + applyMergedHeaders(builder); + applyTelemetry(builder, resource, operation); + return client.executeWithInterceptor(builder.build()); + } + + /** + * POST with subdomain routing (telemetry-aware). + */ + protected Response postWithSubDomain(String resource, String operation, String path, String subDomain, Map formData) throws ChargebeeException { + String fullUrl = UrlBuilder.buildUrl(baseUrlWithSubDomain(subDomain), path, null); + Request.Builder builder = Request.builder() + .method("POST") + .url(fullUrl) + .formBody(formData); + applyMergedHeaders(builder); + applyTelemetry(builder, resource, operation); + return client.executeWithInterceptor(builder.build()); + } + + /** + * POST async with optional headers (telemetry-aware). + */ + protected CompletableFuture postAsync(String resource, String operation, String path, Map formData) { + String fullUrl = UrlBuilder.buildUrl(client.getBaseUrl(), path, null); + Request.Builder builder = Request.builder() + .method("POST") + .url(fullUrl) + .formBody(formData); + applyMergedHeaders(builder); + applyTelemetry(builder, resource, operation); + return client.executeWithInterceptorAsync(builder.build()); + } + + /** + * POST async with subdomain routing (telemetry-aware). + */ + protected CompletableFuture postWithSubDomainAsync(String resource, String operation, String path, String subDomain, Map formData) { + String fullUrl = UrlBuilder.buildUrl(baseUrlWithSubDomain(subDomain), path, null); + Request.Builder builder = Request.builder() + .method("POST") + .url(fullUrl) + .formBody(formData); + applyMergedHeaders(builder); + applyTelemetry(builder, resource, operation); + return client.executeWithInterceptorAsync(builder.build()); + } + + /** + * POST JSON with optional headers (telemetry-aware). + */ + protected Response postJson(String resource, String operation, String path, String jsonData) throws ChargebeeException { + String fullUrl = UrlBuilder.buildUrl(client.getBaseUrl(), path, null); + Request.Builder builder = Request.builder() + .method("POST") + .url(fullUrl) + .jsonBody(jsonData); + applyMergedHeaders(builder); + applyTelemetry(builder, resource, operation); + return client.executeWithInterceptor(builder.build()); + } + + /** + * POST JSON with subdomain routing (telemetry-aware). + */ + protected Response postJsonWithSubDomain(String resource, String operation, String path, String subDomain, String jsonData) throws ChargebeeException { + String fullUrl = UrlBuilder.buildUrl(baseUrlWithSubDomain(subDomain), path, null); + Request.Builder builder = Request.builder() + .method("POST") + .url(fullUrl) + .jsonBody(jsonData); + applyMergedHeaders(builder); + applyTelemetry(builder, resource, operation); + return client.executeWithInterceptor(builder.build()); + } + + /** + * POST JSON async with optional headers (telemetry-aware). + */ + protected CompletableFuture postJsonAsync(String resource, String operation, String path, String jsonData) { + String fullUrl = UrlBuilder.buildUrl(client.getBaseUrl(), path, null); + Request.Builder builder = Request.builder() + .method("POST") + .url(fullUrl) + .jsonBody(jsonData); + applyMergedHeaders(builder); + applyTelemetry(builder, resource, operation); + return client.executeWithInterceptorAsync(builder.build()); + } + + /** + * POST JSON async with subdomain routing (telemetry-aware). + */ + protected CompletableFuture postJsonWithSubDomainAsync(String resource, String operation, String path, String subDomain, String jsonData) { + String fullUrl = UrlBuilder.buildUrl(baseUrlWithSubDomain(subDomain), path, null); + Request.Builder builder = Request.builder() + .method("POST") + .url(fullUrl) + .jsonBody(jsonData); + applyMergedHeaders(builder); + applyTelemetry(builder, resource, operation); + return client.executeWithInterceptorAsync(builder.build()); + } + private void applyMergedHeaders(Request.Builder builder) { RequestContext operation = new RequestContext(options.getHeaders()); Map merged = client.getClientHeaders().merge(operation).getHeaders(); From f69935a7dfdd1fe0e7d2cc51cd3c6e5284870f0a Mon Sep 17 00:00:00 2001 From: cb-karthikp Date: Tue, 30 Jun 2026 16:40:24 +0530 Subject: [PATCH 6/7] Add test for per-request telemetry adapter via withOptions Verifies that a TelemetryAdapter set per call through RequestOptions/withOptions fires for that request, and that telemetry is skipped when no adapter is configured on the call or client. Co-authored-by: Cursor --- .../services/ServiceTelemetryOptionsTest.java | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 src/test/java/com/chargebee/v4/services/ServiceTelemetryOptionsTest.java diff --git a/src/test/java/com/chargebee/v4/services/ServiceTelemetryOptionsTest.java b/src/test/java/com/chargebee/v4/services/ServiceTelemetryOptionsTest.java new file mode 100644 index 000000000..2a5bc85fa --- /dev/null +++ b/src/test/java/com/chargebee/v4/services/ServiceTelemetryOptionsTest.java @@ -0,0 +1,108 @@ +package com.chargebee.v4.services; + +import static org.junit.jupiter.api.Assertions.*; + +import com.chargebee.v4.client.ChargebeeClient; +import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; +import com.chargebee.v4.internal.RetryConfig; +import com.chargebee.v4.telemetry.RequestTelemetryContext; +import com.chargebee.v4.telemetry.RequestTelemetryResult; +import com.chargebee.v4.telemetry.TelemetryAdapter; +import com.chargebee.v4.transport.Request; +import com.chargebee.v4.transport.Response; +import com.chargebee.v4.transport.Transport; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +@DisplayName("Per-request telemetry adapter via RequestOptions/withOptions") +class ServiceTelemetryOptionsTest { + + /** Minimal concrete service mirroring the generated services' withOptions override. */ + private static final class TestService extends BaseService { + TestService(ChargebeeClient client) { + super(client); + } + + private TestService(ChargebeeClient client, RequestOptions options) { + super(client, options); + } + + @Override + TestService with(RequestOptions newOptions) { + return new TestService(client, newOptions); + } + + public TestService withOptions(RequestOptions options) { + return with(options); + } + + Response ping() throws ChargebeeException { + return get("customer", "list", "/customers", null); + } + } + + private static final class RecordingTransport implements Transport { + @Override + public Response send(Request request) { + return new Response(200, new HashMap<>(), "{}".getBytes()); + } + + @Override + public CompletableFuture sendAsync(Request request) { + return CompletableFuture.completedFuture(send(request)); + } + } + + private static ChargebeeClient clientWithoutAdapter() { + return ChargebeeClient.builder("key_test", "acme") + .transport(new RecordingTransport()) + .retry(RetryConfig.builder().enabled(false).build()) + .build(); + } + + private static final class RecordingAdapter implements TelemetryAdapter { + final List events = new ArrayList<>(); + RequestTelemetryContext context; + + @Override + public Object onRequestStart(RequestTelemetryContext ctx, Map requestHeaders) { + events.add("start"); + context = ctx; + return "span"; + } + + @Override + public void onRequestEnd(Object handle, RequestTelemetryResult result) { + events.add("end"); + } + } + + @Test + @DisplayName("adapter set per-request via withOptions(RequestOptions) fires for the call") + void perRequestAdapterViaWithOptions() throws Exception { + RecordingAdapter adapter = new RecordingAdapter(); + TestService service = new TestService(clientWithoutAdapter()); + + service.withOptions(RequestOptions.builder().telemetryAdapter(adapter).build()).ping(); + + assertEquals(List.of("start", "end"), adapter.events); + assertEquals("chargebee.customer.list", adapter.context.getSpanName()); + } + + @Test + @DisplayName("no per-request adapter and no client adapter => telemetry skipped") + void noAdapterSkips() throws Exception { + RecordingAdapter adapter = new RecordingAdapter(); + TestService service = new TestService(clientWithoutAdapter()); + + service.ping(); + + assertTrue(adapter.events.isEmpty()); + } +} From c3b9fe29fea8563bb063249834ad52778c09fb13 Mon Sep 17 00:00:00 2001 From: cb-karthikp Date: Wed, 1 Jul 2026 14:37:14 +0530 Subject: [PATCH 7/7] Fix Java telemetry error.type and request-header span attributes. --- .../v4/telemetry/TelemetryAttributeKeys.java | 4 + .../v4/telemetry/TelemetryExecutor.java | 3 +- .../v4/telemetry/TelemetrySupport.java | 66 +++++++++- .../v4/telemetry/TelemetryExecutorTest.java | 124 ++++++++++++++++++ .../v4/telemetry/TelemetrySupportTest.java | 64 +++++++++ 5 files changed, 255 insertions(+), 6 deletions(-) create mode 100644 src/test/java/com/chargebee/v4/telemetry/TelemetrySupportTest.java diff --git a/src/main/java/com/chargebee/v4/telemetry/TelemetryAttributeKeys.java b/src/main/java/com/chargebee/v4/telemetry/TelemetryAttributeKeys.java index 8d2e1539f..4a4a15f7a 100644 --- a/src/main/java/com/chargebee/v4/telemetry/TelemetryAttributeKeys.java +++ b/src/main/java/com/chargebee/v4/telemetry/TelemetryAttributeKeys.java @@ -22,6 +22,10 @@ public final class TelemetryAttributeKeys { /** Standard span name prefix: chargebee.{resource}.{operation} */ public static final String TELEMETRY_SPAN_NAME_PREFIX = "chargebee"; + public static final String HTTP_REQUEST_HEADER_ATTRIBUTE_PREFIX = "http.request.header."; + public static final String CHARGEBEE_TELEMETRY_HEADER_PREFIX = "chargebee-"; + public static final String CHARGEBEE_TELEMETRY_HEADER_EXCLUDE_PREFIX = "chargebee-request-origin-"; + public static final String URL_FULL = "url.full"; public static final String HTTP_REQUEST_METHOD = "http.request.method"; public static final String HTTP_RESPONSE_STATUS_CODE = "http.response.status_code"; diff --git a/src/main/java/com/chargebee/v4/telemetry/TelemetryExecutor.java b/src/main/java/com/chargebee/v4/telemetry/TelemetryExecutor.java index 1e146cfbb..3567ee603 100644 --- a/src/main/java/com/chargebee/v4/telemetry/TelemetryExecutor.java +++ b/src/main/java/com/chargebee/v4/telemetry/TelemetryExecutor.java @@ -143,7 +143,8 @@ static RequestTelemetryContext buildContext(ChargebeeClient client, Request requ uri.getHost(), client.getSiteName(), TelemetrySupport.resolveChargebeeApiVersion(apiPath), - client.getSdkVersion())); + client.getSdkVersion(), + request.getHeaders())); } private static String extractApiPath(String baseUrl) { diff --git a/src/main/java/com/chargebee/v4/telemetry/TelemetrySupport.java b/src/main/java/com/chargebee/v4/telemetry/TelemetrySupport.java index 13809fb5b..dd7130545 100644 --- a/src/main/java/com/chargebee/v4/telemetry/TelemetrySupport.java +++ b/src/main/java/com/chargebee/v4/telemetry/TelemetrySupport.java @@ -10,6 +10,7 @@ import com.chargebee.v4.exceptions.APIException; import com.chargebee.v4.exceptions.HttpException; import java.util.HashMap; +import java.util.Locale; import java.util.Map; /** Helpers for building standardized Chargebee telemetry context and results. */ @@ -29,6 +30,7 @@ public static final class BuildRequestTelemetryContextInput { private final String chargebeeSite; private final String chargebeeApiVersion; private final String sdkVersion; + private final Map requestHeaders; public BuildRequestTelemetryContextInput( String resource, @@ -39,6 +41,28 @@ public BuildRequestTelemetryContextInput( String chargebeeSite, String chargebeeApiVersion, String sdkVersion) { + this( + resource, + operation, + httpMethod, + httpUrl, + serverAddress, + chargebeeSite, + chargebeeApiVersion, + sdkVersion, + null); + } + + public BuildRequestTelemetryContextInput( + String resource, + String operation, + String httpMethod, + String httpUrl, + String serverAddress, + String chargebeeSite, + String chargebeeApiVersion, + String sdkVersion, + Map requestHeaders) { this.resource = resource; this.operation = operation; this.httpMethod = httpMethod; @@ -47,6 +71,7 @@ public BuildRequestTelemetryContextInput( this.chargebeeSite = chargebeeSite; this.chargebeeApiVersion = chargebeeApiVersion; this.sdkVersion = sdkVersion; + this.requestHeaders = requestHeaders; } public String getResource() { @@ -80,6 +105,10 @@ public String getChargebeeApiVersion() { public String getSdkVersion() { return sdkVersion; } + + public Map getRequestHeaders() { + return requestHeaders; + } } /** Input for {@link #buildRequestTelemetryResult(RequestTelemetryResultInput)}. */ @@ -128,6 +157,33 @@ public static Map buildRequestStartSpanAttributes( attributes.put(TelemetryAttributeKeys.CHARGEBEE_OPERATION, input.getOperation()); attributes.put(TelemetryAttributeKeys.CHARGEBEE_SDK_NAME, TelemetryAttributeKeys.SDK_NAME); attributes.put(TelemetryAttributeKeys.CHARGEBEE_SDK_VERSION, input.getSdkVersion()); + attributes.putAll(buildRequestHeaderSpanAttributes(input.getRequestHeaders())); + return attributes; + } + + public static Map buildRequestHeaderSpanAttributes( + Map requestHeaders) { + Map attributes = new HashMap<>(); + if (requestHeaders == null) { + return attributes; + } + + for (Map.Entry entry : requestHeaders.entrySet()) { + String name = entry.getKey(); + String value = entry.getValue(); + if (name == null || value == null) { + continue; + } + String lowerName = name.toLowerCase(Locale.ROOT); + if (!lowerName.startsWith(TelemetryAttributeKeys.CHARGEBEE_TELEMETRY_HEADER_PREFIX) + || lowerName.startsWith( + TelemetryAttributeKeys.CHARGEBEE_TELEMETRY_HEADER_EXCLUDE_PREFIX)) { + continue; + } + attributes.put( + TelemetryAttributeKeys.HTTP_REQUEST_HEADER_ATTRIBUTE_PREFIX + lowerName, value); + } + return attributes; } @@ -138,15 +194,15 @@ public static Map buildRequestEndSpanAttributes( RequestTelemetryError error = result.getError(); if (error != null) { - attributes.put(TelemetryAttributeKeys.ERROR_TYPE, String.valueOf(result.getHttpStatusCode())); - - if (error.getChargebeeErrorCode() != null) { - attributes.put(TelemetryAttributeKeys.CHARGEBEE_ERROR_CODE, error.getChargebeeErrorCode()); - } if (error.getChargebeeApiErrorType() != null) { + attributes.put(TelemetryAttributeKeys.ERROR_TYPE, error.getChargebeeApiErrorType()); attributes.put( TelemetryAttributeKeys.CHARGEBEE_ERROR_TYPE, error.getChargebeeApiErrorType()); } + + if (error.getChargebeeErrorCode() != null) { + attributes.put(TelemetryAttributeKeys.CHARGEBEE_ERROR_CODE, error.getChargebeeErrorCode()); + } if (error.getChargebeeErrorParam() != null) { attributes.put( TelemetryAttributeKeys.CHARGEBEE_ERROR_PARAM, error.getChargebeeErrorParam()); diff --git a/src/test/java/com/chargebee/v4/telemetry/TelemetryExecutorTest.java b/src/test/java/com/chargebee/v4/telemetry/TelemetryExecutorTest.java index bd5ed3aec..20914b0df 100644 --- a/src/test/java/com/chargebee/v4/telemetry/TelemetryExecutorTest.java +++ b/src/test/java/com/chargebee/v4/telemetry/TelemetryExecutorTest.java @@ -3,7 +3,9 @@ import static org.junit.jupiter.api.Assertions.*; import com.chargebee.v4.client.ChargebeeClient; +import com.chargebee.v4.exceptions.APIException; import com.chargebee.v4.exceptions.NetworkException; +import com.chargebee.v4.exceptions.codes.NotFoundApiErrorCode; import com.chargebee.v4.internal.RetryConfig; import com.chargebee.v4.transport.Request; import com.chargebee.v4.transport.Response; @@ -135,6 +137,128 @@ public CompletableFuture sendAsync(Request request) { assertEquals("00-test-trace", allRequests.get(1).getHeaders().get("traceparent")); } + @Test + @DisplayName("Should capture chargebee-* request headers and exclude the PII origin family") + void shouldCaptureChargebeeRequestHeaders() { + RequestTelemetryContext[] capturedContext = new RequestTelemetryContext[1]; + + TelemetryAdapter adapter = + new TelemetryAdapter() { + @Override + public Object onRequestStart( + RequestTelemetryContext context, Map requestHeaders) { + capturedContext[0] = context; + return "span-1"; + } + + @Override + public void onRequestEnd(Object handle, RequestTelemetryResult result) {} + }; + + ChargebeeClient client = + ChargebeeClient.builder("key_test", "acme") + .transport(new RecordingTransport()) + .retry(RetryConfig.builder().enabled(false).build()) + .telemetryAdapter(adapter) + .build(); + + Request request = + Request.builder() + .method("GET") + .url("https://acme.chargebee.com/api/v2/customers") + .telemetryResource("customer") + .telemetryOperation("list") + .header("chargebee-business-entity-id", "be_123") + .header("Chargebee-Idempotency-Key", "idem-key-1") + .header("Authorization", "Basic super-secret") + .header("X-Custom", "nope") + .header("chargebee-request-origin-ip", "202.170.207.70") + .header("chargebee-request-origin-user", "amara@acme.com") + .build(); + + client.sendWithRetry(request); + + Map attrs = capturedContext[0].getStartAttributes(); + assertEquals("be_123", attrs.get("http.request.header.chargebee-business-entity-id")); + assertEquals("idem-key-1", attrs.get("http.request.header.chargebee-idempotency-key")); + assertNull(attrs.get("http.request.header.authorization")); + assertNull(attrs.get("http.request.header.x-custom")); + assertNull(attrs.get("http.request.header.chargebee-request-origin-ip")); + assertNull(attrs.get("http.request.header.chargebee-request-origin-user")); + assertFalse(attrs.toString().contains("202.170.207.70")); + assertFalse(attrs.toString().contains("amara@acme.com")); + } + + @Test + @DisplayName("Should record Chargebee error.type on API failures") + void shouldRecordChargebeeErrorTypeOnFailure() { + RequestTelemetryResult[] capturedResult = new RequestTelemetryResult[1]; + + TelemetryAdapter adapter = + new TelemetryAdapter() { + @Override + public Object onRequestStart( + RequestTelemetryContext context, Map requestHeaders) { + return "span-1"; + } + + @Override + public void onRequestEnd(Object handle, RequestTelemetryResult result) { + capturedResult[0] = result; + } + }; + + Request request = + Request.builder() + .method("GET") + .url("https://acme.chargebee.com/api/v2/customers/cust_1") + .telemetryResource("customer") + .telemetryOperation("retrieve") + .build(); + + ChargebeeClient client = + ChargebeeClient.builder("key_test", "acme") + .transport( + new Transport() { + @Override + public Response send(Request transportRequest) { + throw new APIException( + 404, + "invalid_request", + NotFoundApiErrorCode.RESOURCE_NOT_FOUND, + "Not found", + "{}", + transportRequest, + new Response(404, new HashMap<>(), "{}".getBytes())); + } + + @Override + public CompletableFuture sendAsync(Request transportRequest) { + CompletableFuture failed = new CompletableFuture<>(); + failed.completeExceptionally( + new APIException( + 404, + "invalid_request", + NotFoundApiErrorCode.RESOURCE_NOT_FOUND, + "Not found", + "{}", + transportRequest, + new Response(404, new HashMap<>(), "{}".getBytes()))); + return failed; + } + }) + .retry(RetryConfig.builder().enabled(false).build()) + .telemetryAdapter(adapter) + .build(); + + assertThrows(APIException.class, () -> client.sendWithRetry(request)); + + Map endAttributes = capturedResult[0].getEndAttributes(); + assertEquals("invalid_request", endAttributes.get(TelemetryAttributeKeys.ERROR_TYPE)); + assertEquals("invalid_request", endAttributes.get(TelemetryAttributeKeys.CHARGEBEE_ERROR_TYPE)); + assertEquals(404, capturedResult[0].getHttpStatusCode()); + } + @Test @DisplayName("Should not fail API call when adapter hooks throw") void shouldNotFailWhenAdapterThrows() { diff --git a/src/test/java/com/chargebee/v4/telemetry/TelemetrySupportTest.java b/src/test/java/com/chargebee/v4/telemetry/TelemetrySupportTest.java new file mode 100644 index 000000000..ec983cd2b --- /dev/null +++ b/src/test/java/com/chargebee/v4/telemetry/TelemetrySupportTest.java @@ -0,0 +1,64 @@ +package com.chargebee.v4.telemetry; + +import static org.junit.jupiter.api.Assertions.*; + +import com.chargebee.v4.exceptions.APIException; +import com.chargebee.v4.exceptions.codes.NotFoundApiErrorCode; +import com.chargebee.v4.transport.Request; +import com.chargebee.v4.transport.Response; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +@DisplayName("TelemetrySupport") +class TelemetrySupportTest { + + @Test + @DisplayName("Should promote chargebee-* headers and exclude the PII origin family") + void shouldBuildRequestHeaderSpanAttributes() { + Map headers = new HashMap<>(); + headers.put("chargebee-foo", "bar"); + headers.put("Chargebee-Idempotency-Key", "idem-key-1"); + headers.put("Authorization", "Basic secret"); + headers.put("chargebee-request-origin-ip", "202.170.207.70"); + + Map attributes = + TelemetrySupport.buildRequestHeaderSpanAttributes(headers); + + assertEquals("bar", attributes.get("http.request.header.chargebee-foo")); + assertEquals("idem-key-1", attributes.get("http.request.header.chargebee-idempotency-key")); + assertFalse(attributes.containsKey("http.request.header.authorization")); + assertFalse(attributes.containsKey("http.request.header.chargebee-request-origin-ip")); + } + + @Test + @DisplayName("Should set error.type from Chargebee API error type, not HTTP status") + void shouldSetErrorTypeFromChargebeeApiErrorType() { + Request request = + Request.builder() + .method("GET") + .url("https://acme.chargebee.com/api/v2/customers/cust_1") + .build(); + Response response = new Response(404, new HashMap<>(), "{}".getBytes()); + APIException apiException = + new APIException( + 404, + "invalid_request", + NotFoundApiErrorCode.RESOURCE_NOT_FOUND, + "Not found", + "{}", + request, + response); + + RequestTelemetryError error = TelemetrySupport.extractRequestTelemetryError(apiException); + Map attributes = + TelemetrySupport.buildRequestEndSpanAttributes( + new TelemetrySupport.RequestTelemetryResultInput(404, 10L, error)); + + assertEquals("invalid_request", attributes.get(TelemetryAttributeKeys.ERROR_TYPE)); + assertEquals("invalid_request", attributes.get(TelemetryAttributeKeys.CHARGEBEE_ERROR_TYPE)); + assertEquals("resource_not_found", attributes.get(TelemetryAttributeKeys.CHARGEBEE_ERROR_CODE)); + assertFalse(attributes.containsValue("404")); + } +}