From 4d304336cb31dd2259a6d4f0450f8c81a268cd84 Mon Sep 17 00:00:00 2001 From: cb-karthikp Date: Wed, 18 Feb 2026 16:05:41 +0530 Subject: [PATCH 1/6] Enable async api support --- README.md | 8 +- .../AdditionalBillingLogiqService.java | 20 + .../chargebee/v4/services/AddonService.java | 66 ++ .../chargebee/v4/services/AddressService.java | 15 + .../v4/services/AttachedItemService.java | 70 ++ .../chargebee/v4/services/BaseService.java | 38 + .../services/BrandConfigurationService.java | 18 + .../v4/services/BusinessEntityService.java | 30 + .../v4/services/BusinessProfileService.java | 18 + .../chargebee/v4/services/CardService.java | 49 ++ .../chargebee/v4/services/CommentService.java | 40 + .../v4/services/ConfigurationService.java | 15 + .../v4/services/CouponCodeService.java | 44 ++ .../chargebee/v4/services/CouponService.java | 95 +++ .../v4/services/CouponSetService.java | 97 +++ .../v4/services/CreditNoteService.java | 236 ++++++ .../v4/services/CsvTaxRuleService.java | 8 + .../v4/services/CurrencyService.java | 64 ++ .../services/CustomerEntitlementService.java | 26 + .../v4/services/CustomerService.java | 425 +++++++++++ .../v4/services/DifferentialPriceService.java | 84 +++ .../services/EntitlementOverrideService.java | 60 ++ .../v4/services/EntitlementService.java | 25 + .../v4/services/EstimateService.java | 356 +++++++++ .../chargebee/v4/services/EventService.java | 25 + .../chargebee/v4/services/ExportService.java | 137 ++++ .../chargebee/v4/services/FeatureService.java | 83 ++ .../v4/services/FullExportService.java | 8 + .../chargebee/v4/services/GiftService.java | 59 ++ .../v4/services/HostedPageService.java | 223 ++++++ .../v4/services/InAppSubscriptionService.java | 73 ++ .../chargebee/v4/services/InvoiceService.java | 623 +++++++++++++++ .../v4/services/ItemEntitlementService.java | 63 ++ .../v4/services/ItemFamilyService.java | 62 ++ .../v4/services/ItemPriceService.java | 105 +++ .../chargebee/v4/services/ItemService.java | 50 ++ .../chargebee/v4/services/MediaService.java | 10 + .../v4/services/NonSubscriptionService.java | 15 + .../v4/services/OfferEventService.java | 10 + .../v4/services/OfferFulfillmentService.java | 40 + .../OmnichannelOneTimeOrderService.java | 35 + .../OmnichannelSubscriptionItemService.java | 41 + .../OmnichannelSubscriptionService.java | 78 ++ .../chargebee/v4/services/OrderService.java | 146 ++++ .../v4/services/PaymentIntentService.java | 40 + .../PaymentScheduleSchemeService.java | 39 + .../v4/services/PaymentSourceService.java | 246 ++++++ .../v4/services/PaymentVoucherService.java | 65 ++ .../Pc2MigrationItemFamilyService.java | 89 +++ .../Pc2MigrationItemPriceService.java | 76 ++ .../v4/services/Pc2MigrationItemService.java | 103 +++ .../v4/services/Pc2MigrationService.java | 45 ++ .../v4/services/PersonalizedOfferService.java | 12 + .../chargebee/v4/services/PlanService.java | 64 ++ .../v4/services/PortalSessionService.java | 41 + .../v4/services/PriceVariantService.java | 68 ++ .../services/PricingPageSessionService.java | 26 + .../chargebee/v4/services/ProductService.java | 76 ++ .../v4/services/PromotionalCreditService.java | 59 ++ .../v4/services/PurchaseService.java | 15 + .../chargebee/v4/services/QuoteService.java | 349 +++++++++ .../chargebee/v4/services/RampService.java | 48 ++ .../v4/services/RecordedPurchaseService.java | 24 + .../v4/services/ResourceMigrationService.java | 12 + .../chargebee/v4/services/RuleService.java | 8 + .../services/SiteMigrationDetailService.java | 20 + .../SubscriptionEntitlementService.java | 45 ++ .../v4/services/SubscriptionService.java | 710 ++++++++++++++++++ .../services/SubscriptionSettingService.java | 19 + .../ThirdPartyConfigurationService.java | 33 + .../ThirdPartyEntityMappingService.java | 54 ++ .../services/ThirdPartySyncDetailService.java | 60 ++ .../v4/services/TimeMachineService.java | 65 ++ .../v4/services/TpSiteUserService.java | 59 ++ .../v4/services/TransactionService.java | 202 +++++ .../v4/services/UnbilledChargeService.java | 72 ++ .../UnbilledChargesSettingService.java | 20 + .../v4/services/UsageEventService.java | 23 + .../v4/services/UsageFileService.java | 24 + .../chargebee/v4/services/UsageService.java | 61 ++ .../chargebee/v4/services/VariantService.java | 69 ++ .../services/VirtualBankAccountService.java | 98 +++ .../v4/services/WebhookEndpointService.java | 76 ++ 83 files changed, 7004 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8da1f945..5448023d 100644 --- a/README.md +++ b/README.md @@ -519,17 +519,17 @@ try { ```java import java.util.concurrent.CompletableFuture; -CompletableFuture futureCustomer = customers.create(params); +CompletableFuture futureCustomer = customers.createAsync(params); futureCustomer - .thenAccept(customer -> { - System.out.println("Customer created: " + customer.getCustomer().getId()); + .thenAccept(response -> { + System.out.println("Customer created: " + response.getCustomer().getId()); }) .exceptionally(throwable -> { if (throwable.getCause() instanceof InvalidRequestException) { InvalidRequestException e = (InvalidRequestException) throwable.getCause(); ApiErrorCode errorCode = e.getApiErrorCode(); - + if (errorCode instanceof BadRequestApiErrorCode) { BadRequestApiErrorCode code = (BadRequestApiErrorCode) errorCode; if (code == BadRequestApiErrorCode.DUPLICATE_ENTRY) { diff --git a/src/main/java/com/chargebee/v4/services/AdditionalBillingLogiqService.java b/src/main/java/com/chargebee/v4/services/AdditionalBillingLogiqService.java index 3902c083..719e92bd 100644 --- a/src/main/java/com/chargebee/v4/services/AdditionalBillingLogiqService.java +++ b/src/main/java/com/chargebee/v4/services/AdditionalBillingLogiqService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.additionalBillingLogiq.params.AdditionalBillingLogiqRetrieveParams; @@ -85,9 +86,28 @@ public AdditionalBillingLogiqRetrieveResponse retrieve( return AdditionalBillingLogiqRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync( + AdditionalBillingLogiqRetrieveParams params) { + + return getAsync("/additional_billing_logiqs", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + AdditionalBillingLogiqRetrieveResponse.fromJson( + response.getBodyAsString(), response)); + } + public AdditionalBillingLogiqRetrieveResponse retrieve() throws ChargebeeException { Response response = retrieveRaw(); return AdditionalBillingLogiqRetrieveResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture retrieveAsync() { + + return getAsync("/additional_billing_logiqs", null) + .thenApply( + response -> + AdditionalBillingLogiqRetrieveResponse.fromJson( + response.getBodyAsString(), response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/AddonService.java b/src/main/java/com/chargebee/v4/services/AddonService.java index cb8a1dab..e5282ae6 100644 --- a/src/main/java/com/chargebee/v4/services/AddonService.java +++ b/src/main/java/com/chargebee/v4/services/AddonService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.addon.params.AddonCopyParams; @@ -86,6 +87,12 @@ public AddonCopyResponse copy(AddonCopyParams params) throws ChargebeeException return AddonCopyResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture copyAsync(AddonCopyParams params) { + + return postAsync("/addons/copy", params != null ? params.toFormData() : null) + .thenApply(response -> AddonCopyResponse.fromJson(response.getBodyAsString(), response)); + } + /** unarchive a addon (executes immediately) - returns raw Response. */ Response unarchiveRaw(String addonId) throws ChargebeeException { String path = buildPathWithParams("/addons/{addon-id}/unarchive", "addon-id", addonId); @@ -98,6 +105,14 @@ public AddonUnarchiveResponse unarchive(String addonId) throws ChargebeeExceptio return AddonUnarchiveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture unarchiveAsync(String addonId) { + String path = buildPathWithParams("/addons/{addon-id}/unarchive", "addon-id", addonId); + + return postAsync(path, null) + .thenApply( + response -> AddonUnarchiveResponse.fromJson(response.getBodyAsString(), response)); + } + /** retrieve a addon (executes immediately) - returns raw Response. */ Response retrieveRaw(String addonId) throws ChargebeeException { String path = buildPathWithParams("/addons/{addon-id}", "addon-id", addonId); @@ -110,6 +125,14 @@ public AddonRetrieveResponse retrieve(String addonId) throws ChargebeeException return AddonRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String addonId) { + String path = buildPathWithParams("/addons/{addon-id}", "addon-id", addonId); + + return getAsync(path, null) + .thenApply( + response -> AddonRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** update a addon (executes immediately) - returns raw Response. */ Response updateRaw(String addonId) throws ChargebeeException { String path = buildPathWithParams("/addons/{addon-id}", "addon-id", addonId); @@ -135,11 +158,25 @@ public AddonUpdateResponse update(String addonId, AddonUpdateParams params) return AddonUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync( + String addonId, AddonUpdateParams params) { + String path = buildPathWithParams("/addons/{addon-id}", "addon-id", addonId); + return postAsync(path, params.toFormData()) + .thenApply(response -> AddonUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + public AddonUpdateResponse update(String addonId) throws ChargebeeException { Response response = updateRaw(addonId); return AddonUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync(String addonId) { + String path = buildPathWithParams("/addons/{addon-id}", "addon-id", addonId); + + return postAsync(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 { @@ -164,12 +201,28 @@ public AddonListResponse list(AddonListParams params) throws ChargebeeException return AddonListResponse.fromJson(response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync(AddonListParams params) { + + return getAsync("/addons", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + AddonListResponse.fromJson(response.getBodyAsString(), this, params, response)); + } + public AddonListResponse list() throws ChargebeeException { Response response = listRaw(); return AddonListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/addons", null) + .thenApply( + response -> + AddonListResponse.fromJson(response.getBodyAsString(), this, null, response)); + } + /** create a addon using immutable params (executes immediately) - returns raw Response. */ Response createRaw(AddonCreateParams params) throws ChargebeeException { @@ -188,6 +241,12 @@ public AddonCreateResponse create(AddonCreateParams params) throws ChargebeeExce return AddonCreateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createAsync(AddonCreateParams params) { + + return postAsync("/addons", params != null ? params.toFormData() : null) + .thenApply(response -> AddonCreateResponse.fromJson(response.getBodyAsString(), response)); + } + /** delete a addon (executes immediately) - returns raw Response. */ Response deleteRaw(String addonId) throws ChargebeeException { String path = buildPathWithParams("/addons/{addon-id}/delete", "addon-id", addonId); @@ -199,4 +258,11 @@ public AddonDeleteResponse delete(String addonId) throws ChargebeeException { Response response = deleteRaw(addonId); return AddonDeleteResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture deleteAsync(String addonId) { + String path = buildPathWithParams("/addons/{addon-id}/delete", "addon-id", addonId); + + return postAsync(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 dd8de8df..5fe69bd1 100644 --- a/src/main/java/com/chargebee/v4/services/AddressService.java +++ b/src/main/java/com/chargebee/v4/services/AddressService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.address.params.AddressRetrieveParams; @@ -72,6 +73,13 @@ public AddressRetrieveResponse retrieve(AddressRetrieveParams params) throws Cha return AddressRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(AddressRetrieveParams params) { + + return getAsync("/addresses", params != null ? params.toQueryParams() : null) + .thenApply( + response -> AddressRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** update a address using immutable params (executes immediately) - returns raw Response. */ Response updateRaw(AddressUpdateParams params) throws ChargebeeException { @@ -89,4 +97,11 @@ public AddressUpdateResponse update(AddressUpdateParams params) throws Chargebee return AddressUpdateResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture updateAsync(AddressUpdateParams params) { + + return postAsync("/addresses", params != null ? params.toFormData() : null) + .thenApply( + response -> AddressUpdateResponse.fromJson(response.getBodyAsString(), response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/AttachedItemService.java b/src/main/java/com/chargebee/v4/services/AttachedItemService.java index 81c197e3..c2c2e6d5 100644 --- a/src/main/java/com/chargebee/v4/services/AttachedItemService.java +++ b/src/main/java/com/chargebee/v4/services/AttachedItemService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.attachedItem.params.AttachedItemRetrieveParams; @@ -93,11 +94,33 @@ public AttachedItemRetrieveResponse retrieve( return AttachedItemRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync( + String attachedItemId, AttachedItemRetrieveParams params) { + String path = + buildPathWithParams( + "/attached_items/{attached-item-id}", "attached-item-id", attachedItemId); + return getAsync(path, params != null ? params.toQueryParams() : null) + .thenApply( + response -> + AttachedItemRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + public AttachedItemRetrieveResponse retrieve(String attachedItemId) throws ChargebeeException { Response response = retrieveRaw(attachedItemId); return AttachedItemRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String attachedItemId) { + String path = + buildPathWithParams( + "/attached_items/{attached-item-id}", "attached-item-id", attachedItemId); + + return getAsync(path, null) + .thenApply( + response -> + AttachedItemRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** update a attachedItem (executes immediately) - returns raw Response. */ Response updateRaw(String attachedItemId) throws ChargebeeException { String path = @@ -130,6 +153,16 @@ public AttachedItemUpdateResponse update(String attachedItemId, AttachedItemUpda return AttachedItemUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync( + String attachedItemId, AttachedItemUpdateParams params) { + String path = + buildPathWithParams( + "/attached_items/{attached-item-id}", "attached-item-id", attachedItemId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> AttachedItemUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + /** 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); @@ -161,6 +194,25 @@ public AttachedItemListResponse list(String itemId) throws ChargebeeException { response.getBodyAsString(), this, null, itemId, response); } + 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) + .thenApply( + response -> + AttachedItemListResponse.fromJson( + response.getBodyAsString(), this, params, itemId, response)); + } + + public CompletableFuture listAsync(String itemId) { + String path = buildPathWithParams("/items/{item-id}/attached_items", "item-id", itemId); + return getAsync(path, null) + .thenApply( + response -> + AttachedItemListResponse.fromJson( + response.getBodyAsString(), this, null, itemId, response)); + } + /** create a attachedItem (executes immediately) - returns raw Response. */ Response createRaw(String itemId) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}/attached_items", "item-id", itemId); @@ -186,6 +238,14 @@ public AttachedItemCreateResponse create(String itemId, AttachedItemCreateParams return AttachedItemCreateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createAsync( + String itemId, AttachedItemCreateParams params) { + String path = buildPathWithParams("/items/{item-id}/attached_items", "item-id", itemId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> AttachedItemCreateResponse.fromJson(response.getBodyAsString(), response)); + } + /** delete a attachedItem (executes immediately) - returns raw Response. */ Response deleteRaw(String attachedItemId) throws ChargebeeException { String path = @@ -217,4 +277,14 @@ public AttachedItemDeleteResponse delete(String attachedItemId, AttachedItemDele Response response = deleteRaw(attachedItemId, params); return AttachedItemDeleteResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture deleteAsync( + String attachedItemId, AttachedItemDeleteParams params) { + String path = + buildPathWithParams( + "/attached_items/{attached-item-id}/delete", "attached-item-id", attachedItemId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> AttachedItemDeleteResponse.fromJson(response.getBodyAsString(), response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/BaseService.java b/src/main/java/com/chargebee/v4/services/BaseService.java index 4008e326..6e6f0e73 100644 --- a/src/main/java/com/chargebee/v4/services/BaseService.java +++ b/src/main/java/com/chargebee/v4/services/BaseService.java @@ -234,6 +234,44 @@ private String baseUrlWithSubDomain(String subDomain) { client.getProtocol(), client.getSiteName(), subDomain, client.getDomainSuffix()); } + /** + * POST async with subdomain routing. + */ + protected CompletableFuture postWithSubDomainAsync(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); + return client.executeWithInterceptorAsync(builder.build()); + } + + /** + * POST JSON async with subdomain routing. + */ + protected CompletableFuture postJsonWithSubDomainAsync(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); + return client.executeWithInterceptorAsync(builder.build()); + } + + /** + * GET async with subdomain routing. + */ + protected CompletableFuture getWithSubDomainAsync(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); + return client.executeWithInterceptorAsync(builder.build()); + } + /** * GET async with Object query parameters. */ diff --git a/src/main/java/com/chargebee/v4/services/BrandConfigurationService.java b/src/main/java/com/chargebee/v4/services/BrandConfigurationService.java index 7589447c..e989dd7f 100644 --- a/src/main/java/com/chargebee/v4/services/BrandConfigurationService.java +++ b/src/main/java/com/chargebee/v4/services/BrandConfigurationService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.brandConfiguration.params.BrandConfigurationRetrieveParams; @@ -82,9 +83,26 @@ public BrandConfigurationRetrieveResponse retrieve(BrandConfigurationRetrievePar return BrandConfigurationRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync( + BrandConfigurationRetrieveParams params) { + + return getAsync("/brand_configurations", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + BrandConfigurationRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + public BrandConfigurationRetrieveResponse retrieve() throws ChargebeeException { Response response = retrieveRaw(); return BrandConfigurationRetrieveResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture retrieveAsync() { + + return getAsync("/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 a5b16684..0fba09df 100644 --- a/src/main/java/com/chargebee/v4/services/BusinessEntityService.java +++ b/src/main/java/com/chargebee/v4/services/BusinessEntityService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.businessEntity.params.BusinessEntityGetTransfersParams; @@ -87,6 +88,16 @@ public BusinessEntityGetTransfersResponse getTransfers(BusinessEntityGetTransfer response.getBodyAsString(), this, params, response); } + public CompletableFuture getTransfersAsync( + BusinessEntityGetTransfersParams params) { + + return getAsync("/business_entities/transfers", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + BusinessEntityGetTransfersResponse.fromJson( + response.getBodyAsString(), this, params, response)); + } + public BusinessEntityGetTransfersResponse getTransfers() throws ChargebeeException { Response response = getTransfersRaw(); @@ -94,6 +105,15 @@ public BusinessEntityGetTransfersResponse getTransfers() throws ChargebeeExcepti response.getBodyAsString(), this, null, response); } + public CompletableFuture getTransfersAsync() { + + return getAsync("/business_entities/transfers", null) + .thenApply( + response -> + BusinessEntityGetTransfersResponse.fromJson( + response.getBodyAsString(), this, null, response)); + } + /** * createTransfers a businessEntity using immutable params (executes immediately) - returns raw * Response. @@ -119,4 +139,14 @@ public BusinessEntityCreateTransfersResponse createTransfers( return BusinessEntityCreateTransfersResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture createTransfersAsync( + BusinessEntityCreateTransfersParams params) { + + return postAsync("/business_entities/transfers", params != null ? params.toFormData() : null) + .thenApply( + response -> + BusinessEntityCreateTransfersResponse.fromJson( + response.getBodyAsString(), response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/BusinessProfileService.java b/src/main/java/com/chargebee/v4/services/BusinessProfileService.java index f365165f..e517c3c2 100644 --- a/src/main/java/com/chargebee/v4/services/BusinessProfileService.java +++ b/src/main/java/com/chargebee/v4/services/BusinessProfileService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.businessProfile.params.BusinessProfileRetrieveParams; @@ -82,9 +83,26 @@ public BusinessProfileRetrieveResponse retrieve(BusinessProfileRetrieveParams pa return BusinessProfileRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync( + BusinessProfileRetrieveParams params) { + + return getAsync("/business_profiles", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + BusinessProfileRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + public BusinessProfileRetrieveResponse retrieve() throws ChargebeeException { Response response = retrieveRaw(); return BusinessProfileRetrieveResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture retrieveAsync() { + + return getAsync("/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 7df2fa95..b4bc97e3 100644 --- a/src/main/java/com/chargebee/v4/services/CardService.java +++ b/src/main/java/com/chargebee/v4/services/CardService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.card.params.CopyCardForCustomerParams; @@ -97,6 +98,15 @@ public CopyCardForCustomerResponse copyCardForCustomer( return CopyCardForCustomerResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture copyCardForCustomerAsync( + String customerId, CopyCardForCustomerParams params) { + String path = + buildPathWithParams("/customers/{customer-id}/copy_card", "customer-id", customerId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> CopyCardForCustomerResponse.fromJson(response.getBodyAsString(), response)); + } + /** retrieve a card (executes immediately) - returns raw Response. */ Response retrieveRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/cards/{customer-id}", "customer-id", customerId); @@ -109,6 +119,13 @@ public CardRetrieveResponse retrieve(String customerId) throws ChargebeeExceptio return CardRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String customerId) { + String path = buildPathWithParams("/cards/{customer-id}", "customer-id", customerId); + + return getAsync(path, null) + .thenApply(response -> CardRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** switchGatewayForCustomer a card (executes immediately) - returns raw Response. */ Response switchGatewayForCustomerRaw(String customerId) throws ChargebeeException { String path = @@ -145,6 +162,17 @@ public CardSwitchGatewayForCustomerResponse switchGatewayForCustomer( return CardSwitchGatewayForCustomerResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture switchGatewayForCustomerAsync( + String customerId, CardSwitchGatewayForCustomerParams params) { + String path = + buildPathWithParams("/customers/{customer-id}/switch_gateway", "customer-id", customerId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + CardSwitchGatewayForCustomerResponse.fromJson( + response.getBodyAsString(), response)); + } + /** deleteCardForCustomer a card (executes immediately) - returns raw Response. */ Response deleteCardForCustomerRaw(String customerId) throws ChargebeeException { String path = @@ -159,6 +187,17 @@ public DeleteCardForCustomerResponse deleteCardForCustomer(String customerId) return DeleteCardForCustomerResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteCardForCustomerAsync( + String customerId) { + String path = + buildPathWithParams("/customers/{customer-id}/delete_card", "customer-id", customerId); + + return postAsync(path, null) + .thenApply( + response -> + DeleteCardForCustomerResponse.fromJson(response.getBodyAsString(), response)); + } + /** updateCardForCustomer a card (executes immediately) - returns raw Response. */ Response updateCardForCustomerRaw(String customerId) throws ChargebeeException { String path = @@ -194,4 +233,14 @@ public UpdateCardForCustomerResponse updateCardForCustomer( Response response = updateCardForCustomerRaw(customerId, params); return UpdateCardForCustomerResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture updateCardForCustomerAsync( + String customerId, UpdateCardForCustomerParams params) { + String path = + buildPathWithParams("/customers/{customer-id}/credit_card", "customer-id", customerId); + return postAsync(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 826ec37a..cb2df36d 100644 --- a/src/main/java/com/chargebee/v4/services/CommentService.java +++ b/src/main/java/com/chargebee/v4/services/CommentService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.comment.params.CommentListParams; @@ -70,6 +71,14 @@ public CommentDeleteResponse delete(String commentId) throws ChargebeeException return CommentDeleteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteAsync(String commentId) { + String path = buildPathWithParams("/comments/{comment-id}/delete", "comment-id", commentId); + + return postAsync(path, null) + .thenApply( + response -> CommentDeleteResponse.fromJson(response.getBodyAsString(), response)); + } + /** retrieve a comment (executes immediately) - returns raw Response. */ Response retrieveRaw(String commentId) throws ChargebeeException { String path = buildPathWithParams("/comments/{comment-id}", "comment-id", commentId); @@ -82,6 +91,14 @@ public CommentRetrieveResponse retrieve(String commentId) throws ChargebeeExcept return CommentRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String commentId) { + String path = buildPathWithParams("/comments/{comment-id}", "comment-id", commentId); + + return getAsync(path, null) + .thenApply( + response -> CommentRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** list a comment using immutable params (executes immediately) - returns raw Response. */ Response listRaw(CommentListParams params) throws ChargebeeException { @@ -106,12 +123,28 @@ public CommentListResponse list(CommentListParams params) throws ChargebeeExcept return CommentListResponse.fromJson(response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync(CommentListParams params) { + + return getAsync("/comments", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + CommentListResponse.fromJson(response.getBodyAsString(), this, params, response)); + } + public CommentListResponse list() throws ChargebeeException { Response response = listRaw(); return CommentListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/comments", null) + .thenApply( + response -> + CommentListResponse.fromJson(response.getBodyAsString(), this, null, response)); + } + /** create a comment using immutable params (executes immediately) - returns raw Response. */ Response createRaw(CommentCreateParams params) throws ChargebeeException { @@ -129,4 +162,11 @@ public CommentCreateResponse create(CommentCreateParams params) throws Chargebee return CommentCreateResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture createAsync(CommentCreateParams params) { + + return postAsync("/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 fde115f4..cb077ddb 100644 --- a/src/main/java/com/chargebee/v4/services/ConfigurationService.java +++ b/src/main/java/com/chargebee/v4/services/ConfigurationService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.configuration.params.ConfigurationListParams; @@ -75,9 +76,23 @@ public ConfigurationListResponse list(ConfigurationListParams params) throws Cha return ConfigurationListResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture listAsync(ConfigurationListParams params) { + + return getAsync("/configurations", params != null ? params.toQueryParams() : null) + .thenApply( + response -> ConfigurationListResponse.fromJson(response.getBodyAsString(), response)); + } + public ConfigurationListResponse list() throws ChargebeeException { Response response = listRaw(); return ConfigurationListResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture listAsync() { + + return getAsync("/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 acb4a3c9..17fd0295 100644 --- a/src/main/java/com/chargebee/v4/services/CouponCodeService.java +++ b/src/main/java/com/chargebee/v4/services/CouponCodeService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.couponCode.params.CouponCodeListParams; @@ -82,12 +83,29 @@ public CouponCodeListResponse list(CouponCodeListParams params) throws Chargebee return CouponCodeListResponse.fromJson(response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync(CouponCodeListParams params) { + + return getAsync("/coupon_codes", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + CouponCodeListResponse.fromJson( + response.getBodyAsString(), this, params, response)); + } + public CouponCodeListResponse list() throws ChargebeeException { Response response = listRaw(); return CouponCodeListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/coupon_codes", null) + .thenApply( + response -> + CouponCodeListResponse.fromJson(response.getBodyAsString(), this, null, response)); + } + /** create a couponCode using immutable params (executes immediately) - returns raw Response. */ Response createRaw(CouponCodeCreateParams params) throws ChargebeeException { @@ -106,6 +124,13 @@ public CouponCodeCreateResponse create(CouponCodeCreateParams params) throws Cha return CouponCodeCreateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createAsync(CouponCodeCreateParams params) { + + return postAsync("/coupon_codes", params != null ? params.toFormData() : null) + .thenApply( + response -> CouponCodeCreateResponse.fromJson(response.getBodyAsString(), response)); + } + /** retrieve a couponCode (executes immediately) - returns raw Response. */ Response retrieveRaw(String couponCodeCode) throws ChargebeeException { String path = @@ -119,6 +144,15 @@ public CouponCodeRetrieveResponse retrieve(String couponCodeCode) throws Chargeb return CouponCodeRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String couponCodeCode) { + String path = + buildPathWithParams("/coupon_codes/{coupon-code-code}", "coupon-code-code", couponCodeCode); + + return getAsync(path, null) + .thenApply( + response -> CouponCodeRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** archive a couponCode (executes immediately) - returns raw Response. */ Response archiveRaw(String couponCodeCode) throws ChargebeeException { String path = @@ -132,4 +166,14 @@ public CouponCodeArchiveResponse archive(String couponCodeCode) throws Chargebee Response response = archiveRaw(couponCodeCode); return CouponCodeArchiveResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture archiveAsync(String couponCodeCode) { + String path = + buildPathWithParams( + "/coupon_codes/{coupon-code-code}/archive", "coupon-code-code", couponCodeCode); + + return postAsync(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 a04c7775..bd850a54 100644 --- a/src/main/java/com/chargebee/v4/services/CouponService.java +++ b/src/main/java/com/chargebee/v4/services/CouponService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.coupon.params.CouponListParams; @@ -100,12 +101,28 @@ public CouponListResponse list(CouponListParams params) throws ChargebeeExceptio return CouponListResponse.fromJson(response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync(CouponListParams params) { + + return getAsync("/coupons", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + CouponListResponse.fromJson(response.getBodyAsString(), this, params, response)); + } + public CouponListResponse list() throws ChargebeeException { Response response = listRaw(); return CouponListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/coupons", null) + .thenApply( + response -> + CouponListResponse.fromJson(response.getBodyAsString(), this, null, response)); + } + /** create a coupon using immutable params (executes immediately) - returns raw Response. */ Response createRaw(CouponCreateParams params) throws ChargebeeException { @@ -124,6 +141,12 @@ public CouponCreateResponse create(CouponCreateParams params) throws ChargebeeEx return CouponCreateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createAsync(CouponCreateParams params) { + + return postAsync("/coupons", params != null ? params.toFormData() : null) + .thenApply(response -> CouponCreateResponse.fromJson(response.getBodyAsString(), response)); + } + /** updateForItems a coupon (executes immediately) - returns raw Response. */ Response updateForItemsRaw(String couponId) throws ChargebeeException { String path = @@ -157,11 +180,31 @@ public CouponUpdateForItemsResponse updateForItems( return CouponUpdateForItemsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateForItemsAsync( + String couponId, CouponUpdateForItemsParams params) { + String path = + buildPathWithParams("/coupons/{coupon-id}/update_for_items", "coupon-id", couponId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + CouponUpdateForItemsResponse.fromJson(response.getBodyAsString(), response)); + } + public CouponUpdateForItemsResponse updateForItems(String couponId) throws ChargebeeException { Response response = updateForItemsRaw(couponId); return CouponUpdateForItemsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateForItemsAsync(String couponId) { + String path = + buildPathWithParams("/coupons/{coupon-id}/update_for_items", "coupon-id", couponId); + + return postAsync(path, null) + .thenApply( + response -> + CouponUpdateForItemsResponse.fromJson(response.getBodyAsString(), response)); + } + /** unarchive a coupon (executes immediately) - returns raw Response. */ Response unarchiveRaw(String couponId) throws ChargebeeException { String path = buildPathWithParams("/coupons/{coupon-id}/unarchive", "coupon-id", couponId); @@ -174,6 +217,14 @@ public CouponUnarchiveResponse unarchive(String couponId) throws ChargebeeExcept return CouponUnarchiveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture unarchiveAsync(String couponId) { + String path = buildPathWithParams("/coupons/{coupon-id}/unarchive", "coupon-id", couponId); + + return postAsync(path, null) + .thenApply( + response -> CouponUnarchiveResponse.fromJson(response.getBodyAsString(), response)); + } + /** delete a coupon (executes immediately) - returns raw Response. */ Response deleteRaw(String couponId) throws ChargebeeException { String path = buildPathWithParams("/coupons/{coupon-id}/delete", "coupon-id", couponId); @@ -186,6 +237,13 @@ public CouponDeleteResponse delete(String couponId) throws ChargebeeException { return CouponDeleteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteAsync(String couponId) { + String path = buildPathWithParams("/coupons/{coupon-id}/delete", "coupon-id", couponId); + + return postAsync(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 { @@ -204,6 +262,12 @@ public CouponCopyResponse copy(CouponCopyParams params) throws ChargebeeExceptio return CouponCopyResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture copyAsync(CouponCopyParams params) { + + return postAsync("/coupons/copy", params != null ? params.toFormData() : null) + .thenApply(response -> CouponCopyResponse.fromJson(response.getBodyAsString(), response)); + } + /** retrieve a coupon (executes immediately) - returns raw Response. */ Response retrieveRaw(String couponId) throws ChargebeeException { String path = buildPathWithParams("/coupons/{coupon-id}", "coupon-id", couponId); @@ -216,6 +280,14 @@ public CouponRetrieveResponse retrieve(String couponId) throws ChargebeeExceptio return CouponRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String couponId) { + String path = buildPathWithParams("/coupons/{coupon-id}", "coupon-id", couponId); + + return getAsync(path, null) + .thenApply( + response -> CouponRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** update a coupon (executes immediately) - returns raw Response. */ Response updateRaw(String couponId) throws ChargebeeException { String path = buildPathWithParams("/coupons/{coupon-id}", "coupon-id", couponId); @@ -241,11 +313,25 @@ public CouponUpdateResponse update(String couponId, CouponUpdateParams params) return CouponUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync( + String couponId, CouponUpdateParams params) { + String path = buildPathWithParams("/coupons/{coupon-id}", "coupon-id", couponId); + return postAsync(path, params.toFormData()) + .thenApply(response -> CouponUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + public CouponUpdateResponse update(String couponId) throws ChargebeeException { Response response = updateRaw(couponId); return CouponUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync(String couponId) { + String path = buildPathWithParams("/coupons/{coupon-id}", "coupon-id", couponId); + + return postAsync(path, null) + .thenApply(response -> CouponUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + /** * createForItems a coupon using immutable params (executes immediately) - returns raw Response. */ @@ -268,4 +354,13 @@ public CouponCreateForItemsResponse createForItems(CouponCreateForItemsParams pa return CouponCreateForItemsResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture createForItemsAsync( + CouponCreateForItemsParams params) { + + return postAsync("/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 761bbdbc..c72b7673 100644 --- a/src/main/java/com/chargebee/v4/services/CouponSetService.java +++ b/src/main/java/com/chargebee/v4/services/CouponSetService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.couponSet.params.CouponSetListParams; @@ -92,12 +93,28 @@ public CouponSetListResponse list(CouponSetListParams params) throws ChargebeeEx return CouponSetListResponse.fromJson(response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync(CouponSetListParams params) { + + return getAsync("/coupon_sets", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + CouponSetListResponse.fromJson(response.getBodyAsString(), this, params, response)); + } + public CouponSetListResponse list() throws ChargebeeException { Response response = listRaw(); return CouponSetListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/coupon_sets", null) + .thenApply( + response -> + CouponSetListResponse.fromJson(response.getBodyAsString(), this, null, response)); + } + /** create a couponSet using immutable params (executes immediately) - returns raw Response. */ Response createRaw(CouponSetCreateParams params) throws ChargebeeException { @@ -116,6 +133,13 @@ public CouponSetCreateResponse create(CouponSetCreateParams params) throws Charg return CouponSetCreateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createAsync(CouponSetCreateParams params) { + + return postAsync("/coupon_sets", params != null ? params.toFormData() : null) + .thenApply( + response -> CouponSetCreateResponse.fromJson(response.getBodyAsString(), response)); + } + /** update a couponSet (executes immediately) - returns raw Response. */ Response updateRaw(String couponSetId) throws ChargebeeException { String path = @@ -144,11 +168,29 @@ public CouponSetUpdateResponse update(String couponSetId, CouponSetUpdateParams return CouponSetUpdateResponse.fromJson(response.getBodyAsString(), response); } + 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()) + .thenApply( + response -> CouponSetUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + public CouponSetUpdateResponse update(String couponSetId) throws ChargebeeException { Response response = updateRaw(couponSetId); return CouponSetUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync(String couponSetId) { + String path = + buildPathWithParams("/coupon_sets/{coupon-set-id}/update", "coupon-set-id", couponSetId); + + return postAsync(path, null) + .thenApply( + response -> CouponSetUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + /** retrieve a couponSet (executes immediately) - returns raw Response. */ Response retrieveRaw(String couponSetId) throws ChargebeeException { String path = buildPathWithParams("/coupon_sets/{coupon-set-id}", "coupon-set-id", couponSetId); @@ -161,6 +203,14 @@ public CouponSetRetrieveResponse retrieve(String couponSetId) throws ChargebeeEx return CouponSetRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String couponSetId) { + String path = buildPathWithParams("/coupon_sets/{coupon-set-id}", "coupon-set-id", couponSetId); + + return getAsync(path, null) + .thenApply( + response -> CouponSetRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** addCouponCodes a couponSet (executes immediately) - returns raw Response. */ Response addCouponCodesRaw(String couponSetId) throws ChargebeeException { String path = @@ -199,12 +249,35 @@ public CouponSetAddCouponCodesResponse addCouponCodes( return CouponSetAddCouponCodesResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture addCouponCodesAsync( + String couponSetId, CouponSetAddCouponCodesParams params) { + String path = + buildPathWithParams( + "/coupon_sets/{coupon-set-id}/add_coupon_codes", "coupon-set-id", couponSetId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + CouponSetAddCouponCodesResponse.fromJson(response.getBodyAsString(), response)); + } + public CouponSetAddCouponCodesResponse addCouponCodes(String couponSetId) throws ChargebeeException { Response response = addCouponCodesRaw(couponSetId); return CouponSetAddCouponCodesResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture addCouponCodesAsync( + String couponSetId) { + String path = + buildPathWithParams( + "/coupon_sets/{coupon-set-id}/add_coupon_codes", "coupon-set-id", couponSetId); + + return postAsync(path, null) + .thenApply( + response -> + CouponSetAddCouponCodesResponse.fromJson(response.getBodyAsString(), response)); + } + /** deleteUnusedCouponCodes a couponSet (executes immediately) - returns raw Response. */ Response deleteUnusedCouponCodesRaw(String couponSetId) throws ChargebeeException { String path = @@ -222,6 +295,21 @@ public CouponSetDeleteUnusedCouponCodesResponse deleteUnusedCouponCodes(String c return CouponSetDeleteUnusedCouponCodesResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteUnusedCouponCodesAsync( + String couponSetId) { + String path = + buildPathWithParams( + "/coupon_sets/{coupon-set-id}/delete_unused_coupon_codes", + "coupon-set-id", + couponSetId); + + return postAsync(path, null) + .thenApply( + response -> + CouponSetDeleteUnusedCouponCodesResponse.fromJson( + response.getBodyAsString(), response)); + } + /** delete a couponSet (executes immediately) - returns raw Response. */ Response deleteRaw(String couponSetId) throws ChargebeeException { String path = @@ -234,4 +322,13 @@ public CouponSetDeleteResponse delete(String couponSetId) throws ChargebeeExcept Response response = deleteRaw(couponSetId); return CouponSetDeleteResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture deleteAsync(String couponSetId) { + String path = + buildPathWithParams("/coupon_sets/{coupon-set-id}/delete", "coupon-set-id", couponSetId); + + return postAsync(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 73fa1868..6fcb7d2a 100644 --- a/src/main/java/com/chargebee/v4/services/CreditNoteService.java +++ b/src/main/java/com/chargebee/v4/services/CreditNoteService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.creditNote.params.CreditNoteRecordRefundParams; @@ -132,12 +133,34 @@ public CreditNoteRecordRefundResponse recordRefund( return CreditNoteRecordRefundResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture recordRefundAsync( + String creditNoteId, CreditNoteRecordRefundParams params) { + String path = + buildPathWithParams( + "/credit_notes/{credit-note-id}/record_refund", "credit-note-id", creditNoteId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + CreditNoteRecordRefundResponse.fromJson(response.getBodyAsString(), response)); + } + public CreditNoteRecordRefundResponse recordRefund(String creditNoteId) throws ChargebeeException { Response response = recordRefundRaw(creditNoteId); return CreditNoteRecordRefundResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture recordRefundAsync(String creditNoteId) { + String path = + buildPathWithParams( + "/credit_notes/{credit-note-id}/record_refund", "credit-note-id", creditNoteId); + + return postAsync(path, null) + .thenApply( + response -> + CreditNoteRecordRefundResponse.fromJson(response.getBodyAsString(), response)); + } + /** * importCreditNote a creditNote using immutable params (executes immediately) - returns raw * Response. @@ -163,6 +186,15 @@ public ImportCreditNoteResponse importCreditNote(ImportCreditNoteParams params) return ImportCreditNoteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture importCreditNoteAsync( + ImportCreditNoteParams params) { + + return postAsync( + "/credit_notes/import_credit_note", params != null ? params.toFormData() : null) + .thenApply( + response -> ImportCreditNoteResponse.fromJson(response.getBodyAsString(), response)); + } + /** delete a creditNote (executes immediately) - returns raw Response. */ Response deleteRaw(String creditNoteId) throws ChargebeeException { String path = @@ -194,11 +226,31 @@ public CreditNoteDeleteResponse delete(String creditNoteId, CreditNoteDeletePara return CreditNoteDeleteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteAsync( + String creditNoteId, CreditNoteDeleteParams params) { + String path = + buildPathWithParams( + "/credit_notes/{credit-note-id}/delete", "credit-note-id", creditNoteId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> CreditNoteDeleteResponse.fromJson(response.getBodyAsString(), response)); + } + public CreditNoteDeleteResponse delete(String creditNoteId) throws ChargebeeException { Response response = deleteRaw(creditNoteId); return CreditNoteDeleteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteAsync(String creditNoteId) { + String path = + buildPathWithParams( + "/credit_notes/{credit-note-id}/delete", "credit-note-id", creditNoteId); + + return postAsync(path, null) + .thenApply( + response -> CreditNoteDeleteResponse.fromJson(response.getBodyAsString(), response)); + } + /** * creditNotesForCustomer a creditNote using immutable params (executes immediately) - returns raw * Response. @@ -245,6 +297,28 @@ public CreditNotesForCustomerResponse creditNotesForCustomer(String customerId) response.getBodyAsString(), this, null, customerId, response); } + public CompletableFuture creditNotesForCustomerAsync( + String customerId, CreditNotesForCustomerParams params) { + String path = + buildPathWithParams("/customers/{customer-id}/credit_notes", "customer-id", customerId); + return getAsync(path, params != null ? params.toQueryParams() : null) + .thenApply( + response -> + CreditNotesForCustomerResponse.fromJson( + response.getBodyAsString(), this, params, customerId, response)); + } + + public CompletableFuture creditNotesForCustomerAsync( + String customerId) { + String path = + buildPathWithParams("/customers/{customer-id}/credit_notes", "customer-id", customerId); + return getAsync(path, null) + .thenApply( + response -> + CreditNotesForCustomerResponse.fromJson( + response.getBodyAsString(), this, null, customerId, response)); + } + /** pdf a creditNote (executes immediately) - returns raw Response. */ Response pdfRaw(String creditNoteId) throws ChargebeeException { String path = @@ -273,11 +347,29 @@ public CreditNotePdfResponse pdf(String creditNoteId, CreditNotePdfParams params return CreditNotePdfResponse.fromJson(response.getBodyAsString(), response); } + 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()) + .thenApply( + response -> CreditNotePdfResponse.fromJson(response.getBodyAsString(), response)); + } + public CreditNotePdfResponse pdf(String creditNoteId) throws ChargebeeException { Response response = pdfRaw(creditNoteId); return CreditNotePdfResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture pdfAsync(String creditNoteId) { + String path = + buildPathWithParams("/credit_notes/{credit-note-id}/pdf", "credit-note-id", creditNoteId); + + return postAsync(path, null) + .thenApply( + response -> CreditNotePdfResponse.fromJson(response.getBodyAsString(), response)); + } + /** sendEinvoice a creditNote (executes immediately) - returns raw Response. */ Response sendEinvoiceRaw(String creditNoteId) throws ChargebeeException { String path = @@ -293,6 +385,17 @@ public CreditNoteSendEinvoiceResponse sendEinvoice(String creditNoteId) return CreditNoteSendEinvoiceResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture sendEinvoiceAsync(String creditNoteId) { + String path = + buildPathWithParams( + "/credit_notes/{credit-note-id}/send_einvoice", "credit-note-id", creditNoteId); + + return postAsync(path, null) + .thenApply( + response -> + CreditNoteSendEinvoiceResponse.fromJson(response.getBodyAsString(), response)); + } + /** voidCreditNote a creditNote (executes immediately) - returns raw Response. */ Response voidCreditNoteRaw(String creditNoteId) throws ChargebeeException { String path = @@ -328,11 +431,29 @@ public VoidCreditNoteResponse voidCreditNote(String creditNoteId, VoidCreditNote return VoidCreditNoteResponse.fromJson(response.getBodyAsString(), response); } + 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()) + .thenApply( + response -> VoidCreditNoteResponse.fromJson(response.getBodyAsString(), response)); + } + public VoidCreditNoteResponse voidCreditNote(String creditNoteId) throws ChargebeeException { Response response = voidCreditNoteRaw(creditNoteId); return VoidCreditNoteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture voidCreditNoteAsync(String creditNoteId) { + String path = + buildPathWithParams("/credit_notes/{credit-note-id}/void", "credit-note-id", creditNoteId); + + return postAsync(path, null) + .thenApply( + response -> VoidCreditNoteResponse.fromJson(response.getBodyAsString(), response)); + } + /** refund a creditNote (executes immediately) - returns raw Response. */ Response refundRaw(String creditNoteId) throws ChargebeeException { String path = @@ -364,11 +485,31 @@ public CreditNoteRefundResponse refund(String creditNoteId, CreditNoteRefundPara return CreditNoteRefundResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture refundAsync( + String creditNoteId, CreditNoteRefundParams params) { + String path = + buildPathWithParams( + "/credit_notes/{credit-note-id}/refund", "credit-note-id", creditNoteId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> CreditNoteRefundResponse.fromJson(response.getBodyAsString(), response)); + } + public CreditNoteRefundResponse refund(String creditNoteId) throws ChargebeeException { Response response = refundRaw(creditNoteId); return CreditNoteRefundResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture refundAsync(String creditNoteId) { + String path = + buildPathWithParams( + "/credit_notes/{credit-note-id}/refund", "credit-note-id", creditNoteId); + + return postAsync(path, null) + .thenApply( + response -> CreditNoteRefundResponse.fromJson(response.getBodyAsString(), response)); + } + /** list a creditNote using immutable params (executes immediately) - returns raw Response. */ Response listRaw(CreditNoteListParams params) throws ChargebeeException { @@ -393,12 +534,29 @@ public CreditNoteListResponse list(CreditNoteListParams params) throws Chargebee return CreditNoteListResponse.fromJson(response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync(CreditNoteListParams params) { + + return getAsync("/credit_notes", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + CreditNoteListResponse.fromJson( + response.getBodyAsString(), this, params, response)); + } + public CreditNoteListResponse list() throws ChargebeeException { Response response = listRaw(); return CreditNoteListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/credit_notes", null) + .thenApply( + response -> + CreditNoteListResponse.fromJson(response.getBodyAsString(), this, null, response)); + } + /** create a creditNote using immutable params (executes immediately) - returns raw Response. */ Response createRaw(CreditNoteCreateParams params) throws ChargebeeException { @@ -417,6 +575,13 @@ public CreditNoteCreateResponse create(CreditNoteCreateParams params) throws Cha return CreditNoteCreateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createAsync(CreditNoteCreateParams params) { + + return postAsync("/credit_notes", params != null ? params.toFormData() : null) + .thenApply( + response -> CreditNoteCreateResponse.fromJson(response.getBodyAsString(), response)); + } + /** downloadEinvoice a creditNote (executes immediately) - returns raw Response. */ Response downloadEinvoiceRaw(String creditNoteId) throws ChargebeeException { String path = @@ -432,6 +597,18 @@ public CreditNoteDownloadEinvoiceResponse downloadEinvoice(String creditNoteId) return CreditNoteDownloadEinvoiceResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture downloadEinvoiceAsync( + String creditNoteId) { + String path = + buildPathWithParams( + "/credit_notes/{credit-note-id}/download_einvoice", "credit-note-id", creditNoteId); + + return getAsync(path, null) + .thenApply( + response -> + CreditNoteDownloadEinvoiceResponse.fromJson(response.getBodyAsString(), response)); + } + /** resendEinvoice a creditNote (executes immediately) - returns raw Response. */ Response resendEinvoiceRaw(String creditNoteId) throws ChargebeeException { String path = @@ -447,6 +624,18 @@ public CreditNoteResendEinvoiceResponse resendEinvoice(String creditNoteId) return CreditNoteResendEinvoiceResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture resendEinvoiceAsync( + String creditNoteId) { + String path = + buildPathWithParams( + "/credit_notes/{credit-note-id}/resend_einvoice", "credit-note-id", creditNoteId); + + return postAsync(path, null) + .thenApply( + response -> + CreditNoteResendEinvoiceResponse.fromJson(response.getBodyAsString(), response)); + } + /** removeTaxWithheldRefund a creditNote (executes immediately) - returns raw Response. */ Response removeTaxWithheldRefundRaw(String creditNoteId) throws ChargebeeException { String path = @@ -494,12 +683,41 @@ public CreditNoteRemoveTaxWithheldRefundResponse removeTaxWithheldRefund( return CreditNoteRemoveTaxWithheldRefundResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture removeTaxWithheldRefundAsync( + String creditNoteId, CreditNoteRemoveTaxWithheldRefundParams params) { + String path = + buildPathWithParams( + "/credit_notes/{credit-note-id}/remove_tax_withheld_refund", + "credit-note-id", + creditNoteId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + CreditNoteRemoveTaxWithheldRefundResponse.fromJson( + response.getBodyAsString(), response)); + } + public CreditNoteRemoveTaxWithheldRefundResponse removeTaxWithheldRefund(String creditNoteId) throws ChargebeeException { Response response = removeTaxWithheldRefundRaw(creditNoteId); return CreditNoteRemoveTaxWithheldRefundResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture removeTaxWithheldRefundAsync( + String creditNoteId) { + String path = + buildPathWithParams( + "/credit_notes/{credit-note-id}/remove_tax_withheld_refund", + "credit-note-id", + creditNoteId); + + return postAsync(path, null) + .thenApply( + response -> + CreditNoteRemoveTaxWithheldRefundResponse.fromJson( + response.getBodyAsString(), response)); + } + /** retrieve a creditNote (executes immediately) - returns raw Response. */ Response retrieveRaw(String creditNoteId) throws ChargebeeException { String path = @@ -522,8 +740,26 @@ public CreditNoteRetrieveResponse retrieve(String creditNoteId, CreditNoteRetrie return CreditNoteRetrieveResponse.fromJson(response.getBodyAsString(), response); } + 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) + .thenApply( + response -> CreditNoteRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + public CreditNoteRetrieveResponse retrieve(String creditNoteId) throws ChargebeeException { Response response = retrieveRaw(creditNoteId); return CreditNoteRetrieveResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture retrieveAsync(String creditNoteId) { + String path = + buildPathWithParams("/credit_notes/{credit-note-id}", "credit-note-id", creditNoteId); + + return getAsync(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 0dd52a44..bebb8dd8 100644 --- a/src/main/java/com/chargebee/v4/services/CsvTaxRuleService.java +++ b/src/main/java/com/chargebee/v4/services/CsvTaxRuleService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.csvTaxRule.params.CsvTaxRuleCreateParams; @@ -67,4 +68,11 @@ public CsvTaxRuleCreateResponse create(CsvTaxRuleCreateParams params) throws Cha return CsvTaxRuleCreateResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture createAsync(CsvTaxRuleCreateParams params) { + + return postAsync("/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 50f4a218..0ea4828e 100644 --- a/src/main/java/com/chargebee/v4/services/CurrencyService.java +++ b/src/main/java/com/chargebee/v4/services/CurrencyService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.currency.params.CurrencyAddScheduleParams; @@ -102,6 +103,16 @@ public CurrencyAddScheduleResponse addSchedule( return CurrencyAddScheduleResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture addScheduleAsync( + String siteCurrencyId, CurrencyAddScheduleParams params) { + String path = + buildPathWithParams( + "/currencies/{site-currency-id}/add_schedule", "site-currency-id", siteCurrencyId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> CurrencyAddScheduleResponse.fromJson(response.getBodyAsString(), response)); + } + /** create a currency using immutable params (executes immediately) - returns raw Response. */ Response createRaw(CurrencyCreateParams params) throws ChargebeeException { @@ -120,6 +131,13 @@ public CurrencyCreateResponse create(CurrencyCreateParams params) throws Chargeb return CurrencyCreateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createAsync(CurrencyCreateParams params) { + + return postAsync("/currencies", params != null ? params.toFormData() : null) + .thenApply( + response -> CurrencyCreateResponse.fromJson(response.getBodyAsString(), response)); + } + /** retrieve a currency (executes immediately) - returns raw Response. */ Response retrieveRaw(String siteCurrencyId) throws ChargebeeException { String path = @@ -133,6 +151,15 @@ public CurrencyRetrieveResponse retrieve(String siteCurrencyId) throws Chargebee return CurrencyRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String siteCurrencyId) { + String path = + buildPathWithParams("/currencies/{site-currency-id}", "site-currency-id", siteCurrencyId); + + return getAsync(path, null) + .thenApply( + response -> CurrencyRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** update a currency (executes immediately) - returns raw Response. */ Response updateRaw(String siteCurrencyId) throws ChargebeeException { String path = @@ -161,6 +188,15 @@ public CurrencyUpdateResponse update(String siteCurrencyId, CurrencyUpdateParams return CurrencyUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync( + String siteCurrencyId, CurrencyUpdateParams params) { + String path = + buildPathWithParams("/currencies/{site-currency-id}", "site-currency-id", siteCurrencyId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> CurrencyUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + /** removeSchedule a currency (executes immediately) - returns raw Response. */ Response removeScheduleRaw(String siteCurrencyId) throws ChargebeeException { String path = @@ -176,6 +212,18 @@ public CurrencyRemoveScheduleResponse removeSchedule(String siteCurrencyId) return CurrencyRemoveScheduleResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture removeScheduleAsync( + String siteCurrencyId) { + String path = + buildPathWithParams( + "/currencies/{site-currency-id}/remove_schedule", "site-currency-id", siteCurrencyId); + + return postAsync(path, null) + .thenApply( + response -> + CurrencyRemoveScheduleResponse.fromJson(response.getBodyAsString(), response)); + } + /** list a currency using immutable params (executes immediately) - returns raw Response. */ Response listRaw(CurrencyListParams params) throws ChargebeeException { @@ -200,9 +248,25 @@ public CurrencyListResponse list(CurrencyListParams params) throws ChargebeeExce return CurrencyListResponse.fromJson(response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync(CurrencyListParams params) { + + return getAsync("/currencies/list", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + CurrencyListResponse.fromJson(response.getBodyAsString(), this, params, response)); + } + public CurrencyListResponse list() throws ChargebeeException { Response response = listRaw(); return CurrencyListResponse.fromJson(response.getBodyAsString(), this, null, response); } + + public CompletableFuture listAsync() { + + return getAsync("/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 22fcbe72..a59c4ed1 100644 --- a/src/main/java/com/chargebee/v4/services/CustomerEntitlementService.java +++ b/src/main/java/com/chargebee/v4/services/CustomerEntitlementService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.customerEntitlement.params.CustomerEntitlementEntitlementsForCustomerParams; @@ -101,4 +102,29 @@ public CustomerEntitlementEntitlementsForCustomerResponse entitlementsForCustome return CustomerEntitlementEntitlementsForCustomerResponse.fromJson( response.getBodyAsString(), this, null, customerId, response); } + + public CompletableFuture + entitlementsForCustomerAsync( + String customerId, CustomerEntitlementEntitlementsForCustomerParams params) { + String path = + buildPathWithParams( + "/customers/{customer-id}/customer_entitlements", "customer-id", customerId); + return getAsync(path, params != null ? params.toQueryParams() : null) + .thenApply( + response -> + CustomerEntitlementEntitlementsForCustomerResponse.fromJson( + response.getBodyAsString(), this, params, customerId, response)); + } + + public CompletableFuture + entitlementsForCustomerAsync(String customerId) { + String path = + buildPathWithParams( + "/customers/{customer-id}/customer_entitlements", "customer-id", customerId); + return getAsync(path, null) + .thenApply( + response -> + CustomerEntitlementEntitlementsForCustomerResponse.fromJson( + response.getBodyAsString(), this, null, customerId, response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/CustomerService.java b/src/main/java/com/chargebee/v4/services/CustomerService.java index 30e53484..86f35bb2 100644 --- a/src/main/java/com/chargebee/v4/services/CustomerService.java +++ b/src/main/java/com/chargebee/v4/services/CustomerService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.customer.params.CustomerDeleteParams; @@ -169,11 +170,27 @@ public CustomerDeleteResponse delete(String customerId, CustomerDeleteParams par return CustomerDeleteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteAsync( + String customerId, CustomerDeleteParams params) { + String path = buildPathWithParams("/customers/{customer-id}/delete", "customer-id", customerId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> CustomerDeleteResponse.fromJson(response.getBodyAsString(), response)); + } + public CustomerDeleteResponse delete(String customerId) throws ChargebeeException { Response response = deleteRaw(customerId); return CustomerDeleteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteAsync(String customerId) { + String path = buildPathWithParams("/customers/{customer-id}/delete", "customer-id", customerId); + + return postAsync(path, null) + .thenApply( + response -> CustomerDeleteResponse.fromJson(response.getBodyAsString(), response)); + } + /** addPromotionalCredits a customer (executes immediately) - returns raw Response. */ Response addPromotionalCreditsRaw(String customerId) throws ChargebeeException { String path = @@ -213,6 +230,18 @@ public CustomerAddPromotionalCreditsResponse addPromotionalCredits( return CustomerAddPromotionalCreditsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture addPromotionalCreditsAsync( + String customerId, CustomerAddPromotionalCreditsParams params) { + String path = + buildPathWithParams( + "/customers/{customer-id}/add_promotional_credits", "customer-id", customerId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + CustomerAddPromotionalCreditsResponse.fromJson( + response.getBodyAsString(), response)); + } + /** relationships a customer (executes immediately) - returns raw Response. */ Response relationshipsRaw(String customerId) throws ChargebeeException { String path = @@ -246,11 +275,31 @@ public CustomerRelationshipsResponse relationships( return CustomerRelationshipsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture relationshipsAsync( + String customerId, CustomerRelationshipsParams params) { + String path = + buildPathWithParams("/customers/{customer-id}/relationships", "customer-id", customerId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + CustomerRelationshipsResponse.fromJson(response.getBodyAsString(), response)); + } + public CustomerRelationshipsResponse relationships(String customerId) throws ChargebeeException { Response response = relationshipsRaw(customerId); return CustomerRelationshipsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture relationshipsAsync(String customerId) { + String path = + buildPathWithParams("/customers/{customer-id}/relationships", "customer-id", customerId); + + return postAsync(path, null) + .thenApply( + response -> + CustomerRelationshipsResponse.fromJson(response.getBodyAsString(), response)); + } + /** deleteRelationship a customer (executes immediately) - returns raw Response. */ Response deleteRelationshipRaw(String customerId) throws ChargebeeException { String path = @@ -266,6 +315,18 @@ public CustomerDeleteRelationshipResponse deleteRelationship(String customerId) return CustomerDeleteRelationshipResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteRelationshipAsync( + String customerId) { + String path = + buildPathWithParams( + "/customers/{customer-id}/delete_relationship", "customer-id", customerId); + + return postAsync(path, null) + .thenApply( + response -> + CustomerDeleteRelationshipResponse.fromJson(response.getBodyAsString(), response)); + } + /** deleteContact a customer (executes immediately) - returns raw Response. */ Response deleteContactRaw(String customerId) throws ChargebeeException { String path = @@ -299,11 +360,31 @@ public CustomerDeleteContactResponse deleteContact( return CustomerDeleteContactResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteContactAsync( + String customerId, CustomerDeleteContactParams params) { + String path = + buildPathWithParams("/customers/{customer-id}/delete_contact", "customer-id", customerId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + CustomerDeleteContactResponse.fromJson(response.getBodyAsString(), response)); + } + public CustomerDeleteContactResponse deleteContact(String customerId) throws ChargebeeException { Response response = deleteContactRaw(customerId); return CustomerDeleteContactResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteContactAsync(String customerId) { + String path = + buildPathWithParams("/customers/{customer-id}/delete_contact", "customer-id", customerId); + + return postAsync(path, null) + .thenApply( + response -> + CustomerDeleteContactResponse.fromJson(response.getBodyAsString(), response)); + } + /** assignPaymentRole a customer (executes immediately) - returns raw Response. */ Response assignPaymentRoleRaw(String customerId) throws ChargebeeException { String path = @@ -342,6 +423,17 @@ public CustomerAssignPaymentRoleResponse assignPaymentRole( return CustomerAssignPaymentRoleResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture assignPaymentRoleAsync( + String customerId, CustomerAssignPaymentRoleParams params) { + String path = + buildPathWithParams( + "/customers/{customer-id}/assign_payment_role", "customer-id", customerId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + CustomerAssignPaymentRoleResponse.fromJson(response.getBodyAsString(), response)); + } + /** move a customer using immutable params (executes immediately) - returns raw Response. */ Response moveRaw(CustomerMoveParams params) throws ChargebeeException { @@ -360,6 +452,12 @@ public CustomerMoveResponse move(CustomerMoveParams params) throws ChargebeeExce return CustomerMoveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture moveAsync(CustomerMoveParams params) { + + return postAsync("/customers/move", params != null ? params.toFormData() : null) + .thenApply(response -> CustomerMoveResponse.fromJson(response.getBodyAsString(), response)); + } + /** hierarchy a customer (executes immediately) - returns raw Response. */ Response hierarchyRaw(String customerId) throws ChargebeeException { String path = @@ -382,11 +480,29 @@ public CustomerHierarchyResponse hierarchy(String customerId, CustomerHierarchyP return CustomerHierarchyResponse.fromJson(response.getBodyAsString(), response); } + 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) + .thenApply( + response -> CustomerHierarchyResponse.fromJson(response.getBodyAsString(), response)); + } + public CustomerHierarchyResponse hierarchy(String customerId) throws ChargebeeException { Response response = hierarchyRaw(customerId); return CustomerHierarchyResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture hierarchyAsync(String customerId) { + String path = + buildPathWithParams("/customers/{customer-id}/hierarchy", "customer-id", customerId); + + return getAsync(path, null) + .thenApply( + response -> CustomerHierarchyResponse.fromJson(response.getBodyAsString(), response)); + } + /** updatePaymentMethod a customer (executes immediately) - returns raw Response. */ Response updatePaymentMethodRaw(String customerId) throws ChargebeeException { String path = @@ -425,12 +541,35 @@ public CustomerUpdatePaymentMethodResponse updatePaymentMethod( return CustomerUpdatePaymentMethodResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updatePaymentMethodAsync( + String customerId, CustomerUpdatePaymentMethodParams params) { + String path = + buildPathWithParams( + "/customers/{customer-id}/update_payment_method", "customer-id", customerId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + CustomerUpdatePaymentMethodResponse.fromJson(response.getBodyAsString(), response)); + } + public CustomerUpdatePaymentMethodResponse updatePaymentMethod(String customerId) throws ChargebeeException { Response response = updatePaymentMethodRaw(customerId); return CustomerUpdatePaymentMethodResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updatePaymentMethodAsync( + String customerId) { + String path = + buildPathWithParams( + "/customers/{customer-id}/update_payment_method", "customer-id", customerId); + + return postAsync(path, null) + .thenApply( + response -> + CustomerUpdatePaymentMethodResponse.fromJson(response.getBodyAsString(), response)); + } + /** retrieve a customer (executes immediately) - returns raw Response. */ Response retrieveRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}", "customer-id", customerId); @@ -443,6 +582,14 @@ public CustomerRetrieveResponse retrieve(String customerId) throws ChargebeeExce return CustomerRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String customerId) { + String path = buildPathWithParams("/customers/{customer-id}", "customer-id", customerId); + + return getAsync(path, null) + .thenApply( + response -> CustomerRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** update a customer (executes immediately) - returns raw Response. */ Response updateRaw(String customerId) throws ChargebeeException { String path = buildPathWithParams("/customers/{customer-id}", "customer-id", customerId); @@ -468,11 +615,27 @@ public CustomerUpdateResponse update(String customerId, CustomerUpdateParams par return CustomerUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync( + String customerId, CustomerUpdateParams params) { + String path = buildPathWithParams("/customers/{customer-id}", "customer-id", customerId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> CustomerUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + public CustomerUpdateResponse update(String customerId) throws ChargebeeException { Response response = updateRaw(customerId); return CustomerUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync(String customerId) { + String path = buildPathWithParams("/customers/{customer-id}", "customer-id", customerId); + + return postAsync(path, null) + .thenApply( + response -> CustomerUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + /** * listHierarchyDetail a customer using immutable params (executes immediately) - returns raw * Response. @@ -517,6 +680,28 @@ public CustomerListHierarchyDetailResponse listHierarchyDetail(String customerId response.getBodyAsString(), this, null, customerId, response); } + public CompletableFuture listHierarchyDetailAsync( + String customerId, CustomerListHierarchyDetailParams params) { + String path = + buildPathWithParams("/customers/{customer-id}/hierarchy_detail", "customer-id", customerId); + return getAsync(path, params != null ? params.toQueryParams() : null) + .thenApply( + response -> + CustomerListHierarchyDetailResponse.fromJson( + response.getBodyAsString(), this, params, customerId, response)); + } + + public CompletableFuture listHierarchyDetailAsync( + String customerId) { + String path = + buildPathWithParams("/customers/{customer-id}/hierarchy_detail", "customer-id", customerId); + return getAsync(path, null) + .thenApply( + response -> + CustomerListHierarchyDetailResponse.fromJson( + response.getBodyAsString(), this, null, customerId, response)); + } + /** changeBillingDate a customer (executes immediately) - returns raw Response. */ Response changeBillingDateRaw(String customerId) throws ChargebeeException { String path = @@ -555,12 +740,35 @@ public CustomerChangeBillingDateResponse changeBillingDate( return CustomerChangeBillingDateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture changeBillingDateAsync( + String customerId, CustomerChangeBillingDateParams params) { + String path = + buildPathWithParams( + "/customers/{customer-id}/change_billing_date", "customer-id", customerId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + CustomerChangeBillingDateResponse.fromJson(response.getBodyAsString(), response)); + } + public CustomerChangeBillingDateResponse changeBillingDate(String customerId) throws ChargebeeException { Response response = changeBillingDateRaw(customerId); return CustomerChangeBillingDateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture changeBillingDateAsync( + String customerId) { + String path = + buildPathWithParams( + "/customers/{customer-id}/change_billing_date", "customer-id", customerId); + + return postAsync(path, null) + .thenApply( + response -> + CustomerChangeBillingDateResponse.fromJson(response.getBodyAsString(), response)); + } + /** list a customer using immutable params (executes immediately) - returns raw Response. */ Response listRaw(CustomerListParams params) throws ChargebeeException { @@ -585,12 +793,28 @@ public CustomerListResponse list(CustomerListParams params) throws ChargebeeExce return CustomerListResponse.fromJson(response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync(CustomerListParams params) { + + return getAsync("/customers", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + CustomerListResponse.fromJson(response.getBodyAsString(), this, params, response)); + } + public CustomerListResponse list() throws ChargebeeException { Response response = listRaw(); return CustomerListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/customers", null) + .thenApply( + response -> + CustomerListResponse.fromJson(response.getBodyAsString(), this, null, response)); + } + /** create a customer using immutable params (executes immediately) - returns raw Response. */ Response createRaw(CustomerCreateParams params) throws ChargebeeException { @@ -609,6 +833,13 @@ public CustomerCreateResponse create(CustomerCreateParams params) throws Chargeb return CustomerCreateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createAsync(CustomerCreateParams params) { + + return postAsync("/customers", params != null ? params.toFormData() : null) + .thenApply( + response -> CustomerCreateResponse.fromJson(response.getBodyAsString(), response)); + } + /** addContact a customer (executes immediately) - returns raw Response. */ Response addContactRaw(String customerId) throws ChargebeeException { String path = @@ -638,11 +869,29 @@ public CustomerAddContactResponse addContact(String customerId, CustomerAddConta return CustomerAddContactResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture addContactAsync( + String customerId, CustomerAddContactParams params) { + String path = + buildPathWithParams("/customers/{customer-id}/add_contact", "customer-id", customerId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> CustomerAddContactResponse.fromJson(response.getBodyAsString(), response)); + } + public CustomerAddContactResponse addContact(String customerId) throws ChargebeeException { Response response = addContactRaw(customerId); return CustomerAddContactResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture addContactAsync(String customerId) { + String path = + buildPathWithParams("/customers/{customer-id}/add_contact", "customer-id", customerId); + + return postAsync(path, null) + .thenApply( + response -> CustomerAddContactResponse.fromJson(response.getBodyAsString(), response)); + } + /** * contactsForCustomer a customer using immutable params (executes immediately) - returns raw * Response. @@ -687,6 +936,28 @@ public ContactsForCustomerResponse contactsForCustomer(String customerId) response.getBodyAsString(), this, null, customerId, response); } + 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) + .thenApply( + response -> + ContactsForCustomerResponse.fromJson( + response.getBodyAsString(), this, params, customerId, response)); + } + + public CompletableFuture contactsForCustomerAsync( + String customerId) { + String path = + buildPathWithParams("/customers/{customer-id}/contacts", "customer-id", customerId); + return getAsync(path, null) + .thenApply( + response -> + ContactsForCustomerResponse.fromJson( + response.getBodyAsString(), this, null, customerId, response)); + } + /** deductPromotionalCredits a customer (executes immediately) - returns raw Response. */ Response deductPromotionalCreditsRaw(String customerId) throws ChargebeeException { String path = @@ -726,6 +997,18 @@ public CustomerDeductPromotionalCreditsResponse deductPromotionalCredits( return CustomerDeductPromotionalCreditsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deductPromotionalCreditsAsync( + String customerId, CustomerDeductPromotionalCreditsParams params) { + String path = + buildPathWithParams( + "/customers/{customer-id}/deduct_promotional_credits", "customer-id", customerId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + CustomerDeductPromotionalCreditsResponse.fromJson( + response.getBodyAsString(), response)); + } + /** clearPersonalData a customer (executes immediately) - returns raw Response. */ Response clearPersonalDataRaw(String customerId) throws ChargebeeException { String path = @@ -741,6 +1024,18 @@ public CustomerClearPersonalDataResponse clearPersonalData(String customerId) return CustomerClearPersonalDataResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture clearPersonalDataAsync( + String customerId) { + String path = + buildPathWithParams( + "/customers/{customer-id}/clear_personal_data", "customer-id", customerId); + + return postAsync(path, null) + .thenApply( + response -> + CustomerClearPersonalDataResponse.fromJson(response.getBodyAsString(), response)); + } + /** merge a customer using immutable params (executes immediately) - returns raw Response. */ Response mergeRaw(CustomerMergeParams params) throws ChargebeeException { @@ -759,6 +1054,13 @@ public CustomerMergeResponse merge(CustomerMergeParams params) throws ChargebeeE return CustomerMergeResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture mergeAsync(CustomerMergeParams params) { + + return postAsync("/customers/merge", params != null ? params.toFormData() : null) + .thenApply( + response -> CustomerMergeResponse.fromJson(response.getBodyAsString(), response)); + } + /** collectPayment a customer (executes immediately) - returns raw Response. */ Response collectPaymentRaw(String customerId) throws ChargebeeException { String path = @@ -792,12 +1094,32 @@ public CustomerCollectPaymentResponse collectPayment( return CustomerCollectPaymentResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture collectPaymentAsync( + String customerId, CustomerCollectPaymentParams params) { + String path = + buildPathWithParams("/customers/{customer-id}/collect_payment", "customer-id", customerId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + CustomerCollectPaymentResponse.fromJson(response.getBodyAsString(), response)); + } + public CustomerCollectPaymentResponse collectPayment(String customerId) throws ChargebeeException { Response response = collectPaymentRaw(customerId); return CustomerCollectPaymentResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture collectPaymentAsync(String customerId) { + String path = + buildPathWithParams("/customers/{customer-id}/collect_payment", "customer-id", customerId); + + return postAsync(path, null) + .thenApply( + response -> + CustomerCollectPaymentResponse.fromJson(response.getBodyAsString(), response)); + } + /** recordExcessPayment a customer (executes immediately) - returns raw Response. */ Response recordExcessPaymentRaw(String customerId) throws ChargebeeException { String path = @@ -836,12 +1158,35 @@ public CustomerRecordExcessPaymentResponse recordExcessPayment( return CustomerRecordExcessPaymentResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture recordExcessPaymentAsync( + String customerId, CustomerRecordExcessPaymentParams params) { + String path = + buildPathWithParams( + "/customers/{customer-id}/record_excess_payment", "customer-id", customerId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + CustomerRecordExcessPaymentResponse.fromJson(response.getBodyAsString(), response)); + } + public CustomerRecordExcessPaymentResponse recordExcessPayment(String customerId) throws ChargebeeException { Response response = recordExcessPaymentRaw(customerId); return CustomerRecordExcessPaymentResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture recordExcessPaymentAsync( + String customerId) { + String path = + buildPathWithParams( + "/customers/{customer-id}/record_excess_payment", "customer-id", customerId); + + return postAsync(path, null) + .thenApply( + response -> + CustomerRecordExcessPaymentResponse.fromJson(response.getBodyAsString(), response)); + } + /** setPromotionalCredits a customer (executes immediately) - returns raw Response. */ Response setPromotionalCreditsRaw(String customerId) throws ChargebeeException { String path = @@ -881,6 +1226,18 @@ public CustomerSetPromotionalCreditsResponse setPromotionalCredits( return CustomerSetPromotionalCreditsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture setPromotionalCreditsAsync( + String customerId, CustomerSetPromotionalCreditsParams params) { + String path = + buildPathWithParams( + "/customers/{customer-id}/set_promotional_credits", "customer-id", customerId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + CustomerSetPromotionalCreditsResponse.fromJson( + response.getBodyAsString(), response)); + } + /** updateContact a customer (executes immediately) - returns raw Response. */ Response updateContactRaw(String customerId) throws ChargebeeException { String path = @@ -914,11 +1271,31 @@ public CustomerUpdateContactResponse updateContact( return CustomerUpdateContactResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateContactAsync( + String customerId, CustomerUpdateContactParams params) { + String path = + buildPathWithParams("/customers/{customer-id}/update_contact", "customer-id", customerId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + CustomerUpdateContactResponse.fromJson(response.getBodyAsString(), response)); + } + public CustomerUpdateContactResponse updateContact(String customerId) throws ChargebeeException { Response response = updateContactRaw(customerId); return CustomerUpdateContactResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateContactAsync(String customerId) { + String path = + buildPathWithParams("/customers/{customer-id}/update_contact", "customer-id", customerId); + + return postAsync(path, null) + .thenApply( + response -> + CustomerUpdateContactResponse.fromJson(response.getBodyAsString(), response)); + } + /** updateHierarchySettings a customer (executes immediately) - returns raw Response. */ Response updateHierarchySettingsRaw(String customerId) throws ChargebeeException { String path = @@ -958,12 +1335,37 @@ public CustomerUpdateHierarchySettingsResponse updateHierarchySettings( return CustomerUpdateHierarchySettingsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateHierarchySettingsAsync( + String customerId, CustomerUpdateHierarchySettingsParams params) { + String path = + buildPathWithParams( + "/customers/{customer-id}/update_hierarchy_settings", "customer-id", customerId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + CustomerUpdateHierarchySettingsResponse.fromJson( + response.getBodyAsString(), response)); + } + public CustomerUpdateHierarchySettingsResponse updateHierarchySettings(String customerId) throws ChargebeeException { Response response = updateHierarchySettingsRaw(customerId); return CustomerUpdateHierarchySettingsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateHierarchySettingsAsync( + String customerId) { + String path = + buildPathWithParams( + "/customers/{customer-id}/update_hierarchy_settings", "customer-id", customerId); + + return postAsync(path, null) + .thenApply( + response -> + CustomerUpdateHierarchySettingsResponse.fromJson( + response.getBodyAsString(), response)); + } + /** updateBillingInfo a customer (executes immediately) - returns raw Response. */ Response updateBillingInfoRaw(String customerId) throws ChargebeeException { String path = @@ -1002,9 +1404,32 @@ public CustomerUpdateBillingInfoResponse updateBillingInfo( return CustomerUpdateBillingInfoResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateBillingInfoAsync( + String customerId, CustomerUpdateBillingInfoParams params) { + String path = + buildPathWithParams( + "/customers/{customer-id}/update_billing_info", "customer-id", customerId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + CustomerUpdateBillingInfoResponse.fromJson(response.getBodyAsString(), response)); + } + public CustomerUpdateBillingInfoResponse updateBillingInfo(String customerId) throws ChargebeeException { Response response = updateBillingInfoRaw(customerId); return CustomerUpdateBillingInfoResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture updateBillingInfoAsync( + String customerId) { + String path = + buildPathWithParams( + "/customers/{customer-id}/update_billing_info", "customer-id", customerId); + + return postAsync(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 787751f6..eae6ae23 100644 --- a/src/main/java/com/chargebee/v4/services/DifferentialPriceService.java +++ b/src/main/java/com/chargebee/v4/services/DifferentialPriceService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.differentialPrice.params.DifferentialPriceDeleteParams; @@ -111,6 +112,19 @@ public DifferentialPriceDeleteResponse delete( return DifferentialPriceDeleteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteAsync( + String differentialPriceId, DifferentialPriceDeleteParams params) { + String path = + buildPathWithParams( + "/differential_prices/{differential-price-id}/delete", + "differential-price-id", + differentialPriceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + DifferentialPriceDeleteResponse.fromJson(response.getBodyAsString(), response)); + } + /** create a differentialPrice (executes immediately) - returns raw Response. */ Response createRaw(String itemPriceId) throws ChargebeeException { String path = @@ -149,6 +163,17 @@ public DifferentialPriceCreateResponse create( return DifferentialPriceCreateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createAsync( + String itemPriceId, DifferentialPriceCreateParams params) { + String path = + buildPathWithParams( + "/item_prices/{item-price-id}/differential_prices", "item-price-id", itemPriceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + DifferentialPriceCreateResponse.fromJson(response.getBodyAsString(), response)); + } + /** * list a differentialPrice using immutable params (executes immediately) - returns raw Response. */ @@ -179,12 +204,31 @@ public DifferentialPriceListResponse list(DifferentialPriceListParams params) response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync( + DifferentialPriceListParams params) { + + return getAsync("/differential_prices", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + DifferentialPriceListResponse.fromJson( + response.getBodyAsString(), this, params, response)); + } + public DifferentialPriceListResponse list() throws ChargebeeException { Response response = listRaw(); return DifferentialPriceListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/differential_prices", null) + .thenApply( + response -> + DifferentialPriceListResponse.fromJson( + response.getBodyAsString(), this, null, response)); + } + /** retrieve a differentialPrice (executes immediately) - returns raw Response. */ Response retrieveRaw(String differentialPriceId) throws ChargebeeException { String path = @@ -217,12 +261,39 @@ public DifferentialPriceRetrieveResponse retrieve( return DifferentialPriceRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync( + String differentialPriceId, DifferentialPriceRetrieveParams params) { + String path = + buildPathWithParams( + "/differential_prices/{differential-price-id}", + "differential-price-id", + differentialPriceId); + return getAsync(path, params != null ? params.toQueryParams() : null) + .thenApply( + response -> + DifferentialPriceRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + public DifferentialPriceRetrieveResponse retrieve(String differentialPriceId) throws ChargebeeException { Response response = retrieveRaw(differentialPriceId); return DifferentialPriceRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync( + String differentialPriceId) { + String path = + buildPathWithParams( + "/differential_prices/{differential-price-id}", + "differential-price-id", + differentialPriceId); + + return getAsync(path, null) + .thenApply( + response -> + DifferentialPriceRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** update a differentialPrice (executes immediately) - returns raw Response. */ Response updateRaw(String differentialPriceId) throws ChargebeeException { String path = @@ -266,4 +337,17 @@ public DifferentialPriceUpdateResponse update( Response response = updateRaw(differentialPriceId, params); return DifferentialPriceUpdateResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture updateAsync( + String differentialPriceId, DifferentialPriceUpdateParams params) { + String path = + buildPathWithParams( + "/differential_prices/{differential-price-id}", + "differential-price-id", + differentialPriceId); + return postAsync(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 f5cae8c1..c1cf1b96 100644 --- a/src/main/java/com/chargebee/v4/services/EntitlementOverrideService.java +++ b/src/main/java/com/chargebee/v4/services/EntitlementOverrideService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.entitlementOverride.params.ListEntitlementOverrideForSubscriptionParams; @@ -113,6 +114,35 @@ public ListEntitlementOverrideForSubscriptionResponse listEntitlementOverrideFor response.getBodyAsString(), this, null, subscriptionId, response); } + public CompletableFuture + listEntitlementOverrideForSubscriptionAsync( + String subscriptionId, ListEntitlementOverrideForSubscriptionParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/entitlement_overrides", + "subscription-id", + subscriptionId); + return getAsync(path, params != null ? params.toQueryParams() : null) + .thenApply( + response -> + ListEntitlementOverrideForSubscriptionResponse.fromJson( + response.getBodyAsString(), this, params, subscriptionId, response)); + } + + public CompletableFuture + listEntitlementOverrideForSubscriptionAsync(String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/entitlement_overrides", + "subscription-id", + subscriptionId); + return getAsync(path, null) + .thenApply( + response -> + ListEntitlementOverrideForSubscriptionResponse.fromJson( + response.getBodyAsString(), this, null, subscriptionId, response)); + } + /** * addEntitlementOverrideForSubscription a entitlementOverride (executes immediately) - returns * raw Response. @@ -165,10 +195,40 @@ public AddEntitlementOverrideForSubscriptionResponse addEntitlementOverrideForSu response.getBodyAsString(), response); } + public CompletableFuture + addEntitlementOverrideForSubscriptionAsync( + String subscriptionId, AddEntitlementOverrideForSubscriptionParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/entitlement_overrides", + "subscription-id", + subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + AddEntitlementOverrideForSubscriptionResponse.fromJson( + response.getBodyAsString(), response)); + } + public AddEntitlementOverrideForSubscriptionResponse addEntitlementOverrideForSubscription( String subscriptionId) throws ChargebeeException { Response response = addEntitlementOverrideForSubscriptionRaw(subscriptionId); return AddEntitlementOverrideForSubscriptionResponse.fromJson( response.getBodyAsString(), response); } + + public CompletableFuture + addEntitlementOverrideForSubscriptionAsync(String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/entitlement_overrides", + "subscription-id", + subscriptionId); + + return postAsync(path, null) + .thenApply( + response -> + AddEntitlementOverrideForSubscriptionResponse.fromJson( + response.getBodyAsString(), response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/EntitlementService.java b/src/main/java/com/chargebee/v4/services/EntitlementService.java index 3ec7663f..f30f6ee1 100644 --- a/src/main/java/com/chargebee/v4/services/EntitlementService.java +++ b/src/main/java/com/chargebee/v4/services/EntitlementService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.entitlement.params.EntitlementListParams; @@ -78,12 +79,29 @@ public EntitlementListResponse list(EntitlementListParams params) throws Chargeb return EntitlementListResponse.fromJson(response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync(EntitlementListParams params) { + + return getAsync("/entitlements", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + EntitlementListResponse.fromJson( + response.getBodyAsString(), this, params, response)); + } + public EntitlementListResponse list() throws ChargebeeException { Response response = listRaw(); return EntitlementListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/entitlements", null) + .thenApply( + response -> + EntitlementListResponse.fromJson(response.getBodyAsString(), this, null, response)); + } + /** create a entitlement using immutable params (executes immediately) - returns raw Response. */ Response createRaw(EntitlementCreateParams params) throws ChargebeeException { @@ -102,4 +120,11 @@ public EntitlementCreateResponse create(EntitlementCreateParams params) return EntitlementCreateResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture createAsync(EntitlementCreateParams params) { + + return postAsync("/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 2a0dd879..121e2c2f 100644 --- a/src/main/java/com/chargebee/v4/services/EstimateService.java +++ b/src/main/java/com/chargebee/v4/services/EstimateService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.estimate.params.RenewalEstimateParams; @@ -151,11 +152,31 @@ public RenewalEstimateResponse renewalEstimate( return RenewalEstimateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture renewalEstimateAsync( + String subscriptionId, RenewalEstimateParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/renewal_estimate", "subscription-id", subscriptionId); + return getAsync(path, params != null ? params.toQueryParams() : null) + .thenApply( + response -> RenewalEstimateResponse.fromJson(response.getBodyAsString(), response)); + } + public RenewalEstimateResponse renewalEstimate(String subscriptionId) throws ChargebeeException { Response response = renewalEstimateRaw(subscriptionId); return RenewalEstimateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture renewalEstimateAsync(String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/renewal_estimate", "subscription-id", subscriptionId); + + return getAsync(path, null) + .thenApply( + response -> RenewalEstimateResponse.fromJson(response.getBodyAsString(), response)); + } + /** * createSubscriptionItemEstimate a estimate using immutable params (executes immediately) - * returns raw Response. @@ -183,6 +204,17 @@ public CreateSubscriptionItemEstimateResponse createSubscriptionItemEstimate( return CreateSubscriptionItemEstimateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture + createSubscriptionItemEstimateAsync(CreateSubscriptionItemEstimateParams params) { + + return postAsync( + "/estimates/create_subscription_for_items", params != null ? params.toFormData() : null) + .thenApply( + response -> + CreateSubscriptionItemEstimateResponse.fromJson( + response.getBodyAsString(), response)); + } + /** * paymentSchedules a estimate using immutable params (executes immediately) - returns raw * Response. @@ -208,6 +240,15 @@ public EstimatePaymentSchedulesResponse paymentSchedules(EstimatePaymentSchedule return EstimatePaymentSchedulesResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture paymentSchedulesAsync( + EstimatePaymentSchedulesParams params) { + + return postAsync("/estimates/payment_schedules", params != null ? params.toFormData() : null) + .thenApply( + response -> + EstimatePaymentSchedulesResponse.fromJson(response.getBodyAsString(), response)); + } + /** cancelSubscriptionForItems a estimate (executes immediately) - returns raw Response. */ Response cancelSubscriptionForItemsRaw(String subscriptionId) throws ChargebeeException { String path = @@ -256,6 +297,21 @@ public EstimateCancelSubscriptionForItemsResponse cancelSubscriptionForItems( response.getBodyAsString(), response); } + public CompletableFuture + cancelSubscriptionForItemsAsync( + String subscriptionId, EstimateCancelSubscriptionForItemsParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/cancel_subscription_for_items_estimate", + "subscription-id", + subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + EstimateCancelSubscriptionForItemsResponse.fromJson( + response.getBodyAsString(), response)); + } + public EstimateCancelSubscriptionForItemsResponse cancelSubscriptionForItems( String subscriptionId) throws ChargebeeException { Response response = cancelSubscriptionForItemsRaw(subscriptionId); @@ -263,6 +319,21 @@ public EstimateCancelSubscriptionForItemsResponse cancelSubscriptionForItems( response.getBodyAsString(), response); } + public CompletableFuture + cancelSubscriptionForItemsAsync(String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/cancel_subscription_for_items_estimate", + "subscription-id", + subscriptionId); + + return postAsync(path, null) + .thenApply( + response -> + EstimateCancelSubscriptionForItemsResponse.fromJson( + response.getBodyAsString(), response)); + } + /** resumeSubscription a estimate (executes immediately) - returns raw Response. */ Response resumeSubscriptionRaw(String subscriptionId) throws ChargebeeException { String path = @@ -308,12 +379,39 @@ public EstimateResumeSubscriptionResponse resumeSubscription( return EstimateResumeSubscriptionResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture resumeSubscriptionAsync( + String subscriptionId, EstimateResumeSubscriptionParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/resume_subscription_estimate", + "subscription-id", + subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + EstimateResumeSubscriptionResponse.fromJson(response.getBodyAsString(), response)); + } + public EstimateResumeSubscriptionResponse resumeSubscription(String subscriptionId) throws ChargebeeException { Response response = resumeSubscriptionRaw(subscriptionId); return EstimateResumeSubscriptionResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture resumeSubscriptionAsync( + String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/resume_subscription_estimate", + "subscription-id", + subscriptionId); + + return postAsync(path, null) + .thenApply( + response -> + EstimateResumeSubscriptionResponse.fromJson(response.getBodyAsString(), response)); + } + /** * createInvoiceForItems a estimate using immutable params (executes immediately) - returns raw * Response. @@ -340,6 +438,17 @@ public EstimateCreateInvoiceForItemsResponse createInvoiceForItems( return EstimateCreateInvoiceForItemsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createInvoiceForItemsAsync( + EstimateCreateInvoiceForItemsParams params) { + + return postAsync( + "/estimates/create_invoice_for_items", params != null ? params.toFormData() : null) + .thenApply( + response -> + EstimateCreateInvoiceForItemsResponse.fromJson( + response.getBodyAsString(), response)); + } + /** * giftSubscriptionForItems a estimate using immutable params (executes immediately) - returns raw * Response. @@ -367,6 +476,17 @@ public EstimateGiftSubscriptionForItemsResponse giftSubscriptionForItems( return EstimateGiftSubscriptionForItemsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture giftSubscriptionForItemsAsync( + EstimateGiftSubscriptionForItemsParams params) { + + return postAsync( + "/estimates/gift_subscription_for_items", params != null ? params.toFormData() : null) + .thenApply( + response -> + EstimateGiftSubscriptionForItemsResponse.fromJson( + response.getBodyAsString(), response)); + } + /** * updateSubscriptionForItems a estimate using immutable params (executes immediately) - returns * raw Response. @@ -395,6 +515,17 @@ public EstimateUpdateSubscriptionForItemsResponse updateSubscriptionForItems( response.getBodyAsString(), response); } + public CompletableFuture + updateSubscriptionForItemsAsync(EstimateUpdateSubscriptionForItemsParams params) { + + return postAsync( + "/estimates/update_subscription_for_items", params != null ? params.toFormData() : null) + .thenApply( + response -> + EstimateUpdateSubscriptionForItemsResponse.fromJson( + response.getBodyAsString(), response)); + } + /** upcomingInvoicesEstimate a estimate (executes immediately) - returns raw Response. */ Response upcomingInvoicesEstimateRaw(String customerId) throws ChargebeeException { String path = @@ -410,6 +541,18 @@ public UpcomingInvoicesEstimateResponse upcomingInvoicesEstimate(String customer return UpcomingInvoicesEstimateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture upcomingInvoicesEstimateAsync( + String customerId) { + String path = + buildPathWithParams( + "/customers/{customer-id}/upcoming_invoices_estimate", "customer-id", customerId); + + return getAsync(path, null) + .thenApply( + response -> + UpcomingInvoicesEstimateResponse.fromJson(response.getBodyAsString(), response)); + } + /** regenerateInvoiceEstimate a estimate (executes immediately) - returns raw Response. */ Response regenerateInvoiceEstimateRaw(String subscriptionId) throws ChargebeeException { String path = @@ -455,12 +598,39 @@ public RegenerateInvoiceEstimateResponse regenerateInvoiceEstimate( return RegenerateInvoiceEstimateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture regenerateInvoiceEstimateAsync( + String subscriptionId, RegenerateInvoiceEstimateParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/regenerate_invoice_estimate", + "subscription-id", + subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + RegenerateInvoiceEstimateResponse.fromJson(response.getBodyAsString(), response)); + } + public RegenerateInvoiceEstimateResponse regenerateInvoiceEstimate(String subscriptionId) throws ChargebeeException { Response response = regenerateInvoiceEstimateRaw(subscriptionId); return RegenerateInvoiceEstimateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture regenerateInvoiceEstimateAsync( + String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/regenerate_invoice_estimate", + "subscription-id", + subscriptionId); + + return postAsync(path, null) + .thenApply( + response -> + RegenerateInvoiceEstimateResponse.fromJson(response.getBodyAsString(), response)); + } + /** * createSubscriptionItemForCustomerEstimate a estimate (executes immediately) - returns raw * Response. @@ -514,6 +684,21 @@ Response createSubscriptionItemForCustomerEstimateRaw(String customerId, String response.getBodyAsString(), response); } + public CompletableFuture + createSubscriptionItemForCustomerEstimateAsync( + String customerId, CreateSubscriptionItemForCustomerEstimateParams params) { + String path = + buildPathWithParams( + "/customers/{customer-id}/create_subscription_for_items_estimate", + "customer-id", + customerId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + CreateSubscriptionItemForCustomerEstimateResponse.fromJson( + response.getBodyAsString(), response)); + } + public CreateSubscriptionItemForCustomerEstimateResponse createSubscriptionItemForCustomerEstimate(String customerId) throws ChargebeeException { Response response = createSubscriptionItemForCustomerEstimateRaw(customerId); @@ -521,6 +706,21 @@ Response createSubscriptionItemForCustomerEstimateRaw(String customerId, String response.getBodyAsString(), response); } + public CompletableFuture + createSubscriptionItemForCustomerEstimateAsync(String customerId) { + String path = + buildPathWithParams( + "/customers/{customer-id}/create_subscription_for_items_estimate", + "customer-id", + customerId); + + return postAsync(path, null) + .thenApply( + response -> + CreateSubscriptionItemForCustomerEstimateResponse.fromJson( + response.getBodyAsString(), response)); + } + /** changeTermEnd a estimate (executes immediately) - returns raw Response. */ Response changeTermEndRaw(String subscriptionId) throws ChargebeeException { String path = @@ -563,6 +763,19 @@ public EstimateChangeTermEndResponse changeTermEnd( return EstimateChangeTermEndResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture changeTermEndAsync( + String subscriptionId, EstimateChangeTermEndParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/change_term_end_estimate", + "subscription-id", + subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + EstimateChangeTermEndResponse.fromJson(response.getBodyAsString(), response)); + } + /** pauseSubscription a estimate (executes immediately) - returns raw Response. */ Response pauseSubscriptionRaw(String subscriptionId) throws ChargebeeException { String path = @@ -608,12 +821,39 @@ public EstimatePauseSubscriptionResponse pauseSubscription( return EstimatePauseSubscriptionResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture pauseSubscriptionAsync( + String subscriptionId, EstimatePauseSubscriptionParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/pause_subscription_estimate", + "subscription-id", + subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + EstimatePauseSubscriptionResponse.fromJson(response.getBodyAsString(), response)); + } + public EstimatePauseSubscriptionResponse pauseSubscription(String subscriptionId) throws ChargebeeException { Response response = pauseSubscriptionRaw(subscriptionId); return EstimatePauseSubscriptionResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture pauseSubscriptionAsync( + String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/pause_subscription_estimate", + "subscription-id", + subscriptionId); + + return postAsync(path, null) + .thenApply( + response -> + EstimatePauseSubscriptionResponse.fromJson(response.getBodyAsString(), response)); + } + /** advanceInvoiceEstimate a estimate (executes immediately) - returns raw Response. */ Response advanceInvoiceEstimateRaw(String subscriptionId) throws ChargebeeException { String path = @@ -659,12 +899,39 @@ public AdvanceInvoiceEstimateResponse advanceInvoiceEstimate( return AdvanceInvoiceEstimateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture advanceInvoiceEstimateAsync( + String subscriptionId, AdvanceInvoiceEstimateParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/advance_invoice_estimate", + "subscription-id", + subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + AdvanceInvoiceEstimateResponse.fromJson(response.getBodyAsString(), response)); + } + public AdvanceInvoiceEstimateResponse advanceInvoiceEstimate(String subscriptionId) throws ChargebeeException { Response response = advanceInvoiceEstimateRaw(subscriptionId); return AdvanceInvoiceEstimateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture advanceInvoiceEstimateAsync( + String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/advance_invoice_estimate", + "subscription-id", + subscriptionId); + + return postAsync(path, null) + .thenApply( + response -> + AdvanceInvoiceEstimateResponse.fromJson(response.getBodyAsString(), response)); + } + /** * updateSubscription a estimate using immutable params (executes immediately) - returns raw * Response. @@ -691,6 +958,15 @@ public EstimateUpdateSubscriptionResponse updateSubscription( return EstimateUpdateSubscriptionResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateSubscriptionAsync( + EstimateUpdateSubscriptionParams params) { + + return postAsync("/estimates/update_subscription", params != null ? params.toFormData() : null) + .thenApply( + response -> + EstimateUpdateSubscriptionResponse.fromJson(response.getBodyAsString(), response)); + } + /** * giftSubscription a estimate using immutable params (executes immediately) - returns raw * Response. @@ -716,6 +992,15 @@ public EstimateGiftSubscriptionResponse giftSubscription(EstimateGiftSubscriptio return EstimateGiftSubscriptionResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture giftSubscriptionAsync( + EstimateGiftSubscriptionParams params) { + + return postAsync("/estimates/gift_subscription", params != null ? params.toFormData() : null) + .thenApply( + response -> + EstimateGiftSubscriptionResponse.fromJson(response.getBodyAsString(), response)); + } + /** * createSubscriptionForCustomerEstimate a estimate (executes immediately) - returns raw Response. */ @@ -748,6 +1033,19 @@ public CreateSubscriptionForCustomerEstimateResponse createSubscriptionForCustom response.getBodyAsString(), response); } + public CompletableFuture + createSubscriptionForCustomerEstimateAsync( + String customerId, CreateSubscriptionForCustomerEstimateParams params) { + String path = + buildPathWithParams( + "/customers/{customer-id}/create_subscription_estimate", "customer-id", customerId); + return getAsync(path, params != null ? params.toQueryParams() : null) + .thenApply( + response -> + CreateSubscriptionForCustomerEstimateResponse.fromJson( + response.getBodyAsString(), response)); + } + public CreateSubscriptionForCustomerEstimateResponse createSubscriptionForCustomerEstimate( String customerId) throws ChargebeeException { Response response = createSubscriptionForCustomerEstimateRaw(customerId); @@ -755,6 +1053,19 @@ public CreateSubscriptionForCustomerEstimateResponse createSubscriptionForCustom response.getBodyAsString(), response); } + public CompletableFuture + createSubscriptionForCustomerEstimateAsync(String customerId) { + String path = + buildPathWithParams( + "/customers/{customer-id}/create_subscription_estimate", "customer-id", customerId); + + return getAsync(path, null) + .thenApply( + response -> + CreateSubscriptionForCustomerEstimateResponse.fromJson( + response.getBodyAsString(), response)); + } + /** * createSubscription a estimate using immutable params (executes immediately) - returns raw * Response. @@ -781,6 +1092,15 @@ public EstimateCreateSubscriptionResponse createSubscription( return EstimateCreateSubscriptionResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createSubscriptionAsync( + EstimateCreateSubscriptionParams params) { + + return postAsync("/estimates/create_subscription", params != null ? params.toFormData() : null) + .thenApply( + response -> + EstimateCreateSubscriptionResponse.fromJson(response.getBodyAsString(), response)); + } + /** * createInvoice a estimate using immutable params (executes immediately) - returns raw Response. */ @@ -804,6 +1124,15 @@ public EstimateCreateInvoiceResponse createInvoice(EstimateCreateInvoiceParams p return EstimateCreateInvoiceResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createInvoiceAsync( + EstimateCreateInvoiceParams params) { + + return postAsync("/estimates/create_invoice", params != null ? params.toFormData() : null) + .thenApply( + response -> + EstimateCreateInvoiceResponse.fromJson(response.getBodyAsString(), response)); + } + /** cancelSubscription a estimate (executes immediately) - returns raw Response. */ Response cancelSubscriptionRaw(String subscriptionId) throws ChargebeeException { String path = @@ -849,9 +1178,36 @@ public EstimateCancelSubscriptionResponse cancelSubscription( return EstimateCancelSubscriptionResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture cancelSubscriptionAsync( + String subscriptionId, EstimateCancelSubscriptionParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/cancel_subscription_estimate", + "subscription-id", + subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + EstimateCancelSubscriptionResponse.fromJson(response.getBodyAsString(), response)); + } + public EstimateCancelSubscriptionResponse cancelSubscription(String subscriptionId) throws ChargebeeException { Response response = cancelSubscriptionRaw(subscriptionId); return EstimateCancelSubscriptionResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture cancelSubscriptionAsync( + String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/cancel_subscription_estimate", + "subscription-id", + subscriptionId); + + return postAsync(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 aeefc022..491ef2c5 100644 --- a/src/main/java/com/chargebee/v4/services/EventService.java +++ b/src/main/java/com/chargebee/v4/services/EventService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.event.params.EventListParams; @@ -76,12 +77,28 @@ public EventListResponse list(EventListParams params) throws ChargebeeException return EventListResponse.fromJson(response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync(EventListParams params) { + + return getAsync("/events", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + EventListResponse.fromJson(response.getBodyAsString(), this, params, response)); + } + public EventListResponse list() throws ChargebeeException { Response response = listRaw(); return EventListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/events", null) + .thenApply( + response -> + EventListResponse.fromJson(response.getBodyAsString(), this, null, response)); + } + /** retrieve a event (executes immediately) - returns raw Response. */ Response retrieveRaw(String eventId) throws ChargebeeException { String path = buildPathWithParams("/events/{event-id}", "event-id", eventId); @@ -93,4 +110,12 @@ public EventRetrieveResponse retrieve(String eventId) throws ChargebeeException Response response = retrieveRaw(eventId); return EventRetrieveResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture retrieveAsync(String eventId) { + String path = buildPathWithParams("/events/{event-id}", "event-id", eventId); + + return getAsync(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 6cd8f2f6..4d1d9067 100644 --- a/src/main/java/com/chargebee/v4/services/ExportService.java +++ b/src/main/java/com/chargebee/v4/services/ExportService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.export.params.ExportCustomersParams; @@ -134,6 +135,13 @@ public ExportCustomersResponse customers(ExportCustomersParams params) throws Ch return ExportCustomersResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture customersAsync(ExportCustomersParams params) { + + return postAsync("/exports/customers", params != null ? params.toFormData() : null) + .thenApply( + response -> ExportCustomersResponse.fromJson(response.getBodyAsString(), response)); + } + /** * attachedItems a export using immutable params (executes immediately) - returns raw Response. */ @@ -157,6 +165,14 @@ public ExportAttachedItemsResponse attachedItems(ExportAttachedItemsParams param return ExportAttachedItemsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture attachedItemsAsync( + ExportAttachedItemsParams params) { + + return postAsync("/exports/attached_items", params != null ? params.toFormData() : null) + .thenApply( + response -> ExportAttachedItemsResponse.fromJson(response.getBodyAsString(), response)); + } + /** transactions a export using immutable params (executes immediately) - returns raw Response. */ Response transactionsRaw(ExportTransactionsParams params) throws ChargebeeException { @@ -176,6 +192,14 @@ public ExportTransactionsResponse transactions(ExportTransactionsParams params) return ExportTransactionsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture transactionsAsync( + ExportTransactionsParams params) { + + return postAsync("/exports/transactions", params != null ? params.toFormData() : null) + .thenApply( + response -> ExportTransactionsResponse.fromJson(response.getBodyAsString(), response)); + } + /** * differentialPrices a export using immutable params (executes immediately) - returns raw * Response. @@ -201,6 +225,15 @@ public ExportDifferentialPricesResponse differentialPrices(ExportDifferentialPri return ExportDifferentialPricesResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture differentialPricesAsync( + ExportDifferentialPricesParams params) { + + return postAsync("/exports/differential_prices", params != null ? params.toFormData() : null) + .thenApply( + response -> + ExportDifferentialPricesResponse.fromJson(response.getBodyAsString(), response)); + } + /** itemFamilies a export using immutable params (executes immediately) - returns raw Response. */ Response itemFamiliesRaw(ExportItemFamiliesParams params) throws ChargebeeException { @@ -220,6 +253,14 @@ public ExportItemFamiliesResponse itemFamilies(ExportItemFamiliesParams params) return ExportItemFamiliesResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture itemFamiliesAsync( + ExportItemFamiliesParams params) { + + return postAsync("/exports/item_families", params != null ? params.toFormData() : null) + .thenApply( + response -> ExportItemFamiliesResponse.fromJson(response.getBodyAsString(), response)); + } + /** invoices a export using immutable params (executes immediately) - returns raw Response. */ Response invoicesRaw(ExportInvoicesParams params) throws ChargebeeException { @@ -238,6 +279,13 @@ public ExportInvoicesResponse invoices(ExportInvoicesParams params) throws Charg return ExportInvoicesResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture invoicesAsync(ExportInvoicesParams params) { + + return postAsync("/exports/invoices", params != null ? params.toFormData() : null) + .thenApply( + response -> ExportInvoicesResponse.fromJson(response.getBodyAsString(), response)); + } + /** retrieve a export (executes immediately) - returns raw Response. */ Response retrieveRaw(String exportId) throws ChargebeeException { String path = buildPathWithParams("/exports/{export-id}", "export-id", exportId); @@ -250,6 +298,14 @@ public ExportRetrieveResponse retrieve(String exportId) throws ChargebeeExceptio return ExportRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String exportId) { + String path = buildPathWithParams("/exports/{export-id}", "export-id", exportId); + + return getAsync(path, null) + .thenApply( + response -> ExportRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** * priceVariants a export using immutable params (executes immediately) - returns raw Response. */ @@ -273,6 +329,14 @@ public ExportPriceVariantsResponse priceVariants(ExportPriceVariantsParams param return ExportPriceVariantsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture priceVariantsAsync( + ExportPriceVariantsParams params) { + + return postAsync("/exports/price_variants", params != null ? params.toFormData() : null) + .thenApply( + response -> ExportPriceVariantsResponse.fromJson(response.getBodyAsString(), response)); + } + /** items a export using immutable params (executes immediately) - returns raw Response. */ Response itemsRaw(ExportItemsParams params) throws ChargebeeException { @@ -291,6 +355,12 @@ public ExportItemsResponse items(ExportItemsParams params) throws ChargebeeExcep return ExportItemsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture itemsAsync(ExportItemsParams params) { + + return postAsync("/exports/items", params != null ? params.toFormData() : null) + .thenApply(response -> ExportItemsResponse.fromJson(response.getBodyAsString(), response)); + } + /** * deferredRevenue a export using immutable params (executes immediately) - returns raw Response. */ @@ -314,6 +384,15 @@ public ExportDeferredRevenueResponse deferredRevenue(ExportDeferredRevenueParams return ExportDeferredRevenueResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deferredRevenueAsync( + ExportDeferredRevenueParams params) { + + return postAsync("/exports/deferred_revenue", params != null ? params.toFormData() : null) + .thenApply( + response -> + ExportDeferredRevenueResponse.fromJson(response.getBodyAsString(), response)); + } + /** * revenueRecognition a export using immutable params (executes immediately) - returns raw * Response. @@ -339,6 +418,15 @@ public ExportRevenueRecognitionResponse revenueRecognition(ExportRevenueRecognit return ExportRevenueRecognitionResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture revenueRecognitionAsync( + ExportRevenueRecognitionParams params) { + + return postAsync("/exports/revenue_recognition", params != null ? params.toFormData() : null) + .thenApply( + response -> + ExportRevenueRecognitionResponse.fromJson(response.getBodyAsString(), response)); + } + /** creditNotes a export using immutable params (executes immediately) - returns raw Response. */ Response creditNotesRaw(ExportCreditNotesParams params) throws ChargebeeException { @@ -358,6 +446,14 @@ public ExportCreditNotesResponse creditNotes(ExportCreditNotesParams params) return ExportCreditNotesResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture creditNotesAsync( + ExportCreditNotesParams params) { + + return postAsync("/exports/credit_notes", params != null ? params.toFormData() : null) + .thenApply( + response -> ExportCreditNotesResponse.fromJson(response.getBodyAsString(), response)); + } + /** coupons a export using immutable params (executes immediately) - returns raw Response. */ Response couponsRaw(ExportCouponsParams params) throws ChargebeeException { @@ -376,6 +472,13 @@ public ExportCouponsResponse coupons(ExportCouponsParams params) throws Chargebe return ExportCouponsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture couponsAsync(ExportCouponsParams params) { + + return postAsync("/exports/coupons", params != null ? params.toFormData() : null) + .thenApply( + response -> ExportCouponsResponse.fromJson(response.getBodyAsString(), response)); + } + /** orders a export using immutable params (executes immediately) - returns raw Response. */ Response ordersRaw(ExportOrdersParams params) throws ChargebeeException { @@ -394,6 +497,12 @@ public ExportOrdersResponse orders(ExportOrdersParams params) throws ChargebeeEx return ExportOrdersResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture ordersAsync(ExportOrdersParams params) { + + return postAsync("/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 { @@ -413,6 +522,14 @@ public ExportItemPricesResponse itemPrices(ExportItemPricesParams params) return ExportItemPricesResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture itemPricesAsync( + ExportItemPricesParams params) { + + return postAsync("/exports/item_prices", params != null ? params.toFormData() : null) + .thenApply( + response -> ExportItemPricesResponse.fromJson(response.getBodyAsString(), response)); + } + /** * subscriptions a export using immutable params (executes immediately) - returns raw Response. */ @@ -436,6 +553,14 @@ public ExportSubscriptionsResponse subscriptions(ExportSubscriptionsParams param return ExportSubscriptionsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture subscriptionsAsync( + ExportSubscriptionsParams params) { + + return postAsync("/exports/subscriptions", params != null ? params.toFormData() : null) + .thenApply( + response -> ExportSubscriptionsResponse.fromJson(response.getBodyAsString(), response)); + } + /** addons a export using immutable params (executes immediately) - returns raw Response. */ Response addonsRaw(ExportAddonsParams params) throws ChargebeeException { @@ -454,6 +579,12 @@ public ExportAddonsResponse addons(ExportAddonsParams params) throws ChargebeeEx return ExportAddonsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture addonsAsync(ExportAddonsParams params) { + + return postAsync("/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 { @@ -472,6 +603,12 @@ public ExportPlansResponse plans(ExportPlansParams params) throws ChargebeeExcep return ExportPlansResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture plansAsync(ExportPlansParams params) { + + return postAsync("/exports/plans", params != null ? params.toFormData() : null) + .thenApply(response -> ExportPlansResponse.fromJson(response.getBodyAsString(), response)); + } + // === Export Utility Methods === /** diff --git a/src/main/java/com/chargebee/v4/services/FeatureService.java b/src/main/java/com/chargebee/v4/services/FeatureService.java index 77f2bc5c..08ac9b2a 100644 --- a/src/main/java/com/chargebee/v4/services/FeatureService.java +++ b/src/main/java/com/chargebee/v4/services/FeatureService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.feature.params.FeatureListParams; @@ -92,12 +93,28 @@ public FeatureListResponse list(FeatureListParams params) throws ChargebeeExcept return FeatureListResponse.fromJson(response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync(FeatureListParams params) { + + return getAsync("/features", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + FeatureListResponse.fromJson(response.getBodyAsString(), this, params, response)); + } + public FeatureListResponse list() throws ChargebeeException { Response response = listRaw(); return FeatureListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/features", null) + .thenApply( + response -> + FeatureListResponse.fromJson(response.getBodyAsString(), this, null, response)); + } + /** create a feature using immutable params (executes immediately) - returns raw Response. */ Response createRaw(FeatureCreateParams params) throws ChargebeeException { @@ -116,6 +133,13 @@ public FeatureCreateResponse create(FeatureCreateParams params) throws Chargebee return FeatureCreateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createAsync(FeatureCreateParams params) { + + return postAsync("/features", params != null ? params.toFormData() : null) + .thenApply( + response -> FeatureCreateResponse.fromJson(response.getBodyAsString(), response)); + } + /** delete a feature (executes immediately) - returns raw Response. */ Response deleteRaw(String featureId) throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}/delete", "feature-id", featureId); @@ -128,6 +152,14 @@ public FeatureDeleteResponse delete(String featureId) throws ChargebeeException return FeatureDeleteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteAsync(String featureId) { + String path = buildPathWithParams("/features/{feature-id}/delete", "feature-id", featureId); + + return postAsync(path, null) + .thenApply( + response -> FeatureDeleteResponse.fromJson(response.getBodyAsString(), response)); + } + /** retrieve a feature (executes immediately) - returns raw Response. */ Response retrieveRaw(String featureId) throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}", "feature-id", featureId); @@ -140,6 +172,14 @@ public FeatureRetrieveResponse retrieve(String featureId) throws ChargebeeExcept return FeatureRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String featureId) { + String path = buildPathWithParams("/features/{feature-id}", "feature-id", featureId); + + return getAsync(path, null) + .thenApply( + response -> FeatureRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** update a feature (executes immediately) - returns raw Response. */ Response updateRaw(String featureId) throws ChargebeeException { String path = buildPathWithParams("/features/{feature-id}", "feature-id", featureId); @@ -165,11 +205,27 @@ public FeatureUpdateResponse update(String featureId, FeatureUpdateParams params return FeatureUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync( + String featureId, FeatureUpdateParams params) { + String path = buildPathWithParams("/features/{feature-id}", "feature-id", featureId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> FeatureUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + public FeatureUpdateResponse update(String featureId) throws ChargebeeException { Response response = updateRaw(featureId); return FeatureUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync(String featureId) { + String path = buildPathWithParams("/features/{feature-id}", "feature-id", featureId); + + return postAsync(path, null) + .thenApply( + response -> FeatureUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + /** archive a feature (executes immediately) - returns raw Response. */ Response archiveRaw(String featureId) throws ChargebeeException { String path = @@ -183,6 +239,15 @@ public FeatureArchiveResponse archive(String featureId) throws ChargebeeExceptio return FeatureArchiveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture archiveAsync(String featureId) { + String path = + buildPathWithParams("/features/{feature-id}/archive_command", "feature-id", featureId); + + return postAsync(path, null) + .thenApply( + response -> FeatureArchiveResponse.fromJson(response.getBodyAsString(), response)); + } + /** activate a feature (executes immediately) - returns raw Response. */ Response activateRaw(String featureId) throws ChargebeeException { String path = @@ -196,6 +261,15 @@ public FeatureActivateResponse activate(String featureId) throws ChargebeeExcept return FeatureActivateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture activateAsync(String featureId) { + String path = + buildPathWithParams("/features/{feature-id}/activate_command", "feature-id", featureId); + + return postAsync(path, null) + .thenApply( + response -> FeatureActivateResponse.fromJson(response.getBodyAsString(), response)); + } + /** reactivate a feature (executes immediately) - returns raw Response. */ Response reactivateRaw(String featureId) throws ChargebeeException { String path = @@ -208,4 +282,13 @@ public FeatureReactivateResponse reactivate(String featureId) throws ChargebeeEx Response response = reactivateRaw(featureId); return FeatureReactivateResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture reactivateAsync(String featureId) { + String path = + buildPathWithParams("/features/{feature-id}/reactivate_command", "feature-id", featureId); + + return postAsync(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 9ec7159f..59c40bfd 100644 --- a/src/main/java/com/chargebee/v4/services/FullExportService.java +++ b/src/main/java/com/chargebee/v4/services/FullExportService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.fullExport.params.FullExportStatusParams; @@ -67,4 +68,11 @@ public FullExportStatusResponse status(FullExportStatusParams params) throws Cha return FullExportStatusResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture statusAsync(FullExportStatusParams params) { + + return getAsync("/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 f166d853..849648ac 100644 --- a/src/main/java/com/chargebee/v4/services/GiftService.java +++ b/src/main/java/com/chargebee/v4/services/GiftService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.gift.params.GiftCreateForItemsParams; @@ -87,6 +88,14 @@ public GiftCreateForItemsResponse createForItems(GiftCreateForItemsParams params return GiftCreateForItemsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createForItemsAsync( + GiftCreateForItemsParams params) { + + return postAsync("/gifts/create_for_items", params != null ? params.toFormData() : null) + .thenApply( + response -> GiftCreateForItemsResponse.fromJson(response.getBodyAsString(), response)); + } + /** cancel a gift (executes immediately) - returns raw Response. */ Response cancelRaw(String giftId) throws ChargebeeException { String path = buildPathWithParams("/gifts/{gift-id}/cancel", "gift-id", giftId); @@ -99,6 +108,13 @@ public GiftCancelResponse cancel(String giftId) throws ChargebeeException { return GiftCancelResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture cancelAsync(String giftId) { + String path = buildPathWithParams("/gifts/{gift-id}/cancel", "gift-id", giftId); + + return postAsync(path, null) + .thenApply(response -> GiftCancelResponse.fromJson(response.getBodyAsString(), response)); + } + /** updateGift a gift (executes immediately) - returns raw Response. */ Response updateGiftRaw(String giftId) throws ChargebeeException { String path = buildPathWithParams("/gifts/{gift-id}/update_gift", "gift-id", giftId); @@ -124,6 +140,13 @@ public UpdateGiftResponse updateGift(String giftId, UpdateGiftParams params) return UpdateGiftResponse.fromJson(response.getBodyAsString(), response); } + 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)); + } + /** list a gift using immutable params (executes immediately) - returns raw Response. */ Response listRaw(GiftListParams params) throws ChargebeeException { @@ -148,12 +171,28 @@ public GiftListResponse list(GiftListParams params) throws ChargebeeException { return GiftListResponse.fromJson(response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync(GiftListParams params) { + + return getAsync("/gifts", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + GiftListResponse.fromJson(response.getBodyAsString(), this, params, response)); + } + public GiftListResponse list() throws ChargebeeException { Response response = listRaw(); return GiftListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/gifts", null) + .thenApply( + response -> + GiftListResponse.fromJson(response.getBodyAsString(), this, null, response)); + } + /** create a gift using immutable params (executes immediately) - returns raw Response. */ Response createRaw(GiftCreateParams params) throws ChargebeeException { @@ -172,6 +211,12 @@ public GiftCreateResponse create(GiftCreateParams params) throws ChargebeeExcept return GiftCreateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createAsync(GiftCreateParams params) { + + return postAsync("/gifts", params != null ? params.toFormData() : null) + .thenApply(response -> GiftCreateResponse.fromJson(response.getBodyAsString(), response)); + } + /** retrieve a gift (executes immediately) - returns raw Response. */ Response retrieveRaw(String giftId) throws ChargebeeException { String path = buildPathWithParams("/gifts/{gift-id}", "gift-id", giftId); @@ -184,6 +229,13 @@ public GiftRetrieveResponse retrieve(String giftId) throws ChargebeeException { return GiftRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String giftId) { + String path = buildPathWithParams("/gifts/{gift-id}", "gift-id", giftId); + + return getAsync(path, null) + .thenApply(response -> GiftRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** claim a gift (executes immediately) - returns raw Response. */ Response claimRaw(String giftId) throws ChargebeeException { String path = buildPathWithParams("/gifts/{gift-id}/claim", "gift-id", giftId); @@ -195,4 +247,11 @@ public GiftClaimResponse claim(String giftId) throws ChargebeeException { Response response = claimRaw(giftId); return GiftClaimResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture claimAsync(String giftId) { + String path = buildPathWithParams("/gifts/{gift-id}/claim", "gift-id", giftId); + + return postAsync(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 ebbac288..f5e9e6e4 100644 --- a/src/main/java/com/chargebee/v4/services/HostedPageService.java +++ b/src/main/java/com/chargebee/v4/services/HostedPageService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.hostedPage.params.HostedPageCheckoutOneTimeForItemsParams; @@ -157,6 +158,18 @@ public HostedPageCheckoutOneTimeForItemsResponse checkoutOneTimeForItems( return HostedPageCheckoutOneTimeForItemsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture checkoutOneTimeForItemsAsync( + HostedPageCheckoutOneTimeForItemsParams params) { + + return postAsync( + "/hosted_pages/checkout_one_time_for_items", + params != null ? params.toFormData() : null) + .thenApply( + response -> + HostedPageCheckoutOneTimeForItemsResponse.fromJson( + response.getBodyAsString(), response)); + } + /** * updatePaymentMethod a hostedPage using immutable params (executes immediately) - returns raw * Response. @@ -183,6 +196,17 @@ public HostedPageUpdatePaymentMethodResponse updatePaymentMethod( return HostedPageUpdatePaymentMethodResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updatePaymentMethodAsync( + HostedPageUpdatePaymentMethodParams params) { + + return postAsync( + "/hosted_pages/update_payment_method", params != null ? params.toFormData() : null) + .thenApply( + response -> + HostedPageUpdatePaymentMethodResponse.fromJson( + response.getBodyAsString(), response)); + } + /** * updateCard a hostedPage using immutable params (executes immediately) - returns raw Response. */ @@ -206,6 +230,15 @@ public HostedPageUpdateCardResponse updateCard(HostedPageUpdateCardParams params return HostedPageUpdateCardResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateCardAsync( + HostedPageUpdateCardParams params) { + + return postAsync("/hosted_pages/update_card", params != null ? params.toFormData() : null) + .thenApply( + response -> + HostedPageUpdateCardResponse.fromJson(response.getBodyAsString(), response)); + } + /** * extendSubscription a hostedPage using immutable params (executes immediately) - returns raw * Response. @@ -232,6 +265,17 @@ public HostedPageExtendSubscriptionResponse extendSubscription( return HostedPageExtendSubscriptionResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture extendSubscriptionAsync( + HostedPageExtendSubscriptionParams params) { + + return postAsync( + "/hosted_pages/extend_subscription", params != null ? params.toFormData() : null) + .thenApply( + response -> + HostedPageExtendSubscriptionResponse.fromJson( + response.getBodyAsString(), response)); + } + /** events a hostedPage using immutable params (executes immediately) - returns raw Response. */ Response eventsRaw(HostedPageEventsParams params) throws ChargebeeException { @@ -250,6 +294,13 @@ public HostedPageEventsResponse events(HostedPageEventsParams params) throws Cha return HostedPageEventsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture eventsAsync(HostedPageEventsParams params) { + + return postAsync("/hosted_pages/events", params != null ? params.toFormData() : null) + .thenApply( + response -> HostedPageEventsResponse.fromJson(response.getBodyAsString(), response)); + } + /** * checkoutGiftForItems a hostedPage using immutable params (executes immediately) - returns raw * Response. @@ -277,6 +328,17 @@ public HostedPageCheckoutGiftForItemsResponse checkoutGiftForItems( return HostedPageCheckoutGiftForItemsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture checkoutGiftForItemsAsync( + HostedPageCheckoutGiftForItemsParams params) { + + return postAsync( + "/hosted_pages/checkout_gift_for_items", params != null ? params.toFormData() : null) + .thenApply( + response -> + HostedPageCheckoutGiftForItemsResponse.fromJson( + response.getBodyAsString(), response)); + } + /** list a hostedPage using immutable params (executes immediately) - returns raw Response. */ Response listRaw(HostedPageListParams params) throws ChargebeeException { @@ -301,12 +363,29 @@ public HostedPageListResponse list(HostedPageListParams params) throws Chargebee return HostedPageListResponse.fromJson(response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync(HostedPageListParams params) { + + return getAsync("/hosted_pages", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + HostedPageListResponse.fromJson( + response.getBodyAsString(), this, params, response)); + } + public HostedPageListResponse list() throws ChargebeeException { Response response = listRaw(); return HostedPageListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/hosted_pages", null) + .thenApply( + response -> + HostedPageListResponse.fromJson(response.getBodyAsString(), this, null, response)); + } + /** * viewVoucher a hostedPage using immutable params (executes immediately) - returns raw Response. */ @@ -330,6 +409,15 @@ public HostedPageViewVoucherResponse viewVoucher(HostedPageViewVoucherParams par return HostedPageViewVoucherResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture viewVoucherAsync( + HostedPageViewVoucherParams params) { + + return postAsync("/hosted_pages/view_voucher", params != null ? params.toFormData() : null) + .thenApply( + response -> + HostedPageViewVoucherResponse.fromJson(response.getBodyAsString(), response)); + } + /** * collectNow a hostedPage using immutable params (executes immediately) - returns raw Response. */ @@ -353,6 +441,15 @@ public HostedPageCollectNowResponse collectNow(HostedPageCollectNowParams params return HostedPageCollectNowResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture collectNowAsync( + HostedPageCollectNowParams params) { + + return postAsync("/hosted_pages/collect_now", params != null ? params.toFormData() : null) + .thenApply( + response -> + HostedPageCollectNowResponse.fromJson(response.getBodyAsString(), response)); + } + /** * acceptQuote a hostedPage using immutable params (executes immediately) - returns raw Response. */ @@ -376,6 +473,15 @@ public HostedPageAcceptQuoteResponse acceptQuote(HostedPageAcceptQuoteParams par return HostedPageAcceptQuoteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture acceptQuoteAsync( + HostedPageAcceptQuoteParams params) { + + return postAsync("/hosted_pages/accept_quote", params != null ? params.toFormData() : null) + .thenApply( + response -> + HostedPageAcceptQuoteResponse.fromJson(response.getBodyAsString(), response)); + } + /** * checkoutNewForItems a hostedPage using immutable params (executes immediately) - returns raw * Response. @@ -403,6 +509,17 @@ public HostedPageCheckoutNewForItemsResponse checkoutNewForItems( return HostedPageCheckoutNewForItemsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture checkoutNewForItemsAsync( + HostedPageCheckoutNewForItemsParams params) { + + return postAsync( + "/hosted_pages/checkout_new_for_items", params != null ? params.toFormData() : null) + .thenApply( + response -> + HostedPageCheckoutNewForItemsResponse.fromJson( + response.getBodyAsString(), response)); + } + /** * claimGift a hostedPage using immutable params (executes immediately) - returns raw Response. */ @@ -426,6 +543,14 @@ public HostedPageClaimGiftResponse claimGift(HostedPageClaimGiftParams params) return HostedPageClaimGiftResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture claimGiftAsync( + HostedPageClaimGiftParams params) { + + return postAsync("/hosted_pages/claim_gift", params != null ? params.toFormData() : null) + .thenApply( + response -> HostedPageClaimGiftResponse.fromJson(response.getBodyAsString(), response)); + } + /** * checkoutExistingForItems a hostedPage using immutable params (executes immediately) - returns * raw Response. @@ -454,6 +579,18 @@ public HostedPageCheckoutExistingForItemsResponse checkoutExistingForItems( response.getBodyAsString(), response); } + public CompletableFuture + checkoutExistingForItemsAsync(HostedPageCheckoutExistingForItemsParams params) { + + return postAsync( + "/hosted_pages/checkout_existing_for_items", + params != null ? params.toFormData() : null) + .thenApply( + response -> + HostedPageCheckoutExistingForItemsResponse.fromJson( + response.getBodyAsString(), response)); + } + /** * preCancel a hostedPage using immutable params (executes immediately) - returns raw Response. */ @@ -477,6 +614,14 @@ public HostedPagePreCancelResponse preCancel(HostedPagePreCancelParams params) return HostedPagePreCancelResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture preCancelAsync( + HostedPagePreCancelParams params) { + + return postAsync("/hosted_pages/pre_cancel", params != null ? params.toFormData() : null) + .thenApply( + response -> HostedPagePreCancelResponse.fromJson(response.getBodyAsString(), response)); + } + /** acknowledge a hostedPage (executes immediately) - returns raw Response. */ Response acknowledgeRaw(String hostedPageId) throws ChargebeeException { String path = @@ -491,6 +636,17 @@ public HostedPageAcknowledgeResponse acknowledge(String hostedPageId) throws Cha return HostedPageAcknowledgeResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture acknowledgeAsync(String hostedPageId) { + String path = + buildPathWithParams( + "/hosted_pages/{hosted-page-id}/acknowledge", "hosted-page-id", hostedPageId); + + return postAsync(path, null) + .thenApply( + response -> + HostedPageAcknowledgeResponse.fromJson(response.getBodyAsString(), response)); + } + /** * retrieveAgreementPdf a hostedPage using immutable params (executes immediately) - returns raw * Response. @@ -518,6 +674,17 @@ public HostedPageRetrieveAgreementPdfResponse retrieveAgreementPdf( return HostedPageRetrieveAgreementPdfResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAgreementPdfAsync( + HostedPageRetrieveAgreementPdfParams params) { + + return postAsync( + "/hosted_pages/retrieve_agreement_pdf", params != null ? params.toFormData() : null) + .thenApply( + response -> + HostedPageRetrieveAgreementPdfResponse.fromJson( + response.getBodyAsString(), response)); + } + /** retrieve a hostedPage (executes immediately) - returns raw Response. */ Response retrieveRaw(String hostedPageId) throws ChargebeeException { String path = @@ -531,6 +698,15 @@ public HostedPageRetrieveResponse retrieve(String hostedPageId) throws Chargebee return HostedPageRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String hostedPageId) { + String path = + buildPathWithParams("/hosted_pages/{hosted-page-id}", "hosted-page-id", hostedPageId); + + return getAsync(path, null) + .thenApply( + response -> HostedPageRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** * managePaymentSources a hostedPage using immutable params (executes immediately) - returns raw * Response. @@ -558,6 +734,17 @@ public HostedPageManagePaymentSourcesResponse managePaymentSources( return HostedPageManagePaymentSourcesResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture managePaymentSourcesAsync( + HostedPageManagePaymentSourcesParams params) { + + return postAsync( + "/hosted_pages/manage_payment_sources", params != null ? params.toFormData() : null) + .thenApply( + response -> + HostedPageManagePaymentSourcesResponse.fromJson( + response.getBodyAsString(), response)); + } + /** * checkoutOneTime a hostedPage using immutable params (executes immediately) - returns raw * Response. @@ -583,6 +770,15 @@ public HostedPageCheckoutOneTimeResponse checkoutOneTime(HostedPageCheckoutOneTi return HostedPageCheckoutOneTimeResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture checkoutOneTimeAsync( + HostedPageCheckoutOneTimeParams params) { + + return postAsync("/hosted_pages/checkout_one_time", params != null ? params.toFormData() : null) + .thenApply( + response -> + HostedPageCheckoutOneTimeResponse.fromJson(response.getBodyAsString(), response)); + } + /** * checkoutNew a hostedPage using immutable params (executes immediately) - returns raw Response. */ @@ -606,6 +802,15 @@ public HostedPageCheckoutNewResponse checkoutNew(HostedPageCheckoutNewParams par return HostedPageCheckoutNewResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture checkoutNewAsync( + HostedPageCheckoutNewParams params) { + + return postAsync("/hosted_pages/checkout_new", params != null ? params.toFormData() : null) + .thenApply( + response -> + HostedPageCheckoutNewResponse.fromJson(response.getBodyAsString(), response)); + } + /** * checkoutGift a hostedPage using immutable params (executes immediately) - returns raw Response. */ @@ -629,6 +834,15 @@ public HostedPageCheckoutGiftResponse checkoutGift(HostedPageCheckoutGiftParams return HostedPageCheckoutGiftResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture checkoutGiftAsync( + HostedPageCheckoutGiftParams params) { + + return postAsync("/hosted_pages/checkout_gift", params != null ? params.toFormData() : null) + .thenApply( + response -> + HostedPageCheckoutGiftResponse.fromJson(response.getBodyAsString(), response)); + } + /** * checkoutExisting a hostedPage using immutable params (executes immediately) - returns raw * Response. @@ -653,4 +867,13 @@ public HostedPageCheckoutExistingResponse checkoutExisting( return HostedPageCheckoutExistingResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture checkoutExistingAsync( + HostedPageCheckoutExistingParams params) { + + return postAsync("/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 9f770447..8db6ebdb 100644 --- a/src/main/java/com/chargebee/v4/services/InAppSubscriptionService.java +++ b/src/main/java/com/chargebee/v4/services/InAppSubscriptionService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.inAppSubscription.params.InAppSubscriptionRetrieveStoreSubscriptionsParams; @@ -113,6 +114,21 @@ public InAppSubscriptionRetrieveStoreSubscriptionsResponse retrieveStoreSubscrip response.getBodyAsString(), response); } + public CompletableFuture + retrieveStoreSubscriptionsAsync( + String inAppSubscriptionAppId, InAppSubscriptionRetrieveStoreSubscriptionsParams params) { + String path = + buildPathWithParams( + "/in_app_subscriptions/{in-app-subscription-app-id}/retrieve", + "in-app-subscription-app-id", + inAppSubscriptionAppId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + InAppSubscriptionRetrieveStoreSubscriptionsResponse.fromJson( + response.getBodyAsString(), response)); + } + /** importReceipt a inAppSubscription (executes immediately) - returns raw Response. */ Response importReceiptRaw(String inAppSubscriptionAppId) throws ChargebeeException { String path = @@ -160,6 +176,20 @@ public InAppSubscriptionImportReceiptResponse importReceipt( return InAppSubscriptionImportReceiptResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture importReceiptAsync( + String inAppSubscriptionAppId, InAppSubscriptionImportReceiptParams params) { + String path = + buildPathWithParams( + "/in_app_subscriptions/{in-app-subscription-app-id}/import_receipt", + "in-app-subscription-app-id", + inAppSubscriptionAppId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + InAppSubscriptionImportReceiptResponse.fromJson( + response.getBodyAsString(), response)); + } + /** importSubscription a inAppSubscription (executes immediately) - returns raw Response. */ Response importSubscriptionRaw(String inAppSubscriptionAppId) throws ChargebeeException { String path = @@ -208,6 +238,20 @@ public InAppSubscriptionImportSubscriptionResponse importSubscription( response.getBodyAsString(), response); } + public CompletableFuture importSubscriptionAsync( + String inAppSubscriptionAppId, InAppSubscriptionImportSubscriptionParams params) { + String path = + buildPathWithParams( + "/in_app_subscriptions/{in-app-subscription-app-id}/import_subscription", + "in-app-subscription-app-id", + inAppSubscriptionAppId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + InAppSubscriptionImportSubscriptionResponse.fromJson( + response.getBodyAsString(), response)); + } + public InAppSubscriptionImportSubscriptionResponse importSubscription( String inAppSubscriptionAppId) throws ChargebeeException { Response response = importSubscriptionRaw(inAppSubscriptionAppId); @@ -215,6 +259,21 @@ public InAppSubscriptionImportSubscriptionResponse importSubscription( response.getBodyAsString(), response); } + public CompletableFuture importSubscriptionAsync( + String inAppSubscriptionAppId) { + String path = + buildPathWithParams( + "/in_app_subscriptions/{in-app-subscription-app-id}/import_subscription", + "in-app-subscription-app-id", + inAppSubscriptionAppId); + + return postAsync(path, null) + .thenApply( + response -> + InAppSubscriptionImportSubscriptionResponse.fromJson( + response.getBodyAsString(), response)); + } + /** processReceipt a inAppSubscription (executes immediately) - returns raw Response. */ Response processReceiptRaw(String inAppSubscriptionAppId) throws ChargebeeException { String path = @@ -261,4 +320,18 @@ public InAppSubscriptionProcessReceiptResponse processReceipt( Response response = processReceiptRaw(inAppSubscriptionAppId, params); return InAppSubscriptionProcessReceiptResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture processReceiptAsync( + String inAppSubscriptionAppId, InAppSubscriptionProcessReceiptParams params) { + String path = + buildPathWithParams( + "/in_app_subscriptions/{in-app-subscription-app-id}/process_purchase_command", + "in-app-subscription-app-id", + inAppSubscriptionAppId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + InAppSubscriptionProcessReceiptResponse.fromJson( + response.getBodyAsString(), response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/InvoiceService.java b/src/main/java/com/chargebee/v4/services/InvoiceService.java index 877c0cbf..edb3d86d 100644 --- a/src/main/java/com/chargebee/v4/services/InvoiceService.java +++ b/src/main/java/com/chargebee/v4/services/InvoiceService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.invoice.params.InvoiceDeleteLineItemsParams; @@ -233,12 +234,32 @@ public InvoiceDeleteLineItemsResponse deleteLineItems( return InvoiceDeleteLineItemsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteLineItemsAsync( + String invoiceId, InvoiceDeleteLineItemsParams params) { + String path = + buildPathWithParams("/invoices/{invoice-id}/delete_line_items", "invoice-id", invoiceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + InvoiceDeleteLineItemsResponse.fromJson(response.getBodyAsString(), response)); + } + public InvoiceDeleteLineItemsResponse deleteLineItems(String invoiceId) throws ChargebeeException { Response response = deleteLineItemsRaw(invoiceId); return InvoiceDeleteLineItemsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteLineItemsAsync(String invoiceId) { + String path = + buildPathWithParams("/invoices/{invoice-id}/delete_line_items", "invoice-id", invoiceId); + + return postAsync(path, null) + .thenApply( + response -> + InvoiceDeleteLineItemsResponse.fromJson(response.getBodyAsString(), response)); + } + /** removeCreditNote a invoice (executes immediately) - returns raw Response. */ Response removeCreditNoteRaw(String invoiceId) throws ChargebeeException { String path = @@ -274,12 +295,33 @@ public InvoiceRemoveCreditNoteResponse removeCreditNote( return InvoiceRemoveCreditNoteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture removeCreditNoteAsync( + String invoiceId, InvoiceRemoveCreditNoteParams params) { + String path = + buildPathWithParams("/invoices/{invoice-id}/remove_credit_note", "invoice-id", invoiceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + InvoiceRemoveCreditNoteResponse.fromJson(response.getBodyAsString(), response)); + } + public InvoiceRemoveCreditNoteResponse removeCreditNote(String invoiceId) throws ChargebeeException { Response response = removeCreditNoteRaw(invoiceId); return InvoiceRemoveCreditNoteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture removeCreditNoteAsync( + String invoiceId) { + String path = + buildPathWithParams("/invoices/{invoice-id}/remove_credit_note", "invoice-id", invoiceId); + + return postAsync(path, null) + .thenApply( + response -> + InvoiceRemoveCreditNoteResponse.fromJson(response.getBodyAsString(), response)); + } + /** removePayment a invoice (executes immediately) - returns raw Response. */ Response removePaymentRaw(String invoiceId) throws ChargebeeException { String path = @@ -313,11 +355,31 @@ public InvoiceRemovePaymentResponse removePayment( return InvoiceRemovePaymentResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture removePaymentAsync( + String invoiceId, InvoiceRemovePaymentParams params) { + String path = + buildPathWithParams("/invoices/{invoice-id}/remove_payment", "invoice-id", invoiceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + InvoiceRemovePaymentResponse.fromJson(response.getBodyAsString(), response)); + } + public InvoiceRemovePaymentResponse removePayment(String invoiceId) throws ChargebeeException { Response response = removePaymentRaw(invoiceId); return InvoiceRemovePaymentResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture removePaymentAsync(String invoiceId) { + String path = + buildPathWithParams("/invoices/{invoice-id}/remove_payment", "invoice-id", invoiceId); + + return postAsync(path, null) + .thenApply( + response -> + InvoiceRemovePaymentResponse.fromJson(response.getBodyAsString(), response)); + } + /** stopDunning a invoice (executes immediately) - returns raw Response. */ Response stopDunningRaw(String invoiceId) throws ChargebeeException { String path = @@ -347,11 +409,29 @@ public InvoiceStopDunningResponse stopDunning(String invoiceId, InvoiceStopDunni return InvoiceStopDunningResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture stopDunningAsync( + String invoiceId, InvoiceStopDunningParams params) { + String path = + buildPathWithParams("/invoices/{invoice-id}/stop_dunning", "invoice-id", invoiceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> InvoiceStopDunningResponse.fromJson(response.getBodyAsString(), response)); + } + public InvoiceStopDunningResponse stopDunning(String invoiceId) throws ChargebeeException { Response response = stopDunningRaw(invoiceId); return InvoiceStopDunningResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture stopDunningAsync(String invoiceId) { + String path = + buildPathWithParams("/invoices/{invoice-id}/stop_dunning", "invoice-id", invoiceId); + + return postAsync(path, null) + .thenApply( + response -> InvoiceStopDunningResponse.fromJson(response.getBodyAsString(), response)); + } + /** applyPayments a invoice (executes immediately) - returns raw Response. */ Response applyPaymentsRaw(String invoiceId) throws ChargebeeException { String path = @@ -385,11 +465,31 @@ public InvoiceApplyPaymentsResponse applyPayments( return InvoiceApplyPaymentsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture applyPaymentsAsync( + String invoiceId, InvoiceApplyPaymentsParams params) { + String path = + buildPathWithParams("/invoices/{invoice-id}/apply_payments", "invoice-id", invoiceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + InvoiceApplyPaymentsResponse.fromJson(response.getBodyAsString(), response)); + } + public InvoiceApplyPaymentsResponse applyPayments(String invoiceId) throws ChargebeeException { Response response = applyPaymentsRaw(invoiceId); return InvoiceApplyPaymentsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture applyPaymentsAsync(String invoiceId) { + String path = + buildPathWithParams("/invoices/{invoice-id}/apply_payments", "invoice-id", invoiceId); + + return postAsync(path, null) + .thenApply( + response -> + InvoiceApplyPaymentsResponse.fromJson(response.getBodyAsString(), response)); + } + /** applyPaymentScheduleScheme a invoice (executes immediately) - returns raw Response. */ Response applyPaymentScheduleSchemeRaw(String invoiceId) throws ChargebeeException { String path = @@ -429,6 +529,19 @@ public InvoiceApplyPaymentScheduleSchemeResponse applyPaymentScheduleScheme( return InvoiceApplyPaymentScheduleSchemeResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture + applyPaymentScheduleSchemeAsync( + String invoiceId, InvoiceApplyPaymentScheduleSchemeParams params) { + String path = + buildPathWithParams( + "/invoices/{invoice-id}/apply_payment_schedule_scheme", "invoice-id", invoiceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + InvoiceApplyPaymentScheduleSchemeResponse.fromJson( + response.getBodyAsString(), response)); + } + /** voidInvoice a invoice (executes immediately) - returns raw Response. */ Response voidInvoiceRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/void", "invoice-id", invoiceId); @@ -454,11 +567,25 @@ public VoidInvoiceResponse voidInvoice(String invoiceId, VoidInvoiceParams param return VoidInvoiceResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture voidInvoiceAsync( + String invoiceId, VoidInvoiceParams params) { + String path = buildPathWithParams("/invoices/{invoice-id}/void", "invoice-id", invoiceId); + return postAsync(path, params.toFormData()) + .thenApply(response -> VoidInvoiceResponse.fromJson(response.getBodyAsString(), response)); + } + public VoidInvoiceResponse voidInvoice(String invoiceId) throws ChargebeeException { Response response = voidInvoiceRaw(invoiceId); return VoidInvoiceResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture voidInvoiceAsync(String invoiceId) { + String path = buildPathWithParams("/invoices/{invoice-id}/void", "invoice-id", invoiceId); + + return postAsync(path, null) + .thenApply(response -> VoidInvoiceResponse.fromJson(response.getBodyAsString(), response)); + } + /** addCharge a invoice (executes immediately) - returns raw Response. */ Response addChargeRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/add_charge", "invoice-id", invoiceId); @@ -484,6 +611,14 @@ public InvoiceAddChargeResponse addCharge(String invoiceId, InvoiceAddChargePara return InvoiceAddChargeResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture addChargeAsync( + String invoiceId, InvoiceAddChargeParams params) { + String path = buildPathWithParams("/invoices/{invoice-id}/add_charge", "invoice-id", invoiceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> InvoiceAddChargeResponse.fromJson(response.getBodyAsString(), response)); + } + /** sendEinvoice a invoice (executes immediately) - returns raw Response. */ Response sendEinvoiceRaw(String invoiceId) throws ChargebeeException { String path = @@ -497,6 +632,14 @@ public SendEinvoiceResponse sendEinvoice(String invoiceId) throws ChargebeeExcep return SendEinvoiceResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture sendEinvoiceAsync(String invoiceId) { + String path = + buildPathWithParams("/invoices/{invoice-id}/send_einvoice", "invoice-id", invoiceId); + + return postAsync(path, null) + .thenApply(response -> SendEinvoiceResponse.fromJson(response.getBodyAsString(), response)); + } + /** paymentSchedules a invoice (executes immediately) - returns raw Response. */ Response paymentSchedulesRaw(String invoiceId) throws ChargebeeException { String path = @@ -511,6 +654,17 @@ public InvoicePaymentSchedulesResponse paymentSchedules(String invoiceId) return InvoicePaymentSchedulesResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture paymentSchedulesAsync( + String invoiceId) { + String path = + buildPathWithParams("/invoices/{invoice-id}/payment_schedules", "invoice-id", invoiceId); + + return getAsync(path, null) + .thenApply( + response -> + InvoicePaymentSchedulesResponse.fromJson(response.getBodyAsString(), response)); + } + /** writeOff a invoice (executes immediately) - returns raw Response. */ Response writeOffRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/write_off", "invoice-id", invoiceId); @@ -536,11 +690,27 @@ public InvoiceWriteOffResponse writeOff(String invoiceId, InvoiceWriteOffParams return InvoiceWriteOffResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture writeOffAsync( + String invoiceId, InvoiceWriteOffParams params) { + String path = buildPathWithParams("/invoices/{invoice-id}/write_off", "invoice-id", invoiceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> InvoiceWriteOffResponse.fromJson(response.getBodyAsString(), response)); + } + public InvoiceWriteOffResponse writeOff(String invoiceId) throws ChargebeeException { Response response = writeOffRaw(invoiceId); return InvoiceWriteOffResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture writeOffAsync(String invoiceId) { + String path = buildPathWithParams("/invoices/{invoice-id}/write_off", "invoice-id", invoiceId); + + return postAsync(path, null) + .thenApply( + response -> InvoiceWriteOffResponse.fromJson(response.getBodyAsString(), response)); + } + /** addChargeItem a invoice (executes immediately) - returns raw Response. */ Response addChargeItemRaw(String invoiceId) throws ChargebeeException { String path = @@ -574,11 +744,31 @@ public InvoiceAddChargeItemResponse addChargeItem( return InvoiceAddChargeItemResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture addChargeItemAsync( + String invoiceId, InvoiceAddChargeItemParams params) { + String path = + buildPathWithParams("/invoices/{invoice-id}/add_charge_item", "invoice-id", invoiceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + InvoiceAddChargeItemResponse.fromJson(response.getBodyAsString(), response)); + } + public InvoiceAddChargeItemResponse addChargeItem(String invoiceId) throws ChargebeeException { Response response = addChargeItemRaw(invoiceId); return InvoiceAddChargeItemResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture addChargeItemAsync(String invoiceId) { + String path = + buildPathWithParams("/invoices/{invoice-id}/add_charge_item", "invoice-id", invoiceId); + + return postAsync(path, null) + .thenApply( + response -> + InvoiceAddChargeItemResponse.fromJson(response.getBodyAsString(), response)); + } + /** pauseDunning a invoice (executes immediately) - returns raw Response. */ Response pauseDunningRaw(String invoiceId) throws ChargebeeException { String path = @@ -612,6 +802,15 @@ public InvoicePauseDunningResponse pauseDunning( return InvoicePauseDunningResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture pauseDunningAsync( + String invoiceId, InvoicePauseDunningParams params) { + String path = + buildPathWithParams("/invoices/{invoice-id}/pause_dunning", "invoice-id", invoiceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> InvoicePauseDunningResponse.fromJson(response.getBodyAsString(), response)); + } + /** list a invoice using immutable params (executes immediately) - returns raw Response. */ Response listRaw(InvoiceListParams params) throws ChargebeeException { @@ -636,12 +835,28 @@ public InvoiceListResponse list(InvoiceListParams params) throws ChargebeeExcept return InvoiceListResponse.fromJson(response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync(InvoiceListParams params) { + + return getAsync("/invoices", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + InvoiceListResponse.fromJson(response.getBodyAsString(), this, params, response)); + } + public InvoiceListResponse list() throws ChargebeeException { Response response = listRaw(); return InvoiceListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/invoices", null) + .thenApply( + response -> + InvoiceListResponse.fromJson(response.getBodyAsString(), this, null, response)); + } + /** create a invoice using immutable params (executes immediately) - returns raw Response. */ Response createRaw(InvoiceCreateParams params) throws ChargebeeException { @@ -660,6 +875,13 @@ public InvoiceCreateResponse create(InvoiceCreateParams params) throws Chargebee return InvoiceCreateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createAsync(InvoiceCreateParams params) { + + return postAsync("/invoices", params != null ? params.toFormData() : null) + .thenApply( + response -> InvoiceCreateResponse.fromJson(response.getBodyAsString(), response)); + } + /** close a invoice (executes immediately) - returns raw Response. */ Response closeRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/close", "invoice-id", invoiceId); @@ -685,11 +907,25 @@ public InvoiceCloseResponse close(String invoiceId, InvoiceCloseParams params) return InvoiceCloseResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture closeAsync( + String invoiceId, InvoiceCloseParams params) { + String path = buildPathWithParams("/invoices/{invoice-id}/close", "invoice-id", invoiceId); + return postAsync(path, params.toFormData()) + .thenApply(response -> InvoiceCloseResponse.fromJson(response.getBodyAsString(), response)); + } + public InvoiceCloseResponse close(String invoiceId) throws ChargebeeException { Response response = closeRaw(invoiceId); return InvoiceCloseResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture closeAsync(String invoiceId) { + String path = buildPathWithParams("/invoices/{invoice-id}/close", "invoice-id", invoiceId); + + return postAsync(path, null) + .thenApply(response -> InvoiceCloseResponse.fromJson(response.getBodyAsString(), response)); + } + /** applyCredits a invoice (executes immediately) - returns raw Response. */ Response applyCreditsRaw(String invoiceId) throws ChargebeeException { String path = @@ -723,11 +959,29 @@ public InvoiceApplyCreditsResponse applyCredits( return InvoiceApplyCreditsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture applyCreditsAsync( + String invoiceId, InvoiceApplyCreditsParams params) { + String path = + buildPathWithParams("/invoices/{invoice-id}/apply_credits", "invoice-id", invoiceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> InvoiceApplyCreditsResponse.fromJson(response.getBodyAsString(), response)); + } + public InvoiceApplyCreditsResponse applyCredits(String invoiceId) throws ChargebeeException { Response response = applyCreditsRaw(invoiceId); return InvoiceApplyCreditsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture applyCreditsAsync(String invoiceId) { + String path = + buildPathWithParams("/invoices/{invoice-id}/apply_credits", "invoice-id", invoiceId); + + return postAsync(path, null) + .thenApply( + response -> InvoiceApplyCreditsResponse.fromJson(response.getBodyAsString(), response)); + } + /** retrieve a invoice (executes immediately) - returns raw Response. */ Response retrieveRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}", "invoice-id", invoiceId); @@ -747,11 +1001,27 @@ public InvoiceRetrieveResponse retrieve(String invoiceId, InvoiceRetrieveParams return InvoiceRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync( + String invoiceId, InvoiceRetrieveParams params) { + String path = buildPathWithParams("/invoices/{invoice-id}", "invoice-id", invoiceId); + return getAsync(path, params != null ? params.toQueryParams() : null) + .thenApply( + response -> InvoiceRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + public InvoiceRetrieveResponse retrieve(String invoiceId) throws ChargebeeException { Response response = retrieveRaw(invoiceId); return InvoiceRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String invoiceId) { + String path = buildPathWithParams("/invoices/{invoice-id}", "invoice-id", invoiceId); + + return getAsync(path, null) + .thenApply( + response -> InvoiceRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** * createForChargeItem a invoice using immutable params (executes immediately) - returns raw * Response. @@ -778,6 +1048,16 @@ public InvoiceCreateForChargeItemResponse createForChargeItem( return InvoiceCreateForChargeItemResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createForChargeItemAsync( + InvoiceCreateForChargeItemParams params) { + + return postAsync( + "/invoices/create_for_charge_item", params != null ? params.toFormData() : null) + .thenApply( + response -> + InvoiceCreateForChargeItemResponse.fromJson(response.getBodyAsString(), response)); + } + /** * createForChargeItemsAndCharges a invoice using immutable params (executes immediately) - * returns raw Response. @@ -807,6 +1087,18 @@ public InvoiceCreateForChargeItemsAndChargesResponse createForChargeItemsAndChar response.getBodyAsString(), response); } + public CompletableFuture + createForChargeItemsAndChargesAsync(InvoiceCreateForChargeItemsAndChargesParams params) { + + return postAsync( + "/invoices/create_for_charge_items_and_charges", + params != null ? params.toFormData() : null) + .thenApply( + response -> + InvoiceCreateForChargeItemsAndChargesResponse.fromJson( + response.getBodyAsString(), response)); + } + /** deleteImported a invoice (executes immediately) - returns raw Response. */ Response deleteImportedRaw(String invoiceId) throws ChargebeeException { String path = @@ -840,11 +1132,31 @@ public InvoiceDeleteImportedResponse deleteImported( return InvoiceDeleteImportedResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteImportedAsync( + String invoiceId, InvoiceDeleteImportedParams params) { + String path = + buildPathWithParams("/invoices/{invoice-id}/delete_imported", "invoice-id", invoiceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + InvoiceDeleteImportedResponse.fromJson(response.getBodyAsString(), response)); + } + public InvoiceDeleteImportedResponse deleteImported(String invoiceId) throws ChargebeeException { Response response = deleteImportedRaw(invoiceId); return InvoiceDeleteImportedResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteImportedAsync(String invoiceId) { + String path = + buildPathWithParams("/invoices/{invoice-id}/delete_imported", "invoice-id", invoiceId); + + return postAsync(path, null) + .thenApply( + response -> + InvoiceDeleteImportedResponse.fromJson(response.getBodyAsString(), response)); + } + /** updateDetails a invoice (executes immediately) - returns raw Response. */ Response updateDetailsRaw(String invoiceId) throws ChargebeeException { String path = @@ -878,11 +1190,31 @@ public InvoiceUpdateDetailsResponse updateDetails( return InvoiceUpdateDetailsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateDetailsAsync( + String invoiceId, InvoiceUpdateDetailsParams params) { + String path = + buildPathWithParams("/invoices/{invoice-id}/update_details", "invoice-id", invoiceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + InvoiceUpdateDetailsResponse.fromJson(response.getBodyAsString(), response)); + } + public InvoiceUpdateDetailsResponse updateDetails(String invoiceId) throws ChargebeeException { Response response = updateDetailsRaw(invoiceId); return InvoiceUpdateDetailsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateDetailsAsync(String invoiceId) { + String path = + buildPathWithParams("/invoices/{invoice-id}/update_details", "invoice-id", invoiceId); + + return postAsync(path, null) + .thenApply( + response -> + InvoiceUpdateDetailsResponse.fromJson(response.getBodyAsString(), response)); + } + /** * invoicesForCustomer a invoice using immutable params (executes immediately) - returns raw * Response. @@ -925,6 +1257,28 @@ public InvoicesForCustomerResponse invoicesForCustomer(String customerId) response.getBodyAsString(), this, null, customerId, response); } + 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) + .thenApply( + response -> + InvoicesForCustomerResponse.fromJson( + response.getBodyAsString(), this, params, customerId, response)); + } + + public CompletableFuture invoicesForCustomerAsync( + String customerId) { + String path = + buildPathWithParams("/customers/{customer-id}/invoices", "customer-id", customerId); + return getAsync(path, null) + .thenApply( + response -> + InvoicesForCustomerResponse.fromJson( + response.getBodyAsString(), this, null, customerId, response)); + } + /** recordPayment a invoice (executes immediately) - returns raw Response. */ Response recordPaymentRaw(String invoiceId) throws ChargebeeException { String path = @@ -958,11 +1312,31 @@ public InvoiceRecordPaymentResponse recordPayment( return InvoiceRecordPaymentResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture recordPaymentAsync( + String invoiceId, InvoiceRecordPaymentParams params) { + String path = + buildPathWithParams("/invoices/{invoice-id}/record_payment", "invoice-id", invoiceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + InvoiceRecordPaymentResponse.fromJson(response.getBodyAsString(), response)); + } + public InvoiceRecordPaymentResponse recordPayment(String invoiceId) throws ChargebeeException { Response response = recordPaymentRaw(invoiceId); return InvoiceRecordPaymentResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture recordPaymentAsync(String invoiceId) { + String path = + buildPathWithParams("/invoices/{invoice-id}/record_payment", "invoice-id", invoiceId); + + return postAsync(path, null) + .thenApply( + response -> + InvoiceRecordPaymentResponse.fromJson(response.getBodyAsString(), response)); + } + /** delete a invoice (executes immediately) - returns raw Response. */ Response deleteRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/delete", "invoice-id", invoiceId); @@ -988,11 +1362,27 @@ public InvoiceDeleteResponse delete(String invoiceId, InvoiceDeleteParams params return InvoiceDeleteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteAsync( + String invoiceId, InvoiceDeleteParams params) { + String path = buildPathWithParams("/invoices/{invoice-id}/delete", "invoice-id", invoiceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> InvoiceDeleteResponse.fromJson(response.getBodyAsString(), response)); + } + public InvoiceDeleteResponse delete(String invoiceId) throws ChargebeeException { Response response = deleteRaw(invoiceId); return InvoiceDeleteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteAsync(String invoiceId) { + String path = buildPathWithParams("/invoices/{invoice-id}/delete", "invoice-id", invoiceId); + + return postAsync(path, null) + .thenApply( + response -> InvoiceDeleteResponse.fromJson(response.getBodyAsString(), response)); + } + /** * importInvoice a invoice using immutable params (executes immediately) - returns raw Response. */ @@ -1015,6 +1405,13 @@ public ImportInvoiceResponse importInvoice(ImportInvoiceParams params) throws Ch return ImportInvoiceResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture importInvoiceAsync(ImportInvoiceParams params) { + + return postAsync("/invoices/import_invoice", params != null ? params.toFormData() : null) + .thenApply( + response -> ImportInvoiceResponse.fromJson(response.getBodyAsString(), response)); + } + /** resumeDunning a invoice (executes immediately) - returns raw Response. */ Response resumeDunningRaw(String invoiceId) throws ChargebeeException { String path = @@ -1048,11 +1445,31 @@ public InvoiceResumeDunningResponse resumeDunning( return InvoiceResumeDunningResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture resumeDunningAsync( + String invoiceId, InvoiceResumeDunningParams params) { + String path = + buildPathWithParams("/invoices/{invoice-id}/resume_dunning", "invoice-id", invoiceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + InvoiceResumeDunningResponse.fromJson(response.getBodyAsString(), response)); + } + public InvoiceResumeDunningResponse resumeDunning(String invoiceId) throws ChargebeeException { Response response = resumeDunningRaw(invoiceId); return InvoiceResumeDunningResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture resumeDunningAsync(String invoiceId) { + String path = + buildPathWithParams("/invoices/{invoice-id}/resume_dunning", "invoice-id", invoiceId); + + return postAsync(path, null) + .thenApply( + response -> + InvoiceResumeDunningResponse.fromJson(response.getBodyAsString(), response)); + } + /** recordTaxWithheld a invoice (executes immediately) - returns raw Response. */ Response recordTaxWithheldRaw(String invoiceId) throws ChargebeeException { String path = @@ -1088,12 +1505,33 @@ public InvoiceRecordTaxWithheldResponse recordTaxWithheld( return InvoiceRecordTaxWithheldResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture recordTaxWithheldAsync( + String invoiceId, InvoiceRecordTaxWithheldParams params) { + String path = + buildPathWithParams("/invoices/{invoice-id}/record_tax_withheld", "invoice-id", invoiceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + InvoiceRecordTaxWithheldResponse.fromJson(response.getBodyAsString(), response)); + } + public InvoiceRecordTaxWithheldResponse recordTaxWithheld(String invoiceId) throws ChargebeeException { Response response = recordTaxWithheldRaw(invoiceId); return InvoiceRecordTaxWithheldResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture recordTaxWithheldAsync( + String invoiceId) { + String path = + buildPathWithParams("/invoices/{invoice-id}/record_tax_withheld", "invoice-id", invoiceId); + + return postAsync(path, null) + .thenApply( + response -> + InvoiceRecordTaxWithheldResponse.fromJson(response.getBodyAsString(), response)); + } + /** resendEinvoice a invoice (executes immediately) - returns raw Response. */ Response resendEinvoiceRaw(String invoiceId) throws ChargebeeException { String path = @@ -1107,6 +1545,15 @@ public ResendEinvoiceResponse resendEinvoice(String invoiceId) throws ChargebeeE return ResendEinvoiceResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture resendEinvoiceAsync(String invoiceId) { + String path = + buildPathWithParams("/invoices/{invoice-id}/resend_einvoice", "invoice-id", invoiceId); + + return postAsync(path, null) + .thenApply( + response -> ResendEinvoiceResponse.fromJson(response.getBodyAsString(), response)); + } + /** removeTaxWithheld a invoice (executes immediately) - returns raw Response. */ Response removeTaxWithheldRaw(String invoiceId) throws ChargebeeException { String path = @@ -1142,12 +1589,33 @@ public InvoiceRemoveTaxWithheldResponse removeTaxWithheld( return InvoiceRemoveTaxWithheldResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture removeTaxWithheldAsync( + String invoiceId, InvoiceRemoveTaxWithheldParams params) { + String path = + buildPathWithParams("/invoices/{invoice-id}/remove_tax_withheld", "invoice-id", invoiceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + InvoiceRemoveTaxWithheldResponse.fromJson(response.getBodyAsString(), response)); + } + public InvoiceRemoveTaxWithheldResponse removeTaxWithheld(String invoiceId) throws ChargebeeException { Response response = removeTaxWithheldRaw(invoiceId); return InvoiceRemoveTaxWithheldResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture removeTaxWithheldAsync( + String invoiceId) { + String path = + buildPathWithParams("/invoices/{invoice-id}/remove_tax_withheld", "invoice-id", invoiceId); + + return postAsync(path, null) + .thenApply( + response -> + InvoiceRemoveTaxWithheldResponse.fromJson(response.getBodyAsString(), response)); + } + /** * listPaymentReferenceNumbers a invoice using immutable params (executes immediately) - returns * raw Response. @@ -1185,6 +1653,17 @@ public InvoiceListPaymentReferenceNumbersResponse listPaymentReferenceNumbers( response.getBodyAsString(), this, params, response); } + public CompletableFuture + listPaymentReferenceNumbersAsync(InvoiceListPaymentReferenceNumbersParams params) { + + return getAsync( + "/invoices/payment_reference_numbers", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + InvoiceListPaymentReferenceNumbersResponse.fromJson( + response.getBodyAsString(), this, params, response)); + } + public InvoiceListPaymentReferenceNumbersResponse listPaymentReferenceNumbers() throws ChargebeeException { Response response = listPaymentReferenceNumbersRaw(); @@ -1193,6 +1672,16 @@ public InvoiceListPaymentReferenceNumbersResponse listPaymentReferenceNumbers() response.getBodyAsString(), this, null, response); } + public CompletableFuture + listPaymentReferenceNumbersAsync() { + + return getAsync("/invoices/payment_reference_numbers", null) + .thenApply( + response -> + InvoiceListPaymentReferenceNumbersResponse.fromJson( + response.getBodyAsString(), this, null, response)); + } + /** collectPayment a invoice (executes immediately) - returns raw Response. */ Response collectPaymentRaw(String invoiceId) throws ChargebeeException { String path = @@ -1226,11 +1715,31 @@ public InvoiceCollectPaymentResponse collectPayment( return InvoiceCollectPaymentResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture collectPaymentAsync( + String invoiceId, InvoiceCollectPaymentParams params) { + String path = + buildPathWithParams("/invoices/{invoice-id}/collect_payment", "invoice-id", invoiceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + InvoiceCollectPaymentResponse.fromJson(response.getBodyAsString(), response)); + } + public InvoiceCollectPaymentResponse collectPayment(String invoiceId) throws ChargebeeException { Response response = collectPaymentRaw(invoiceId); return InvoiceCollectPaymentResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture collectPaymentAsync(String invoiceId) { + String path = + buildPathWithParams("/invoices/{invoice-id}/collect_payment", "invoice-id", invoiceId); + + return postAsync(path, null) + .thenApply( + response -> + InvoiceCollectPaymentResponse.fromJson(response.getBodyAsString(), response)); + } + /** syncUsages a invoice (executes immediately) - returns raw Response. */ Response syncUsagesRaw(String invoiceId) throws ChargebeeException { String path = @@ -1244,6 +1753,15 @@ public InvoiceSyncUsagesResponse syncUsages(String invoiceId) throws ChargebeeEx return InvoiceSyncUsagesResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture syncUsagesAsync(String invoiceId) { + String path = + buildPathWithParams("/invoices/{invoice-id}/sync_usages", "invoice-id", invoiceId); + + return postAsync(path, null) + .thenApply( + response -> InvoiceSyncUsagesResponse.fromJson(response.getBodyAsString(), response)); + } + /** refund a invoice (executes immediately) - returns raw Response. */ Response refundRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/refund", "invoice-id", invoiceId); @@ -1269,11 +1787,27 @@ public InvoiceRefundResponse refund(String invoiceId, InvoiceRefundParams params return InvoiceRefundResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture refundAsync( + String invoiceId, InvoiceRefundParams params) { + String path = buildPathWithParams("/invoices/{invoice-id}/refund", "invoice-id", invoiceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> InvoiceRefundResponse.fromJson(response.getBodyAsString(), response)); + } + public InvoiceRefundResponse refund(String invoiceId) throws ChargebeeException { Response response = refundRaw(invoiceId); return InvoiceRefundResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture refundAsync(String invoiceId) { + String path = buildPathWithParams("/invoices/{invoice-id}/refund", "invoice-id", invoiceId); + + return postAsync(path, null) + .thenApply( + response -> InvoiceRefundResponse.fromJson(response.getBodyAsString(), response)); + } + /** recordRefund a invoice (executes immediately) - returns raw Response. */ Response recordRefundRaw(String invoiceId) throws ChargebeeException { String path = @@ -1307,11 +1841,29 @@ public InvoiceRecordRefundResponse recordRefund( return InvoiceRecordRefundResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture recordRefundAsync( + String invoiceId, InvoiceRecordRefundParams params) { + String path = + buildPathWithParams("/invoices/{invoice-id}/record_refund", "invoice-id", invoiceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> InvoiceRecordRefundResponse.fromJson(response.getBodyAsString(), response)); + } + public InvoiceRecordRefundResponse recordRefund(String invoiceId) throws ChargebeeException { Response response = recordRefundRaw(invoiceId); return InvoiceRecordRefundResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture recordRefundAsync(String invoiceId) { + String path = + buildPathWithParams("/invoices/{invoice-id}/record_refund", "invoice-id", invoiceId); + + return postAsync(path, null) + .thenApply( + response -> InvoiceRecordRefundResponse.fromJson(response.getBodyAsString(), response)); + } + /** pdf a invoice (executes immediately) - returns raw Response. */ Response pdfRaw(String invoiceId) throws ChargebeeException { String path = buildPathWithParams("/invoices/{invoice-id}/pdf", "invoice-id", invoiceId); @@ -1337,11 +1889,24 @@ public InvoicePdfResponse pdf(String invoiceId, InvoicePdfParams params) return InvoicePdfResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture pdfAsync(String invoiceId, InvoicePdfParams params) { + String path = buildPathWithParams("/invoices/{invoice-id}/pdf", "invoice-id", invoiceId); + return postAsync(path, params.toFormData()) + .thenApply(response -> InvoicePdfResponse.fromJson(response.getBodyAsString(), response)); + } + public InvoicePdfResponse pdf(String invoiceId) throws ChargebeeException { Response response = pdfRaw(invoiceId); return InvoicePdfResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture pdfAsync(String invoiceId) { + String path = buildPathWithParams("/invoices/{invoice-id}/pdf", "invoice-id", invoiceId); + + return postAsync(path, null) + .thenApply(response -> InvoicePdfResponse.fromJson(response.getBodyAsString(), response)); + } + /** * invoicesForSubscription a invoice using immutable params (executes immediately) - returns raw * Response. @@ -1390,6 +1955,30 @@ public InvoicesForSubscriptionResponse invoicesForSubscription(String subscripti response.getBodyAsString(), this, null, subscriptionId, response); } + public CompletableFuture invoicesForSubscriptionAsync( + String subscriptionId, InvoicesForSubscriptionParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/invoices", "subscription-id", subscriptionId); + return getAsync(path, params != null ? params.toQueryParams() : null) + .thenApply( + response -> + InvoicesForSubscriptionResponse.fromJson( + response.getBodyAsString(), this, params, subscriptionId, response)); + } + + public CompletableFuture invoicesForSubscriptionAsync( + String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/invoices", "subscription-id", subscriptionId); + return getAsync(path, null) + .thenApply( + response -> + InvoicesForSubscriptionResponse.fromJson( + response.getBodyAsString(), this, null, subscriptionId, response)); + } + /** downloadEinvoice a invoice (executes immediately) - returns raw Response. */ Response downloadEinvoiceRaw(String invoiceId) throws ChargebeeException { String path = @@ -1403,6 +1992,15 @@ public DownloadEinvoiceResponse downloadEinvoice(String invoiceId) throws Charge return DownloadEinvoiceResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture downloadEinvoiceAsync(String invoiceId) { + String path = + buildPathWithParams("/invoices/{invoice-id}/download_einvoice", "invoice-id", invoiceId); + + return getAsync(path, null) + .thenApply( + response -> DownloadEinvoiceResponse.fromJson(response.getBodyAsString(), response)); + } + /** chargeAddon a invoice using immutable params (executes immediately) - returns raw Response. */ Response chargeAddonRaw(InvoiceChargeAddonParams params) throws ChargebeeException { @@ -1422,6 +2020,14 @@ public InvoiceChargeAddonResponse chargeAddon(InvoiceChargeAddonParams params) return InvoiceChargeAddonResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture chargeAddonAsync( + InvoiceChargeAddonParams params) { + + return postAsync("/invoices/charge_addon", params != null ? params.toFormData() : null) + .thenApply( + response -> InvoiceChargeAddonResponse.fromJson(response.getBodyAsString(), response)); + } + /** addAddonCharge a invoice (executes immediately) - returns raw Response. */ Response addAddonChargeRaw(String invoiceId) throws ChargebeeException { String path = @@ -1455,6 +2061,16 @@ public InvoiceAddAddonChargeResponse addAddonCharge( return InvoiceAddAddonChargeResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture addAddonChargeAsync( + String invoiceId, InvoiceAddAddonChargeParams params) { + String path = + buildPathWithParams("/invoices/{invoice-id}/add_addon_charge", "invoice-id", invoiceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + InvoiceAddAddonChargeResponse.fromJson(response.getBodyAsString(), response)); + } + /** charge a invoice using immutable params (executes immediately) - returns raw Response. */ Response chargeRaw(InvoiceChargeParams params) throws ChargebeeException { @@ -1472,4 +2088,11 @@ public InvoiceChargeResponse charge(InvoiceChargeParams params) throws Chargebee return InvoiceChargeResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture chargeAsync(InvoiceChargeParams params) { + + return postAsync("/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 c832d093..07db88b3 100644 --- a/src/main/java/com/chargebee/v4/services/ItemEntitlementService.java +++ b/src/main/java/com/chargebee/v4/services/ItemEntitlementService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.itemEntitlement.params.ItemEntitlementsForFeatureParams; @@ -109,6 +110,28 @@ public ItemEntitlementsForFeatureResponse itemEntitlementsForFeature(String feat response.getBodyAsString(), this, null, featureId, response); } + public CompletableFuture itemEntitlementsForFeatureAsync( + String featureId, ItemEntitlementsForFeatureParams params) { + String path = + buildPathWithParams("/features/{feature-id}/item_entitlements", "feature-id", featureId); + return getAsync(path, params != null ? params.toQueryParams() : null) + .thenApply( + response -> + ItemEntitlementsForFeatureResponse.fromJson( + response.getBodyAsString(), this, params, featureId, response)); + } + + public CompletableFuture itemEntitlementsForFeatureAsync( + String featureId) { + String path = + buildPathWithParams("/features/{feature-id}/item_entitlements", "feature-id", featureId); + return getAsync(path, null) + .thenApply( + response -> + ItemEntitlementsForFeatureResponse.fromJson( + response.getBodyAsString(), this, null, featureId, response)); + } + /** addItemEntitlements a itemEntitlement (executes immediately) - returns raw Response. */ Response addItemEntitlementsRaw(String featureId) throws ChargebeeException { String path = @@ -144,6 +167,15 @@ public AddItemEntitlementsResponse addItemEntitlements( return AddItemEntitlementsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture addItemEntitlementsAsync( + String featureId, AddItemEntitlementsParams params) { + String path = + buildPathWithParams("/features/{feature-id}/item_entitlements", "feature-id", featureId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> AddItemEntitlementsResponse.fromJson(response.getBodyAsString(), response)); + } + /** * itemEntitlementsForItem a itemEntitlement using immutable params (executes immediately) - * returns raw Response. @@ -186,6 +218,26 @@ public ItemEntitlementsForItemResponse itemEntitlementsForItem(String itemId) response.getBodyAsString(), this, null, itemId, response); } + 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) + .thenApply( + response -> + ItemEntitlementsForItemResponse.fromJson( + response.getBodyAsString(), this, params, itemId, response)); + } + + public CompletableFuture itemEntitlementsForItemAsync( + String itemId) { + String path = buildPathWithParams("/items/{item-id}/item_entitlements", "item-id", itemId); + return getAsync(path, null) + .thenApply( + response -> + ItemEntitlementsForItemResponse.fromJson( + response.getBodyAsString(), this, null, itemId, response)); + } + /** * upsertOrRemoveItemEntitlementsForItem a itemEntitlement (executes immediately) - returns raw * Response. @@ -222,4 +274,15 @@ public UpsertOrRemoveItemEntitlementsForItemResponse upsertOrRemoveItemEntitleme return UpsertOrRemoveItemEntitlementsForItemResponse.fromJson( response.getBodyAsString(), response); } + + public CompletableFuture + upsertOrRemoveItemEntitlementsForItemAsync( + String itemId, UpsertOrRemoveItemEntitlementsForItemParams params) { + String path = buildPathWithParams("/items/{item-id}/item_entitlements", "item-id", itemId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + UpsertOrRemoveItemEntitlementsForItemResponse.fromJson( + response.getBodyAsString(), response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/ItemFamilyService.java b/src/main/java/com/chargebee/v4/services/ItemFamilyService.java index 3e93d286..b5b65f04 100644 --- a/src/main/java/com/chargebee/v4/services/ItemFamilyService.java +++ b/src/main/java/com/chargebee/v4/services/ItemFamilyService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.itemFamily.params.ItemFamilyListParams; @@ -76,6 +77,16 @@ public ItemFamilyDeleteResponse delete(String itemFamilyId) throws ChargebeeExce return ItemFamilyDeleteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteAsync(String itemFamilyId) { + String path = + buildPathWithParams( + "/item_families/{item-family-id}/delete", "item-family-id", itemFamilyId); + + return postAsync(path, null) + .thenApply( + response -> ItemFamilyDeleteResponse.fromJson(response.getBodyAsString(), response)); + } + /** list a itemFamily using immutable params (executes immediately) - returns raw Response. */ Response listRaw(ItemFamilyListParams params) throws ChargebeeException { @@ -100,12 +111,29 @@ public ItemFamilyListResponse list(ItemFamilyListParams params) throws Chargebee return ItemFamilyListResponse.fromJson(response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync(ItemFamilyListParams params) { + + return getAsync("/item_families", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + ItemFamilyListResponse.fromJson( + response.getBodyAsString(), this, params, response)); + } + public ItemFamilyListResponse list() throws ChargebeeException { Response response = listRaw(); return ItemFamilyListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/item_families", null) + .thenApply( + response -> + ItemFamilyListResponse.fromJson(response.getBodyAsString(), this, null, response)); + } + /** create a itemFamily using immutable params (executes immediately) - returns raw Response. */ Response createRaw(ItemFamilyCreateParams params) throws ChargebeeException { @@ -124,6 +152,13 @@ public ItemFamilyCreateResponse create(ItemFamilyCreateParams params) throws Cha return ItemFamilyCreateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createAsync(ItemFamilyCreateParams params) { + + return postAsync("/item_families", params != null ? params.toFormData() : null) + .thenApply( + response -> ItemFamilyCreateResponse.fromJson(response.getBodyAsString(), response)); + } + /** retrieve a itemFamily (executes immediately) - returns raw Response. */ Response retrieveRaw(String itemFamilyId) throws ChargebeeException { String path = @@ -137,6 +172,15 @@ public ItemFamilyRetrieveResponse retrieve(String itemFamilyId) throws Chargebee return ItemFamilyRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String itemFamilyId) { + String path = + buildPathWithParams("/item_families/{item-family-id}", "item-family-id", itemFamilyId); + + return getAsync(path, null) + .thenApply( + response -> ItemFamilyRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** update a itemFamily (executes immediately) - returns raw Response. */ Response updateRaw(String itemFamilyId) throws ChargebeeException { String path = @@ -165,8 +209,26 @@ public ItemFamilyUpdateResponse update(String itemFamilyId, ItemFamilyUpdatePara return ItemFamilyUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync( + String itemFamilyId, ItemFamilyUpdateParams params) { + String path = + buildPathWithParams("/item_families/{item-family-id}", "item-family-id", itemFamilyId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> ItemFamilyUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + public ItemFamilyUpdateResponse update(String itemFamilyId) throws ChargebeeException { Response response = updateRaw(itemFamilyId); return ItemFamilyUpdateResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture updateAsync(String itemFamilyId) { + String path = + buildPathWithParams("/item_families/{item-family-id}", "item-family-id", itemFamilyId); + + return postAsync(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 5940deb8..38d91853 100644 --- a/src/main/java/com/chargebee/v4/services/ItemPriceService.java +++ b/src/main/java/com/chargebee/v4/services/ItemPriceService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.itemPrice.params.ItemPriceUpdateParams; @@ -82,6 +83,14 @@ public ItemPriceRetrieveResponse retrieve(String itemPriceId) throws ChargebeeEx return ItemPriceRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String itemPriceId) { + String path = buildPathWithParams("/item_prices/{item-price-id}", "item-price-id", itemPriceId); + + return getAsync(path, null) + .thenApply( + response -> ItemPriceRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** update a itemPrice (executes immediately) - returns raw Response. */ Response updateRaw(String itemPriceId) throws ChargebeeException { String path = buildPathWithParams("/item_prices/{item-price-id}", "item-price-id", itemPriceId); @@ -107,11 +116,27 @@ public ItemPriceUpdateResponse update(String itemPriceId, ItemPriceUpdateParams return ItemPriceUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync( + String itemPriceId, ItemPriceUpdateParams params) { + String path = buildPathWithParams("/item_prices/{item-price-id}", "item-price-id", itemPriceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> ItemPriceUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + public ItemPriceUpdateResponse update(String itemPriceId) throws ChargebeeException { Response response = updateRaw(itemPriceId); return ItemPriceUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync(String itemPriceId) { + String path = buildPathWithParams("/item_prices/{item-price-id}", "item-price-id", itemPriceId); + + return postAsync(path, null) + .thenApply( + response -> ItemPriceUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + /** delete a itemPrice (executes immediately) - returns raw Response. */ Response deleteRaw(String itemPriceId) throws ChargebeeException { String path = @@ -125,6 +150,15 @@ public ItemPriceDeleteResponse delete(String itemPriceId) throws ChargebeeExcept return ItemPriceDeleteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteAsync(String itemPriceId) { + String path = + buildPathWithParams("/item_prices/{item-price-id}/delete", "item-price-id", itemPriceId); + + return postAsync(path, null) + .thenApply( + response -> ItemPriceDeleteResponse.fromJson(response.getBodyAsString(), response)); + } + /** * findApplicableItemPrices a itemPrice using immutable params (executes immediately) - returns * raw Response. @@ -174,6 +208,30 @@ public FindApplicableItemPricesResponse findApplicableItemPrices(String itemPric response.getBodyAsString(), this, null, itemPriceId, response); } + public CompletableFuture findApplicableItemPricesAsync( + String itemPriceId, FindApplicableItemPricesParams params) { + String path = + buildPathWithParams( + "/item_prices/{item-price-id}/applicable_item_prices", "item-price-id", itemPriceId); + return getAsync(path, params != null ? params.toQueryParams() : null) + .thenApply( + response -> + FindApplicableItemPricesResponse.fromJson( + response.getBodyAsString(), this, params, itemPriceId, response)); + } + + public CompletableFuture findApplicableItemPricesAsync( + String itemPriceId) { + String path = + buildPathWithParams( + "/item_prices/{item-price-id}/applicable_item_prices", "item-price-id", itemPriceId); + return getAsync(path, null) + .thenApply( + response -> + FindApplicableItemPricesResponse.fromJson( + response.getBodyAsString(), this, null, itemPriceId, response)); + } + /** * findApplicableItems a itemPrice using immutable params (executes immediately) - returns raw * Response. @@ -222,6 +280,30 @@ public ItemPriceFindApplicableItemsResponse findApplicableItems(String itemPrice response.getBodyAsString(), this, null, itemPriceId, response); } + public CompletableFuture findApplicableItemsAsync( + String itemPriceId, ItemPriceFindApplicableItemsParams params) { + String path = + buildPathWithParams( + "/item_prices/{item-price-id}/applicable_items", "item-price-id", itemPriceId); + return getAsync(path, params != null ? params.toQueryParams() : null) + .thenApply( + response -> + ItemPriceFindApplicableItemsResponse.fromJson( + response.getBodyAsString(), this, params, itemPriceId, response)); + } + + public CompletableFuture findApplicableItemsAsync( + String itemPriceId) { + String path = + buildPathWithParams( + "/item_prices/{item-price-id}/applicable_items", "item-price-id", itemPriceId); + return getAsync(path, null) + .thenApply( + response -> + ItemPriceFindApplicableItemsResponse.fromJson( + response.getBodyAsString(), this, null, itemPriceId, response)); + } + /** list a itemPrice using immutable params (executes immediately) - returns raw Response. */ Response listRaw(ItemPriceListParams params) throws ChargebeeException { @@ -246,12 +328,28 @@ public ItemPriceListResponse list(ItemPriceListParams params) throws ChargebeeEx return ItemPriceListResponse.fromJson(response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync(ItemPriceListParams params) { + + return getAsync("/item_prices", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + ItemPriceListResponse.fromJson(response.getBodyAsString(), this, params, response)); + } + public ItemPriceListResponse list() throws ChargebeeException { Response response = listRaw(); return ItemPriceListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/item_prices", null) + .thenApply( + response -> + ItemPriceListResponse.fromJson(response.getBodyAsString(), this, null, response)); + } + /** create a itemPrice using immutable params (executes immediately) - returns raw Response. */ Response createRaw(ItemPriceCreateParams params) throws ChargebeeException { @@ -269,4 +367,11 @@ public ItemPriceCreateResponse create(ItemPriceCreateParams params) throws Charg return ItemPriceCreateResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture createAsync(ItemPriceCreateParams params) { + + return postAsync("/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 45725a44..6afd244a 100644 --- a/src/main/java/com/chargebee/v4/services/ItemService.java +++ b/src/main/java/com/chargebee/v4/services/ItemService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.item.params.ItemListParams; @@ -86,12 +87,28 @@ public ItemListResponse list(ItemListParams params) throws ChargebeeException { return ItemListResponse.fromJson(response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync(ItemListParams params) { + + return getAsync("/items", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + ItemListResponse.fromJson(response.getBodyAsString(), this, params, response)); + } + public ItemListResponse list() throws ChargebeeException { Response response = listRaw(); return ItemListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/items", null) + .thenApply( + response -> + ItemListResponse.fromJson(response.getBodyAsString(), this, null, response)); + } + /** create a item using immutable params (executes immediately) - returns raw Response. */ Response createRaw(ItemCreateParams params) throws ChargebeeException { @@ -110,6 +127,12 @@ public ItemCreateResponse create(ItemCreateParams params) throws ChargebeeExcept return ItemCreateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createAsync(ItemCreateParams params) { + + return postAsync("/items", params != null ? params.toFormData() : null) + .thenApply(response -> ItemCreateResponse.fromJson(response.getBodyAsString(), response)); + } + /** delete a item (executes immediately) - returns raw Response. */ Response deleteRaw(String itemId) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}/delete", "item-id", itemId); @@ -122,6 +145,13 @@ public ItemDeleteResponse delete(String itemId) throws ChargebeeException { return ItemDeleteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteAsync(String itemId) { + String path = buildPathWithParams("/items/{item-id}/delete", "item-id", itemId); + + return postAsync(path, null) + .thenApply(response -> ItemDeleteResponse.fromJson(response.getBodyAsString(), response)); + } + /** retrieve a item (executes immediately) - returns raw Response. */ Response retrieveRaw(String itemId) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}", "item-id", itemId); @@ -134,6 +164,13 @@ public ItemRetrieveResponse retrieve(String itemId) throws ChargebeeException { return ItemRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String itemId) { + String path = buildPathWithParams("/items/{item-id}", "item-id", itemId); + + return getAsync(path, null) + .thenApply(response -> ItemRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** update a item (executes immediately) - returns raw Response. */ Response updateRaw(String itemId) throws ChargebeeException { String path = buildPathWithParams("/items/{item-id}", "item-id", itemId); @@ -159,8 +196,21 @@ public ItemUpdateResponse update(String itemId, ItemUpdateParams params) return ItemUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync(String itemId, ItemUpdateParams params) { + String path = buildPathWithParams("/items/{item-id}", "item-id", itemId); + return postAsync(path, params.toFormData()) + .thenApply(response -> ItemUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + public ItemUpdateResponse update(String itemId) throws ChargebeeException { Response response = updateRaw(itemId); return ItemUpdateResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture updateAsync(String itemId) { + String path = buildPathWithParams("/items/{item-id}", "item-id", itemId); + + return postAsync(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 f990ff60..c505a619 100644 --- a/src/main/java/com/chargebee/v4/services/MediaService.java +++ b/src/main/java/com/chargebee/v4/services/MediaService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.media.params.CreateMediaAndAttachToItemParams; @@ -82,4 +83,13 @@ public CreateMediaAndAttachToItemResponse createMediaAndAttachToItem( Response response = createMediaAndAttachToItemRaw(itemId, params); return CreateMediaAndAttachToItemResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture createMediaAndAttachToItemAsync( + String itemId, CreateMediaAndAttachToItemParams params) { + String path = buildPathWithParams("/items/{item-id}/media", "item-id", itemId); + return postAsync(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 693e9454..8da3cb6a 100644 --- a/src/main/java/com/chargebee/v4/services/NonSubscriptionService.java +++ b/src/main/java/com/chargebee/v4/services/NonSubscriptionService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.nonSubscription.params.NonSubscriptionProcessReceiptParams; @@ -97,4 +98,18 @@ public NonSubscriptionProcessReceiptResponse processReceipt( Response response = processReceiptRaw(nonSubscriptionAppId, params); return NonSubscriptionProcessReceiptResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture processReceiptAsync( + String nonSubscriptionAppId, NonSubscriptionProcessReceiptParams params) { + String path = + buildPathWithParams( + "/non_subscriptions/{non-subscription-app-id}/one_time_purchase", + "non-subscription-app-id", + nonSubscriptionAppId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + NonSubscriptionProcessReceiptResponse.fromJson( + response.getBodyAsString(), response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/OfferEventService.java b/src/main/java/com/chargebee/v4/services/OfferEventService.java index 9db3e9d3..137f6947 100644 --- a/src/main/java/com/chargebee/v4/services/OfferEventService.java +++ b/src/main/java/com/chargebee/v4/services/OfferEventService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.offerEvent.params.OfferEventsParams; @@ -74,4 +75,13 @@ public OfferEventsResponse offerEvents(OfferEventsParams params) throws Chargebe return OfferEventsResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture offerEventsAsync(OfferEventsParams params) { + + return postJsonWithSubDomainAsync( + "/offer_events", + SubDomain.GROW.getValue(), + params != null ? params.toJsonString() : null) + .thenApply(response -> OfferEventsResponse.fromJson(response.getBodyAsString(), response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/OfferFulfillmentService.java b/src/main/java/com/chargebee/v4/services/OfferFulfillmentService.java index 9a81da7b..e54afbde 100644 --- a/src/main/java/com/chargebee/v4/services/OfferFulfillmentService.java +++ b/src/main/java/com/chargebee/v4/services/OfferFulfillmentService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.offerFulfillment.params.OfferFulfillmentsParams; @@ -87,6 +88,17 @@ public OfferFulfillmentsResponse offerFulfillments(OfferFulfillmentsParams param return OfferFulfillmentsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture offerFulfillmentsAsync( + OfferFulfillmentsParams params) { + + return postJsonWithSubDomainAsync( + "/offer_fulfillments", + SubDomain.GROW.getValue(), + params != null ? params.toJsonString() : null) + .thenApply( + response -> OfferFulfillmentsResponse.fromJson(response.getBodyAsString(), response)); + } + /** offerFulfillmentsGet a offerFulfillment (executes immediately) - returns raw Response. */ Response offerFulfillmentsGetRaw(String offerFulfillmentId) throws ChargebeeException { String path = @@ -104,6 +116,20 @@ public OfferFulfillmentsGetResponse offerFulfillmentsGet(String offerFulfillment return OfferFulfillmentsGetResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture offerFulfillmentsGetAsync( + String offerFulfillmentId) { + String path = + buildPathWithParams( + "/offer_fulfillments/{offer-fulfillment-id}", + "offer-fulfillment-id", + offerFulfillmentId); + + return getWithSubDomainAsync(path, SubDomain.GROW.getValue(), null) + .thenApply( + response -> + OfferFulfillmentsGetResponse.fromJson(response.getBodyAsString(), response)); + } + /** offerFulfillmentsUpdate a offerFulfillment (executes immediately) - returns raw Response. */ Response offerFulfillmentsUpdateRaw(String offerFulfillmentId) throws ChargebeeException { String path = @@ -149,4 +175,18 @@ public OfferFulfillmentsUpdateResponse offerFulfillmentsUpdate( Response response = offerFulfillmentsUpdateRaw(offerFulfillmentId, params); return OfferFulfillmentsUpdateResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture offerFulfillmentsUpdateAsync( + String offerFulfillmentId, OfferFulfillmentsUpdateParams params) { + String path = + buildPathWithParams( + "/offer_fulfillments/{offer-fulfillment-id}", + "offer-fulfillment-id", + offerFulfillmentId); + return postJsonWithSubDomainAsync( + 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 cde68971..cd64dd5a 100644 --- a/src/main/java/com/chargebee/v4/services/OmnichannelOneTimeOrderService.java +++ b/src/main/java/com/chargebee/v4/services/OmnichannelOneTimeOrderService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.omnichannelOneTimeOrder.params.OmnichannelOneTimeOrderListParams; @@ -88,6 +89,16 @@ public OmnichannelOneTimeOrderListResponse list(OmnichannelOneTimeOrderListParam response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync( + OmnichannelOneTimeOrderListParams params) { + + return getAsync("/omnichannel_one_time_orders", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + OmnichannelOneTimeOrderListResponse.fromJson( + response.getBodyAsString(), this, params, response)); + } + public OmnichannelOneTimeOrderListResponse list() throws ChargebeeException { Response response = listRaw(); @@ -95,6 +106,15 @@ public OmnichannelOneTimeOrderListResponse list() throws ChargebeeException { response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/omnichannel_one_time_orders", null) + .thenApply( + response -> + OmnichannelOneTimeOrderListResponse.fromJson( + response.getBodyAsString(), this, null, response)); + } + /** retrieve a omnichannelOneTimeOrder (executes immediately) - returns raw Response. */ Response retrieveRaw(String omnichannelOneTimeOrderId) throws ChargebeeException { String path = @@ -111,4 +131,19 @@ public OmnichannelOneTimeOrderRetrieveResponse retrieve(String omnichannelOneTim Response response = retrieveRaw(omnichannelOneTimeOrderId); return OmnichannelOneTimeOrderRetrieveResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture retrieveAsync( + String omnichannelOneTimeOrderId) { + String path = + buildPathWithParams( + "/omnichannel_one_time_orders/{omnichannel-one-time-order-id}", + "omnichannel-one-time-order-id", + omnichannelOneTimeOrderId); + + return getAsync(path, null) + .thenApply( + response -> + OmnichannelOneTimeOrderRetrieveResponse.fromJson( + response.getBodyAsString(), response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionItemService.java b/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionItemService.java index 3b5d9929..93313051 100644 --- a/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionItemService.java +++ b/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionItemService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.omnichannelSubscriptionItem.params.OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesParams; @@ -114,4 +115,44 @@ Response listOmniSubscriptionItemScheduleChangesRaw( return OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesResponse.fromJson( response.getBodyAsString(), this, null, omnichannelSubscriptionItemId, response); } + + public CompletableFuture< + OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesResponse> + listOmniSubscriptionItemScheduleChangesAsync( + String omnichannelSubscriptionItemId, + OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesParams params) { + String path = + buildPathWithParams( + "/omnichannel_subscription_items/{omnichannel-subscription-item-id}/scheduled_changes", + "omnichannel-subscription-item-id", + omnichannelSubscriptionItemId); + return getAsync(path, params != null ? params.toQueryParams() : null) + .thenApply( + response -> + OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesResponse.fromJson( + response.getBodyAsString(), + this, + params, + omnichannelSubscriptionItemId, + response)); + } + + public CompletableFuture< + OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesResponse> + listOmniSubscriptionItemScheduleChangesAsync(String omnichannelSubscriptionItemId) { + String path = + buildPathWithParams( + "/omnichannel_subscription_items/{omnichannel-subscription-item-id}/scheduled_changes", + "omnichannel-subscription-item-id", + omnichannelSubscriptionItemId); + return getAsync(path, null) + .thenApply( + response -> + OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesResponse.fromJson( + response.getBodyAsString(), + this, + null, + omnichannelSubscriptionItemId, + response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionService.java b/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionService.java index 88dfba8c..06912d50 100644 --- a/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionService.java +++ b/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.omnichannelSubscription.params.OmnichannelSubscriptionMoveParams; @@ -107,6 +108,19 @@ public OmnichannelSubscriptionMoveResponse move( return OmnichannelSubscriptionMoveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture moveAsync( + String omnichannelSubscriptionId, OmnichannelSubscriptionMoveParams params) { + String path = + buildPathWithParams( + "/omnichannel_subscriptions/{omnichannel-subscription-id}/move", + "omnichannel-subscription-id", + omnichannelSubscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + OmnichannelSubscriptionMoveResponse.fromJson(response.getBodyAsString(), response)); + } + /** retrieve a omnichannelSubscription (executes immediately) - returns raw Response. */ Response retrieveRaw(String omnichannelSubscriptionId) throws ChargebeeException { String path = @@ -124,6 +138,21 @@ public OmnichannelSubscriptionRetrieveResponse retrieve(String omnichannelSubscr return OmnichannelSubscriptionRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync( + String omnichannelSubscriptionId) { + String path = + buildPathWithParams( + "/omnichannel_subscriptions/{omnichannel-subscription-id}", + "omnichannel-subscription-id", + omnichannelSubscriptionId); + + return getAsync(path, null) + .thenApply( + response -> + OmnichannelSubscriptionRetrieveResponse.fromJson( + response.getBodyAsString(), response)); + } + /** * omnichannelTransactionsForOmnichannelSubscription a omnichannelSubscription using immutable * params (executes immediately) - returns raw Response. @@ -188,6 +217,36 @@ Response omnichannelTransactionsForOmnichannelSubscriptionRaw( response.getBodyAsString(), this, null, omnichannelSubscriptionId, response); } + public CompletableFuture + omnichannelTransactionsForOmnichannelSubscriptionAsync( + String omnichannelSubscriptionId, + OmnichannelTransactionsForOmnichannelSubscriptionParams params) { + String path = + buildPathWithParams( + "/omnichannel_subscriptions/{omnichannel-subscription-id}/omnichannel_transactions", + "omnichannel-subscription-id", + omnichannelSubscriptionId); + return getAsync(path, params != null ? params.toQueryParams() : null) + .thenApply( + response -> + OmnichannelTransactionsForOmnichannelSubscriptionResponse.fromJson( + response.getBodyAsString(), this, params, omnichannelSubscriptionId, response)); + } + + public CompletableFuture + omnichannelTransactionsForOmnichannelSubscriptionAsync(String omnichannelSubscriptionId) { + String path = + buildPathWithParams( + "/omnichannel_subscriptions/{omnichannel-subscription-id}/omnichannel_transactions", + "omnichannel-subscription-id", + omnichannelSubscriptionId); + return getAsync(path, null) + .thenApply( + response -> + OmnichannelTransactionsForOmnichannelSubscriptionResponse.fromJson( + response.getBodyAsString(), this, null, omnichannelSubscriptionId, response)); + } + /** * list a omnichannelSubscription using immutable params (executes immediately) - returns raw * Response. @@ -222,10 +281,29 @@ public OmnichannelSubscriptionListResponse list(OmnichannelSubscriptionListParam response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync( + OmnichannelSubscriptionListParams params) { + + return getAsync("/omnichannel_subscriptions", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + OmnichannelSubscriptionListResponse.fromJson( + response.getBodyAsString(), this, params, response)); + } + public OmnichannelSubscriptionListResponse list() throws ChargebeeException { Response response = listRaw(); return OmnichannelSubscriptionListResponse.fromJson( response.getBodyAsString(), this, null, response); } + + public CompletableFuture listAsync() { + + return getAsync("/omnichannel_subscriptions", null) + .thenApply( + response -> + OmnichannelSubscriptionListResponse.fromJson( + response.getBodyAsString(), this, null, response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/OrderService.java b/src/main/java/com/chargebee/v4/services/OrderService.java index 4f78c1d7..5462620b 100644 --- a/src/main/java/com/chargebee/v4/services/OrderService.java +++ b/src/main/java/com/chargebee/v4/services/OrderService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.order.params.OrderListParams; @@ -112,12 +113,28 @@ public OrderListResponse list(OrderListParams params) throws ChargebeeException return OrderListResponse.fromJson(response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync(OrderListParams params) { + + return getAsync("/orders", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + OrderListResponse.fromJson(response.getBodyAsString(), this, params, response)); + } + public OrderListResponse list() throws ChargebeeException { Response response = listRaw(); return OrderListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/orders", null) + .thenApply( + response -> + OrderListResponse.fromJson(response.getBodyAsString(), this, null, response)); + } + /** create a order using immutable params (executes immediately) - returns raw Response. */ Response createRaw(OrderCreateParams params) throws ChargebeeException { @@ -136,6 +153,12 @@ public OrderCreateResponse create(OrderCreateParams params) throws ChargebeeExce return OrderCreateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createAsync(OrderCreateParams params) { + + return postAsync("/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 { @@ -154,6 +177,12 @@ public ImportOrderResponse importOrder(ImportOrderParams params) throws Chargebe return ImportOrderResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture importOrderAsync(ImportOrderParams params) { + + return postAsync("/orders/import_order", params != null ? params.toFormData() : null) + .thenApply(response -> ImportOrderResponse.fromJson(response.getBodyAsString(), response)); + } + /** assignOrderNumber a order (executes immediately) - returns raw Response. */ Response assignOrderNumberRaw(String orderId) throws ChargebeeException { String path = @@ -167,6 +196,15 @@ public AssignOrderNumberResponse assignOrderNumber(String orderId) throws Charge return AssignOrderNumberResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture assignOrderNumberAsync(String orderId) { + String path = + buildPathWithParams("/orders/{order-id}/assign_order_number", "order-id", orderId); + + return postAsync(path, null) + .thenApply( + response -> AssignOrderNumberResponse.fromJson(response.getBodyAsString(), response)); + } + /** resend a order (executes immediately) - returns raw Response. */ Response resendRaw(String orderId) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}/resend", "order-id", orderId); @@ -192,11 +230,25 @@ public OrderResendResponse resend(String orderId, OrderResendParams params) return OrderResendResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture resendAsync( + String orderId, OrderResendParams params) { + String path = buildPathWithParams("/orders/{order-id}/resend", "order-id", orderId); + return postAsync(path, params.toFormData()) + .thenApply(response -> OrderResendResponse.fromJson(response.getBodyAsString(), response)); + } + public OrderResendResponse resend(String orderId) throws ChargebeeException { Response response = resendRaw(orderId); return OrderResendResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture resendAsync(String orderId) { + String path = buildPathWithParams("/orders/{order-id}/resend", "order-id", orderId); + + return postAsync(path, null) + .thenApply(response -> OrderResendResponse.fromJson(response.getBodyAsString(), response)); + } + /** reopen a order (executes immediately) - returns raw Response. */ Response reopenRaw(String orderId) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}/reopen", "order-id", orderId); @@ -222,11 +274,25 @@ public OrderReopenResponse reopen(String orderId, OrderReopenParams params) return OrderReopenResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture reopenAsync( + String orderId, OrderReopenParams params) { + String path = buildPathWithParams("/orders/{order-id}/reopen", "order-id", orderId); + return postAsync(path, params.toFormData()) + .thenApply(response -> OrderReopenResponse.fromJson(response.getBodyAsString(), response)); + } + public OrderReopenResponse reopen(String orderId) throws ChargebeeException { Response response = reopenRaw(orderId); return OrderReopenResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture reopenAsync(String orderId) { + String path = buildPathWithParams("/orders/{order-id}/reopen", "order-id", orderId); + + return postAsync(path, null) + .thenApply(response -> OrderReopenResponse.fromJson(response.getBodyAsString(), response)); + } + /** * ordersForInvoice a order using immutable params (executes immediately) - returns raw Response. */ @@ -263,6 +329,25 @@ public OrdersForInvoiceResponse ordersForInvoice(String invoiceId) throws Charge response.getBodyAsString(), this, null, invoiceId, response); } + 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) + .thenApply( + response -> + OrdersForInvoiceResponse.fromJson( + response.getBodyAsString(), this, params, invoiceId, response)); + } + + public CompletableFuture ordersForInvoiceAsync(String invoiceId) { + String path = buildPathWithParams("/invoices/{invoice-id}/orders", "invoice-id", invoiceId); + return getAsync(path, null) + .thenApply( + response -> + OrdersForInvoiceResponse.fromJson( + response.getBodyAsString(), this, null, invoiceId, response)); + } + /** cancel a order (executes immediately) - returns raw Response. */ Response cancelRaw(String orderId) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}/cancel", "order-id", orderId); @@ -288,6 +373,13 @@ public OrderCancelResponse cancel(String orderId, OrderCancelParams params) return OrderCancelResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture cancelAsync( + String orderId, OrderCancelParams params) { + String path = buildPathWithParams("/orders/{order-id}/cancel", "order-id", orderId); + return postAsync(path, params.toFormData()) + .thenApply(response -> OrderCancelResponse.fromJson(response.getBodyAsString(), response)); + } + /** retrieve a order (executes immediately) - returns raw Response. */ Response retrieveRaw(String orderId) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}", "order-id", orderId); @@ -300,6 +392,14 @@ public OrderRetrieveResponse retrieve(String orderId) throws ChargebeeException return OrderRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String orderId) { + String path = buildPathWithParams("/orders/{order-id}", "order-id", orderId); + + return getAsync(path, null) + .thenApply( + response -> OrderRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** update a order (executes immediately) - returns raw Response. */ Response updateRaw(String orderId) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}", "order-id", orderId); @@ -325,11 +425,25 @@ public OrderUpdateResponse update(String orderId, OrderUpdateParams params) return OrderUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync( + String orderId, OrderUpdateParams params) { + String path = buildPathWithParams("/orders/{order-id}", "order-id", orderId); + return postAsync(path, params.toFormData()) + .thenApply(response -> OrderUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + public OrderUpdateResponse update(String orderId) throws ChargebeeException { Response response = updateRaw(orderId); return OrderUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync(String orderId) { + String path = buildPathWithParams("/orders/{order-id}", "order-id", orderId); + + return postAsync(path, null) + .thenApply(response -> OrderUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + /** delete a order (executes immediately) - returns raw Response. */ Response deleteRaw(String orderId) throws ChargebeeException { String path = buildPathWithParams("/orders/{order-id}/delete", "order-id", orderId); @@ -342,6 +456,13 @@ public OrderDeleteResponse delete(String orderId) throws ChargebeeException { return OrderDeleteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteAsync(String orderId) { + String path = buildPathWithParams("/orders/{order-id}/delete", "order-id", orderId); + + return postAsync(path, null) + .thenApply(response -> OrderDeleteResponse.fromJson(response.getBodyAsString(), response)); + } + /** createRefundableCreditNote a order (executes immediately) - returns raw Response. */ Response createRefundableCreditNoteRaw(String orderId) throws ChargebeeException { String path = @@ -381,9 +502,34 @@ public OrderCreateRefundableCreditNoteResponse createRefundableCreditNote( return OrderCreateRefundableCreditNoteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createRefundableCreditNoteAsync( + String orderId, OrderCreateRefundableCreditNoteParams params) { + String path = + buildPathWithParams( + "/orders/{order-id}/create_refundable_credit_note", "order-id", orderId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + OrderCreateRefundableCreditNoteResponse.fromJson( + response.getBodyAsString(), response)); + } + public OrderCreateRefundableCreditNoteResponse createRefundableCreditNote(String orderId) throws ChargebeeException { Response response = createRefundableCreditNoteRaw(orderId); return OrderCreateRefundableCreditNoteResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture createRefundableCreditNoteAsync( + String orderId) { + String path = + buildPathWithParams( + "/orders/{order-id}/create_refundable_credit_note", "order-id", orderId); + + return postAsync(path, null) + .thenApply( + response -> + OrderCreateRefundableCreditNoteResponse.fromJson( + response.getBodyAsString(), response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/PaymentIntentService.java b/src/main/java/com/chargebee/v4/services/PaymentIntentService.java index c905fc4e..f489d488 100644 --- a/src/main/java/com/chargebee/v4/services/PaymentIntentService.java +++ b/src/main/java/com/chargebee/v4/services/PaymentIntentService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.paymentIntent.params.PaymentIntentUpdateParams; @@ -71,6 +72,17 @@ public PaymentIntentRetrieveResponse retrieve(String paymentIntentId) throws Cha return PaymentIntentRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String paymentIntentId) { + String path = + buildPathWithParams( + "/payment_intents/{payment-intent-id}", "payment-intent-id", paymentIntentId); + + return getAsync(path, null) + .thenApply( + response -> + PaymentIntentRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** update a paymentIntent (executes immediately) - returns raw Response. */ Response updateRaw(String paymentIntentId) throws ChargebeeException { String path = @@ -107,11 +119,31 @@ public PaymentIntentUpdateResponse update( return PaymentIntentUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync( + String paymentIntentId, PaymentIntentUpdateParams params) { + String path = + buildPathWithParams( + "/payment_intents/{payment-intent-id}", "payment-intent-id", paymentIntentId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> PaymentIntentUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + public PaymentIntentUpdateResponse update(String paymentIntentId) throws ChargebeeException { Response response = updateRaw(paymentIntentId); return PaymentIntentUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync(String paymentIntentId) { + String path = + buildPathWithParams( + "/payment_intents/{payment-intent-id}", "payment-intent-id", paymentIntentId); + + return postAsync(path, null) + .thenApply( + response -> PaymentIntentUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + /** * create a paymentIntent using immutable params (executes immediately) - returns raw Response. */ @@ -134,4 +166,12 @@ public PaymentIntentCreateResponse create(PaymentIntentCreateParams params) return PaymentIntentCreateResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture createAsync( + PaymentIntentCreateParams params) { + + return postAsync("/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 a69eea11..4f481be9 100644 --- a/src/main/java/com/chargebee/v4/services/PaymentScheduleSchemeService.java +++ b/src/main/java/com/chargebee/v4/services/PaymentScheduleSchemeService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.paymentScheduleScheme.params.PaymentScheduleSchemeCreateParams; @@ -72,6 +73,21 @@ public PaymentScheduleSchemeRetrieveResponse retrieve(String paymentScheduleSche return PaymentScheduleSchemeRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync( + String paymentScheduleSchemeId) { + String path = + buildPathWithParams( + "/payment_schedule_schemes/{payment-schedule-scheme-id}", + "payment-schedule-scheme-id", + paymentScheduleSchemeId); + + return getAsync(path, null) + .thenApply( + response -> + PaymentScheduleSchemeRetrieveResponse.fromJson( + response.getBodyAsString(), response)); + } + /** * create a paymentScheduleScheme using immutable params (executes immediately) - returns raw * Response. @@ -97,6 +113,15 @@ public PaymentScheduleSchemeCreateResponse create(PaymentScheduleSchemeCreatePar return PaymentScheduleSchemeCreateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createAsync( + PaymentScheduleSchemeCreateParams params) { + + return postAsync("/payment_schedule_schemes", params != null ? params.toFormData() : null) + .thenApply( + response -> + PaymentScheduleSchemeCreateResponse.fromJson(response.getBodyAsString(), response)); + } + /** delete a paymentScheduleScheme (executes immediately) - returns raw Response. */ Response deleteRaw(String paymentScheduleSchemeId) throws ChargebeeException { String path = @@ -113,4 +138,18 @@ public PaymentScheduleSchemeDeleteResponse delete(String paymentScheduleSchemeId Response response = deleteRaw(paymentScheduleSchemeId); return PaymentScheduleSchemeDeleteResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture deleteAsync( + String paymentScheduleSchemeId) { + String path = + buildPathWithParams( + "/payment_schedule_schemes/{payment-schedule-scheme-id}/delete", + "payment-schedule-scheme-id", + paymentScheduleSchemeId); + + return postAsync(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 2da648e0..07681a96 100644 --- a/src/main/java/com/chargebee/v4/services/PaymentSourceService.java +++ b/src/main/java/com/chargebee/v4/services/PaymentSourceService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.paymentSource.params.PaymentSourceCreateUsingPermanentTokenParams; @@ -136,6 +137,18 @@ public PaymentSourceCreateUsingPermanentTokenResponse createUsingPermanentToken( response.getBodyAsString(), response); } + public CompletableFuture + createUsingPermanentTokenAsync(PaymentSourceCreateUsingPermanentTokenParams params) { + + return postAsync( + "/payment_sources/create_using_permanent_token", + params != null ? params.toFormData() : null) + .thenApply( + response -> + PaymentSourceCreateUsingPermanentTokenResponse.fromJson( + response.getBodyAsString(), response)); + } + /** delete a paymentSource (executes immediately) - returns raw Response. */ Response deleteRaw(String custPaymentSourceId) throws ChargebeeException { String path = @@ -152,6 +165,18 @@ public PaymentSourceDeleteResponse delete(String custPaymentSourceId) throws Cha return PaymentSourceDeleteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteAsync(String custPaymentSourceId) { + String path = + buildPathWithParams( + "/payment_sources/{cust-payment-source-id}/delete", + "cust-payment-source-id", + custPaymentSourceId); + + return postAsync(path, null) + .thenApply( + response -> PaymentSourceDeleteResponse.fromJson(response.getBodyAsString(), response)); + } + /** * createCard a paymentSource using immutable params (executes immediately) - returns raw * Response. @@ -177,6 +202,15 @@ public PaymentSourceCreateCardResponse createCard(PaymentSourceCreateCardParams return PaymentSourceCreateCardResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createCardAsync( + PaymentSourceCreateCardParams params) { + + return postAsync("/payment_sources/create_card", params != null ? params.toFormData() : null) + .thenApply( + response -> + PaymentSourceCreateCardResponse.fromJson(response.getBodyAsString(), response)); + } + /** verifyBankAccount a paymentSource (executes immediately) - returns raw Response. */ Response verifyBankAccountRaw(String custPaymentSourceId) throws ChargebeeException { String path = @@ -224,6 +258,20 @@ public PaymentSourceVerifyBankAccountResponse verifyBankAccount( return PaymentSourceVerifyBankAccountResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture verifyBankAccountAsync( + String custPaymentSourceId, PaymentSourceVerifyBankAccountParams params) { + String path = + buildPathWithParams( + "/payment_sources/{cust-payment-source-id}/verify_bank_account", + "cust-payment-source-id", + custPaymentSourceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + PaymentSourceVerifyBankAccountResponse.fromJson( + response.getBodyAsString(), response)); + } + /** list a paymentSource using immutable params (executes immediately) - returns raw Response. */ Response listRaw(PaymentSourceListParams params) throws ChargebeeException { @@ -248,12 +296,30 @@ public PaymentSourceListResponse list(PaymentSourceListParams params) throws Cha return PaymentSourceListResponse.fromJson(response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync(PaymentSourceListParams params) { + + return getAsync("/payment_sources", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + PaymentSourceListResponse.fromJson( + response.getBodyAsString(), this, params, response)); + } + public PaymentSourceListResponse list() throws ChargebeeException { Response response = listRaw(); return PaymentSourceListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/payment_sources", null) + .thenApply( + response -> + PaymentSourceListResponse.fromJson( + response.getBodyAsString(), this, null, response)); + } + /** exportPaymentSource a paymentSource (executes immediately) - returns raw Response. */ Response exportPaymentSourceRaw(String custPaymentSourceId) throws ChargebeeException { String path = @@ -299,6 +365,18 @@ public ExportPaymentSourceResponse exportPaymentSource( return ExportPaymentSourceResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture exportPaymentSourceAsync( + String custPaymentSourceId, ExportPaymentSourceParams params) { + String path = + buildPathWithParams( + "/payment_sources/{cust-payment-source-id}/export_payment_source", + "cust-payment-source-id", + custPaymentSourceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> ExportPaymentSourceResponse.fromJson(response.getBodyAsString(), response)); + } + /** * createUsingPaymentIntent a paymentSource using immutable params (executes immediately) - * returns raw Response. @@ -328,6 +406,18 @@ public PaymentSourceCreateUsingPaymentIntentResponse createUsingPaymentIntent( response.getBodyAsString(), response); } + public CompletableFuture + createUsingPaymentIntentAsync(PaymentSourceCreateUsingPaymentIntentParams params) { + + return postAsync( + "/payment_sources/create_using_payment_intent", + params != null ? params.toFormData() : null) + .thenApply( + response -> + PaymentSourceCreateUsingPaymentIntentResponse.fromJson( + response.getBodyAsString(), response)); + } + /** agreementPdf a paymentSource (executes immediately) - returns raw Response. */ Response agreementPdfRaw(String custPaymentSourceId) throws ChargebeeException { String path = @@ -345,6 +435,20 @@ public PaymentSourceAgreementPdfResponse agreementPdf(String custPaymentSourceId return PaymentSourceAgreementPdfResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture agreementPdfAsync( + String custPaymentSourceId) { + String path = + buildPathWithParams( + "/payment_sources/{cust-payment-source-id}/agreement_pdf", + "cust-payment-source-id", + custPaymentSourceId); + + return postAsync(path, null) + .thenApply( + response -> + PaymentSourceAgreementPdfResponse.fromJson(response.getBodyAsString(), response)); + } + /** retrieve a paymentSource (executes immediately) - returns raw Response. */ Response retrieveRaw(String custPaymentSourceId) throws ChargebeeException { String path = @@ -362,6 +466,20 @@ public PaymentSourceRetrieveResponse retrieve(String custPaymentSourceId) return PaymentSourceRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync( + String custPaymentSourceId) { + String path = + buildPathWithParams( + "/payment_sources/{cust-payment-source-id}", + "cust-payment-source-id", + custPaymentSourceId); + + return getAsync(path, null) + .thenApply( + response -> + PaymentSourceRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** * createVoucherPaymentSource a paymentSource using immutable params (executes immediately) - * returns raw Response. @@ -390,6 +508,17 @@ public CreateVoucherPaymentSourceResponse createVoucherPaymentSource( return CreateVoucherPaymentSourceResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createVoucherPaymentSourceAsync( + CreateVoucherPaymentSourceParams params) { + + return postAsync( + "/payment_sources/create_voucher_payment_source", + params != null ? params.toFormData() : null) + .thenApply( + response -> + CreateVoucherPaymentSourceResponse.fromJson(response.getBodyAsString(), response)); + } + /** * createUsingTempToken a paymentSource using immutable params (executes immediately) - returns * raw Response. @@ -417,6 +546,17 @@ public PaymentSourceCreateUsingTempTokenResponse createUsingTempToken( return PaymentSourceCreateUsingTempTokenResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createUsingTempTokenAsync( + PaymentSourceCreateUsingTempTokenParams params) { + + return postAsync( + "/payment_sources/create_using_temp_token", params != null ? params.toFormData() : null) + .thenApply( + response -> + PaymentSourceCreateUsingTempTokenResponse.fromJson( + response.getBodyAsString(), response)); + } + /** updateCard a paymentSource (executes immediately) - returns raw Response. */ Response updateCardRaw(String custPaymentSourceId) throws ChargebeeException { String path = @@ -461,12 +601,39 @@ public PaymentSourceUpdateCardResponse updateCard( return PaymentSourceUpdateCardResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateCardAsync( + String custPaymentSourceId, PaymentSourceUpdateCardParams params) { + String path = + buildPathWithParams( + "/payment_sources/{cust-payment-source-id}/update_card", + "cust-payment-source-id", + custPaymentSourceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + PaymentSourceUpdateCardResponse.fromJson(response.getBodyAsString(), response)); + } + public PaymentSourceUpdateCardResponse updateCard(String custPaymentSourceId) throws ChargebeeException { Response response = updateCardRaw(custPaymentSourceId); return PaymentSourceUpdateCardResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateCardAsync( + String custPaymentSourceId) { + String path = + buildPathWithParams( + "/payment_sources/{cust-payment-source-id}/update_card", + "cust-payment-source-id", + custPaymentSourceId); + + return postAsync(path, null) + .thenApply( + response -> + PaymentSourceUpdateCardResponse.fromJson(response.getBodyAsString(), response)); + } + /** switchGatewayAccount a paymentSource (executes immediately) - returns raw Response. */ Response switchGatewayAccountRaw(String custPaymentSourceId) throws ChargebeeException { String path = @@ -514,6 +681,20 @@ public PaymentSourceSwitchGatewayAccountResponse switchGatewayAccount( return PaymentSourceSwitchGatewayAccountResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture switchGatewayAccountAsync( + String custPaymentSourceId, PaymentSourceSwitchGatewayAccountParams params) { + String path = + buildPathWithParams( + "/payment_sources/{cust-payment-source-id}/switch_gateway_account", + "cust-payment-source-id", + custPaymentSourceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + PaymentSourceSwitchGatewayAccountResponse.fromJson( + response.getBodyAsString(), response)); + } + /** * createUsingToken a paymentSource using immutable params (executes immediately) - returns raw * Response. @@ -540,6 +721,17 @@ public PaymentSourceCreateUsingTokenResponse createUsingToken( return PaymentSourceCreateUsingTokenResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createUsingTokenAsync( + PaymentSourceCreateUsingTokenParams params) { + + return postAsync( + "/payment_sources/create_using_token", params != null ? params.toFormData() : null) + .thenApply( + response -> + PaymentSourceCreateUsingTokenResponse.fromJson( + response.getBodyAsString(), response)); + } + /** deleteLocal a paymentSource (executes immediately) - returns raw Response. */ Response deleteLocalRaw(String custPaymentSourceId) throws ChargebeeException { String path = @@ -557,6 +749,20 @@ public PaymentSourceDeleteLocalResponse deleteLocal(String custPaymentSourceId) return PaymentSourceDeleteLocalResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteLocalAsync( + String custPaymentSourceId) { + String path = + buildPathWithParams( + "/payment_sources/{cust-payment-source-id}/delete_local", + "cust-payment-source-id", + custPaymentSourceId); + + return postAsync(path, null) + .thenApply( + response -> + PaymentSourceDeleteLocalResponse.fromJson(response.getBodyAsString(), response)); + } + /** * createBankAccount a paymentSource using immutable params (executes immediately) - returns raw * Response. @@ -584,6 +790,17 @@ public PaymentSourceCreateBankAccountResponse createBankAccount( return PaymentSourceCreateBankAccountResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createBankAccountAsync( + PaymentSourceCreateBankAccountParams params) { + + return postAsync( + "/payment_sources/create_bank_account", params != null ? params.toFormData() : null) + .thenApply( + response -> + PaymentSourceCreateBankAccountResponse.fromJson( + response.getBodyAsString(), response)); + } + /** updateBankAccount a paymentSource (executes immediately) - returns raw Response. */ Response updateBankAccountRaw(String custPaymentSourceId) throws ChargebeeException { String path = @@ -631,9 +848,38 @@ public PaymentSourceUpdateBankAccountResponse updateBankAccount( return PaymentSourceUpdateBankAccountResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateBankAccountAsync( + String custPaymentSourceId, PaymentSourceUpdateBankAccountParams params) { + String path = + buildPathWithParams( + "/payment_sources/{cust-payment-source-id}/update_bank_account", + "cust-payment-source-id", + custPaymentSourceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + PaymentSourceUpdateBankAccountResponse.fromJson( + response.getBodyAsString(), response)); + } + public PaymentSourceUpdateBankAccountResponse updateBankAccount(String custPaymentSourceId) throws ChargebeeException { Response response = updateBankAccountRaw(custPaymentSourceId); return PaymentSourceUpdateBankAccountResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture updateBankAccountAsync( + String custPaymentSourceId) { + String path = + buildPathWithParams( + "/payment_sources/{cust-payment-source-id}/update_bank_account", + "cust-payment-source-id", + custPaymentSourceId); + + return postAsync(path, null) + .thenApply( + response -> + PaymentSourceUpdateBankAccountResponse.fromJson( + response.getBodyAsString(), response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/PaymentVoucherService.java b/src/main/java/com/chargebee/v4/services/PaymentVoucherService.java index 066c3287..2b29346d 100644 --- a/src/main/java/com/chargebee/v4/services/PaymentVoucherService.java +++ b/src/main/java/com/chargebee/v4/services/PaymentVoucherService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.paymentVoucher.params.PaymentVouchersForCustomerParams; @@ -107,6 +108,28 @@ public PaymentVouchersForCustomerResponse paymentVouchersForCustomer(String cust response.getBodyAsString(), this, null, customerId, response); } + public CompletableFuture paymentVouchersForCustomerAsync( + String customerId, PaymentVouchersForCustomerParams params) { + String path = + buildPathWithParams("/customers/{customer-id}/payment_vouchers", "customer-id", customerId); + return getAsync(path, params != null ? params.toQueryParams() : null) + .thenApply( + response -> + PaymentVouchersForCustomerResponse.fromJson( + response.getBodyAsString(), this, params, customerId, response)); + } + + public CompletableFuture paymentVouchersForCustomerAsync( + String customerId) { + String path = + buildPathWithParams("/customers/{customer-id}/payment_vouchers", "customer-id", customerId); + return getAsync(path, null) + .thenApply( + response -> + PaymentVouchersForCustomerResponse.fromJson( + response.getBodyAsString(), this, null, customerId, response)); + } + /** * paymentVouchersForInvoice a paymentVoucher using immutable params (executes immediately) - * returns raw Response. @@ -153,6 +176,28 @@ public PaymentVouchersForInvoiceResponse paymentVouchersForInvoice(String invoic response.getBodyAsString(), this, null, invoiceId, response); } + public CompletableFuture paymentVouchersForInvoiceAsync( + String invoiceId, PaymentVouchersForInvoiceParams params) { + String path = + buildPathWithParams("/invoices/{invoice-id}/payment_vouchers", "invoice-id", invoiceId); + return getAsync(path, params != null ? params.toQueryParams() : null) + .thenApply( + response -> + PaymentVouchersForInvoiceResponse.fromJson( + response.getBodyAsString(), this, params, invoiceId, response)); + } + + public CompletableFuture paymentVouchersForInvoiceAsync( + String invoiceId) { + String path = + buildPathWithParams("/invoices/{invoice-id}/payment_vouchers", "invoice-id", invoiceId); + return getAsync(path, null) + .thenApply( + response -> + PaymentVouchersForInvoiceResponse.fromJson( + response.getBodyAsString(), this, null, invoiceId, response)); + } + /** retrieve a paymentVoucher (executes immediately) - returns raw Response. */ Response retrieveRaw(String paymentVoucherId) throws ChargebeeException { String path = @@ -168,6 +213,17 @@ public PaymentVoucherRetrieveResponse retrieve(String paymentVoucherId) return PaymentVoucherRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String paymentVoucherId) { + String path = + buildPathWithParams( + "/payment_vouchers/{payment-voucher-id}", "payment-voucher-id", paymentVoucherId); + + return getAsync(path, null) + .thenApply( + response -> + PaymentVoucherRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** * create a paymentVoucher using immutable params (executes immediately) - returns raw Response. */ @@ -190,4 +246,13 @@ public PaymentVoucherCreateResponse create(PaymentVoucherCreateParams params) return PaymentVoucherCreateResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture createAsync( + PaymentVoucherCreateParams params) { + + return postAsync("/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 e083de2f..5596052d 100644 --- a/src/main/java/com/chargebee/v4/services/Pc2MigrationItemFamilyService.java +++ b/src/main/java/com/chargebee/v4/services/Pc2MigrationItemFamilyService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.pc2MigrationItemFamily.params.Pc2MigrationItemFamilyUpdateParams; @@ -81,6 +82,21 @@ public Pc2MigrationItemFamilyDeleteResponse delete(String pc2MigrationItemFamily return Pc2MigrationItemFamilyDeleteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteAsync( + String pc2MigrationItemFamilyId) { + String path = + buildPathWithParams( + "/pc2_migration_item_families/{pc2-migration-item-family-id}/delete", + "pc2-migration-item-family-id", + pc2MigrationItemFamilyId); + + return postAsync(path, null) + .thenApply( + response -> + Pc2MigrationItemFamilyDeleteResponse.fromJson( + response.getBodyAsString(), response)); + } + /** retrieve a pc2MigrationItemFamily (executes immediately) - returns raw Response. */ Response retrieveRaw(String pc2MigrationItemFamilyId) throws ChargebeeException { String path = @@ -98,6 +114,21 @@ public Pc2MigrationItemFamilyRetrieveResponse retrieve(String pc2MigrationItemFa return Pc2MigrationItemFamilyRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync( + String pc2MigrationItemFamilyId) { + String path = + buildPathWithParams( + "/pc2_migration_item_families/{pc2-migration-item-family-id}", + "pc2-migration-item-family-id", + pc2MigrationItemFamilyId); + + return getAsync(path, null) + .thenApply( + response -> + Pc2MigrationItemFamilyRetrieveResponse.fromJson( + response.getBodyAsString(), response)); + } + /** update a pc2MigrationItemFamily (executes immediately) - returns raw Response. */ Response updateRaw(String pc2MigrationItemFamilyId) throws ChargebeeException { String path = @@ -144,12 +175,41 @@ public Pc2MigrationItemFamilyUpdateResponse update( return Pc2MigrationItemFamilyUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync( + String pc2MigrationItemFamilyId, Pc2MigrationItemFamilyUpdateParams params) { + String path = + buildPathWithParams( + "/pc2_migration_item_families/{pc2-migration-item-family-id}", + "pc2-migration-item-family-id", + pc2MigrationItemFamilyId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + Pc2MigrationItemFamilyUpdateResponse.fromJson( + response.getBodyAsString(), response)); + } + public Pc2MigrationItemFamilyUpdateResponse update(String pc2MigrationItemFamilyId) throws ChargebeeException { Response response = updateRaw(pc2MigrationItemFamilyId); return Pc2MigrationItemFamilyUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync( + String pc2MigrationItemFamilyId) { + String path = + buildPathWithParams( + "/pc2_migration_item_families/{pc2-migration-item-family-id}", + "pc2-migration-item-family-id", + pc2MigrationItemFamilyId); + + return postAsync(path, null) + .thenApply( + response -> + Pc2MigrationItemFamilyUpdateResponse.fromJson( + response.getBodyAsString(), response)); + } + /** * list a pc2MigrationItemFamily using immutable params (executes immediately) - returns raw * Response. @@ -182,6 +242,16 @@ public Pc2MigrationItemFamilyListResponse list(Pc2MigrationItemFamilyListParams response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync( + Pc2MigrationItemFamilyListParams params) { + + return getAsync("/pc2_migration_item_families", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + Pc2MigrationItemFamilyListResponse.fromJson( + response.getBodyAsString(), this, params, response)); + } + public Pc2MigrationItemFamilyListResponse list() throws ChargebeeException { Response response = listRaw(); @@ -189,6 +259,15 @@ public Pc2MigrationItemFamilyListResponse list() throws ChargebeeException { response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/pc2_migration_item_families", null) + .thenApply( + response -> + Pc2MigrationItemFamilyListResponse.fromJson( + response.getBodyAsString(), this, null, response)); + } + /** * create a pc2MigrationItemFamily using immutable params (executes immediately) - returns raw * Response. @@ -213,4 +292,14 @@ public Pc2MigrationItemFamilyCreateResponse create(Pc2MigrationItemFamilyCreateP return Pc2MigrationItemFamilyCreateResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture createAsync( + Pc2MigrationItemFamilyCreateParams params) { + + return postAsync("/pc2_migration_item_families", params != null ? params.toFormData() : null) + .thenApply( + response -> + Pc2MigrationItemFamilyCreateResponse.fromJson( + response.getBodyAsString(), response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/Pc2MigrationItemPriceService.java b/src/main/java/com/chargebee/v4/services/Pc2MigrationItemPriceService.java index 570d6ac4..029fec46 100644 --- a/src/main/java/com/chargebee/v4/services/Pc2MigrationItemPriceService.java +++ b/src/main/java/com/chargebee/v4/services/Pc2MigrationItemPriceService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.pc2MigrationItemPrice.params.Pc2MigrationItemPriceListParams; @@ -91,6 +92,16 @@ public Pc2MigrationItemPriceListResponse list(Pc2MigrationItemPriceListParams pa response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync( + Pc2MigrationItemPriceListParams params) { + + return getAsync("/pc2_migration_item_prices", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + Pc2MigrationItemPriceListResponse.fromJson( + response.getBodyAsString(), this, params, response)); + } + public Pc2MigrationItemPriceListResponse list() throws ChargebeeException { Response response = listRaw(); @@ -98,6 +109,15 @@ public Pc2MigrationItemPriceListResponse list() throws ChargebeeException { response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/pc2_migration_item_prices", null) + .thenApply( + response -> + Pc2MigrationItemPriceListResponse.fromJson( + response.getBodyAsString(), this, null, response)); + } + /** delete a pc2MigrationItemPrice (executes immediately) - returns raw Response. */ Response deleteRaw(String pc2MigrationItemPriceId) throws ChargebeeException { String path = @@ -115,6 +135,20 @@ public Pc2MigrationItemPriceDeleteResponse delete(String pc2MigrationItemPriceId return Pc2MigrationItemPriceDeleteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteAsync( + String pc2MigrationItemPriceId) { + String path = + buildPathWithParams( + "/pc2_migration_item_prices/{pc2-migration-item-price-id}/delete", + "pc2-migration-item-price-id", + pc2MigrationItemPriceId); + + return postAsync(path, null) + .thenApply( + response -> + Pc2MigrationItemPriceDeleteResponse.fromJson(response.getBodyAsString(), response)); + } + /** retrieve a pc2MigrationItemPrice (executes immediately) - returns raw Response. */ Response retrieveRaw(String pc2MigrationItemPriceId) throws ChargebeeException { String path = @@ -132,6 +166,21 @@ public Pc2MigrationItemPriceRetrieveResponse retrieve(String pc2MigrationItemPri return Pc2MigrationItemPriceRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync( + String pc2MigrationItemPriceId) { + String path = + buildPathWithParams( + "/pc2_migration_item_prices/{pc2-migration-item-price-id}", + "pc2-migration-item-price-id", + pc2MigrationItemPriceId); + + return getAsync(path, null) + .thenApply( + response -> + Pc2MigrationItemPriceRetrieveResponse.fromJson( + response.getBodyAsString(), response)); + } + /** update a pc2MigrationItemPrice (executes immediately) - returns raw Response. */ Response updateRaw(String pc2MigrationItemPriceId) throws ChargebeeException { String path = @@ -177,9 +226,36 @@ public Pc2MigrationItemPriceUpdateResponse update( return Pc2MigrationItemPriceUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync( + String pc2MigrationItemPriceId, Pc2MigrationItemPriceUpdateParams params) { + String path = + buildPathWithParams( + "/pc2_migration_item_prices/{pc2-migration-item-price-id}", + "pc2-migration-item-price-id", + pc2MigrationItemPriceId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + Pc2MigrationItemPriceUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + public Pc2MigrationItemPriceUpdateResponse update(String pc2MigrationItemPriceId) throws ChargebeeException { Response response = updateRaw(pc2MigrationItemPriceId); return Pc2MigrationItemPriceUpdateResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture updateAsync( + String pc2MigrationItemPriceId) { + String path = + buildPathWithParams( + "/pc2_migration_item_prices/{pc2-migration-item-price-id}", + "pc2-migration-item-price-id", + pc2MigrationItemPriceId); + + return postAsync(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 f4af870b..5cb84f80 100644 --- a/src/main/java/com/chargebee/v4/services/Pc2MigrationItemService.java +++ b/src/main/java/com/chargebee/v4/services/Pc2MigrationItemService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.pc2MigrationItem.params.Pc2MigrationItemUpdateParams; @@ -84,6 +85,20 @@ public Pc2MigrationItemRetrieveResponse retrieve(String pc2MigrationItemId) return Pc2MigrationItemRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync( + String pc2MigrationItemId) { + String path = + buildPathWithParams( + "/pc2_migration_items/{pc2-migration-item-id}", + "pc2-migration-item-id", + pc2MigrationItemId); + + return getAsync(path, null) + .thenApply( + response -> + Pc2MigrationItemRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** update a pc2MigrationItem (executes immediately) - returns raw Response. */ Response updateRaw(String pc2MigrationItemId) throws ChargebeeException { String path = @@ -126,12 +141,38 @@ public Pc2MigrationItemUpdateResponse update( return Pc2MigrationItemUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync( + String pc2MigrationItemId, Pc2MigrationItemUpdateParams params) { + String path = + buildPathWithParams( + "/pc2_migration_items/{pc2-migration-item-id}", + "pc2-migration-item-id", + pc2MigrationItemId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + Pc2MigrationItemUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + public Pc2MigrationItemUpdateResponse update(String pc2MigrationItemId) throws ChargebeeException { Response response = updateRaw(pc2MigrationItemId); return Pc2MigrationItemUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync(String pc2MigrationItemId) { + String path = + buildPathWithParams( + "/pc2_migration_items/{pc2-migration-item-id}", + "pc2-migration-item-id", + pc2MigrationItemId); + + return postAsync(path, null) + .thenApply( + response -> + Pc2MigrationItemUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + /** delete a pc2MigrationItem (executes immediately) - returns raw Response. */ Response deleteRaw(String pc2MigrationItemId) throws ChargebeeException { String path = @@ -149,6 +190,19 @@ public Pc2MigrationItemDeleteResponse delete(String pc2MigrationItemId) return Pc2MigrationItemDeleteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteAsync(String pc2MigrationItemId) { + String path = + buildPathWithParams( + "/pc2_migration_items/{pc2-migration-item-id}/delete", + "pc2-migration-item-id", + pc2MigrationItemId); + + return postAsync(path, null) + .thenApply( + response -> + Pc2MigrationItemDeleteResponse.fromJson(response.getBodyAsString(), response)); + } + /** * list a pc2MigrationItem using immutable params (executes immediately) - returns raw Response. */ @@ -179,12 +233,31 @@ public Pc2MigrationItemListResponse list(Pc2MigrationItemListParams params) response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync( + Pc2MigrationItemListParams params) { + + return getAsync("/pc2_migration_items", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + Pc2MigrationItemListResponse.fromJson( + response.getBodyAsString(), this, params, response)); + } + public Pc2MigrationItemListResponse list() throws ChargebeeException { Response response = listRaw(); return Pc2MigrationItemListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/pc2_migration_items", null) + .thenApply( + response -> + Pc2MigrationItemListResponse.fromJson( + response.getBodyAsString(), this, null, response)); + } + /** * create a pc2MigrationItem using immutable params (executes immediately) - returns raw Response. */ @@ -208,6 +281,15 @@ public Pc2MigrationItemCreateResponse create(Pc2MigrationItemCreateParams params return Pc2MigrationItemCreateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createAsync( + Pc2MigrationItemCreateParams params) { + + return postAsync("/pc2_migration_items", params != null ? params.toFormData() : null) + .thenApply( + response -> + Pc2MigrationItemCreateResponse.fromJson(response.getBodyAsString(), response)); + } + /** * listApplicableAddons a pc2MigrationItem using immutable params (executes immediately) - returns * raw Response. @@ -245,6 +327,17 @@ public Pc2MigrationItemListApplicableAddonsResponse listApplicableAddons( response.getBodyAsString(), this, params, response); } + public CompletableFuture listApplicableAddonsAsync( + Pc2MigrationItemListApplicableAddonsParams params) { + + return getAsync( + "/pc2_migration_items/applicable_items", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + Pc2MigrationItemListApplicableAddonsResponse.fromJson( + response.getBodyAsString(), this, params, response)); + } + public Pc2MigrationItemListApplicableAddonsResponse listApplicableAddons() throws ChargebeeException { Response response = listApplicableAddonsRaw(); @@ -252,4 +345,14 @@ public Pc2MigrationItemListApplicableAddonsResponse listApplicableAddons() return Pc2MigrationItemListApplicableAddonsResponse.fromJson( response.getBodyAsString(), this, null, response); } + + public CompletableFuture + listApplicableAddonsAsync() { + + return getAsync("/pc2_migration_items/applicable_items", null) + .thenApply( + response -> + Pc2MigrationItemListApplicableAddonsResponse.fromJson( + response.getBodyAsString(), this, null, response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/Pc2MigrationService.java b/src/main/java/com/chargebee/v4/services/Pc2MigrationService.java index 55c58f7e..09d7e281 100644 --- a/src/main/java/com/chargebee/v4/services/Pc2MigrationService.java +++ b/src/main/java/com/chargebee/v4/services/Pc2MigrationService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.pc2Migration.params.Pc2MigrationCreateParams; @@ -74,6 +75,20 @@ public Pc2MigrationContactSupportResponse contactSupport(String pc2MigrationId) return Pc2MigrationContactSupportResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture contactSupportAsync( + String pc2MigrationId) { + String path = + buildPathWithParams( + "/pc2_migrations/{pc2-migration-id}/contact_support", + "pc2-migration-id", + pc2MigrationId); + + return postAsync(path, null) + .thenApply( + response -> + Pc2MigrationContactSupportResponse.fromJson(response.getBodyAsString(), response)); + } + /** retrieve a pc2Migration (executes immediately) - returns raw Response. */ Response retrieveRaw(String pc2MigrationId) throws ChargebeeException { String path = @@ -88,6 +103,17 @@ public Pc2MigrationRetrieveResponse retrieve(String pc2MigrationId) throws Charg return Pc2MigrationRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String pc2MigrationId) { + String path = + buildPathWithParams( + "/pc2_migrations/{pc2-migration-id}", "pc2-migration-id", pc2MigrationId); + + return getAsync(path, null) + .thenApply( + response -> + Pc2MigrationRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** create a pc2Migration using immutable params (executes immediately) - returns raw Response. */ Response createRaw(Pc2MigrationCreateParams params) throws ChargebeeException { @@ -107,6 +133,14 @@ public Pc2MigrationCreateResponse create(Pc2MigrationCreateParams params) return Pc2MigrationCreateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createAsync( + Pc2MigrationCreateParams params) { + + return postAsync("/pc2_migrations", params != null ? params.toFormData() : null) + .thenApply( + response -> Pc2MigrationCreateResponse.fromJson(response.getBodyAsString(), response)); + } + /** initiate a pc2Migration (executes immediately) - returns raw Response. */ Response initiateRaw(String pc2MigrationId) throws ChargebeeException { String path = @@ -120,4 +154,15 @@ public Pc2MigrationInitiateResponse initiate(String pc2MigrationId) throws Charg Response response = initiateRaw(pc2MigrationId); return Pc2MigrationInitiateResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture initiateAsync(String pc2MigrationId) { + String path = + buildPathWithParams( + "/pc2_migrations/{pc2-migration-id}/initiate", "pc2-migration-id", pc2MigrationId); + + return postAsync(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 4106323a..f91a358a 100644 --- a/src/main/java/com/chargebee/v4/services/PersonalizedOfferService.java +++ b/src/main/java/com/chargebee/v4/services/PersonalizedOfferService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.personalizedOffer.params.PersonalizedOffersParams; @@ -80,4 +81,15 @@ public PersonalizedOffersResponse personalizedOffers(PersonalizedOffersParams pa return PersonalizedOffersResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture personalizedOffersAsync( + PersonalizedOffersParams params) { + + return postJsonWithSubDomainAsync( + "/personalized_offers", + SubDomain.GROW.getValue(), + params != null ? params.toJsonString() : null) + .thenApply( + response -> PersonalizedOffersResponse.fromJson(response.getBodyAsString(), response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/PlanService.java b/src/main/java/com/chargebee/v4/services/PlanService.java index 6f202f0e..85499533 100644 --- a/src/main/java/com/chargebee/v4/services/PlanService.java +++ b/src/main/java/com/chargebee/v4/services/PlanService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.plan.params.PlanCopyParams; @@ -80,6 +81,14 @@ public PlanUnarchiveResponse unarchive(String planId) throws ChargebeeException return PlanUnarchiveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture unarchiveAsync(String planId) { + String path = buildPathWithParams("/plans/{plan-id}/unarchive", "plan-id", planId); + + return postAsync(path, null) + .thenApply( + response -> PlanUnarchiveResponse.fromJson(response.getBodyAsString(), response)); + } + /** delete a plan (executes immediately) - returns raw Response. */ Response deleteRaw(String planId) throws ChargebeeException { String path = buildPathWithParams("/plans/{plan-id}/delete", "plan-id", planId); @@ -92,6 +101,13 @@ public PlanDeleteResponse delete(String planId) throws ChargebeeException { return PlanDeleteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteAsync(String planId) { + String path = buildPathWithParams("/plans/{plan-id}/delete", "plan-id", planId); + + return postAsync(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 { @@ -110,6 +126,12 @@ public PlanCopyResponse copy(PlanCopyParams params) throws ChargebeeException { return PlanCopyResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture copyAsync(PlanCopyParams params) { + + return postAsync("/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 { @@ -134,12 +156,28 @@ public PlanListResponse list(PlanListParams params) throws ChargebeeException { return PlanListResponse.fromJson(response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync(PlanListParams params) { + + return getAsync("/plans", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + PlanListResponse.fromJson(response.getBodyAsString(), this, params, response)); + } + public PlanListResponse list() throws ChargebeeException { Response response = listRaw(); return PlanListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/plans", null) + .thenApply( + response -> + PlanListResponse.fromJson(response.getBodyAsString(), this, null, response)); + } + /** create a plan using immutable params (executes immediately) - returns raw Response. */ Response createRaw(PlanCreateParams params) throws ChargebeeException { @@ -158,6 +196,12 @@ public PlanCreateResponse create(PlanCreateParams params) throws ChargebeeExcept return PlanCreateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createAsync(PlanCreateParams params) { + + return postAsync("/plans", params != null ? params.toFormData() : null) + .thenApply(response -> PlanCreateResponse.fromJson(response.getBodyAsString(), response)); + } + /** retrieve a plan (executes immediately) - returns raw Response. */ Response retrieveRaw(String planId) throws ChargebeeException { String path = buildPathWithParams("/plans/{plan-id}", "plan-id", planId); @@ -170,6 +214,13 @@ public PlanRetrieveResponse retrieve(String planId) throws ChargebeeException { return PlanRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String planId) { + String path = buildPathWithParams("/plans/{plan-id}", "plan-id", planId); + + return getAsync(path, null) + .thenApply(response -> PlanRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** update a plan (executes immediately) - returns raw Response. */ Response updateRaw(String planId) throws ChargebeeException { String path = buildPathWithParams("/plans/{plan-id}", "plan-id", planId); @@ -195,8 +246,21 @@ public PlanUpdateResponse update(String planId, PlanUpdateParams params) return PlanUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync(String planId, PlanUpdateParams params) { + String path = buildPathWithParams("/plans/{plan-id}", "plan-id", planId); + return postAsync(path, params.toFormData()) + .thenApply(response -> PlanUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + public PlanUpdateResponse update(String planId) throws ChargebeeException { Response response = updateRaw(planId); return PlanUpdateResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture updateAsync(String planId) { + String path = buildPathWithParams("/plans/{plan-id}", "plan-id", planId); + + return postAsync(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 9e928f65..9fd2d8bf 100644 --- a/src/main/java/com/chargebee/v4/services/PortalSessionService.java +++ b/src/main/java/com/chargebee/v4/services/PortalSessionService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.portalSession.params.PortalSessionCreateParams; @@ -82,6 +83,14 @@ public PortalSessionCreateResponse create(PortalSessionCreateParams params) return PortalSessionCreateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createAsync( + PortalSessionCreateParams params) { + + return postAsync("/portal_sessions", params != null ? params.toFormData() : null) + .thenApply( + response -> PortalSessionCreateResponse.fromJson(response.getBodyAsString(), response)); + } + /** activate a portalSession (executes immediately) - returns raw Response. */ Response activateRaw(String portalSessionId) throws ChargebeeException { String path = @@ -118,6 +127,17 @@ public PortalSessionActivateResponse activate( return PortalSessionActivateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture activateAsync( + String portalSessionId, PortalSessionActivateParams params) { + String path = + buildPathWithParams( + "/portal_sessions/{portal-session-id}/activate", "portal-session-id", portalSessionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + PortalSessionActivateResponse.fromJson(response.getBodyAsString(), response)); + } + /** logout a portalSession (executes immediately) - returns raw Response. */ Response logoutRaw(String portalSessionId) throws ChargebeeException { String path = @@ -132,6 +152,16 @@ public PortalSessionLogoutResponse logout(String portalSessionId) throws Chargeb return PortalSessionLogoutResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture logoutAsync(String portalSessionId) { + String path = + buildPathWithParams( + "/portal_sessions/{portal-session-id}/logout", "portal-session-id", portalSessionId); + + return postAsync(path, null) + .thenApply( + response -> PortalSessionLogoutResponse.fromJson(response.getBodyAsString(), response)); + } + /** retrieve a portalSession (executes immediately) - returns raw Response. */ Response retrieveRaw(String portalSessionId) throws ChargebeeException { String path = @@ -145,4 +175,15 @@ public PortalSessionRetrieveResponse retrieve(String portalSessionId) throws Cha Response response = retrieveRaw(portalSessionId); return PortalSessionRetrieveResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture retrieveAsync(String portalSessionId) { + String path = + buildPathWithParams( + "/portal_sessions/{portal-session-id}", "portal-session-id", portalSessionId); + + return getAsync(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 fee9d8ef..99c95f1c 100644 --- a/src/main/java/com/chargebee/v4/services/PriceVariantService.java +++ b/src/main/java/com/chargebee/v4/services/PriceVariantService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.priceVariant.params.PriceVariantListParams; @@ -77,6 +78,16 @@ public PriceVariantDeleteResponse delete(String priceVariantId) throws Chargebee return PriceVariantDeleteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteAsync(String priceVariantId) { + String path = + buildPathWithParams( + "/price_variants/{price-variant-id}/delete", "price-variant-id", priceVariantId); + + return postAsync(path, null) + .thenApply( + response -> PriceVariantDeleteResponse.fromJson(response.getBodyAsString(), response)); + } + /** list a priceVariant using immutable params (executes immediately) - returns raw Response. */ Response listRaw(PriceVariantListParams params) throws ChargebeeException { @@ -101,12 +112,30 @@ public PriceVariantListResponse list(PriceVariantListParams params) throws Charg return PriceVariantListResponse.fromJson(response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync(PriceVariantListParams params) { + + return getAsync("/price_variants", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + PriceVariantListResponse.fromJson( + response.getBodyAsString(), this, params, response)); + } + public PriceVariantListResponse list() throws ChargebeeException { Response response = listRaw(); return PriceVariantListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/price_variants", null) + .thenApply( + response -> + PriceVariantListResponse.fromJson( + response.getBodyAsString(), this, null, response)); + } + /** create a priceVariant using immutable params (executes immediately) - returns raw Response. */ Response createRaw(PriceVariantCreateParams params) throws ChargebeeException { @@ -126,6 +155,14 @@ public PriceVariantCreateResponse create(PriceVariantCreateParams params) return PriceVariantCreateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createAsync( + PriceVariantCreateParams params) { + + return postAsync("/price_variants", params != null ? params.toFormData() : null) + .thenApply( + response -> PriceVariantCreateResponse.fromJson(response.getBodyAsString(), response)); + } + /** retrieve a priceVariant (executes immediately) - returns raw Response. */ Response retrieveRaw(String priceVariantId) throws ChargebeeException { String path = @@ -140,6 +177,17 @@ public PriceVariantRetrieveResponse retrieve(String priceVariantId) throws Charg return PriceVariantRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String priceVariantId) { + String path = + buildPathWithParams( + "/price_variants/{price-variant-id}", "price-variant-id", priceVariantId); + + return getAsync(path, null) + .thenApply( + response -> + PriceVariantRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** update a priceVariant (executes immediately) - returns raw Response. */ Response updateRaw(String priceVariantId) throws ChargebeeException { String path = @@ -172,8 +220,28 @@ public PriceVariantUpdateResponse update(String priceVariantId, PriceVariantUpda return PriceVariantUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync( + String priceVariantId, PriceVariantUpdateParams params) { + String path = + buildPathWithParams( + "/price_variants/{price-variant-id}", "price-variant-id", priceVariantId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> PriceVariantUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + public PriceVariantUpdateResponse update(String priceVariantId) throws ChargebeeException { Response response = updateRaw(priceVariantId); return PriceVariantUpdateResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture updateAsync(String priceVariantId) { + String path = + buildPathWithParams( + "/price_variants/{price-variant-id}", "price-variant-id", priceVariantId); + + return postAsync(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 763de0cf..caad8d79 100644 --- a/src/main/java/com/chargebee/v4/services/PricingPageSessionService.java +++ b/src/main/java/com/chargebee/v4/services/PricingPageSessionService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.pricingPageSession.params.PricingPageSessionCreateForExistingSubscriptionParams; @@ -84,6 +85,19 @@ public PricingPageSessionCreateForExistingSubscriptionResponse createForExisting response.getBodyAsString(), response); } + public CompletableFuture + createForExistingSubscriptionAsync( + PricingPageSessionCreateForExistingSubscriptionParams params) { + + return postAsync( + "/pricing_page_sessions/create_for_existing_subscription", + params != null ? params.toFormData() : null) + .thenApply( + response -> + PricingPageSessionCreateForExistingSubscriptionResponse.fromJson( + response.getBodyAsString(), response)); + } + /** * createForNewSubscription a pricingPageSession using immutable params (executes immediately) - * returns raw Response. @@ -112,4 +126,16 @@ public PricingPageSessionCreateForNewSubscriptionResponse createForNewSubscripti return PricingPageSessionCreateForNewSubscriptionResponse.fromJson( response.getBodyAsString(), response); } + + public CompletableFuture + createForNewSubscriptionAsync(PricingPageSessionCreateForNewSubscriptionParams params) { + + return postAsync( + "/pricing_page_sessions/create_for_new_subscription", + params != null ? params.toFormData() : null) + .thenApply( + response -> + PricingPageSessionCreateForNewSubscriptionResponse.fromJson( + response.getBodyAsString(), response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/ProductService.java b/src/main/java/com/chargebee/v4/services/ProductService.java index 1a3fef34..c2126aa2 100644 --- a/src/main/java/com/chargebee/v4/services/ProductService.java +++ b/src/main/java/com/chargebee/v4/services/ProductService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.product.params.ProductUpdateParams; @@ -78,6 +79,14 @@ public ProductRetrieveResponse retrieve(String productId) throws ChargebeeExcept return ProductRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String productId) { + String path = buildPathWithParams("/products/{product-id}", "product-id", productId); + + return getAsync(path, null) + .thenApply( + response -> ProductRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** update a product (executes immediately) - returns raw Response. */ Response updateRaw(String productId) throws ChargebeeException { String path = buildPathWithParams("/products/{product-id}", "product-id", productId); @@ -103,11 +112,27 @@ public ProductUpdateResponse update(String productId, ProductUpdateParams params return ProductUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync( + String productId, ProductUpdateParams params) { + String path = buildPathWithParams("/products/{product-id}", "product-id", productId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> ProductUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + public ProductUpdateResponse update(String productId) throws ChargebeeException { Response response = updateRaw(productId); return ProductUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync(String productId) { + String path = buildPathWithParams("/products/{product-id}", "product-id", productId); + + return postAsync(path, null) + .thenApply( + response -> ProductUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + /** delete a product (executes immediately) - returns raw Response. */ Response deleteRaw(String productId) throws ChargebeeException { String path = buildPathWithParams("/products/{product-id}/delete", "product-id", productId); @@ -120,6 +145,14 @@ public ProductDeleteResponse delete(String productId) throws ChargebeeException return ProductDeleteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteAsync(String productId) { + String path = buildPathWithParams("/products/{product-id}/delete", "product-id", productId); + + return postAsync(path, null) + .thenApply( + response -> ProductDeleteResponse.fromJson(response.getBodyAsString(), response)); + } + /** updateOptions a product (executes immediately) - returns raw Response. */ Response updateOptionsRaw(String productId) throws ChargebeeException { String path = @@ -153,11 +186,31 @@ public ProductUpdateOptionsResponse updateOptions( return ProductUpdateOptionsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateOptionsAsync( + String productId, ProductUpdateOptionsParams params) { + String path = + buildPathWithParams("/products/{product-id}/update_options", "product-id", productId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + ProductUpdateOptionsResponse.fromJson(response.getBodyAsString(), response)); + } + public ProductUpdateOptionsResponse updateOptions(String productId) throws ChargebeeException { Response response = updateOptionsRaw(productId); return ProductUpdateOptionsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateOptionsAsync(String productId) { + String path = + buildPathWithParams("/products/{product-id}/update_options", "product-id", productId); + + return postAsync(path, null) + .thenApply( + response -> + ProductUpdateOptionsResponse.fromJson(response.getBodyAsString(), response)); + } + /** list a product using immutable params (executes immediately) - returns raw Response. */ Response listRaw(ProductListParams params) throws ChargebeeException { @@ -182,12 +235,28 @@ public ProductListResponse list(ProductListParams params) throws ChargebeeExcept return ProductListResponse.fromJson(response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync(ProductListParams params) { + + return getAsync("/products", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + ProductListResponse.fromJson(response.getBodyAsString(), this, params, response)); + } + public ProductListResponse list() throws ChargebeeException { Response response = listRaw(); return ProductListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/products", null) + .thenApply( + response -> + ProductListResponse.fromJson(response.getBodyAsString(), this, null, response)); + } + /** create a product using immutable params (executes immediately) - returns raw Response. */ Response createRaw(ProductCreateParams params) throws ChargebeeException { @@ -205,4 +274,11 @@ public ProductCreateResponse create(ProductCreateParams params) throws Chargebee return ProductCreateResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture createAsync(ProductCreateParams params) { + + return postAsync("/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 6b616ca9..a281d0b7 100644 --- a/src/main/java/com/chargebee/v4/services/PromotionalCreditService.java +++ b/src/main/java/com/chargebee/v4/services/PromotionalCreditService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.promotionalCredit.params.PromotionalCreditListParams; @@ -80,6 +81,18 @@ public PromotionalCreditRetrieveResponse retrieve(String accountCreditId) return PromotionalCreditRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync( + String accountCreditId) { + String path = + buildPathWithParams( + "/promotional_credits/{account-credit-id}", "account-credit-id", accountCreditId); + + return getAsync(path, null) + .thenApply( + response -> + PromotionalCreditRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** * list a promotionalCredit using immutable params (executes immediately) - returns raw Response. */ @@ -110,12 +123,31 @@ public PromotionalCreditListResponse list(PromotionalCreditListParams params) response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync( + PromotionalCreditListParams params) { + + return getAsync("/promotional_credits", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + PromotionalCreditListResponse.fromJson( + response.getBodyAsString(), this, params, response)); + } + public PromotionalCreditListResponse list() throws ChargebeeException { Response response = listRaw(); return PromotionalCreditListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/promotional_credits", null) + .thenApply( + response -> + PromotionalCreditListResponse.fromJson( + response.getBodyAsString(), this, null, response)); + } + /** * deduct a promotionalCredit using immutable params (executes immediately) - returns raw * Response. @@ -141,6 +173,15 @@ public PromotionalCreditDeductResponse deduct(PromotionalCreditDeductParams para return PromotionalCreditDeductResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deductAsync( + PromotionalCreditDeductParams params) { + + return postAsync("/promotional_credits/deduct", params != null ? params.toFormData() : null) + .thenApply( + response -> + PromotionalCreditDeductResponse.fromJson(response.getBodyAsString(), response)); + } + /** * set a promotionalCredit using immutable params (executes immediately) - returns raw Response. */ @@ -164,6 +205,15 @@ public PromotionalCreditSetResponse set(PromotionalCreditSetParams params) return PromotionalCreditSetResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture setAsync( + PromotionalCreditSetParams params) { + + return postAsync("/promotional_credits/set", params != null ? params.toFormData() : null) + .thenApply( + response -> + PromotionalCreditSetResponse.fromJson(response.getBodyAsString(), response)); + } + /** * add a promotionalCredit using immutable params (executes immediately) - returns raw Response. */ @@ -186,4 +236,13 @@ public PromotionalCreditAddResponse add(PromotionalCreditAddParams params) return PromotionalCreditAddResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture addAsync( + PromotionalCreditAddParams params) { + + return postAsync("/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 c40269f4..d3a05a29 100644 --- a/src/main/java/com/chargebee/v4/services/PurchaseService.java +++ b/src/main/java/com/chargebee/v4/services/PurchaseService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.purchase.params.PurchaseCreateParams; @@ -72,6 +73,13 @@ public PurchaseCreateResponse create(PurchaseCreateParams params) throws Chargeb return PurchaseCreateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createAsync(PurchaseCreateParams params) { + + return postAsync("/purchases", params != null ? params.toFormData() : null) + .thenApply( + response -> PurchaseCreateResponse.fromJson(response.getBodyAsString(), response)); + } + /** estimate a purchase using immutable params (executes immediately) - returns raw Response. */ Response estimateRaw(PurchaseEstimateParams params) throws ChargebeeException { @@ -90,4 +98,11 @@ public PurchaseEstimateResponse estimate(PurchaseEstimateParams params) return PurchaseEstimateResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture estimateAsync(PurchaseEstimateParams params) { + + return postAsync("/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 35fd21ec..e87e786c 100644 --- a/src/main/java/com/chargebee/v4/services/QuoteService.java +++ b/src/main/java/com/chargebee/v4/services/QuoteService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.quote.params.CreateSubscriptionItemsForCustomerQuoteParams; @@ -174,6 +175,21 @@ public CreateSubscriptionItemsForCustomerQuoteResponse createSubscriptionItemsFo response.getBodyAsString(), response); } + public CompletableFuture + createSubscriptionItemsForCustomerQuoteAsync( + String customerId, CreateSubscriptionItemsForCustomerQuoteParams params) { + String path = + buildPathWithParams( + "/customers/{customer-id}/create_subscription_quote_for_items", + "customer-id", + customerId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + CreateSubscriptionItemsForCustomerQuoteResponse.fromJson( + response.getBodyAsString(), response)); + } + public CreateSubscriptionItemsForCustomerQuoteResponse createSubscriptionItemsForCustomerQuote( String customerId) throws ChargebeeException { Response response = createSubscriptionItemsForCustomerQuoteRaw(customerId); @@ -181,6 +197,21 @@ public CreateSubscriptionItemsForCustomerQuoteResponse createSubscriptionItemsFo response.getBodyAsString(), response); } + public CompletableFuture + createSubscriptionItemsForCustomerQuoteAsync(String customerId) { + String path = + buildPathWithParams( + "/customers/{customer-id}/create_subscription_quote_for_items", + "customer-id", + customerId); + + return postAsync(path, null) + .thenApply( + response -> + CreateSubscriptionItemsForCustomerQuoteResponse.fromJson( + response.getBodyAsString(), response)); + } + /** retrieve a quote (executes immediately) - returns raw Response. */ Response retrieveRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}", "quote-id", quoteId); @@ -193,6 +224,14 @@ public QuoteRetrieveResponse retrieve(String quoteId) throws ChargebeeException return QuoteRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String quoteId) { + String path = buildPathWithParams("/quotes/{quote-id}", "quote-id", quoteId); + + return getAsync(path, null) + .thenApply( + response -> QuoteRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** * editCreateSubscriptionCustomerQuoteForItems a quote (executes immediately) - returns raw * Response. @@ -240,6 +279,19 @@ Response editCreateSubscriptionCustomerQuoteForItemsRaw(String quoteId, String j response.getBodyAsString(), response); } + public CompletableFuture + editCreateSubscriptionCustomerQuoteForItemsAsync( + String quoteId, EditCreateSubscriptionCustomerQuoteForItemsParams params) { + String path = + buildPathWithParams( + "/quotes/{quote-id}/edit_create_subscription_quote_for_items", "quote-id", quoteId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + EditCreateSubscriptionCustomerQuoteForItemsResponse.fromJson( + response.getBodyAsString(), response)); + } + public EditCreateSubscriptionCustomerQuoteForItemsResponse editCreateSubscriptionCustomerQuoteForItems(String quoteId) throws ChargebeeException { Response response = editCreateSubscriptionCustomerQuoteForItemsRaw(quoteId); @@ -247,6 +299,19 @@ Response editCreateSubscriptionCustomerQuoteForItemsRaw(String quoteId, String j response.getBodyAsString(), response); } + public CompletableFuture + editCreateSubscriptionCustomerQuoteForItemsAsync(String quoteId) { + String path = + buildPathWithParams( + "/quotes/{quote-id}/edit_create_subscription_quote_for_items", "quote-id", quoteId); + + return postAsync(path, null) + .thenApply( + response -> + EditCreateSubscriptionCustomerQuoteForItemsResponse.fromJson( + response.getBodyAsString(), response)); + } + /** updateStatus a quote (executes immediately) - returns raw Response. */ Response updateStatusRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/update_status", "quote-id", quoteId); @@ -273,6 +338,14 @@ public QuoteUpdateStatusResponse updateStatus(String quoteId, QuoteUpdateStatusP return QuoteUpdateStatusResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateStatusAsync( + String quoteId, QuoteUpdateStatusParams params) { + String path = buildPathWithParams("/quotes/{quote-id}/update_status", "quote-id", quoteId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> QuoteUpdateStatusResponse.fromJson(response.getBodyAsString(), response)); + } + /** * updateSubscriptionQuoteForItems a quote using immutable params (executes immediately) - returns * raw Response. @@ -300,6 +373,18 @@ public UpdateSubscriptionQuoteForItemsResponse updateSubscriptionQuoteForItems( return UpdateSubscriptionQuoteForItemsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture + updateSubscriptionQuoteForItemsAsync(UpdateSubscriptionQuoteForItemsParams params) { + + return postAsync( + "/quotes/update_subscription_quote_for_items", + params != null ? params.toFormData() : null) + .thenApply( + response -> + UpdateSubscriptionQuoteForItemsResponse.fromJson( + response.getBodyAsString(), response)); + } + /** * quoteLineGroupsForQuote a quote using immutable params (executes immediately) - returns raw * Response. @@ -342,6 +427,26 @@ public QuoteLineGroupsForQuoteResponse quoteLineGroupsForQuote(String quoteId) response.getBodyAsString(), this, null, quoteId, response); } + 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) + .thenApply( + response -> + QuoteLineGroupsForQuoteResponse.fromJson( + response.getBodyAsString(), this, params, quoteId, response)); + } + + public CompletableFuture quoteLineGroupsForQuoteAsync( + String quoteId) { + String path = buildPathWithParams("/quotes/{quote-id}/quote_line_groups", "quote-id", quoteId); + return getAsync(path, null) + .thenApply( + response -> + QuoteLineGroupsForQuoteResponse.fromJson( + response.getBodyAsString(), this, null, quoteId, response)); + } + /** extendExpiryDate a quote (executes immediately) - returns raw Response. */ Response extendExpiryDateRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/extend_expiry_date", "quote-id", quoteId); @@ -372,6 +477,15 @@ public QuoteExtendExpiryDateResponse extendExpiryDate( return QuoteExtendExpiryDateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture extendExpiryDateAsync( + String quoteId, QuoteExtendExpiryDateParams params) { + String path = buildPathWithParams("/quotes/{quote-id}/extend_expiry_date", "quote-id", quoteId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + QuoteExtendExpiryDateResponse.fromJson(response.getBodyAsString(), response)); + } + /** editForChargeItemsAndCharges a quote (executes immediately) - returns raw Response. */ Response editForChargeItemsAndChargesRaw(String quoteId) throws ChargebeeException { String path = @@ -411,12 +525,38 @@ public QuoteEditForChargeItemsAndChargesResponse editForChargeItemsAndCharges( return QuoteEditForChargeItemsAndChargesResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture + editForChargeItemsAndChargesAsync( + String quoteId, QuoteEditForChargeItemsAndChargesParams params) { + String path = + buildPathWithParams( + "/quotes/{quote-id}/edit_for_charge_items_and_charges", "quote-id", quoteId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + QuoteEditForChargeItemsAndChargesResponse.fromJson( + response.getBodyAsString(), response)); + } + public QuoteEditForChargeItemsAndChargesResponse editForChargeItemsAndCharges(String quoteId) throws ChargebeeException { Response response = editForChargeItemsAndChargesRaw(quoteId); return QuoteEditForChargeItemsAndChargesResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture + editForChargeItemsAndChargesAsync(String quoteId) { + String path = + buildPathWithParams( + "/quotes/{quote-id}/edit_for_charge_items_and_charges", "quote-id", quoteId); + + return postAsync(path, null) + .thenApply( + response -> + QuoteEditForChargeItemsAndChargesResponse.fromJson( + response.getBodyAsString(), response)); + } + /** editUpdateSubscriptionQuoteForItems a quote (executes immediately) - returns raw Response. */ Response editUpdateSubscriptionQuoteForItemsRaw(String quoteId) throws ChargebeeException { String path = @@ -457,6 +597,19 @@ public EditUpdateSubscriptionQuoteForItemsResponse editUpdateSubscriptionQuoteFo response.getBodyAsString(), response); } + public CompletableFuture + editUpdateSubscriptionQuoteForItemsAsync( + String quoteId, EditUpdateSubscriptionQuoteForItemsParams params) { + String path = + buildPathWithParams( + "/quotes/{quote-id}/edit_update_subscription_quote_for_items", "quote-id", quoteId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + EditUpdateSubscriptionQuoteForItemsResponse.fromJson( + response.getBodyAsString(), response)); + } + public EditUpdateSubscriptionQuoteForItemsResponse editUpdateSubscriptionQuoteForItems( String quoteId) throws ChargebeeException { Response response = editUpdateSubscriptionQuoteForItemsRaw(quoteId); @@ -464,6 +617,19 @@ public EditUpdateSubscriptionQuoteForItemsResponse editUpdateSubscriptionQuoteFo response.getBodyAsString(), response); } + public CompletableFuture + editUpdateSubscriptionQuoteForItemsAsync(String quoteId) { + String path = + buildPathWithParams( + "/quotes/{quote-id}/edit_update_subscription_quote_for_items", "quote-id", quoteId); + + return postAsync(path, null) + .thenApply( + response -> + EditUpdateSubscriptionQuoteForItemsResponse.fromJson( + response.getBodyAsString(), response)); + } + /** list a quote using immutable params (executes immediately) - returns raw Response. */ Response listRaw(QuoteListParams params) throws ChargebeeException { @@ -488,12 +654,28 @@ public QuoteListResponse list(QuoteListParams params) throws ChargebeeException return QuoteListResponse.fromJson(response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync(QuoteListParams params) { + + return getAsync("/quotes", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + QuoteListResponse.fromJson(response.getBodyAsString(), this, params, response)); + } + public QuoteListResponse list() throws ChargebeeException { Response response = listRaw(); return QuoteListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/quotes", null) + .thenApply( + response -> + QuoteListResponse.fromJson(response.getBodyAsString(), this, null, response)); + } + /** pdf a quote (executes immediately) - returns raw Response. */ Response pdfRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/pdf", "quote-id", quoteId); @@ -518,11 +700,24 @@ public QuotePdfResponse pdf(String quoteId, QuotePdfParams params) throws Charge return QuotePdfResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture pdfAsync(String quoteId, QuotePdfParams params) { + String path = buildPathWithParams("/quotes/{quote-id}/pdf", "quote-id", quoteId); + return postAsync(path, params.toFormData()) + .thenApply(response -> QuotePdfResponse.fromJson(response.getBodyAsString(), response)); + } + public QuotePdfResponse pdf(String quoteId) throws ChargebeeException { Response response = pdfRaw(quoteId); return QuotePdfResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture pdfAsync(String quoteId) { + String path = buildPathWithParams("/quotes/{quote-id}/pdf", "quote-id", quoteId); + + return postAsync(path, null) + .thenApply(response -> QuotePdfResponse.fromJson(response.getBodyAsString(), response)); + } + /** convert a quote (executes immediately) - returns raw Response. */ Response convertRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/convert", "quote-id", quoteId); @@ -548,11 +743,25 @@ public QuoteConvertResponse convert(String quoteId, QuoteConvertParams params) return QuoteConvertResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture convertAsync( + String quoteId, QuoteConvertParams params) { + String path = buildPathWithParams("/quotes/{quote-id}/convert", "quote-id", quoteId); + return postAsync(path, params.toFormData()) + .thenApply(response -> QuoteConvertResponse.fromJson(response.getBodyAsString(), response)); + } + public QuoteConvertResponse convert(String quoteId) throws ChargebeeException { Response response = convertRaw(quoteId); return QuoteConvertResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture convertAsync(String quoteId) { + String path = buildPathWithParams("/quotes/{quote-id}/convert", "quote-id", quoteId); + + return postAsync(path, null) + .thenApply(response -> QuoteConvertResponse.fromJson(response.getBodyAsString(), response)); + } + /** * createForChargeItemsAndCharges a quote using immutable params (executes immediately) - returns * raw Response. @@ -581,6 +790,18 @@ public QuoteCreateForChargeItemsAndChargesResponse createForChargeItemsAndCharge response.getBodyAsString(), response); } + public CompletableFuture + createForChargeItemsAndChargesAsync(QuoteCreateForChargeItemsAndChargesParams params) { + + return postAsync( + "/quotes/create_for_charge_items_and_charges", + params != null ? params.toFormData() : null) + .thenApply( + response -> + QuoteCreateForChargeItemsAndChargesResponse.fromJson( + response.getBodyAsString(), response)); + } + /** delete a quote (executes immediately) - returns raw Response. */ Response deleteRaw(String quoteId) throws ChargebeeException { String path = buildPathWithParams("/quotes/{quote-id}/delete", "quote-id", quoteId); @@ -606,11 +827,25 @@ public QuoteDeleteResponse delete(String quoteId, QuoteDeleteParams params) return QuoteDeleteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteAsync( + String quoteId, QuoteDeleteParams params) { + String path = buildPathWithParams("/quotes/{quote-id}/delete", "quote-id", quoteId); + return postAsync(path, params.toFormData()) + .thenApply(response -> QuoteDeleteResponse.fromJson(response.getBodyAsString(), response)); + } + public QuoteDeleteResponse delete(String quoteId) throws ChargebeeException { Response response = deleteRaw(quoteId); return QuoteDeleteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteAsync(String quoteId) { + String path = buildPathWithParams("/quotes/{quote-id}/delete", "quote-id", quoteId); + + return postAsync(path, null) + .thenApply(response -> QuoteDeleteResponse.fromJson(response.getBodyAsString(), response)); + } + /** editOneTimeQuote a quote (executes immediately) - returns raw Response. */ Response editOneTimeQuoteRaw(String quoteId) throws ChargebeeException { String path = @@ -644,11 +879,29 @@ public EditOneTimeQuoteResponse editOneTimeQuote(String quoteId, EditOneTimeQuot return EditOneTimeQuoteResponse.fromJson(response.getBodyAsString(), response); } + 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()) + .thenApply( + response -> EditOneTimeQuoteResponse.fromJson(response.getBodyAsString(), response)); + } + public EditOneTimeQuoteResponse editOneTimeQuote(String quoteId) throws ChargebeeException { Response response = editOneTimeQuoteRaw(quoteId); return EditOneTimeQuoteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture editOneTimeQuoteAsync(String quoteId) { + String path = + buildPathWithParams("/quotes/{quote-id}/edit_one_time_quote", "quote-id", quoteId); + + return postAsync(path, null) + .thenApply( + response -> EditOneTimeQuoteResponse.fromJson(response.getBodyAsString(), response)); + } + /** * updateSubscriptionQuote a quote using immutable params (executes immediately) - returns raw * Response. @@ -675,6 +928,16 @@ public UpdateSubscriptionQuoteResponse updateSubscriptionQuote( return UpdateSubscriptionQuoteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateSubscriptionQuoteAsync( + UpdateSubscriptionQuoteParams params) { + + return postAsync( + "/quotes/update_subscription_quote", params != null ? params.toFormData() : null) + .thenApply( + response -> + UpdateSubscriptionQuoteResponse.fromJson(response.getBodyAsString(), response)); + } + /** * createForOnetimeCharges a quote using immutable params (executes immediately) - returns raw * Response. @@ -701,6 +964,17 @@ public QuoteCreateForOnetimeChargesResponse createForOnetimeCharges( return QuoteCreateForOnetimeChargesResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createForOnetimeChargesAsync( + QuoteCreateForOnetimeChargesParams params) { + + return postAsync( + "/quotes/create_for_onetime_charges", params != null ? params.toFormData() : null) + .thenApply( + response -> + QuoteCreateForOnetimeChargesResponse.fromJson( + response.getBodyAsString(), response)); + } + /** createSubscriptionForCustomerQuote a quote (executes immediately) - returns raw Response. */ Response createSubscriptionForCustomerQuoteRaw(String customerId) throws ChargebeeException { String path = @@ -743,6 +1017,19 @@ public CreateSubscriptionForCustomerQuoteResponse createSubscriptionForCustomerQ response.getBodyAsString(), response); } + public CompletableFuture + createSubscriptionForCustomerQuoteAsync( + String customerId, CreateSubscriptionForCustomerQuoteParams params) { + String path = + buildPathWithParams( + "/customers/{customer-id}/create_subscription_quote", "customer-id", customerId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + CreateSubscriptionForCustomerQuoteResponse.fromJson( + response.getBodyAsString(), response)); + } + public CreateSubscriptionForCustomerQuoteResponse createSubscriptionForCustomerQuote( String customerId) throws ChargebeeException { Response response = createSubscriptionForCustomerQuoteRaw(customerId); @@ -750,6 +1037,19 @@ public CreateSubscriptionForCustomerQuoteResponse createSubscriptionForCustomerQ response.getBodyAsString(), response); } + public CompletableFuture + createSubscriptionForCustomerQuoteAsync(String customerId) { + String path = + buildPathWithParams( + "/customers/{customer-id}/create_subscription_quote", "customer-id", customerId); + + return postAsync(path, null) + .thenApply( + response -> + CreateSubscriptionForCustomerQuoteResponse.fromJson( + response.getBodyAsString(), response)); + } + /** editUpdateSubscriptionQuote a quote (executes immediately) - returns raw Response. */ Response editUpdateSubscriptionQuoteRaw(String quoteId) throws ChargebeeException { String path = @@ -789,12 +1089,35 @@ public EditUpdateSubscriptionQuoteResponse editUpdateSubscriptionQuote( return EditUpdateSubscriptionQuoteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture editUpdateSubscriptionQuoteAsync( + String quoteId, EditUpdateSubscriptionQuoteParams params) { + String path = + buildPathWithParams( + "/quotes/{quote-id}/edit_update_subscription_quote", "quote-id", quoteId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + EditUpdateSubscriptionQuoteResponse.fromJson(response.getBodyAsString(), response)); + } + public EditUpdateSubscriptionQuoteResponse editUpdateSubscriptionQuote(String quoteId) throws ChargebeeException { Response response = editUpdateSubscriptionQuoteRaw(quoteId); return EditUpdateSubscriptionQuoteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture editUpdateSubscriptionQuoteAsync( + String quoteId) { + String path = + buildPathWithParams( + "/quotes/{quote-id}/edit_update_subscription_quote", "quote-id", quoteId); + + return postAsync(path, null) + .thenApply( + response -> + EditUpdateSubscriptionQuoteResponse.fromJson(response.getBodyAsString(), response)); + } + /** * editCreateSubscriptionForCustomerQuote a quote (executes immediately) - returns raw Response. */ @@ -839,10 +1162,36 @@ public EditCreateSubscriptionForCustomerQuoteResponse editCreateSubscriptionForC response.getBodyAsString(), response); } + public CompletableFuture + editCreateSubscriptionForCustomerQuoteAsync( + String quoteId, EditCreateSubscriptionForCustomerQuoteParams params) { + String path = + buildPathWithParams( + "/quotes/{quote-id}/edit_create_subscription_quote", "quote-id", quoteId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + EditCreateSubscriptionForCustomerQuoteResponse.fromJson( + response.getBodyAsString(), response)); + } + public EditCreateSubscriptionForCustomerQuoteResponse editCreateSubscriptionForCustomerQuote( String quoteId) throws ChargebeeException { Response response = editCreateSubscriptionForCustomerQuoteRaw(quoteId); return EditCreateSubscriptionForCustomerQuoteResponse.fromJson( response.getBodyAsString(), response); } + + public CompletableFuture + editCreateSubscriptionForCustomerQuoteAsync(String quoteId) { + String path = + buildPathWithParams( + "/quotes/{quote-id}/edit_create_subscription_quote", "quote-id", quoteId); + + return postAsync(path, null) + .thenApply( + response -> + EditCreateSubscriptionForCustomerQuoteResponse.fromJson( + response.getBodyAsString(), response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/RampService.java b/src/main/java/com/chargebee/v4/services/RampService.java index e6f96850..76636712 100644 --- a/src/main/java/com/chargebee/v4/services/RampService.java +++ b/src/main/java/com/chargebee/v4/services/RampService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.ramp.params.RampCreateForSubscriptionParams; @@ -74,6 +75,13 @@ public RampRetrieveResponse retrieve(String rampId) throws ChargebeeException { return RampRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String rampId) { + String path = buildPathWithParams("/ramps/{ramp-id}", "ramp-id", rampId); + + return getAsync(path, null) + .thenApply(response -> RampRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** createForSubscription a ramp (executes immediately) - returns raw Response. */ Response createForSubscriptionRaw(String subscriptionId) throws ChargebeeException { String path = @@ -113,6 +121,17 @@ public RampCreateForSubscriptionResponse createForSubscription( return RampCreateForSubscriptionResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createForSubscriptionAsync( + String subscriptionId, RampCreateForSubscriptionParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/create_ramp", "subscription-id", subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + RampCreateForSubscriptionResponse.fromJson(response.getBodyAsString(), response)); + } + /** list a ramp using immutable params (executes immediately) - returns raw Response. */ Response listRaw(RampListParams params) throws ChargebeeException { @@ -137,12 +156,28 @@ public RampListResponse list(RampListParams params) throws ChargebeeException { return RampListResponse.fromJson(response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync(RampListParams params) { + + return getAsync("/ramps", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + RampListResponse.fromJson(response.getBodyAsString(), this, params, response)); + } + public RampListResponse list() throws ChargebeeException { Response response = listRaw(); return RampListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/ramps", null) + .thenApply( + response -> + RampListResponse.fromJson(response.getBodyAsString(), this, null, response)); + } + /** update a ramp (executes immediately) - returns raw Response. */ Response updateRaw(String rampId) throws ChargebeeException { String path = buildPathWithParams("/ramps/{ramp-id}/update", "ramp-id", rampId); @@ -168,6 +203,12 @@ public RampUpdateResponse update(String rampId, RampUpdateParams params) return RampUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync(String rampId, RampUpdateParams params) { + String path = buildPathWithParams("/ramps/{ramp-id}/update", "ramp-id", rampId); + return postAsync(path, params.toFormData()) + .thenApply(response -> RampUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + /** delete a ramp (executes immediately) - returns raw Response. */ Response deleteRaw(String rampId) throws ChargebeeException { String path = buildPathWithParams("/ramps/{ramp-id}/delete", "ramp-id", rampId); @@ -179,4 +220,11 @@ public RampDeleteResponse delete(String rampId) throws ChargebeeException { Response response = deleteRaw(rampId); return RampDeleteResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture deleteAsync(String rampId) { + String path = buildPathWithParams("/ramps/{ramp-id}/delete", "ramp-id", rampId); + + return postAsync(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 67b65fe9..c3b29555 100644 --- a/src/main/java/com/chargebee/v4/services/RecordedPurchaseService.java +++ b/src/main/java/com/chargebee/v4/services/RecordedPurchaseService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.recordedPurchase.params.RecordedPurchaseCreateParams; @@ -70,6 +71,20 @@ public RecordedPurchaseRetrieveResponse retrieve(String recordedPurchaseId) return RecordedPurchaseRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync( + String recordedPurchaseId) { + String path = + buildPathWithParams( + "/recorded_purchases/{recorded-purchase-id}", + "recorded-purchase-id", + recordedPurchaseId); + + return getAsync(path, null) + .thenApply( + response -> + RecordedPurchaseRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** * create a recordedPurchase using immutable params (executes immediately) - returns raw Response. */ @@ -92,4 +107,13 @@ public RecordedPurchaseCreateResponse create(RecordedPurchaseCreateParams params return RecordedPurchaseCreateResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture createAsync( + RecordedPurchaseCreateParams params) { + + return postAsync("/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 19a552d5..ed5039e0 100644 --- a/src/main/java/com/chargebee/v4/services/ResourceMigrationService.java +++ b/src/main/java/com/chargebee/v4/services/ResourceMigrationService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.resourceMigration.params.ResourceMigrationRetrieveLatestParams; @@ -77,4 +78,15 @@ public ResourceMigrationRetrieveLatestResponse retrieveLatest( return ResourceMigrationRetrieveLatestResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture retrieveLatestAsync( + ResourceMigrationRetrieveLatestParams params) { + + return getAsync( + "/resource_migrations/retrieve_latest", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + ResourceMigrationRetrieveLatestResponse.fromJson( + response.getBodyAsString(), response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/RuleService.java b/src/main/java/com/chargebee/v4/services/RuleService.java index 3b774961..e15fad1a 100644 --- a/src/main/java/com/chargebee/v4/services/RuleService.java +++ b/src/main/java/com/chargebee/v4/services/RuleService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.rule.responses.RuleRetrieveResponse; @@ -59,4 +60,11 @@ public RuleRetrieveResponse retrieve(String ruleId) throws ChargebeeException { Response response = retrieveRaw(ruleId); return RuleRetrieveResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture retrieveAsync(String ruleId) { + String path = buildPathWithParams("/rules/{rule-id}", "rule-id", ruleId); + + return getAsync(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 f1d0f278..5d7cc4d2 100644 --- a/src/main/java/com/chargebee/v4/services/SiteMigrationDetailService.java +++ b/src/main/java/com/chargebee/v4/services/SiteMigrationDetailService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.siteMigrationDetail.params.SiteMigrationDetailListParams; @@ -83,10 +84,29 @@ public SiteMigrationDetailListResponse list(SiteMigrationDetailListParams params response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync( + SiteMigrationDetailListParams params) { + + return getAsync("/site_migration_details", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + SiteMigrationDetailListResponse.fromJson( + response.getBodyAsString(), this, params, response)); + } + public SiteMigrationDetailListResponse list() throws ChargebeeException { Response response = listRaw(); return SiteMigrationDetailListResponse.fromJson( response.getBodyAsString(), this, null, response); } + + public CompletableFuture listAsync() { + + return getAsync("/site_migration_details", null) + .thenApply( + response -> + SiteMigrationDetailListResponse.fromJson( + response.getBodyAsString(), this, null, response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/SubscriptionEntitlementService.java b/src/main/java/com/chargebee/v4/services/SubscriptionEntitlementService.java index ef765657..0c8e6f4c 100644 --- a/src/main/java/com/chargebee/v4/services/SubscriptionEntitlementService.java +++ b/src/main/java/com/chargebee/v4/services/SubscriptionEntitlementService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.subscriptionEntitlement.params.SetSubscriptionEntitlementAvailabilityParams; @@ -108,6 +109,21 @@ public SetSubscriptionEntitlementAvailabilityResponse setSubscriptionEntitlement response.getBodyAsString(), response); } + public CompletableFuture + setSubscriptionEntitlementAvailabilityAsync( + String subscriptionId, SetSubscriptionEntitlementAvailabilityParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/subscription_entitlements/set_availability", + "subscription-id", + subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + SetSubscriptionEntitlementAvailabilityResponse.fromJson( + response.getBodyAsString(), response)); + } + /** * subscriptionEntitlementsForSubscription a subscriptionEntitlement using immutable params * (executes immediately) - returns raw Response. @@ -165,4 +181,33 @@ public SubscriptionEntitlementsForSubscriptionResponse subscriptionEntitlementsF return SubscriptionEntitlementsForSubscriptionResponse.fromJson( response.getBodyAsString(), this, null, subscriptionId, response); } + + public CompletableFuture + subscriptionEntitlementsForSubscriptionAsync( + String subscriptionId, SubscriptionEntitlementsForSubscriptionParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/subscription_entitlements", + "subscription-id", + subscriptionId); + return getAsync(path, params != null ? params.toQueryParams() : null) + .thenApply( + response -> + SubscriptionEntitlementsForSubscriptionResponse.fromJson( + response.getBodyAsString(), this, params, subscriptionId, response)); + } + + public CompletableFuture + subscriptionEntitlementsForSubscriptionAsync(String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/subscription_entitlements", + "subscription-id", + subscriptionId); + return getAsync(path, null) + .thenApply( + response -> + SubscriptionEntitlementsForSubscriptionResponse.fromJson( + response.getBodyAsString(), this, null, subscriptionId, response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/SubscriptionService.java b/src/main/java/com/chargebee/v4/services/SubscriptionService.java index 60aeeced..5df73465 100644 --- a/src/main/java/com/chargebee/v4/services/SubscriptionService.java +++ b/src/main/java/com/chargebee/v4/services/SubscriptionService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.subscription.params.SubscriptionRemoveAdvanceInvoiceScheduleParams; @@ -229,6 +230,21 @@ public SubscriptionRemoveAdvanceInvoiceScheduleResponse removeAdvanceInvoiceSche response.getBodyAsString(), response); } + public CompletableFuture + removeAdvanceInvoiceScheduleAsync( + String subscriptionId, SubscriptionRemoveAdvanceInvoiceScheduleParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/remove_advance_invoice_schedule", + "subscription-id", + subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + SubscriptionRemoveAdvanceInvoiceScheduleResponse.fromJson( + response.getBodyAsString(), response)); + } + public SubscriptionRemoveAdvanceInvoiceScheduleResponse removeAdvanceInvoiceSchedule( String subscriptionId) throws ChargebeeException { Response response = removeAdvanceInvoiceScheduleRaw(subscriptionId); @@ -236,6 +252,21 @@ public SubscriptionRemoveAdvanceInvoiceScheduleResponse removeAdvanceInvoiceSche response.getBodyAsString(), response); } + public CompletableFuture + removeAdvanceInvoiceScheduleAsync(String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/remove_advance_invoice_schedule", + "subscription-id", + subscriptionId); + + return postAsync(path, null) + .thenApply( + response -> + SubscriptionRemoveAdvanceInvoiceScheduleResponse.fromJson( + response.getBodyAsString(), response)); + } + /** updateForItems a subscription (executes immediately) - returns raw Response. */ Response updateForItemsRaw(String subscriptionId) throws ChargebeeException { String path = @@ -274,12 +305,35 @@ public SubscriptionUpdateForItemsResponse updateForItems( return SubscriptionUpdateForItemsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateForItemsAsync( + String subscriptionId, SubscriptionUpdateForItemsParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/update_for_items", "subscription-id", subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + SubscriptionUpdateForItemsResponse.fromJson(response.getBodyAsString(), response)); + } + public SubscriptionUpdateForItemsResponse updateForItems(String subscriptionId) throws ChargebeeException { Response response = updateForItemsRaw(subscriptionId); return SubscriptionUpdateForItemsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateForItemsAsync( + String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/update_for_items", "subscription-id", subscriptionId); + + return postAsync(path, null) + .thenApply( + response -> + SubscriptionUpdateForItemsResponse.fromJson(response.getBodyAsString(), response)); + } + /** removeCoupons a subscription (executes immediately) - returns raw Response. */ Response removeCouponsRaw(String subscriptionId) throws ChargebeeException { String path = @@ -318,12 +372,35 @@ public SubscriptionRemoveCouponsResponse removeCoupons( return SubscriptionRemoveCouponsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture removeCouponsAsync( + String subscriptionId, SubscriptionRemoveCouponsParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/remove_coupons", "subscription-id", subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + SubscriptionRemoveCouponsResponse.fromJson(response.getBodyAsString(), response)); + } + public SubscriptionRemoveCouponsResponse removeCoupons(String subscriptionId) throws ChargebeeException { Response response = removeCouponsRaw(subscriptionId); return SubscriptionRemoveCouponsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture removeCouponsAsync( + String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/remove_coupons", "subscription-id", subscriptionId); + + return postAsync(path, null) + .thenApply( + response -> + SubscriptionRemoveCouponsResponse.fromJson(response.getBodyAsString(), response)); + } + /** resume a subscription (executes immediately) - returns raw Response. */ Response resumeRaw(String subscriptionId) throws ChargebeeException { String path = @@ -356,11 +433,31 @@ public SubscriptionResumeResponse resume(String subscriptionId, SubscriptionResu return SubscriptionResumeResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture resumeAsync( + String subscriptionId, SubscriptionResumeParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/resume", "subscription-id", subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> SubscriptionResumeResponse.fromJson(response.getBodyAsString(), response)); + } + public SubscriptionResumeResponse resume(String subscriptionId) throws ChargebeeException { Response response = resumeRaw(subscriptionId); return SubscriptionResumeResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture resumeAsync(String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/resume", "subscription-id", subscriptionId); + + return postAsync(path, null) + .thenApply( + response -> SubscriptionResumeResponse.fromJson(response.getBodyAsString(), response)); + } + /** cancelForItems a subscription (executes immediately) - returns raw Response. */ Response cancelForItemsRaw(String subscriptionId) throws ChargebeeException { String path = @@ -399,12 +496,35 @@ public SubscriptionCancelForItemsResponse cancelForItems( return SubscriptionCancelForItemsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture cancelForItemsAsync( + String subscriptionId, SubscriptionCancelForItemsParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/cancel_for_items", "subscription-id", subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + SubscriptionCancelForItemsResponse.fromJson(response.getBodyAsString(), response)); + } + public SubscriptionCancelForItemsResponse cancelForItems(String subscriptionId) throws ChargebeeException { Response response = cancelForItemsRaw(subscriptionId); return SubscriptionCancelForItemsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture cancelForItemsAsync( + String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/cancel_for_items", "subscription-id", subscriptionId); + + return postAsync(path, null) + .thenApply( + response -> + SubscriptionCancelForItemsResponse.fromJson(response.getBodyAsString(), response)); + } + /** regenerateInvoice a subscription (executes immediately) - returns raw Response. */ Response regenerateInvoiceRaw(String subscriptionId) throws ChargebeeException { String path = @@ -450,12 +570,41 @@ public SubscriptionRegenerateInvoiceResponse regenerateInvoice( return SubscriptionRegenerateInvoiceResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture regenerateInvoiceAsync( + String subscriptionId, SubscriptionRegenerateInvoiceParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/regenerate_invoice", + "subscription-id", + subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + SubscriptionRegenerateInvoiceResponse.fromJson( + response.getBodyAsString(), response)); + } + public SubscriptionRegenerateInvoiceResponse regenerateInvoice(String subscriptionId) throws ChargebeeException { Response response = regenerateInvoiceRaw(subscriptionId); return SubscriptionRegenerateInvoiceResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture regenerateInvoiceAsync( + String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/regenerate_invoice", + "subscription-id", + subscriptionId); + + return postAsync(path, null) + .thenApply( + response -> + SubscriptionRegenerateInvoiceResponse.fromJson( + response.getBodyAsString(), response)); + } + /** list a subscription using immutable params (executes immediately) - returns raw Response. */ Response listRaw(SubscriptionListParams params) throws ChargebeeException { @@ -480,12 +629,30 @@ public SubscriptionListResponse list(SubscriptionListParams params) throws Charg return SubscriptionListResponse.fromJson(response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync(SubscriptionListParams params) { + + return getAsync("/subscriptions", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + SubscriptionListResponse.fromJson( + response.getBodyAsString(), this, params, response)); + } + public SubscriptionListResponse list() throws ChargebeeException { Response response = listRaw(); return SubscriptionListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/subscriptions", null) + .thenApply( + response -> + SubscriptionListResponse.fromJson( + response.getBodyAsString(), this, null, response)); + } + /** create a subscription using immutable params (executes immediately) - returns raw Response. */ Response createRaw(SubscriptionCreateParams params) throws ChargebeeException { @@ -505,6 +672,14 @@ public SubscriptionCreateResponse create(SubscriptionCreateParams params) return SubscriptionCreateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createAsync( + SubscriptionCreateParams params) { + + return postAsync("/subscriptions", params != null ? params.toFormData() : null) + .thenApply( + response -> SubscriptionCreateResponse.fromJson(response.getBodyAsString(), response)); + } + /** move a subscription (executes immediately) - returns raw Response. */ Response moveRaw(String subscriptionId) throws ChargebeeException { String path = @@ -536,6 +711,16 @@ public SubscriptionMoveResponse move(String subscriptionId, SubscriptionMovePara return SubscriptionMoveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture moveAsync( + String subscriptionId, SubscriptionMoveParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/move", "subscription-id", subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> SubscriptionMoveResponse.fromJson(response.getBodyAsString(), response)); + } + /** * subscriptionsForCustomer a subscription using immutable params (executes immediately) - returns * raw Response. @@ -582,6 +767,28 @@ public SubscriptionsForCustomerResponse subscriptionsForCustomer(String customer response.getBodyAsString(), this, null, customerId, response); } + public CompletableFuture subscriptionsForCustomerAsync( + String customerId, SubscriptionsForCustomerParams params) { + String path = + buildPathWithParams("/customers/{customer-id}/subscriptions", "customer-id", customerId); + return getAsync(path, params != null ? params.toQueryParams() : null) + .thenApply( + response -> + SubscriptionsForCustomerResponse.fromJson( + response.getBodyAsString(), this, params, customerId, response)); + } + + public CompletableFuture subscriptionsForCustomerAsync( + String customerId) { + String path = + buildPathWithParams("/customers/{customer-id}/subscriptions", "customer-id", customerId); + return getAsync(path, null) + .thenApply( + response -> + SubscriptionsForCustomerResponse.fromJson( + response.getBodyAsString(), this, null, customerId, response)); + } + /** createForCustomer a subscription (executes immediately) - returns raw Response. */ Response createForCustomerRaw(String customerId) throws ChargebeeException { String path = @@ -617,6 +824,17 @@ public SubscriptionCreateForCustomerResponse createForCustomer( return SubscriptionCreateForCustomerResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createForCustomerAsync( + String customerId, SubscriptionCreateForCustomerParams params) { + String path = + buildPathWithParams("/customers/{customer-id}/subscriptions", "customer-id", customerId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + SubscriptionCreateForCustomerResponse.fromJson( + response.getBodyAsString(), response)); + } + /** importForItems a subscription (executes immediately) - returns raw Response. */ Response importForItemsRaw(String customerId) throws ChargebeeException { String path = @@ -652,6 +870,16 @@ public SubscriptionImportForItemsResponse importForItems( return SubscriptionImportForItemsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture importForItemsAsync( + String customerId, SubscriptionImportForItemsParams params) { + String path = + buildPathWithParams("/customers/{customer-id}/import_for_items", "customer-id", customerId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + SubscriptionImportForItemsResponse.fromJson(response.getBodyAsString(), response)); + } + /** * retrieveAdvanceInvoiceSchedule a subscription (executes immediately) - returns raw Response. */ @@ -672,6 +900,21 @@ public SubscriptionRetrieveAdvanceInvoiceScheduleResponse retrieveAdvanceInvoice response.getBodyAsString(), response); } + public CompletableFuture + retrieveAdvanceInvoiceScheduleAsync(String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/retrieve_advance_invoice_schedule", + "subscription-id", + subscriptionId); + + return getAsync(path, null) + .thenApply( + response -> + SubscriptionRetrieveAdvanceInvoiceScheduleResponse.fromJson( + response.getBodyAsString(), response)); + } + /** removeScheduledCancellation a subscription (executes immediately) - returns raw Response. */ Response removeScheduledCancellationRaw(String subscriptionId) throws ChargebeeException { String path = @@ -720,6 +963,21 @@ public SubscriptionRemoveScheduledCancellationResponse removeScheduledCancellati response.getBodyAsString(), response); } + public CompletableFuture + removeScheduledCancellationAsync( + String subscriptionId, SubscriptionRemoveScheduledCancellationParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/remove_scheduled_cancellation", + "subscription-id", + subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + SubscriptionRemoveScheduledCancellationResponse.fromJson( + response.getBodyAsString(), response)); + } + public SubscriptionRemoveScheduledCancellationResponse removeScheduledCancellation( String subscriptionId) throws ChargebeeException { Response response = removeScheduledCancellationRaw(subscriptionId); @@ -727,6 +985,21 @@ public SubscriptionRemoveScheduledCancellationResponse removeScheduledCancellati response.getBodyAsString(), response); } + public CompletableFuture + removeScheduledCancellationAsync(String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/remove_scheduled_cancellation", + "subscription-id", + subscriptionId); + + return postAsync(path, null) + .thenApply( + response -> + SubscriptionRemoveScheduledCancellationResponse.fromJson( + response.getBodyAsString(), response)); + } + /** retrieveWithScheduledChanges a subscription (executes immediately) - returns raw Response. */ Response retrieveWithScheduledChangesRaw(String subscriptionId) throws ChargebeeException { String path = @@ -745,6 +1018,21 @@ public SubscriptionRetrieveWithScheduledChangesResponse retrieveWithScheduledCha response.getBodyAsString(), response); } + public CompletableFuture + retrieveWithScheduledChangesAsync(String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/retrieve_with_scheduled_changes", + "subscription-id", + subscriptionId); + + return getAsync(path, null) + .thenApply( + response -> + SubscriptionRetrieveWithScheduledChangesResponse.fromJson( + response.getBodyAsString(), response)); + } + /** reactivate a subscription (executes immediately) - returns raw Response. */ Response reactivateRaw(String subscriptionId) throws ChargebeeException { String path = @@ -781,12 +1069,34 @@ public SubscriptionReactivateResponse reactivate( return SubscriptionReactivateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture reactivateAsync( + String subscriptionId, SubscriptionReactivateParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/reactivate", "subscription-id", subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + SubscriptionReactivateResponse.fromJson(response.getBodyAsString(), response)); + } + public SubscriptionReactivateResponse reactivate(String subscriptionId) throws ChargebeeException { Response response = reactivateRaw(subscriptionId); return SubscriptionReactivateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture reactivateAsync(String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/reactivate", "subscription-id", subscriptionId); + + return postAsync(path, null) + .thenApply( + response -> + SubscriptionReactivateResponse.fromJson(response.getBodyAsString(), response)); + } + /** chargeFutureRenewals a subscription (executes immediately) - returns raw Response. */ Response chargeFutureRenewalsRaw(String subscriptionId) throws ChargebeeException { String path = @@ -834,12 +1144,41 @@ public SubscriptionChargeFutureRenewalsResponse chargeFutureRenewals( return SubscriptionChargeFutureRenewalsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture chargeFutureRenewalsAsync( + String subscriptionId, SubscriptionChargeFutureRenewalsParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/charge_future_renewals", + "subscription-id", + subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + SubscriptionChargeFutureRenewalsResponse.fromJson( + response.getBodyAsString(), response)); + } + public SubscriptionChargeFutureRenewalsResponse chargeFutureRenewals(String subscriptionId) throws ChargebeeException { Response response = chargeFutureRenewalsRaw(subscriptionId); return SubscriptionChargeFutureRenewalsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture chargeFutureRenewalsAsync( + String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/charge_future_renewals", + "subscription-id", + subscriptionId); + + return postAsync(path, null) + .thenApply( + response -> + SubscriptionChargeFutureRenewalsResponse.fromJson( + response.getBodyAsString(), response)); + } + /** addChargeAtTermEnd a subscription (executes immediately) - returns raw Response. */ Response addChargeAtTermEndRaw(String subscriptionId) throws ChargebeeException { String path = @@ -886,6 +1225,20 @@ public SubscriptionAddChargeAtTermEndResponse addChargeAtTermEnd( return SubscriptionAddChargeAtTermEndResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture addChargeAtTermEndAsync( + String subscriptionId, SubscriptionAddChargeAtTermEndParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/add_charge_at_term_end", + "subscription-id", + subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + SubscriptionAddChargeAtTermEndResponse.fromJson( + response.getBodyAsString(), response)); + } + /** removeScheduledChanges a subscription (executes immediately) - returns raw Response. */ Response removeScheduledChangesRaw(String subscriptionId) throws ChargebeeException { String path = @@ -904,6 +1257,21 @@ public SubscriptionRemoveScheduledChangesResponse removeScheduledChanges(String response.getBodyAsString(), response); } + public CompletableFuture removeScheduledChangesAsync( + String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/remove_scheduled_changes", + "subscription-id", + subscriptionId); + + return postAsync(path, null) + .thenApply( + response -> + SubscriptionRemoveScheduledChangesResponse.fromJson( + response.getBodyAsString(), response)); + } + /** changeTermEnd a subscription (executes immediately) - returns raw Response. */ Response changeTermEndRaw(String subscriptionId) throws ChargebeeException { String path = @@ -942,6 +1310,17 @@ public SubscriptionChangeTermEndResponse changeTermEnd( return SubscriptionChangeTermEndResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture changeTermEndAsync( + String subscriptionId, SubscriptionChangeTermEndParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/change_term_end", "subscription-id", subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + SubscriptionChangeTermEndResponse.fromJson(response.getBodyAsString(), response)); + } + /** delete a subscription (executes immediately) - returns raw Response. */ Response deleteRaw(String subscriptionId) throws ChargebeeException { String path = @@ -956,6 +1335,16 @@ public SubscriptionDeleteResponse delete(String subscriptionId) throws Chargebee return SubscriptionDeleteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteAsync(String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/delete", "subscription-id", subscriptionId); + + return postAsync(path, null) + .thenApply( + response -> SubscriptionDeleteResponse.fromJson(response.getBodyAsString(), response)); + } + /** createWithItems a subscription (executes immediately) - returns raw Response. */ Response createWithItemsRaw(String customerId) throws ChargebeeException { String path = @@ -994,12 +1383,35 @@ public SubscriptionCreateWithItemsResponse createWithItems( return SubscriptionCreateWithItemsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createWithItemsAsync( + String customerId, SubscriptionCreateWithItemsParams params) { + String path = + buildPathWithParams( + "/customers/{customer-id}/subscription_for_items", "customer-id", customerId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + SubscriptionCreateWithItemsResponse.fromJson(response.getBodyAsString(), response)); + } + public SubscriptionCreateWithItemsResponse createWithItems(String customerId) throws ChargebeeException { Response response = createWithItemsRaw(customerId); return SubscriptionCreateWithItemsResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createWithItemsAsync( + String customerId) { + String path = + buildPathWithParams( + "/customers/{customer-id}/subscription_for_items", "customer-id", customerId); + + return postAsync(path, null) + .thenApply( + response -> + SubscriptionCreateWithItemsResponse.fromJson(response.getBodyAsString(), response)); + } + /** importUnbilledCharges a subscription (executes immediately) - returns raw Response. */ Response importUnbilledChargesRaw(String subscriptionId) throws ChargebeeException { String path = @@ -1047,12 +1459,41 @@ public SubscriptionImportUnbilledChargesResponse importUnbilledCharges( return SubscriptionImportUnbilledChargesResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture importUnbilledChargesAsync( + String subscriptionId, SubscriptionImportUnbilledChargesParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/import_unbilled_charges", + "subscription-id", + subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + SubscriptionImportUnbilledChargesResponse.fromJson( + response.getBodyAsString(), response)); + } + public SubscriptionImportUnbilledChargesResponse importUnbilledCharges(String subscriptionId) throws ChargebeeException { Response response = importUnbilledChargesRaw(subscriptionId); return SubscriptionImportUnbilledChargesResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture importUnbilledChargesAsync( + String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/import_unbilled_charges", + "subscription-id", + subscriptionId); + + return postAsync(path, null) + .thenApply( + response -> + SubscriptionImportUnbilledChargesResponse.fromJson( + response.getBodyAsString(), response)); + } + /** removeScheduledResumption a subscription (executes immediately) - returns raw Response. */ Response removeScheduledResumptionRaw(String subscriptionId) throws ChargebeeException { String path = @@ -1071,6 +1512,21 @@ public SubscriptionRemoveScheduledResumptionResponse removeScheduledResumption( response.getBodyAsString(), response); } + public CompletableFuture + removeScheduledResumptionAsync(String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/remove_scheduled_resumption", + "subscription-id", + subscriptionId); + + return postAsync(path, null) + .thenApply( + response -> + SubscriptionRemoveScheduledResumptionResponse.fromJson( + response.getBodyAsString(), response)); + } + /** retrieve a subscription (executes immediately) - returns raw Response. */ Response retrieveRaw(String subscriptionId) throws ChargebeeException { String path = @@ -1084,6 +1540,16 @@ public SubscriptionRetrieveResponse retrieve(String subscriptionId) throws Charg return SubscriptionRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String subscriptionId) { + String path = + buildPathWithParams("/subscriptions/{subscription-id}", "subscription-id", subscriptionId); + + return getAsync(path, null) + .thenApply( + response -> + SubscriptionRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** update a subscription (executes immediately) - returns raw Response. */ Response updateRaw(String subscriptionId) throws ChargebeeException { String path = @@ -1113,11 +1579,29 @@ public SubscriptionUpdateResponse update(String subscriptionId, SubscriptionUpda return SubscriptionUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync( + String subscriptionId, SubscriptionUpdateParams params) { + String path = + buildPathWithParams("/subscriptions/{subscription-id}", "subscription-id", subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> SubscriptionUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + public SubscriptionUpdateResponse update(String subscriptionId) throws ChargebeeException { Response response = updateRaw(subscriptionId); return SubscriptionUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync(String subscriptionId) { + String path = + buildPathWithParams("/subscriptions/{subscription-id}", "subscription-id", subscriptionId); + + return postAsync(path, null) + .thenApply( + response -> SubscriptionUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + /** importContractTerm a subscription (executes immediately) - returns raw Response. */ Response importContractTermRaw(String subscriptionId) throws ChargebeeException { String path = @@ -1164,12 +1648,41 @@ public SubscriptionImportContractTermResponse importContractTerm( return SubscriptionImportContractTermResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture importContractTermAsync( + String subscriptionId, SubscriptionImportContractTermParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/import_contract_term", + "subscription-id", + subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + SubscriptionImportContractTermResponse.fromJson( + response.getBodyAsString(), response)); + } + public SubscriptionImportContractTermResponse importContractTerm(String subscriptionId) throws ChargebeeException { Response response = importContractTermRaw(subscriptionId); return SubscriptionImportContractTermResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture importContractTermAsync( + String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/import_contract_term", + "subscription-id", + subscriptionId); + + return postAsync(path, null) + .thenApply( + response -> + SubscriptionImportContractTermResponse.fromJson( + response.getBodyAsString(), response)); + } + /** overrideBillingProfile a subscription (executes immediately) - returns raw Response. */ Response overrideBillingProfileRaw(String subscriptionId) throws ChargebeeException { String path = @@ -1218,6 +1731,20 @@ public SubscriptionOverrideBillingProfileResponse overrideBillingProfile( response.getBodyAsString(), response); } + public CompletableFuture overrideBillingProfileAsync( + String subscriptionId, SubscriptionOverrideBillingProfileParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/override_billing_profile", + "subscription-id", + subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + SubscriptionOverrideBillingProfileResponse.fromJson( + response.getBodyAsString(), response)); + } + public SubscriptionOverrideBillingProfileResponse overrideBillingProfile(String subscriptionId) throws ChargebeeException { Response response = overrideBillingProfileRaw(subscriptionId); @@ -1225,6 +1752,21 @@ public SubscriptionOverrideBillingProfileResponse overrideBillingProfile(String response.getBodyAsString(), response); } + public CompletableFuture overrideBillingProfileAsync( + String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/override_billing_profile", + "subscription-id", + subscriptionId); + + return postAsync(path, null) + .thenApply( + response -> + SubscriptionOverrideBillingProfileResponse.fromJson( + response.getBodyAsString(), response)); + } + /** removeScheduledPause a subscription (executes immediately) - returns raw Response. */ Response removeScheduledPauseRaw(String subscriptionId) throws ChargebeeException { String path = @@ -1242,6 +1784,21 @@ public SubscriptionRemoveScheduledPauseResponse removeScheduledPause(String subs return SubscriptionRemoveScheduledPauseResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture removeScheduledPauseAsync( + String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/remove_scheduled_pause", + "subscription-id", + subscriptionId); + + return postAsync(path, null) + .thenApply( + response -> + SubscriptionRemoveScheduledPauseResponse.fromJson( + response.getBodyAsString(), response)); + } + /** editAdvanceInvoiceSchedule a subscription (executes immediately) - returns raw Response. */ Response editAdvanceInvoiceScheduleRaw(String subscriptionId) throws ChargebeeException { String path = @@ -1290,6 +1847,21 @@ public SubscriptionEditAdvanceInvoiceScheduleResponse editAdvanceInvoiceSchedule response.getBodyAsString(), response); } + public CompletableFuture + editAdvanceInvoiceScheduleAsync( + String subscriptionId, SubscriptionEditAdvanceInvoiceScheduleParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/edit_advance_invoice_schedule", + "subscription-id", + subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + SubscriptionEditAdvanceInvoiceScheduleResponse.fromJson( + response.getBodyAsString(), response)); + } + public SubscriptionEditAdvanceInvoiceScheduleResponse editAdvanceInvoiceSchedule( String subscriptionId) throws ChargebeeException { Response response = editAdvanceInvoiceScheduleRaw(subscriptionId); @@ -1297,6 +1869,21 @@ public SubscriptionEditAdvanceInvoiceScheduleResponse editAdvanceInvoiceSchedule response.getBodyAsString(), response); } + public CompletableFuture + editAdvanceInvoiceScheduleAsync(String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/edit_advance_invoice_schedule", + "subscription-id", + subscriptionId); + + return postAsync(path, null) + .thenApply( + response -> + SubscriptionEditAdvanceInvoiceScheduleResponse.fromJson( + response.getBodyAsString(), response)); + } + /** * listDiscounts a subscription using immutable params (executes immediately) - returns raw * Response. @@ -1342,6 +1929,30 @@ public SubscriptionListDiscountsResponse listDiscounts(String subscriptionId) response.getBodyAsString(), this, null, subscriptionId, response); } + public CompletableFuture listDiscountsAsync( + String subscriptionId, SubscriptionListDiscountsParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/discounts", "subscription-id", subscriptionId); + return getAsync(path, params != null ? params.toQueryParams() : null) + .thenApply( + response -> + SubscriptionListDiscountsResponse.fromJson( + response.getBodyAsString(), this, params, subscriptionId, response)); + } + + public CompletableFuture listDiscountsAsync( + String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/discounts", "subscription-id", subscriptionId); + return getAsync(path, null) + .thenApply( + response -> + SubscriptionListDiscountsResponse.fromJson( + response.getBodyAsString(), this, null, subscriptionId, response)); + } + /** * contractTermsForSubscription a subscription using immutable params (executes immediately) - * returns raw Response. @@ -1391,6 +2002,30 @@ public ContractTermsForSubscriptionResponse contractTermsForSubscription(String response.getBodyAsString(), this, null, subscriptionId, response); } + public CompletableFuture contractTermsForSubscriptionAsync( + String subscriptionId, ContractTermsForSubscriptionParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/contract_terms", "subscription-id", subscriptionId); + return getAsync(path, params != null ? params.toQueryParams() : null) + .thenApply( + response -> + ContractTermsForSubscriptionResponse.fromJson( + response.getBodyAsString(), this, params, subscriptionId, response)); + } + + public CompletableFuture contractTermsForSubscriptionAsync( + String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/contract_terms", "subscription-id", subscriptionId); + return getAsync(path, null) + .thenApply( + response -> + ContractTermsForSubscriptionResponse.fromJson( + response.getBodyAsString(), this, null, subscriptionId, response)); + } + /** pause a subscription (executes immediately) - returns raw Response. */ Response pauseRaw(String subscriptionId) throws ChargebeeException { String path = @@ -1423,11 +2058,31 @@ public SubscriptionPauseResponse pause(String subscriptionId, SubscriptionPauseP return SubscriptionPauseResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture pauseAsync( + String subscriptionId, SubscriptionPauseParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/pause", "subscription-id", subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> SubscriptionPauseResponse.fromJson(response.getBodyAsString(), response)); + } + public SubscriptionPauseResponse pause(String subscriptionId) throws ChargebeeException { Response response = pauseRaw(subscriptionId); return SubscriptionPauseResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture pauseAsync(String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/pause", "subscription-id", subscriptionId); + + return postAsync(path, null) + .thenApply( + response -> SubscriptionPauseResponse.fromJson(response.getBodyAsString(), response)); + } + /** importForCustomer a subscription (executes immediately) - returns raw Response. */ Response importForCustomerRaw(String customerId) throws ChargebeeException { String path = @@ -1466,6 +2121,18 @@ public SubscriptionImportForCustomerResponse importForCustomer( return SubscriptionImportForCustomerResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture importForCustomerAsync( + String customerId, SubscriptionImportForCustomerParams params) { + String path = + buildPathWithParams( + "/customers/{customer-id}/import_subscription", "customer-id", customerId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + SubscriptionImportForCustomerResponse.fromJson( + response.getBodyAsString(), response)); + } + /** * importSubscription a subscription using immutable params (executes immediately) - returns raw * Response. @@ -1491,6 +2158,15 @@ public ImportSubscriptionResponse importSubscription(ImportSubscriptionParams pa return ImportSubscriptionResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture importSubscriptionAsync( + ImportSubscriptionParams params) { + + return postAsync( + "/subscriptions/import_subscription", params != null ? params.toFormData() : null) + .thenApply( + response -> ImportSubscriptionResponse.fromJson(response.getBodyAsString(), response)); + } + /** cancel a subscription (executes immediately) - returns raw Response. */ Response cancelRaw(String subscriptionId) throws ChargebeeException { String path = @@ -1523,11 +2199,31 @@ public SubscriptionCancelResponse cancel(String subscriptionId, SubscriptionCanc return SubscriptionCancelResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture cancelAsync( + String subscriptionId, SubscriptionCancelParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/cancel", "subscription-id", subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> SubscriptionCancelResponse.fromJson(response.getBodyAsString(), response)); + } + public SubscriptionCancelResponse cancel(String subscriptionId) throws ChargebeeException { Response response = cancelRaw(subscriptionId); return SubscriptionCancelResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture cancelAsync(String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/cancel", "subscription-id", subscriptionId); + + return postAsync(path, null) + .thenApply( + response -> SubscriptionCancelResponse.fromJson(response.getBodyAsString(), response)); + } + /** chargeAddonAtTermEnd a subscription (executes immediately) - returns raw Response. */ Response chargeAddonAtTermEndRaw(String subscriptionId) throws ChargebeeException { String path = @@ -1574,4 +2270,18 @@ public SubscriptionChargeAddonAtTermEndResponse chargeAddonAtTermEnd( Response response = chargeAddonAtTermEndRaw(subscriptionId, params); return SubscriptionChargeAddonAtTermEndResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture chargeAddonAtTermEndAsync( + String subscriptionId, SubscriptionChargeAddonAtTermEndParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/charge_addon_at_term_end", + "subscription-id", + subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + SubscriptionChargeAddonAtTermEndResponse.fromJson( + response.getBodyAsString(), response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/SubscriptionSettingService.java b/src/main/java/com/chargebee/v4/services/SubscriptionSettingService.java index 0649cf3d..850eec49 100644 --- a/src/main/java/com/chargebee/v4/services/SubscriptionSettingService.java +++ b/src/main/java/com/chargebee/v4/services/SubscriptionSettingService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.subscriptionSetting.params.SubscriptionSettingRetrieveParams; @@ -84,9 +85,27 @@ public SubscriptionSettingRetrieveResponse retrieve(SubscriptionSettingRetrieveP return SubscriptionSettingRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync( + SubscriptionSettingRetrieveParams params) { + + return getAsync( + "/subscription_settings/retrieve", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + SubscriptionSettingRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + public SubscriptionSettingRetrieveResponse retrieve() throws ChargebeeException { Response response = retrieveRaw(); return SubscriptionSettingRetrieveResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture retrieveAsync() { + + return getAsync("/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 46882176..6cb85777 100644 --- a/src/main/java/com/chargebee/v4/services/ThirdPartyConfigurationService.java +++ b/src/main/java/com/chargebee/v4/services/ThirdPartyConfigurationService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.thirdPartyConfiguration.params.ThirdPartyConfigurationConfigurationsParams; @@ -89,6 +90,18 @@ public ThirdPartyConfigurationConfigurationsResponse configurations( response.getBodyAsString(), response); } + public CompletableFuture configurationsAsync( + ThirdPartyConfigurationConfigurationsParams params) { + + return getAsync( + "/third_party_configurations/configurations", + params != null ? params.toQueryParams() : null) + .thenApply( + response -> + ThirdPartyConfigurationConfigurationsResponse.fromJson( + response.getBodyAsString(), response)); + } + /** * retrieve a thirdPartyConfiguration using immutable params (executes immediately) - returns raw * Response. @@ -114,6 +127,16 @@ public ThirdPartyConfigurationRetrieveResponse retrieve( return ThirdPartyConfigurationRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync( + ThirdPartyConfigurationRetrieveParams params) { + + return getAsync("/third_party_configurations", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + ThirdPartyConfigurationRetrieveResponse.fromJson( + response.getBodyAsString(), response)); + } + /** * update a thirdPartyConfiguration using immutable params (executes immediately) - returns raw * Response. @@ -138,4 +161,14 @@ public ThirdPartyConfigurationUpdateResponse update(ThirdPartyConfigurationUpdat return ThirdPartyConfigurationUpdateResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture updateAsync( + ThirdPartyConfigurationUpdateParams params) { + + return postAsync("/third_party_configurations", params != null ? params.toFormData() : null) + .thenApply( + response -> + ThirdPartyConfigurationUpdateResponse.fromJson( + response.getBodyAsString(), response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/ThirdPartyEntityMappingService.java b/src/main/java/com/chargebee/v4/services/ThirdPartyEntityMappingService.java index add15861..96c341df 100644 --- a/src/main/java/com/chargebee/v4/services/ThirdPartyEntityMappingService.java +++ b/src/main/java/com/chargebee/v4/services/ThirdPartyEntityMappingService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.thirdPartyEntityMapping.params.ThirdPartyEntityMappingRetrieveEntityParams; @@ -92,6 +93,17 @@ public ThirdPartyEntityMappingRetrieveEntityResponse retrieveEntity( response.getBodyAsString(), response); } + public CompletableFuture retrieveEntityAsync( + ThirdPartyEntityMappingRetrieveEntityParams params) { + + return getAsync( + "/third_party_entity_mappings/retrieve", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + ThirdPartyEntityMappingRetrieveEntityResponse.fromJson( + response.getBodyAsString(), response)); + } + /** * listAll a thirdPartyEntityMapping using immutable params (executes immediately) - returns raw * Response. @@ -118,6 +130,17 @@ public ThirdPartyEntityMappingListAllResponse listAll(ThirdPartyEntityMappingLis return ThirdPartyEntityMappingListAllResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture listAllAsync( + ThirdPartyEntityMappingListAllParams params) { + + return getAsync( + "/third_party_entity_mappings/list_all", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + ThirdPartyEntityMappingListAllResponse.fromJson( + response.getBodyAsString(), response)); + } + /** * updateEntity a thirdPartyEntityMapping using immutable params (executes immediately) - returns * raw Response. @@ -146,6 +169,18 @@ public ThirdPartyEntityMappingUpdateEntityResponse updateEntity( response.getBodyAsString(), response); } + public CompletableFuture updateEntityAsync( + ThirdPartyEntityMappingUpdateEntityParams params) { + + return postAsync( + "/third_party_entity_mappings/update_entity", + params != null ? params.toFormData() : null) + .thenApply( + response -> + ThirdPartyEntityMappingUpdateEntityResponse.fromJson( + response.getBodyAsString(), response)); + } + /** * list a thirdPartyEntityMapping using immutable params (executes immediately) - returns raw * Response. @@ -180,10 +215,29 @@ public ThirdPartyEntityMappingListResponse list(ThirdPartyEntityMappingListParam response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync( + ThirdPartyEntityMappingListParams params) { + + return getAsync("/third_party_entity_mappings", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + ThirdPartyEntityMappingListResponse.fromJson( + response.getBodyAsString(), this, params, response)); + } + public ThirdPartyEntityMappingListResponse list() throws ChargebeeException { Response response = listRaw(); return ThirdPartyEntityMappingListResponse.fromJson( response.getBodyAsString(), this, null, response); } + + public CompletableFuture listAsync() { + + return getAsync("/third_party_entity_mappings", null) + .thenApply( + response -> + ThirdPartyEntityMappingListResponse.fromJson( + response.getBodyAsString(), this, null, response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/ThirdPartySyncDetailService.java b/src/main/java/com/chargebee/v4/services/ThirdPartySyncDetailService.java index c76bda07..22e16293 100644 --- a/src/main/java/com/chargebee/v4/services/ThirdPartySyncDetailService.java +++ b/src/main/java/com/chargebee/v4/services/ThirdPartySyncDetailService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.thirdPartySyncDetail.params.ThirdPartySyncDetailUpdateParams; @@ -78,6 +79,21 @@ public ThirdPartySyncDetailRetrieveResponse retrieve(String tpIntegSyncDetailId) return ThirdPartySyncDetailRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync( + String tpIntegSyncDetailId) { + String path = + buildPathWithParams( + "/third_party_sync_details/{tp-integ-sync-detail-id}", + "tp-integ-sync-detail-id", + tpIntegSyncDetailId); + + return getAsync(path, null) + .thenApply( + response -> + ThirdPartySyncDetailRetrieveResponse.fromJson( + response.getBodyAsString(), response)); + } + /** update a thirdPartySyncDetail (executes immediately) - returns raw Response. */ Response updateRaw(String tpIntegSyncDetailId) throws ChargebeeException { String path = @@ -123,6 +139,19 @@ public ThirdPartySyncDetailUpdateResponse update( return ThirdPartySyncDetailUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync( + String tpIntegSyncDetailId, ThirdPartySyncDetailUpdateParams params) { + String path = + buildPathWithParams( + "/third_party_sync_details/{tp-integ-sync-detail-id}", + "tp-integ-sync-detail-id", + tpIntegSyncDetailId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + ThirdPartySyncDetailUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + /** * create a thirdPartySyncDetail using immutable params (executes immediately) - returns raw * Response. @@ -148,6 +177,15 @@ public ThirdPartySyncDetailCreateResponse create(ThirdPartySyncDetailCreateParam return ThirdPartySyncDetailCreateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createAsync( + ThirdPartySyncDetailCreateParams params) { + + return postAsync("/third_party_sync_details", params != null ? params.toFormData() : null) + .thenApply( + response -> + ThirdPartySyncDetailCreateResponse.fromJson(response.getBodyAsString(), response)); + } + /** * retrieveLatestSync a thirdPartySyncDetail using immutable params (executes immediately) - * returns raw Response. @@ -186,6 +224,18 @@ public ThirdPartySyncDetailRetrieveLatestSyncResponse retrieveLatestSync( response.getBodyAsString(), response); } + public CompletableFuture retrieveLatestSyncAsync( + ThirdPartySyncDetailRetrieveLatestSyncParams params) { + + return getAsync( + "/third_party_sync_details/retrieve_latest_sync", + params != null ? params.toQueryParams() : null) + .thenApply( + response -> + ThirdPartySyncDetailRetrieveLatestSyncResponse.fromJson( + response.getBodyAsString(), response)); + } + public ThirdPartySyncDetailRetrieveLatestSyncResponse retrieveLatestSync() throws ChargebeeException { Response response = retrieveLatestSyncRaw(); @@ -193,4 +243,14 @@ public ThirdPartySyncDetailRetrieveLatestSyncResponse retrieveLatestSync() return ThirdPartySyncDetailRetrieveLatestSyncResponse.fromJson( response.getBodyAsString(), response); } + + public CompletableFuture + retrieveLatestSyncAsync() { + + return getAsync("/third_party_sync_details/retrieve_latest_sync", null) + .thenApply( + response -> + ThirdPartySyncDetailRetrieveLatestSyncResponse.fromJson( + response.getBodyAsString(), response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/TimeMachineService.java b/src/main/java/com/chargebee/v4/services/TimeMachineService.java index 9c05e302..7213d7cd 100644 --- a/src/main/java/com/chargebee/v4/services/TimeMachineService.java +++ b/src/main/java/com/chargebee/v4/services/TimeMachineService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.timeMachine.params.TimeMachineTravelForwardParams; @@ -76,6 +77,16 @@ public TimeMachineRetrieveResponse retrieve(String timeMachineName) throws Charg return TimeMachineRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String timeMachineName) { + String path = + buildPathWithParams( + "/time_machines/{time-machine-name}", "time-machine-name", timeMachineName); + + return getAsync(path, null) + .thenApply( + response -> TimeMachineRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** travelForward a timeMachine (executes immediately) - returns raw Response. */ Response travelForwardRaw(String timeMachineName) throws ChargebeeException { String path = @@ -120,12 +131,39 @@ public TimeMachineTravelForwardResponse travelForward( return TimeMachineTravelForwardResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture travelForwardAsync( + String timeMachineName, TimeMachineTravelForwardParams params) { + String path = + buildPathWithParams( + "/time_machines/{time-machine-name}/travel_forward", + "time-machine-name", + timeMachineName); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + TimeMachineTravelForwardResponse.fromJson(response.getBodyAsString(), response)); + } + public TimeMachineTravelForwardResponse travelForward(String timeMachineName) throws ChargebeeException { Response response = travelForwardRaw(timeMachineName); return TimeMachineTravelForwardResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture travelForwardAsync( + String timeMachineName) { + String path = + buildPathWithParams( + "/time_machines/{time-machine-name}/travel_forward", + "time-machine-name", + timeMachineName); + + return postAsync(path, null) + .thenApply( + response -> + TimeMachineTravelForwardResponse.fromJson(response.getBodyAsString(), response)); + } + /** startAfresh a timeMachine (executes immediately) - returns raw Response. */ Response startAfreshRaw(String timeMachineName) throws ChargebeeException { String path = @@ -168,12 +206,39 @@ public TimeMachineStartAfreshResponse startAfresh( return TimeMachineStartAfreshResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture startAfreshAsync( + String timeMachineName, TimeMachineStartAfreshParams params) { + String path = + buildPathWithParams( + "/time_machines/{time-machine-name}/start_afresh", + "time-machine-name", + timeMachineName); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + TimeMachineStartAfreshResponse.fromJson(response.getBodyAsString(), response)); + } + public TimeMachineStartAfreshResponse startAfresh(String timeMachineName) throws ChargebeeException { Response response = startAfreshRaw(timeMachineName); return TimeMachineStartAfreshResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture startAfreshAsync( + String timeMachineName) { + String path = + buildPathWithParams( + "/time_machines/{time-machine-name}/start_afresh", + "time-machine-name", + timeMachineName); + + return postAsync(path, null) + .thenApply( + response -> + TimeMachineStartAfreshResponse.fromJson(response.getBodyAsString(), response)); + } + // === Time Travel Completion Helper === /** diff --git a/src/main/java/com/chargebee/v4/services/TpSiteUserService.java b/src/main/java/com/chargebee/v4/services/TpSiteUserService.java index 03c77958..dbf6210b 100644 --- a/src/main/java/com/chargebee/v4/services/TpSiteUserService.java +++ b/src/main/java/com/chargebee/v4/services/TpSiteUserService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.tpSiteUser.params.UsersForTpSiteUserParams; @@ -106,6 +107,30 @@ public UsersForTpSiteUserResponse usersForTpSiteUser(String tpSiteUserDomain) response.getBodyAsString(), this, null, tpSiteUserDomain, response); } + public CompletableFuture usersForTpSiteUserAsync( + String tpSiteUserDomain, UsersForTpSiteUserParams params) { + String path = + buildPathWithParams( + "/tp_site_users/{tp-site-user-domain}/users", "tp-site-user-domain", tpSiteUserDomain); + return getAsync(path, params != null ? params.toQueryParams() : null) + .thenApply( + response -> + UsersForTpSiteUserResponse.fromJson( + response.getBodyAsString(), this, params, tpSiteUserDomain, response)); + } + + public CompletableFuture usersForTpSiteUserAsync( + String tpSiteUserDomain) { + String path = + buildPathWithParams( + "/tp_site_users/{tp-site-user-domain}/users", "tp-site-user-domain", tpSiteUserDomain); + return getAsync(path, null) + .thenApply( + response -> + UsersForTpSiteUserResponse.fromJson( + response.getBodyAsString(), this, null, tpSiteUserDomain, response)); + } + /** * payNowEnableLive a tpSiteUser using immutable params (executes immediately) - returns raw * Response. @@ -131,6 +156,16 @@ public TpSiteUserPayNowEnableLiveResponse payNowEnableLive( return TpSiteUserPayNowEnableLiveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture payNowEnableLiveAsync( + TpSiteUserPayNowEnableLiveParams params) { + + return postAsync( + "/tp_site_users/pay_now_enable_live", params != null ? params.toFormData() : null) + .thenApply( + response -> + TpSiteUserPayNowEnableLiveResponse.fromJson(response.getBodyAsString(), response)); + } + /** * guestsForTpSiteUser a tpSiteUser using immutable params (executes immediately) - returns raw * Response. @@ -178,4 +213,28 @@ public GuestsForTpSiteUserResponse guestsForTpSiteUser(String tpSiteUserDomain) return GuestsForTpSiteUserResponse.fromJson( response.getBodyAsString(), this, null, tpSiteUserDomain, response); } + + public CompletableFuture guestsForTpSiteUserAsync( + String tpSiteUserDomain, GuestsForTpSiteUserParams params) { + String path = + buildPathWithParams( + "/tp_site_users/{tp-site-user-domain}/guests", "tp-site-user-domain", tpSiteUserDomain); + return getAsync(path, params != null ? params.toQueryParams() : null) + .thenApply( + response -> + GuestsForTpSiteUserResponse.fromJson( + response.getBodyAsString(), this, params, tpSiteUserDomain, response)); + } + + public CompletableFuture guestsForTpSiteUserAsync( + String tpSiteUserDomain) { + String path = + buildPathWithParams( + "/tp_site_users/{tp-site-user-domain}/guests", "tp-site-user-domain", tpSiteUserDomain); + return getAsync(path, null) + .thenApply( + response -> + GuestsForTpSiteUserResponse.fromJson( + response.getBodyAsString(), this, null, tpSiteUserDomain, response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/TransactionService.java b/src/main/java/com/chargebee/v4/services/TransactionService.java index 8642caf9..365a1b4d 100644 --- a/src/main/java/com/chargebee/v4/services/TransactionService.java +++ b/src/main/java/com/chargebee/v4/services/TransactionService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.transaction.params.TransactionListParams; @@ -112,12 +113,29 @@ public TransactionListResponse list(TransactionListParams params) throws Chargeb return TransactionListResponse.fromJson(response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync(TransactionListParams params) { + + return getAsync("/transactions", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + TransactionListResponse.fromJson( + response.getBodyAsString(), this, params, response)); + } + public TransactionListResponse list() throws ChargebeeException { Response response = listRaw(); return TransactionListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/transactions", null) + .thenApply( + response -> + TransactionListResponse.fromJson(response.getBodyAsString(), this, null, response)); + } + /** reconcile a transaction (executes immediately) - returns raw Response. */ Response reconcileRaw(String transactionId) throws ChargebeeException { String path = @@ -154,11 +172,33 @@ public TransactionReconcileResponse reconcile( return TransactionReconcileResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture reconcileAsync( + String transactionId, TransactionReconcileParams params) { + String path = + buildPathWithParams( + "/transactions/{transaction-id}/reconcile", "transaction-id", transactionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + TransactionReconcileResponse.fromJson(response.getBodyAsString(), response)); + } + public TransactionReconcileResponse reconcile(String transactionId) throws ChargebeeException { Response response = reconcileRaw(transactionId); return TransactionReconcileResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture reconcileAsync(String transactionId) { + String path = + buildPathWithParams( + "/transactions/{transaction-id}/reconcile", "transaction-id", transactionId); + + return postAsync(path, null) + .thenApply( + response -> + TransactionReconcileResponse.fromJson(response.getBodyAsString(), response)); + } + /** retrieve a transaction (executes immediately) - returns raw Response. */ Response retrieveRaw(String transactionId) throws ChargebeeException { String path = @@ -172,6 +212,15 @@ public TransactionRetrieveResponse retrieve(String transactionId) throws Chargeb return TransactionRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String transactionId) { + String path = + buildPathWithParams("/transactions/{transaction-id}", "transaction-id", transactionId); + + return getAsync(path, null) + .thenApply( + response -> TransactionRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** refund a transaction (executes immediately) - returns raw Response. */ Response refundRaw(String transactionId) throws ChargebeeException { String path = @@ -204,11 +253,31 @@ public TransactionRefundResponse refund(String transactionId, TransactionRefundP return TransactionRefundResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture refundAsync( + String transactionId, TransactionRefundParams params) { + String path = + buildPathWithParams( + "/transactions/{transaction-id}/refund", "transaction-id", transactionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> TransactionRefundResponse.fromJson(response.getBodyAsString(), response)); + } + public TransactionRefundResponse refund(String transactionId) throws ChargebeeException { Response response = refundRaw(transactionId); return TransactionRefundResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture refundAsync(String transactionId) { + String path = + buildPathWithParams( + "/transactions/{transaction-id}/refund", "transaction-id", transactionId); + + return postAsync(path, null) + .thenApply( + response -> TransactionRefundResponse.fromJson(response.getBodyAsString(), response)); + } + /** * transactionsForCustomer a transaction using immutable params (executes immediately) - returns * raw Response. @@ -255,6 +324,28 @@ public TransactionsForCustomerResponse transactionsForCustomer(String customerId response.getBodyAsString(), this, null, customerId, response); } + public CompletableFuture transactionsForCustomerAsync( + String customerId, TransactionsForCustomerParams params) { + String path = + buildPathWithParams("/customers/{customer-id}/transactions", "customer-id", customerId); + return getAsync(path, params != null ? params.toQueryParams() : null) + .thenApply( + response -> + TransactionsForCustomerResponse.fromJson( + response.getBodyAsString(), this, params, customerId, response)); + } + + public CompletableFuture transactionsForCustomerAsync( + String customerId) { + String path = + buildPathWithParams("/customers/{customer-id}/transactions", "customer-id", customerId); + return getAsync(path, null) + .thenApply( + response -> + TransactionsForCustomerResponse.fromJson( + response.getBodyAsString(), this, null, customerId, response)); + } + /** recordRefund a transaction (executes immediately) - returns raw Response. */ Response recordRefundRaw(String transactionId) throws ChargebeeException { String path = @@ -293,6 +384,17 @@ public TransactionRecordRefundResponse recordRefund( return TransactionRecordRefundResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture recordRefundAsync( + String transactionId, TransactionRecordRefundParams params) { + String path = + buildPathWithParams( + "/transactions/{transaction-id}/record_refund", "transaction-id", transactionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + TransactionRecordRefundResponse.fromJson(response.getBodyAsString(), response)); + } + /** * transactionsForSubscription a transaction using immutable params (executes immediately) - * returns raw Response. @@ -342,6 +444,30 @@ public TransactionsForSubscriptionResponse transactionsForSubscription(String su response.getBodyAsString(), this, null, subscriptionId, response); } + public CompletableFuture transactionsForSubscriptionAsync( + String subscriptionId, TransactionsForSubscriptionParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/transactions", "subscription-id", subscriptionId); + return getAsync(path, params != null ? params.toQueryParams() : null) + .thenApply( + response -> + TransactionsForSubscriptionResponse.fromJson( + response.getBodyAsString(), this, params, subscriptionId, response)); + } + + public CompletableFuture transactionsForSubscriptionAsync( + String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/transactions", "subscription-id", subscriptionId); + return getAsync(path, null) + .thenApply( + response -> + TransactionsForSubscriptionResponse.fromJson( + response.getBodyAsString(), this, null, subscriptionId, response)); + } + /** voidTransaction a transaction (executes immediately) - returns raw Response. */ Response voidTransactionRaw(String transactionId) throws ChargebeeException { String path = @@ -355,6 +481,15 @@ public VoidTransactionResponse voidTransaction(String transactionId) throws Char return VoidTransactionResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture voidTransactionAsync(String transactionId) { + String path = + buildPathWithParams("/transactions/{transaction-id}/void", "transaction-id", transactionId); + + return postAsync(path, null) + .thenApply( + response -> VoidTransactionResponse.fromJson(response.getBodyAsString(), response)); + } + /** syncTransaction a transaction (executes immediately) - returns raw Response. */ Response syncTransactionRaw(String transactionId) throws ChargebeeException { String path = @@ -368,6 +503,15 @@ public SyncTransactionResponse syncTransaction(String transactionId) throws Char return SyncTransactionResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture syncTransactionAsync(String transactionId) { + String path = + buildPathWithParams("/transactions/{transaction-id}/sync", "transaction-id", transactionId); + + return postAsync(path, null) + .thenApply( + response -> SyncTransactionResponse.fromJson(response.getBodyAsString(), response)); + } + /** * createAuthorization a transaction using immutable params (executes immediately) - returns raw * Response. @@ -394,6 +538,17 @@ public TransactionCreateAuthorizationResponse createAuthorization( return TransactionCreateAuthorizationResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createAuthorizationAsync( + TransactionCreateAuthorizationParams params) { + + return postAsync( + "/transactions/create_authorization", params != null ? params.toFormData() : null) + .thenApply( + response -> + TransactionCreateAuthorizationResponse.fromJson( + response.getBodyAsString(), response)); + } + /** * paymentsForInvoice a transaction using immutable params (executes immediately) - returns raw * Response. @@ -435,6 +590,26 @@ public TransactionPaymentsForInvoiceResponse paymentsForInvoice(String invoiceId response.getBodyAsString(), this, null, invoiceId, response); } + 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) + .thenApply( + response -> + TransactionPaymentsForInvoiceResponse.fromJson( + response.getBodyAsString(), this, params, invoiceId, response)); + } + + public CompletableFuture paymentsForInvoiceAsync( + String invoiceId) { + String path = buildPathWithParams("/invoices/{invoice-id}/payments", "invoice-id", invoiceId); + return getAsync(path, null) + .thenApply( + response -> + TransactionPaymentsForInvoiceResponse.fromJson( + response.getBodyAsString(), this, null, invoiceId, response)); + } + /** deleteOfflineTransaction a transaction (executes immediately) - returns raw Response. */ Response deleteOfflineTransactionRaw(String transactionId) throws ChargebeeException { String path = @@ -480,9 +655,36 @@ public DeleteOfflineTransactionResponse deleteOfflineTransaction( return DeleteOfflineTransactionResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteOfflineTransactionAsync( + String transactionId, DeleteOfflineTransactionParams params) { + String path = + buildPathWithParams( + "/transactions/{transaction-id}/delete_offline_transaction", + "transaction-id", + transactionId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + DeleteOfflineTransactionResponse.fromJson(response.getBodyAsString(), response)); + } + public DeleteOfflineTransactionResponse deleteOfflineTransaction(String transactionId) throws ChargebeeException { Response response = deleteOfflineTransactionRaw(transactionId); return DeleteOfflineTransactionResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture deleteOfflineTransactionAsync( + String transactionId) { + String path = + buildPathWithParams( + "/transactions/{transaction-id}/delete_offline_transaction", + "transaction-id", + transactionId); + + return postAsync(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 3d294cd5..6d43d279 100644 --- a/src/main/java/com/chargebee/v4/services/UnbilledChargeService.java +++ b/src/main/java/com/chargebee/v4/services/UnbilledChargeService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.unbilledCharge.params.UnbilledChargeInvoiceNowEstimateParams; @@ -85,6 +86,19 @@ public UnbilledChargeDeleteResponse delete(String unbilledChargeId) throws Charg return UnbilledChargeDeleteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteAsync(String unbilledChargeId) { + String path = + buildPathWithParams( + "/unbilled_charges/{unbilled-charge-id}/delete", + "unbilled-charge-id", + unbilledChargeId); + + return postAsync(path, null) + .thenApply( + response -> + UnbilledChargeDeleteResponse.fromJson(response.getBodyAsString(), response)); + } + /** * invoiceNowEstimate a unbilledCharge using immutable params (executes immediately) - returns raw * Response. @@ -112,6 +126,17 @@ public UnbilledChargeInvoiceNowEstimateResponse invoiceNowEstimate( return UnbilledChargeInvoiceNowEstimateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture invoiceNowEstimateAsync( + UnbilledChargeInvoiceNowEstimateParams params) { + + return postAsync( + "/unbilled_charges/invoice_now_estimate", params != null ? params.toFormData() : null) + .thenApply( + response -> + UnbilledChargeInvoiceNowEstimateResponse.fromJson( + response.getBodyAsString(), response)); + } + /** * invoiceUnbilledCharges a unbilledCharge using immutable params (executes immediately) - returns * raw Response. @@ -139,6 +164,17 @@ public InvoiceUnbilledChargesResponse invoiceUnbilledCharges(InvoiceUnbilledChar return InvoiceUnbilledChargesResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture invoiceUnbilledChargesAsync( + InvoiceUnbilledChargesParams params) { + + return postAsync( + "/unbilled_charges/invoice_unbilled_charges", + params != null ? params.toFormData() : null) + .thenApply( + response -> + InvoiceUnbilledChargesResponse.fromJson(response.getBodyAsString(), response)); + } + /** list a unbilledCharge using immutable params (executes immediately) - returns raw Response. */ Response listRaw(UnbilledChargeListParams params) throws ChargebeeException { @@ -164,12 +200,30 @@ public UnbilledChargeListResponse list(UnbilledChargeListParams params) return UnbilledChargeListResponse.fromJson(response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync(UnbilledChargeListParams params) { + + return getAsync("/unbilled_charges", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + UnbilledChargeListResponse.fromJson( + response.getBodyAsString(), this, params, response)); + } + public UnbilledChargeListResponse list() throws ChargebeeException { Response response = listRaw(); return UnbilledChargeListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/unbilled_charges", null) + .thenApply( + response -> + UnbilledChargeListResponse.fromJson( + response.getBodyAsString(), this, null, response)); + } + /** * create a unbilledCharge using immutable params (executes immediately) - returns raw Response. */ @@ -193,6 +247,15 @@ public UnbilledChargeCreateResponse create(UnbilledChargeCreateParams params) return UnbilledChargeCreateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createAsync( + UnbilledChargeCreateParams params) { + + return postAsync("/unbilled_charges", params != null ? params.toFormData() : null) + .thenApply( + response -> + UnbilledChargeCreateResponse.fromJson(response.getBodyAsString(), response)); + } + /** * createUnbilledCharge a unbilledCharge using immutable params (executes immediately) - returns * raw Response. @@ -217,4 +280,13 @@ public CreateUnbilledChargeResponse createUnbilledCharge(CreateUnbilledChargePar return CreateUnbilledChargeResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture createUnbilledChargeAsync( + CreateUnbilledChargeParams params) { + + return postAsync("/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 cad3e21a..a5c49304 100644 --- a/src/main/java/com/chargebee/v4/services/UnbilledChargesSettingService.java +++ b/src/main/java/com/chargebee/v4/services/UnbilledChargesSettingService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.unbilledChargesSetting.params.UnbilledChargesSettingRetrieveParams; @@ -85,9 +86,28 @@ public UnbilledChargesSettingRetrieveResponse retrieve( return UnbilledChargesSettingRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync( + UnbilledChargesSettingRetrieveParams params) { + + return getAsync("/unbilled_charges_settings", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + UnbilledChargesSettingRetrieveResponse.fromJson( + response.getBodyAsString(), response)); + } + public UnbilledChargesSettingRetrieveResponse retrieve() throws ChargebeeException { Response response = retrieveRaw(); return UnbilledChargesSettingRetrieveResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture retrieveAsync() { + + return getAsync("/unbilled_charges_settings", null) + .thenApply( + response -> + UnbilledChargesSettingRetrieveResponse.fromJson( + response.getBodyAsString(), response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/UsageEventService.java b/src/main/java/com/chargebee/v4/services/UsageEventService.java index fe900b27..efd5ba6f 100644 --- a/src/main/java/com/chargebee/v4/services/UsageEventService.java +++ b/src/main/java/com/chargebee/v4/services/UsageEventService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.usageEvent.params.UsageEventCreateParams; @@ -77,6 +78,16 @@ public UsageEventCreateResponse create(UsageEventCreateParams params) throws Cha return UsageEventCreateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createAsync(UsageEventCreateParams params) { + + return postJsonWithSubDomainAsync( + "/usage_events", + SubDomain.INGEST.getValue(), + params != null ? params.toJsonString() : null) + .thenApply( + response -> UsageEventCreateResponse.fromJson(response.getBodyAsString(), response)); + } + /** * batchIngest a usageEvent using immutable params (executes immediately) - returns raw Response. */ @@ -102,4 +113,16 @@ public UsageEventBatchIngestResponse batchIngest(UsageEventBatchIngestParams par return UsageEventBatchIngestResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture batchIngestAsync( + UsageEventBatchIngestParams params) { + + return postJsonWithSubDomainAsync( + "/batch/usage_events", + SubDomain.INGEST.getValue(), + params != null ? params.toJsonString() : null) + .thenApply( + response -> + UsageEventBatchIngestResponse.fromJson(response.getBodyAsString(), response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/UsageFileService.java b/src/main/java/com/chargebee/v4/services/UsageFileService.java index 497cbc79..3e037508 100644 --- a/src/main/java/com/chargebee/v4/services/UsageFileService.java +++ b/src/main/java/com/chargebee/v4/services/UsageFileService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.usageFile.params.UsageFileUploadUrlParams; @@ -69,6 +70,18 @@ public UsageFileProcessingStatusResponse processingStatus(String usageFileId) return UsageFileProcessingStatusResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture processingStatusAsync( + String usageFileId) { + String path = + buildPathWithParams( + "/usage_files/{usage-file-id}/processing_status", "usage-file-id", usageFileId); + + return getWithSubDomainAsync(path, SubDomain.FILE_INGEST.getValue(), null) + .thenApply( + response -> + UsageFileProcessingStatusResponse.fromJson(response.getBodyAsString(), response)); + } + /** uploadUrl a usageFile using immutable params (executes immediately) - returns raw Response. */ Response uploadUrlRaw(UsageFileUploadUrlParams params) throws ChargebeeException { @@ -91,4 +104,15 @@ public UsageFileUploadUrlResponse uploadUrl(UsageFileUploadUrlParams params) return UsageFileUploadUrlResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture uploadUrlAsync( + UsageFileUploadUrlParams params) { + + return postWithSubDomainAsync( + "/usage_files/upload_url", + SubDomain.FILE_INGEST.getValue(), + params != null ? params.toFormData() : null) + .thenApply( + response -> UsageFileUploadUrlResponse.fromJson(response.getBodyAsString(), response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/UsageService.java b/src/main/java/com/chargebee/v4/services/UsageService.java index 9c6690aa..e8ca39da 100644 --- a/src/main/java/com/chargebee/v4/services/UsageService.java +++ b/src/main/java/com/chargebee/v4/services/UsageService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.usage.params.UsagePdfParams; @@ -84,6 +85,12 @@ public UsagePdfResponse pdf(UsagePdfParams params) throws ChargebeeException { return UsagePdfResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture pdfAsync(UsagePdfParams params) { + + return postAsync("/usages/pdf", params != null ? params.toFormData() : null) + .thenApply(response -> UsagePdfResponse.fromJson(response.getBodyAsString(), response)); + } + /** retrieve a usage (executes immediately) - returns raw Response. */ Response retrieveRaw(String subscriptionId) throws ChargebeeException { String path = @@ -108,11 +115,31 @@ public UsageRetrieveResponse retrieve(String subscriptionId, UsageRetrieveParams return UsageRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync( + String subscriptionId, UsageRetrieveParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/usages", "subscription-id", subscriptionId); + return getAsync(path, params != null ? params.toQueryParams() : null) + .thenApply( + response -> UsageRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + public UsageRetrieveResponse retrieve(String subscriptionId) throws ChargebeeException { Response response = retrieveRaw(subscriptionId); return UsageRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String subscriptionId) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/usages", "subscription-id", subscriptionId); + + return getAsync(path, null) + .thenApply( + response -> UsageRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** create a usage (executes immediately) - returns raw Response. */ Response createRaw(String subscriptionId) throws ChargebeeException { String path = @@ -144,6 +171,15 @@ public UsageCreateResponse create(String subscriptionId, UsageCreateParams param return UsageCreateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createAsync( + String subscriptionId, UsageCreateParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/usages", "subscription-id", subscriptionId); + return postAsync(path, params.toFormData()) + .thenApply(response -> UsageCreateResponse.fromJson(response.getBodyAsString(), response)); + } + /** delete a usage (executes immediately) - returns raw Response. */ Response deleteRaw(String subscriptionId) throws ChargebeeException { String path = @@ -175,6 +211,15 @@ public UsageDeleteResponse delete(String subscriptionId, UsageDeleteParams param return UsageDeleteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteAsync( + String subscriptionId, UsageDeleteParams params) { + String path = + buildPathWithParams( + "/subscriptions/{subscription-id}/delete_usage", "subscription-id", subscriptionId); + return postAsync(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 { @@ -199,9 +244,25 @@ public UsageListResponse list(UsageListParams params) throws ChargebeeException return UsageListResponse.fromJson(response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync(UsageListParams params) { + + return getAsync("/usages", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + UsageListResponse.fromJson(response.getBodyAsString(), this, params, response)); + } + public UsageListResponse list() throws ChargebeeException { Response response = listRaw(); return UsageListResponse.fromJson(response.getBodyAsString(), this, null, response); } + + public CompletableFuture listAsync() { + + return getAsync("/usages", null) + .thenApply( + response -> + UsageListResponse.fromJson(response.getBodyAsString(), this, null, response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/VariantService.java b/src/main/java/com/chargebee/v4/services/VariantService.java index bcce54e0..c8a0ee06 100644 --- a/src/main/java/com/chargebee/v4/services/VariantService.java +++ b/src/main/java/com/chargebee/v4/services/VariantService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.variant.params.ListProductVariantsParams; @@ -101,6 +102,25 @@ public ListProductVariantsResponse listProductVariants(String productId) response.getBodyAsString(), this, null, productId, response); } + 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) + .thenApply( + response -> + ListProductVariantsResponse.fromJson( + response.getBodyAsString(), this, params, productId, response)); + } + + public CompletableFuture listProductVariantsAsync(String productId) { + String path = buildPathWithParams("/products/{product-id}/variants", "product-id", productId); + return getAsync(path, null) + .thenApply( + response -> + ListProductVariantsResponse.fromJson( + response.getBodyAsString(), this, null, productId, response)); + } + /** createProductVariant a variant (executes immediately) - returns raw Response. */ Response createProductVariantRaw(String productId) throws ChargebeeException { String path = buildPathWithParams("/products/{product-id}/variants", "product-id", productId); @@ -133,6 +153,15 @@ public CreateProductVariantResponse createProductVariant( return CreateProductVariantResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createProductVariantAsync( + String productId, CreateProductVariantParams params) { + String path = buildPathWithParams("/products/{product-id}/variants", "product-id", productId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + CreateProductVariantResponse.fromJson(response.getBodyAsString(), response)); + } + /** retrieve a variant (executes immediately) - returns raw Response. */ Response retrieveRaw(String productVariantId) throws ChargebeeException { String path = @@ -147,6 +176,16 @@ public VariantRetrieveResponse retrieve(String productVariantId) throws Chargebe return VariantRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync(String productVariantId) { + String path = + buildPathWithParams( + "/variants/{product-variant-id}", "product-variant-id", productVariantId); + + return getAsync(path, null) + .thenApply( + response -> VariantRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** update a variant (executes immediately) - returns raw Response. */ Response updateRaw(String productVariantId) throws ChargebeeException { String path = @@ -179,11 +218,31 @@ public VariantUpdateResponse update(String productVariantId, VariantUpdateParams return VariantUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync( + String productVariantId, VariantUpdateParams params) { + String path = + buildPathWithParams( + "/variants/{product-variant-id}", "product-variant-id", productVariantId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> VariantUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + public VariantUpdateResponse update(String productVariantId) throws ChargebeeException { Response response = updateRaw(productVariantId); return VariantUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync(String productVariantId) { + String path = + buildPathWithParams( + "/variants/{product-variant-id}", "product-variant-id", productVariantId); + + return postAsync(path, null) + .thenApply( + response -> VariantUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + /** delete a variant (executes immediately) - returns raw Response. */ Response deleteRaw(String productVariantId) throws ChargebeeException { String path = @@ -197,4 +256,14 @@ public VariantDeleteResponse delete(String productVariantId) throws ChargebeeExc Response response = deleteRaw(productVariantId); return VariantDeleteResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture deleteAsync(String productVariantId) { + String path = + buildPathWithParams( + "/variants/{product-variant-id}/delete", "product-variant-id", productVariantId); + + return postAsync(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 24623b29..1f40beb8 100644 --- a/src/main/java/com/chargebee/v4/services/VirtualBankAccountService.java +++ b/src/main/java/com/chargebee/v4/services/VirtualBankAccountService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.virtualBankAccount.params.VirtualBankAccountListParams; @@ -84,6 +85,21 @@ public VirtualBankAccountDeleteLocalResponse deleteLocal(String virtualBankAccou return VirtualBankAccountDeleteLocalResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteLocalAsync( + String virtualBankAccountId) { + String path = + buildPathWithParams( + "/virtual_bank_accounts/{virtual-bank-account-id}/delete_local", + "virtual-bank-account-id", + virtualBankAccountId); + + return postAsync(path, null) + .thenApply( + response -> + VirtualBankAccountDeleteLocalResponse.fromJson( + response.getBodyAsString(), response)); + } + /** delete a virtualBankAccount (executes immediately) - returns raw Response. */ Response deleteRaw(String virtualBankAccountId) throws ChargebeeException { String path = @@ -101,6 +117,20 @@ public VirtualBankAccountDeleteResponse delete(String virtualBankAccountId) return VirtualBankAccountDeleteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteAsync( + String virtualBankAccountId) { + String path = + buildPathWithParams( + "/virtual_bank_accounts/{virtual-bank-account-id}/delete", + "virtual-bank-account-id", + virtualBankAccountId); + + return postAsync(path, null) + .thenApply( + response -> + VirtualBankAccountDeleteResponse.fromJson(response.getBodyAsString(), response)); + } + /** * list a virtualBankAccount using immutable params (executes immediately) - returns raw Response. */ @@ -131,6 +161,16 @@ public VirtualBankAccountListResponse list(VirtualBankAccountListParams params) response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync( + VirtualBankAccountListParams params) { + + return getAsync("/virtual_bank_accounts", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + VirtualBankAccountListResponse.fromJson( + response.getBodyAsString(), this, params, response)); + } + public VirtualBankAccountListResponse list() throws ChargebeeException { Response response = listRaw(); @@ -138,6 +178,15 @@ public VirtualBankAccountListResponse list() throws ChargebeeException { response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/virtual_bank_accounts", null) + .thenApply( + response -> + VirtualBankAccountListResponse.fromJson( + response.getBodyAsString(), this, null, response)); + } + /** * create a virtualBankAccount using immutable params (executes immediately) - returns raw * Response. @@ -163,6 +212,15 @@ public VirtualBankAccountCreateResponse create(VirtualBankAccountCreateParams pa return VirtualBankAccountCreateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture createAsync( + VirtualBankAccountCreateParams params) { + + return postAsync("/virtual_bank_accounts", params != null ? params.toFormData() : null) + .thenApply( + response -> + VirtualBankAccountCreateResponse.fromJson(response.getBodyAsString(), response)); + } + /** syncFund a virtualBankAccount (executes immediately) - returns raw Response. */ Response syncFundRaw(String virtualBankAccountId) throws ChargebeeException { String path = @@ -180,6 +238,20 @@ public VirtualBankAccountSyncFundResponse syncFund(String virtualBankAccountId) return VirtualBankAccountSyncFundResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture syncFundAsync( + String virtualBankAccountId) { + String path = + buildPathWithParams( + "/virtual_bank_accounts/{virtual-bank-account-id}/sync_fund", + "virtual-bank-account-id", + virtualBankAccountId); + + return postAsync(path, null) + .thenApply( + response -> + VirtualBankAccountSyncFundResponse.fromJson(response.getBodyAsString(), response)); + } + /** retrieve a virtualBankAccount (executes immediately) - returns raw Response. */ Response retrieveRaw(String virtualBankAccountId) throws ChargebeeException { String path = @@ -197,6 +269,20 @@ public VirtualBankAccountRetrieveResponse retrieve(String virtualBankAccountId) return VirtualBankAccountRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync( + String virtualBankAccountId) { + String path = + buildPathWithParams( + "/virtual_bank_accounts/{virtual-bank-account-id}", + "virtual-bank-account-id", + virtualBankAccountId); + + return getAsync(path, null) + .thenApply( + response -> + VirtualBankAccountRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** * createUsingPermanentToken a virtualBankAccount using immutable params (executes immediately) - * returns raw Response. @@ -225,4 +311,16 @@ public VirtualBankAccountCreateUsingPermanentTokenResponse createUsingPermanentT return VirtualBankAccountCreateUsingPermanentTokenResponse.fromJson( response.getBodyAsString(), response); } + + public CompletableFuture + createUsingPermanentTokenAsync(VirtualBankAccountCreateUsingPermanentTokenParams params) { + + return postAsync( + "/virtual_bank_accounts/create_using_permanent_token", + params != null ? params.toFormData() : null) + .thenApply( + response -> + VirtualBankAccountCreateUsingPermanentTokenResponse.fromJson( + response.getBodyAsString(), response)); + } } diff --git a/src/main/java/com/chargebee/v4/services/WebhookEndpointService.java b/src/main/java/com/chargebee/v4/services/WebhookEndpointService.java index 9fce3a99..b42609ef 100644 --- a/src/main/java/com/chargebee/v4/services/WebhookEndpointService.java +++ b/src/main/java/com/chargebee/v4/services/WebhookEndpointService.java @@ -11,6 +11,7 @@ import com.chargebee.v4.client.request.RequestOptions; import com.chargebee.v4.exceptions.ChargebeeException; import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; import com.chargebee.v4.models.webhookEndpoint.params.WebhookEndpointUpdateParams; @@ -79,6 +80,19 @@ public WebhookEndpointDeleteResponse delete(String webhookEndpointId) throws Cha return WebhookEndpointDeleteResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture deleteAsync(String webhookEndpointId) { + String path = + buildPathWithParams( + "/webhook_endpoints/{webhook-endpoint-id}/delete", + "webhook-endpoint-id", + webhookEndpointId); + + return postAsync(path, null) + .thenApply( + response -> + WebhookEndpointDeleteResponse.fromJson(response.getBodyAsString(), response)); + } + /** retrieve a webhookEndpoint (executes immediately) - returns raw Response. */ Response retrieveRaw(String webhookEndpointId) throws ChargebeeException { String path = @@ -94,6 +108,18 @@ public WebhookEndpointRetrieveResponse retrieve(String webhookEndpointId) return WebhookEndpointRetrieveResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture retrieveAsync( + String webhookEndpointId) { + String path = + buildPathWithParams( + "/webhook_endpoints/{webhook-endpoint-id}", "webhook-endpoint-id", webhookEndpointId); + + return getAsync(path, null) + .thenApply( + response -> + WebhookEndpointRetrieveResponse.fromJson(response.getBodyAsString(), response)); + } + /** update a webhookEndpoint (executes immediately) - returns raw Response. */ Response updateRaw(String webhookEndpointId) throws ChargebeeException { String path = @@ -130,11 +156,33 @@ public WebhookEndpointUpdateResponse update( return WebhookEndpointUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync( + String webhookEndpointId, WebhookEndpointUpdateParams params) { + String path = + buildPathWithParams( + "/webhook_endpoints/{webhook-endpoint-id}", "webhook-endpoint-id", webhookEndpointId); + return postAsync(path, params.toFormData()) + .thenApply( + response -> + WebhookEndpointUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + public WebhookEndpointUpdateResponse update(String webhookEndpointId) throws ChargebeeException { Response response = updateRaw(webhookEndpointId); return WebhookEndpointUpdateResponse.fromJson(response.getBodyAsString(), response); } + public CompletableFuture updateAsync(String webhookEndpointId) { + String path = + buildPathWithParams( + "/webhook_endpoints/{webhook-endpoint-id}", "webhook-endpoint-id", webhookEndpointId); + + return postAsync(path, null) + .thenApply( + response -> + WebhookEndpointUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + /** * list a webhookEndpoint using immutable params (executes immediately) - returns raw Response. */ @@ -164,12 +212,31 @@ public WebhookEndpointListResponse list(WebhookEndpointListParams params) return WebhookEndpointListResponse.fromJson(response.getBodyAsString(), this, params, response); } + public CompletableFuture listAsync( + WebhookEndpointListParams params) { + + return getAsync("/webhook_endpoints", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + WebhookEndpointListResponse.fromJson( + response.getBodyAsString(), this, params, response)); + } + public WebhookEndpointListResponse list() throws ChargebeeException { Response response = listRaw(); return WebhookEndpointListResponse.fromJson(response.getBodyAsString(), this, null, response); } + public CompletableFuture listAsync() { + + return getAsync("/webhook_endpoints", null) + .thenApply( + response -> + WebhookEndpointListResponse.fromJson( + response.getBodyAsString(), this, null, response)); + } + /** * create a webhookEndpoint using immutable params (executes immediately) - returns raw Response. */ @@ -192,4 +259,13 @@ public WebhookEndpointCreateResponse create(WebhookEndpointCreateParams params) return WebhookEndpointCreateResponse.fromJson(response.getBodyAsString(), response); } + + public CompletableFuture createAsync( + WebhookEndpointCreateParams params) { + + return postAsync("/webhook_endpoints", params != null ? params.toFormData() : null) + .thenApply( + response -> + WebhookEndpointCreateResponse.fromJson(response.getBodyAsString(), response)); + } } From 3846956d2e3206f7d2df44d908c0cab26ebbd557 Mon Sep 17 00:00:00 2001 From: cb-karthikp Date: Wed, 18 Feb 2026 16:21:53 +0530 Subject: [PATCH 2/6] version bump-up and change log --- CHANGELOG.md | 6 ++++++ VERSION | 2 +- build.gradle.kts | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 516a6be5..32e6fe71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +### v4.2.1 (2026-02-18) +* * * + +### New Features: +* Added async API support for all resource operations via `CompletableFuture`-based async methods (e.g., `createAsync`, `listAsync`, `retrieveAsync`). + ### v4.2.0 (2026-02-16) * * * diff --git a/VERSION b/VERSION index 6aba2b24..fae6e3d0 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.2.0 +4.2.1 diff --git a/build.gradle.kts b/build.gradle.kts index c3ec526e..48ff245c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,7 +7,7 @@ plugins { } group = "com.chargebee" -version = "4.2.0" +version = "4.2.1" description = "Java client library for ChargeBee" // Project metadata From 6854d3fd5fbaf00df3aedf8fad74ba4be67c6bd5 Mon Sep 17 00:00:00 2001 From: cb-karthikp Date: Wed, 18 Feb 2026 16:30:11 +0530 Subject: [PATCH 3/6] add JavaDoc --- .../AdditionalBillingLogiqService.java | 2 + .../chargebee/v4/services/AddonService.java | 9 +++ .../chargebee/v4/services/AddressService.java | 2 + .../v4/services/AttachedItemService.java | 7 ++ .../services/BrandConfigurationService.java | 2 + .../v4/services/BusinessEntityService.java | 3 + .../v4/services/BusinessProfileService.java | 2 + .../chargebee/v4/services/CardService.java | 5 ++ .../chargebee/v4/services/CommentService.java | 5 ++ .../v4/services/ConfigurationService.java | 2 + .../v4/services/CouponCodeService.java | 5 ++ .../chargebee/v4/services/CouponService.java | 12 ++++ .../v4/services/CouponSetService.java | 10 +++ .../v4/services/CreditNoteService.java | 23 +++++++ .../v4/services/CsvTaxRuleService.java | 1 + .../v4/services/CurrencyService.java | 7 ++ .../services/CustomerEntitlementService.java | 2 + .../v4/services/CustomerService.java | 42 ++++++++++++ .../v4/services/DifferentialPriceService.java | 7 ++ .../services/EntitlementOverrideService.java | 10 +++ .../v4/services/EntitlementService.java | 3 + .../v4/services/EstimateService.java | 29 ++++++++ .../chargebee/v4/services/EventService.java | 3 + .../chargebee/v4/services/ExportService.java | 18 +++++ .../chargebee/v4/services/FeatureService.java | 10 +++ .../v4/services/FullExportService.java | 1 + .../chargebee/v4/services/GiftService.java | 8 +++ .../v4/services/HostedPageService.java | 23 +++++++ .../v4/services/InAppSubscriptionService.java | 5 ++ .../chargebee/v4/services/InvoiceService.java | 67 +++++++++++++++++++ .../v4/services/ItemEntitlementService.java | 6 ++ .../v4/services/ItemFamilyService.java | 7 ++ .../v4/services/ItemPriceService.java | 11 +++ .../chargebee/v4/services/ItemService.java | 7 ++ .../chargebee/v4/services/MediaService.java | 1 + .../v4/services/NonSubscriptionService.java | 1 + .../v4/services/OfferEventService.java | 1 + .../v4/services/OfferFulfillmentService.java | 3 + .../OmnichannelOneTimeOrderService.java | 3 + .../OmnichannelSubscriptionItemService.java | 8 +++ .../OmnichannelSubscriptionService.java | 12 ++++ .../chargebee/v4/services/OrderService.java | 18 +++++ .../v4/services/PaymentIntentService.java | 4 ++ .../PaymentScheduleSchemeService.java | 3 + .../v4/services/PaymentSourceService.java | 20 ++++++ .../v4/services/PaymentVoucherService.java | 6 ++ .../Pc2MigrationItemFamilyService.java | 7 ++ .../Pc2MigrationItemPriceService.java | 6 ++ .../v4/services/Pc2MigrationItemService.java | 9 +++ .../v4/services/Pc2MigrationService.java | 4 ++ .../v4/services/PersonalizedOfferService.java | 1 + .../chargebee/v4/services/PlanService.java | 9 +++ .../v4/services/PortalSessionService.java | 4 ++ .../v4/services/PriceVariantService.java | 7 ++ .../services/PricingPageSessionService.java | 2 + .../chargebee/v4/services/ProductService.java | 9 +++ .../v4/services/PromotionalCreditService.java | 6 ++ .../v4/services/PurchaseService.java | 2 + .../chargebee/v4/services/QuoteService.java | 33 +++++++++ .../chargebee/v4/services/RampService.java | 6 ++ .../v4/services/RecordedPurchaseService.java | 2 + .../v4/services/ResourceMigrationService.java | 1 + .../chargebee/v4/services/RuleService.java | 1 + .../services/SiteMigrationDetailService.java | 2 + .../SubscriptionEntitlementService.java | 12 ++++ .../v4/services/SubscriptionService.java | 58 ++++++++++++++++ .../services/SubscriptionSettingService.java | 2 + .../ThirdPartyConfigurationService.java | 3 + .../ThirdPartyEntityMappingService.java | 5 ++ .../services/ThirdPartySyncDetailService.java | 5 ++ .../v4/services/TimeMachineService.java | 5 ++ .../v4/services/TpSiteUserService.java | 5 ++ .../v4/services/TransactionService.java | 19 ++++++ .../v4/services/UnbilledChargeService.java | 7 ++ .../UnbilledChargesSettingService.java | 2 + .../v4/services/UsageEventService.java | 2 + .../v4/services/UsageFileService.java | 2 + .../chargebee/v4/services/UsageService.java | 7 ++ .../chargebee/v4/services/VariantService.java | 7 ++ .../services/VirtualBankAccountService.java | 8 +++ .../v4/services/WebhookEndpointService.java | 7 ++ 81 files changed, 703 insertions(+) diff --git a/src/main/java/com/chargebee/v4/services/AdditionalBillingLogiqService.java b/src/main/java/com/chargebee/v4/services/AdditionalBillingLogiqService.java index 719e92bd..c02a61dc 100644 --- a/src/main/java/com/chargebee/v4/services/AdditionalBillingLogiqService.java +++ b/src/main/java/com/chargebee/v4/services/AdditionalBillingLogiqService.java @@ -86,6 +86,7 @@ public AdditionalBillingLogiqRetrieveResponse retrieve( return AdditionalBillingLogiqRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for additionalBillingLogiq with params. */ public CompletableFuture retrieveAsync( AdditionalBillingLogiqRetrieveParams params) { @@ -102,6 +103,7 @@ public AdditionalBillingLogiqRetrieveResponse retrieve() throws ChargebeeExcepti return AdditionalBillingLogiqRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for additionalBillingLogiq without params. */ public CompletableFuture retrieveAsync() { return getAsync("/additional_billing_logiqs", null) diff --git a/src/main/java/com/chargebee/v4/services/AddonService.java b/src/main/java/com/chargebee/v4/services/AddonService.java index e5282ae6..88acc89a 100644 --- a/src/main/java/com/chargebee/v4/services/AddonService.java +++ b/src/main/java/com/chargebee/v4/services/AddonService.java @@ -87,6 +87,7 @@ public AddonCopyResponse copy(AddonCopyParams params) throws ChargebeeException return AddonCopyResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of copy for addon with params. */ public CompletableFuture copyAsync(AddonCopyParams params) { return postAsync("/addons/copy", params != null ? params.toFormData() : null) @@ -105,6 +106,7 @@ public AddonUnarchiveResponse unarchive(String addonId) throws ChargebeeExceptio return AddonUnarchiveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of unarchive for addon without params. */ public CompletableFuture unarchiveAsync(String addonId) { String path = buildPathWithParams("/addons/{addon-id}/unarchive", "addon-id", addonId); @@ -125,6 +127,7 @@ public AddonRetrieveResponse retrieve(String addonId) throws ChargebeeException return AddonRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for addon without params. */ public CompletableFuture retrieveAsync(String addonId) { String path = buildPathWithParams("/addons/{addon-id}", "addon-id", addonId); @@ -158,6 +161,7 @@ public AddonUpdateResponse update(String addonId, AddonUpdateParams params) return AddonUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for addon with params. */ public CompletableFuture updateAsync( String addonId, AddonUpdateParams params) { String path = buildPathWithParams("/addons/{addon-id}", "addon-id", addonId); @@ -170,6 +174,7 @@ public AddonUpdateResponse update(String addonId) throws ChargebeeException { return AddonUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for addon without params. */ public CompletableFuture updateAsync(String addonId) { String path = buildPathWithParams("/addons/{addon-id}", "addon-id", addonId); @@ -201,6 +206,7 @@ public AddonListResponse list(AddonListParams params) throws ChargebeeException return AddonListResponse.fromJson(response.getBodyAsString(), this, params, response); } + /** Async variant of list for addon with params. */ public CompletableFuture listAsync(AddonListParams params) { return getAsync("/addons", params != null ? params.toQueryParams() : null) @@ -215,6 +221,7 @@ public AddonListResponse list() throws ChargebeeException { return AddonListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for addon without params. */ public CompletableFuture listAsync() { return getAsync("/addons", null) @@ -241,6 +248,7 @@ public AddonCreateResponse create(AddonCreateParams params) throws ChargebeeExce return AddonCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for addon with params. */ public CompletableFuture createAsync(AddonCreateParams params) { return postAsync("/addons", params != null ? params.toFormData() : null) @@ -259,6 +267,7 @@ public AddonDeleteResponse delete(String addonId) throws ChargebeeException { return AddonDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for addon without params. */ public CompletableFuture deleteAsync(String addonId) { String path = buildPathWithParams("/addons/{addon-id}/delete", "addon-id", addonId); diff --git a/src/main/java/com/chargebee/v4/services/AddressService.java b/src/main/java/com/chargebee/v4/services/AddressService.java index 5fe69bd1..af875f04 100644 --- a/src/main/java/com/chargebee/v4/services/AddressService.java +++ b/src/main/java/com/chargebee/v4/services/AddressService.java @@ -73,6 +73,7 @@ public AddressRetrieveResponse retrieve(AddressRetrieveParams params) throws Cha return AddressRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for address with params. */ public CompletableFuture retrieveAsync(AddressRetrieveParams params) { return getAsync("/addresses", params != null ? params.toQueryParams() : null) @@ -98,6 +99,7 @@ public AddressUpdateResponse update(AddressUpdateParams params) throws Chargebee return AddressUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for address with params. */ public CompletableFuture updateAsync(AddressUpdateParams params) { return postAsync("/addresses", params != null ? params.toFormData() : null) diff --git a/src/main/java/com/chargebee/v4/services/AttachedItemService.java b/src/main/java/com/chargebee/v4/services/AttachedItemService.java index c2c2e6d5..96188ad1 100644 --- a/src/main/java/com/chargebee/v4/services/AttachedItemService.java +++ b/src/main/java/com/chargebee/v4/services/AttachedItemService.java @@ -94,6 +94,7 @@ public AttachedItemRetrieveResponse retrieve( return AttachedItemRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for attachedItem with params. */ public CompletableFuture retrieveAsync( String attachedItemId, AttachedItemRetrieveParams params) { String path = @@ -110,6 +111,7 @@ public AttachedItemRetrieveResponse retrieve(String attachedItemId) throws Charg return AttachedItemRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for attachedItem without params. */ public CompletableFuture retrieveAsync(String attachedItemId) { String path = buildPathWithParams( @@ -153,6 +155,7 @@ public AttachedItemUpdateResponse update(String attachedItemId, AttachedItemUpda return AttachedItemUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for attachedItem with params. */ public CompletableFuture updateAsync( String attachedItemId, AttachedItemUpdateParams params) { String path = @@ -194,6 +197,7 @@ public AttachedItemListResponse list(String itemId) throws ChargebeeException { response.getBodyAsString(), this, null, itemId, response); } + /** Async variant of list for attachedItem with params. */ public CompletableFuture listAsync( String itemId, AttachedItemListParams params) { String path = buildPathWithParams("/items/{item-id}/attached_items", "item-id", itemId); @@ -204,6 +208,7 @@ public CompletableFuture listAsync( response.getBodyAsString(), this, params, itemId, response)); } + /** 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) @@ -238,6 +243,7 @@ public AttachedItemCreateResponse create(String itemId, AttachedItemCreateParams return AttachedItemCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for attachedItem with params. */ public CompletableFuture createAsync( String itemId, AttachedItemCreateParams params) { String path = buildPathWithParams("/items/{item-id}/attached_items", "item-id", itemId); @@ -278,6 +284,7 @@ public AttachedItemDeleteResponse delete(String attachedItemId, AttachedItemDele return AttachedItemDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for attachedItem with params. */ public CompletableFuture deleteAsync( String attachedItemId, AttachedItemDeleteParams params) { String path = diff --git a/src/main/java/com/chargebee/v4/services/BrandConfigurationService.java b/src/main/java/com/chargebee/v4/services/BrandConfigurationService.java index e989dd7f..399ce0c8 100644 --- a/src/main/java/com/chargebee/v4/services/BrandConfigurationService.java +++ b/src/main/java/com/chargebee/v4/services/BrandConfigurationService.java @@ -83,6 +83,7 @@ public BrandConfigurationRetrieveResponse retrieve(BrandConfigurationRetrievePar return BrandConfigurationRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for brandConfiguration with params. */ public CompletableFuture retrieveAsync( BrandConfigurationRetrieveParams params) { @@ -98,6 +99,7 @@ public BrandConfigurationRetrieveResponse retrieve() throws ChargebeeException { return BrandConfigurationRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for brandConfiguration without params. */ public CompletableFuture retrieveAsync() { return getAsync("/brand_configurations", null) diff --git a/src/main/java/com/chargebee/v4/services/BusinessEntityService.java b/src/main/java/com/chargebee/v4/services/BusinessEntityService.java index 0fba09df..1b348ecc 100644 --- a/src/main/java/com/chargebee/v4/services/BusinessEntityService.java +++ b/src/main/java/com/chargebee/v4/services/BusinessEntityService.java @@ -88,6 +88,7 @@ public BusinessEntityGetTransfersResponse getTransfers(BusinessEntityGetTransfer response.getBodyAsString(), this, params, response); } + /** Async variant of getTransfers for businessEntity with params. */ public CompletableFuture getTransfersAsync( BusinessEntityGetTransfersParams params) { @@ -105,6 +106,7 @@ public BusinessEntityGetTransfersResponse getTransfers() throws ChargebeeExcepti response.getBodyAsString(), this, null, response); } + /** Async variant of getTransfers for businessEntity without params. */ public CompletableFuture getTransfersAsync() { return getAsync("/business_entities/transfers", null) @@ -140,6 +142,7 @@ public BusinessEntityCreateTransfersResponse createTransfers( return BusinessEntityCreateTransfersResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of createTransfers for businessEntity with params. */ public CompletableFuture createTransfersAsync( BusinessEntityCreateTransfersParams params) { diff --git a/src/main/java/com/chargebee/v4/services/BusinessProfileService.java b/src/main/java/com/chargebee/v4/services/BusinessProfileService.java index e517c3c2..76517abb 100644 --- a/src/main/java/com/chargebee/v4/services/BusinessProfileService.java +++ b/src/main/java/com/chargebee/v4/services/BusinessProfileService.java @@ -83,6 +83,7 @@ public BusinessProfileRetrieveResponse retrieve(BusinessProfileRetrieveParams pa return BusinessProfileRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for businessProfile with params. */ public CompletableFuture retrieveAsync( BusinessProfileRetrieveParams params) { @@ -98,6 +99,7 @@ public BusinessProfileRetrieveResponse retrieve() throws ChargebeeException { return BusinessProfileRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for businessProfile without params. */ public CompletableFuture retrieveAsync() { return getAsync("/business_profiles", null) diff --git a/src/main/java/com/chargebee/v4/services/CardService.java b/src/main/java/com/chargebee/v4/services/CardService.java index b4bc97e3..10f40159 100644 --- a/src/main/java/com/chargebee/v4/services/CardService.java +++ b/src/main/java/com/chargebee/v4/services/CardService.java @@ -98,6 +98,7 @@ public CopyCardForCustomerResponse copyCardForCustomer( return CopyCardForCustomerResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of copyCardForCustomer for card with params. */ public CompletableFuture copyCardForCustomerAsync( String customerId, CopyCardForCustomerParams params) { String path = @@ -119,6 +120,7 @@ public CardRetrieveResponse retrieve(String customerId) throws ChargebeeExceptio return CardRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for card without params. */ public CompletableFuture retrieveAsync(String customerId) { String path = buildPathWithParams("/cards/{customer-id}", "customer-id", customerId); @@ -162,6 +164,7 @@ public CardSwitchGatewayForCustomerResponse switchGatewayForCustomer( return CardSwitchGatewayForCustomerResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of switchGatewayForCustomer for card with params. */ public CompletableFuture switchGatewayForCustomerAsync( String customerId, CardSwitchGatewayForCustomerParams params) { String path = @@ -187,6 +190,7 @@ public DeleteCardForCustomerResponse deleteCardForCustomer(String customerId) return DeleteCardForCustomerResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of deleteCardForCustomer for card without params. */ public CompletableFuture deleteCardForCustomerAsync( String customerId) { String path = @@ -234,6 +238,7 @@ public UpdateCardForCustomerResponse updateCardForCustomer( return UpdateCardForCustomerResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of updateCardForCustomer for card with params. */ public CompletableFuture updateCardForCustomerAsync( String customerId, UpdateCardForCustomerParams params) { String path = diff --git a/src/main/java/com/chargebee/v4/services/CommentService.java b/src/main/java/com/chargebee/v4/services/CommentService.java index cb2df36d..5246caa9 100644 --- a/src/main/java/com/chargebee/v4/services/CommentService.java +++ b/src/main/java/com/chargebee/v4/services/CommentService.java @@ -71,6 +71,7 @@ public CommentDeleteResponse delete(String commentId) throws ChargebeeException return CommentDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for comment without params. */ public CompletableFuture deleteAsync(String commentId) { String path = buildPathWithParams("/comments/{comment-id}/delete", "comment-id", commentId); @@ -91,6 +92,7 @@ public CommentRetrieveResponse retrieve(String commentId) throws ChargebeeExcept return CommentRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for comment without params. */ public CompletableFuture retrieveAsync(String commentId) { String path = buildPathWithParams("/comments/{comment-id}", "comment-id", commentId); @@ -123,6 +125,7 @@ public CommentListResponse list(CommentListParams params) throws ChargebeeExcept return CommentListResponse.fromJson(response.getBodyAsString(), this, params, response); } + /** Async variant of list for comment with params. */ public CompletableFuture listAsync(CommentListParams params) { return getAsync("/comments", params != null ? params.toQueryParams() : null) @@ -137,6 +140,7 @@ public CommentListResponse list() throws ChargebeeException { return CommentListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for comment without params. */ public CompletableFuture listAsync() { return getAsync("/comments", null) @@ -163,6 +167,7 @@ public CommentCreateResponse create(CommentCreateParams params) throws Chargebee return CommentCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for comment with params. */ public CompletableFuture createAsync(CommentCreateParams params) { return postAsync("/comments", params != null ? params.toFormData() : null) diff --git a/src/main/java/com/chargebee/v4/services/ConfigurationService.java b/src/main/java/com/chargebee/v4/services/ConfigurationService.java index cb077ddb..cb51c043 100644 --- a/src/main/java/com/chargebee/v4/services/ConfigurationService.java +++ b/src/main/java/com/chargebee/v4/services/ConfigurationService.java @@ -76,6 +76,7 @@ public ConfigurationListResponse list(ConfigurationListParams params) throws Cha return ConfigurationListResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of list for configuration with params. */ public CompletableFuture listAsync(ConfigurationListParams params) { return getAsync("/configurations", params != null ? params.toQueryParams() : null) @@ -89,6 +90,7 @@ public ConfigurationListResponse list() throws ChargebeeException { return ConfigurationListResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of list for configuration without params. */ public CompletableFuture listAsync() { return getAsync("/configurations", null) diff --git a/src/main/java/com/chargebee/v4/services/CouponCodeService.java b/src/main/java/com/chargebee/v4/services/CouponCodeService.java index 17fd0295..c84d2970 100644 --- a/src/main/java/com/chargebee/v4/services/CouponCodeService.java +++ b/src/main/java/com/chargebee/v4/services/CouponCodeService.java @@ -83,6 +83,7 @@ public CouponCodeListResponse list(CouponCodeListParams params) throws Chargebee return CouponCodeListResponse.fromJson(response.getBodyAsString(), this, params, response); } + /** Async variant of list for couponCode with params. */ public CompletableFuture listAsync(CouponCodeListParams params) { return getAsync("/coupon_codes", params != null ? params.toQueryParams() : null) @@ -98,6 +99,7 @@ public CouponCodeListResponse list() throws ChargebeeException { return CouponCodeListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for couponCode without params. */ public CompletableFuture listAsync() { return getAsync("/coupon_codes", null) @@ -124,6 +126,7 @@ public CouponCodeCreateResponse create(CouponCodeCreateParams params) throws Cha return CouponCodeCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for couponCode with params. */ public CompletableFuture createAsync(CouponCodeCreateParams params) { return postAsync("/coupon_codes", params != null ? params.toFormData() : null) @@ -144,6 +147,7 @@ public CouponCodeRetrieveResponse retrieve(String couponCodeCode) throws Chargeb return CouponCodeRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for couponCode without params. */ public CompletableFuture retrieveAsync(String couponCodeCode) { String path = buildPathWithParams("/coupon_codes/{coupon-code-code}", "coupon-code-code", couponCodeCode); @@ -167,6 +171,7 @@ public CouponCodeArchiveResponse archive(String couponCodeCode) throws Chargebee return CouponCodeArchiveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of archive for couponCode without params. */ public CompletableFuture archiveAsync(String couponCodeCode) { String path = buildPathWithParams( diff --git a/src/main/java/com/chargebee/v4/services/CouponService.java b/src/main/java/com/chargebee/v4/services/CouponService.java index bd850a54..6e9ff55c 100644 --- a/src/main/java/com/chargebee/v4/services/CouponService.java +++ b/src/main/java/com/chargebee/v4/services/CouponService.java @@ -101,6 +101,7 @@ public CouponListResponse list(CouponListParams params) throws ChargebeeExceptio return CouponListResponse.fromJson(response.getBodyAsString(), this, params, response); } + /** Async variant of list for coupon with params. */ public CompletableFuture listAsync(CouponListParams params) { return getAsync("/coupons", params != null ? params.toQueryParams() : null) @@ -115,6 +116,7 @@ public CouponListResponse list() throws ChargebeeException { return CouponListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for coupon without params. */ public CompletableFuture listAsync() { return getAsync("/coupons", null) @@ -141,6 +143,7 @@ public CouponCreateResponse create(CouponCreateParams params) throws ChargebeeEx return CouponCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for coupon with params. */ public CompletableFuture createAsync(CouponCreateParams params) { return postAsync("/coupons", params != null ? params.toFormData() : null) @@ -180,6 +183,7 @@ public CouponUpdateForItemsResponse updateForItems( return CouponUpdateForItemsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of updateForItems for coupon with params. */ public CompletableFuture updateForItemsAsync( String couponId, CouponUpdateForItemsParams params) { String path = @@ -195,6 +199,7 @@ public CouponUpdateForItemsResponse updateForItems(String couponId) throws Charg return CouponUpdateForItemsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of updateForItems for coupon without params. */ public CompletableFuture updateForItemsAsync(String couponId) { String path = buildPathWithParams("/coupons/{coupon-id}/update_for_items", "coupon-id", couponId); @@ -217,6 +222,7 @@ public CouponUnarchiveResponse unarchive(String couponId) throws ChargebeeExcept return CouponUnarchiveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of unarchive for coupon without params. */ public CompletableFuture unarchiveAsync(String couponId) { String path = buildPathWithParams("/coupons/{coupon-id}/unarchive", "coupon-id", couponId); @@ -237,6 +243,7 @@ public CouponDeleteResponse delete(String couponId) throws ChargebeeException { return CouponDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for coupon without params. */ public CompletableFuture deleteAsync(String couponId) { String path = buildPathWithParams("/coupons/{coupon-id}/delete", "coupon-id", couponId); @@ -262,6 +269,7 @@ public CouponCopyResponse copy(CouponCopyParams params) throws ChargebeeExceptio return CouponCopyResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of copy for coupon with params. */ public CompletableFuture copyAsync(CouponCopyParams params) { return postAsync("/coupons/copy", params != null ? params.toFormData() : null) @@ -280,6 +288,7 @@ public CouponRetrieveResponse retrieve(String couponId) throws ChargebeeExceptio return CouponRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for coupon without params. */ public CompletableFuture retrieveAsync(String couponId) { String path = buildPathWithParams("/coupons/{coupon-id}", "coupon-id", couponId); @@ -313,6 +322,7 @@ public CouponUpdateResponse update(String couponId, CouponUpdateParams params) return CouponUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for coupon with params. */ public CompletableFuture updateAsync( String couponId, CouponUpdateParams params) { String path = buildPathWithParams("/coupons/{coupon-id}", "coupon-id", couponId); @@ -325,6 +335,7 @@ public CouponUpdateResponse update(String couponId) throws ChargebeeException { return CouponUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for coupon without params. */ public CompletableFuture updateAsync(String couponId) { String path = buildPathWithParams("/coupons/{coupon-id}", "coupon-id", couponId); @@ -355,6 +366,7 @@ public CouponCreateForItemsResponse createForItems(CouponCreateForItemsParams pa return CouponCreateForItemsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of createForItems for coupon with params. */ public CompletableFuture createForItemsAsync( CouponCreateForItemsParams params) { diff --git a/src/main/java/com/chargebee/v4/services/CouponSetService.java b/src/main/java/com/chargebee/v4/services/CouponSetService.java index c72b7673..ef39960c 100644 --- a/src/main/java/com/chargebee/v4/services/CouponSetService.java +++ b/src/main/java/com/chargebee/v4/services/CouponSetService.java @@ -93,6 +93,7 @@ public CouponSetListResponse list(CouponSetListParams params) throws ChargebeeEx return CouponSetListResponse.fromJson(response.getBodyAsString(), this, params, response); } + /** Async variant of list for couponSet with params. */ public CompletableFuture listAsync(CouponSetListParams params) { return getAsync("/coupon_sets", params != null ? params.toQueryParams() : null) @@ -107,6 +108,7 @@ public CouponSetListResponse list() throws ChargebeeException { return CouponSetListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for couponSet without params. */ public CompletableFuture listAsync() { return getAsync("/coupon_sets", null) @@ -133,6 +135,7 @@ public CouponSetCreateResponse create(CouponSetCreateParams params) throws Charg return CouponSetCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for couponSet with params. */ public CompletableFuture createAsync(CouponSetCreateParams params) { return postAsync("/coupon_sets", params != null ? params.toFormData() : null) @@ -168,6 +171,7 @@ public CouponSetUpdateResponse update(String couponSetId, CouponSetUpdateParams return CouponSetUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for couponSet with params. */ public CompletableFuture updateAsync( String couponSetId, CouponSetUpdateParams params) { String path = @@ -182,6 +186,7 @@ public CouponSetUpdateResponse update(String couponSetId) throws ChargebeeExcept return CouponSetUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for couponSet without params. */ public CompletableFuture updateAsync(String couponSetId) { String path = buildPathWithParams("/coupon_sets/{coupon-set-id}/update", "coupon-set-id", couponSetId); @@ -203,6 +208,7 @@ public CouponSetRetrieveResponse retrieve(String couponSetId) throws ChargebeeEx return CouponSetRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for couponSet without params. */ public CompletableFuture retrieveAsync(String couponSetId) { String path = buildPathWithParams("/coupon_sets/{coupon-set-id}", "coupon-set-id", couponSetId); @@ -249,6 +255,7 @@ public CouponSetAddCouponCodesResponse addCouponCodes( return CouponSetAddCouponCodesResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of addCouponCodes for couponSet with params. */ public CompletableFuture addCouponCodesAsync( String couponSetId, CouponSetAddCouponCodesParams params) { String path = @@ -266,6 +273,7 @@ public CouponSetAddCouponCodesResponse addCouponCodes(String couponSetId) return CouponSetAddCouponCodesResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of addCouponCodes for couponSet without params. */ public CompletableFuture addCouponCodesAsync( String couponSetId) { String path = @@ -295,6 +303,7 @@ public CouponSetDeleteUnusedCouponCodesResponse deleteUnusedCouponCodes(String c return CouponSetDeleteUnusedCouponCodesResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of deleteUnusedCouponCodes for couponSet without params. */ public CompletableFuture deleteUnusedCouponCodesAsync( String couponSetId) { String path = @@ -323,6 +332,7 @@ public CouponSetDeleteResponse delete(String couponSetId) throws ChargebeeExcept return CouponSetDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for couponSet without params. */ public CompletableFuture deleteAsync(String couponSetId) { String path = buildPathWithParams("/coupon_sets/{coupon-set-id}/delete", "coupon-set-id", couponSetId); diff --git a/src/main/java/com/chargebee/v4/services/CreditNoteService.java b/src/main/java/com/chargebee/v4/services/CreditNoteService.java index 6fcb7d2a..2c58f577 100644 --- a/src/main/java/com/chargebee/v4/services/CreditNoteService.java +++ b/src/main/java/com/chargebee/v4/services/CreditNoteService.java @@ -133,6 +133,7 @@ public CreditNoteRecordRefundResponse recordRefund( return CreditNoteRecordRefundResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of recordRefund for creditNote with params. */ public CompletableFuture recordRefundAsync( String creditNoteId, CreditNoteRecordRefundParams params) { String path = @@ -150,6 +151,7 @@ public CreditNoteRecordRefundResponse recordRefund(String creditNoteId) return CreditNoteRecordRefundResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of recordRefund for creditNote without params. */ public CompletableFuture recordRefundAsync(String creditNoteId) { String path = buildPathWithParams( @@ -186,6 +188,7 @@ public ImportCreditNoteResponse importCreditNote(ImportCreditNoteParams params) return ImportCreditNoteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of importCreditNote for creditNote with params. */ public CompletableFuture importCreditNoteAsync( ImportCreditNoteParams params) { @@ -226,6 +229,7 @@ public CreditNoteDeleteResponse delete(String creditNoteId, CreditNoteDeletePara return CreditNoteDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for creditNote with params. */ public CompletableFuture deleteAsync( String creditNoteId, CreditNoteDeleteParams params) { String path = @@ -241,6 +245,7 @@ public CreditNoteDeleteResponse delete(String creditNoteId) throws ChargebeeExce return CreditNoteDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for creditNote without params. */ public CompletableFuture deleteAsync(String creditNoteId) { String path = buildPathWithParams( @@ -297,6 +302,7 @@ public CreditNotesForCustomerResponse creditNotesForCustomer(String customerId) response.getBodyAsString(), this, null, customerId, response); } + /** Async variant of creditNotesForCustomer for creditNote with params. */ public CompletableFuture creditNotesForCustomerAsync( String customerId, CreditNotesForCustomerParams params) { String path = @@ -308,6 +314,7 @@ public CompletableFuture creditNotesForCustomerA response.getBodyAsString(), this, params, customerId, response)); } + /** Async variant of creditNotesForCustomer for creditNote without params. */ public CompletableFuture creditNotesForCustomerAsync( String customerId) { String path = @@ -347,6 +354,7 @@ public CreditNotePdfResponse pdf(String creditNoteId, CreditNotePdfParams params return CreditNotePdfResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of pdf for creditNote with params. */ public CompletableFuture pdfAsync( String creditNoteId, CreditNotePdfParams params) { String path = @@ -361,6 +369,7 @@ public CreditNotePdfResponse pdf(String creditNoteId) throws ChargebeeException return CreditNotePdfResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of pdf for creditNote without params. */ public CompletableFuture pdfAsync(String creditNoteId) { String path = buildPathWithParams("/credit_notes/{credit-note-id}/pdf", "credit-note-id", creditNoteId); @@ -385,6 +394,7 @@ public CreditNoteSendEinvoiceResponse sendEinvoice(String creditNoteId) return CreditNoteSendEinvoiceResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of sendEinvoice for creditNote without params. */ public CompletableFuture sendEinvoiceAsync(String creditNoteId) { String path = buildPathWithParams( @@ -431,6 +441,7 @@ public VoidCreditNoteResponse voidCreditNote(String creditNoteId, VoidCreditNote return VoidCreditNoteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of voidCreditNote for creditNote with params. */ public CompletableFuture voidCreditNoteAsync( String creditNoteId, VoidCreditNoteParams params) { String path = @@ -445,6 +456,7 @@ public VoidCreditNoteResponse voidCreditNote(String creditNoteId) throws Chargeb return VoidCreditNoteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of voidCreditNote for creditNote without params. */ public CompletableFuture voidCreditNoteAsync(String creditNoteId) { String path = buildPathWithParams("/credit_notes/{credit-note-id}/void", "credit-note-id", creditNoteId); @@ -485,6 +497,7 @@ public CreditNoteRefundResponse refund(String creditNoteId, CreditNoteRefundPara return CreditNoteRefundResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of refund for creditNote with params. */ public CompletableFuture refundAsync( String creditNoteId, CreditNoteRefundParams params) { String path = @@ -500,6 +513,7 @@ public CreditNoteRefundResponse refund(String creditNoteId) throws ChargebeeExce return CreditNoteRefundResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of refund for creditNote without params. */ public CompletableFuture refundAsync(String creditNoteId) { String path = buildPathWithParams( @@ -534,6 +548,7 @@ public CreditNoteListResponse list(CreditNoteListParams params) throws Chargebee return CreditNoteListResponse.fromJson(response.getBodyAsString(), this, params, response); } + /** Async variant of list for creditNote with params. */ public CompletableFuture listAsync(CreditNoteListParams params) { return getAsync("/credit_notes", params != null ? params.toQueryParams() : null) @@ -549,6 +564,7 @@ public CreditNoteListResponse list() throws ChargebeeException { return CreditNoteListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for creditNote without params. */ public CompletableFuture listAsync() { return getAsync("/credit_notes", null) @@ -575,6 +591,7 @@ public CreditNoteCreateResponse create(CreditNoteCreateParams params) throws Cha return CreditNoteCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for creditNote with params. */ public CompletableFuture createAsync(CreditNoteCreateParams params) { return postAsync("/credit_notes", params != null ? params.toFormData() : null) @@ -597,6 +614,7 @@ public CreditNoteDownloadEinvoiceResponse downloadEinvoice(String creditNoteId) return CreditNoteDownloadEinvoiceResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of downloadEinvoice for creditNote without params. */ public CompletableFuture downloadEinvoiceAsync( String creditNoteId) { String path = @@ -624,6 +642,7 @@ public CreditNoteResendEinvoiceResponse resendEinvoice(String creditNoteId) return CreditNoteResendEinvoiceResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of resendEinvoice for creditNote without params. */ public CompletableFuture resendEinvoiceAsync( String creditNoteId) { String path = @@ -683,6 +702,7 @@ public CreditNoteRemoveTaxWithheldRefundResponse removeTaxWithheldRefund( return CreditNoteRemoveTaxWithheldRefundResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of removeTaxWithheldRefund for creditNote with params. */ public CompletableFuture removeTaxWithheldRefundAsync( String creditNoteId, CreditNoteRemoveTaxWithheldRefundParams params) { String path = @@ -703,6 +723,7 @@ public CreditNoteRemoveTaxWithheldRefundResponse removeTaxWithheldRefund(String return CreditNoteRemoveTaxWithheldRefundResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of removeTaxWithheldRefund for creditNote without params. */ public CompletableFuture removeTaxWithheldRefundAsync( String creditNoteId) { String path = @@ -740,6 +761,7 @@ public CreditNoteRetrieveResponse retrieve(String creditNoteId, CreditNoteRetrie return CreditNoteRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for creditNote with params. */ public CompletableFuture retrieveAsync( String creditNoteId, CreditNoteRetrieveParams params) { String path = @@ -754,6 +776,7 @@ public CreditNoteRetrieveResponse retrieve(String creditNoteId) throws Chargebee return CreditNoteRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for creditNote without params. */ public CompletableFuture retrieveAsync(String creditNoteId) { String path = buildPathWithParams("/credit_notes/{credit-note-id}", "credit-note-id", creditNoteId); diff --git a/src/main/java/com/chargebee/v4/services/CsvTaxRuleService.java b/src/main/java/com/chargebee/v4/services/CsvTaxRuleService.java index bebb8dd8..fba8beb3 100644 --- a/src/main/java/com/chargebee/v4/services/CsvTaxRuleService.java +++ b/src/main/java/com/chargebee/v4/services/CsvTaxRuleService.java @@ -69,6 +69,7 @@ public CsvTaxRuleCreateResponse create(CsvTaxRuleCreateParams params) throws Cha return CsvTaxRuleCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for csvTaxRule with params. */ public CompletableFuture createAsync(CsvTaxRuleCreateParams params) { return postAsync("/csv_tax_rules", params != null ? params.toFormData() : null) diff --git a/src/main/java/com/chargebee/v4/services/CurrencyService.java b/src/main/java/com/chargebee/v4/services/CurrencyService.java index 0ea4828e..47f2dc59 100644 --- a/src/main/java/com/chargebee/v4/services/CurrencyService.java +++ b/src/main/java/com/chargebee/v4/services/CurrencyService.java @@ -103,6 +103,7 @@ public CurrencyAddScheduleResponse addSchedule( return CurrencyAddScheduleResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of addSchedule for currency with params. */ public CompletableFuture addScheduleAsync( String siteCurrencyId, CurrencyAddScheduleParams params) { String path = @@ -131,6 +132,7 @@ public CurrencyCreateResponse create(CurrencyCreateParams params) throws Chargeb return CurrencyCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for currency with params. */ public CompletableFuture createAsync(CurrencyCreateParams params) { return postAsync("/currencies", params != null ? params.toFormData() : null) @@ -151,6 +153,7 @@ public CurrencyRetrieveResponse retrieve(String siteCurrencyId) throws Chargebee return CurrencyRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for currency without params. */ public CompletableFuture retrieveAsync(String siteCurrencyId) { String path = buildPathWithParams("/currencies/{site-currency-id}", "site-currency-id", siteCurrencyId); @@ -188,6 +191,7 @@ public CurrencyUpdateResponse update(String siteCurrencyId, CurrencyUpdateParams return CurrencyUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for currency with params. */ public CompletableFuture updateAsync( String siteCurrencyId, CurrencyUpdateParams params) { String path = @@ -212,6 +216,7 @@ public CurrencyRemoveScheduleResponse removeSchedule(String siteCurrencyId) return CurrencyRemoveScheduleResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of removeSchedule for currency without params. */ public CompletableFuture removeScheduleAsync( String siteCurrencyId) { String path = @@ -248,6 +253,7 @@ public CurrencyListResponse list(CurrencyListParams params) throws ChargebeeExce return CurrencyListResponse.fromJson(response.getBodyAsString(), this, params, response); } + /** Async variant of list for currency with params. */ public CompletableFuture listAsync(CurrencyListParams params) { return getAsync("/currencies/list", params != null ? params.toQueryParams() : null) @@ -262,6 +268,7 @@ public CurrencyListResponse list() throws ChargebeeException { return CurrencyListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for currency without params. */ public CompletableFuture listAsync() { return getAsync("/currencies/list", null) diff --git a/src/main/java/com/chargebee/v4/services/CustomerEntitlementService.java b/src/main/java/com/chargebee/v4/services/CustomerEntitlementService.java index a59c4ed1..44d6369a 100644 --- a/src/main/java/com/chargebee/v4/services/CustomerEntitlementService.java +++ b/src/main/java/com/chargebee/v4/services/CustomerEntitlementService.java @@ -103,6 +103,7 @@ public CustomerEntitlementEntitlementsForCustomerResponse entitlementsForCustome response.getBodyAsString(), this, null, customerId, response); } + /** Async variant of entitlementsForCustomer for customerEntitlement with params. */ public CompletableFuture entitlementsForCustomerAsync( String customerId, CustomerEntitlementEntitlementsForCustomerParams params) { @@ -116,6 +117,7 @@ public CustomerEntitlementEntitlementsForCustomerResponse entitlementsForCustome response.getBodyAsString(), this, params, customerId, response)); } + /** Async variant of entitlementsForCustomer for customerEntitlement without params. */ public CompletableFuture entitlementsForCustomerAsync(String customerId) { String path = diff --git a/src/main/java/com/chargebee/v4/services/CustomerService.java b/src/main/java/com/chargebee/v4/services/CustomerService.java index 86f35bb2..6522451d 100644 --- a/src/main/java/com/chargebee/v4/services/CustomerService.java +++ b/src/main/java/com/chargebee/v4/services/CustomerService.java @@ -170,6 +170,7 @@ public CustomerDeleteResponse delete(String customerId, CustomerDeleteParams par return CustomerDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for customer with params. */ public CompletableFuture deleteAsync( String customerId, CustomerDeleteParams params) { String path = buildPathWithParams("/customers/{customer-id}/delete", "customer-id", customerId); @@ -183,6 +184,7 @@ public CustomerDeleteResponse delete(String customerId) throws ChargebeeExceptio return CustomerDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for customer without params. */ public CompletableFuture deleteAsync(String customerId) { String path = buildPathWithParams("/customers/{customer-id}/delete", "customer-id", customerId); @@ -230,6 +232,7 @@ public CustomerAddPromotionalCreditsResponse addPromotionalCredits( return CustomerAddPromotionalCreditsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of addPromotionalCredits for customer with params. */ public CompletableFuture addPromotionalCreditsAsync( String customerId, CustomerAddPromotionalCreditsParams params) { String path = @@ -275,6 +278,7 @@ public CustomerRelationshipsResponse relationships( return CustomerRelationshipsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of relationships for customer with params. */ public CompletableFuture relationshipsAsync( String customerId, CustomerRelationshipsParams params) { String path = @@ -290,6 +294,7 @@ public CustomerRelationshipsResponse relationships(String customerId) throws Cha return CustomerRelationshipsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of relationships for customer without params. */ public CompletableFuture relationshipsAsync(String customerId) { String path = buildPathWithParams("/customers/{customer-id}/relationships", "customer-id", customerId); @@ -315,6 +320,7 @@ public CustomerDeleteRelationshipResponse deleteRelationship(String customerId) return CustomerDeleteRelationshipResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of deleteRelationship for customer without params. */ public CompletableFuture deleteRelationshipAsync( String customerId) { String path = @@ -360,6 +366,7 @@ public CustomerDeleteContactResponse deleteContact( return CustomerDeleteContactResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of deleteContact for customer with params. */ public CompletableFuture deleteContactAsync( String customerId, CustomerDeleteContactParams params) { String path = @@ -375,6 +382,7 @@ public CustomerDeleteContactResponse deleteContact(String customerId) throws Cha return CustomerDeleteContactResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of deleteContact for customer without params. */ public CompletableFuture deleteContactAsync(String customerId) { String path = buildPathWithParams("/customers/{customer-id}/delete_contact", "customer-id", customerId); @@ -423,6 +431,7 @@ public CustomerAssignPaymentRoleResponse assignPaymentRole( return CustomerAssignPaymentRoleResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of assignPaymentRole for customer with params. */ public CompletableFuture assignPaymentRoleAsync( String customerId, CustomerAssignPaymentRoleParams params) { String path = @@ -452,6 +461,7 @@ public CustomerMoveResponse move(CustomerMoveParams params) throws ChargebeeExce return CustomerMoveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of move for customer with params. */ public CompletableFuture moveAsync(CustomerMoveParams params) { return postAsync("/customers/move", params != null ? params.toFormData() : null) @@ -480,6 +490,7 @@ public CustomerHierarchyResponse hierarchy(String customerId, CustomerHierarchyP return CustomerHierarchyResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of hierarchy for customer with params. */ public CompletableFuture hierarchyAsync( String customerId, CustomerHierarchyParams params) { String path = @@ -494,6 +505,7 @@ public CustomerHierarchyResponse hierarchy(String customerId) throws ChargebeeEx return CustomerHierarchyResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of hierarchy for customer without params. */ public CompletableFuture hierarchyAsync(String customerId) { String path = buildPathWithParams("/customers/{customer-id}/hierarchy", "customer-id", customerId); @@ -541,6 +553,7 @@ public CustomerUpdatePaymentMethodResponse updatePaymentMethod( return CustomerUpdatePaymentMethodResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of updatePaymentMethod for customer with params. */ public CompletableFuture updatePaymentMethodAsync( String customerId, CustomerUpdatePaymentMethodParams params) { String path = @@ -558,6 +571,7 @@ public CustomerUpdatePaymentMethodResponse updatePaymentMethod(String customerId return CustomerUpdatePaymentMethodResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of updatePaymentMethod for customer without params. */ public CompletableFuture updatePaymentMethodAsync( String customerId) { String path = @@ -582,6 +596,7 @@ public CustomerRetrieveResponse retrieve(String customerId) throws ChargebeeExce return CustomerRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for customer without params. */ public CompletableFuture retrieveAsync(String customerId) { String path = buildPathWithParams("/customers/{customer-id}", "customer-id", customerId); @@ -615,6 +630,7 @@ public CustomerUpdateResponse update(String customerId, CustomerUpdateParams par return CustomerUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for customer with params. */ public CompletableFuture updateAsync( String customerId, CustomerUpdateParams params) { String path = buildPathWithParams("/customers/{customer-id}", "customer-id", customerId); @@ -628,6 +644,7 @@ public CustomerUpdateResponse update(String customerId) throws ChargebeeExceptio return CustomerUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for customer without params. */ public CompletableFuture updateAsync(String customerId) { String path = buildPathWithParams("/customers/{customer-id}", "customer-id", customerId); @@ -680,6 +697,7 @@ public CustomerListHierarchyDetailResponse listHierarchyDetail(String customerId response.getBodyAsString(), this, null, customerId, response); } + /** Async variant of listHierarchyDetail for customer with params. */ public CompletableFuture listHierarchyDetailAsync( String customerId, CustomerListHierarchyDetailParams params) { String path = @@ -691,6 +709,7 @@ public CompletableFuture listHierarchyDetai response.getBodyAsString(), this, params, customerId, response)); } + /** Async variant of listHierarchyDetail for customer without params. */ public CompletableFuture listHierarchyDetailAsync( String customerId) { String path = @@ -740,6 +759,7 @@ public CustomerChangeBillingDateResponse changeBillingDate( return CustomerChangeBillingDateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of changeBillingDate for customer with params. */ public CompletableFuture changeBillingDateAsync( String customerId, CustomerChangeBillingDateParams params) { String path = @@ -757,6 +777,7 @@ public CustomerChangeBillingDateResponse changeBillingDate(String customerId) return CustomerChangeBillingDateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of changeBillingDate for customer without params. */ public CompletableFuture changeBillingDateAsync( String customerId) { String path = @@ -793,6 +814,7 @@ public CustomerListResponse list(CustomerListParams params) throws ChargebeeExce return CustomerListResponse.fromJson(response.getBodyAsString(), this, params, response); } + /** Async variant of list for customer with params. */ public CompletableFuture listAsync(CustomerListParams params) { return getAsync("/customers", params != null ? params.toQueryParams() : null) @@ -807,6 +829,7 @@ public CustomerListResponse list() throws ChargebeeException { return CustomerListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for customer without params. */ public CompletableFuture listAsync() { return getAsync("/customers", null) @@ -833,6 +856,7 @@ public CustomerCreateResponse create(CustomerCreateParams params) throws Chargeb return CustomerCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for customer with params. */ public CompletableFuture createAsync(CustomerCreateParams params) { return postAsync("/customers", params != null ? params.toFormData() : null) @@ -869,6 +893,7 @@ public CustomerAddContactResponse addContact(String customerId, CustomerAddConta return CustomerAddContactResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of addContact for customer with params. */ public CompletableFuture addContactAsync( String customerId, CustomerAddContactParams params) { String path = @@ -883,6 +908,7 @@ public CustomerAddContactResponse addContact(String customerId) throws Chargebee return CustomerAddContactResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of addContact for customer without params. */ public CompletableFuture addContactAsync(String customerId) { String path = buildPathWithParams("/customers/{customer-id}/add_contact", "customer-id", customerId); @@ -936,6 +962,7 @@ public ContactsForCustomerResponse contactsForCustomer(String customerId) response.getBodyAsString(), this, null, customerId, response); } + /** Async variant of contactsForCustomer for customer with params. */ public CompletableFuture contactsForCustomerAsync( String customerId, ContactsForCustomerParams params) { String path = @@ -947,6 +974,7 @@ public CompletableFuture contactsForCustomerAsync( response.getBodyAsString(), this, params, customerId, response)); } + /** Async variant of contactsForCustomer for customer without params. */ public CompletableFuture contactsForCustomerAsync( String customerId) { String path = @@ -997,6 +1025,7 @@ public CustomerDeductPromotionalCreditsResponse deductPromotionalCredits( return CustomerDeductPromotionalCreditsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of deductPromotionalCredits for customer with params. */ public CompletableFuture deductPromotionalCreditsAsync( String customerId, CustomerDeductPromotionalCreditsParams params) { String path = @@ -1024,6 +1053,7 @@ public CustomerClearPersonalDataResponse clearPersonalData(String customerId) return CustomerClearPersonalDataResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of clearPersonalData for customer without params. */ public CompletableFuture clearPersonalDataAsync( String customerId) { String path = @@ -1054,6 +1084,7 @@ public CustomerMergeResponse merge(CustomerMergeParams params) throws ChargebeeE return CustomerMergeResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of merge for customer with params. */ public CompletableFuture mergeAsync(CustomerMergeParams params) { return postAsync("/customers/merge", params != null ? params.toFormData() : null) @@ -1094,6 +1125,7 @@ public CustomerCollectPaymentResponse collectPayment( return CustomerCollectPaymentResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of collectPayment for customer with params. */ public CompletableFuture collectPaymentAsync( String customerId, CustomerCollectPaymentParams params) { String path = @@ -1110,6 +1142,7 @@ public CustomerCollectPaymentResponse collectPayment(String customerId) return CustomerCollectPaymentResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of collectPayment for customer without params. */ public CompletableFuture collectPaymentAsync(String customerId) { String path = buildPathWithParams("/customers/{customer-id}/collect_payment", "customer-id", customerId); @@ -1158,6 +1191,7 @@ public CustomerRecordExcessPaymentResponse recordExcessPayment( return CustomerRecordExcessPaymentResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of recordExcessPayment for customer with params. */ public CompletableFuture recordExcessPaymentAsync( String customerId, CustomerRecordExcessPaymentParams params) { String path = @@ -1175,6 +1209,7 @@ public CustomerRecordExcessPaymentResponse recordExcessPayment(String customerId return CustomerRecordExcessPaymentResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of recordExcessPayment for customer without params. */ public CompletableFuture recordExcessPaymentAsync( String customerId) { String path = @@ -1226,6 +1261,7 @@ public CustomerSetPromotionalCreditsResponse setPromotionalCredits( return CustomerSetPromotionalCreditsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of setPromotionalCredits for customer with params. */ public CompletableFuture setPromotionalCreditsAsync( String customerId, CustomerSetPromotionalCreditsParams params) { String path = @@ -1271,6 +1307,7 @@ public CustomerUpdateContactResponse updateContact( return CustomerUpdateContactResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of updateContact for customer with params. */ public CompletableFuture updateContactAsync( String customerId, CustomerUpdateContactParams params) { String path = @@ -1286,6 +1323,7 @@ public CustomerUpdateContactResponse updateContact(String customerId) throws Cha return CustomerUpdateContactResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of updateContact for customer without params. */ public CompletableFuture updateContactAsync(String customerId) { String path = buildPathWithParams("/customers/{customer-id}/update_contact", "customer-id", customerId); @@ -1335,6 +1373,7 @@ public CustomerUpdateHierarchySettingsResponse updateHierarchySettings( return CustomerUpdateHierarchySettingsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of updateHierarchySettings for customer with params. */ public CompletableFuture updateHierarchySettingsAsync( String customerId, CustomerUpdateHierarchySettingsParams params) { String path = @@ -1353,6 +1392,7 @@ public CustomerUpdateHierarchySettingsResponse updateHierarchySettings(String cu return CustomerUpdateHierarchySettingsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of updateHierarchySettings for customer without params. */ public CompletableFuture updateHierarchySettingsAsync( String customerId) { String path = @@ -1404,6 +1444,7 @@ public CustomerUpdateBillingInfoResponse updateBillingInfo( return CustomerUpdateBillingInfoResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of updateBillingInfo for customer with params. */ public CompletableFuture updateBillingInfoAsync( String customerId, CustomerUpdateBillingInfoParams params) { String path = @@ -1421,6 +1462,7 @@ public CustomerUpdateBillingInfoResponse updateBillingInfo(String customerId) return CustomerUpdateBillingInfoResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of updateBillingInfo for customer without params. */ public CompletableFuture updateBillingInfoAsync( String customerId) { String path = diff --git a/src/main/java/com/chargebee/v4/services/DifferentialPriceService.java b/src/main/java/com/chargebee/v4/services/DifferentialPriceService.java index eae6ae23..d329924b 100644 --- a/src/main/java/com/chargebee/v4/services/DifferentialPriceService.java +++ b/src/main/java/com/chargebee/v4/services/DifferentialPriceService.java @@ -112,6 +112,7 @@ public DifferentialPriceDeleteResponse delete( return DifferentialPriceDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for differentialPrice with params. */ public CompletableFuture deleteAsync( String differentialPriceId, DifferentialPriceDeleteParams params) { String path = @@ -163,6 +164,7 @@ public DifferentialPriceCreateResponse create( return DifferentialPriceCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for differentialPrice with params. */ public CompletableFuture createAsync( String itemPriceId, DifferentialPriceCreateParams params) { String path = @@ -204,6 +206,7 @@ public DifferentialPriceListResponse list(DifferentialPriceListParams params) response.getBodyAsString(), this, params, response); } + /** Async variant of list for differentialPrice with params. */ public CompletableFuture listAsync( DifferentialPriceListParams params) { @@ -220,6 +223,7 @@ public DifferentialPriceListResponse list() throws ChargebeeException { return DifferentialPriceListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for differentialPrice without params. */ public CompletableFuture listAsync() { return getAsync("/differential_prices", null) @@ -261,6 +265,7 @@ public DifferentialPriceRetrieveResponse retrieve( return DifferentialPriceRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for differentialPrice with params. */ public CompletableFuture retrieveAsync( String differentialPriceId, DifferentialPriceRetrieveParams params) { String path = @@ -280,6 +285,7 @@ public DifferentialPriceRetrieveResponse retrieve(String differentialPriceId) return DifferentialPriceRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for differentialPrice without params. */ public CompletableFuture retrieveAsync( String differentialPriceId) { String path = @@ -338,6 +344,7 @@ public DifferentialPriceUpdateResponse update( return DifferentialPriceUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for differentialPrice with params. */ public CompletableFuture updateAsync( String differentialPriceId, DifferentialPriceUpdateParams params) { String path = diff --git a/src/main/java/com/chargebee/v4/services/EntitlementOverrideService.java b/src/main/java/com/chargebee/v4/services/EntitlementOverrideService.java index c1cf1b96..a614d9a1 100644 --- a/src/main/java/com/chargebee/v4/services/EntitlementOverrideService.java +++ b/src/main/java/com/chargebee/v4/services/EntitlementOverrideService.java @@ -114,6 +114,9 @@ public ListEntitlementOverrideForSubscriptionResponse listEntitlementOverrideFor response.getBodyAsString(), this, null, subscriptionId, response); } + /** + * Async variant of listEntitlementOverrideForSubscription for entitlementOverride with params. + */ public CompletableFuture listEntitlementOverrideForSubscriptionAsync( String subscriptionId, ListEntitlementOverrideForSubscriptionParams params) { @@ -129,6 +132,9 @@ public ListEntitlementOverrideForSubscriptionResponse listEntitlementOverrideFor response.getBodyAsString(), this, params, subscriptionId, response)); } + /** + * Async variant of listEntitlementOverrideForSubscription for entitlementOverride without params. + */ public CompletableFuture listEntitlementOverrideForSubscriptionAsync(String subscriptionId) { String path = @@ -195,6 +201,7 @@ public AddEntitlementOverrideForSubscriptionResponse addEntitlementOverrideForSu response.getBodyAsString(), response); } + /** Async variant of addEntitlementOverrideForSubscription for entitlementOverride with params. */ public CompletableFuture addEntitlementOverrideForSubscriptionAsync( String subscriptionId, AddEntitlementOverrideForSubscriptionParams params) { @@ -217,6 +224,9 @@ public AddEntitlementOverrideForSubscriptionResponse addEntitlementOverrideForSu response.getBodyAsString(), response); } + /** + * Async variant of addEntitlementOverrideForSubscription for entitlementOverride without params. + */ public CompletableFuture addEntitlementOverrideForSubscriptionAsync(String subscriptionId) { String path = diff --git a/src/main/java/com/chargebee/v4/services/EntitlementService.java b/src/main/java/com/chargebee/v4/services/EntitlementService.java index f30f6ee1..661233c4 100644 --- a/src/main/java/com/chargebee/v4/services/EntitlementService.java +++ b/src/main/java/com/chargebee/v4/services/EntitlementService.java @@ -79,6 +79,7 @@ public EntitlementListResponse list(EntitlementListParams params) throws Chargeb return EntitlementListResponse.fromJson(response.getBodyAsString(), this, params, response); } + /** Async variant of list for entitlement with params. */ public CompletableFuture listAsync(EntitlementListParams params) { return getAsync("/entitlements", params != null ? params.toQueryParams() : null) @@ -94,6 +95,7 @@ public EntitlementListResponse list() throws ChargebeeException { return EntitlementListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for entitlement without params. */ public CompletableFuture listAsync() { return getAsync("/entitlements", null) @@ -121,6 +123,7 @@ public EntitlementCreateResponse create(EntitlementCreateParams params) return EntitlementCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for entitlement with params. */ public CompletableFuture createAsync(EntitlementCreateParams params) { return postAsync("/entitlements", params != null ? params.toFormData() : null) diff --git a/src/main/java/com/chargebee/v4/services/EstimateService.java b/src/main/java/com/chargebee/v4/services/EstimateService.java index 121e2c2f..0e9039ec 100644 --- a/src/main/java/com/chargebee/v4/services/EstimateService.java +++ b/src/main/java/com/chargebee/v4/services/EstimateService.java @@ -152,6 +152,7 @@ public RenewalEstimateResponse renewalEstimate( return RenewalEstimateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of renewalEstimate for estimate with params. */ public CompletableFuture renewalEstimateAsync( String subscriptionId, RenewalEstimateParams params) { String path = @@ -167,6 +168,7 @@ public RenewalEstimateResponse renewalEstimate(String subscriptionId) throws Cha return RenewalEstimateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of renewalEstimate for estimate without params. */ public CompletableFuture renewalEstimateAsync(String subscriptionId) { String path = buildPathWithParams( @@ -204,6 +206,7 @@ public CreateSubscriptionItemEstimateResponse createSubscriptionItemEstimate( return CreateSubscriptionItemEstimateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of createSubscriptionItemEstimate for estimate with params. */ public CompletableFuture createSubscriptionItemEstimateAsync(CreateSubscriptionItemEstimateParams params) { @@ -240,6 +243,7 @@ public EstimatePaymentSchedulesResponse paymentSchedules(EstimatePaymentSchedule return EstimatePaymentSchedulesResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of paymentSchedules for estimate with params. */ public CompletableFuture paymentSchedulesAsync( EstimatePaymentSchedulesParams params) { @@ -297,6 +301,7 @@ public EstimateCancelSubscriptionForItemsResponse cancelSubscriptionForItems( response.getBodyAsString(), response); } + /** Async variant of cancelSubscriptionForItems for estimate with params. */ public CompletableFuture cancelSubscriptionForItemsAsync( String subscriptionId, EstimateCancelSubscriptionForItemsParams params) { @@ -319,6 +324,7 @@ public EstimateCancelSubscriptionForItemsResponse cancelSubscriptionForItems( response.getBodyAsString(), response); } + /** Async variant of cancelSubscriptionForItems for estimate without params. */ public CompletableFuture cancelSubscriptionForItemsAsync(String subscriptionId) { String path = @@ -379,6 +385,7 @@ public EstimateResumeSubscriptionResponse resumeSubscription( return EstimateResumeSubscriptionResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of resumeSubscription for estimate with params. */ public CompletableFuture resumeSubscriptionAsync( String subscriptionId, EstimateResumeSubscriptionParams params) { String path = @@ -398,6 +405,7 @@ public EstimateResumeSubscriptionResponse resumeSubscription(String subscription return EstimateResumeSubscriptionResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of resumeSubscription for estimate without params. */ public CompletableFuture resumeSubscriptionAsync( String subscriptionId) { String path = @@ -438,6 +446,7 @@ public EstimateCreateInvoiceForItemsResponse createInvoiceForItems( return EstimateCreateInvoiceForItemsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of createInvoiceForItems for estimate with params. */ public CompletableFuture createInvoiceForItemsAsync( EstimateCreateInvoiceForItemsParams params) { @@ -476,6 +485,7 @@ public EstimateGiftSubscriptionForItemsResponse giftSubscriptionForItems( return EstimateGiftSubscriptionForItemsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of giftSubscriptionForItems for estimate with params. */ public CompletableFuture giftSubscriptionForItemsAsync( EstimateGiftSubscriptionForItemsParams params) { @@ -515,6 +525,7 @@ public EstimateUpdateSubscriptionForItemsResponse updateSubscriptionForItems( response.getBodyAsString(), response); } + /** Async variant of updateSubscriptionForItems for estimate with params. */ public CompletableFuture updateSubscriptionForItemsAsync(EstimateUpdateSubscriptionForItemsParams params) { @@ -541,6 +552,7 @@ public UpcomingInvoicesEstimateResponse upcomingInvoicesEstimate(String customer return UpcomingInvoicesEstimateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of upcomingInvoicesEstimate for estimate without params. */ public CompletableFuture upcomingInvoicesEstimateAsync( String customerId) { String path = @@ -598,6 +610,7 @@ public RegenerateInvoiceEstimateResponse regenerateInvoiceEstimate( return RegenerateInvoiceEstimateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of regenerateInvoiceEstimate for estimate with params. */ public CompletableFuture regenerateInvoiceEstimateAsync( String subscriptionId, RegenerateInvoiceEstimateParams params) { String path = @@ -617,6 +630,7 @@ public RegenerateInvoiceEstimateResponse regenerateInvoiceEstimate(String subscr return RegenerateInvoiceEstimateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of regenerateInvoiceEstimate for estimate without params. */ public CompletableFuture regenerateInvoiceEstimateAsync( String subscriptionId) { String path = @@ -684,6 +698,7 @@ Response createSubscriptionItemForCustomerEstimateRaw(String customerId, String response.getBodyAsString(), response); } + /** Async variant of createSubscriptionItemForCustomerEstimate for estimate with params. */ public CompletableFuture createSubscriptionItemForCustomerEstimateAsync( String customerId, CreateSubscriptionItemForCustomerEstimateParams params) { @@ -706,6 +721,7 @@ Response createSubscriptionItemForCustomerEstimateRaw(String customerId, String response.getBodyAsString(), response); } + /** Async variant of createSubscriptionItemForCustomerEstimate for estimate without params. */ public CompletableFuture createSubscriptionItemForCustomerEstimateAsync(String customerId) { String path = @@ -763,6 +779,7 @@ public EstimateChangeTermEndResponse changeTermEnd( return EstimateChangeTermEndResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of changeTermEnd for estimate with params. */ public CompletableFuture changeTermEndAsync( String subscriptionId, EstimateChangeTermEndParams params) { String path = @@ -821,6 +838,7 @@ public EstimatePauseSubscriptionResponse pauseSubscription( return EstimatePauseSubscriptionResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of pauseSubscription for estimate with params. */ public CompletableFuture pauseSubscriptionAsync( String subscriptionId, EstimatePauseSubscriptionParams params) { String path = @@ -840,6 +858,7 @@ public EstimatePauseSubscriptionResponse pauseSubscription(String subscriptionId return EstimatePauseSubscriptionResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of pauseSubscription for estimate without params. */ public CompletableFuture pauseSubscriptionAsync( String subscriptionId) { String path = @@ -899,6 +918,7 @@ public AdvanceInvoiceEstimateResponse advanceInvoiceEstimate( return AdvanceInvoiceEstimateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of advanceInvoiceEstimate for estimate with params. */ public CompletableFuture advanceInvoiceEstimateAsync( String subscriptionId, AdvanceInvoiceEstimateParams params) { String path = @@ -918,6 +938,7 @@ public AdvanceInvoiceEstimateResponse advanceInvoiceEstimate(String subscription return AdvanceInvoiceEstimateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of advanceInvoiceEstimate for estimate without params. */ public CompletableFuture advanceInvoiceEstimateAsync( String subscriptionId) { String path = @@ -958,6 +979,7 @@ public EstimateUpdateSubscriptionResponse updateSubscription( return EstimateUpdateSubscriptionResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of updateSubscription for estimate with params. */ public CompletableFuture updateSubscriptionAsync( EstimateUpdateSubscriptionParams params) { @@ -992,6 +1014,7 @@ public EstimateGiftSubscriptionResponse giftSubscription(EstimateGiftSubscriptio return EstimateGiftSubscriptionResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of giftSubscription for estimate with params. */ public CompletableFuture giftSubscriptionAsync( EstimateGiftSubscriptionParams params) { @@ -1033,6 +1056,7 @@ public CreateSubscriptionForCustomerEstimateResponse createSubscriptionForCustom response.getBodyAsString(), response); } + /** Async variant of createSubscriptionForCustomerEstimate for estimate with params. */ public CompletableFuture createSubscriptionForCustomerEstimateAsync( String customerId, CreateSubscriptionForCustomerEstimateParams params) { @@ -1053,6 +1077,7 @@ public CreateSubscriptionForCustomerEstimateResponse createSubscriptionForCustom response.getBodyAsString(), response); } + /** Async variant of createSubscriptionForCustomerEstimate for estimate without params. */ public CompletableFuture createSubscriptionForCustomerEstimateAsync(String customerId) { String path = @@ -1092,6 +1117,7 @@ public EstimateCreateSubscriptionResponse createSubscription( return EstimateCreateSubscriptionResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of createSubscription for estimate with params. */ public CompletableFuture createSubscriptionAsync( EstimateCreateSubscriptionParams params) { @@ -1124,6 +1150,7 @@ public EstimateCreateInvoiceResponse createInvoice(EstimateCreateInvoiceParams p return EstimateCreateInvoiceResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of createInvoice for estimate with params. */ public CompletableFuture createInvoiceAsync( EstimateCreateInvoiceParams params) { @@ -1178,6 +1205,7 @@ public EstimateCancelSubscriptionResponse cancelSubscription( return EstimateCancelSubscriptionResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of cancelSubscription for estimate with params. */ public CompletableFuture cancelSubscriptionAsync( String subscriptionId, EstimateCancelSubscriptionParams params) { String path = @@ -1197,6 +1225,7 @@ public EstimateCancelSubscriptionResponse cancelSubscription(String subscription return EstimateCancelSubscriptionResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of cancelSubscription for estimate without params. */ public CompletableFuture cancelSubscriptionAsync( String subscriptionId) { String path = diff --git a/src/main/java/com/chargebee/v4/services/EventService.java b/src/main/java/com/chargebee/v4/services/EventService.java index 491ef2c5..4b2bf31d 100644 --- a/src/main/java/com/chargebee/v4/services/EventService.java +++ b/src/main/java/com/chargebee/v4/services/EventService.java @@ -77,6 +77,7 @@ public EventListResponse list(EventListParams params) throws ChargebeeException return EventListResponse.fromJson(response.getBodyAsString(), this, params, response); } + /** Async variant of list for event with params. */ public CompletableFuture listAsync(EventListParams params) { return getAsync("/events", params != null ? params.toQueryParams() : null) @@ -91,6 +92,7 @@ public EventListResponse list() throws ChargebeeException { return EventListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for event without params. */ public CompletableFuture listAsync() { return getAsync("/events", null) @@ -111,6 +113,7 @@ public EventRetrieveResponse retrieve(String eventId) throws ChargebeeException return EventRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for event without params. */ public CompletableFuture retrieveAsync(String eventId) { String path = buildPathWithParams("/events/{event-id}", "event-id", eventId); diff --git a/src/main/java/com/chargebee/v4/services/ExportService.java b/src/main/java/com/chargebee/v4/services/ExportService.java index 4d1d9067..36d40f88 100644 --- a/src/main/java/com/chargebee/v4/services/ExportService.java +++ b/src/main/java/com/chargebee/v4/services/ExportService.java @@ -135,6 +135,7 @@ public ExportCustomersResponse customers(ExportCustomersParams params) throws Ch return ExportCustomersResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of customers for export with params. */ public CompletableFuture customersAsync(ExportCustomersParams params) { return postAsync("/exports/customers", params != null ? params.toFormData() : null) @@ -165,6 +166,7 @@ public ExportAttachedItemsResponse attachedItems(ExportAttachedItemsParams param return ExportAttachedItemsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of attachedItems for export with params. */ public CompletableFuture attachedItemsAsync( ExportAttachedItemsParams params) { @@ -192,6 +194,7 @@ public ExportTransactionsResponse transactions(ExportTransactionsParams params) return ExportTransactionsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of transactions for export with params. */ public CompletableFuture transactionsAsync( ExportTransactionsParams params) { @@ -225,6 +228,7 @@ public ExportDifferentialPricesResponse differentialPrices(ExportDifferentialPri return ExportDifferentialPricesResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of differentialPrices for export with params. */ public CompletableFuture differentialPricesAsync( ExportDifferentialPricesParams params) { @@ -253,6 +257,7 @@ public ExportItemFamiliesResponse itemFamilies(ExportItemFamiliesParams params) return ExportItemFamiliesResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of itemFamilies for export with params. */ public CompletableFuture itemFamiliesAsync( ExportItemFamiliesParams params) { @@ -279,6 +284,7 @@ public ExportInvoicesResponse invoices(ExportInvoicesParams params) throws Charg return ExportInvoicesResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of invoices for export with params. */ public CompletableFuture invoicesAsync(ExportInvoicesParams params) { return postAsync("/exports/invoices", params != null ? params.toFormData() : null) @@ -298,6 +304,7 @@ public ExportRetrieveResponse retrieve(String exportId) throws ChargebeeExceptio return ExportRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for export without params. */ public CompletableFuture retrieveAsync(String exportId) { String path = buildPathWithParams("/exports/{export-id}", "export-id", exportId); @@ -329,6 +336,7 @@ public ExportPriceVariantsResponse priceVariants(ExportPriceVariantsParams param return ExportPriceVariantsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of priceVariants for export with params. */ public CompletableFuture priceVariantsAsync( ExportPriceVariantsParams params) { @@ -355,6 +363,7 @@ public ExportItemsResponse items(ExportItemsParams params) throws ChargebeeExcep return ExportItemsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of items for export with params. */ public CompletableFuture itemsAsync(ExportItemsParams params) { return postAsync("/exports/items", params != null ? params.toFormData() : null) @@ -384,6 +393,7 @@ public ExportDeferredRevenueResponse deferredRevenue(ExportDeferredRevenueParams return ExportDeferredRevenueResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of deferredRevenue for export with params. */ public CompletableFuture deferredRevenueAsync( ExportDeferredRevenueParams params) { @@ -418,6 +428,7 @@ public ExportRevenueRecognitionResponse revenueRecognition(ExportRevenueRecognit return ExportRevenueRecognitionResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of revenueRecognition for export with params. */ public CompletableFuture revenueRecognitionAsync( ExportRevenueRecognitionParams params) { @@ -446,6 +457,7 @@ public ExportCreditNotesResponse creditNotes(ExportCreditNotesParams params) return ExportCreditNotesResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of creditNotes for export with params. */ public CompletableFuture creditNotesAsync( ExportCreditNotesParams params) { @@ -472,6 +484,7 @@ public ExportCouponsResponse coupons(ExportCouponsParams params) throws Chargebe return ExportCouponsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of coupons for export with params. */ public CompletableFuture couponsAsync(ExportCouponsParams params) { return postAsync("/exports/coupons", params != null ? params.toFormData() : null) @@ -497,6 +510,7 @@ public ExportOrdersResponse orders(ExportOrdersParams params) throws ChargebeeEx return ExportOrdersResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of orders for export with params. */ public CompletableFuture ordersAsync(ExportOrdersParams params) { return postAsync("/exports/orders", params != null ? params.toFormData() : null) @@ -522,6 +536,7 @@ public ExportItemPricesResponse itemPrices(ExportItemPricesParams params) return ExportItemPricesResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of itemPrices for export with params. */ public CompletableFuture itemPricesAsync( ExportItemPricesParams params) { @@ -553,6 +568,7 @@ public ExportSubscriptionsResponse subscriptions(ExportSubscriptionsParams param return ExportSubscriptionsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of subscriptions for export with params. */ public CompletableFuture subscriptionsAsync( ExportSubscriptionsParams params) { @@ -579,6 +595,7 @@ public ExportAddonsResponse addons(ExportAddonsParams params) throws ChargebeeEx return ExportAddonsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of addons for export with params. */ public CompletableFuture addonsAsync(ExportAddonsParams params) { return postAsync("/exports/addons", params != null ? params.toFormData() : null) @@ -603,6 +620,7 @@ public ExportPlansResponse plans(ExportPlansParams params) throws ChargebeeExcep return ExportPlansResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of plans for export with params. */ public CompletableFuture plansAsync(ExportPlansParams params) { return postAsync("/exports/plans", params != null ? params.toFormData() : null) diff --git a/src/main/java/com/chargebee/v4/services/FeatureService.java b/src/main/java/com/chargebee/v4/services/FeatureService.java index 08ac9b2a..a9cfb33d 100644 --- a/src/main/java/com/chargebee/v4/services/FeatureService.java +++ b/src/main/java/com/chargebee/v4/services/FeatureService.java @@ -93,6 +93,7 @@ public FeatureListResponse list(FeatureListParams params) throws ChargebeeExcept return FeatureListResponse.fromJson(response.getBodyAsString(), this, params, response); } + /** Async variant of list for feature with params. */ public CompletableFuture listAsync(FeatureListParams params) { return getAsync("/features", params != null ? params.toQueryParams() : null) @@ -107,6 +108,7 @@ public FeatureListResponse list() throws ChargebeeException { return FeatureListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for feature without params. */ public CompletableFuture listAsync() { return getAsync("/features", null) @@ -133,6 +135,7 @@ public FeatureCreateResponse create(FeatureCreateParams params) throws Chargebee return FeatureCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for feature with params. */ public CompletableFuture createAsync(FeatureCreateParams params) { return postAsync("/features", params != null ? params.toFormData() : null) @@ -152,6 +155,7 @@ public FeatureDeleteResponse delete(String featureId) throws ChargebeeException return FeatureDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for feature without params. */ public CompletableFuture deleteAsync(String featureId) { String path = buildPathWithParams("/features/{feature-id}/delete", "feature-id", featureId); @@ -172,6 +176,7 @@ public FeatureRetrieveResponse retrieve(String featureId) throws ChargebeeExcept return FeatureRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for feature without params. */ public CompletableFuture retrieveAsync(String featureId) { String path = buildPathWithParams("/features/{feature-id}", "feature-id", featureId); @@ -205,6 +210,7 @@ public FeatureUpdateResponse update(String featureId, FeatureUpdateParams params return FeatureUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for feature with params. */ public CompletableFuture updateAsync( String featureId, FeatureUpdateParams params) { String path = buildPathWithParams("/features/{feature-id}", "feature-id", featureId); @@ -218,6 +224,7 @@ public FeatureUpdateResponse update(String featureId) throws ChargebeeException return FeatureUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for feature without params. */ public CompletableFuture updateAsync(String featureId) { String path = buildPathWithParams("/features/{feature-id}", "feature-id", featureId); @@ -239,6 +246,7 @@ public FeatureArchiveResponse archive(String featureId) throws ChargebeeExceptio return FeatureArchiveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of archive for feature without params. */ public CompletableFuture archiveAsync(String featureId) { String path = buildPathWithParams("/features/{feature-id}/archive_command", "feature-id", featureId); @@ -261,6 +269,7 @@ public FeatureActivateResponse activate(String featureId) throws ChargebeeExcept return FeatureActivateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of activate for feature without params. */ public CompletableFuture activateAsync(String featureId) { String path = buildPathWithParams("/features/{feature-id}/activate_command", "feature-id", featureId); @@ -283,6 +292,7 @@ public FeatureReactivateResponse reactivate(String featureId) throws ChargebeeEx return FeatureReactivateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of reactivate for feature without params. */ public CompletableFuture reactivateAsync(String featureId) { String path = buildPathWithParams("/features/{feature-id}/reactivate_command", "feature-id", featureId); diff --git a/src/main/java/com/chargebee/v4/services/FullExportService.java b/src/main/java/com/chargebee/v4/services/FullExportService.java index 59c40bfd..52b245db 100644 --- a/src/main/java/com/chargebee/v4/services/FullExportService.java +++ b/src/main/java/com/chargebee/v4/services/FullExportService.java @@ -69,6 +69,7 @@ public FullExportStatusResponse status(FullExportStatusParams params) throws Cha return FullExportStatusResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of status for fullExport with params. */ public CompletableFuture statusAsync(FullExportStatusParams params) { return getAsync("/full_exports/status", params != null ? params.toQueryParams() : null) diff --git a/src/main/java/com/chargebee/v4/services/GiftService.java b/src/main/java/com/chargebee/v4/services/GiftService.java index 849648ac..47c1f3cc 100644 --- a/src/main/java/com/chargebee/v4/services/GiftService.java +++ b/src/main/java/com/chargebee/v4/services/GiftService.java @@ -88,6 +88,7 @@ public GiftCreateForItemsResponse createForItems(GiftCreateForItemsParams params return GiftCreateForItemsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of createForItems for gift with params. */ public CompletableFuture createForItemsAsync( GiftCreateForItemsParams params) { @@ -108,6 +109,7 @@ public GiftCancelResponse cancel(String giftId) throws ChargebeeException { return GiftCancelResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of cancel for gift without params. */ public CompletableFuture cancelAsync(String giftId) { String path = buildPathWithParams("/gifts/{gift-id}/cancel", "gift-id", giftId); @@ -140,6 +142,7 @@ public UpdateGiftResponse updateGift(String giftId, UpdateGiftParams params) return UpdateGiftResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of updateGift for gift with params. */ public CompletableFuture updateGiftAsync( String giftId, UpdateGiftParams params) { String path = buildPathWithParams("/gifts/{gift-id}/update_gift", "gift-id", giftId); @@ -171,6 +174,7 @@ public GiftListResponse list(GiftListParams params) throws ChargebeeException { return GiftListResponse.fromJson(response.getBodyAsString(), this, params, response); } + /** Async variant of list for gift with params. */ public CompletableFuture listAsync(GiftListParams params) { return getAsync("/gifts", params != null ? params.toQueryParams() : null) @@ -185,6 +189,7 @@ public GiftListResponse list() throws ChargebeeException { return GiftListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for gift without params. */ public CompletableFuture listAsync() { return getAsync("/gifts", null) @@ -211,6 +216,7 @@ public GiftCreateResponse create(GiftCreateParams params) throws ChargebeeExcept return GiftCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for gift with params. */ public CompletableFuture createAsync(GiftCreateParams params) { return postAsync("/gifts", params != null ? params.toFormData() : null) @@ -229,6 +235,7 @@ public GiftRetrieveResponse retrieve(String giftId) throws ChargebeeException { return GiftRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for gift without params. */ public CompletableFuture retrieveAsync(String giftId) { String path = buildPathWithParams("/gifts/{gift-id}", "gift-id", giftId); @@ -248,6 +255,7 @@ public GiftClaimResponse claim(String giftId) throws ChargebeeException { return GiftClaimResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of claim for gift without params. */ public CompletableFuture claimAsync(String giftId) { String path = buildPathWithParams("/gifts/{gift-id}/claim", "gift-id", giftId); diff --git a/src/main/java/com/chargebee/v4/services/HostedPageService.java b/src/main/java/com/chargebee/v4/services/HostedPageService.java index f5e9e6e4..a0276403 100644 --- a/src/main/java/com/chargebee/v4/services/HostedPageService.java +++ b/src/main/java/com/chargebee/v4/services/HostedPageService.java @@ -158,6 +158,7 @@ public HostedPageCheckoutOneTimeForItemsResponse checkoutOneTimeForItems( return HostedPageCheckoutOneTimeForItemsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of checkoutOneTimeForItems for hostedPage with params. */ public CompletableFuture checkoutOneTimeForItemsAsync( HostedPageCheckoutOneTimeForItemsParams params) { @@ -196,6 +197,7 @@ public HostedPageUpdatePaymentMethodResponse updatePaymentMethod( return HostedPageUpdatePaymentMethodResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of updatePaymentMethod for hostedPage with params. */ public CompletableFuture updatePaymentMethodAsync( HostedPageUpdatePaymentMethodParams params) { @@ -230,6 +232,7 @@ public HostedPageUpdateCardResponse updateCard(HostedPageUpdateCardParams params return HostedPageUpdateCardResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of updateCard for hostedPage with params. */ public CompletableFuture updateCardAsync( HostedPageUpdateCardParams params) { @@ -265,6 +268,7 @@ public HostedPageExtendSubscriptionResponse extendSubscription( return HostedPageExtendSubscriptionResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of extendSubscription for hostedPage with params. */ public CompletableFuture extendSubscriptionAsync( HostedPageExtendSubscriptionParams params) { @@ -294,6 +298,7 @@ public HostedPageEventsResponse events(HostedPageEventsParams params) throws Cha return HostedPageEventsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of events for hostedPage with params. */ public CompletableFuture eventsAsync(HostedPageEventsParams params) { return postAsync("/hosted_pages/events", params != null ? params.toFormData() : null) @@ -328,6 +333,7 @@ public HostedPageCheckoutGiftForItemsResponse checkoutGiftForItems( return HostedPageCheckoutGiftForItemsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of checkoutGiftForItems for hostedPage with params. */ public CompletableFuture checkoutGiftForItemsAsync( HostedPageCheckoutGiftForItemsParams params) { @@ -363,6 +369,7 @@ public HostedPageListResponse list(HostedPageListParams params) throws Chargebee return HostedPageListResponse.fromJson(response.getBodyAsString(), this, params, response); } + /** Async variant of list for hostedPage with params. */ public CompletableFuture listAsync(HostedPageListParams params) { return getAsync("/hosted_pages", params != null ? params.toQueryParams() : null) @@ -378,6 +385,7 @@ public HostedPageListResponse list() throws ChargebeeException { return HostedPageListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for hostedPage without params. */ public CompletableFuture listAsync() { return getAsync("/hosted_pages", null) @@ -409,6 +417,7 @@ public HostedPageViewVoucherResponse viewVoucher(HostedPageViewVoucherParams par return HostedPageViewVoucherResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of viewVoucher for hostedPage with params. */ public CompletableFuture viewVoucherAsync( HostedPageViewVoucherParams params) { @@ -441,6 +450,7 @@ public HostedPageCollectNowResponse collectNow(HostedPageCollectNowParams params return HostedPageCollectNowResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of collectNow for hostedPage with params. */ public CompletableFuture collectNowAsync( HostedPageCollectNowParams params) { @@ -473,6 +483,7 @@ public HostedPageAcceptQuoteResponse acceptQuote(HostedPageAcceptQuoteParams par return HostedPageAcceptQuoteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of acceptQuote for hostedPage with params. */ public CompletableFuture acceptQuoteAsync( HostedPageAcceptQuoteParams params) { @@ -509,6 +520,7 @@ public HostedPageCheckoutNewForItemsResponse checkoutNewForItems( return HostedPageCheckoutNewForItemsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of checkoutNewForItems for hostedPage with params. */ public CompletableFuture checkoutNewForItemsAsync( HostedPageCheckoutNewForItemsParams params) { @@ -543,6 +555,7 @@ public HostedPageClaimGiftResponse claimGift(HostedPageClaimGiftParams params) return HostedPageClaimGiftResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of claimGift for hostedPage with params. */ public CompletableFuture claimGiftAsync( HostedPageClaimGiftParams params) { @@ -579,6 +592,7 @@ public HostedPageCheckoutExistingForItemsResponse checkoutExistingForItems( response.getBodyAsString(), response); } + /** Async variant of checkoutExistingForItems for hostedPage with params. */ public CompletableFuture checkoutExistingForItemsAsync(HostedPageCheckoutExistingForItemsParams params) { @@ -614,6 +628,7 @@ public HostedPagePreCancelResponse preCancel(HostedPagePreCancelParams params) return HostedPagePreCancelResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of preCancel for hostedPage with params. */ public CompletableFuture preCancelAsync( HostedPagePreCancelParams params) { @@ -636,6 +651,7 @@ public HostedPageAcknowledgeResponse acknowledge(String hostedPageId) throws Cha return HostedPageAcknowledgeResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of acknowledge for hostedPage without params. */ public CompletableFuture acknowledgeAsync(String hostedPageId) { String path = buildPathWithParams( @@ -674,6 +690,7 @@ public HostedPageRetrieveAgreementPdfResponse retrieveAgreementPdf( return HostedPageRetrieveAgreementPdfResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieveAgreementPdf for hostedPage with params. */ public CompletableFuture retrieveAgreementPdfAsync( HostedPageRetrieveAgreementPdfParams params) { @@ -698,6 +715,7 @@ public HostedPageRetrieveResponse retrieve(String hostedPageId) throws Chargebee return HostedPageRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for hostedPage without params. */ public CompletableFuture retrieveAsync(String hostedPageId) { String path = buildPathWithParams("/hosted_pages/{hosted-page-id}", "hosted-page-id", hostedPageId); @@ -734,6 +752,7 @@ public HostedPageManagePaymentSourcesResponse managePaymentSources( return HostedPageManagePaymentSourcesResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of managePaymentSources for hostedPage with params. */ public CompletableFuture managePaymentSourcesAsync( HostedPageManagePaymentSourcesParams params) { @@ -770,6 +789,7 @@ public HostedPageCheckoutOneTimeResponse checkoutOneTime(HostedPageCheckoutOneTi return HostedPageCheckoutOneTimeResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of checkoutOneTime for hostedPage with params. */ public CompletableFuture checkoutOneTimeAsync( HostedPageCheckoutOneTimeParams params) { @@ -802,6 +822,7 @@ public HostedPageCheckoutNewResponse checkoutNew(HostedPageCheckoutNewParams par return HostedPageCheckoutNewResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of checkoutNew for hostedPage with params. */ public CompletableFuture checkoutNewAsync( HostedPageCheckoutNewParams params) { @@ -834,6 +855,7 @@ public HostedPageCheckoutGiftResponse checkoutGift(HostedPageCheckoutGiftParams return HostedPageCheckoutGiftResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of checkoutGift for hostedPage with params. */ public CompletableFuture checkoutGiftAsync( HostedPageCheckoutGiftParams params) { @@ -868,6 +890,7 @@ public HostedPageCheckoutExistingResponse checkoutExisting( return HostedPageCheckoutExistingResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of checkoutExisting for hostedPage with params. */ public CompletableFuture checkoutExistingAsync( HostedPageCheckoutExistingParams params) { diff --git a/src/main/java/com/chargebee/v4/services/InAppSubscriptionService.java b/src/main/java/com/chargebee/v4/services/InAppSubscriptionService.java index 8db6ebdb..2c34f416 100644 --- a/src/main/java/com/chargebee/v4/services/InAppSubscriptionService.java +++ b/src/main/java/com/chargebee/v4/services/InAppSubscriptionService.java @@ -114,6 +114,7 @@ public InAppSubscriptionRetrieveStoreSubscriptionsResponse retrieveStoreSubscrip response.getBodyAsString(), response); } + /** Async variant of retrieveStoreSubscriptions for inAppSubscription with params. */ public CompletableFuture retrieveStoreSubscriptionsAsync( String inAppSubscriptionAppId, InAppSubscriptionRetrieveStoreSubscriptionsParams params) { @@ -176,6 +177,7 @@ public InAppSubscriptionImportReceiptResponse importReceipt( return InAppSubscriptionImportReceiptResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of importReceipt for inAppSubscription with params. */ public CompletableFuture importReceiptAsync( String inAppSubscriptionAppId, InAppSubscriptionImportReceiptParams params) { String path = @@ -238,6 +240,7 @@ public InAppSubscriptionImportSubscriptionResponse importSubscription( response.getBodyAsString(), response); } + /** Async variant of importSubscription for inAppSubscription with params. */ public CompletableFuture importSubscriptionAsync( String inAppSubscriptionAppId, InAppSubscriptionImportSubscriptionParams params) { String path = @@ -259,6 +262,7 @@ public InAppSubscriptionImportSubscriptionResponse importSubscription( response.getBodyAsString(), response); } + /** Async variant of importSubscription for inAppSubscription without params. */ public CompletableFuture importSubscriptionAsync( String inAppSubscriptionAppId) { String path = @@ -321,6 +325,7 @@ public InAppSubscriptionProcessReceiptResponse processReceipt( return InAppSubscriptionProcessReceiptResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of processReceipt for inAppSubscription with params. */ public CompletableFuture processReceiptAsync( String inAppSubscriptionAppId, InAppSubscriptionProcessReceiptParams params) { String path = diff --git a/src/main/java/com/chargebee/v4/services/InvoiceService.java b/src/main/java/com/chargebee/v4/services/InvoiceService.java index edb3d86d..7f09dc8d 100644 --- a/src/main/java/com/chargebee/v4/services/InvoiceService.java +++ b/src/main/java/com/chargebee/v4/services/InvoiceService.java @@ -234,6 +234,7 @@ public InvoiceDeleteLineItemsResponse deleteLineItems( return InvoiceDeleteLineItemsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of deleteLineItems for invoice with params. */ public CompletableFuture deleteLineItemsAsync( String invoiceId, InvoiceDeleteLineItemsParams params) { String path = @@ -250,6 +251,7 @@ public InvoiceDeleteLineItemsResponse deleteLineItems(String invoiceId) return InvoiceDeleteLineItemsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of deleteLineItems for invoice without params. */ public CompletableFuture deleteLineItemsAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/delete_line_items", "invoice-id", invoiceId); @@ -295,6 +297,7 @@ public InvoiceRemoveCreditNoteResponse removeCreditNote( return InvoiceRemoveCreditNoteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of removeCreditNote for invoice with params. */ public CompletableFuture removeCreditNoteAsync( String invoiceId, InvoiceRemoveCreditNoteParams params) { String path = @@ -311,6 +314,7 @@ public InvoiceRemoveCreditNoteResponse removeCreditNote(String invoiceId) return InvoiceRemoveCreditNoteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of removeCreditNote for invoice without params. */ public CompletableFuture removeCreditNoteAsync( String invoiceId) { String path = @@ -355,6 +359,7 @@ public InvoiceRemovePaymentResponse removePayment( return InvoiceRemovePaymentResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of removePayment for invoice with params. */ public CompletableFuture removePaymentAsync( String invoiceId, InvoiceRemovePaymentParams params) { String path = @@ -370,6 +375,7 @@ public InvoiceRemovePaymentResponse removePayment(String invoiceId) throws Charg return InvoiceRemovePaymentResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of removePayment for invoice without params. */ public CompletableFuture removePaymentAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/remove_payment", "invoice-id", invoiceId); @@ -409,6 +415,7 @@ public InvoiceStopDunningResponse stopDunning(String invoiceId, InvoiceStopDunni return InvoiceStopDunningResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of stopDunning for invoice with params. */ public CompletableFuture stopDunningAsync( String invoiceId, InvoiceStopDunningParams params) { String path = @@ -423,6 +430,7 @@ public InvoiceStopDunningResponse stopDunning(String invoiceId) throws Chargebee return InvoiceStopDunningResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of stopDunning for invoice without params. */ public CompletableFuture stopDunningAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/stop_dunning", "invoice-id", invoiceId); @@ -465,6 +473,7 @@ public InvoiceApplyPaymentsResponse applyPayments( return InvoiceApplyPaymentsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of applyPayments for invoice with params. */ public CompletableFuture applyPaymentsAsync( String invoiceId, InvoiceApplyPaymentsParams params) { String path = @@ -480,6 +489,7 @@ public InvoiceApplyPaymentsResponse applyPayments(String invoiceId) throws Charg return InvoiceApplyPaymentsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of applyPayments for invoice without params. */ public CompletableFuture applyPaymentsAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/apply_payments", "invoice-id", invoiceId); @@ -529,6 +539,7 @@ public InvoiceApplyPaymentScheduleSchemeResponse applyPaymentScheduleScheme( return InvoiceApplyPaymentScheduleSchemeResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of applyPaymentScheduleScheme for invoice with params. */ public CompletableFuture applyPaymentScheduleSchemeAsync( String invoiceId, InvoiceApplyPaymentScheduleSchemeParams params) { @@ -567,6 +578,7 @@ public VoidInvoiceResponse voidInvoice(String invoiceId, VoidInvoiceParams param return VoidInvoiceResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of voidInvoice for invoice with params. */ public CompletableFuture voidInvoiceAsync( String invoiceId, VoidInvoiceParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/void", "invoice-id", invoiceId); @@ -579,6 +591,7 @@ public VoidInvoiceResponse voidInvoice(String invoiceId) throws ChargebeeExcepti return VoidInvoiceResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of voidInvoice for invoice without params. */ public CompletableFuture voidInvoiceAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/void", "invoice-id", invoiceId); @@ -611,6 +624,7 @@ public InvoiceAddChargeResponse addCharge(String invoiceId, InvoiceAddChargePara return InvoiceAddChargeResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of addCharge for invoice with params. */ public CompletableFuture addChargeAsync( String invoiceId, InvoiceAddChargeParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/add_charge", "invoice-id", invoiceId); @@ -632,6 +646,7 @@ public SendEinvoiceResponse sendEinvoice(String invoiceId) throws ChargebeeExcep return SendEinvoiceResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of sendEinvoice for invoice without params. */ public CompletableFuture sendEinvoiceAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/send_einvoice", "invoice-id", invoiceId); @@ -654,6 +669,7 @@ public InvoicePaymentSchedulesResponse paymentSchedules(String invoiceId) return InvoicePaymentSchedulesResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of paymentSchedules for invoice without params. */ public CompletableFuture paymentSchedulesAsync( String invoiceId) { String path = @@ -690,6 +706,7 @@ public InvoiceWriteOffResponse writeOff(String invoiceId, InvoiceWriteOffParams return InvoiceWriteOffResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of writeOff for invoice with params. */ public CompletableFuture writeOffAsync( String invoiceId, InvoiceWriteOffParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/write_off", "invoice-id", invoiceId); @@ -703,6 +720,7 @@ public InvoiceWriteOffResponse writeOff(String invoiceId) throws ChargebeeExcept return InvoiceWriteOffResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of writeOff for invoice without params. */ public CompletableFuture writeOffAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/write_off", "invoice-id", invoiceId); @@ -744,6 +762,7 @@ public InvoiceAddChargeItemResponse addChargeItem( return InvoiceAddChargeItemResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of addChargeItem for invoice with params. */ public CompletableFuture addChargeItemAsync( String invoiceId, InvoiceAddChargeItemParams params) { String path = @@ -759,6 +778,7 @@ public InvoiceAddChargeItemResponse addChargeItem(String invoiceId) throws Charg return InvoiceAddChargeItemResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of addChargeItem for invoice without params. */ public CompletableFuture addChargeItemAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/add_charge_item", "invoice-id", invoiceId); @@ -802,6 +822,7 @@ public InvoicePauseDunningResponse pauseDunning( return InvoicePauseDunningResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of pauseDunning for invoice with params. */ public CompletableFuture pauseDunningAsync( String invoiceId, InvoicePauseDunningParams params) { String path = @@ -835,6 +856,7 @@ public InvoiceListResponse list(InvoiceListParams params) throws ChargebeeExcept return InvoiceListResponse.fromJson(response.getBodyAsString(), this, params, response); } + /** Async variant of list for invoice with params. */ public CompletableFuture listAsync(InvoiceListParams params) { return getAsync("/invoices", params != null ? params.toQueryParams() : null) @@ -849,6 +871,7 @@ public InvoiceListResponse list() throws ChargebeeException { return InvoiceListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for invoice without params. */ public CompletableFuture listAsync() { return getAsync("/invoices", null) @@ -875,6 +898,7 @@ public InvoiceCreateResponse create(InvoiceCreateParams params) throws Chargebee return InvoiceCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for invoice with params. */ public CompletableFuture createAsync(InvoiceCreateParams params) { return postAsync("/invoices", params != null ? params.toFormData() : null) @@ -907,6 +931,7 @@ public InvoiceCloseResponse close(String invoiceId, InvoiceCloseParams params) return InvoiceCloseResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of close for invoice with params. */ public CompletableFuture closeAsync( String invoiceId, InvoiceCloseParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/close", "invoice-id", invoiceId); @@ -919,6 +944,7 @@ public InvoiceCloseResponse close(String invoiceId) throws ChargebeeException { return InvoiceCloseResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of close for invoice without params. */ public CompletableFuture closeAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/close", "invoice-id", invoiceId); @@ -959,6 +985,7 @@ public InvoiceApplyCreditsResponse applyCredits( return InvoiceApplyCreditsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of applyCredits for invoice with params. */ public CompletableFuture applyCreditsAsync( String invoiceId, InvoiceApplyCreditsParams params) { String path = @@ -973,6 +1000,7 @@ public InvoiceApplyCreditsResponse applyCredits(String invoiceId) throws Chargeb return InvoiceApplyCreditsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of applyCredits for invoice without params. */ public CompletableFuture applyCreditsAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/apply_credits", "invoice-id", invoiceId); @@ -1001,6 +1029,7 @@ public InvoiceRetrieveResponse retrieve(String invoiceId, InvoiceRetrieveParams return InvoiceRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for invoice with params. */ public CompletableFuture retrieveAsync( String invoiceId, InvoiceRetrieveParams params) { String path = buildPathWithParams("/invoices/{invoice-id}", "invoice-id", invoiceId); @@ -1014,6 +1043,7 @@ public InvoiceRetrieveResponse retrieve(String invoiceId) throws ChargebeeExcept return InvoiceRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for invoice without params. */ public CompletableFuture retrieveAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}", "invoice-id", invoiceId); @@ -1048,6 +1078,7 @@ public InvoiceCreateForChargeItemResponse createForChargeItem( return InvoiceCreateForChargeItemResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of createForChargeItem for invoice with params. */ public CompletableFuture createForChargeItemAsync( InvoiceCreateForChargeItemParams params) { @@ -1087,6 +1118,7 @@ public InvoiceCreateForChargeItemsAndChargesResponse createForChargeItemsAndChar response.getBodyAsString(), response); } + /** Async variant of createForChargeItemsAndCharges for invoice with params. */ public CompletableFuture createForChargeItemsAndChargesAsync(InvoiceCreateForChargeItemsAndChargesParams params) { @@ -1132,6 +1164,7 @@ public InvoiceDeleteImportedResponse deleteImported( return InvoiceDeleteImportedResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of deleteImported for invoice with params. */ public CompletableFuture deleteImportedAsync( String invoiceId, InvoiceDeleteImportedParams params) { String path = @@ -1147,6 +1180,7 @@ public InvoiceDeleteImportedResponse deleteImported(String invoiceId) throws Cha return InvoiceDeleteImportedResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of deleteImported for invoice without params. */ public CompletableFuture deleteImportedAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/delete_imported", "invoice-id", invoiceId); @@ -1190,6 +1224,7 @@ public InvoiceUpdateDetailsResponse updateDetails( return InvoiceUpdateDetailsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of updateDetails for invoice with params. */ public CompletableFuture updateDetailsAsync( String invoiceId, InvoiceUpdateDetailsParams params) { String path = @@ -1205,6 +1240,7 @@ public InvoiceUpdateDetailsResponse updateDetails(String invoiceId) throws Charg return InvoiceUpdateDetailsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of updateDetails for invoice without params. */ public CompletableFuture updateDetailsAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/update_details", "invoice-id", invoiceId); @@ -1257,6 +1293,7 @@ public InvoicesForCustomerResponse invoicesForCustomer(String customerId) response.getBodyAsString(), this, null, customerId, response); } + /** Async variant of invoicesForCustomer for invoice with params. */ public CompletableFuture invoicesForCustomerAsync( String customerId, InvoicesForCustomerParams params) { String path = @@ -1268,6 +1305,7 @@ public CompletableFuture invoicesForCustomerAsync( response.getBodyAsString(), this, params, customerId, response)); } + /** Async variant of invoicesForCustomer for invoice without params. */ public CompletableFuture invoicesForCustomerAsync( String customerId) { String path = @@ -1312,6 +1350,7 @@ public InvoiceRecordPaymentResponse recordPayment( return InvoiceRecordPaymentResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of recordPayment for invoice with params. */ public CompletableFuture recordPaymentAsync( String invoiceId, InvoiceRecordPaymentParams params) { String path = @@ -1327,6 +1366,7 @@ public InvoiceRecordPaymentResponse recordPayment(String invoiceId) throws Charg return InvoiceRecordPaymentResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of recordPayment for invoice without params. */ public CompletableFuture recordPaymentAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/record_payment", "invoice-id", invoiceId); @@ -1362,6 +1402,7 @@ public InvoiceDeleteResponse delete(String invoiceId, InvoiceDeleteParams params return InvoiceDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for invoice with params. */ public CompletableFuture deleteAsync( String invoiceId, InvoiceDeleteParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/delete", "invoice-id", invoiceId); @@ -1375,6 +1416,7 @@ public InvoiceDeleteResponse delete(String invoiceId) throws ChargebeeException return InvoiceDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for invoice without params. */ public CompletableFuture deleteAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/delete", "invoice-id", invoiceId); @@ -1405,6 +1447,7 @@ public ImportInvoiceResponse importInvoice(ImportInvoiceParams params) throws Ch return ImportInvoiceResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of importInvoice for invoice with params. */ public CompletableFuture importInvoiceAsync(ImportInvoiceParams params) { return postAsync("/invoices/import_invoice", params != null ? params.toFormData() : null) @@ -1445,6 +1488,7 @@ public InvoiceResumeDunningResponse resumeDunning( return InvoiceResumeDunningResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of resumeDunning for invoice with params. */ public CompletableFuture resumeDunningAsync( String invoiceId, InvoiceResumeDunningParams params) { String path = @@ -1460,6 +1504,7 @@ public InvoiceResumeDunningResponse resumeDunning(String invoiceId) throws Charg return InvoiceResumeDunningResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of resumeDunning for invoice without params. */ public CompletableFuture resumeDunningAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/resume_dunning", "invoice-id", invoiceId); @@ -1505,6 +1550,7 @@ public InvoiceRecordTaxWithheldResponse recordTaxWithheld( return InvoiceRecordTaxWithheldResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of recordTaxWithheld for invoice with params. */ public CompletableFuture recordTaxWithheldAsync( String invoiceId, InvoiceRecordTaxWithheldParams params) { String path = @@ -1521,6 +1567,7 @@ public InvoiceRecordTaxWithheldResponse recordTaxWithheld(String invoiceId) return InvoiceRecordTaxWithheldResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of recordTaxWithheld for invoice without params. */ public CompletableFuture recordTaxWithheldAsync( String invoiceId) { String path = @@ -1545,6 +1592,7 @@ public ResendEinvoiceResponse resendEinvoice(String invoiceId) throws ChargebeeE return ResendEinvoiceResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of resendEinvoice for invoice without params. */ public CompletableFuture resendEinvoiceAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/resend_einvoice", "invoice-id", invoiceId); @@ -1589,6 +1637,7 @@ public InvoiceRemoveTaxWithheldResponse removeTaxWithheld( return InvoiceRemoveTaxWithheldResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of removeTaxWithheld for invoice with params. */ public CompletableFuture removeTaxWithheldAsync( String invoiceId, InvoiceRemoveTaxWithheldParams params) { String path = @@ -1605,6 +1654,7 @@ public InvoiceRemoveTaxWithheldResponse removeTaxWithheld(String invoiceId) return InvoiceRemoveTaxWithheldResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of removeTaxWithheld for invoice without params. */ public CompletableFuture removeTaxWithheldAsync( String invoiceId) { String path = @@ -1653,6 +1703,7 @@ public InvoiceListPaymentReferenceNumbersResponse listPaymentReferenceNumbers( response.getBodyAsString(), this, params, response); } + /** Async variant of listPaymentReferenceNumbers for invoice with params. */ public CompletableFuture listPaymentReferenceNumbersAsync(InvoiceListPaymentReferenceNumbersParams params) { @@ -1672,6 +1723,7 @@ public InvoiceListPaymentReferenceNumbersResponse listPaymentReferenceNumbers() response.getBodyAsString(), this, null, response); } + /** Async variant of listPaymentReferenceNumbers for invoice without params. */ public CompletableFuture listPaymentReferenceNumbersAsync() { @@ -1715,6 +1767,7 @@ public InvoiceCollectPaymentResponse collectPayment( return InvoiceCollectPaymentResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of collectPayment for invoice with params. */ public CompletableFuture collectPaymentAsync( String invoiceId, InvoiceCollectPaymentParams params) { String path = @@ -1730,6 +1783,7 @@ public InvoiceCollectPaymentResponse collectPayment(String invoiceId) throws Cha return InvoiceCollectPaymentResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of collectPayment for invoice without params. */ public CompletableFuture collectPaymentAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/collect_payment", "invoice-id", invoiceId); @@ -1753,6 +1807,7 @@ public InvoiceSyncUsagesResponse syncUsages(String invoiceId) throws ChargebeeEx return InvoiceSyncUsagesResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of syncUsages for invoice without params. */ public CompletableFuture syncUsagesAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/sync_usages", "invoice-id", invoiceId); @@ -1787,6 +1842,7 @@ public InvoiceRefundResponse refund(String invoiceId, InvoiceRefundParams params return InvoiceRefundResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of refund for invoice with params. */ public CompletableFuture refundAsync( String invoiceId, InvoiceRefundParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/refund", "invoice-id", invoiceId); @@ -1800,6 +1856,7 @@ public InvoiceRefundResponse refund(String invoiceId) throws ChargebeeException return InvoiceRefundResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of refund for invoice without params. */ public CompletableFuture refundAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/refund", "invoice-id", invoiceId); @@ -1841,6 +1898,7 @@ public InvoiceRecordRefundResponse recordRefund( return InvoiceRecordRefundResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of recordRefund for invoice with params. */ public CompletableFuture recordRefundAsync( String invoiceId, InvoiceRecordRefundParams params) { String path = @@ -1855,6 +1913,7 @@ public InvoiceRecordRefundResponse recordRefund(String invoiceId) throws Chargeb return InvoiceRecordRefundResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of recordRefund for invoice without params. */ public CompletableFuture recordRefundAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/record_refund", "invoice-id", invoiceId); @@ -1889,6 +1948,7 @@ public InvoicePdfResponse pdf(String invoiceId, InvoicePdfParams params) return InvoicePdfResponse.fromJson(response.getBodyAsString(), response); } + /** 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()) @@ -1900,6 +1960,7 @@ public InvoicePdfResponse pdf(String invoiceId) throws ChargebeeException { return InvoicePdfResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of pdf for invoice without params. */ public CompletableFuture pdfAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/pdf", "invoice-id", invoiceId); @@ -1955,6 +2016,7 @@ public InvoicesForSubscriptionResponse invoicesForSubscription(String subscripti response.getBodyAsString(), this, null, subscriptionId, response); } + /** Async variant of invoicesForSubscription for invoice with params. */ public CompletableFuture invoicesForSubscriptionAsync( String subscriptionId, InvoicesForSubscriptionParams params) { String path = @@ -1967,6 +2029,7 @@ public CompletableFuture invoicesForSubscriptio response.getBodyAsString(), this, params, subscriptionId, response)); } + /** Async variant of invoicesForSubscription for invoice without params. */ public CompletableFuture invoicesForSubscriptionAsync( String subscriptionId) { String path = @@ -1992,6 +2055,7 @@ public DownloadEinvoiceResponse downloadEinvoice(String invoiceId) throws Charge return DownloadEinvoiceResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of downloadEinvoice for invoice without params. */ public CompletableFuture downloadEinvoiceAsync(String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/download_einvoice", "invoice-id", invoiceId); @@ -2020,6 +2084,7 @@ public InvoiceChargeAddonResponse chargeAddon(InvoiceChargeAddonParams params) return InvoiceChargeAddonResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of chargeAddon for invoice with params. */ public CompletableFuture chargeAddonAsync( InvoiceChargeAddonParams params) { @@ -2061,6 +2126,7 @@ public InvoiceAddAddonChargeResponse addAddonCharge( return InvoiceAddAddonChargeResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of addAddonCharge for invoice with params. */ public CompletableFuture addAddonChargeAsync( String invoiceId, InvoiceAddAddonChargeParams params) { String path = @@ -2089,6 +2155,7 @@ public InvoiceChargeResponse charge(InvoiceChargeParams params) throws Chargebee return InvoiceChargeResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of charge for invoice with params. */ public CompletableFuture chargeAsync(InvoiceChargeParams params) { return postAsync("/invoices/charge", params != null ? params.toFormData() : null) diff --git a/src/main/java/com/chargebee/v4/services/ItemEntitlementService.java b/src/main/java/com/chargebee/v4/services/ItemEntitlementService.java index 07db88b3..aba621e5 100644 --- a/src/main/java/com/chargebee/v4/services/ItemEntitlementService.java +++ b/src/main/java/com/chargebee/v4/services/ItemEntitlementService.java @@ -110,6 +110,7 @@ public ItemEntitlementsForFeatureResponse itemEntitlementsForFeature(String feat response.getBodyAsString(), this, null, featureId, response); } + /** Async variant of itemEntitlementsForFeature for itemEntitlement with params. */ public CompletableFuture itemEntitlementsForFeatureAsync( String featureId, ItemEntitlementsForFeatureParams params) { String path = @@ -121,6 +122,7 @@ public CompletableFuture itemEntitlementsFor response.getBodyAsString(), this, params, featureId, response)); } + /** Async variant of itemEntitlementsForFeature for itemEntitlement without params. */ public CompletableFuture itemEntitlementsForFeatureAsync( String featureId) { String path = @@ -167,6 +169,7 @@ public AddItemEntitlementsResponse addItemEntitlements( return AddItemEntitlementsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of addItemEntitlements for itemEntitlement with params. */ public CompletableFuture addItemEntitlementsAsync( String featureId, AddItemEntitlementsParams params) { String path = @@ -218,6 +221,7 @@ public ItemEntitlementsForItemResponse itemEntitlementsForItem(String itemId) response.getBodyAsString(), this, null, itemId, response); } + /** Async variant of itemEntitlementsForItem for itemEntitlement with params. */ public CompletableFuture itemEntitlementsForItemAsync( String itemId, ItemEntitlementsForItemParams params) { String path = buildPathWithParams("/items/{item-id}/item_entitlements", "item-id", itemId); @@ -228,6 +232,7 @@ public CompletableFuture itemEntitlementsForIte response.getBodyAsString(), this, params, itemId, response)); } + /** Async variant of itemEntitlementsForItem for itemEntitlement without params. */ public CompletableFuture itemEntitlementsForItemAsync( String itemId) { String path = buildPathWithParams("/items/{item-id}/item_entitlements", "item-id", itemId); @@ -275,6 +280,7 @@ public UpsertOrRemoveItemEntitlementsForItemResponse upsertOrRemoveItemEntitleme response.getBodyAsString(), response); } + /** Async variant of upsertOrRemoveItemEntitlementsForItem for itemEntitlement with params. */ public CompletableFuture upsertOrRemoveItemEntitlementsForItemAsync( String itemId, UpsertOrRemoveItemEntitlementsForItemParams params) { diff --git a/src/main/java/com/chargebee/v4/services/ItemFamilyService.java b/src/main/java/com/chargebee/v4/services/ItemFamilyService.java index b5b65f04..9a31f2f2 100644 --- a/src/main/java/com/chargebee/v4/services/ItemFamilyService.java +++ b/src/main/java/com/chargebee/v4/services/ItemFamilyService.java @@ -77,6 +77,7 @@ public ItemFamilyDeleteResponse delete(String itemFamilyId) throws ChargebeeExce return ItemFamilyDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for itemFamily without params. */ public CompletableFuture deleteAsync(String itemFamilyId) { String path = buildPathWithParams( @@ -111,6 +112,7 @@ public ItemFamilyListResponse list(ItemFamilyListParams params) throws Chargebee return ItemFamilyListResponse.fromJson(response.getBodyAsString(), this, params, response); } + /** Async variant of list for itemFamily with params. */ public CompletableFuture listAsync(ItemFamilyListParams params) { return getAsync("/item_families", params != null ? params.toQueryParams() : null) @@ -126,6 +128,7 @@ public ItemFamilyListResponse list() throws ChargebeeException { return ItemFamilyListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for itemFamily without params. */ public CompletableFuture listAsync() { return getAsync("/item_families", null) @@ -152,6 +155,7 @@ public ItemFamilyCreateResponse create(ItemFamilyCreateParams params) throws Cha return ItemFamilyCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for itemFamily with params. */ public CompletableFuture createAsync(ItemFamilyCreateParams params) { return postAsync("/item_families", params != null ? params.toFormData() : null) @@ -172,6 +176,7 @@ public ItemFamilyRetrieveResponse retrieve(String itemFamilyId) throws Chargebee return ItemFamilyRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for itemFamily without params. */ public CompletableFuture retrieveAsync(String itemFamilyId) { String path = buildPathWithParams("/item_families/{item-family-id}", "item-family-id", itemFamilyId); @@ -209,6 +214,7 @@ public ItemFamilyUpdateResponse update(String itemFamilyId, ItemFamilyUpdatePara return ItemFamilyUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for itemFamily with params. */ public CompletableFuture updateAsync( String itemFamilyId, ItemFamilyUpdateParams params) { String path = @@ -223,6 +229,7 @@ public ItemFamilyUpdateResponse update(String itemFamilyId) throws ChargebeeExce return ItemFamilyUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for itemFamily without params. */ public CompletableFuture updateAsync(String itemFamilyId) { String path = buildPathWithParams("/item_families/{item-family-id}", "item-family-id", itemFamilyId); diff --git a/src/main/java/com/chargebee/v4/services/ItemPriceService.java b/src/main/java/com/chargebee/v4/services/ItemPriceService.java index 38d91853..018e6bad 100644 --- a/src/main/java/com/chargebee/v4/services/ItemPriceService.java +++ b/src/main/java/com/chargebee/v4/services/ItemPriceService.java @@ -83,6 +83,7 @@ public ItemPriceRetrieveResponse retrieve(String itemPriceId) throws ChargebeeEx return ItemPriceRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for itemPrice without params. */ public CompletableFuture retrieveAsync(String itemPriceId) { String path = buildPathWithParams("/item_prices/{item-price-id}", "item-price-id", itemPriceId); @@ -116,6 +117,7 @@ public ItemPriceUpdateResponse update(String itemPriceId, ItemPriceUpdateParams return ItemPriceUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for itemPrice with params. */ public CompletableFuture updateAsync( String itemPriceId, ItemPriceUpdateParams params) { String path = buildPathWithParams("/item_prices/{item-price-id}", "item-price-id", itemPriceId); @@ -129,6 +131,7 @@ public ItemPriceUpdateResponse update(String itemPriceId) throws ChargebeeExcept return ItemPriceUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for itemPrice without params. */ public CompletableFuture updateAsync(String itemPriceId) { String path = buildPathWithParams("/item_prices/{item-price-id}", "item-price-id", itemPriceId); @@ -150,6 +153,7 @@ public ItemPriceDeleteResponse delete(String itemPriceId) throws ChargebeeExcept return ItemPriceDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for itemPrice without params. */ public CompletableFuture deleteAsync(String itemPriceId) { String path = buildPathWithParams("/item_prices/{item-price-id}/delete", "item-price-id", itemPriceId); @@ -208,6 +212,7 @@ public FindApplicableItemPricesResponse findApplicableItemPrices(String itemPric response.getBodyAsString(), this, null, itemPriceId, response); } + /** Async variant of findApplicableItemPrices for itemPrice with params. */ public CompletableFuture findApplicableItemPricesAsync( String itemPriceId, FindApplicableItemPricesParams params) { String path = @@ -220,6 +225,7 @@ public CompletableFuture findApplicableItemPri response.getBodyAsString(), this, params, itemPriceId, response)); } + /** Async variant of findApplicableItemPrices for itemPrice without params. */ public CompletableFuture findApplicableItemPricesAsync( String itemPriceId) { String path = @@ -280,6 +286,7 @@ public ItemPriceFindApplicableItemsResponse findApplicableItems(String itemPrice response.getBodyAsString(), this, null, itemPriceId, response); } + /** Async variant of findApplicableItems for itemPrice with params. */ public CompletableFuture findApplicableItemsAsync( String itemPriceId, ItemPriceFindApplicableItemsParams params) { String path = @@ -292,6 +299,7 @@ public CompletableFuture findApplicableIte response.getBodyAsString(), this, params, itemPriceId, response)); } + /** Async variant of findApplicableItems for itemPrice without params. */ public CompletableFuture findApplicableItemsAsync( String itemPriceId) { String path = @@ -328,6 +336,7 @@ public ItemPriceListResponse list(ItemPriceListParams params) throws ChargebeeEx return ItemPriceListResponse.fromJson(response.getBodyAsString(), this, params, response); } + /** Async variant of list for itemPrice with params. */ public CompletableFuture listAsync(ItemPriceListParams params) { return getAsync("/item_prices", params != null ? params.toQueryParams() : null) @@ -342,6 +351,7 @@ public ItemPriceListResponse list() throws ChargebeeException { return ItemPriceListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for itemPrice without params. */ public CompletableFuture listAsync() { return getAsync("/item_prices", null) @@ -368,6 +378,7 @@ public ItemPriceCreateResponse create(ItemPriceCreateParams params) throws Charg return ItemPriceCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for itemPrice with params. */ public CompletableFuture createAsync(ItemPriceCreateParams params) { return postAsync("/item_prices", params != null ? params.toFormData() : null) diff --git a/src/main/java/com/chargebee/v4/services/ItemService.java b/src/main/java/com/chargebee/v4/services/ItemService.java index 6afd244a..ac3be22d 100644 --- a/src/main/java/com/chargebee/v4/services/ItemService.java +++ b/src/main/java/com/chargebee/v4/services/ItemService.java @@ -87,6 +87,7 @@ public ItemListResponse list(ItemListParams params) throws ChargebeeException { return ItemListResponse.fromJson(response.getBodyAsString(), this, params, response); } + /** Async variant of list for item with params. */ public CompletableFuture listAsync(ItemListParams params) { return getAsync("/items", params != null ? params.toQueryParams() : null) @@ -101,6 +102,7 @@ public ItemListResponse list() throws ChargebeeException { return ItemListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for item without params. */ public CompletableFuture listAsync() { return getAsync("/items", null) @@ -127,6 +129,7 @@ public ItemCreateResponse create(ItemCreateParams params) throws ChargebeeExcept return ItemCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for item with params. */ public CompletableFuture createAsync(ItemCreateParams params) { return postAsync("/items", params != null ? params.toFormData() : null) @@ -145,6 +148,7 @@ public ItemDeleteResponse delete(String itemId) throws ChargebeeException { return ItemDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for item without params. */ public CompletableFuture deleteAsync(String itemId) { String path = buildPathWithParams("/items/{item-id}/delete", "item-id", itemId); @@ -164,6 +168,7 @@ public ItemRetrieveResponse retrieve(String itemId) throws ChargebeeException { return ItemRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for item without params. */ public CompletableFuture retrieveAsync(String itemId) { String path = buildPathWithParams("/items/{item-id}", "item-id", itemId); @@ -196,6 +201,7 @@ public ItemUpdateResponse update(String itemId, ItemUpdateParams params) return ItemUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** 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()) @@ -207,6 +213,7 @@ public ItemUpdateResponse update(String itemId) throws ChargebeeException { return ItemUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for item without params. */ public CompletableFuture updateAsync(String itemId) { String path = buildPathWithParams("/items/{item-id}", "item-id", itemId); diff --git a/src/main/java/com/chargebee/v4/services/MediaService.java b/src/main/java/com/chargebee/v4/services/MediaService.java index c505a619..0ce35467 100644 --- a/src/main/java/com/chargebee/v4/services/MediaService.java +++ b/src/main/java/com/chargebee/v4/services/MediaService.java @@ -84,6 +84,7 @@ public CreateMediaAndAttachToItemResponse createMediaAndAttachToItem( return CreateMediaAndAttachToItemResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of createMediaAndAttachToItem for media with params. */ public CompletableFuture createMediaAndAttachToItemAsync( String itemId, CreateMediaAndAttachToItemParams params) { String path = buildPathWithParams("/items/{item-id}/media", "item-id", itemId); diff --git a/src/main/java/com/chargebee/v4/services/NonSubscriptionService.java b/src/main/java/com/chargebee/v4/services/NonSubscriptionService.java index 8da3cb6a..dbd3e6f2 100644 --- a/src/main/java/com/chargebee/v4/services/NonSubscriptionService.java +++ b/src/main/java/com/chargebee/v4/services/NonSubscriptionService.java @@ -99,6 +99,7 @@ public NonSubscriptionProcessReceiptResponse processReceipt( return NonSubscriptionProcessReceiptResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of processReceipt for nonSubscription with params. */ public CompletableFuture processReceiptAsync( String nonSubscriptionAppId, NonSubscriptionProcessReceiptParams params) { String path = diff --git a/src/main/java/com/chargebee/v4/services/OfferEventService.java b/src/main/java/com/chargebee/v4/services/OfferEventService.java index 137f6947..f4c75ba0 100644 --- a/src/main/java/com/chargebee/v4/services/OfferEventService.java +++ b/src/main/java/com/chargebee/v4/services/OfferEventService.java @@ -76,6 +76,7 @@ public OfferEventsResponse offerEvents(OfferEventsParams params) throws Chargebe return OfferEventsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of offerEvents for offerEvent with params. */ public CompletableFuture offerEventsAsync(OfferEventsParams params) { return postJsonWithSubDomainAsync( diff --git a/src/main/java/com/chargebee/v4/services/OfferFulfillmentService.java b/src/main/java/com/chargebee/v4/services/OfferFulfillmentService.java index e54afbde..40fbbe94 100644 --- a/src/main/java/com/chargebee/v4/services/OfferFulfillmentService.java +++ b/src/main/java/com/chargebee/v4/services/OfferFulfillmentService.java @@ -88,6 +88,7 @@ public OfferFulfillmentsResponse offerFulfillments(OfferFulfillmentsParams param return OfferFulfillmentsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of offerFulfillments for offerFulfillment with params. */ public CompletableFuture offerFulfillmentsAsync( OfferFulfillmentsParams params) { @@ -116,6 +117,7 @@ public OfferFulfillmentsGetResponse offerFulfillmentsGet(String offerFulfillment return OfferFulfillmentsGetResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of offerFulfillmentsGet for offerFulfillment without params. */ public CompletableFuture offerFulfillmentsGetAsync( String offerFulfillmentId) { String path = @@ -176,6 +178,7 @@ public OfferFulfillmentsUpdateResponse offerFulfillmentsUpdate( return OfferFulfillmentsUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of offerFulfillmentsUpdate for offerFulfillment with params. */ public CompletableFuture offerFulfillmentsUpdateAsync( String offerFulfillmentId, OfferFulfillmentsUpdateParams params) { String path = diff --git a/src/main/java/com/chargebee/v4/services/OmnichannelOneTimeOrderService.java b/src/main/java/com/chargebee/v4/services/OmnichannelOneTimeOrderService.java index cd64dd5a..c7fef5af 100644 --- a/src/main/java/com/chargebee/v4/services/OmnichannelOneTimeOrderService.java +++ b/src/main/java/com/chargebee/v4/services/OmnichannelOneTimeOrderService.java @@ -89,6 +89,7 @@ public OmnichannelOneTimeOrderListResponse list(OmnichannelOneTimeOrderListParam response.getBodyAsString(), this, params, response); } + /** Async variant of list for omnichannelOneTimeOrder with params. */ public CompletableFuture listAsync( OmnichannelOneTimeOrderListParams params) { @@ -106,6 +107,7 @@ public OmnichannelOneTimeOrderListResponse list() throws ChargebeeException { response.getBodyAsString(), this, null, response); } + /** Async variant of list for omnichannelOneTimeOrder without params. */ public CompletableFuture listAsync() { return getAsync("/omnichannel_one_time_orders", null) @@ -132,6 +134,7 @@ public OmnichannelOneTimeOrderRetrieveResponse retrieve(String omnichannelOneTim return OmnichannelOneTimeOrderRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for omnichannelOneTimeOrder without params. */ public CompletableFuture retrieveAsync( String omnichannelOneTimeOrderId) { String path = diff --git a/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionItemService.java b/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionItemService.java index 93313051..2db0c4e7 100644 --- a/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionItemService.java +++ b/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionItemService.java @@ -116,6 +116,10 @@ Response listOmniSubscriptionItemScheduleChangesRaw( response.getBodyAsString(), this, null, omnichannelSubscriptionItemId, response); } + /** + * Async variant of listOmniSubscriptionItemScheduleChanges for omnichannelSubscriptionItem with + * params. + */ public CompletableFuture< OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesResponse> listOmniSubscriptionItemScheduleChangesAsync( @@ -137,6 +141,10 @@ Response listOmniSubscriptionItemScheduleChangesRaw( response)); } + /** + * Async variant of listOmniSubscriptionItemScheduleChanges for omnichannelSubscriptionItem + * without params. + */ public CompletableFuture< OmnichannelSubscriptionItemListOmniSubscriptionItemScheduleChangesResponse> listOmniSubscriptionItemScheduleChangesAsync(String omnichannelSubscriptionItemId) { diff --git a/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionService.java b/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionService.java index 06912d50..37e63871 100644 --- a/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionService.java +++ b/src/main/java/com/chargebee/v4/services/OmnichannelSubscriptionService.java @@ -108,6 +108,7 @@ public OmnichannelSubscriptionMoveResponse move( return OmnichannelSubscriptionMoveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of move for omnichannelSubscription with params. */ public CompletableFuture moveAsync( String omnichannelSubscriptionId, OmnichannelSubscriptionMoveParams params) { String path = @@ -138,6 +139,7 @@ public OmnichannelSubscriptionRetrieveResponse retrieve(String omnichannelSubscr return OmnichannelSubscriptionRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for omnichannelSubscription without params. */ public CompletableFuture retrieveAsync( String omnichannelSubscriptionId) { String path = @@ -217,6 +219,10 @@ Response omnichannelTransactionsForOmnichannelSubscriptionRaw( response.getBodyAsString(), this, null, omnichannelSubscriptionId, response); } + /** + * Async variant of omnichannelTransactionsForOmnichannelSubscription for omnichannelSubscription + * with params. + */ public CompletableFuture omnichannelTransactionsForOmnichannelSubscriptionAsync( String omnichannelSubscriptionId, @@ -233,6 +239,10 @@ Response omnichannelTransactionsForOmnichannelSubscriptionRaw( response.getBodyAsString(), this, params, omnichannelSubscriptionId, response)); } + /** + * Async variant of omnichannelTransactionsForOmnichannelSubscription for omnichannelSubscription + * without params. + */ public CompletableFuture omnichannelTransactionsForOmnichannelSubscriptionAsync(String omnichannelSubscriptionId) { String path = @@ -281,6 +291,7 @@ public OmnichannelSubscriptionListResponse list(OmnichannelSubscriptionListParam response.getBodyAsString(), this, params, response); } + /** Async variant of list for omnichannelSubscription with params. */ public CompletableFuture listAsync( OmnichannelSubscriptionListParams params) { @@ -298,6 +309,7 @@ public OmnichannelSubscriptionListResponse list() throws ChargebeeException { response.getBodyAsString(), this, null, response); } + /** Async variant of list for omnichannelSubscription without params. */ public CompletableFuture listAsync() { return getAsync("/omnichannel_subscriptions", null) diff --git a/src/main/java/com/chargebee/v4/services/OrderService.java b/src/main/java/com/chargebee/v4/services/OrderService.java index 5462620b..8d16fe94 100644 --- a/src/main/java/com/chargebee/v4/services/OrderService.java +++ b/src/main/java/com/chargebee/v4/services/OrderService.java @@ -113,6 +113,7 @@ public OrderListResponse list(OrderListParams params) throws ChargebeeException return OrderListResponse.fromJson(response.getBodyAsString(), this, params, response); } + /** Async variant of list for order with params. */ public CompletableFuture listAsync(OrderListParams params) { return getAsync("/orders", params != null ? params.toQueryParams() : null) @@ -127,6 +128,7 @@ public OrderListResponse list() throws ChargebeeException { return OrderListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for order without params. */ public CompletableFuture listAsync() { return getAsync("/orders", null) @@ -153,6 +155,7 @@ public OrderCreateResponse create(OrderCreateParams params) throws ChargebeeExce return OrderCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for order with params. */ public CompletableFuture createAsync(OrderCreateParams params) { return postAsync("/orders", params != null ? params.toFormData() : null) @@ -177,6 +180,7 @@ public ImportOrderResponse importOrder(ImportOrderParams params) throws Chargebe return ImportOrderResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of importOrder for order with params. */ public CompletableFuture importOrderAsync(ImportOrderParams params) { return postAsync("/orders/import_order", params != null ? params.toFormData() : null) @@ -196,6 +200,7 @@ public AssignOrderNumberResponse assignOrderNumber(String orderId) throws Charge return AssignOrderNumberResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of assignOrderNumber for order without params. */ public CompletableFuture assignOrderNumberAsync(String orderId) { String path = buildPathWithParams("/orders/{order-id}/assign_order_number", "order-id", orderId); @@ -230,6 +235,7 @@ public OrderResendResponse resend(String orderId, OrderResendParams params) return OrderResendResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of resend for order with params. */ public CompletableFuture resendAsync( String orderId, OrderResendParams params) { String path = buildPathWithParams("/orders/{order-id}/resend", "order-id", orderId); @@ -242,6 +248,7 @@ public OrderResendResponse resend(String orderId) throws ChargebeeException { return OrderResendResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of resend for order without params. */ public CompletableFuture resendAsync(String orderId) { String path = buildPathWithParams("/orders/{order-id}/resend", "order-id", orderId); @@ -274,6 +281,7 @@ public OrderReopenResponse reopen(String orderId, OrderReopenParams params) return OrderReopenResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of reopen for order with params. */ public CompletableFuture reopenAsync( String orderId, OrderReopenParams params) { String path = buildPathWithParams("/orders/{order-id}/reopen", "order-id", orderId); @@ -286,6 +294,7 @@ public OrderReopenResponse reopen(String orderId) throws ChargebeeException { return OrderReopenResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of reopen for order without params. */ public CompletableFuture reopenAsync(String orderId) { String path = buildPathWithParams("/orders/{order-id}/reopen", "order-id", orderId); @@ -329,6 +338,7 @@ public OrdersForInvoiceResponse ordersForInvoice(String invoiceId) throws Charge response.getBodyAsString(), this, null, invoiceId, response); } + /** Async variant of ordersForInvoice for order with params. */ public CompletableFuture ordersForInvoiceAsync( String invoiceId, OrdersForInvoiceParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/orders", "invoice-id", invoiceId); @@ -339,6 +349,7 @@ public CompletableFuture ordersForInvoiceAsync( response.getBodyAsString(), this, params, invoiceId, response)); } + /** 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) @@ -373,6 +384,7 @@ public OrderCancelResponse cancel(String orderId, OrderCancelParams params) return OrderCancelResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of cancel for order with params. */ public CompletableFuture cancelAsync( String orderId, OrderCancelParams params) { String path = buildPathWithParams("/orders/{order-id}/cancel", "order-id", orderId); @@ -392,6 +404,7 @@ public OrderRetrieveResponse retrieve(String orderId) throws ChargebeeException return OrderRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for order without params. */ public CompletableFuture retrieveAsync(String orderId) { String path = buildPathWithParams("/orders/{order-id}", "order-id", orderId); @@ -425,6 +438,7 @@ public OrderUpdateResponse update(String orderId, OrderUpdateParams params) return OrderUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for order with params. */ public CompletableFuture updateAsync( String orderId, OrderUpdateParams params) { String path = buildPathWithParams("/orders/{order-id}", "order-id", orderId); @@ -437,6 +451,7 @@ public OrderUpdateResponse update(String orderId) throws ChargebeeException { return OrderUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for order without params. */ public CompletableFuture updateAsync(String orderId) { String path = buildPathWithParams("/orders/{order-id}", "order-id", orderId); @@ -456,6 +471,7 @@ public OrderDeleteResponse delete(String orderId) throws ChargebeeException { return OrderDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for order without params. */ public CompletableFuture deleteAsync(String orderId) { String path = buildPathWithParams("/orders/{order-id}/delete", "order-id", orderId); @@ -502,6 +518,7 @@ public OrderCreateRefundableCreditNoteResponse createRefundableCreditNote( return OrderCreateRefundableCreditNoteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of createRefundableCreditNote for order with params. */ public CompletableFuture createRefundableCreditNoteAsync( String orderId, OrderCreateRefundableCreditNoteParams params) { String path = @@ -520,6 +537,7 @@ public OrderCreateRefundableCreditNoteResponse createRefundableCreditNote(String return OrderCreateRefundableCreditNoteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of createRefundableCreditNote for order without params. */ public CompletableFuture createRefundableCreditNoteAsync( String orderId) { String path = diff --git a/src/main/java/com/chargebee/v4/services/PaymentIntentService.java b/src/main/java/com/chargebee/v4/services/PaymentIntentService.java index f489d488..6f753e29 100644 --- a/src/main/java/com/chargebee/v4/services/PaymentIntentService.java +++ b/src/main/java/com/chargebee/v4/services/PaymentIntentService.java @@ -72,6 +72,7 @@ public PaymentIntentRetrieveResponse retrieve(String paymentIntentId) throws Cha return PaymentIntentRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for paymentIntent without params. */ public CompletableFuture retrieveAsync(String paymentIntentId) { String path = buildPathWithParams( @@ -119,6 +120,7 @@ public PaymentIntentUpdateResponse update( return PaymentIntentUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for paymentIntent with params. */ public CompletableFuture updateAsync( String paymentIntentId, PaymentIntentUpdateParams params) { String path = @@ -134,6 +136,7 @@ public PaymentIntentUpdateResponse update(String paymentIntentId) throws Chargeb return PaymentIntentUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for paymentIntent without params. */ public CompletableFuture updateAsync(String paymentIntentId) { String path = buildPathWithParams( @@ -167,6 +170,7 @@ public PaymentIntentCreateResponse create(PaymentIntentCreateParams params) return PaymentIntentCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for paymentIntent with params. */ public CompletableFuture createAsync( PaymentIntentCreateParams params) { diff --git a/src/main/java/com/chargebee/v4/services/PaymentScheduleSchemeService.java b/src/main/java/com/chargebee/v4/services/PaymentScheduleSchemeService.java index 4f481be9..72908e1f 100644 --- a/src/main/java/com/chargebee/v4/services/PaymentScheduleSchemeService.java +++ b/src/main/java/com/chargebee/v4/services/PaymentScheduleSchemeService.java @@ -73,6 +73,7 @@ public PaymentScheduleSchemeRetrieveResponse retrieve(String paymentScheduleSche return PaymentScheduleSchemeRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for paymentScheduleScheme without params. */ public CompletableFuture retrieveAsync( String paymentScheduleSchemeId) { String path = @@ -113,6 +114,7 @@ public PaymentScheduleSchemeCreateResponse create(PaymentScheduleSchemeCreatePar return PaymentScheduleSchemeCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for paymentScheduleScheme with params. */ public CompletableFuture createAsync( PaymentScheduleSchemeCreateParams params) { @@ -139,6 +141,7 @@ public PaymentScheduleSchemeDeleteResponse delete(String paymentScheduleSchemeId return PaymentScheduleSchemeDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for paymentScheduleScheme without params. */ public CompletableFuture deleteAsync( String paymentScheduleSchemeId) { String path = diff --git a/src/main/java/com/chargebee/v4/services/PaymentSourceService.java b/src/main/java/com/chargebee/v4/services/PaymentSourceService.java index 07681a96..d131a3f4 100644 --- a/src/main/java/com/chargebee/v4/services/PaymentSourceService.java +++ b/src/main/java/com/chargebee/v4/services/PaymentSourceService.java @@ -137,6 +137,7 @@ public PaymentSourceCreateUsingPermanentTokenResponse createUsingPermanentToken( response.getBodyAsString(), response); } + /** Async variant of createUsingPermanentToken for paymentSource with params. */ public CompletableFuture createUsingPermanentTokenAsync(PaymentSourceCreateUsingPermanentTokenParams params) { @@ -165,6 +166,7 @@ public PaymentSourceDeleteResponse delete(String custPaymentSourceId) throws Cha return PaymentSourceDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for paymentSource without params. */ public CompletableFuture deleteAsync(String custPaymentSourceId) { String path = buildPathWithParams( @@ -202,6 +204,7 @@ public PaymentSourceCreateCardResponse createCard(PaymentSourceCreateCardParams return PaymentSourceCreateCardResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of createCard for paymentSource with params. */ public CompletableFuture createCardAsync( PaymentSourceCreateCardParams params) { @@ -258,6 +261,7 @@ public PaymentSourceVerifyBankAccountResponse verifyBankAccount( return PaymentSourceVerifyBankAccountResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of verifyBankAccount for paymentSource with params. */ public CompletableFuture verifyBankAccountAsync( String custPaymentSourceId, PaymentSourceVerifyBankAccountParams params) { String path = @@ -296,6 +300,7 @@ public PaymentSourceListResponse list(PaymentSourceListParams params) throws Cha return PaymentSourceListResponse.fromJson(response.getBodyAsString(), this, params, response); } + /** Async variant of list for paymentSource with params. */ public CompletableFuture listAsync(PaymentSourceListParams params) { return getAsync("/payment_sources", params != null ? params.toQueryParams() : null) @@ -311,6 +316,7 @@ public PaymentSourceListResponse list() throws ChargebeeException { return PaymentSourceListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for paymentSource without params. */ public CompletableFuture listAsync() { return getAsync("/payment_sources", null) @@ -365,6 +371,7 @@ public ExportPaymentSourceResponse exportPaymentSource( return ExportPaymentSourceResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of exportPaymentSource for paymentSource with params. */ public CompletableFuture exportPaymentSourceAsync( String custPaymentSourceId, ExportPaymentSourceParams params) { String path = @@ -406,6 +413,7 @@ public PaymentSourceCreateUsingPaymentIntentResponse createUsingPaymentIntent( response.getBodyAsString(), response); } + /** Async variant of createUsingPaymentIntent for paymentSource with params. */ public CompletableFuture createUsingPaymentIntentAsync(PaymentSourceCreateUsingPaymentIntentParams params) { @@ -435,6 +443,7 @@ public PaymentSourceAgreementPdfResponse agreementPdf(String custPaymentSourceId return PaymentSourceAgreementPdfResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of agreementPdf for paymentSource without params. */ public CompletableFuture agreementPdfAsync( String custPaymentSourceId) { String path = @@ -466,6 +475,7 @@ public PaymentSourceRetrieveResponse retrieve(String custPaymentSourceId) return PaymentSourceRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for paymentSource without params. */ public CompletableFuture retrieveAsync( String custPaymentSourceId) { String path = @@ -508,6 +518,7 @@ public CreateVoucherPaymentSourceResponse createVoucherPaymentSource( return CreateVoucherPaymentSourceResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of createVoucherPaymentSource for paymentSource with params. */ public CompletableFuture createVoucherPaymentSourceAsync( CreateVoucherPaymentSourceParams params) { @@ -546,6 +557,7 @@ public PaymentSourceCreateUsingTempTokenResponse createUsingTempToken( return PaymentSourceCreateUsingTempTokenResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of createUsingTempToken for paymentSource with params. */ public CompletableFuture createUsingTempTokenAsync( PaymentSourceCreateUsingTempTokenParams params) { @@ -601,6 +613,7 @@ public PaymentSourceUpdateCardResponse updateCard( return PaymentSourceUpdateCardResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of updateCard for paymentSource with params. */ public CompletableFuture updateCardAsync( String custPaymentSourceId, PaymentSourceUpdateCardParams params) { String path = @@ -620,6 +633,7 @@ public PaymentSourceUpdateCardResponse updateCard(String custPaymentSourceId) return PaymentSourceUpdateCardResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of updateCard for paymentSource without params. */ public CompletableFuture updateCardAsync( String custPaymentSourceId) { String path = @@ -681,6 +695,7 @@ public PaymentSourceSwitchGatewayAccountResponse switchGatewayAccount( return PaymentSourceSwitchGatewayAccountResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of switchGatewayAccount for paymentSource with params. */ public CompletableFuture switchGatewayAccountAsync( String custPaymentSourceId, PaymentSourceSwitchGatewayAccountParams params) { String path = @@ -721,6 +736,7 @@ public PaymentSourceCreateUsingTokenResponse createUsingToken( return PaymentSourceCreateUsingTokenResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of createUsingToken for paymentSource with params. */ public CompletableFuture createUsingTokenAsync( PaymentSourceCreateUsingTokenParams params) { @@ -749,6 +765,7 @@ public PaymentSourceDeleteLocalResponse deleteLocal(String custPaymentSourceId) return PaymentSourceDeleteLocalResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of deleteLocal for paymentSource without params. */ public CompletableFuture deleteLocalAsync( String custPaymentSourceId) { String path = @@ -790,6 +807,7 @@ public PaymentSourceCreateBankAccountResponse createBankAccount( return PaymentSourceCreateBankAccountResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of createBankAccount for paymentSource with params. */ public CompletableFuture createBankAccountAsync( PaymentSourceCreateBankAccountParams params) { @@ -848,6 +866,7 @@ public PaymentSourceUpdateBankAccountResponse updateBankAccount( return PaymentSourceUpdateBankAccountResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of updateBankAccount for paymentSource with params. */ public CompletableFuture updateBankAccountAsync( String custPaymentSourceId, PaymentSourceUpdateBankAccountParams params) { String path = @@ -868,6 +887,7 @@ public PaymentSourceUpdateBankAccountResponse updateBankAccount(String custPayme return PaymentSourceUpdateBankAccountResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of updateBankAccount for paymentSource without params. */ public CompletableFuture updateBankAccountAsync( String custPaymentSourceId) { String path = diff --git a/src/main/java/com/chargebee/v4/services/PaymentVoucherService.java b/src/main/java/com/chargebee/v4/services/PaymentVoucherService.java index 2b29346d..eeb9e764 100644 --- a/src/main/java/com/chargebee/v4/services/PaymentVoucherService.java +++ b/src/main/java/com/chargebee/v4/services/PaymentVoucherService.java @@ -108,6 +108,7 @@ public PaymentVouchersForCustomerResponse paymentVouchersForCustomer(String cust response.getBodyAsString(), this, null, customerId, response); } + /** Async variant of paymentVouchersForCustomer for paymentVoucher with params. */ public CompletableFuture paymentVouchersForCustomerAsync( String customerId, PaymentVouchersForCustomerParams params) { String path = @@ -119,6 +120,7 @@ public CompletableFuture paymentVouchersForC response.getBodyAsString(), this, params, customerId, response)); } + /** Async variant of paymentVouchersForCustomer for paymentVoucher without params. */ public CompletableFuture paymentVouchersForCustomerAsync( String customerId) { String path = @@ -176,6 +178,7 @@ public PaymentVouchersForInvoiceResponse paymentVouchersForInvoice(String invoic response.getBodyAsString(), this, null, invoiceId, response); } + /** Async variant of paymentVouchersForInvoice for paymentVoucher with params. */ public CompletableFuture paymentVouchersForInvoiceAsync( String invoiceId, PaymentVouchersForInvoiceParams params) { String path = @@ -187,6 +190,7 @@ public CompletableFuture paymentVouchersForIn response.getBodyAsString(), this, params, invoiceId, response)); } + /** Async variant of paymentVouchersForInvoice for paymentVoucher without params. */ public CompletableFuture paymentVouchersForInvoiceAsync( String invoiceId) { String path = @@ -213,6 +217,7 @@ public PaymentVoucherRetrieveResponse retrieve(String paymentVoucherId) return PaymentVoucherRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for paymentVoucher without params. */ public CompletableFuture retrieveAsync(String paymentVoucherId) { String path = buildPathWithParams( @@ -247,6 +252,7 @@ public PaymentVoucherCreateResponse create(PaymentVoucherCreateParams params) return PaymentVoucherCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for paymentVoucher with params. */ public CompletableFuture createAsync( PaymentVoucherCreateParams params) { diff --git a/src/main/java/com/chargebee/v4/services/Pc2MigrationItemFamilyService.java b/src/main/java/com/chargebee/v4/services/Pc2MigrationItemFamilyService.java index 5596052d..b6def44f 100644 --- a/src/main/java/com/chargebee/v4/services/Pc2MigrationItemFamilyService.java +++ b/src/main/java/com/chargebee/v4/services/Pc2MigrationItemFamilyService.java @@ -82,6 +82,7 @@ public Pc2MigrationItemFamilyDeleteResponse delete(String pc2MigrationItemFamily return Pc2MigrationItemFamilyDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for pc2MigrationItemFamily without params. */ public CompletableFuture deleteAsync( String pc2MigrationItemFamilyId) { String path = @@ -114,6 +115,7 @@ public Pc2MigrationItemFamilyRetrieveResponse retrieve(String pc2MigrationItemFa return Pc2MigrationItemFamilyRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for pc2MigrationItemFamily without params. */ public CompletableFuture retrieveAsync( String pc2MigrationItemFamilyId) { String path = @@ -175,6 +177,7 @@ public Pc2MigrationItemFamilyUpdateResponse update( return Pc2MigrationItemFamilyUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for pc2MigrationItemFamily with params. */ public CompletableFuture updateAsync( String pc2MigrationItemFamilyId, Pc2MigrationItemFamilyUpdateParams params) { String path = @@ -195,6 +198,7 @@ public Pc2MigrationItemFamilyUpdateResponse update(String pc2MigrationItemFamily return Pc2MigrationItemFamilyUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for pc2MigrationItemFamily without params. */ public CompletableFuture updateAsync( String pc2MigrationItemFamilyId) { String path = @@ -242,6 +246,7 @@ public Pc2MigrationItemFamilyListResponse list(Pc2MigrationItemFamilyListParams response.getBodyAsString(), this, params, response); } + /** Async variant of list for pc2MigrationItemFamily with params. */ public CompletableFuture listAsync( Pc2MigrationItemFamilyListParams params) { @@ -259,6 +264,7 @@ public Pc2MigrationItemFamilyListResponse list() throws ChargebeeException { response.getBodyAsString(), this, null, response); } + /** Async variant of list for pc2MigrationItemFamily without params. */ public CompletableFuture listAsync() { return getAsync("/pc2_migration_item_families", null) @@ -293,6 +299,7 @@ public Pc2MigrationItemFamilyCreateResponse create(Pc2MigrationItemFamilyCreateP return Pc2MigrationItemFamilyCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for pc2MigrationItemFamily with params. */ public CompletableFuture createAsync( Pc2MigrationItemFamilyCreateParams params) { diff --git a/src/main/java/com/chargebee/v4/services/Pc2MigrationItemPriceService.java b/src/main/java/com/chargebee/v4/services/Pc2MigrationItemPriceService.java index 029fec46..6e1e3a7f 100644 --- a/src/main/java/com/chargebee/v4/services/Pc2MigrationItemPriceService.java +++ b/src/main/java/com/chargebee/v4/services/Pc2MigrationItemPriceService.java @@ -92,6 +92,7 @@ public Pc2MigrationItemPriceListResponse list(Pc2MigrationItemPriceListParams pa response.getBodyAsString(), this, params, response); } + /** Async variant of list for pc2MigrationItemPrice with params. */ public CompletableFuture listAsync( Pc2MigrationItemPriceListParams params) { @@ -109,6 +110,7 @@ public Pc2MigrationItemPriceListResponse list() throws ChargebeeException { response.getBodyAsString(), this, null, response); } + /** Async variant of list for pc2MigrationItemPrice without params. */ public CompletableFuture listAsync() { return getAsync("/pc2_migration_item_prices", null) @@ -135,6 +137,7 @@ public Pc2MigrationItemPriceDeleteResponse delete(String pc2MigrationItemPriceId return Pc2MigrationItemPriceDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for pc2MigrationItemPrice without params. */ public CompletableFuture deleteAsync( String pc2MigrationItemPriceId) { String path = @@ -166,6 +169,7 @@ public Pc2MigrationItemPriceRetrieveResponse retrieve(String pc2MigrationItemPri return Pc2MigrationItemPriceRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for pc2MigrationItemPrice without params. */ public CompletableFuture retrieveAsync( String pc2MigrationItemPriceId) { String path = @@ -226,6 +230,7 @@ public Pc2MigrationItemPriceUpdateResponse update( return Pc2MigrationItemPriceUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for pc2MigrationItemPrice with params. */ public CompletableFuture updateAsync( String pc2MigrationItemPriceId, Pc2MigrationItemPriceUpdateParams params) { String path = @@ -245,6 +250,7 @@ public Pc2MigrationItemPriceUpdateResponse update(String pc2MigrationItemPriceId return Pc2MigrationItemPriceUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for pc2MigrationItemPrice without params. */ public CompletableFuture updateAsync( String pc2MigrationItemPriceId) { String path = diff --git a/src/main/java/com/chargebee/v4/services/Pc2MigrationItemService.java b/src/main/java/com/chargebee/v4/services/Pc2MigrationItemService.java index 5cb84f80..940a08b5 100644 --- a/src/main/java/com/chargebee/v4/services/Pc2MigrationItemService.java +++ b/src/main/java/com/chargebee/v4/services/Pc2MigrationItemService.java @@ -85,6 +85,7 @@ public Pc2MigrationItemRetrieveResponse retrieve(String pc2MigrationItemId) return Pc2MigrationItemRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for pc2MigrationItem without params. */ public CompletableFuture retrieveAsync( String pc2MigrationItemId) { String path = @@ -141,6 +142,7 @@ public Pc2MigrationItemUpdateResponse update( return Pc2MigrationItemUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for pc2MigrationItem with params. */ public CompletableFuture updateAsync( String pc2MigrationItemId, Pc2MigrationItemUpdateParams params) { String path = @@ -160,6 +162,7 @@ public Pc2MigrationItemUpdateResponse update(String pc2MigrationItemId) return Pc2MigrationItemUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for pc2MigrationItem without params. */ public CompletableFuture updateAsync(String pc2MigrationItemId) { String path = buildPathWithParams( @@ -190,6 +193,7 @@ public Pc2MigrationItemDeleteResponse delete(String pc2MigrationItemId) return Pc2MigrationItemDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for pc2MigrationItem without params. */ public CompletableFuture deleteAsync(String pc2MigrationItemId) { String path = buildPathWithParams( @@ -233,6 +237,7 @@ public Pc2MigrationItemListResponse list(Pc2MigrationItemListParams params) response.getBodyAsString(), this, params, response); } + /** Async variant of list for pc2MigrationItem with params. */ public CompletableFuture listAsync( Pc2MigrationItemListParams params) { @@ -249,6 +254,7 @@ public Pc2MigrationItemListResponse list() throws ChargebeeException { return Pc2MigrationItemListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for pc2MigrationItem without params. */ public CompletableFuture listAsync() { return getAsync("/pc2_migration_items", null) @@ -281,6 +287,7 @@ public Pc2MigrationItemCreateResponse create(Pc2MigrationItemCreateParams params return Pc2MigrationItemCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for pc2MigrationItem with params. */ public CompletableFuture createAsync( Pc2MigrationItemCreateParams params) { @@ -327,6 +334,7 @@ public Pc2MigrationItemListApplicableAddonsResponse listApplicableAddons( response.getBodyAsString(), this, params, response); } + /** Async variant of listApplicableAddons for pc2MigrationItem with params. */ public CompletableFuture listApplicableAddonsAsync( Pc2MigrationItemListApplicableAddonsParams params) { @@ -346,6 +354,7 @@ public Pc2MigrationItemListApplicableAddonsResponse listApplicableAddons() response.getBodyAsString(), this, null, response); } + /** Async variant of listApplicableAddons for pc2MigrationItem without params. */ public CompletableFuture listApplicableAddonsAsync() { diff --git a/src/main/java/com/chargebee/v4/services/Pc2MigrationService.java b/src/main/java/com/chargebee/v4/services/Pc2MigrationService.java index 09d7e281..d9756928 100644 --- a/src/main/java/com/chargebee/v4/services/Pc2MigrationService.java +++ b/src/main/java/com/chargebee/v4/services/Pc2MigrationService.java @@ -75,6 +75,7 @@ public Pc2MigrationContactSupportResponse contactSupport(String pc2MigrationId) return Pc2MigrationContactSupportResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of contactSupport for pc2Migration without params. */ public CompletableFuture contactSupportAsync( String pc2MigrationId) { String path = @@ -103,6 +104,7 @@ public Pc2MigrationRetrieveResponse retrieve(String pc2MigrationId) throws Charg return Pc2MigrationRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for pc2Migration without params. */ public CompletableFuture retrieveAsync(String pc2MigrationId) { String path = buildPathWithParams( @@ -133,6 +135,7 @@ public Pc2MigrationCreateResponse create(Pc2MigrationCreateParams params) return Pc2MigrationCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for pc2Migration with params. */ public CompletableFuture createAsync( Pc2MigrationCreateParams params) { @@ -155,6 +158,7 @@ public Pc2MigrationInitiateResponse initiate(String pc2MigrationId) throws Charg return Pc2MigrationInitiateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of initiate for pc2Migration without params. */ public CompletableFuture initiateAsync(String pc2MigrationId) { String path = buildPathWithParams( diff --git a/src/main/java/com/chargebee/v4/services/PersonalizedOfferService.java b/src/main/java/com/chargebee/v4/services/PersonalizedOfferService.java index f91a358a..226f6cc8 100644 --- a/src/main/java/com/chargebee/v4/services/PersonalizedOfferService.java +++ b/src/main/java/com/chargebee/v4/services/PersonalizedOfferService.java @@ -82,6 +82,7 @@ public PersonalizedOffersResponse personalizedOffers(PersonalizedOffersParams pa return PersonalizedOffersResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of personalizedOffers for personalizedOffer with params. */ public CompletableFuture personalizedOffersAsync( PersonalizedOffersParams params) { diff --git a/src/main/java/com/chargebee/v4/services/PlanService.java b/src/main/java/com/chargebee/v4/services/PlanService.java index 85499533..1e5c7545 100644 --- a/src/main/java/com/chargebee/v4/services/PlanService.java +++ b/src/main/java/com/chargebee/v4/services/PlanService.java @@ -81,6 +81,7 @@ public PlanUnarchiveResponse unarchive(String planId) throws ChargebeeException return PlanUnarchiveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of unarchive for plan without params. */ public CompletableFuture unarchiveAsync(String planId) { String path = buildPathWithParams("/plans/{plan-id}/unarchive", "plan-id", planId); @@ -101,6 +102,7 @@ public PlanDeleteResponse delete(String planId) throws ChargebeeException { return PlanDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for plan without params. */ public CompletableFuture deleteAsync(String planId) { String path = buildPathWithParams("/plans/{plan-id}/delete", "plan-id", planId); @@ -126,6 +128,7 @@ public PlanCopyResponse copy(PlanCopyParams params) throws ChargebeeException { return PlanCopyResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of copy for plan with params. */ public CompletableFuture copyAsync(PlanCopyParams params) { return postAsync("/plans/copy", params != null ? params.toFormData() : null) @@ -156,6 +159,7 @@ public PlanListResponse list(PlanListParams params) throws ChargebeeException { return PlanListResponse.fromJson(response.getBodyAsString(), this, params, response); } + /** Async variant of list for plan with params. */ public CompletableFuture listAsync(PlanListParams params) { return getAsync("/plans", params != null ? params.toQueryParams() : null) @@ -170,6 +174,7 @@ public PlanListResponse list() throws ChargebeeException { return PlanListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for plan without params. */ public CompletableFuture listAsync() { return getAsync("/plans", null) @@ -196,6 +201,7 @@ public PlanCreateResponse create(PlanCreateParams params) throws ChargebeeExcept return PlanCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for plan with params. */ public CompletableFuture createAsync(PlanCreateParams params) { return postAsync("/plans", params != null ? params.toFormData() : null) @@ -214,6 +220,7 @@ public PlanRetrieveResponse retrieve(String planId) throws ChargebeeException { return PlanRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for plan without params. */ public CompletableFuture retrieveAsync(String planId) { String path = buildPathWithParams("/plans/{plan-id}", "plan-id", planId); @@ -246,6 +253,7 @@ public PlanUpdateResponse update(String planId, PlanUpdateParams params) return PlanUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** 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()) @@ -257,6 +265,7 @@ public PlanUpdateResponse update(String planId) throws ChargebeeException { return PlanUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for plan without params. */ public CompletableFuture updateAsync(String planId) { String path = buildPathWithParams("/plans/{plan-id}", "plan-id", planId); diff --git a/src/main/java/com/chargebee/v4/services/PortalSessionService.java b/src/main/java/com/chargebee/v4/services/PortalSessionService.java index 9fd2d8bf..33b835b5 100644 --- a/src/main/java/com/chargebee/v4/services/PortalSessionService.java +++ b/src/main/java/com/chargebee/v4/services/PortalSessionService.java @@ -83,6 +83,7 @@ public PortalSessionCreateResponse create(PortalSessionCreateParams params) return PortalSessionCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for portalSession with params. */ public CompletableFuture createAsync( PortalSessionCreateParams params) { @@ -127,6 +128,7 @@ public PortalSessionActivateResponse activate( return PortalSessionActivateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of activate for portalSession with params. */ public CompletableFuture activateAsync( String portalSessionId, PortalSessionActivateParams params) { String path = @@ -152,6 +154,7 @@ public PortalSessionLogoutResponse logout(String portalSessionId) throws Chargeb return PortalSessionLogoutResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of logout for portalSession without params. */ public CompletableFuture logoutAsync(String portalSessionId) { String path = buildPathWithParams( @@ -176,6 +179,7 @@ public PortalSessionRetrieveResponse retrieve(String portalSessionId) throws Cha return PortalSessionRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for portalSession without params. */ public CompletableFuture retrieveAsync(String portalSessionId) { String path = buildPathWithParams( diff --git a/src/main/java/com/chargebee/v4/services/PriceVariantService.java b/src/main/java/com/chargebee/v4/services/PriceVariantService.java index 99c95f1c..da76fa08 100644 --- a/src/main/java/com/chargebee/v4/services/PriceVariantService.java +++ b/src/main/java/com/chargebee/v4/services/PriceVariantService.java @@ -78,6 +78,7 @@ public PriceVariantDeleteResponse delete(String priceVariantId) throws Chargebee return PriceVariantDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for priceVariant without params. */ public CompletableFuture deleteAsync(String priceVariantId) { String path = buildPathWithParams( @@ -112,6 +113,7 @@ public PriceVariantListResponse list(PriceVariantListParams params) throws Charg return PriceVariantListResponse.fromJson(response.getBodyAsString(), this, params, response); } + /** Async variant of list for priceVariant with params. */ public CompletableFuture listAsync(PriceVariantListParams params) { return getAsync("/price_variants", params != null ? params.toQueryParams() : null) @@ -127,6 +129,7 @@ public PriceVariantListResponse list() throws ChargebeeException { return PriceVariantListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for priceVariant without params. */ public CompletableFuture listAsync() { return getAsync("/price_variants", null) @@ -155,6 +158,7 @@ public PriceVariantCreateResponse create(PriceVariantCreateParams params) return PriceVariantCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for priceVariant with params. */ public CompletableFuture createAsync( PriceVariantCreateParams params) { @@ -177,6 +181,7 @@ public PriceVariantRetrieveResponse retrieve(String priceVariantId) throws Charg return PriceVariantRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for priceVariant without params. */ public CompletableFuture retrieveAsync(String priceVariantId) { String path = buildPathWithParams( @@ -220,6 +225,7 @@ public PriceVariantUpdateResponse update(String priceVariantId, PriceVariantUpda return PriceVariantUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for priceVariant with params. */ public CompletableFuture updateAsync( String priceVariantId, PriceVariantUpdateParams params) { String path = @@ -235,6 +241,7 @@ public PriceVariantUpdateResponse update(String priceVariantId) throws Chargebee return PriceVariantUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for priceVariant without params. */ public CompletableFuture updateAsync(String priceVariantId) { String path = buildPathWithParams( diff --git a/src/main/java/com/chargebee/v4/services/PricingPageSessionService.java b/src/main/java/com/chargebee/v4/services/PricingPageSessionService.java index caad8d79..6e2f925b 100644 --- a/src/main/java/com/chargebee/v4/services/PricingPageSessionService.java +++ b/src/main/java/com/chargebee/v4/services/PricingPageSessionService.java @@ -85,6 +85,7 @@ public PricingPageSessionCreateForExistingSubscriptionResponse createForExisting response.getBodyAsString(), response); } + /** Async variant of createForExistingSubscription for pricingPageSession with params. */ public CompletableFuture createForExistingSubscriptionAsync( PricingPageSessionCreateForExistingSubscriptionParams params) { @@ -127,6 +128,7 @@ public PricingPageSessionCreateForNewSubscriptionResponse createForNewSubscripti response.getBodyAsString(), response); } + /** Async variant of createForNewSubscription for pricingPageSession with params. */ public CompletableFuture createForNewSubscriptionAsync(PricingPageSessionCreateForNewSubscriptionParams params) { diff --git a/src/main/java/com/chargebee/v4/services/ProductService.java b/src/main/java/com/chargebee/v4/services/ProductService.java index c2126aa2..1a91f535 100644 --- a/src/main/java/com/chargebee/v4/services/ProductService.java +++ b/src/main/java/com/chargebee/v4/services/ProductService.java @@ -79,6 +79,7 @@ public ProductRetrieveResponse retrieve(String productId) throws ChargebeeExcept return ProductRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for product without params. */ public CompletableFuture retrieveAsync(String productId) { String path = buildPathWithParams("/products/{product-id}", "product-id", productId); @@ -112,6 +113,7 @@ public ProductUpdateResponse update(String productId, ProductUpdateParams params return ProductUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for product with params. */ public CompletableFuture updateAsync( String productId, ProductUpdateParams params) { String path = buildPathWithParams("/products/{product-id}", "product-id", productId); @@ -125,6 +127,7 @@ public ProductUpdateResponse update(String productId) throws ChargebeeException return ProductUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for product without params. */ public CompletableFuture updateAsync(String productId) { String path = buildPathWithParams("/products/{product-id}", "product-id", productId); @@ -145,6 +148,7 @@ public ProductDeleteResponse delete(String productId) throws ChargebeeException return ProductDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for product without params. */ public CompletableFuture deleteAsync(String productId) { String path = buildPathWithParams("/products/{product-id}/delete", "product-id", productId); @@ -186,6 +190,7 @@ public ProductUpdateOptionsResponse updateOptions( return ProductUpdateOptionsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of updateOptions for product with params. */ public CompletableFuture updateOptionsAsync( String productId, ProductUpdateOptionsParams params) { String path = @@ -201,6 +206,7 @@ public ProductUpdateOptionsResponse updateOptions(String productId) throws Charg return ProductUpdateOptionsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of updateOptions for product without params. */ public CompletableFuture updateOptionsAsync(String productId) { String path = buildPathWithParams("/products/{product-id}/update_options", "product-id", productId); @@ -235,6 +241,7 @@ public ProductListResponse list(ProductListParams params) throws ChargebeeExcept return ProductListResponse.fromJson(response.getBodyAsString(), this, params, response); } + /** Async variant of list for product with params. */ public CompletableFuture listAsync(ProductListParams params) { return getAsync("/products", params != null ? params.toQueryParams() : null) @@ -249,6 +256,7 @@ public ProductListResponse list() throws ChargebeeException { return ProductListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for product without params. */ public CompletableFuture listAsync() { return getAsync("/products", null) @@ -275,6 +283,7 @@ public ProductCreateResponse create(ProductCreateParams params) throws Chargebee return ProductCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for product with params. */ public CompletableFuture createAsync(ProductCreateParams params) { return postAsync("/products", params != null ? params.toFormData() : null) diff --git a/src/main/java/com/chargebee/v4/services/PromotionalCreditService.java b/src/main/java/com/chargebee/v4/services/PromotionalCreditService.java index a281d0b7..5e63ba19 100644 --- a/src/main/java/com/chargebee/v4/services/PromotionalCreditService.java +++ b/src/main/java/com/chargebee/v4/services/PromotionalCreditService.java @@ -81,6 +81,7 @@ public PromotionalCreditRetrieveResponse retrieve(String accountCreditId) return PromotionalCreditRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for promotionalCredit without params. */ public CompletableFuture retrieveAsync( String accountCreditId) { String path = @@ -123,6 +124,7 @@ public PromotionalCreditListResponse list(PromotionalCreditListParams params) response.getBodyAsString(), this, params, response); } + /** Async variant of list for promotionalCredit with params. */ public CompletableFuture listAsync( PromotionalCreditListParams params) { @@ -139,6 +141,7 @@ public PromotionalCreditListResponse list() throws ChargebeeException { return PromotionalCreditListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for promotionalCredit without params. */ public CompletableFuture listAsync() { return getAsync("/promotional_credits", null) @@ -173,6 +176,7 @@ public PromotionalCreditDeductResponse deduct(PromotionalCreditDeductParams para return PromotionalCreditDeductResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of deduct for promotionalCredit with params. */ public CompletableFuture deductAsync( PromotionalCreditDeductParams params) { @@ -205,6 +209,7 @@ public PromotionalCreditSetResponse set(PromotionalCreditSetParams params) return PromotionalCreditSetResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of set for promotionalCredit with params. */ public CompletableFuture setAsync( PromotionalCreditSetParams params) { @@ -237,6 +242,7 @@ public PromotionalCreditAddResponse add(PromotionalCreditAddParams params) return PromotionalCreditAddResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of add for promotionalCredit with params. */ public CompletableFuture addAsync( PromotionalCreditAddParams params) { diff --git a/src/main/java/com/chargebee/v4/services/PurchaseService.java b/src/main/java/com/chargebee/v4/services/PurchaseService.java index d3a05a29..c0e87713 100644 --- a/src/main/java/com/chargebee/v4/services/PurchaseService.java +++ b/src/main/java/com/chargebee/v4/services/PurchaseService.java @@ -73,6 +73,7 @@ public PurchaseCreateResponse create(PurchaseCreateParams params) throws Chargeb return PurchaseCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for purchase with params. */ public CompletableFuture createAsync(PurchaseCreateParams params) { return postAsync("/purchases", params != null ? params.toFormData() : null) @@ -99,6 +100,7 @@ public PurchaseEstimateResponse estimate(PurchaseEstimateParams params) return PurchaseEstimateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of estimate for purchase with params. */ public CompletableFuture estimateAsync(PurchaseEstimateParams params) { return postAsync("/purchases/estimate", params != null ? params.toFormData() : null) diff --git a/src/main/java/com/chargebee/v4/services/QuoteService.java b/src/main/java/com/chargebee/v4/services/QuoteService.java index e87e786c..49e88857 100644 --- a/src/main/java/com/chargebee/v4/services/QuoteService.java +++ b/src/main/java/com/chargebee/v4/services/QuoteService.java @@ -175,6 +175,7 @@ public CreateSubscriptionItemsForCustomerQuoteResponse createSubscriptionItemsFo response.getBodyAsString(), response); } + /** Async variant of createSubscriptionItemsForCustomerQuote for quote with params. */ public CompletableFuture createSubscriptionItemsForCustomerQuoteAsync( String customerId, CreateSubscriptionItemsForCustomerQuoteParams params) { @@ -197,6 +198,7 @@ public CreateSubscriptionItemsForCustomerQuoteResponse createSubscriptionItemsFo response.getBodyAsString(), response); } + /** Async variant of createSubscriptionItemsForCustomerQuote for quote without params. */ public CompletableFuture createSubscriptionItemsForCustomerQuoteAsync(String customerId) { String path = @@ -224,6 +226,7 @@ public QuoteRetrieveResponse retrieve(String quoteId) throws ChargebeeException return QuoteRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for quote without params. */ public CompletableFuture retrieveAsync(String quoteId) { String path = buildPathWithParams("/quotes/{quote-id}", "quote-id", quoteId); @@ -279,6 +282,7 @@ Response editCreateSubscriptionCustomerQuoteForItemsRaw(String quoteId, String j response.getBodyAsString(), response); } + /** Async variant of editCreateSubscriptionCustomerQuoteForItems for quote with params. */ public CompletableFuture editCreateSubscriptionCustomerQuoteForItemsAsync( String quoteId, EditCreateSubscriptionCustomerQuoteForItemsParams params) { @@ -299,6 +303,7 @@ Response editCreateSubscriptionCustomerQuoteForItemsRaw(String quoteId, String j response.getBodyAsString(), response); } + /** Async variant of editCreateSubscriptionCustomerQuoteForItems for quote without params. */ public CompletableFuture editCreateSubscriptionCustomerQuoteForItemsAsync(String quoteId) { String path = @@ -338,6 +343,7 @@ public QuoteUpdateStatusResponse updateStatus(String quoteId, QuoteUpdateStatusP return QuoteUpdateStatusResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of updateStatus for quote with params. */ public CompletableFuture updateStatusAsync( String quoteId, QuoteUpdateStatusParams params) { String path = buildPathWithParams("/quotes/{quote-id}/update_status", "quote-id", quoteId); @@ -373,6 +379,7 @@ public UpdateSubscriptionQuoteForItemsResponse updateSubscriptionQuoteForItems( return UpdateSubscriptionQuoteForItemsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of updateSubscriptionQuoteForItems for quote with params. */ public CompletableFuture updateSubscriptionQuoteForItemsAsync(UpdateSubscriptionQuoteForItemsParams params) { @@ -427,6 +434,7 @@ public QuoteLineGroupsForQuoteResponse quoteLineGroupsForQuote(String quoteId) response.getBodyAsString(), this, null, quoteId, response); } + /** Async variant of quoteLineGroupsForQuote for quote with params. */ public CompletableFuture quoteLineGroupsForQuoteAsync( String quoteId, QuoteLineGroupsForQuoteParams params) { String path = buildPathWithParams("/quotes/{quote-id}/quote_line_groups", "quote-id", quoteId); @@ -437,6 +445,7 @@ public CompletableFuture quoteLineGroupsForQuot response.getBodyAsString(), this, params, quoteId, response)); } + /** Async variant of quoteLineGroupsForQuote for quote without params. */ public CompletableFuture quoteLineGroupsForQuoteAsync( String quoteId) { String path = buildPathWithParams("/quotes/{quote-id}/quote_line_groups", "quote-id", quoteId); @@ -477,6 +486,7 @@ public QuoteExtendExpiryDateResponse extendExpiryDate( return QuoteExtendExpiryDateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of extendExpiryDate for quote with params. */ public CompletableFuture extendExpiryDateAsync( String quoteId, QuoteExtendExpiryDateParams params) { String path = buildPathWithParams("/quotes/{quote-id}/extend_expiry_date", "quote-id", quoteId); @@ -525,6 +535,7 @@ public QuoteEditForChargeItemsAndChargesResponse editForChargeItemsAndCharges( return QuoteEditForChargeItemsAndChargesResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of editForChargeItemsAndCharges for quote with params. */ public CompletableFuture editForChargeItemsAndChargesAsync( String quoteId, QuoteEditForChargeItemsAndChargesParams params) { @@ -544,6 +555,7 @@ public QuoteEditForChargeItemsAndChargesResponse editForChargeItemsAndCharges(St return QuoteEditForChargeItemsAndChargesResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of editForChargeItemsAndCharges for quote without params. */ public CompletableFuture editForChargeItemsAndChargesAsync(String quoteId) { String path = @@ -597,6 +609,7 @@ public EditUpdateSubscriptionQuoteForItemsResponse editUpdateSubscriptionQuoteFo response.getBodyAsString(), response); } + /** Async variant of editUpdateSubscriptionQuoteForItems for quote with params. */ public CompletableFuture editUpdateSubscriptionQuoteForItemsAsync( String quoteId, EditUpdateSubscriptionQuoteForItemsParams params) { @@ -617,6 +630,7 @@ public EditUpdateSubscriptionQuoteForItemsResponse editUpdateSubscriptionQuoteFo response.getBodyAsString(), response); } + /** Async variant of editUpdateSubscriptionQuoteForItems for quote without params. */ public CompletableFuture editUpdateSubscriptionQuoteForItemsAsync(String quoteId) { String path = @@ -654,6 +668,7 @@ public QuoteListResponse list(QuoteListParams params) throws ChargebeeException return QuoteListResponse.fromJson(response.getBodyAsString(), this, params, response); } + /** Async variant of list for quote with params. */ public CompletableFuture listAsync(QuoteListParams params) { return getAsync("/quotes", params != null ? params.toQueryParams() : null) @@ -668,6 +683,7 @@ public QuoteListResponse list() throws ChargebeeException { return QuoteListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for quote without params. */ public CompletableFuture listAsync() { return getAsync("/quotes", null) @@ -700,6 +716,7 @@ public QuotePdfResponse pdf(String quoteId, QuotePdfParams params) throws Charge return QuotePdfResponse.fromJson(response.getBodyAsString(), response); } + /** 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()) @@ -711,6 +728,7 @@ public QuotePdfResponse pdf(String quoteId) throws ChargebeeException { return QuotePdfResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of pdf for quote without params. */ public CompletableFuture pdfAsync(String quoteId) { String path = buildPathWithParams("/quotes/{quote-id}/pdf", "quote-id", quoteId); @@ -743,6 +761,7 @@ public QuoteConvertResponse convert(String quoteId, QuoteConvertParams params) return QuoteConvertResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of convert for quote with params. */ public CompletableFuture convertAsync( String quoteId, QuoteConvertParams params) { String path = buildPathWithParams("/quotes/{quote-id}/convert", "quote-id", quoteId); @@ -755,6 +774,7 @@ public QuoteConvertResponse convert(String quoteId) throws ChargebeeException { return QuoteConvertResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of convert for quote without params. */ public CompletableFuture convertAsync(String quoteId) { String path = buildPathWithParams("/quotes/{quote-id}/convert", "quote-id", quoteId); @@ -790,6 +810,7 @@ public QuoteCreateForChargeItemsAndChargesResponse createForChargeItemsAndCharge response.getBodyAsString(), response); } + /** Async variant of createForChargeItemsAndCharges for quote with params. */ public CompletableFuture createForChargeItemsAndChargesAsync(QuoteCreateForChargeItemsAndChargesParams params) { @@ -827,6 +848,7 @@ public QuoteDeleteResponse delete(String quoteId, QuoteDeleteParams params) return QuoteDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for quote with params. */ public CompletableFuture deleteAsync( String quoteId, QuoteDeleteParams params) { String path = buildPathWithParams("/quotes/{quote-id}/delete", "quote-id", quoteId); @@ -839,6 +861,7 @@ public QuoteDeleteResponse delete(String quoteId) throws ChargebeeException { return QuoteDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for quote without params. */ public CompletableFuture deleteAsync(String quoteId) { String path = buildPathWithParams("/quotes/{quote-id}/delete", "quote-id", quoteId); @@ -879,6 +902,7 @@ public EditOneTimeQuoteResponse editOneTimeQuote(String quoteId, EditOneTimeQuot return EditOneTimeQuoteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of editOneTimeQuote for quote with params. */ public CompletableFuture editOneTimeQuoteAsync( String quoteId, EditOneTimeQuoteParams params) { String path = @@ -893,6 +917,7 @@ public EditOneTimeQuoteResponse editOneTimeQuote(String quoteId) throws Chargebe return EditOneTimeQuoteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of editOneTimeQuote for quote without params. */ public CompletableFuture editOneTimeQuoteAsync(String quoteId) { String path = buildPathWithParams("/quotes/{quote-id}/edit_one_time_quote", "quote-id", quoteId); @@ -928,6 +953,7 @@ public UpdateSubscriptionQuoteResponse updateSubscriptionQuote( return UpdateSubscriptionQuoteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of updateSubscriptionQuote for quote with params. */ public CompletableFuture updateSubscriptionQuoteAsync( UpdateSubscriptionQuoteParams params) { @@ -964,6 +990,7 @@ public QuoteCreateForOnetimeChargesResponse createForOnetimeCharges( return QuoteCreateForOnetimeChargesResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of createForOnetimeCharges for quote with params. */ public CompletableFuture createForOnetimeChargesAsync( QuoteCreateForOnetimeChargesParams params) { @@ -1017,6 +1044,7 @@ public CreateSubscriptionForCustomerQuoteResponse createSubscriptionForCustomerQ response.getBodyAsString(), response); } + /** Async variant of createSubscriptionForCustomerQuote for quote with params. */ public CompletableFuture createSubscriptionForCustomerQuoteAsync( String customerId, CreateSubscriptionForCustomerQuoteParams params) { @@ -1037,6 +1065,7 @@ public CreateSubscriptionForCustomerQuoteResponse createSubscriptionForCustomerQ response.getBodyAsString(), response); } + /** Async variant of createSubscriptionForCustomerQuote for quote without params. */ public CompletableFuture createSubscriptionForCustomerQuoteAsync(String customerId) { String path = @@ -1089,6 +1118,7 @@ public EditUpdateSubscriptionQuoteResponse editUpdateSubscriptionQuote( return EditUpdateSubscriptionQuoteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of editUpdateSubscriptionQuote for quote with params. */ public CompletableFuture editUpdateSubscriptionQuoteAsync( String quoteId, EditUpdateSubscriptionQuoteParams params) { String path = @@ -1106,6 +1136,7 @@ public EditUpdateSubscriptionQuoteResponse editUpdateSubscriptionQuote(String qu return EditUpdateSubscriptionQuoteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of editUpdateSubscriptionQuote for quote without params. */ public CompletableFuture editUpdateSubscriptionQuoteAsync( String quoteId) { String path = @@ -1162,6 +1193,7 @@ public EditCreateSubscriptionForCustomerQuoteResponse editCreateSubscriptionForC response.getBodyAsString(), response); } + /** Async variant of editCreateSubscriptionForCustomerQuote for quote with params. */ public CompletableFuture editCreateSubscriptionForCustomerQuoteAsync( String quoteId, EditCreateSubscriptionForCustomerQuoteParams params) { @@ -1182,6 +1214,7 @@ public EditCreateSubscriptionForCustomerQuoteResponse editCreateSubscriptionForC response.getBodyAsString(), response); } + /** Async variant of editCreateSubscriptionForCustomerQuote for quote without params. */ public CompletableFuture editCreateSubscriptionForCustomerQuoteAsync(String quoteId) { String path = diff --git a/src/main/java/com/chargebee/v4/services/RampService.java b/src/main/java/com/chargebee/v4/services/RampService.java index 76636712..8a5e3cda 100644 --- a/src/main/java/com/chargebee/v4/services/RampService.java +++ b/src/main/java/com/chargebee/v4/services/RampService.java @@ -75,6 +75,7 @@ public RampRetrieveResponse retrieve(String rampId) throws ChargebeeException { return RampRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for ramp without params. */ public CompletableFuture retrieveAsync(String rampId) { String path = buildPathWithParams("/ramps/{ramp-id}", "ramp-id", rampId); @@ -121,6 +122,7 @@ public RampCreateForSubscriptionResponse createForSubscription( return RampCreateForSubscriptionResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of createForSubscription for ramp with params. */ public CompletableFuture createForSubscriptionAsync( String subscriptionId, RampCreateForSubscriptionParams params) { String path = @@ -156,6 +158,7 @@ public RampListResponse list(RampListParams params) throws ChargebeeException { return RampListResponse.fromJson(response.getBodyAsString(), this, params, response); } + /** Async variant of list for ramp with params. */ public CompletableFuture listAsync(RampListParams params) { return getAsync("/ramps", params != null ? params.toQueryParams() : null) @@ -170,6 +173,7 @@ public RampListResponse list() throws ChargebeeException { return RampListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for ramp without params. */ public CompletableFuture listAsync() { return getAsync("/ramps", null) @@ -203,6 +207,7 @@ public RampUpdateResponse update(String rampId, RampUpdateParams params) return RampUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** 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()) @@ -221,6 +226,7 @@ public RampDeleteResponse delete(String rampId) throws ChargebeeException { return RampDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for ramp without params. */ public CompletableFuture deleteAsync(String rampId) { String path = buildPathWithParams("/ramps/{ramp-id}/delete", "ramp-id", rampId); diff --git a/src/main/java/com/chargebee/v4/services/RecordedPurchaseService.java b/src/main/java/com/chargebee/v4/services/RecordedPurchaseService.java index c3b29555..b43ea108 100644 --- a/src/main/java/com/chargebee/v4/services/RecordedPurchaseService.java +++ b/src/main/java/com/chargebee/v4/services/RecordedPurchaseService.java @@ -71,6 +71,7 @@ public RecordedPurchaseRetrieveResponse retrieve(String recordedPurchaseId) return RecordedPurchaseRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for recordedPurchase without params. */ public CompletableFuture retrieveAsync( String recordedPurchaseId) { String path = @@ -108,6 +109,7 @@ public RecordedPurchaseCreateResponse create(RecordedPurchaseCreateParams params return RecordedPurchaseCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for recordedPurchase with params. */ public CompletableFuture createAsync( RecordedPurchaseCreateParams params) { diff --git a/src/main/java/com/chargebee/v4/services/ResourceMigrationService.java b/src/main/java/com/chargebee/v4/services/ResourceMigrationService.java index ed5039e0..bafac52e 100644 --- a/src/main/java/com/chargebee/v4/services/ResourceMigrationService.java +++ b/src/main/java/com/chargebee/v4/services/ResourceMigrationService.java @@ -79,6 +79,7 @@ public ResourceMigrationRetrieveLatestResponse retrieveLatest( return ResourceMigrationRetrieveLatestResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieveLatest for resourceMigration with params. */ public CompletableFuture retrieveLatestAsync( ResourceMigrationRetrieveLatestParams params) { diff --git a/src/main/java/com/chargebee/v4/services/RuleService.java b/src/main/java/com/chargebee/v4/services/RuleService.java index e15fad1a..9940ef4b 100644 --- a/src/main/java/com/chargebee/v4/services/RuleService.java +++ b/src/main/java/com/chargebee/v4/services/RuleService.java @@ -61,6 +61,7 @@ public RuleRetrieveResponse retrieve(String ruleId) throws ChargebeeException { return RuleRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for rule without params. */ public CompletableFuture retrieveAsync(String ruleId) { String path = buildPathWithParams("/rules/{rule-id}", "rule-id", ruleId); diff --git a/src/main/java/com/chargebee/v4/services/SiteMigrationDetailService.java b/src/main/java/com/chargebee/v4/services/SiteMigrationDetailService.java index 5d7cc4d2..deff5d62 100644 --- a/src/main/java/com/chargebee/v4/services/SiteMigrationDetailService.java +++ b/src/main/java/com/chargebee/v4/services/SiteMigrationDetailService.java @@ -84,6 +84,7 @@ public SiteMigrationDetailListResponse list(SiteMigrationDetailListParams params response.getBodyAsString(), this, params, response); } + /** Async variant of list for siteMigrationDetail with params. */ public CompletableFuture listAsync( SiteMigrationDetailListParams params) { @@ -101,6 +102,7 @@ public SiteMigrationDetailListResponse list() throws ChargebeeException { response.getBodyAsString(), this, null, response); } + /** Async variant of list for siteMigrationDetail without params. */ public CompletableFuture listAsync() { return getAsync("/site_migration_details", null) diff --git a/src/main/java/com/chargebee/v4/services/SubscriptionEntitlementService.java b/src/main/java/com/chargebee/v4/services/SubscriptionEntitlementService.java index 0c8e6f4c..27ef5826 100644 --- a/src/main/java/com/chargebee/v4/services/SubscriptionEntitlementService.java +++ b/src/main/java/com/chargebee/v4/services/SubscriptionEntitlementService.java @@ -109,6 +109,10 @@ public SetSubscriptionEntitlementAvailabilityResponse setSubscriptionEntitlement response.getBodyAsString(), response); } + /** + * Async variant of setSubscriptionEntitlementAvailability for subscriptionEntitlement with + * params. + */ public CompletableFuture setSubscriptionEntitlementAvailabilityAsync( String subscriptionId, SetSubscriptionEntitlementAvailabilityParams params) { @@ -182,6 +186,10 @@ public SubscriptionEntitlementsForSubscriptionResponse subscriptionEntitlementsF response.getBodyAsString(), this, null, subscriptionId, response); } + /** + * Async variant of subscriptionEntitlementsForSubscription for subscriptionEntitlement with + * params. + */ public CompletableFuture subscriptionEntitlementsForSubscriptionAsync( String subscriptionId, SubscriptionEntitlementsForSubscriptionParams params) { @@ -197,6 +205,10 @@ public SubscriptionEntitlementsForSubscriptionResponse subscriptionEntitlementsF response.getBodyAsString(), this, params, subscriptionId, response)); } + /** + * Async variant of subscriptionEntitlementsForSubscription for subscriptionEntitlement without + * params. + */ public CompletableFuture subscriptionEntitlementsForSubscriptionAsync(String subscriptionId) { String path = diff --git a/src/main/java/com/chargebee/v4/services/SubscriptionService.java b/src/main/java/com/chargebee/v4/services/SubscriptionService.java index 5df73465..083f7564 100644 --- a/src/main/java/com/chargebee/v4/services/SubscriptionService.java +++ b/src/main/java/com/chargebee/v4/services/SubscriptionService.java @@ -230,6 +230,7 @@ public SubscriptionRemoveAdvanceInvoiceScheduleResponse removeAdvanceInvoiceSche response.getBodyAsString(), response); } + /** Async variant of removeAdvanceInvoiceSchedule for subscription with params. */ public CompletableFuture removeAdvanceInvoiceScheduleAsync( String subscriptionId, SubscriptionRemoveAdvanceInvoiceScheduleParams params) { @@ -252,6 +253,7 @@ public SubscriptionRemoveAdvanceInvoiceScheduleResponse removeAdvanceInvoiceSche response.getBodyAsString(), response); } + /** Async variant of removeAdvanceInvoiceSchedule for subscription without params. */ public CompletableFuture removeAdvanceInvoiceScheduleAsync(String subscriptionId) { String path = @@ -305,6 +307,7 @@ public SubscriptionUpdateForItemsResponse updateForItems( return SubscriptionUpdateForItemsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of updateForItems for subscription with params. */ public CompletableFuture updateForItemsAsync( String subscriptionId, SubscriptionUpdateForItemsParams params) { String path = @@ -322,6 +325,7 @@ public SubscriptionUpdateForItemsResponse updateForItems(String subscriptionId) return SubscriptionUpdateForItemsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of updateForItems for subscription without params. */ public CompletableFuture updateForItemsAsync( String subscriptionId) { String path = @@ -372,6 +376,7 @@ public SubscriptionRemoveCouponsResponse removeCoupons( return SubscriptionRemoveCouponsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of removeCoupons for subscription with params. */ public CompletableFuture removeCouponsAsync( String subscriptionId, SubscriptionRemoveCouponsParams params) { String path = @@ -389,6 +394,7 @@ public SubscriptionRemoveCouponsResponse removeCoupons(String subscriptionId) return SubscriptionRemoveCouponsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of removeCoupons for subscription without params. */ public CompletableFuture removeCouponsAsync( String subscriptionId) { String path = @@ -433,6 +439,7 @@ public SubscriptionResumeResponse resume(String subscriptionId, SubscriptionResu return SubscriptionResumeResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of resume for subscription with params. */ public CompletableFuture resumeAsync( String subscriptionId, SubscriptionResumeParams params) { String path = @@ -448,6 +455,7 @@ public SubscriptionResumeResponse resume(String subscriptionId) throws Chargebee return SubscriptionResumeResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of resume for subscription without params. */ public CompletableFuture resumeAsync(String subscriptionId) { String path = buildPathWithParams( @@ -496,6 +504,7 @@ public SubscriptionCancelForItemsResponse cancelForItems( return SubscriptionCancelForItemsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of cancelForItems for subscription with params. */ public CompletableFuture cancelForItemsAsync( String subscriptionId, SubscriptionCancelForItemsParams params) { String path = @@ -513,6 +522,7 @@ public SubscriptionCancelForItemsResponse cancelForItems(String subscriptionId) return SubscriptionCancelForItemsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of cancelForItems for subscription without params. */ public CompletableFuture cancelForItemsAsync( String subscriptionId) { String path = @@ -570,6 +580,7 @@ public SubscriptionRegenerateInvoiceResponse regenerateInvoice( return SubscriptionRegenerateInvoiceResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of regenerateInvoice for subscription with params. */ public CompletableFuture regenerateInvoiceAsync( String subscriptionId, SubscriptionRegenerateInvoiceParams params) { String path = @@ -590,6 +601,7 @@ public SubscriptionRegenerateInvoiceResponse regenerateInvoice(String subscripti return SubscriptionRegenerateInvoiceResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of regenerateInvoice for subscription without params. */ public CompletableFuture regenerateInvoiceAsync( String subscriptionId) { String path = @@ -629,6 +641,7 @@ public SubscriptionListResponse list(SubscriptionListParams params) throws Charg return SubscriptionListResponse.fromJson(response.getBodyAsString(), this, params, response); } + /** Async variant of list for subscription with params. */ public CompletableFuture listAsync(SubscriptionListParams params) { return getAsync("/subscriptions", params != null ? params.toQueryParams() : null) @@ -644,6 +657,7 @@ public SubscriptionListResponse list() throws ChargebeeException { return SubscriptionListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for subscription without params. */ public CompletableFuture listAsync() { return getAsync("/subscriptions", null) @@ -672,6 +686,7 @@ public SubscriptionCreateResponse create(SubscriptionCreateParams params) return SubscriptionCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for subscription with params. */ public CompletableFuture createAsync( SubscriptionCreateParams params) { @@ -711,6 +726,7 @@ public SubscriptionMoveResponse move(String subscriptionId, SubscriptionMovePara return SubscriptionMoveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of move for subscription with params. */ public CompletableFuture moveAsync( String subscriptionId, SubscriptionMoveParams params) { String path = @@ -767,6 +783,7 @@ public SubscriptionsForCustomerResponse subscriptionsForCustomer(String customer response.getBodyAsString(), this, null, customerId, response); } + /** Async variant of subscriptionsForCustomer for subscription with params. */ public CompletableFuture subscriptionsForCustomerAsync( String customerId, SubscriptionsForCustomerParams params) { String path = @@ -778,6 +795,7 @@ public CompletableFuture subscriptionsForCusto response.getBodyAsString(), this, params, customerId, response)); } + /** Async variant of subscriptionsForCustomer for subscription without params. */ public CompletableFuture subscriptionsForCustomerAsync( String customerId) { String path = @@ -824,6 +842,7 @@ public SubscriptionCreateForCustomerResponse createForCustomer( return SubscriptionCreateForCustomerResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of createForCustomer for subscription with params. */ public CompletableFuture createForCustomerAsync( String customerId, SubscriptionCreateForCustomerParams params) { String path = @@ -870,6 +889,7 @@ public SubscriptionImportForItemsResponse importForItems( return SubscriptionImportForItemsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of importForItems for subscription with params. */ public CompletableFuture importForItemsAsync( String customerId, SubscriptionImportForItemsParams params) { String path = @@ -900,6 +920,7 @@ public SubscriptionRetrieveAdvanceInvoiceScheduleResponse retrieveAdvanceInvoice response.getBodyAsString(), response); } + /** Async variant of retrieveAdvanceInvoiceSchedule for subscription without params. */ public CompletableFuture retrieveAdvanceInvoiceScheduleAsync(String subscriptionId) { String path = @@ -963,6 +984,7 @@ public SubscriptionRemoveScheduledCancellationResponse removeScheduledCancellati response.getBodyAsString(), response); } + /** Async variant of removeScheduledCancellation for subscription with params. */ public CompletableFuture removeScheduledCancellationAsync( String subscriptionId, SubscriptionRemoveScheduledCancellationParams params) { @@ -985,6 +1007,7 @@ public SubscriptionRemoveScheduledCancellationResponse removeScheduledCancellati response.getBodyAsString(), response); } + /** Async variant of removeScheduledCancellation for subscription without params. */ public CompletableFuture removeScheduledCancellationAsync(String subscriptionId) { String path = @@ -1018,6 +1041,7 @@ public SubscriptionRetrieveWithScheduledChangesResponse retrieveWithScheduledCha response.getBodyAsString(), response); } + /** Async variant of retrieveWithScheduledChanges for subscription without params. */ public CompletableFuture retrieveWithScheduledChangesAsync(String subscriptionId) { String path = @@ -1069,6 +1093,7 @@ public SubscriptionReactivateResponse reactivate( return SubscriptionReactivateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of reactivate for subscription with params. */ public CompletableFuture reactivateAsync( String subscriptionId, SubscriptionReactivateParams params) { String path = @@ -1086,6 +1111,7 @@ public SubscriptionReactivateResponse reactivate(String subscriptionId) return SubscriptionReactivateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of reactivate for subscription without params. */ public CompletableFuture reactivateAsync(String subscriptionId) { String path = buildPathWithParams( @@ -1144,6 +1170,7 @@ public SubscriptionChargeFutureRenewalsResponse chargeFutureRenewals( return SubscriptionChargeFutureRenewalsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of chargeFutureRenewals for subscription with params. */ public CompletableFuture chargeFutureRenewalsAsync( String subscriptionId, SubscriptionChargeFutureRenewalsParams params) { String path = @@ -1164,6 +1191,7 @@ public SubscriptionChargeFutureRenewalsResponse chargeFutureRenewals(String subs return SubscriptionChargeFutureRenewalsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of chargeFutureRenewals for subscription without params. */ public CompletableFuture chargeFutureRenewalsAsync( String subscriptionId) { String path = @@ -1225,6 +1253,7 @@ public SubscriptionAddChargeAtTermEndResponse addChargeAtTermEnd( return SubscriptionAddChargeAtTermEndResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of addChargeAtTermEnd for subscription with params. */ public CompletableFuture addChargeAtTermEndAsync( String subscriptionId, SubscriptionAddChargeAtTermEndParams params) { String path = @@ -1257,6 +1286,7 @@ public SubscriptionRemoveScheduledChangesResponse removeScheduledChanges(String response.getBodyAsString(), response); } + /** Async variant of removeScheduledChanges for subscription without params. */ public CompletableFuture removeScheduledChangesAsync( String subscriptionId) { String path = @@ -1310,6 +1340,7 @@ public SubscriptionChangeTermEndResponse changeTermEnd( return SubscriptionChangeTermEndResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of changeTermEnd for subscription with params. */ public CompletableFuture changeTermEndAsync( String subscriptionId, SubscriptionChangeTermEndParams params) { String path = @@ -1335,6 +1366,7 @@ public SubscriptionDeleteResponse delete(String subscriptionId) throws Chargebee return SubscriptionDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for subscription without params. */ public CompletableFuture deleteAsync(String subscriptionId) { String path = buildPathWithParams( @@ -1383,6 +1415,7 @@ public SubscriptionCreateWithItemsResponse createWithItems( return SubscriptionCreateWithItemsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of createWithItems for subscription with params. */ public CompletableFuture createWithItemsAsync( String customerId, SubscriptionCreateWithItemsParams params) { String path = @@ -1400,6 +1433,7 @@ public SubscriptionCreateWithItemsResponse createWithItems(String customerId) return SubscriptionCreateWithItemsResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of createWithItems for subscription without params. */ public CompletableFuture createWithItemsAsync( String customerId) { String path = @@ -1459,6 +1493,7 @@ public SubscriptionImportUnbilledChargesResponse importUnbilledCharges( return SubscriptionImportUnbilledChargesResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of importUnbilledCharges for subscription with params. */ public CompletableFuture importUnbilledChargesAsync( String subscriptionId, SubscriptionImportUnbilledChargesParams params) { String path = @@ -1479,6 +1514,7 @@ public SubscriptionImportUnbilledChargesResponse importUnbilledCharges(String su return SubscriptionImportUnbilledChargesResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of importUnbilledCharges for subscription without params. */ public CompletableFuture importUnbilledChargesAsync( String subscriptionId) { String path = @@ -1512,6 +1548,7 @@ public SubscriptionRemoveScheduledResumptionResponse removeScheduledResumption( response.getBodyAsString(), response); } + /** Async variant of removeScheduledResumption for subscription without params. */ public CompletableFuture removeScheduledResumptionAsync(String subscriptionId) { String path = @@ -1540,6 +1577,7 @@ public SubscriptionRetrieveResponse retrieve(String subscriptionId) throws Charg return SubscriptionRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for subscription without params. */ public CompletableFuture retrieveAsync(String subscriptionId) { String path = buildPathWithParams("/subscriptions/{subscription-id}", "subscription-id", subscriptionId); @@ -1579,6 +1617,7 @@ public SubscriptionUpdateResponse update(String subscriptionId, SubscriptionUpda return SubscriptionUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for subscription with params. */ public CompletableFuture updateAsync( String subscriptionId, SubscriptionUpdateParams params) { String path = @@ -1593,6 +1632,7 @@ public SubscriptionUpdateResponse update(String subscriptionId) throws Chargebee return SubscriptionUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for subscription without params. */ public CompletableFuture updateAsync(String subscriptionId) { String path = buildPathWithParams("/subscriptions/{subscription-id}", "subscription-id", subscriptionId); @@ -1648,6 +1688,7 @@ public SubscriptionImportContractTermResponse importContractTerm( return SubscriptionImportContractTermResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of importContractTerm for subscription with params. */ public CompletableFuture importContractTermAsync( String subscriptionId, SubscriptionImportContractTermParams params) { String path = @@ -1668,6 +1709,7 @@ public SubscriptionImportContractTermResponse importContractTerm(String subscrip return SubscriptionImportContractTermResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of importContractTerm for subscription without params. */ public CompletableFuture importContractTermAsync( String subscriptionId) { String path = @@ -1731,6 +1773,7 @@ public SubscriptionOverrideBillingProfileResponse overrideBillingProfile( response.getBodyAsString(), response); } + /** Async variant of overrideBillingProfile for subscription with params. */ public CompletableFuture overrideBillingProfileAsync( String subscriptionId, SubscriptionOverrideBillingProfileParams params) { String path = @@ -1752,6 +1795,7 @@ public SubscriptionOverrideBillingProfileResponse overrideBillingProfile(String response.getBodyAsString(), response); } + /** Async variant of overrideBillingProfile for subscription without params. */ public CompletableFuture overrideBillingProfileAsync( String subscriptionId) { String path = @@ -1784,6 +1828,7 @@ public SubscriptionRemoveScheduledPauseResponse removeScheduledPause(String subs return SubscriptionRemoveScheduledPauseResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of removeScheduledPause for subscription without params. */ public CompletableFuture removeScheduledPauseAsync( String subscriptionId) { String path = @@ -1847,6 +1892,7 @@ public SubscriptionEditAdvanceInvoiceScheduleResponse editAdvanceInvoiceSchedule response.getBodyAsString(), response); } + /** Async variant of editAdvanceInvoiceSchedule for subscription with params. */ public CompletableFuture editAdvanceInvoiceScheduleAsync( String subscriptionId, SubscriptionEditAdvanceInvoiceScheduleParams params) { @@ -1869,6 +1915,7 @@ public SubscriptionEditAdvanceInvoiceScheduleResponse editAdvanceInvoiceSchedule response.getBodyAsString(), response); } + /** Async variant of editAdvanceInvoiceSchedule for subscription without params. */ public CompletableFuture editAdvanceInvoiceScheduleAsync(String subscriptionId) { String path = @@ -1929,6 +1976,7 @@ public SubscriptionListDiscountsResponse listDiscounts(String subscriptionId) response.getBodyAsString(), this, null, subscriptionId, response); } + /** Async variant of listDiscounts for subscription with params. */ public CompletableFuture listDiscountsAsync( String subscriptionId, SubscriptionListDiscountsParams params) { String path = @@ -1941,6 +1989,7 @@ public CompletableFuture listDiscountsAsync( response.getBodyAsString(), this, params, subscriptionId, response)); } + /** Async variant of listDiscounts for subscription without params. */ public CompletableFuture listDiscountsAsync( String subscriptionId) { String path = @@ -2002,6 +2051,7 @@ public ContractTermsForSubscriptionResponse contractTermsForSubscription(String response.getBodyAsString(), this, null, subscriptionId, response); } + /** Async variant of contractTermsForSubscription for subscription with params. */ public CompletableFuture contractTermsForSubscriptionAsync( String subscriptionId, ContractTermsForSubscriptionParams params) { String path = @@ -2014,6 +2064,7 @@ public CompletableFuture contractTermsForS response.getBodyAsString(), this, params, subscriptionId, response)); } + /** Async variant of contractTermsForSubscription for subscription without params. */ public CompletableFuture contractTermsForSubscriptionAsync( String subscriptionId) { String path = @@ -2058,6 +2109,7 @@ public SubscriptionPauseResponse pause(String subscriptionId, SubscriptionPauseP return SubscriptionPauseResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of pause for subscription with params. */ public CompletableFuture pauseAsync( String subscriptionId, SubscriptionPauseParams params) { String path = @@ -2073,6 +2125,7 @@ public SubscriptionPauseResponse pause(String subscriptionId) throws ChargebeeEx return SubscriptionPauseResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of pause for subscription without params. */ public CompletableFuture pauseAsync(String subscriptionId) { String path = buildPathWithParams( @@ -2121,6 +2174,7 @@ public SubscriptionImportForCustomerResponse importForCustomer( return SubscriptionImportForCustomerResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of importForCustomer for subscription with params. */ public CompletableFuture importForCustomerAsync( String customerId, SubscriptionImportForCustomerParams params) { String path = @@ -2158,6 +2212,7 @@ public ImportSubscriptionResponse importSubscription(ImportSubscriptionParams pa return ImportSubscriptionResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of importSubscription for subscription with params. */ public CompletableFuture importSubscriptionAsync( ImportSubscriptionParams params) { @@ -2199,6 +2254,7 @@ public SubscriptionCancelResponse cancel(String subscriptionId, SubscriptionCanc return SubscriptionCancelResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of cancel for subscription with params. */ public CompletableFuture cancelAsync( String subscriptionId, SubscriptionCancelParams params) { String path = @@ -2214,6 +2270,7 @@ public SubscriptionCancelResponse cancel(String subscriptionId) throws Chargebee return SubscriptionCancelResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of cancel for subscription without params. */ public CompletableFuture cancelAsync(String subscriptionId) { String path = buildPathWithParams( @@ -2271,6 +2328,7 @@ public SubscriptionChargeAddonAtTermEndResponse chargeAddonAtTermEnd( return SubscriptionChargeAddonAtTermEndResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of chargeAddonAtTermEnd for subscription with params. */ public CompletableFuture chargeAddonAtTermEndAsync( String subscriptionId, SubscriptionChargeAddonAtTermEndParams params) { String path = diff --git a/src/main/java/com/chargebee/v4/services/SubscriptionSettingService.java b/src/main/java/com/chargebee/v4/services/SubscriptionSettingService.java index 850eec49..05922cf0 100644 --- a/src/main/java/com/chargebee/v4/services/SubscriptionSettingService.java +++ b/src/main/java/com/chargebee/v4/services/SubscriptionSettingService.java @@ -85,6 +85,7 @@ public SubscriptionSettingRetrieveResponse retrieve(SubscriptionSettingRetrieveP return SubscriptionSettingRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for subscriptionSetting with params. */ public CompletableFuture retrieveAsync( SubscriptionSettingRetrieveParams params) { @@ -101,6 +102,7 @@ public SubscriptionSettingRetrieveResponse retrieve() throws ChargebeeException return SubscriptionSettingRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for subscriptionSetting without params. */ public CompletableFuture retrieveAsync() { return getAsync("/subscription_settings/retrieve", null) diff --git a/src/main/java/com/chargebee/v4/services/ThirdPartyConfigurationService.java b/src/main/java/com/chargebee/v4/services/ThirdPartyConfigurationService.java index 6cb85777..22ec1b12 100644 --- a/src/main/java/com/chargebee/v4/services/ThirdPartyConfigurationService.java +++ b/src/main/java/com/chargebee/v4/services/ThirdPartyConfigurationService.java @@ -90,6 +90,7 @@ public ThirdPartyConfigurationConfigurationsResponse configurations( response.getBodyAsString(), response); } + /** Async variant of configurations for thirdPartyConfiguration with params. */ public CompletableFuture configurationsAsync( ThirdPartyConfigurationConfigurationsParams params) { @@ -127,6 +128,7 @@ public ThirdPartyConfigurationRetrieveResponse retrieve( return ThirdPartyConfigurationRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for thirdPartyConfiguration with params. */ public CompletableFuture retrieveAsync( ThirdPartyConfigurationRetrieveParams params) { @@ -162,6 +164,7 @@ public ThirdPartyConfigurationUpdateResponse update(ThirdPartyConfigurationUpdat return ThirdPartyConfigurationUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for thirdPartyConfiguration with params. */ public CompletableFuture updateAsync( ThirdPartyConfigurationUpdateParams params) { diff --git a/src/main/java/com/chargebee/v4/services/ThirdPartyEntityMappingService.java b/src/main/java/com/chargebee/v4/services/ThirdPartyEntityMappingService.java index 96c341df..983d6bdc 100644 --- a/src/main/java/com/chargebee/v4/services/ThirdPartyEntityMappingService.java +++ b/src/main/java/com/chargebee/v4/services/ThirdPartyEntityMappingService.java @@ -93,6 +93,7 @@ public ThirdPartyEntityMappingRetrieveEntityResponse retrieveEntity( response.getBodyAsString(), response); } + /** Async variant of retrieveEntity for thirdPartyEntityMapping with params. */ public CompletableFuture retrieveEntityAsync( ThirdPartyEntityMappingRetrieveEntityParams params) { @@ -130,6 +131,7 @@ public ThirdPartyEntityMappingListAllResponse listAll(ThirdPartyEntityMappingLis return ThirdPartyEntityMappingListAllResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of listAll for thirdPartyEntityMapping with params. */ public CompletableFuture listAllAsync( ThirdPartyEntityMappingListAllParams params) { @@ -169,6 +171,7 @@ public ThirdPartyEntityMappingUpdateEntityResponse updateEntity( response.getBodyAsString(), response); } + /** Async variant of updateEntity for thirdPartyEntityMapping with params. */ public CompletableFuture updateEntityAsync( ThirdPartyEntityMappingUpdateEntityParams params) { @@ -215,6 +218,7 @@ public ThirdPartyEntityMappingListResponse list(ThirdPartyEntityMappingListParam response.getBodyAsString(), this, params, response); } + /** Async variant of list for thirdPartyEntityMapping with params. */ public CompletableFuture listAsync( ThirdPartyEntityMappingListParams params) { @@ -232,6 +236,7 @@ public ThirdPartyEntityMappingListResponse list() throws ChargebeeException { response.getBodyAsString(), this, null, response); } + /** Async variant of list for thirdPartyEntityMapping without params. */ public CompletableFuture listAsync() { return getAsync("/third_party_entity_mappings", null) diff --git a/src/main/java/com/chargebee/v4/services/ThirdPartySyncDetailService.java b/src/main/java/com/chargebee/v4/services/ThirdPartySyncDetailService.java index 22e16293..e1b4ff6f 100644 --- a/src/main/java/com/chargebee/v4/services/ThirdPartySyncDetailService.java +++ b/src/main/java/com/chargebee/v4/services/ThirdPartySyncDetailService.java @@ -79,6 +79,7 @@ public ThirdPartySyncDetailRetrieveResponse retrieve(String tpIntegSyncDetailId) return ThirdPartySyncDetailRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for thirdPartySyncDetail without params. */ public CompletableFuture retrieveAsync( String tpIntegSyncDetailId) { String path = @@ -139,6 +140,7 @@ public ThirdPartySyncDetailUpdateResponse update( return ThirdPartySyncDetailUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for thirdPartySyncDetail with params. */ public CompletableFuture updateAsync( String tpIntegSyncDetailId, ThirdPartySyncDetailUpdateParams params) { String path = @@ -177,6 +179,7 @@ public ThirdPartySyncDetailCreateResponse create(ThirdPartySyncDetailCreateParam return ThirdPartySyncDetailCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for thirdPartySyncDetail with params. */ public CompletableFuture createAsync( ThirdPartySyncDetailCreateParams params) { @@ -224,6 +227,7 @@ public ThirdPartySyncDetailRetrieveLatestSyncResponse retrieveLatestSync( response.getBodyAsString(), response); } + /** Async variant of retrieveLatestSync for thirdPartySyncDetail with params. */ public CompletableFuture retrieveLatestSyncAsync( ThirdPartySyncDetailRetrieveLatestSyncParams params) { @@ -244,6 +248,7 @@ public ThirdPartySyncDetailRetrieveLatestSyncResponse retrieveLatestSync() response.getBodyAsString(), response); } + /** Async variant of retrieveLatestSync for thirdPartySyncDetail without params. */ public CompletableFuture retrieveLatestSyncAsync() { diff --git a/src/main/java/com/chargebee/v4/services/TimeMachineService.java b/src/main/java/com/chargebee/v4/services/TimeMachineService.java index 7213d7cd..13cc8ad9 100644 --- a/src/main/java/com/chargebee/v4/services/TimeMachineService.java +++ b/src/main/java/com/chargebee/v4/services/TimeMachineService.java @@ -77,6 +77,7 @@ public TimeMachineRetrieveResponse retrieve(String timeMachineName) throws Charg return TimeMachineRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for timeMachine without params. */ public CompletableFuture retrieveAsync(String timeMachineName) { String path = buildPathWithParams( @@ -131,6 +132,7 @@ public TimeMachineTravelForwardResponse travelForward( return TimeMachineTravelForwardResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of travelForward for timeMachine with params. */ public CompletableFuture travelForwardAsync( String timeMachineName, TimeMachineTravelForwardParams params) { String path = @@ -150,6 +152,7 @@ public TimeMachineTravelForwardResponse travelForward(String timeMachineName) return TimeMachineTravelForwardResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of travelForward for timeMachine without params. */ public CompletableFuture travelForwardAsync( String timeMachineName) { String path = @@ -206,6 +209,7 @@ public TimeMachineStartAfreshResponse startAfresh( return TimeMachineStartAfreshResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of startAfresh for timeMachine with params. */ public CompletableFuture startAfreshAsync( String timeMachineName, TimeMachineStartAfreshParams params) { String path = @@ -225,6 +229,7 @@ public TimeMachineStartAfreshResponse startAfresh(String timeMachineName) return TimeMachineStartAfreshResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of startAfresh for timeMachine without params. */ public CompletableFuture startAfreshAsync( String timeMachineName) { String path = diff --git a/src/main/java/com/chargebee/v4/services/TpSiteUserService.java b/src/main/java/com/chargebee/v4/services/TpSiteUserService.java index dbf6210b..4630c1b5 100644 --- a/src/main/java/com/chargebee/v4/services/TpSiteUserService.java +++ b/src/main/java/com/chargebee/v4/services/TpSiteUserService.java @@ -107,6 +107,7 @@ public UsersForTpSiteUserResponse usersForTpSiteUser(String tpSiteUserDomain) response.getBodyAsString(), this, null, tpSiteUserDomain, response); } + /** Async variant of usersForTpSiteUser for tpSiteUser with params. */ public CompletableFuture usersForTpSiteUserAsync( String tpSiteUserDomain, UsersForTpSiteUserParams params) { String path = @@ -119,6 +120,7 @@ public CompletableFuture usersForTpSiteUserAsync( response.getBodyAsString(), this, params, tpSiteUserDomain, response)); } + /** Async variant of usersForTpSiteUser for tpSiteUser without params. */ public CompletableFuture usersForTpSiteUserAsync( String tpSiteUserDomain) { String path = @@ -156,6 +158,7 @@ public TpSiteUserPayNowEnableLiveResponse payNowEnableLive( return TpSiteUserPayNowEnableLiveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of payNowEnableLive for tpSiteUser with params. */ public CompletableFuture payNowEnableLiveAsync( TpSiteUserPayNowEnableLiveParams params) { @@ -214,6 +217,7 @@ public GuestsForTpSiteUserResponse guestsForTpSiteUser(String tpSiteUserDomain) response.getBodyAsString(), this, null, tpSiteUserDomain, response); } + /** Async variant of guestsForTpSiteUser for tpSiteUser with params. */ public CompletableFuture guestsForTpSiteUserAsync( String tpSiteUserDomain, GuestsForTpSiteUserParams params) { String path = @@ -226,6 +230,7 @@ public CompletableFuture guestsForTpSiteUserAsync( response.getBodyAsString(), this, params, tpSiteUserDomain, response)); } + /** Async variant of guestsForTpSiteUser for tpSiteUser without params. */ public CompletableFuture guestsForTpSiteUserAsync( String tpSiteUserDomain) { String path = diff --git a/src/main/java/com/chargebee/v4/services/TransactionService.java b/src/main/java/com/chargebee/v4/services/TransactionService.java index 365a1b4d..42d48923 100644 --- a/src/main/java/com/chargebee/v4/services/TransactionService.java +++ b/src/main/java/com/chargebee/v4/services/TransactionService.java @@ -113,6 +113,7 @@ public TransactionListResponse list(TransactionListParams params) throws Chargeb return TransactionListResponse.fromJson(response.getBodyAsString(), this, params, response); } + /** Async variant of list for transaction with params. */ public CompletableFuture listAsync(TransactionListParams params) { return getAsync("/transactions", params != null ? params.toQueryParams() : null) @@ -128,6 +129,7 @@ public TransactionListResponse list() throws ChargebeeException { return TransactionListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for transaction without params. */ public CompletableFuture listAsync() { return getAsync("/transactions", null) @@ -172,6 +174,7 @@ public TransactionReconcileResponse reconcile( return TransactionReconcileResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of reconcile for transaction with params. */ public CompletableFuture reconcileAsync( String transactionId, TransactionReconcileParams params) { String path = @@ -188,6 +191,7 @@ public TransactionReconcileResponse reconcile(String transactionId) throws Charg return TransactionReconcileResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of reconcile for transaction without params. */ public CompletableFuture reconcileAsync(String transactionId) { String path = buildPathWithParams( @@ -212,6 +216,7 @@ public TransactionRetrieveResponse retrieve(String transactionId) throws Chargeb return TransactionRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for transaction without params. */ public CompletableFuture retrieveAsync(String transactionId) { String path = buildPathWithParams("/transactions/{transaction-id}", "transaction-id", transactionId); @@ -253,6 +258,7 @@ public TransactionRefundResponse refund(String transactionId, TransactionRefundP return TransactionRefundResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of refund for transaction with params. */ public CompletableFuture refundAsync( String transactionId, TransactionRefundParams params) { String path = @@ -268,6 +274,7 @@ public TransactionRefundResponse refund(String transactionId) throws ChargebeeEx return TransactionRefundResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of refund for transaction without params. */ public CompletableFuture refundAsync(String transactionId) { String path = buildPathWithParams( @@ -324,6 +331,7 @@ public TransactionsForCustomerResponse transactionsForCustomer(String customerId response.getBodyAsString(), this, null, customerId, response); } + /** Async variant of transactionsForCustomer for transaction with params. */ public CompletableFuture transactionsForCustomerAsync( String customerId, TransactionsForCustomerParams params) { String path = @@ -335,6 +343,7 @@ public CompletableFuture transactionsForCustome response.getBodyAsString(), this, params, customerId, response)); } + /** Async variant of transactionsForCustomer for transaction without params. */ public CompletableFuture transactionsForCustomerAsync( String customerId) { String path = @@ -384,6 +393,7 @@ public TransactionRecordRefundResponse recordRefund( return TransactionRecordRefundResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of recordRefund for transaction with params. */ public CompletableFuture recordRefundAsync( String transactionId, TransactionRecordRefundParams params) { String path = @@ -444,6 +454,7 @@ public TransactionsForSubscriptionResponse transactionsForSubscription(String su response.getBodyAsString(), this, null, subscriptionId, response); } + /** Async variant of transactionsForSubscription for transaction with params. */ public CompletableFuture transactionsForSubscriptionAsync( String subscriptionId, TransactionsForSubscriptionParams params) { String path = @@ -456,6 +467,7 @@ public CompletableFuture transactionsForSub response.getBodyAsString(), this, params, subscriptionId, response)); } + /** Async variant of transactionsForSubscription for transaction without params. */ public CompletableFuture transactionsForSubscriptionAsync( String subscriptionId) { String path = @@ -481,6 +493,7 @@ public VoidTransactionResponse voidTransaction(String transactionId) throws Char return VoidTransactionResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of voidTransaction for transaction without params. */ public CompletableFuture voidTransactionAsync(String transactionId) { String path = buildPathWithParams("/transactions/{transaction-id}/void", "transaction-id", transactionId); @@ -503,6 +516,7 @@ public SyncTransactionResponse syncTransaction(String transactionId) throws Char return SyncTransactionResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of syncTransaction for transaction without params. */ public CompletableFuture syncTransactionAsync(String transactionId) { String path = buildPathWithParams("/transactions/{transaction-id}/sync", "transaction-id", transactionId); @@ -538,6 +552,7 @@ public TransactionCreateAuthorizationResponse createAuthorization( return TransactionCreateAuthorizationResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of createAuthorization for transaction with params. */ public CompletableFuture createAuthorizationAsync( TransactionCreateAuthorizationParams params) { @@ -590,6 +605,7 @@ public TransactionPaymentsForInvoiceResponse paymentsForInvoice(String invoiceId response.getBodyAsString(), this, null, invoiceId, response); } + /** Async variant of paymentsForInvoice for transaction with params. */ public CompletableFuture paymentsForInvoiceAsync( String invoiceId, TransactionPaymentsForInvoiceParams params) { String path = buildPathWithParams("/invoices/{invoice-id}/payments", "invoice-id", invoiceId); @@ -600,6 +616,7 @@ public CompletableFuture paymentsForInvoi response.getBodyAsString(), this, params, invoiceId, response)); } + /** Async variant of paymentsForInvoice for transaction without params. */ public CompletableFuture paymentsForInvoiceAsync( String invoiceId) { String path = buildPathWithParams("/invoices/{invoice-id}/payments", "invoice-id", invoiceId); @@ -655,6 +672,7 @@ public DeleteOfflineTransactionResponse deleteOfflineTransaction( return DeleteOfflineTransactionResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of deleteOfflineTransaction for transaction with params. */ public CompletableFuture deleteOfflineTransactionAsync( String transactionId, DeleteOfflineTransactionParams params) { String path = @@ -674,6 +692,7 @@ public DeleteOfflineTransactionResponse deleteOfflineTransaction(String transact return DeleteOfflineTransactionResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of deleteOfflineTransaction for transaction without params. */ public CompletableFuture deleteOfflineTransactionAsync( String transactionId) { String path = diff --git a/src/main/java/com/chargebee/v4/services/UnbilledChargeService.java b/src/main/java/com/chargebee/v4/services/UnbilledChargeService.java index 6d43d279..17eb874a 100644 --- a/src/main/java/com/chargebee/v4/services/UnbilledChargeService.java +++ b/src/main/java/com/chargebee/v4/services/UnbilledChargeService.java @@ -86,6 +86,7 @@ public UnbilledChargeDeleteResponse delete(String unbilledChargeId) throws Charg return UnbilledChargeDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for unbilledCharge without params. */ public CompletableFuture deleteAsync(String unbilledChargeId) { String path = buildPathWithParams( @@ -126,6 +127,7 @@ public UnbilledChargeInvoiceNowEstimateResponse invoiceNowEstimate( return UnbilledChargeInvoiceNowEstimateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of invoiceNowEstimate for unbilledCharge with params. */ public CompletableFuture invoiceNowEstimateAsync( UnbilledChargeInvoiceNowEstimateParams params) { @@ -164,6 +166,7 @@ public InvoiceUnbilledChargesResponse invoiceUnbilledCharges(InvoiceUnbilledChar return InvoiceUnbilledChargesResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of invoiceUnbilledCharges for unbilledCharge with params. */ public CompletableFuture invoiceUnbilledChargesAsync( InvoiceUnbilledChargesParams params) { @@ -200,6 +203,7 @@ public UnbilledChargeListResponse list(UnbilledChargeListParams params) return UnbilledChargeListResponse.fromJson(response.getBodyAsString(), this, params, response); } + /** Async variant of list for unbilledCharge with params. */ public CompletableFuture listAsync(UnbilledChargeListParams params) { return getAsync("/unbilled_charges", params != null ? params.toQueryParams() : null) @@ -215,6 +219,7 @@ public UnbilledChargeListResponse list() throws ChargebeeException { return UnbilledChargeListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for unbilledCharge without params. */ public CompletableFuture listAsync() { return getAsync("/unbilled_charges", null) @@ -247,6 +252,7 @@ public UnbilledChargeCreateResponse create(UnbilledChargeCreateParams params) return UnbilledChargeCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for unbilledCharge with params. */ public CompletableFuture createAsync( UnbilledChargeCreateParams params) { @@ -281,6 +287,7 @@ public CreateUnbilledChargeResponse createUnbilledCharge(CreateUnbilledChargePar return CreateUnbilledChargeResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of createUnbilledCharge for unbilledCharge with params. */ public CompletableFuture createUnbilledChargeAsync( CreateUnbilledChargeParams params) { diff --git a/src/main/java/com/chargebee/v4/services/UnbilledChargesSettingService.java b/src/main/java/com/chargebee/v4/services/UnbilledChargesSettingService.java index a5c49304..576c5e57 100644 --- a/src/main/java/com/chargebee/v4/services/UnbilledChargesSettingService.java +++ b/src/main/java/com/chargebee/v4/services/UnbilledChargesSettingService.java @@ -86,6 +86,7 @@ public UnbilledChargesSettingRetrieveResponse retrieve( return UnbilledChargesSettingRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for unbilledChargesSetting with params. */ public CompletableFuture retrieveAsync( UnbilledChargesSettingRetrieveParams params) { @@ -102,6 +103,7 @@ public UnbilledChargesSettingRetrieveResponse retrieve() throws ChargebeeExcepti return UnbilledChargesSettingRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for unbilledChargesSetting without params. */ public CompletableFuture retrieveAsync() { return getAsync("/unbilled_charges_settings", null) diff --git a/src/main/java/com/chargebee/v4/services/UsageEventService.java b/src/main/java/com/chargebee/v4/services/UsageEventService.java index efd5ba6f..11725aca 100644 --- a/src/main/java/com/chargebee/v4/services/UsageEventService.java +++ b/src/main/java/com/chargebee/v4/services/UsageEventService.java @@ -78,6 +78,7 @@ public UsageEventCreateResponse create(UsageEventCreateParams params) throws Cha return UsageEventCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for usageEvent with params. */ public CompletableFuture createAsync(UsageEventCreateParams params) { return postJsonWithSubDomainAsync( @@ -114,6 +115,7 @@ public UsageEventBatchIngestResponse batchIngest(UsageEventBatchIngestParams par return UsageEventBatchIngestResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of batchIngest for usageEvent with params. */ public CompletableFuture batchIngestAsync( UsageEventBatchIngestParams params) { diff --git a/src/main/java/com/chargebee/v4/services/UsageFileService.java b/src/main/java/com/chargebee/v4/services/UsageFileService.java index 3e037508..bda60e5c 100644 --- a/src/main/java/com/chargebee/v4/services/UsageFileService.java +++ b/src/main/java/com/chargebee/v4/services/UsageFileService.java @@ -70,6 +70,7 @@ public UsageFileProcessingStatusResponse processingStatus(String usageFileId) return UsageFileProcessingStatusResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of processingStatus for usageFile without params. */ public CompletableFuture processingStatusAsync( String usageFileId) { String path = @@ -105,6 +106,7 @@ public UsageFileUploadUrlResponse uploadUrl(UsageFileUploadUrlParams params) return UsageFileUploadUrlResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of uploadUrl for usageFile with params. */ public CompletableFuture uploadUrlAsync( UsageFileUploadUrlParams params) { diff --git a/src/main/java/com/chargebee/v4/services/UsageService.java b/src/main/java/com/chargebee/v4/services/UsageService.java index e8ca39da..43a1271f 100644 --- a/src/main/java/com/chargebee/v4/services/UsageService.java +++ b/src/main/java/com/chargebee/v4/services/UsageService.java @@ -85,6 +85,7 @@ public UsagePdfResponse pdf(UsagePdfParams params) throws ChargebeeException { return UsagePdfResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of pdf for usage with params. */ public CompletableFuture pdfAsync(UsagePdfParams params) { return postAsync("/usages/pdf", params != null ? params.toFormData() : null) @@ -115,6 +116,7 @@ public UsageRetrieveResponse retrieve(String subscriptionId, UsageRetrieveParams return UsageRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for usage with params. */ public CompletableFuture retrieveAsync( String subscriptionId, UsageRetrieveParams params) { String path = @@ -130,6 +132,7 @@ public UsageRetrieveResponse retrieve(String subscriptionId) throws ChargebeeExc return UsageRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for usage without params. */ public CompletableFuture retrieveAsync(String subscriptionId) { String path = buildPathWithParams( @@ -171,6 +174,7 @@ public UsageCreateResponse create(String subscriptionId, UsageCreateParams param return UsageCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for usage with params. */ public CompletableFuture createAsync( String subscriptionId, UsageCreateParams params) { String path = @@ -211,6 +215,7 @@ public UsageDeleteResponse delete(String subscriptionId, UsageDeleteParams param return UsageDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for usage with params. */ public CompletableFuture deleteAsync( String subscriptionId, UsageDeleteParams params) { String path = @@ -244,6 +249,7 @@ public UsageListResponse list(UsageListParams params) throws ChargebeeException return UsageListResponse.fromJson(response.getBodyAsString(), this, params, response); } + /** Async variant of list for usage with params. */ public CompletableFuture listAsync(UsageListParams params) { return getAsync("/usages", params != null ? params.toQueryParams() : null) @@ -258,6 +264,7 @@ public UsageListResponse list() throws ChargebeeException { return UsageListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for usage without params. */ public CompletableFuture listAsync() { return getAsync("/usages", null) diff --git a/src/main/java/com/chargebee/v4/services/VariantService.java b/src/main/java/com/chargebee/v4/services/VariantService.java index c8a0ee06..870ca60d 100644 --- a/src/main/java/com/chargebee/v4/services/VariantService.java +++ b/src/main/java/com/chargebee/v4/services/VariantService.java @@ -102,6 +102,7 @@ public ListProductVariantsResponse listProductVariants(String productId) response.getBodyAsString(), this, null, productId, response); } + /** Async variant of listProductVariants for variant with params. */ public CompletableFuture listProductVariantsAsync( String productId, ListProductVariantsParams params) { String path = buildPathWithParams("/products/{product-id}/variants", "product-id", productId); @@ -112,6 +113,7 @@ public CompletableFuture listProductVariantsAsync( response.getBodyAsString(), this, params, productId, response)); } + /** 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) @@ -153,6 +155,7 @@ public CreateProductVariantResponse createProductVariant( return CreateProductVariantResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of createProductVariant for variant with params. */ public CompletableFuture createProductVariantAsync( String productId, CreateProductVariantParams params) { String path = buildPathWithParams("/products/{product-id}/variants", "product-id", productId); @@ -176,6 +179,7 @@ public VariantRetrieveResponse retrieve(String productVariantId) throws Chargebe return VariantRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for variant without params. */ public CompletableFuture retrieveAsync(String productVariantId) { String path = buildPathWithParams( @@ -218,6 +222,7 @@ public VariantUpdateResponse update(String productVariantId, VariantUpdateParams return VariantUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for variant with params. */ public CompletableFuture updateAsync( String productVariantId, VariantUpdateParams params) { String path = @@ -233,6 +238,7 @@ public VariantUpdateResponse update(String productVariantId) throws ChargebeeExc return VariantUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for variant without params. */ public CompletableFuture updateAsync(String productVariantId) { String path = buildPathWithParams( @@ -257,6 +263,7 @@ public VariantDeleteResponse delete(String productVariantId) throws ChargebeeExc return VariantDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for variant without params. */ public CompletableFuture deleteAsync(String productVariantId) { String path = buildPathWithParams( diff --git a/src/main/java/com/chargebee/v4/services/VirtualBankAccountService.java b/src/main/java/com/chargebee/v4/services/VirtualBankAccountService.java index 1f40beb8..4998e499 100644 --- a/src/main/java/com/chargebee/v4/services/VirtualBankAccountService.java +++ b/src/main/java/com/chargebee/v4/services/VirtualBankAccountService.java @@ -85,6 +85,7 @@ public VirtualBankAccountDeleteLocalResponse deleteLocal(String virtualBankAccou return VirtualBankAccountDeleteLocalResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of deleteLocal for virtualBankAccount without params. */ public CompletableFuture deleteLocalAsync( String virtualBankAccountId) { String path = @@ -117,6 +118,7 @@ public VirtualBankAccountDeleteResponse delete(String virtualBankAccountId) return VirtualBankAccountDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for virtualBankAccount without params. */ public CompletableFuture deleteAsync( String virtualBankAccountId) { String path = @@ -161,6 +163,7 @@ public VirtualBankAccountListResponse list(VirtualBankAccountListParams params) response.getBodyAsString(), this, params, response); } + /** Async variant of list for virtualBankAccount with params. */ public CompletableFuture listAsync( VirtualBankAccountListParams params) { @@ -178,6 +181,7 @@ public VirtualBankAccountListResponse list() throws ChargebeeException { response.getBodyAsString(), this, null, response); } + /** Async variant of list for virtualBankAccount without params. */ public CompletableFuture listAsync() { return getAsync("/virtual_bank_accounts", null) @@ -212,6 +216,7 @@ public VirtualBankAccountCreateResponse create(VirtualBankAccountCreateParams pa return VirtualBankAccountCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for virtualBankAccount with params. */ public CompletableFuture createAsync( VirtualBankAccountCreateParams params) { @@ -238,6 +243,7 @@ public VirtualBankAccountSyncFundResponse syncFund(String virtualBankAccountId) return VirtualBankAccountSyncFundResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of syncFund for virtualBankAccount without params. */ public CompletableFuture syncFundAsync( String virtualBankAccountId) { String path = @@ -269,6 +275,7 @@ public VirtualBankAccountRetrieveResponse retrieve(String virtualBankAccountId) return VirtualBankAccountRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for virtualBankAccount without params. */ public CompletableFuture retrieveAsync( String virtualBankAccountId) { String path = @@ -312,6 +319,7 @@ public VirtualBankAccountCreateUsingPermanentTokenResponse createUsingPermanentT response.getBodyAsString(), response); } + /** Async variant of createUsingPermanentToken for virtualBankAccount with params. */ public CompletableFuture createUsingPermanentTokenAsync(VirtualBankAccountCreateUsingPermanentTokenParams params) { diff --git a/src/main/java/com/chargebee/v4/services/WebhookEndpointService.java b/src/main/java/com/chargebee/v4/services/WebhookEndpointService.java index b42609ef..c4a5a599 100644 --- a/src/main/java/com/chargebee/v4/services/WebhookEndpointService.java +++ b/src/main/java/com/chargebee/v4/services/WebhookEndpointService.java @@ -80,6 +80,7 @@ public WebhookEndpointDeleteResponse delete(String webhookEndpointId) throws Cha return WebhookEndpointDeleteResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of delete for webhookEndpoint without params. */ public CompletableFuture deleteAsync(String webhookEndpointId) { String path = buildPathWithParams( @@ -108,6 +109,7 @@ public WebhookEndpointRetrieveResponse retrieve(String webhookEndpointId) return WebhookEndpointRetrieveResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of retrieve for webhookEndpoint without params. */ public CompletableFuture retrieveAsync( String webhookEndpointId) { String path = @@ -156,6 +158,7 @@ public WebhookEndpointUpdateResponse update( return WebhookEndpointUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for webhookEndpoint with params. */ public CompletableFuture updateAsync( String webhookEndpointId, WebhookEndpointUpdateParams params) { String path = @@ -172,6 +175,7 @@ public WebhookEndpointUpdateResponse update(String webhookEndpointId) throws Cha return WebhookEndpointUpdateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of update for webhookEndpoint without params. */ public CompletableFuture updateAsync(String webhookEndpointId) { String path = buildPathWithParams( @@ -212,6 +216,7 @@ public WebhookEndpointListResponse list(WebhookEndpointListParams params) return WebhookEndpointListResponse.fromJson(response.getBodyAsString(), this, params, response); } + /** Async variant of list for webhookEndpoint with params. */ public CompletableFuture listAsync( WebhookEndpointListParams params) { @@ -228,6 +233,7 @@ public WebhookEndpointListResponse list() throws ChargebeeException { return WebhookEndpointListResponse.fromJson(response.getBodyAsString(), this, null, response); } + /** Async variant of list for webhookEndpoint without params. */ public CompletableFuture listAsync() { return getAsync("/webhook_endpoints", null) @@ -260,6 +266,7 @@ public WebhookEndpointCreateResponse create(WebhookEndpointCreateParams params) return WebhookEndpointCreateResponse.fromJson(response.getBodyAsString(), response); } + /** Async variant of create for webhookEndpoint with params. */ public CompletableFuture createAsync( WebhookEndpointCreateParams params) { From 57fb257eaf2c39d891fe8c9c3cf02947ca3345d5 Mon Sep 17 00:00:00 2001 From: cb-karthikp Date: Wed, 18 Feb 2026 16:58:44 +0530 Subject: [PATCH 4/6] Exception handling document --- README.md | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5448023d..873383db 100644 --- a/README.md +++ b/README.md @@ -516,8 +516,16 @@ try { ``` ##### Async exception handling + +> **Important:** When using async methods, exceptions are wrapped in a `java.util.concurrent.CompletionException`. +> Unlike sync methods that throw `ChargebeeException` directly, async methods deliver errors through +> `CompletableFuture`'s `.exceptionally()` or `.handle()` callbacks, where the original exception is +> available via `throwable.getCause()`. Always unwrap the `CompletionException` to access the +> underlying `ChargebeeException` (e.g., `InvalidRequestException`, `APIException`). + ```java import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionException; CompletableFuture futureCustomer = customers.createAsync(params); @@ -526,8 +534,13 @@ futureCustomer System.out.println("Customer created: " + response.getCustomer().getId()); }) .exceptionally(throwable -> { - if (throwable.getCause() instanceof InvalidRequestException) { - InvalidRequestException e = (InvalidRequestException) throwable.getCause(); + // Unwrap CompletionException to get the actual ChargebeeException + Throwable cause = throwable instanceof CompletionException + ? throwable.getCause() + : throwable; + + if (cause instanceof InvalidRequestException) { + InvalidRequestException e = (InvalidRequestException) cause; ApiErrorCode errorCode = e.getApiErrorCode(); if (errorCode instanceof BadRequestApiErrorCode) { @@ -538,16 +551,35 @@ futureCustomer } else { System.err.println("Validation error: " + e.getMessage()); } - } else if (throwable.getCause() instanceof APIException) { - APIException e = (APIException) throwable.getCause(); + } else if (cause instanceof APIException) { + APIException e = (APIException) cause; System.err.println("API error: " + e.getApiErrorCodeRaw()); } else { - System.err.println("Unexpected error: " + throwable.getMessage()); + System.err.println("Unexpected error: " + cause.getMessage()); } return null; }); ``` +If you prefer blocking on the result, use a try-catch around `.join()` or `.get()`: + +```java +try { + CustomerCreateResponse response = customers.createAsync(params).join(); + System.out.println("Customer created: " + response.getCustomer().getId()); +} catch (CompletionException e) { + // Unwrap to get the original ChargebeeException + Throwable cause = e.getCause(); + if (cause instanceof InvalidRequestException) { + System.err.println("Validation error: " + cause.getMessage()); + } else if (cause instanceof APIException) { + System.err.println("API error: " + ((APIException) cause).getApiErrorCodeRaw()); + } else { + throw e; // Re-throw unexpected errors + } +} +``` + ### Retry Handling Chargebee's SDK includes built-in retry logic to handle temporary network issues and server-side errors. This feature is **disabled by default** but can be **enabled when needed**. From be34f9afad23e64508a0f769ec4991e02a4f5065 Mon Sep 17 00:00:00 2001 From: cb-karthikp Date: Wed, 18 Feb 2026 17:18:30 +0530 Subject: [PATCH 5/6] add configurable executor service --- .../chargebee/v4/client/ChargebeeClient.java | 58 +-- .../v4/transport/DefaultTransport.java | 52 ++- .../v4/transport/TransportConfig.java | 21 +- .../ChargebeeClientAsyncExecutorTest.java | 341 ++++++++++++++++++ .../DefaultTransportExecutorTest.java | 311 ++++++++++++++++ 5 files changed, 755 insertions(+), 28 deletions(-) create mode 100644 src/test/java/com/chargebee/v4/client/ChargebeeClientAsyncExecutorTest.java create mode 100644 src/test/java/com/chargebee/v4/transport/DefaultTransportExecutorTest.java diff --git a/src/main/java/com/chargebee/v4/client/ChargebeeClient.java b/src/main/java/com/chargebee/v4/client/ChargebeeClient.java index 00a378a3..387793f0 100644 --- a/src/main/java/com/chargebee/v4/client/ChargebeeClient.java +++ b/src/main/java/com/chargebee/v4/client/ChargebeeClient.java @@ -14,7 +14,10 @@ import java.util.*; import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.TimeUnit; /** * Immutable, thread-safe Chargebee API client with pluggable transport. @@ -25,7 +28,7 @@ * .build(); * } */ -public final class ChargebeeClient extends ClientMethodsImpl { +public final class ChargebeeClient extends ClientMethodsImpl implements AutoCloseable { private final String apiKey; private final String siteName; private final String endpoint; @@ -37,7 +40,8 @@ public final class ChargebeeClient extends ClientMethodsImpl { private final String protocol; private final RequestInterceptor requestInterceptor; private final RequestContext clientHeaders; - + private final ScheduledExecutorService retryScheduler; + // Auto-generated service registry for lazy loading private final ServiceRegistry serviceRegistry; @@ -53,6 +57,11 @@ private ChargebeeClient(Builder builder) { this.protocol = builder.protocol; this.requestInterceptor = builder.requestInterceptor; this.clientHeaders = new RequestContext(builder.clientHeaders.getHeaders()); + this.retryScheduler = Executors.newSingleThreadScheduledExecutor(r -> { + Thread t = new Thread(r, "chargebee-retry-scheduler"); + t.setDaemon(true); + return t; + }); this.serviceRegistry = new ServiceRegistry(this); } @@ -83,7 +92,19 @@ public static Builder builder(String apiKey, String siteName) { public String getProtocol() { return protocol; } public RequestInterceptor getRequestInterceptor() { return requestInterceptor; } public RequestContext getClientHeaders() { return clientHeaders; } - + + @Override + public void close() { + retryScheduler.shutdown(); + if (transport instanceof AutoCloseable) { + try { + ((AutoCloseable) transport).close(); + } catch (Exception e) { + // best-effort cleanup + } + } + } + // (Header decoration removed from public API) // Resource Services - Auto-generated via ClientMethodsImpl @@ -477,25 +498,18 @@ private CompletableFuture sendWithRetryAsyncInternal(Request request, private CompletableFuture delayAndRetry(Request request, int nextAttempt, long delayMs, int maxRetries) { CompletableFuture delayedRetry = new CompletableFuture<>(); - - // Use a separate thread for the delay to avoid blocking - CompletableFuture.runAsync(() -> { - try { - Thread.sleep(delayMs); - sendWithRetryAsyncInternal(request, nextAttempt, maxRetries) - .whenComplete((response, throwable) -> { - if (throwable != null) { - delayedRetry.completeExceptionally(throwable); - } else { - delayedRetry.complete(response); - } - }); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - delayedRetry.completeExceptionally(new RuntimeException("Interrupted during retry delay", e)); - } - }); - + + retryScheduler.schedule(() -> { + sendWithRetryAsyncInternal(request, nextAttempt, maxRetries) + .whenComplete((response, throwable) -> { + if (throwable != null) { + delayedRetry.completeExceptionally(throwable); + } else { + delayedRetry.complete(response); + } + }); + }, delayMs, TimeUnit.MILLISECONDS); + return delayedRetry; } diff --git a/src/main/java/com/chargebee/v4/transport/DefaultTransport.java b/src/main/java/com/chargebee/v4/transport/DefaultTransport.java index 7c43abd3..0c8df9f4 100644 --- a/src/main/java/com/chargebee/v4/transport/DefaultTransport.java +++ b/src/main/java/com/chargebee/v4/transport/DefaultTransport.java @@ -7,17 +7,21 @@ import java.nio.charset.StandardCharsets; import java.util.*; import java.util.concurrent.CompletableFuture; -import java.util.concurrent.Executor; -import java.util.concurrent.ForkJoinPool; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; import java.util.zip.GZIPInputStream; /** * Default HTTP transport implementation using HttpURLConnection for both sync and async operations. * Async operations are executed on a background thread pool. */ -public class DefaultTransport implements Transport { +public class DefaultTransport implements Transport, AutoCloseable { private final TransportConfig config; - private final Executor asyncExecutor; + private final ExecutorService asyncExecutor; + private final boolean ownsExecutor; private static final String VERSION; @@ -41,7 +45,45 @@ public TransportConfig getConfig() { public DefaultTransport(TransportConfig config) { this.config = Objects.requireNonNull(config, "TransportConfig cannot be null"); - this.asyncExecutor = ForkJoinPool.commonPool(); + if (config.getAsyncExecutor() != null) { + this.asyncExecutor = config.getAsyncExecutor(); + this.ownsExecutor = false; + } else { + this.asyncExecutor = createDefaultExecutor(); + this.ownsExecutor = true; + } + } + + private static ExecutorService createDefaultExecutor() { + AtomicInteger counter = new AtomicInteger(); + ThreadFactory factory = r -> { + Thread t = new Thread(r, "chargebee-async-" + counter.incrementAndGet()); + t.setDaemon(true); + return t; + }; + return Executors.newCachedThreadPool(factory); + } + + /** + * Returns the executor used for async operations. + */ + public ExecutorService getAsyncExecutor() { + return asyncExecutor; + } + + @Override + public void close() { + if (ownsExecutor) { + asyncExecutor.shutdown(); + try { + if (!asyncExecutor.awaitTermination(5, TimeUnit.SECONDS)) { + asyncExecutor.shutdownNow(); + } + } catch (InterruptedException e) { + asyncExecutor.shutdownNow(); + Thread.currentThread().interrupt(); + } + } } @Override diff --git a/src/main/java/com/chargebee/v4/transport/TransportConfig.java b/src/main/java/com/chargebee/v4/transport/TransportConfig.java index 1bd26c70..15829295 100644 --- a/src/main/java/com/chargebee/v4/transport/TransportConfig.java +++ b/src/main/java/com/chargebee/v4/transport/TransportConfig.java @@ -1,6 +1,7 @@ package com.chargebee.v4.transport; import java.util.*; +import java.util.concurrent.ExecutorService; /** * Immutable configuration for HTTP transport. @@ -15,7 +16,8 @@ public final class TransportConfig { private final int maxConnections; private final long keepAliveDurationMs; private final RequestLogger requestLogger; - + private final ExecutorService asyncExecutor; + private TransportConfig(Builder builder) { this.apiKey = builder.apiKey; this.connectTimeoutMs = builder.connectTimeoutMs; @@ -26,6 +28,7 @@ private TransportConfig(Builder builder) { this.maxConnections = builder.maxConnections; this.keepAliveDurationMs = builder.keepAliveDurationMs; this.requestLogger = builder.requestLogger; + this.asyncExecutor = builder.asyncExecutor; } public String getApiKey() { @@ -63,6 +66,13 @@ public long getKeepAliveDurationMs() { public RequestLogger getRequestLogger() { return requestLogger; } + + /** + * Returns the configured async executor, or null if the default should be used. + */ + public ExecutorService getAsyncExecutor() { + return asyncExecutor; + } public static Builder builder() { return new Builder(); @@ -78,6 +88,7 @@ public static class Builder { private int maxConnections = 20; private long keepAliveDurationMs = 300000; // 5 minutes private RequestLogger requestLogger; + private ExecutorService asyncExecutor; public Builder() { // Standard headers are set by DefaultTransport @@ -150,6 +161,14 @@ public Builder requestLogger(RequestLogger requestLogger) { this.requestLogger = requestLogger; return this; } + + /** + * Set a custom executor for async operations. If not set, a dedicated cached thread pool is used. + */ + public Builder asyncExecutor(ExecutorService asyncExecutor) { + this.asyncExecutor = asyncExecutor; + return this; + } public TransportConfig build() { if (apiKey == null || apiKey.trim().isEmpty()) { diff --git a/src/test/java/com/chargebee/v4/client/ChargebeeClientAsyncExecutorTest.java b/src/test/java/com/chargebee/v4/client/ChargebeeClientAsyncExecutorTest.java new file mode 100644 index 00000000..dbfe293b --- /dev/null +++ b/src/test/java/com/chargebee/v4/client/ChargebeeClientAsyncExecutorTest.java @@ -0,0 +1,341 @@ +package com.chargebee.v4.client; + +import com.chargebee.v4.exceptions.NetworkException; +import com.chargebee.v4.internal.RetryConfig; +import com.chargebee.v4.transport.*; +import org.junit.jupiter.api.*; + +import java.util.*; +import java.util.concurrent.*; +import java.util.concurrent.atomic.AtomicInteger; + +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.*; + +@DisplayName("ChargebeeClient Async Executor Tests") +class ChargebeeClientAsyncExecutorTest { + + private static final String TEST_API_KEY = "test_api_key"; + private static final String TEST_SITE = "test-site"; + + @Nested + @DisplayName("delayAndRetry - ScheduledExecutorService Tests") + class DelayAndRetryTests { + + @Test + @DisplayName("should use ScheduledExecutorService for retry delays instead of Thread.sleep") + @Timeout(10) + void shouldUseScheduledExecutorForDelays() throws Exception { + Transport mockTransport = mock(Transport.class); + Response retryableResponse = createResponse(429); + Response successResponse = createSuccessResponse(); + + when(mockTransport.sendAsync(any(Request.class))) + .thenReturn(CompletableFuture.completedFuture(retryableResponse)) + .thenReturn(CompletableFuture.completedFuture(successResponse)); + + RetryConfig retryConfig = RetryConfig.builder() + .enabled(true) + .maxRetries(2) + .baseDelayMs(50) + .retryOnStatus(new HashSet<>(Arrays.asList(429))) + .build(); + + ChargebeeClient client = ChargebeeClient.builder() + .apiKey(TEST_API_KEY) + .siteName(TEST_SITE) + .transport(mockTransport) + .retry(retryConfig) + .build(); + + Request request = Request.builder() + .method("GET") + .url("http://test.com") + .build(); + + long start = System.currentTimeMillis(); + CompletableFuture future = client.sendWithRetryAsync(request); + Response response = future.get(5, TimeUnit.SECONDS); + long duration = System.currentTimeMillis() - start; + + assertEquals(200, response.getStatusCode()); + verify(mockTransport, times(2)).sendAsync(any(Request.class)); + // Verify delay was actually applied + assertTrue(duration >= 30, "Retry delay should have been applied, but took only " + duration + "ms"); + + client.close(); + } + + @Test + @DisplayName("should not block ForkJoinPool.commonPool threads during retry delay") + @Timeout(15) + void shouldNotBlockCommonPoolDuringDelay() throws Exception { + Transport mockTransport = mock(Transport.class); + Response retryableResponse = createResponse(429); + Response successResponse = createSuccessResponse(); + + AtomicInteger callCount = new AtomicInteger(0); + when(mockTransport.sendAsync(any(Request.class))).thenAnswer(invocation -> { + int count = callCount.incrementAndGet(); + if (count <= 2) { + return CompletableFuture.completedFuture(retryableResponse); + } + return CompletableFuture.completedFuture(successResponse); + }); + + RetryConfig retryConfig = RetryConfig.builder() + .enabled(true) + .maxRetries(3) + .baseDelayMs(100) + .retryOnStatus(new HashSet<>(Arrays.asList(429))) + .build(); + + ChargebeeClient client = ChargebeeClient.builder() + .apiKey(TEST_API_KEY) + .siteName(TEST_SITE) + .transport(mockTransport) + .retry(retryConfig) + .build(); + + // Submit work on ForkJoinPool.commonPool to verify it's not starved + CompletableFuture commonPoolTask = CompletableFuture.supplyAsync(() -> { + // This should complete quickly if common pool is not blocked + return "common-pool-not-blocked"; + }); + + Request request = Request.builder() + .method("GET") + .url("http://test.com") + .build(); + + CompletableFuture retryFuture = client.sendWithRetryAsync(request); + + // Common pool task should complete even while retries are in progress + String result = commonPoolTask.get(2, TimeUnit.SECONDS); + assertEquals("common-pool-not-blocked", result); + + // Wait for retry to complete + Response response = retryFuture.get(10, TimeUnit.SECONDS); + assertEquals(200, response.getStatusCode()); + + client.close(); + } + + @Test + @DisplayName("should handle multiple concurrent async retries without exhausting threads") + @Timeout(30) + void shouldHandleConcurrentRetriesWithoutExhaustingThreads() throws Exception { + Transport mockTransport = mock(Transport.class); + Response retryableResponse = createResponse(429); + Response successResponse = createSuccessResponse(); + + AtomicInteger totalCalls = new AtomicInteger(0); + when(mockTransport.sendAsync(any(Request.class))).thenAnswer(invocation -> { + int count = totalCalls.incrementAndGet(); + // First call for each request returns 429, second returns 200 + // With 10 requests, calls 1-10 return 429, calls 11-20 return 200 + if (count <= 10) { + return CompletableFuture.completedFuture(retryableResponse); + } + return CompletableFuture.completedFuture(successResponse); + }); + + RetryConfig retryConfig = RetryConfig.builder() + .enabled(true) + .maxRetries(2) + .baseDelayMs(50) + .retryOnStatus(new HashSet<>(Arrays.asList(429))) + .build(); + + ChargebeeClient client = ChargebeeClient.builder() + .apiKey(TEST_API_KEY) + .siteName(TEST_SITE) + .transport(mockTransport) + .retry(retryConfig) + .build(); + + int concurrentRequests = 10; + List> futures = new ArrayList<>(); + + for (int i = 0; i < concurrentRequests; i++) { + Request request = Request.builder() + .method("GET") + .url("http://test.com") + .build(); + futures.add(client.sendWithRetryAsync(request)); + } + + CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])) + .get(20, TimeUnit.SECONDS); + + for (CompletableFuture future : futures) { + assertEquals(200, future.get().getStatusCode()); + } + + client.close(); + } + + @Test + @DisplayName("should apply correct backoff delay in async retries") + @Timeout(10) + void shouldApplyCorrectBackoffDelayInAsyncRetries() throws Exception { + Transport mockTransport = mock(Transport.class); + NetworkException networkException = new NetworkException("Network error", new Exception()); + Response successResponse = createSuccessResponse(); + + List callTimestamps = Collections.synchronizedList(new ArrayList<>()); + + CompletableFuture failedFuture1 = new CompletableFuture<>(); + failedFuture1.completeExceptionally(networkException); + CompletableFuture failedFuture2 = new CompletableFuture<>(); + failedFuture2.completeExceptionally(networkException); + + when(mockTransport.sendAsync(any(Request.class))).thenAnswer(invocation -> { + callTimestamps.add(System.currentTimeMillis()); + if (callTimestamps.size() <= 2) { + CompletableFuture failed = new CompletableFuture<>(); + failed.completeExceptionally(networkException); + return failed; + } + return CompletableFuture.completedFuture(successResponse); + }); + + RetryConfig retryConfig = RetryConfig.builder() + .enabled(true) + .maxRetries(3) + .baseDelayMs(100) + .build(); + + ChargebeeClient client = ChargebeeClient.builder() + .apiKey(TEST_API_KEY) + .siteName(TEST_SITE) + .transport(mockTransport) + .retry(retryConfig) + .build(); + + Request request = Request.builder() + .method("GET") + .url("http://test.com") + .build(); + + Response response = client.sendWithRetryAsync(request).get(10, TimeUnit.SECONDS); + assertEquals(200, response.getStatusCode()); + + // Verify exponential backoff: delays should increase + assertEquals(3, callTimestamps.size()); + long delay1 = callTimestamps.get(1) - callTimestamps.get(0); + long delay2 = callTimestamps.get(2) - callTimestamps.get(1); + + // First retry delay ~100ms, second ~200ms (with jitter) + assertTrue(delay1 >= 50, "First retry delay too short: " + delay1 + "ms"); + assertTrue(delay2 >= 100, "Second retry delay too short: " + delay2 + "ms"); + + client.close(); + } + } + + @Nested + @DisplayName("ChargebeeClient AutoCloseable Tests") + class ClientAutoCloseableTests { + + @Test + @DisplayName("should implement AutoCloseable") + void shouldImplementAutoCloseable() { + ChargebeeClient client = ChargebeeClient.builder() + .apiKey(TEST_API_KEY) + .siteName(TEST_SITE) + .build(); + + assertTrue(client instanceof AutoCloseable); + client.close(); + } + + @Test + @DisplayName("should work with try-with-resources") + void shouldWorkWithTryWithResources() throws Exception { + Transport mockTransport = mock(Transport.class); + when(mockTransport.sendAsync(any(Request.class))) + .thenReturn(CompletableFuture.completedFuture(createSuccessResponse())); + + try (ChargebeeClient client = ChargebeeClient.builder() + .apiKey(TEST_API_KEY) + .siteName(TEST_SITE) + .transport(mockTransport) + .build()) { + + Request request = Request.builder() + .method("GET") + .url("http://test.com") + .build(); + + Response response = client.sendWithRetryAsync(request).get(5, TimeUnit.SECONDS); + assertEquals(200, response.getStatusCode()); + } + // No exception should be thrown after close + } + + @Test + @DisplayName("should close transport when transport is AutoCloseable") + void shouldCloseTransportWhenAutoCloseable() throws Exception { + DefaultTransport transport = new DefaultTransport( + TransportConfig.builder().apiKey(TEST_API_KEY).build()); + + ChargebeeClient client = ChargebeeClient.builder() + .apiKey(TEST_API_KEY) + .siteName(TEST_SITE) + .transport(transport) + .build(); + + ExecutorService transportExecutor = transport.getAsyncExecutor(); + assertFalse(transportExecutor.isShutdown()); + + client.close(); + + assertTrue(transportExecutor.isShutdown(), + "Transport executor should be shut down when client is closed"); + } + + @Test + @DisplayName("should handle close gracefully when transport is not AutoCloseable") + void shouldHandleCloseWhenTransportNotAutoCloseable() { + Transport mockTransport = mock(Transport.class); + + ChargebeeClient client = ChargebeeClient.builder() + .apiKey(TEST_API_KEY) + .siteName(TEST_SITE) + .transport(mockTransport) + .build(); + + // Should not throw even with non-closeable transport + assertDoesNotThrow(() -> client.close()); + } + + @Test + @DisplayName("should handle multiple close calls gracefully") + void shouldHandleMultipleCloseCalls() { + ChargebeeClient client = ChargebeeClient.builder() + .apiKey(TEST_API_KEY) + .siteName(TEST_SITE) + .build(); + + assertDoesNotThrow(() -> { + client.close(); + client.close(); + }); + } + } + + // Helper methods + + private Response createSuccessResponse() { + return new Response(200, new HashMap<>(), "OK".getBytes()); + } + + private Response createResponse(int statusCode) { + Map> headers = new HashMap<>(); + headers.put("Content-Type", Arrays.asList("application/json")); + String body = String.format("{\"status\":%d}", statusCode); + return new Response(statusCode, headers, body.getBytes()); + } +} diff --git a/src/test/java/com/chargebee/v4/transport/DefaultTransportExecutorTest.java b/src/test/java/com/chargebee/v4/transport/DefaultTransportExecutorTest.java new file mode 100644 index 00000000..d1160f8c --- /dev/null +++ b/src/test/java/com/chargebee/v4/transport/DefaultTransportExecutorTest.java @@ -0,0 +1,311 @@ +package com.chargebee.v4.transport; + +import org.junit.jupiter.api.*; + +import com.sun.net.httpserver.HttpServer; + +import java.io.*; +import java.net.*; +import java.nio.charset.StandardCharsets; +import java.util.*; +import java.util.concurrent.*; + +import static org.junit.jupiter.api.Assertions.*; + +@DisplayName("DefaultTransport Executor Tests") +class DefaultTransportExecutorTest { + + private static final String TEST_API_KEY = "test_api_key"; + + @Nested + @DisplayName("Default Executor Tests") + class DefaultExecutorTests { + + @Test + @DisplayName("should create a dedicated executor by default instead of ForkJoinPool.commonPool") + void shouldUseDedicatedExecutorByDefault() { + TransportConfig config = TransportConfig.builder() + .apiKey(TEST_API_KEY) + .build(); + + DefaultTransport transport = new DefaultTransport(config); + + ExecutorService executor = transport.getAsyncExecutor(); + assertNotNull(executor); + assertNotSame(ForkJoinPool.commonPool(), executor); + + transport.close(); + } + + @Test + @DisplayName("should use daemon threads in default executor") + void shouldUseDaemonThreadsInDefaultExecutor() throws Exception { + TransportConfig config = TransportConfig.builder() + .apiKey(TEST_API_KEY) + .build(); + + DefaultTransport transport = new DefaultTransport(config); + + CompletableFuture isDaemon = new CompletableFuture<>(); + CompletableFuture threadName = new CompletableFuture<>(); + + transport.getAsyncExecutor().execute(() -> { + isDaemon.complete(Thread.currentThread().isDaemon()); + threadName.complete(Thread.currentThread().getName()); + }); + + assertTrue(isDaemon.get(5, TimeUnit.SECONDS), "Default executor threads should be daemon threads"); + assertTrue(threadName.get(5, TimeUnit.SECONDS).startsWith("chargebee-async-"), + "Default executor threads should be named chargebee-async-*"); + + transport.close(); + } + + @Test + @DisplayName("should execute async requests on dedicated thread pool, not common pool") + void shouldExecuteAsyncOnDedicatedPool() throws Exception { + TransportConfig config = TransportConfig.builder() + .apiKey(TEST_API_KEY) + .build(); + + DefaultTransport transport = new DefaultTransport(config); + + TestHttpServer server = new TestHttpServer(); + server.start(); + + try { + Request request = Request.builder() + .method("GET") + .url(server.getUrl()) + .build(); + + CompletableFuture threadNameFuture = new CompletableFuture<>(); + + // Intercept the thread name during async execution + CompletableFuture responseFuture = transport.sendAsync(request); + responseFuture.thenRun(() -> threadNameFuture.complete("completed")); + + Response response = responseFuture.get(5, TimeUnit.SECONDS); + assertEquals(200, response.getStatusCode()); + } finally { + server.stop(); + transport.close(); + } + } + } + + @Nested + @DisplayName("Custom Executor Tests") + class CustomExecutorTests { + + @Test + @DisplayName("should use custom executor when provided via TransportConfig") + void shouldUseCustomExecutor() throws Exception { + ExecutorService customExecutor = Executors.newFixedThreadPool(2); + + TransportConfig config = TransportConfig.builder() + .apiKey(TEST_API_KEY) + .asyncExecutor(customExecutor) + .build(); + + DefaultTransport transport = new DefaultTransport(config); + + assertSame(customExecutor, transport.getAsyncExecutor()); + + transport.close(); + // Custom executor should NOT be shut down by transport + assertFalse(customExecutor.isShutdown(), + "Transport should not shut down a user-provided executor"); + + customExecutor.shutdown(); + } + + @Test + @DisplayName("should execute async requests on custom executor") + void shouldExecuteAsyncOnCustomExecutor() throws Exception { + CompletableFuture executingThreadName = new CompletableFuture<>(); + + ExecutorService customExecutor = Executors.newSingleThreadExecutor(r -> { + Thread t = new Thread(r, "custom-test-thread"); + t.setDaemon(true); + return t; + }); + + TransportConfig config = TransportConfig.builder() + .apiKey(TEST_API_KEY) + .asyncExecutor(customExecutor) + .build(); + + DefaultTransport transport = new DefaultTransport(config); + + TestHttpServer server = new TestHttpServer(); + server.start(); + + try { + Request request = Request.builder() + .method("GET") + .url(server.getUrl()) + .build(); + + Response response = transport.sendAsync(request).get(5, TimeUnit.SECONDS); + assertEquals(200, response.getStatusCode()); + } finally { + server.stop(); + transport.close(); + customExecutor.shutdown(); + } + } + } + + @Nested + @DisplayName("AutoCloseable Tests") + class AutoCloseableTests { + + @Test + @DisplayName("should shut down owned executor on close") + void shouldShutDownOwnedExecutorOnClose() { + TransportConfig config = TransportConfig.builder() + .apiKey(TEST_API_KEY) + .build(); + + DefaultTransport transport = new DefaultTransport(config); + ExecutorService executor = transport.getAsyncExecutor(); + + assertFalse(executor.isShutdown()); + + transport.close(); + + assertTrue(executor.isShutdown(), "Owned executor should be shut down on close"); + } + + @Test + @DisplayName("should not shut down user-provided executor on close") + void shouldNotShutDownUserProvidedExecutorOnClose() { + ExecutorService userExecutor = Executors.newCachedThreadPool(); + + TransportConfig config = TransportConfig.builder() + .apiKey(TEST_API_KEY) + .asyncExecutor(userExecutor) + .build(); + + DefaultTransport transport = new DefaultTransport(config); + transport.close(); + + assertFalse(userExecutor.isShutdown(), + "User-provided executor must not be shut down by transport"); + + userExecutor.shutdown(); + } + + @Test + @DisplayName("should be usable with try-with-resources") + void shouldWorkWithTryWithResources() throws Exception { + ExecutorService capturedExecutor; + + try (DefaultTransport transport = new DefaultTransport( + TransportConfig.builder().apiKey(TEST_API_KEY).build())) { + capturedExecutor = transport.getAsyncExecutor(); + assertFalse(capturedExecutor.isShutdown()); + } + + assertTrue(capturedExecutor.isShutdown(), + "Executor should be shut down after try-with-resources block"); + } + + @Test + @DisplayName("should handle multiple close calls gracefully") + void shouldHandleMultipleCloseCalls() { + TransportConfig config = TransportConfig.builder() + .apiKey(TEST_API_KEY) + .build(); + + DefaultTransport transport = new DefaultTransport(config); + + // Should not throw on multiple close calls + transport.close(); + transport.close(); + } + } + + @Nested + @DisplayName("Concurrency Tests") + class ConcurrencyTests { + + @Test + @DisplayName("should handle multiple concurrent async requests") + @Timeout(10) + void shouldHandleConcurrentAsyncRequests() throws Exception { + TransportConfig config = TransportConfig.builder() + .apiKey(TEST_API_KEY) + .build(); + + DefaultTransport transport = new DefaultTransport(config); + + TestHttpServer server = new TestHttpServer(); + server.start(); + + try { + int concurrentRequests = 20; + List> futures = new ArrayList<>(); + + for (int i = 0; i < concurrentRequests; i++) { + Request request = Request.builder() + .method("GET") + .url(server.getUrl()) + .build(); + futures.add(transport.sendAsync(request)); + } + + CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])) + .get(10, TimeUnit.SECONDS); + + for (CompletableFuture future : futures) { + assertEquals(200, future.get().getStatusCode()); + } + } finally { + server.stop(); + transport.close(); + } + } + } + + /** + * Simple embedded HTTP server for testing. + */ + private static class TestHttpServer { + private HttpServer server; + private int port; + + void start() throws IOException { + port = findFreePort(); + server = HttpServer.create(new InetSocketAddress(port), 0); + + server.createContext("/", exchange -> { + byte[] responseBytes = "OK".getBytes(StandardCharsets.UTF_8); + exchange.sendResponseHeaders(200, responseBytes.length); + try (OutputStream os = exchange.getResponseBody()) { + os.write(responseBytes); + } + }); + + server.setExecutor(null); + server.start(); + } + + void stop() { + if (server != null) { + server.stop(0); + } + } + + String getUrl() { + return "http://localhost:" + port + "/"; + } + + private int findFreePort() throws IOException { + try (ServerSocket socket = new ServerSocket(0)) { + return socket.getLocalPort(); + } + } + } +} From 762ea34c6c9ff133432f21f26f5c0ee8c0beae8e Mon Sep 17 00:00:00 2001 From: cb-karthikp Date: Fri, 20 Feb 2026 17:34:52 +0530 Subject: [PATCH 6/6] Version bump-up --- CHANGELOG.md | 2 +- VERSION | 2 +- build.gradle.kts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32e6fe71..dbce63f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### v4.2.1 (2026-02-18) +### v4.3.0 (2026-02-20) * * * ### New Features: diff --git a/VERSION b/VERSION index fae6e3d0..80895903 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.2.1 +4.3.0 diff --git a/build.gradle.kts b/build.gradle.kts index 48ff245c..2366bb74 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,7 +7,7 @@ plugins { } group = "com.chargebee" -version = "4.2.1" +version = "4.3.0" description = "Java client library for ChargeBee" // Project metadata