diff --git a/CHANGELOG.md b/CHANGELOG.md index 009800e6..b75cd951 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,61 @@ +### v4.14.0 (2026-07-30) +* * * +### New Resources: +- [`CreditUnit`](https://apidocs.chargebee.com/docs/api/credit_units) has been added. +- [`LedgerEntry`](https://apidocs.chargebee.com/docs/api/ledger_entries) has been added. + + +### New Actions: +- [`allocate`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate) has been added to [`LedgerOperation`](https://apidocs.chargebee.com/docs/api/ledger_operations). + + +### New Attributes: +- [`unit_id`](https://apidocs.chargebee.com/docs/api/alerts/alert-object#unit_id) has been added to [`Alert`](https://apidocs.chargebee.com/docs/api/alerts). +- [`subscription_id`](https://apidocs.chargebee.com/docs/api/grant_blocks/grant-block-object#subscription_id) has been added to [`GrantBlock`](https://apidocs.chargebee.com/docs/api/grant_blocks). +- [`modified_at`](https://apidocs.chargebee.com/docs/api/grant_blocks/grant-block-object#modified_at) has been added to [`GrantBlock`](https://apidocs.chargebee.com/docs/api/grant_blocks). +- [`resource_version`](https://apidocs.chargebee.com/docs/api/grant_blocks/grant-block-object#resource_version) has been added to [`GrantBlock`](https://apidocs.chargebee.com/docs/api/grant_blocks). +- [`created_at`](https://apidocs.chargebee.com/docs/api/ledger_account_balances/ledger-account-balance-object#created_at) has been added to [`LedgerAccountBalance`](https://apidocs.chargebee.com/docs/api/ledger_account_balances). +- [`resource_version`](https://apidocs.chargebee.com/docs/api/ledger_account_balances/ledger-account-balance-object#resource_version) has been added to [`LedgerAccountBalance`](https://apidocs.chargebee.com/docs/api/ledger_account_balances). + + +### New Parameters: +- [`account_type`](https://apidocs.chargebee.com/docs/api/grant_blocks/list-grant-blocks#account_type) has been added as query parameter to [`list_grant_blocks`](https://apidocs.chargebee.com/docs/api/grant_blocks/list-grant-blocks) in [`GrantBlock`](https://apidocs.chargebee.com/docs/api/grant_blocks). +- [`unit_id`](https://apidocs.chargebee.com/docs/api/alerts/create-an-alert#unit_id) has been added as request body parameter to [`create_an_alert`](https://apidocs.chargebee.com/docs/api/alerts/create-an-alert) in [`Alert`](https://apidocs.chargebee.com/docs/api/alerts). +- [`include_cancellation_day_in_billing`](https://apidocs.chargebee.com/docs/api/estimates/cancel-subscription-for-items-estimate#include_cancellation_day_in_billing) has been added as request body parameter to [`cancel_subscription_for_items_estimate`](https://apidocs.chargebee.com/docs/api/estimates/cancel-subscription-for-items-estimate) in [`Estimate`](https://apidocs.chargebee.com/docs/api/estimates). +- [`subscription_id`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate#subscription_id) has been added as request body parameter to [`allocate`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate) in [`LedgerOperation`](https://apidocs.chargebee.com/docs/api/ledger_operations). +- [`unit_id`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate#unit_id) has been added as request body parameter to [`allocate`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate) in [`LedgerOperation`](https://apidocs.chargebee.com/docs/api/ledger_operations). +- [`amount`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate#amount) has been added as request body parameter to [`allocate`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate) in [`LedgerOperation`](https://apidocs.chargebee.com/docs/api/ledger_operations). +- [`expires_at`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate#expires_at) has been added as request body parameter to [`allocate`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate) in [`LedgerOperation`](https://apidocs.chargebee.com/docs/api/ledger_operations). +- [`metadata`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate#metadata) has been added as request body parameter to [`allocate`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate) in [`LedgerOperation`](https://apidocs.chargebee.com/docs/api/ledger_operations). +- [`include_cancellation_day_in_billing`](https://apidocs.chargebee.com/docs/api/subscriptions/cancel-subscription-for-items#include_cancellation_day_in_billing) has been added as request body parameter to [`cancel_subscription_for_items`](https://apidocs.chargebee.com/docs/api/subscriptions/cancel-subscription-for-items) in [`Subscription`](https://apidocs.chargebee.com/docs/api/subscriptions). + + +### New Events: +- [`grant_blocks_created`](https://apidocs.chargebee.com/docs/api/events/webhook/grant_blocks_created) has been added. +- [`ledger_updated`](https://apidocs.chargebee.com/docs/api/events/webhook/ledger_updated) has been added. +- [`ledger_account_balance_updated`](https://apidocs.chargebee.com/docs/api/events/webhook/ledger_account_balance_updated) has been added. +- [`grant_blocks_updated`](https://apidocs.chargebee.com/docs/api/events/webhook/grant_blocks_updated) has been added. + + +### New Enums: +- `ledger_account_balance_updated`, `grant_blocks_created`, `grant_blocks_updated`, and `ledger_updated` have been added as new values enum `EventType`. +- `dana`, `touch_n_go`, `tamara`, and `qpay` have been added as new values enum `PaymentMethod`. +- `dana`, `touch_n_go`, `tamara`, and `qpay` have been added as new values enum `PaymentMethodType`. +- `dana`, `touch_n_go`, `tamara`, `qpay`, `credit_balance_dropped`, `credit`, `debit`, `hold`, and `unhold` have been added as new values enum `Type`. +- `active` and `archived` have been added as new values to enum attribute [`status`](https://apidocs.chargebee.com/docs/api/credit_units/credit-unit-object#status) in [`CreditUnit`](https://apidocs.chargebee.com/docs/api/credit_units). +- `grant_renewal` and `subscription_renewed` have been added as new values to enum attribute [`grant_source`](https://apidocs.chargebee.com/docs/api/grant_blocks/grant-block-object#grant_source) in [`GrantBlock`](https://apidocs.chargebee.com/docs/api/grant_blocks). +- `provisioned` and `overdraft` have been added as new values to enum attribute [`account_type`](https://apidocs.chargebee.com/docs/api/ledger_entries/ledger-entry-object#account_type) in [`LedgerEntry`](https://apidocs.chargebee.com/docs/api/ledger_entries). +- `credit_unit` has been added as a new value to enum attribute [`unit_type`](https://apidocs.chargebee.com/docs/api/ledger_entries/ledger-entry-object#unit_type) in [`LedgerEntry`](https://apidocs.chargebee.com/docs/api/ledger_entries). +- `dana`, `touch_n_go`, `tamara`, and `qpay` have been added as new values to enum attribute [`payment_method_type`](https://apidocs.chargebee.com/docs/api/payment_intents/payment-intent-object#payment_method_type) in [`PaymentIntent`](https://apidocs.chargebee.com/docs/api/payment_intents). +- `dana`, `touch_n_go`, `tamara`, and `qpay` have been added as new values to enum attribute [`active_payment_attempt.payment_method_type`](https://apidocs.chargebee.com/docs/api/payment_intents/payment-intent-object#active_payment_attempt_payment_method_type) in [`PaymentIntent`](https://apidocs.chargebee.com/docs/api/payment_intents). +- `archived` and `active` have been added as new values to enum query parameter `status.in` in [`list_credit_units`](https://apidocs.chargebee.com/docs/api/credit_units/list-credit-units) of [`CreditUnit`](https://apidocs.chargebee.com/docs/api/credit_units). +- `archived` and `active` have been added as new values to enum query parameter `status.is` in [`list_credit_units`](https://apidocs.chargebee.com/docs/api/credit_units/list-credit-units) of [`CreditUnit`](https://apidocs.chargebee.com/docs/api/credit_units). +- `provisioned` and `overdraft` have been added as new values to enum query parameter `account_type.is` in [`list_grant_blocks`](https://apidocs.chargebee.com/docs/api/grant_blocks/list-grant-blocks) of [`GrantBlock`](https://apidocs.chargebee.com/docs/api/grant_blocks). +- `dana`, `touch_n_go`, `tamara`, and `qpay` have been added as new values to enum request body parameter `payment_method_type` in [`update_a_payment_intent`](https://apidocs.chargebee.com/docs/api/payment_intents/update-a-payment-intent) of [`PaymentIntent`](https://apidocs.chargebee.com/docs/api/payment_intents). +- `dana`, `touch_n_go`, `tamara`, and `qpay` have been added as new values to enum request body parameter `payment_method_type` in [`create_a_payment_intent`](https://apidocs.chargebee.com/docs/api/payment_intents/create-a-payment-intent) of [`PaymentIntent`](https://apidocs.chargebee.com/docs/api/payment_intents). + + + ### v4.13.0 (2026-07-21) * * * ### New Resources: diff --git a/VERSION b/VERSION index 813b83b6..c412a4e2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.13.0 +4.14.0 diff --git a/build.gradle.kts b/build.gradle.kts index ca622089..93b25bad 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,7 +7,7 @@ plugins { } group = "com.chargebee" -version = "4.13.0" +version = "4.14.0" description = "Java client library for ChargeBee" // Project metadata diff --git a/src/main/java/com/chargebee/v4/client/ClientMethods.java b/src/main/java/com/chargebee/v4/client/ClientMethods.java index dbedc752..5e3d1a5b 100644 --- a/src/main/java/com/chargebee/v4/client/ClientMethods.java +++ b/src/main/java/com/chargebee/v4/client/ClientMethods.java @@ -148,6 +148,8 @@ import com.chargebee.v4.services.ItemPriceService; +import com.chargebee.v4.services.CreditUnitService; + import com.chargebee.v4.services.OfferFulfillmentService; import com.chargebee.v4.services.HostedPageService; @@ -706,6 +708,13 @@ public interface ClientMethods { */ ItemPriceService itemPrices(); + /** + * Access credit_unit-related operations. + * + * @return CreditUnitService instance for fluent API access + */ + CreditUnitService creditUnits(); + /** * Access offer_fulfillment-related operations. * diff --git a/src/main/java/com/chargebee/v4/client/ClientMethodsImpl.java b/src/main/java/com/chargebee/v4/client/ClientMethodsImpl.java index a56a6f08..633024cd 100644 --- a/src/main/java/com/chargebee/v4/client/ClientMethodsImpl.java +++ b/src/main/java/com/chargebee/v4/client/ClientMethodsImpl.java @@ -148,6 +148,8 @@ import com.chargebee.v4.services.ItemPriceService; +import com.chargebee.v4.services.CreditUnitService; + import com.chargebee.v4.services.OfferFulfillmentService; import com.chargebee.v4.services.HostedPageService; @@ -560,6 +562,11 @@ public ItemPriceService itemPrices() { return getServiceRegistry().itemPrices(); } + @Override + public CreditUnitService creditUnits() { + return getServiceRegistry().creditUnits(); + } + @Override public OfferFulfillmentService offerFulfillments() { return getServiceRegistry().offerFulfillments(); diff --git a/src/main/java/com/chargebee/v4/client/ServiceRegistry.java b/src/main/java/com/chargebee/v4/client/ServiceRegistry.java index c92aa427..f5c0928c 100644 --- a/src/main/java/com/chargebee/v4/client/ServiceRegistry.java +++ b/src/main/java/com/chargebee/v4/client/ServiceRegistry.java @@ -148,6 +148,8 @@ import com.chargebee.v4.services.ItemPriceService; +import com.chargebee.v4.services.CreditUnitService; + import com.chargebee.v4.services.OfferFulfillmentService; import com.chargebee.v4.services.HostedPageService; @@ -337,6 +339,8 @@ final class ServiceRegistry { private volatile ItemPriceService itemPriceService; + private volatile CreditUnitService creditUnitService; + private volatile OfferFulfillmentService offerFulfillmentService; private volatile HostedPageService hostedPageService; @@ -1485,6 +1489,21 @@ ItemPriceService itemPrices() { return itemPriceService; } + /** + * Get or create the CreditUnitService instance. Thread-safe lazy initialization using + * double-checked locking. + */ + CreditUnitService creditUnits() { + if (creditUnitService == null) { + synchronized (this) { + if (creditUnitService == null) { + creditUnitService = new CreditUnitService(client); + } + } + } + return creditUnitService; + } + /** * Get or create the OfferFulfillmentService instance. Thread-safe lazy initialization using * double-checked locking. diff --git a/src/main/java/com/chargebee/v4/models/alert/Alert.java b/src/main/java/com/chargebee/v4/models/alert/Alert.java index e1dc64cb..6a39d952 100644 --- a/src/main/java/com/chargebee/v4/models/alert/Alert.java +++ b/src/main/java/com/chargebee/v4/models/alert/Alert.java @@ -20,12 +20,13 @@ public class Alert { private String description; private String meteredFeatureId; private String currencyCode; + private String unitId; private String subscriptionId; private Status status; private String meta; private Timestamp createdAt; private Timestamp updatedAt; - private List threshold; + private Threshold threshold; private List filterConditions; public String getId() { @@ -52,6 +53,10 @@ public String getCurrencyCode() { return currencyCode; } + public String getUnitId() { + return unitId; + } + public String getSubscriptionId() { return subscriptionId; } @@ -72,7 +77,7 @@ public Timestamp getUpdatedAt() { return updatedAt; } - public List getThreshold() { + public Threshold getThreshold() { return threshold; } @@ -85,6 +90,8 @@ public enum Type { SPEND_EXCEEDED("spend_exceeded"), + CREDIT_BALANCE_DROPPED("credit_balance_dropped"), + /** An enum member indicating that Type was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; @@ -159,6 +166,8 @@ public static Alert fromJson(JsonObject jsonObj) { obj.currencyCode = JsonUtil.getString(jsonObj, "currency_code"); + obj.unitId = JsonUtil.getString(jsonObj, "unit_id"); + obj.subscriptionId = JsonUtil.getString(jsonObj, "subscription_id"); obj.status = Status.fromString(JsonUtil.getString(jsonObj, "status")); @@ -169,8 +178,10 @@ public static Alert fromJson(JsonObject jsonObj) { obj.updatedAt = JsonUtil.getTimestamp(jsonObj, "updated_at"); - obj.threshold = - JsonUtil.mapArray(JsonUtil.getJsonArray(jsonObj, "threshold"), Threshold::fromJson); + JsonObject __thresholdObj = JsonUtil.getJsonObject(jsonObj, "threshold"); + if (__thresholdObj != null) { + obj.threshold = Threshold.fromJson(__thresholdObj); + } obj.filterConditions = JsonUtil.mapArray( @@ -194,6 +205,8 @@ public String toString() { + meteredFeatureId + ", currencyCode=" + currencyCode + + ", unitId=" + + unitId + ", subscriptionId=" + subscriptionId + ", status=" @@ -223,6 +236,7 @@ public boolean equals(Object o) { && java.util.Objects.equals(description, that.description) && java.util.Objects.equals(meteredFeatureId, that.meteredFeatureId) && java.util.Objects.equals(currencyCode, that.currencyCode) + && java.util.Objects.equals(unitId, that.unitId) && java.util.Objects.equals(subscriptionId, that.subscriptionId) && java.util.Objects.equals(status, that.status) && java.util.Objects.equals(meta, that.meta) @@ -242,6 +256,7 @@ public int hashCode() { description, meteredFeatureId, currencyCode, + unitId, subscriptionId, status, meta, diff --git a/src/main/java/com/chargebee/v4/models/alert/params/AlertCreateParams.java b/src/main/java/com/chargebee/v4/models/alert/params/AlertCreateParams.java index 83e38c42..ee0ab8b7 100644 --- a/src/main/java/com/chargebee/v4/models/alert/params/AlertCreateParams.java +++ b/src/main/java/com/chargebee/v4/models/alert/params/AlertCreateParams.java @@ -24,6 +24,8 @@ public final class AlertCreateParams { private final String currencyCode; + private final String unitId; + private final String subscriptionId; private final String meta; @@ -44,6 +46,8 @@ private AlertCreateParams(AlertCreateBuilder builder) { this.currencyCode = builder.currencyCode; + this.unitId = builder.unitId; + this.subscriptionId = builder.subscriptionId; this.meta = builder.meta; @@ -73,6 +77,10 @@ public String getCurrencyCode() { return currencyCode; } + public String getUnitId() { + return unitId; + } + public String getSubscriptionId() { return subscriptionId; } @@ -118,6 +126,11 @@ public Map toFormData() { formData.put("currency_code", this.currencyCode); } + if (this.unitId != null) { + + formData.put("unit_id", this.unitId); + } + if (this.subscriptionId != null) { formData.put("subscription_id", this.subscriptionId); @@ -174,6 +187,8 @@ public static final class AlertCreateBuilder { private String currencyCode; + private String unitId; + private String subscriptionId; private String meta; @@ -209,6 +224,11 @@ public AlertCreateBuilder currencyCode(String value) { return this; } + public AlertCreateBuilder unitId(String value) { + this.unitId = value; + return this; + } + public AlertCreateBuilder subscriptionId(String value) { this.subscriptionId = value; return this; @@ -239,6 +259,8 @@ public enum Type { SPEND_EXCEEDED("spend_exceeded"), + CREDIT_BALANCE_DROPPED("credit_balance_dropped"), + /** An enum member indicating that Type was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; diff --git a/src/main/java/com/chargebee/v4/models/alert/params/AlertListParams.java b/src/main/java/com/chargebee/v4/models/alert/params/AlertListParams.java index 5c8f7462..911dea6b 100644 --- a/src/main/java/com/chargebee/v4/models/alert/params/AlertListParams.java +++ b/src/main/java/com/chargebee/v4/models/alert/params/AlertListParams.java @@ -209,6 +209,8 @@ public enum TypeIs { SPEND_EXCEEDED("spend_exceeded"), + CREDIT_BALANCE_DROPPED("credit_balance_dropped"), + /** An enum member indicating that TypeIs was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; @@ -265,6 +267,8 @@ public enum Type { SPEND_EXCEEDED("spend_exceeded"), + CREDIT_BALANCE_DROPPED("credit_balance_dropped"), + /** An enum member indicating that Type was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; diff --git a/src/main/java/com/chargebee/v4/models/alert/params/ApplicationAlertsForSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/alert/params/ApplicationAlertsForSubscriptionParams.java index e2aa0a3c..f42793e3 100644 --- a/src/main/java/com/chargebee/v4/models/alert/params/ApplicationAlertsForSubscriptionParams.java +++ b/src/main/java/com/chargebee/v4/models/alert/params/ApplicationAlertsForSubscriptionParams.java @@ -224,6 +224,8 @@ public enum TypeIs { SPEND_EXCEEDED("spend_exceeded"), + CREDIT_BALANCE_DROPPED("credit_balance_dropped"), + /** An enum member indicating that TypeIs was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; @@ -280,6 +282,8 @@ public enum Type { SPEND_EXCEEDED("spend_exceeded"), + CREDIT_BALANCE_DROPPED("credit_balance_dropped"), + /** An enum member indicating that Type was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; diff --git a/src/main/java/com/chargebee/v4/models/creditNote/params/CreditNoteRecordRefundParams.java b/src/main/java/com/chargebee/v4/models/creditNote/params/CreditNoteRecordRefundParams.java index 11735d89..09c97bde 100644 --- a/src/main/java/com/chargebee/v4/models/creditNote/params/CreditNoteRecordRefundParams.java +++ b/src/main/java/com/chargebee/v4/models/creditNote/params/CreditNoteRecordRefundParams.java @@ -268,6 +268,14 @@ public enum PaymentMethod { CUSTOM("custom"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that PaymentMethod was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; diff --git a/src/main/java/com/chargebee/v4/models/creditNote/params/ImportCreditNoteParams.java b/src/main/java/com/chargebee/v4/models/creditNote/params/ImportCreditNoteParams.java index e9b29e75..d00c728b 100644 --- a/src/main/java/com/chargebee/v4/models/creditNote/params/ImportCreditNoteParams.java +++ b/src/main/java/com/chargebee/v4/models/creditNote/params/ImportCreditNoteParams.java @@ -2340,6 +2340,14 @@ public enum PaymentMethod { CUSTOM("custom"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that PaymentMethod was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; diff --git a/src/main/java/com/chargebee/v4/models/creditUnit/CreditUnit.java b/src/main/java/com/chargebee/v4/models/creditUnit/CreditUnit.java new file mode 100644 index 00000000..7c726074 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/creditUnit/CreditUnit.java @@ -0,0 +1,199 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.creditUnit; + +import com.chargebee.v4.internal.JsonUtil; +import com.google.gson.JsonObject; +import java.sql.Timestamp; + +public class CreditUnit { + + private String id; + private String name; + private String externalName; + private Status status; + private Long resourceVersion; + private Timestamp updatedAt; + private Timestamp createdAt; + private String createdBy; + private String updatedBy; + private Boolean isUnlimited; + private String overdraftAmount; + + public String getId() { + return id; + } + + public String getName() { + return name; + } + + public String getExternalName() { + return externalName; + } + + public Status getStatus() { + return status; + } + + public Long getResourceVersion() { + return resourceVersion; + } + + public Timestamp getUpdatedAt() { + return updatedAt; + } + + public Timestamp getCreatedAt() { + return createdAt; + } + + public String getCreatedBy() { + return createdBy; + } + + public String getUpdatedBy() { + return updatedBy; + } + + public Boolean getIsUnlimited() { + return isUnlimited; + } + + public String getOverdraftAmount() { + return overdraftAmount; + } + + public enum Status { + ACTIVE("active"), + + ARCHIVED("archived"), + + /** An enum member indicating that Status was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + Status(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static Status fromString(String value) { + if (value == null) return _UNKNOWN; + for (Status enumValue : Status.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static CreditUnit fromJson(String json) { + return fromJson(JsonUtil.parse(json)); + } + + public static CreditUnit fromJson(java.util.Map map) { + return fromJson(JsonUtil.toJson(map)); + } + + public static CreditUnit fromJson(JsonObject jsonObj) { + CreditUnit obj = new CreditUnit(); + + obj.id = JsonUtil.getString(jsonObj, "id"); + + obj.name = JsonUtil.getString(jsonObj, "name"); + + obj.externalName = JsonUtil.getString(jsonObj, "external_name"); + + obj.status = Status.fromString(JsonUtil.getString(jsonObj, "status")); + + obj.resourceVersion = JsonUtil.getLong(jsonObj, "resource_version"); + + obj.updatedAt = JsonUtil.getTimestamp(jsonObj, "updated_at"); + + obj.createdAt = JsonUtil.getTimestamp(jsonObj, "created_at"); + + obj.createdBy = JsonUtil.getString(jsonObj, "created_by"); + + obj.updatedBy = JsonUtil.getString(jsonObj, "updated_by"); + + obj.isUnlimited = JsonUtil.getBoolean(jsonObj, "is_unlimited"); + + obj.overdraftAmount = JsonUtil.getString(jsonObj, "overdraft_amount"); + + return obj; + } + + @Override + public String toString() { + return "CreditUnit{" + + "id=" + + id + + ", name=" + + name + + ", externalName=" + + externalName + + ", status=" + + status + + ", resourceVersion=" + + resourceVersion + + ", updatedAt=" + + updatedAt + + ", createdAt=" + + createdAt + + ", createdBy=" + + createdBy + + ", updatedBy=" + + updatedBy + + ", isUnlimited=" + + isUnlimited + + ", overdraftAmount=" + + overdraftAmount + + "}"; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + CreditUnit that = (CreditUnit) o; + return java.util.Objects.equals(id, that.id) + && java.util.Objects.equals(name, that.name) + && java.util.Objects.equals(externalName, that.externalName) + && java.util.Objects.equals(status, that.status) + && java.util.Objects.equals(resourceVersion, that.resourceVersion) + && java.util.Objects.equals(updatedAt, that.updatedAt) + && java.util.Objects.equals(createdAt, that.createdAt) + && java.util.Objects.equals(createdBy, that.createdBy) + && java.util.Objects.equals(updatedBy, that.updatedBy) + && java.util.Objects.equals(isUnlimited, that.isUnlimited) + && java.util.Objects.equals(overdraftAmount, that.overdraftAmount); + } + + @Override + public int hashCode() { + + return java.util.Objects.hash( + id, + name, + externalName, + status, + resourceVersion, + updatedAt, + createdAt, + createdBy, + updatedBy, + isUnlimited, + overdraftAmount); + } +} diff --git a/src/main/java/com/chargebee/v4/models/creditUnit/params/CreditUnitArchiveParams.java b/src/main/java/com/chargebee/v4/models/creditUnit/params/CreditUnitArchiveParams.java new file mode 100644 index 00000000..c20d5d09 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/creditUnit/params/CreditUnitArchiveParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.creditUnit.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CreditUnitArchiveParams { + + private CreditUnitArchiveParams(CreditUnitArchiveBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for CreditUnitArchiveParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CreditUnitArchiveBuilder builder() { + return new CreditUnitArchiveBuilder(); + } + + public static final class CreditUnitArchiveBuilder { + + private CreditUnitArchiveBuilder() {} + + public CreditUnitArchiveParams build() { + return new CreditUnitArchiveParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/creditUnit/params/CreditUnitCreateParams.java b/src/main/java/com/chargebee/v4/models/creditUnit/params/CreditUnitCreateParams.java new file mode 100644 index 00000000..f1c9a6d6 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/creditUnit/params/CreditUnitCreateParams.java @@ -0,0 +1,140 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.creditUnit.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CreditUnitCreateParams { + + private final String id; + + private final String name; + + private final Boolean isUnlimited; + + private final String overdraftAmount; + + private final String externalName; + + private CreditUnitCreateParams(CreditUnitCreateBuilder builder) { + + this.id = builder.id; + + this.name = builder.name; + + this.isUnlimited = builder.isUnlimited; + + this.overdraftAmount = builder.overdraftAmount; + + this.externalName = builder.externalName; + } + + public String getId() { + return id; + } + + public String getName() { + return name; + } + + public Boolean getIsUnlimited() { + return isUnlimited; + } + + public String getOverdraftAmount() { + return overdraftAmount; + } + + public String getExternalName() { + return externalName; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.id != null) { + + formData.put("id", this.id); + } + + if (this.name != null) { + + formData.put("name", this.name); + } + + if (this.isUnlimited != null) { + + formData.put("is_unlimited", this.isUnlimited); + } + + if (this.overdraftAmount != null) { + + formData.put("overdraft_amount", this.overdraftAmount); + } + + if (this.externalName != null) { + + formData.put("external_name", this.externalName); + } + + return formData; + } + + /** Create a new builder for CreditUnitCreateParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CreditUnitCreateBuilder builder() { + return new CreditUnitCreateBuilder(); + } + + public static final class CreditUnitCreateBuilder { + + private String id; + + private String name; + + private Boolean isUnlimited; + + private String overdraftAmount; + + private String externalName; + + private CreditUnitCreateBuilder() {} + + public CreditUnitCreateBuilder id(String value) { + this.id = value; + return this; + } + + public CreditUnitCreateBuilder name(String value) { + this.name = value; + return this; + } + + public CreditUnitCreateBuilder isUnlimited(Boolean value) { + this.isUnlimited = value; + return this; + } + + public CreditUnitCreateBuilder overdraftAmount(String value) { + this.overdraftAmount = value; + return this; + } + + public CreditUnitCreateBuilder externalName(String value) { + this.externalName = value; + return this; + } + + public CreditUnitCreateParams build() { + return new CreditUnitCreateParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/creditUnit/params/CreditUnitListParams.java b/src/main/java/com/chargebee/v4/models/creditUnit/params/CreditUnitListParams.java new file mode 100644 index 00000000..2bec3c69 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/creditUnit/params/CreditUnitListParams.java @@ -0,0 +1,218 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.creditUnit.params; + +import com.chargebee.v4.internal.Recommended; +import com.chargebee.v4.filters.StringFilter; +import com.chargebee.v4.filters.EnumFilter; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CreditUnitListParams { + + private final Map queryParams; + + private CreditUnitListParams(CreditUnitListBuilder builder) { + this.queryParams = Collections.unmodifiableMap(new LinkedHashMap<>(builder.queryParams)); + } + + /** Get the query parameters for this request. */ + public Map toQueryParams() { + return queryParams; + } + + public CreditUnitListBuilder toBuilder() { + CreditUnitListBuilder builder = new CreditUnitListBuilder(); + builder.queryParams.putAll(queryParams); + return builder; + } + + /** Create a new builder for CreditUnitListParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CreditUnitListBuilder builder() { + return new CreditUnitListBuilder(); + } + + public static final class CreditUnitListBuilder { + private final Map queryParams = new LinkedHashMap<>(); + + private CreditUnitListBuilder() {} + + public CreditUnitListBuilder limit(Integer value) { + queryParams.put("limit", value); + return this; + } + + public CreditUnitListBuilder offset(String value) { + queryParams.put("offset", value); + return this; + } + + public StatusFilter status() { + return new StatusFilter("status", this, queryParams); + } + + public IdFilter id() { + return new IdFilter("id", this, queryParams); + } + + public CreditUnitListParams build() { + return new CreditUnitListParams(this); + } + + public static final class StatusFilter extends EnumFilter { + StatusFilter(String fieldName, CreditUnitListBuilder builder, Map params) { + super(fieldName, builder, params, Status::getValue); + } + + /** + * @deprecated This method accepting raw String will be removed in a future version. Use the + * type-safe enum overload instead: + *
{@code .status().is(Status.YOUR_VALUE)}
+ * + * @see #is(Status) + */ + @Deprecated + public CreditUnitListBuilder is(String value) { + params.put(fieldName + "[is]", value); + return builder; + } + + /** + * @deprecated This method accepting raw String will be removed in a future version. Use the + * type-safe enum overload instead: + *
{@code .status().isNot(Status.YOUR_VALUE)}
+ * + * @see #isNot(Status) + */ + @Deprecated + public CreditUnitListBuilder isNot(String value) { + params.put(fieldName + "[is_not]", value); + return builder; + } + + /** + * @deprecated This method accepting raw String will be removed in a future version. Use the + * type-safe enum overload instead: + *
{@code .status().in(Status.VALUE1, Status.VALUE2)}
+ * + * @see #in(Status[]) + */ + @Deprecated + public CreditUnitListBuilder in(String... values) { + params.put(fieldName + "[in]", "[" + String.join(",", values) + "]"); + return builder; + } + + /** + * @deprecated This method accepting raw String will be removed in a future version. Use the + * type-safe enum overload instead: + *
{@code .status().notIn(Status.VALUE1, Status.VALUE2)}
+ * + * @see #notIn(Status[]) + */ + @Deprecated + public CreditUnitListBuilder notIn(String... values) { + params.put(fieldName + "[not_in]", "[" + String.join(",", values) + "]"); + return builder; + } + } + + public static final class IdFilter extends StringFilter { + IdFilter(String fieldName, CreditUnitListBuilder builder, Map params) { + super(fieldName, builder, params); + } + } + } + + public enum StatusIn { + ACTIVE("active"), + + ARCHIVED("archived"), + + /** An enum member indicating that StatusIn was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + StatusIn(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static StatusIn fromString(String value) { + if (value == null) return _UNKNOWN; + for (StatusIn enumValue : StatusIn.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum StatusIs { + ACTIVE("active"), + + ARCHIVED("archived"), + + /** An enum member indicating that StatusIs was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + StatusIs(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static StatusIs fromString(String value) { + if (value == null) return _UNKNOWN; + for (StatusIs enumValue : StatusIs.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum Status { + ACTIVE("active"), + + ARCHIVED("archived"), + + /** An enum member indicating that Status was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + Status(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static Status fromString(String value) { + if (value == null) return _UNKNOWN; + for (Status enumValue : Status.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/creditUnit/params/CreditUnitReactivateParams.java b/src/main/java/com/chargebee/v4/models/creditUnit/params/CreditUnitReactivateParams.java new file mode 100644 index 00000000..3ad7abe8 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/creditUnit/params/CreditUnitReactivateParams.java @@ -0,0 +1,39 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.creditUnit.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CreditUnitReactivateParams { + + private CreditUnitReactivateParams(CreditUnitReactivateBuilder builder) {} + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + return formData; + } + + /** Create a new builder for CreditUnitReactivateParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CreditUnitReactivateBuilder builder() { + return new CreditUnitReactivateBuilder(); + } + + public static final class CreditUnitReactivateBuilder { + + private CreditUnitReactivateBuilder() {} + + public CreditUnitReactivateParams build() { + return new CreditUnitReactivateParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/creditUnit/params/CreditUnitUpdateParams.java b/src/main/java/com/chargebee/v4/models/creditUnit/params/CreditUnitUpdateParams.java new file mode 100644 index 00000000..aa3b6973 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/creditUnit/params/CreditUnitUpdateParams.java @@ -0,0 +1,80 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.creditUnit.params; + +import com.chargebee.v4.internal.Recommended; + +import java.util.LinkedHashMap; +import java.util.Map; + +public final class CreditUnitUpdateParams { + + private final String name; + + private final String externalName; + + private CreditUnitUpdateParams(CreditUnitUpdateBuilder builder) { + + this.name = builder.name; + + this.externalName = builder.externalName; + } + + public String getName() { + return name; + } + + public String getExternalName() { + return externalName; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.name != null) { + + formData.put("name", this.name); + } + + if (this.externalName != null) { + + formData.put("external_name", this.externalName); + } + + return formData; + } + + /** Create a new builder for CreditUnitUpdateParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static CreditUnitUpdateBuilder builder() { + return new CreditUnitUpdateBuilder(); + } + + public static final class CreditUnitUpdateBuilder { + + private String name; + + private String externalName; + + private CreditUnitUpdateBuilder() {} + + public CreditUnitUpdateBuilder name(String value) { + this.name = value; + return this; + } + + public CreditUnitUpdateBuilder externalName(String value) { + this.externalName = value; + return this; + } + + public CreditUnitUpdateParams build() { + return new CreditUnitUpdateParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/creditUnit/responses/CreditUnitArchiveResponse.java b/src/main/java/com/chargebee/v4/models/creditUnit/responses/CreditUnitArchiveResponse.java new file mode 100644 index 00000000..eceefa15 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/creditUnit/responses/CreditUnitArchiveResponse.java @@ -0,0 +1,99 @@ +package com.chargebee.v4.models.creditUnit.responses; + +import com.chargebee.v4.models.creditUnit.CreditUnit; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.google.gson.JsonObject; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CreditUnitArchive operation. Contains the response data from the + * API. + */ +public final class CreditUnitArchiveResponse extends BaseResponse { + private final CreditUnit creditUnit; + + private CreditUnitArchiveResponse(Builder builder) { + super(builder.httpResponse); + + this.creditUnit = builder.creditUnit; + } + + /** Parse JSON response into CreditUnitArchiveResponse object. */ + public static CreditUnitArchiveResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CreditUnitArchiveResponse object with HTTP response. */ + public static CreditUnitArchiveResponse fromJson(String json, Response httpResponse) { + try { + JsonObject jsonObj = JsonUtil.parse(json); + Builder builder = builder(); + + JsonObject __creditUnitObj = JsonUtil.getJsonObject(jsonObj, "credit_unit"); + if (__creditUnitObj != null) { + builder.creditUnit(CreditUnit.fromJson(__creditUnitObj)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CreditUnitArchiveResponse from JSON", e); + } + } + + /** Create a new builder for CreditUnitArchiveResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CreditUnitArchiveResponse. */ + public static class Builder { + + private CreditUnit creditUnit; + + private Response httpResponse; + + private Builder() {} + + public Builder creditUnit(CreditUnit creditUnit) { + this.creditUnit = creditUnit; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CreditUnitArchiveResponse build() { + return new CreditUnitArchiveResponse(this); + } + } + + /** Get the creditUnit from the response. */ + public CreditUnit getCreditUnit() { + return creditUnit; + } + + @Override + public String toString() { + return "CreditUnitArchiveResponse{" + "creditUnit=" + creditUnit + "}"; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + CreditUnitArchiveResponse that = (CreditUnitArchiveResponse) o; + return java.util.Objects.equals(creditUnit, that.creditUnit); + } + + @Override + public int hashCode() { + + return java.util.Objects.hash(creditUnit); + } +} diff --git a/src/main/java/com/chargebee/v4/models/creditUnit/responses/CreditUnitCreateResponse.java b/src/main/java/com/chargebee/v4/models/creditUnit/responses/CreditUnitCreateResponse.java new file mode 100644 index 00000000..3a790bd0 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/creditUnit/responses/CreditUnitCreateResponse.java @@ -0,0 +1,99 @@ +package com.chargebee.v4.models.creditUnit.responses; + +import com.chargebee.v4.models.creditUnit.CreditUnit; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.google.gson.JsonObject; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CreditUnitCreate operation. Contains the response data from the + * API. + */ +public final class CreditUnitCreateResponse extends BaseResponse { + private final CreditUnit creditUnit; + + private CreditUnitCreateResponse(Builder builder) { + super(builder.httpResponse); + + this.creditUnit = builder.creditUnit; + } + + /** Parse JSON response into CreditUnitCreateResponse object. */ + public static CreditUnitCreateResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CreditUnitCreateResponse object with HTTP response. */ + public static CreditUnitCreateResponse fromJson(String json, Response httpResponse) { + try { + JsonObject jsonObj = JsonUtil.parse(json); + Builder builder = builder(); + + JsonObject __creditUnitObj = JsonUtil.getJsonObject(jsonObj, "credit_unit"); + if (__creditUnitObj != null) { + builder.creditUnit(CreditUnit.fromJson(__creditUnitObj)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CreditUnitCreateResponse from JSON", e); + } + } + + /** Create a new builder for CreditUnitCreateResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CreditUnitCreateResponse. */ + public static class Builder { + + private CreditUnit creditUnit; + + private Response httpResponse; + + private Builder() {} + + public Builder creditUnit(CreditUnit creditUnit) { + this.creditUnit = creditUnit; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CreditUnitCreateResponse build() { + return new CreditUnitCreateResponse(this); + } + } + + /** Get the creditUnit from the response. */ + public CreditUnit getCreditUnit() { + return creditUnit; + } + + @Override + public String toString() { + return "CreditUnitCreateResponse{" + "creditUnit=" + creditUnit + "}"; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + CreditUnitCreateResponse that = (CreditUnitCreateResponse) o; + return java.util.Objects.equals(creditUnit, that.creditUnit); + } + + @Override + public int hashCode() { + + return java.util.Objects.hash(creditUnit); + } +} diff --git a/src/main/java/com/chargebee/v4/models/creditUnit/responses/CreditUnitListResponse.java b/src/main/java/com/chargebee/v4/models/creditUnit/responses/CreditUnitListResponse.java new file mode 100644 index 00000000..4270c257 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/creditUnit/responses/CreditUnitListResponse.java @@ -0,0 +1,209 @@ +package com.chargebee.v4.models.creditUnit.responses; + +import java.util.List; + +import com.chargebee.v4.models.creditUnit.CreditUnit; + +import com.chargebee.v4.exceptions.ChargebeeException; +import com.chargebee.v4.internal.JsonUtil; +import com.google.gson.JsonObject; +import com.chargebee.v4.transport.Response; +import com.chargebee.v4.services.CreditUnitService; +import com.chargebee.v4.models.creditUnit.params.CreditUnitListParams; + +/** Immutable response object for CreditUnitList operation. Contains paginated list data. */ +public final class CreditUnitListResponse { + + private final List list; + + private final String nextOffset; + + private final CreditUnitService service; + private final CreditUnitListParams originalParams; + private final Response httpResponse; + + private CreditUnitListResponse( + List list, + String nextOffset, + CreditUnitService service, + CreditUnitListParams originalParams, + Response httpResponse) { + + this.list = list; + + this.nextOffset = nextOffset; + + this.service = service; + this.originalParams = originalParams; + this.httpResponse = httpResponse; + } + + /** + * Parse JSON response into CreditUnitListResponse object (no service context). Use this when you + * only need to read a single page (no nextPage()). + */ + public static CreditUnitListResponse fromJson(String json) { + try { + JsonObject jsonObj = JsonUtil.parse(json); + + List list = + JsonUtil.mapArray(JsonUtil.getJsonArray(jsonObj, "list"), CreditUnitListItem::fromJson); + + String nextOffset = JsonUtil.getString(jsonObj, "next_offset"); + + return new CreditUnitListResponse(list, nextOffset, null, null, null); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CreditUnitListResponse from JSON", e); + } + } + + /** + * Parse JSON response into CreditUnitListResponse object with service context for pagination + * (enables nextPage()). + */ + public static CreditUnitListResponse fromJson( + String json, + CreditUnitService service, + CreditUnitListParams originalParams, + Response httpResponse) { + try { + JsonObject jsonObj = JsonUtil.parse(json); + + List list = + JsonUtil.mapArray(JsonUtil.getJsonArray(jsonObj, "list"), CreditUnitListItem::fromJson); + + String nextOffset = JsonUtil.getString(jsonObj, "next_offset"); + + return new CreditUnitListResponse(list, nextOffset, service, originalParams, httpResponse); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CreditUnitListResponse from JSON", e); + } + } + + /** Get the list from the response. */ + public List getList() { + return list; + } + + /** Get the nextOffset from the response. */ + public String getNextOffset() { + return nextOffset; + } + + /** Check if there are more pages available. */ + public boolean hasNextPage() { + return nextOffset != null && !nextOffset.isEmpty(); + } + + /** + * Get the next page of results. + * + * @throws ChargebeeException if unable to fetch next page + */ + public CreditUnitListResponse nextPage() throws ChargebeeException { + if (!hasNextPage()) { + throw new IllegalStateException("No more pages available"); + } + if (service == null) { + throw new UnsupportedOperationException( + "nextPage() requires service context. Use fromJson(json, service, originalParams, httpResponse)."); + } + + CreditUnitListParams nextParams = + (originalParams != null ? originalParams.toBuilder() : CreditUnitListParams.builder()) + .offset(nextOffset) + .build(); + + return service.list(nextParams); + } + + /** Get the raw response payload as JSON string. */ + public String responsePayload() { + return httpResponse != null ? httpResponse.getBodyAsString() : null; + } + + /** Get the HTTP status code. */ + public int httpStatus() { + return httpResponse != null ? httpResponse.getStatusCode() : 0; + } + + /** Get response headers. */ + public java.util.Map> headers() { + return httpResponse != null ? httpResponse.getHeaders() : java.util.Collections.emptyMap(); + } + + /** Get a specific header value. */ + public java.util.List header(String name) { + if (httpResponse == null) return null; + return httpResponse.getHeaders().entrySet().stream() + .filter(e -> e.getKey().equalsIgnoreCase(name)) + .map(java.util.Map.Entry::getValue) + .findFirst() + .orElse(null); + } + + @Override + public String toString() { + return "CreditUnitListResponse{" + "list=" + list + ", nextOffset=" + nextOffset + "}"; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + CreditUnitListResponse that = (CreditUnitListResponse) o; + return java.util.Objects.equals(list, that.list) + && java.util.Objects.equals(nextOffset, that.nextOffset); + } + + @Override + public int hashCode() { + + return java.util.Objects.hash(list, nextOffset); + } + + public static class CreditUnitListItem { + + private CreditUnit creditUnit; + + public CreditUnit getCreditUnit() { + return creditUnit; + } + + public static CreditUnitListItem fromJson(String json) { + return fromJson(JsonUtil.parse(json)); + } + + public static CreditUnitListItem fromJson(JsonObject jsonObj) { + CreditUnitListItem item = new CreditUnitListItem(); + + JsonObject __creditUnitObj = JsonUtil.getJsonObject(jsonObj, "credit_unit"); + if (__creditUnitObj != null) { + item.creditUnit = CreditUnit.fromJson(__creditUnitObj); + } + + return item; + } + + @Override + public String toString() { + return "CreditUnitListItem{" + "creditUnit=" + creditUnit + "}"; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + CreditUnitListItem that = (CreditUnitListItem) o; + return java.util.Objects.equals(creditUnit, that.creditUnit); + } + + @Override + public int hashCode() { + + return java.util.Objects.hash(creditUnit); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/creditUnit/responses/CreditUnitReactivateResponse.java b/src/main/java/com/chargebee/v4/models/creditUnit/responses/CreditUnitReactivateResponse.java new file mode 100644 index 00000000..e3628f90 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/creditUnit/responses/CreditUnitReactivateResponse.java @@ -0,0 +1,99 @@ +package com.chargebee.v4.models.creditUnit.responses; + +import com.chargebee.v4.models.creditUnit.CreditUnit; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.google.gson.JsonObject; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CreditUnitReactivate operation. Contains the response data from the + * API. + */ +public final class CreditUnitReactivateResponse extends BaseResponse { + private final CreditUnit creditUnit; + + private CreditUnitReactivateResponse(Builder builder) { + super(builder.httpResponse); + + this.creditUnit = builder.creditUnit; + } + + /** Parse JSON response into CreditUnitReactivateResponse object. */ + public static CreditUnitReactivateResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CreditUnitReactivateResponse object with HTTP response. */ + public static CreditUnitReactivateResponse fromJson(String json, Response httpResponse) { + try { + JsonObject jsonObj = JsonUtil.parse(json); + Builder builder = builder(); + + JsonObject __creditUnitObj = JsonUtil.getJsonObject(jsonObj, "credit_unit"); + if (__creditUnitObj != null) { + builder.creditUnit(CreditUnit.fromJson(__creditUnitObj)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CreditUnitReactivateResponse from JSON", e); + } + } + + /** Create a new builder for CreditUnitReactivateResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CreditUnitReactivateResponse. */ + public static class Builder { + + private CreditUnit creditUnit; + + private Response httpResponse; + + private Builder() {} + + public Builder creditUnit(CreditUnit creditUnit) { + this.creditUnit = creditUnit; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CreditUnitReactivateResponse build() { + return new CreditUnitReactivateResponse(this); + } + } + + /** Get the creditUnit from the response. */ + public CreditUnit getCreditUnit() { + return creditUnit; + } + + @Override + public String toString() { + return "CreditUnitReactivateResponse{" + "creditUnit=" + creditUnit + "}"; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + CreditUnitReactivateResponse that = (CreditUnitReactivateResponse) o; + return java.util.Objects.equals(creditUnit, that.creditUnit); + } + + @Override + public int hashCode() { + + return java.util.Objects.hash(creditUnit); + } +} diff --git a/src/main/java/com/chargebee/v4/models/creditUnit/responses/CreditUnitUpdateResponse.java b/src/main/java/com/chargebee/v4/models/creditUnit/responses/CreditUnitUpdateResponse.java new file mode 100644 index 00000000..a963bdc8 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/creditUnit/responses/CreditUnitUpdateResponse.java @@ -0,0 +1,99 @@ +package com.chargebee.v4.models.creditUnit.responses; + +import com.chargebee.v4.models.creditUnit.CreditUnit; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.google.gson.JsonObject; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for CreditUnitUpdate operation. Contains the response data from the + * API. + */ +public final class CreditUnitUpdateResponse extends BaseResponse { + private final CreditUnit creditUnit; + + private CreditUnitUpdateResponse(Builder builder) { + super(builder.httpResponse); + + this.creditUnit = builder.creditUnit; + } + + /** Parse JSON response into CreditUnitUpdateResponse object. */ + public static CreditUnitUpdateResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into CreditUnitUpdateResponse object with HTTP response. */ + public static CreditUnitUpdateResponse fromJson(String json, Response httpResponse) { + try { + JsonObject jsonObj = JsonUtil.parse(json); + Builder builder = builder(); + + JsonObject __creditUnitObj = JsonUtil.getJsonObject(jsonObj, "credit_unit"); + if (__creditUnitObj != null) { + builder.creditUnit(CreditUnit.fromJson(__creditUnitObj)); + } + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse CreditUnitUpdateResponse from JSON", e); + } + } + + /** Create a new builder for CreditUnitUpdateResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for CreditUnitUpdateResponse. */ + public static class Builder { + + private CreditUnit creditUnit; + + private Response httpResponse; + + private Builder() {} + + public Builder creditUnit(CreditUnit creditUnit) { + this.creditUnit = creditUnit; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public CreditUnitUpdateResponse build() { + return new CreditUnitUpdateResponse(this); + } + } + + /** Get the creditUnit from the response. */ + public CreditUnit getCreditUnit() { + return creditUnit; + } + + @Override + public String toString() { + return "CreditUnitUpdateResponse{" + "creditUnit=" + creditUnit + "}"; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + CreditUnitUpdateResponse that = (CreditUnitUpdateResponse) o; + return java.util.Objects.equals(creditUnit, that.creditUnit); + } + + @Override + public int hashCode() { + + return java.util.Objects.hash(creditUnit); + } +} diff --git a/src/main/java/com/chargebee/v4/models/customer/Customer.java b/src/main/java/com/chargebee/v4/models/customer/Customer.java index 64e5176d..96e7b7ac 100644 --- a/src/main/java/com/chargebee/v4/models/customer/Customer.java +++ b/src/main/java/com/chargebee/v4/models/customer/Customer.java @@ -2153,6 +2153,14 @@ public enum Type { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that Type was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; diff --git a/src/main/java/com/chargebee/v4/models/customer/params/CustomerCollectPaymentParams.java b/src/main/java/com/chargebee/v4/models/customer/params/CustomerCollectPaymentParams.java index b7f5901b..97b61fd0 100644 --- a/src/main/java/com/chargebee/v4/models/customer/params/CustomerCollectPaymentParams.java +++ b/src/main/java/com/chargebee/v4/models/customer/params/CustomerCollectPaymentParams.java @@ -590,6 +590,14 @@ public enum Type { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that Type was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; @@ -1257,6 +1265,14 @@ public enum PaymentMethodType { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** * An enum member indicating that PaymentMethodType was instantiated with an unknown value. */ diff --git a/src/main/java/com/chargebee/v4/models/customer/params/CustomerCreateParams.java b/src/main/java/com/chargebee/v4/models/customer/params/CustomerCreateParams.java index 0c045f07..fe3114f5 100644 --- a/src/main/java/com/chargebee/v4/models/customer/params/CustomerCreateParams.java +++ b/src/main/java/com/chargebee/v4/models/customer/params/CustomerCreateParams.java @@ -2603,6 +2603,14 @@ public enum Type { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that Type was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; @@ -3034,6 +3042,14 @@ public enum PaymentMethodType { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** * An enum member indicating that PaymentMethodType was instantiated with an unknown value. */ diff --git a/src/main/java/com/chargebee/v4/models/customer/params/CustomerRecordExcessPaymentParams.java b/src/main/java/com/chargebee/v4/models/customer/params/CustomerRecordExcessPaymentParams.java index 7598b007..dd24927f 100644 --- a/src/main/java/com/chargebee/v4/models/customer/params/CustomerRecordExcessPaymentParams.java +++ b/src/main/java/com/chargebee/v4/models/customer/params/CustomerRecordExcessPaymentParams.java @@ -335,6 +335,14 @@ public enum PaymentMethod { CUSTOM("custom"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that PaymentMethod was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; diff --git a/src/main/java/com/chargebee/v4/models/customer/params/CustomerUpdatePaymentMethodParams.java b/src/main/java/com/chargebee/v4/models/customer/params/CustomerUpdatePaymentMethodParams.java index ed6c5cb4..5f5bb2d2 100644 --- a/src/main/java/com/chargebee/v4/models/customer/params/CustomerUpdatePaymentMethodParams.java +++ b/src/main/java/com/chargebee/v4/models/customer/params/CustomerUpdatePaymentMethodParams.java @@ -400,6 +400,14 @@ public enum Type { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that Type was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; diff --git a/src/main/java/com/chargebee/v4/models/entitlement/params/EntitlementListParams.java b/src/main/java/com/chargebee/v4/models/entitlement/params/EntitlementListParams.java index b10179b6..22469fb1 100644 --- a/src/main/java/com/chargebee/v4/models/entitlement/params/EntitlementListParams.java +++ b/src/main/java/com/chargebee/v4/models/entitlement/params/EntitlementListParams.java @@ -157,7 +157,7 @@ public static final class EntityIdFilter extends StringFilter subscriptionItems; @@ -58,6 +60,8 @@ private EstimateCancelSubscriptionForItemsParams( this.invoiceDate = builder.invoiceDate; + this.includeCancellationDayInBilling = builder.includeCancellationDayInBilling; + this.cancelReasonCode = builder.cancelReasonCode; this.subscriptionItems = builder.subscriptionItems; @@ -99,6 +103,10 @@ public Timestamp getInvoiceDate() { return invoiceDate; } + public Boolean getIncludeCancellationDayInBilling() { + return includeCancellationDayInBilling; + } + public String getCancelReasonCode() { return cancelReasonCode; } @@ -157,6 +165,11 @@ public Map toFormData() { formData.put("invoice_date", this.invoiceDate); } + if (this.includeCancellationDayInBilling != null) { + + formData.put("include_cancellation_day_in_billing", this.includeCancellationDayInBilling); + } + if (this.cancelReasonCode != null) { formData.put("cancel_reason_code", this.cancelReasonCode); @@ -206,6 +219,8 @@ public static final class EstimateCancelSubscriptionForItemsBuilder { private Timestamp invoiceDate; + private Boolean includeCancellationDayInBilling; + private String cancelReasonCode; private List subscriptionItems; @@ -262,6 +277,12 @@ public EstimateCancelSubscriptionForItemsBuilder invoiceDate(Timestamp value) { return this; } + public EstimateCancelSubscriptionForItemsBuilder includeCancellationDayInBilling( + Boolean value) { + this.includeCancellationDayInBilling = value; + return this; + } + public EstimateCancelSubscriptionForItemsBuilder cancelReasonCode(String value) { this.cancelReasonCode = value; return this; diff --git a/src/main/java/com/chargebee/v4/models/estimate/params/EstimateGiftSubscriptionForItemsParams.java b/src/main/java/com/chargebee/v4/models/estimate/params/EstimateGiftSubscriptionForItemsParams.java index 901511a9..0c779b50 100644 --- a/src/main/java/com/chargebee/v4/models/estimate/params/EstimateGiftSubscriptionForItemsParams.java +++ b/src/main/java/com/chargebee/v4/models/estimate/params/EstimateGiftSubscriptionForItemsParams.java @@ -836,6 +836,14 @@ public enum PaymentMethodType { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** * An enum member indicating that PaymentMethodType was instantiated with an unknown value. */ diff --git a/src/main/java/com/chargebee/v4/models/estimate/params/EstimateGiftSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/estimate/params/EstimateGiftSubscriptionParams.java index 38708cdb..fd565ed5 100644 --- a/src/main/java/com/chargebee/v4/models/estimate/params/EstimateGiftSubscriptionParams.java +++ b/src/main/java/com/chargebee/v4/models/estimate/params/EstimateGiftSubscriptionParams.java @@ -830,6 +830,14 @@ public enum PaymentMethodType { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** * An enum member indicating that PaymentMethodType was instantiated with an unknown value. */ diff --git a/src/main/java/com/chargebee/v4/models/event/Event.java b/src/main/java/com/chargebee/v4/models/event/Event.java index 2ccf040c..bf540493 100644 --- a/src/main/java/com/chargebee/v4/models/event/Event.java +++ b/src/main/java/com/chargebee/v4/models/event/Event.java @@ -615,6 +615,14 @@ public enum EventType { OMNICHANNEL_SUBSCRIPTION_ITEM_RECOVERED("omnichannel_subscription_item_recovered"), + LEDGER_ACCOUNT_BALANCE_UPDATED("ledger_account_balance_updated"), + + GRANT_BLOCKS_CREATED("grant_blocks_created"), + + GRANT_BLOCKS_UPDATED("grant_blocks_updated"), + + LEDGER_UPDATED("ledger_updated"), + PLAN_CREATED("plan_created"), PLAN_UPDATED("plan_updated"), diff --git a/src/main/java/com/chargebee/v4/models/event/GrantBlocksCreatedEvent.java b/src/main/java/com/chargebee/v4/models/event/GrantBlocksCreatedEvent.java new file mode 100644 index 00000000..7b588b96 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/event/GrantBlocksCreatedEvent.java @@ -0,0 +1,182 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.event; + +import com.chargebee.v4.internal.JsonUtil; +import com.google.gson.JsonObject; +import java.util.List; + +import com.chargebee.v4.models.grantBlock.GrantBlock; + +public class GrantBlocksCreatedEvent { + + private String id; + private Long occurredAt; + private String source; + private String object; + private String apiVersion; + private String eventType; + private String webhookStatus; + private Content content; + + public String getId() { + return id; + } + + public Long getOccurredAt() { + return occurredAt; + } + + public String getSource() { + return source; + } + + public String getObject() { + return object; + } + + public String getApiVersion() { + return apiVersion; + } + + public String getEventType() { + return eventType; + } + + public String getWebhookStatus() { + return webhookStatus; + } + + public Content getContent() { + return content; + } + + public static GrantBlocksCreatedEvent fromJson(String json) { + return fromJson(JsonUtil.parse(json)); + } + + public static GrantBlocksCreatedEvent fromJson(java.util.Map map) { + return fromJson(JsonUtil.toJson(map)); + } + + public static GrantBlocksCreatedEvent fromJson(JsonObject jsonObj) { + GrantBlocksCreatedEvent obj = new GrantBlocksCreatedEvent(); + + obj.id = JsonUtil.getString(jsonObj, "id"); + + obj.occurredAt = JsonUtil.getLong(jsonObj, "occurred_at"); + + obj.source = JsonUtil.getString(jsonObj, "source"); + + obj.object = JsonUtil.getString(jsonObj, "object"); + + obj.apiVersion = JsonUtil.getString(jsonObj, "api_version"); + + obj.eventType = JsonUtil.getString(jsonObj, "event_type"); + + obj.webhookStatus = JsonUtil.getString(jsonObj, "webhook_status"); + + JsonObject __contentObj = JsonUtil.getJsonObject(jsonObj, "content"); + if (__contentObj != null) { + obj.content = Content.fromJson(__contentObj); + } + + return obj; + } + + @Override + public String toString() { + return "GrantBlocksCreatedEvent{" + + "id=" + + id + + ", occurredAt=" + + occurredAt + + ", source=" + + source + + ", object=" + + object + + ", apiVersion=" + + apiVersion + + ", eventType=" + + eventType + + ", webhookStatus=" + + webhookStatus + + ", content=" + + content + + "}"; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + GrantBlocksCreatedEvent that = (GrantBlocksCreatedEvent) o; + return java.util.Objects.equals(id, that.id) + && java.util.Objects.equals(occurredAt, that.occurredAt) + && java.util.Objects.equals(source, that.source) + && java.util.Objects.equals(object, that.object) + && java.util.Objects.equals(apiVersion, that.apiVersion) + && java.util.Objects.equals(eventType, that.eventType) + && java.util.Objects.equals(webhookStatus, that.webhookStatus) + && java.util.Objects.equals(content, that.content); + } + + @Override + public int hashCode() { + + return java.util.Objects.hash( + id, occurredAt, source, object, apiVersion, eventType, webhookStatus, content); + } + + public static class Content { + + private List grantBlocks; + + public List getGrantBlocks() { + return grantBlocks; + } + + public static Content fromJson(String json) { + return fromJson(JsonUtil.parse(json)); + } + + public static Content fromJson(java.util.Map map) { + return fromJson(JsonUtil.toJson(map)); + } + + public static Content fromJson(JsonObject jsonObj) { + Content obj = new Content(); + + obj.grantBlocks = + JsonUtil.mapArray(JsonUtil.getJsonArray(jsonObj, "grant_blocks"), GrantBlock::fromJson); + + return obj; + } + + @Override + public String toString() { + return "Content{" + "grantBlocks=" + grantBlocks + "}"; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Content that = (Content) o; + return java.util.Objects.equals(grantBlocks, that.grantBlocks); + } + + @Override + public int hashCode() { + + return java.util.Objects.hash(grantBlocks); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/event/GrantBlocksUpdatedEvent.java b/src/main/java/com/chargebee/v4/models/event/GrantBlocksUpdatedEvent.java new file mode 100644 index 00000000..9658da09 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/event/GrantBlocksUpdatedEvent.java @@ -0,0 +1,182 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.event; + +import com.chargebee.v4.internal.JsonUtil; +import com.google.gson.JsonObject; +import java.util.List; + +import com.chargebee.v4.models.grantBlock.GrantBlock; + +public class GrantBlocksUpdatedEvent { + + private String id; + private Long occurredAt; + private String source; + private String object; + private String apiVersion; + private String eventType; + private String webhookStatus; + private Content content; + + public String getId() { + return id; + } + + public Long getOccurredAt() { + return occurredAt; + } + + public String getSource() { + return source; + } + + public String getObject() { + return object; + } + + public String getApiVersion() { + return apiVersion; + } + + public String getEventType() { + return eventType; + } + + public String getWebhookStatus() { + return webhookStatus; + } + + public Content getContent() { + return content; + } + + public static GrantBlocksUpdatedEvent fromJson(String json) { + return fromJson(JsonUtil.parse(json)); + } + + public static GrantBlocksUpdatedEvent fromJson(java.util.Map map) { + return fromJson(JsonUtil.toJson(map)); + } + + public static GrantBlocksUpdatedEvent fromJson(JsonObject jsonObj) { + GrantBlocksUpdatedEvent obj = new GrantBlocksUpdatedEvent(); + + obj.id = JsonUtil.getString(jsonObj, "id"); + + obj.occurredAt = JsonUtil.getLong(jsonObj, "occurred_at"); + + obj.source = JsonUtil.getString(jsonObj, "source"); + + obj.object = JsonUtil.getString(jsonObj, "object"); + + obj.apiVersion = JsonUtil.getString(jsonObj, "api_version"); + + obj.eventType = JsonUtil.getString(jsonObj, "event_type"); + + obj.webhookStatus = JsonUtil.getString(jsonObj, "webhook_status"); + + JsonObject __contentObj = JsonUtil.getJsonObject(jsonObj, "content"); + if (__contentObj != null) { + obj.content = Content.fromJson(__contentObj); + } + + return obj; + } + + @Override + public String toString() { + return "GrantBlocksUpdatedEvent{" + + "id=" + + id + + ", occurredAt=" + + occurredAt + + ", source=" + + source + + ", object=" + + object + + ", apiVersion=" + + apiVersion + + ", eventType=" + + eventType + + ", webhookStatus=" + + webhookStatus + + ", content=" + + content + + "}"; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + GrantBlocksUpdatedEvent that = (GrantBlocksUpdatedEvent) o; + return java.util.Objects.equals(id, that.id) + && java.util.Objects.equals(occurredAt, that.occurredAt) + && java.util.Objects.equals(source, that.source) + && java.util.Objects.equals(object, that.object) + && java.util.Objects.equals(apiVersion, that.apiVersion) + && java.util.Objects.equals(eventType, that.eventType) + && java.util.Objects.equals(webhookStatus, that.webhookStatus) + && java.util.Objects.equals(content, that.content); + } + + @Override + public int hashCode() { + + return java.util.Objects.hash( + id, occurredAt, source, object, apiVersion, eventType, webhookStatus, content); + } + + public static class Content { + + private List grantBlocks; + + public List getGrantBlocks() { + return grantBlocks; + } + + public static Content fromJson(String json) { + return fromJson(JsonUtil.parse(json)); + } + + public static Content fromJson(java.util.Map map) { + return fromJson(JsonUtil.toJson(map)); + } + + public static Content fromJson(JsonObject jsonObj) { + Content obj = new Content(); + + obj.grantBlocks = + JsonUtil.mapArray(JsonUtil.getJsonArray(jsonObj, "grant_blocks"), GrantBlock::fromJson); + + return obj; + } + + @Override + public String toString() { + return "Content{" + "grantBlocks=" + grantBlocks + "}"; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Content that = (Content) o; + return java.util.Objects.equals(grantBlocks, that.grantBlocks); + } + + @Override + public int hashCode() { + + return java.util.Objects.hash(grantBlocks); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/event/LedgerAccountBalanceUpdatedEvent.java b/src/main/java/com/chargebee/v4/models/event/LedgerAccountBalanceUpdatedEvent.java new file mode 100644 index 00000000..18f3aceb --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/event/LedgerAccountBalanceUpdatedEvent.java @@ -0,0 +1,184 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.event; + +import com.chargebee.v4.internal.JsonUtil; +import com.google.gson.JsonObject; + +import com.chargebee.v4.models.ledgerAccountBalance.LedgerAccountBalance; + +public class LedgerAccountBalanceUpdatedEvent { + + private String id; + private Long occurredAt; + private String source; + private String object; + private String apiVersion; + private String eventType; + private String webhookStatus; + private Content content; + + public String getId() { + return id; + } + + public Long getOccurredAt() { + return occurredAt; + } + + public String getSource() { + return source; + } + + public String getObject() { + return object; + } + + public String getApiVersion() { + return apiVersion; + } + + public String getEventType() { + return eventType; + } + + public String getWebhookStatus() { + return webhookStatus; + } + + public Content getContent() { + return content; + } + + public static LedgerAccountBalanceUpdatedEvent fromJson(String json) { + return fromJson(JsonUtil.parse(json)); + } + + public static LedgerAccountBalanceUpdatedEvent fromJson(java.util.Map map) { + return fromJson(JsonUtil.toJson(map)); + } + + public static LedgerAccountBalanceUpdatedEvent fromJson(JsonObject jsonObj) { + LedgerAccountBalanceUpdatedEvent obj = new LedgerAccountBalanceUpdatedEvent(); + + obj.id = JsonUtil.getString(jsonObj, "id"); + + obj.occurredAt = JsonUtil.getLong(jsonObj, "occurred_at"); + + obj.source = JsonUtil.getString(jsonObj, "source"); + + obj.object = JsonUtil.getString(jsonObj, "object"); + + obj.apiVersion = JsonUtil.getString(jsonObj, "api_version"); + + obj.eventType = JsonUtil.getString(jsonObj, "event_type"); + + obj.webhookStatus = JsonUtil.getString(jsonObj, "webhook_status"); + + JsonObject __contentObj = JsonUtil.getJsonObject(jsonObj, "content"); + if (__contentObj != null) { + obj.content = Content.fromJson(__contentObj); + } + + return obj; + } + + @Override + public String toString() { + return "LedgerAccountBalanceUpdatedEvent{" + + "id=" + + id + + ", occurredAt=" + + occurredAt + + ", source=" + + source + + ", object=" + + object + + ", apiVersion=" + + apiVersion + + ", eventType=" + + eventType + + ", webhookStatus=" + + webhookStatus + + ", content=" + + content + + "}"; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + LedgerAccountBalanceUpdatedEvent that = (LedgerAccountBalanceUpdatedEvent) o; + return java.util.Objects.equals(id, that.id) + && java.util.Objects.equals(occurredAt, that.occurredAt) + && java.util.Objects.equals(source, that.source) + && java.util.Objects.equals(object, that.object) + && java.util.Objects.equals(apiVersion, that.apiVersion) + && java.util.Objects.equals(eventType, that.eventType) + && java.util.Objects.equals(webhookStatus, that.webhookStatus) + && java.util.Objects.equals(content, that.content); + } + + @Override + public int hashCode() { + + return java.util.Objects.hash( + id, occurredAt, source, object, apiVersion, eventType, webhookStatus, content); + } + + public static class Content { + + private LedgerAccountBalance ledgerAccountBalance; + + public LedgerAccountBalance getLedgerAccountBalance() { + return ledgerAccountBalance; + } + + public static Content fromJson(String json) { + return fromJson(JsonUtil.parse(json)); + } + + public static Content fromJson(java.util.Map map) { + return fromJson(JsonUtil.toJson(map)); + } + + public static Content fromJson(JsonObject jsonObj) { + Content obj = new Content(); + + JsonObject __ledgerAccountBalanceObj = + JsonUtil.getJsonObject(jsonObj, "ledger_account_balance"); + if (__ledgerAccountBalanceObj != null) { + obj.ledgerAccountBalance = LedgerAccountBalance.fromJson(__ledgerAccountBalanceObj); + } + + return obj; + } + + @Override + public String toString() { + return "Content{" + "ledgerAccountBalance=" + ledgerAccountBalance + "}"; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Content that = (Content) o; + return java.util.Objects.equals(ledgerAccountBalance, that.ledgerAccountBalance); + } + + @Override + public int hashCode() { + + return java.util.Objects.hash(ledgerAccountBalance); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/event/LedgerUpdatedEvent.java b/src/main/java/com/chargebee/v4/models/event/LedgerUpdatedEvent.java new file mode 100644 index 00000000..d2722eea --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/event/LedgerUpdatedEvent.java @@ -0,0 +1,230 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.event; + +import com.chargebee.v4.internal.JsonUtil; +import com.google.gson.JsonObject; +import java.util.List; + +import com.chargebee.v4.models.ledgerOperation.LedgerOperation; + +import com.chargebee.v4.models.ledgerAccountBalance.LedgerAccountBalance; + +import com.chargebee.v4.models.ledgerEntry.LedgerEntry; + +import com.chargebee.v4.models.grantBlock.GrantBlock; + +public class LedgerUpdatedEvent { + + private String id; + private Long occurredAt; + private String source; + private String object; + private String apiVersion; + private String eventType; + private String webhookStatus; + private Content content; + + public String getId() { + return id; + } + + public Long getOccurredAt() { + return occurredAt; + } + + public String getSource() { + return source; + } + + public String getObject() { + return object; + } + + public String getApiVersion() { + return apiVersion; + } + + public String getEventType() { + return eventType; + } + + public String getWebhookStatus() { + return webhookStatus; + } + + public Content getContent() { + return content; + } + + public static LedgerUpdatedEvent fromJson(String json) { + return fromJson(JsonUtil.parse(json)); + } + + public static LedgerUpdatedEvent fromJson(java.util.Map map) { + return fromJson(JsonUtil.toJson(map)); + } + + public static LedgerUpdatedEvent fromJson(JsonObject jsonObj) { + LedgerUpdatedEvent obj = new LedgerUpdatedEvent(); + + obj.id = JsonUtil.getString(jsonObj, "id"); + + obj.occurredAt = JsonUtil.getLong(jsonObj, "occurred_at"); + + obj.source = JsonUtil.getString(jsonObj, "source"); + + obj.object = JsonUtil.getString(jsonObj, "object"); + + obj.apiVersion = JsonUtil.getString(jsonObj, "api_version"); + + obj.eventType = JsonUtil.getString(jsonObj, "event_type"); + + obj.webhookStatus = JsonUtil.getString(jsonObj, "webhook_status"); + + JsonObject __contentObj = JsonUtil.getJsonObject(jsonObj, "content"); + if (__contentObj != null) { + obj.content = Content.fromJson(__contentObj); + } + + return obj; + } + + @Override + public String toString() { + return "LedgerUpdatedEvent{" + + "id=" + + id + + ", occurredAt=" + + occurredAt + + ", source=" + + source + + ", object=" + + object + + ", apiVersion=" + + apiVersion + + ", eventType=" + + eventType + + ", webhookStatus=" + + webhookStatus + + ", content=" + + content + + "}"; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + LedgerUpdatedEvent that = (LedgerUpdatedEvent) o; + return java.util.Objects.equals(id, that.id) + && java.util.Objects.equals(occurredAt, that.occurredAt) + && java.util.Objects.equals(source, that.source) + && java.util.Objects.equals(object, that.object) + && java.util.Objects.equals(apiVersion, that.apiVersion) + && java.util.Objects.equals(eventType, that.eventType) + && java.util.Objects.equals(webhookStatus, that.webhookStatus) + && java.util.Objects.equals(content, that.content); + } + + @Override + public int hashCode() { + + return java.util.Objects.hash( + id, occurredAt, source, object, apiVersion, eventType, webhookStatus, content); + } + + public static class Content { + + private List ledgerOperations; + private LedgerAccountBalance ledgerAccountBalance; + private List grantBlocks; + private List ledgerEntries; + + public List getLedgerOperations() { + return ledgerOperations; + } + + public LedgerAccountBalance getLedgerAccountBalance() { + return ledgerAccountBalance; + } + + public List getGrantBlocks() { + return grantBlocks; + } + + public List getLedgerEntries() { + return ledgerEntries; + } + + public static Content fromJson(String json) { + return fromJson(JsonUtil.parse(json)); + } + + public static Content fromJson(java.util.Map map) { + return fromJson(JsonUtil.toJson(map)); + } + + public static Content fromJson(JsonObject jsonObj) { + Content obj = new Content(); + + obj.ledgerOperations = + JsonUtil.mapArray( + JsonUtil.getJsonArray(jsonObj, "ledger_operations"), LedgerOperation::fromJson); + + JsonObject __ledgerAccountBalanceObj = + JsonUtil.getJsonObject(jsonObj, "ledger_account_balance"); + if (__ledgerAccountBalanceObj != null) { + obj.ledgerAccountBalance = LedgerAccountBalance.fromJson(__ledgerAccountBalanceObj); + } + + obj.grantBlocks = + JsonUtil.mapArray(JsonUtil.getJsonArray(jsonObj, "grant_blocks"), GrantBlock::fromJson); + + obj.ledgerEntries = + JsonUtil.mapArray( + JsonUtil.getJsonArray(jsonObj, "ledger_entries"), LedgerEntry::fromJson); + + return obj; + } + + @Override + public String toString() { + return "Content{" + + "ledgerOperations=" + + ledgerOperations + + ", ledgerAccountBalance=" + + ledgerAccountBalance + + ", grantBlocks=" + + grantBlocks + + ", ledgerEntries=" + + ledgerEntries + + "}"; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Content that = (Content) o; + return java.util.Objects.equals(ledgerOperations, that.ledgerOperations) + && java.util.Objects.equals(ledgerAccountBalance, that.ledgerAccountBalance) + && java.util.Objects.equals(grantBlocks, that.grantBlocks) + && java.util.Objects.equals(ledgerEntries, that.ledgerEntries); + } + + @Override + public int hashCode() { + + return java.util.Objects.hash( + ledgerOperations, ledgerAccountBalance, grantBlocks, ledgerEntries); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/event/params/EventListParams.java b/src/main/java/com/chargebee/v4/models/event/params/EventListParams.java index 1c4bb680..b9909a75 100644 --- a/src/main/java/com/chargebee/v4/models/event/params/EventListParams.java +++ b/src/main/java/com/chargebee/v4/models/event/params/EventListParams.java @@ -944,6 +944,14 @@ public enum EventTypeIs { OMNICHANNEL_SUBSCRIPTION_ITEM_RECOVERED("omnichannel_subscription_item_recovered"), + LEDGER_ACCOUNT_BALANCE_UPDATED("ledger_account_balance_updated"), + + GRANT_BLOCKS_CREATED("grant_blocks_created"), + + GRANT_BLOCKS_UPDATED("grant_blocks_updated"), + + LEDGER_UPDATED("ledger_updated"), + /** An enum member indicating that EventTypeIs was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; @@ -1422,6 +1430,14 @@ public enum EventTypeIsNot { OMNICHANNEL_SUBSCRIPTION_ITEM_RECOVERED("omnichannel_subscription_item_recovered"), + LEDGER_ACCOUNT_BALANCE_UPDATED("ledger_account_balance_updated"), + + GRANT_BLOCKS_CREATED("grant_blocks_created"), + + GRANT_BLOCKS_UPDATED("grant_blocks_updated"), + + LEDGER_UPDATED("ledger_updated"), + /** An enum member indicating that EventTypeIsNot was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; @@ -1900,6 +1916,14 @@ public enum EventTypeIn { OMNICHANNEL_SUBSCRIPTION_ITEM_RECOVERED("omnichannel_subscription_item_recovered"), + LEDGER_ACCOUNT_BALANCE_UPDATED("ledger_account_balance_updated"), + + GRANT_BLOCKS_CREATED("grant_blocks_created"), + + GRANT_BLOCKS_UPDATED("grant_blocks_updated"), + + LEDGER_UPDATED("ledger_updated"), + /** An enum member indicating that EventTypeIn was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; @@ -2378,6 +2402,14 @@ public enum EventTypeNotIn { OMNICHANNEL_SUBSCRIPTION_ITEM_RECOVERED("omnichannel_subscription_item_recovered"), + LEDGER_ACCOUNT_BALANCE_UPDATED("ledger_account_balance_updated"), + + GRANT_BLOCKS_CREATED("grant_blocks_created"), + + GRANT_BLOCKS_UPDATED("grant_blocks_updated"), + + LEDGER_UPDATED("ledger_updated"), + /** An enum member indicating that EventTypeNotIn was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; @@ -3134,6 +3166,14 @@ public enum EventType { OMNICHANNEL_SUBSCRIPTION_ITEM_RECOVERED("omnichannel_subscription_item_recovered"), + LEDGER_ACCOUNT_BALANCE_UPDATED("ledger_account_balance_updated"), + + GRANT_BLOCKS_CREATED("grant_blocks_created"), + + GRANT_BLOCKS_UPDATED("grant_blocks_updated"), + + LEDGER_UPDATED("ledger_updated"), + /** An enum member indicating that EventType was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; diff --git a/src/main/java/com/chargebee/v4/models/export/params/ExportTransactionsParams.java b/src/main/java/com/chargebee/v4/models/export/params/ExportTransactionsParams.java index 4f1e04c8..85e31241 100644 --- a/src/main/java/com/chargebee/v4/models/export/params/ExportTransactionsParams.java +++ b/src/main/java/com/chargebee/v4/models/export/params/ExportTransactionsParams.java @@ -390,6 +390,14 @@ public enum PaymentMethod { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that PaymentMethod was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; diff --git a/src/main/java/com/chargebee/v4/models/gift/params/GiftCreateForItemsParams.java b/src/main/java/com/chargebee/v4/models/gift/params/GiftCreateForItemsParams.java index 6694a5c0..78fa4f50 100644 --- a/src/main/java/com/chargebee/v4/models/gift/params/GiftCreateForItemsParams.java +++ b/src/main/java/com/chargebee/v4/models/gift/params/GiftCreateForItemsParams.java @@ -802,6 +802,14 @@ public enum PaymentMethodType { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** * An enum member indicating that PaymentMethodType was instantiated with an unknown value. */ diff --git a/src/main/java/com/chargebee/v4/models/gift/params/GiftCreateParams.java b/src/main/java/com/chargebee/v4/models/gift/params/GiftCreateParams.java index 0ba39e98..e0b5e8af 100644 --- a/src/main/java/com/chargebee/v4/models/gift/params/GiftCreateParams.java +++ b/src/main/java/com/chargebee/v4/models/gift/params/GiftCreateParams.java @@ -778,6 +778,14 @@ public enum PaymentMethodType { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** * An enum member indicating that PaymentMethodType was instantiated with an unknown value. */ diff --git a/src/main/java/com/chargebee/v4/models/grantBlock/GrantBlock.java b/src/main/java/com/chargebee/v4/models/grantBlock/GrantBlock.java index 8f375f09..4d11eaca 100644 --- a/src/main/java/com/chargebee/v4/models/grantBlock/GrantBlock.java +++ b/src/main/java/com/chargebee/v4/models/grantBlock/GrantBlock.java @@ -14,6 +14,10 @@ public class GrantBlock { private String id; + private String subscriptionId; + private AccountType accountType; + private String unitId; + private UnitType unitType; private String grantedAmount; private Timestamp effectiveFrom; private Timestamp expiresAt; @@ -27,15 +31,30 @@ public class GrantBlock { private Status status; private GrantSource grantSource; private Timestamp createdAt; - private AccountType accountType; - private String unitId; - private UnitType unitType; + private Timestamp modifiedAt; + private Long resourceVersion; private java.util.Map metadata; public String getId() { return id; } + public String getSubscriptionId() { + return subscriptionId; + } + + public AccountType getAccountType() { + return accountType; + } + + public String getUnitId() { + return unitId; + } + + public UnitType getUnitType() { + return unitType; + } + public String getGrantedAmount() { return grantedAmount; } @@ -88,36 +107,28 @@ public Timestamp getCreatedAt() { return createdAt; } - public AccountType getAccountType() { - return accountType; + public Timestamp getModifiedAt() { + return modifiedAt; } - public String getUnitId() { - return unitId; - } - - public UnitType getUnitType() { - return unitType; + public Long getResourceVersion() { + return resourceVersion; } public java.util.Map getMetadata() { return metadata; } - public enum Status { - AVAILABLE("available"), - - EXHAUSTED("exhausted"), - - SCHEDULED("scheduled"), + public enum AccountType { + PROVISIONED("provisioned"), - IN_GRACE_PERIOD("in_grace_period"), + OVERDRAFT("overdraft"), - /** An enum member indicating that Status was instantiated with an unknown value. */ + /** An enum member indicating that AccountType was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; - Status(String value) { + AccountType(String value) { this.value = value; } @@ -125,9 +136,9 @@ public String getValue() { return value; } - public static Status fromString(String value) { + public static AccountType fromString(String value) { if (value == null) return _UNKNOWN; - for (Status enumValue : Status.values()) { + for (AccountType enumValue : AccountType.values()) { if (enumValue.value != null && enumValue.value.equals(value)) { return enumValue; } @@ -136,22 +147,14 @@ public static Status fromString(String value) { } } - public enum GrantSource { - SUBSCRIPTION_CREATED("subscription_created"), - - SUBSCRIPTION_CHANGED("subscription_changed"), - - TOP_UP("top_up"), - - PROMOTIONAL_GRANTS("promotional_grants"), - - ROLLOVER("rollover"), + public enum UnitType { + CREDIT_UNIT("credit_unit"), - /** An enum member indicating that GrantSource was instantiated with an unknown value. */ + /** An enum member indicating that UnitType was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; - GrantSource(String value) { + UnitType(String value) { this.value = value; } @@ -159,9 +162,9 @@ public String getValue() { return value; } - public static GrantSource fromString(String value) { + public static UnitType fromString(String value) { if (value == null) return _UNKNOWN; - for (GrantSource enumValue : GrantSource.values()) { + for (UnitType enumValue : UnitType.values()) { if (enumValue.value != null && enumValue.value.equals(value)) { return enumValue; } @@ -170,16 +173,20 @@ public static GrantSource fromString(String value) { } } - public enum AccountType { - PROVISIONED("provisioned"), + public enum Status { + AVAILABLE("available"), - OVERDRAFT("overdraft"), + EXHAUSTED("exhausted"), - /** An enum member indicating that AccountType was instantiated with an unknown value. */ + SCHEDULED("scheduled"), + + IN_GRACE_PERIOD("in_grace_period"), + + /** An enum member indicating that Status was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; - AccountType(String value) { + Status(String value) { this.value = value; } @@ -187,9 +194,9 @@ public String getValue() { return value; } - public static AccountType fromString(String value) { + public static Status fromString(String value) { if (value == null) return _UNKNOWN; - for (AccountType enumValue : AccountType.values()) { + for (Status enumValue : Status.values()) { if (enumValue.value != null && enumValue.value.equals(value)) { return enumValue; } @@ -198,14 +205,26 @@ public static AccountType fromString(String value) { } } - public enum UnitType { - CREDIT_UNIT("credit_unit"), + public enum GrantSource { + SUBSCRIPTION_CREATED("subscription_created"), - /** An enum member indicating that UnitType was instantiated with an unknown value. */ + SUBSCRIPTION_CHANGED("subscription_changed"), + + TOP_UP("top_up"), + + PROMOTIONAL_GRANTS("promotional_grants"), + + ROLLOVER("rollover"), + + GRANT_RENEWAL("grant_renewal"), + + SUBSCRIPTION_RENEWED("subscription_renewed"), + + /** An enum member indicating that GrantSource was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; - UnitType(String value) { + GrantSource(String value) { this.value = value; } @@ -213,9 +232,9 @@ public String getValue() { return value; } - public static UnitType fromString(String value) { + public static GrantSource fromString(String value) { if (value == null) return _UNKNOWN; - for (UnitType enumValue : UnitType.values()) { + for (GrantSource enumValue : GrantSource.values()) { if (enumValue.value != null && enumValue.value.equals(value)) { return enumValue; } @@ -237,6 +256,14 @@ public static GrantBlock fromJson(JsonObject jsonObj) { obj.id = JsonUtil.getString(jsonObj, "id"); + obj.subscriptionId = JsonUtil.getString(jsonObj, "subscription_id"); + + obj.accountType = AccountType.fromString(JsonUtil.getString(jsonObj, "account_type")); + + obj.unitId = JsonUtil.getString(jsonObj, "unit_id"); + + obj.unitType = UnitType.fromString(JsonUtil.getString(jsonObj, "unit_type")); + obj.grantedAmount = JsonUtil.getString(jsonObj, "granted_amount"); obj.effectiveFrom = JsonUtil.getTimestamp(jsonObj, "effective_from"); @@ -263,11 +290,9 @@ public static GrantBlock fromJson(JsonObject jsonObj) { obj.createdAt = JsonUtil.getTimestamp(jsonObj, "created_at"); - obj.accountType = AccountType.fromString(JsonUtil.getString(jsonObj, "account_type")); - - obj.unitId = JsonUtil.getString(jsonObj, "unit_id"); + obj.modifiedAt = JsonUtil.getTimestamp(jsonObj, "modified_at"); - obj.unitType = UnitType.fromString(JsonUtil.getString(jsonObj, "unit_type")); + obj.resourceVersion = JsonUtil.getLong(jsonObj, "resource_version"); JsonObject __metadataObj = JsonUtil.getJsonObject(jsonObj, "metadata"); obj.metadata = @@ -283,6 +308,14 @@ public String toString() { return "GrantBlock{" + "id=" + id + + ", subscriptionId=" + + subscriptionId + + ", accountType=" + + accountType + + ", unitId=" + + unitId + + ", unitType=" + + unitType + ", grantedAmount=" + grantedAmount + ", effectiveFrom=" @@ -309,12 +342,10 @@ public String toString() { + grantSource + ", createdAt=" + createdAt - + ", accountType=" - + accountType - + ", unitId=" - + unitId - + ", unitType=" - + unitType + + ", modifiedAt=" + + modifiedAt + + ", resourceVersion=" + + resourceVersion + ", metadata=" + metadata + "}"; @@ -327,6 +358,10 @@ public boolean equals(Object o) { GrantBlock that = (GrantBlock) o; return java.util.Objects.equals(id, that.id) + && java.util.Objects.equals(subscriptionId, that.subscriptionId) + && java.util.Objects.equals(accountType, that.accountType) + && java.util.Objects.equals(unitId, that.unitId) + && java.util.Objects.equals(unitType, that.unitType) && java.util.Objects.equals(grantedAmount, that.grantedAmount) && java.util.Objects.equals(effectiveFrom, that.effectiveFrom) && java.util.Objects.equals(expiresAt, that.expiresAt) @@ -340,9 +375,8 @@ public boolean equals(Object o) { && java.util.Objects.equals(status, that.status) && java.util.Objects.equals(grantSource, that.grantSource) && java.util.Objects.equals(createdAt, that.createdAt) - && java.util.Objects.equals(accountType, that.accountType) - && java.util.Objects.equals(unitId, that.unitId) - && java.util.Objects.equals(unitType, that.unitType) + && java.util.Objects.equals(modifiedAt, that.modifiedAt) + && java.util.Objects.equals(resourceVersion, that.resourceVersion) && java.util.Objects.equals(metadata, that.metadata); } @@ -351,6 +385,10 @@ public int hashCode() { return java.util.Objects.hash( id, + subscriptionId, + accountType, + unitId, + unitType, grantedAmount, effectiveFrom, expiresAt, @@ -364,9 +402,8 @@ public int hashCode() { status, grantSource, createdAt, - accountType, - unitId, - unitType, + modifiedAt, + resourceVersion, metadata); } } diff --git a/src/main/java/com/chargebee/v4/models/grantBlock/params/ListGrantBlocksParams.java b/src/main/java/com/chargebee/v4/models/grantBlock/params/ListGrantBlocksParams.java index 107fd8be..eb19be30 100644 --- a/src/main/java/com/chargebee/v4/models/grantBlock/params/ListGrantBlocksParams.java +++ b/src/main/java/com/chargebee/v4/models/grantBlock/params/ListGrantBlocksParams.java @@ -10,6 +10,7 @@ import com.chargebee.v4.internal.Recommended; import com.chargebee.v4.filters.StringFilter; import com.chargebee.v4.filters.TimestampFilter; +import com.chargebee.v4.filters.EnumFilter; import java.util.Collections; import java.util.LinkedHashMap; @@ -63,6 +64,10 @@ public UnitIdFilter unitId() { return new UnitIdFilter("unit_id", this, queryParams); } + public AccountTypeFilter accountType() { + return new AccountTypeFilter("account_type", this, queryParams); + } + public EffectiveFromFilter effectiveFrom() { return new EffectiveFromFilter("effective_from", this, queryParams); } @@ -96,6 +101,66 @@ public static final class UnitIdFilter extends StringFilter { + AccountTypeFilter( + String fieldName, ListGrantBlocksBuilder builder, Map params) { + super(fieldName, builder, params, AccountType::getValue); + } + + /** + * @deprecated This method accepting raw String will be removed in a future version. Use the + * type-safe enum overload instead: + *
{@code .accountType().is(AccountType.YOUR_VALUE)}
+ * + * @see #is(AccountType) + */ + @Deprecated + public ListGrantBlocksBuilder is(String value) { + params.put(fieldName + "[is]", value); + return builder; + } + + /** + * @deprecated This method accepting raw String will be removed in a future version. Use the + * type-safe enum overload instead: + *
{@code .accountType().isNot(AccountType.YOUR_VALUE)}
+ * + * @see #isNot(AccountType) + */ + @Deprecated + public ListGrantBlocksBuilder isNot(String value) { + params.put(fieldName + "[is_not]", value); + return builder; + } + + /** + * @deprecated This method accepting raw String will be removed in a future version. Use the + * type-safe enum overload instead: + *
{@code .accountType().in(AccountType.VALUE1, AccountType.VALUE2)}
+ * + * @see #in(AccountType[]) + */ + @Deprecated + public ListGrantBlocksBuilder in(String... values) { + params.put(fieldName + "[in]", "[" + String.join(",", values) + "]"); + return builder; + } + + /** + * @deprecated This method accepting raw String will be removed in a future version. Use the + * type-safe enum overload instead: + *
{@code .accountType().notIn(AccountType.VALUE1, AccountType.VALUE2)}
+ * + * @see #notIn(AccountType[]) + */ + @Deprecated + public ListGrantBlocksBuilder notIn(String... values) { + params.put(fieldName + "[not_in]", "[" + String.join(",", values) + "]"); + return builder; + } + } + public static final class EffectiveFromFilter extends TimestampFilter { EffectiveFromFilter( String fieldName, ListGrantBlocksBuilder builder, Map params) { @@ -162,6 +227,34 @@ public ListGrantBlocksBuilder desc() { } } + public enum AccountTypeIs { + PROVISIONED("provisioned"), + + OVERDRAFT("overdraft"), + + /** An enum member indicating that AccountTypeIs was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + AccountTypeIs(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static AccountTypeIs fromString(String value) { + if (value == null) return _UNKNOWN; + for (AccountTypeIs enumValue : AccountTypeIs.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + public enum SortByAsc { EFFECTIVE_FROM("effective_from"), @@ -221,4 +314,32 @@ public static SortByDesc fromString(String value) { return _UNKNOWN; } } + + public enum AccountType { + PROVISIONED("provisioned"), + + OVERDRAFT("overdraft"), + + /** An enum member indicating that AccountType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + AccountType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static AccountType fromString(String value) { + if (value == null) return _UNKNOWN; + for (AccountType enumValue : AccountType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } } diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/ImportInvoiceParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/ImportInvoiceParams.java index 2f1f7a54..95c7ba27 100644 --- a/src/main/java/com/chargebee/v4/models/invoice/params/ImportInvoiceParams.java +++ b/src/main/java/com/chargebee/v4/models/invoice/params/ImportInvoiceParams.java @@ -3421,6 +3421,14 @@ public enum PaymentMethod { CUSTOM("custom"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that PaymentMethod was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceCreateForChargeItemsAndChargesParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceCreateForChargeItemsAndChargesParams.java index 547b79d1..679b71fc 100644 --- a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceCreateForChargeItemsAndChargesParams.java +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceCreateForChargeItemsAndChargesParams.java @@ -2547,6 +2547,14 @@ public enum Type { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that Type was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; @@ -2978,6 +2986,14 @@ public enum PaymentMethodType { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** * An enum member indicating that PaymentMethodType was instantiated with an unknown value. */ diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceCreateParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceCreateParams.java index 4aaeaff7..86a1bb3a 100644 --- a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceCreateParams.java +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceCreateParams.java @@ -2388,6 +2388,14 @@ public enum Type { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that Type was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; @@ -2819,6 +2827,14 @@ public enum PaymentMethodType { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** * An enum member indicating that PaymentMethodType was instantiated with an unknown value. */ diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceRecordPaymentParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceRecordPaymentParams.java index abbcba9d..1aa6bd31 100644 --- a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceRecordPaymentParams.java +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceRecordPaymentParams.java @@ -306,6 +306,14 @@ public enum PaymentMethod { CUSTOM("custom"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that PaymentMethod was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; diff --git a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceRecordRefundParams.java b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceRecordRefundParams.java index bcfab083..cc58eba4 100644 --- a/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceRecordRefundParams.java +++ b/src/main/java/com/chargebee/v4/models/invoice/params/InvoiceRecordRefundParams.java @@ -273,6 +273,14 @@ public enum PaymentMethod { CUSTOM("custom"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that PaymentMethod was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; diff --git a/src/main/java/com/chargebee/v4/models/ledgerAccountBalance/LedgerAccountBalance.java b/src/main/java/com/chargebee/v4/models/ledgerAccountBalance/LedgerAccountBalance.java index 718fe385..f9ea3f4d 100644 --- a/src/main/java/com/chargebee/v4/models/ledgerAccountBalance/LedgerAccountBalance.java +++ b/src/main/java/com/chargebee/v4/models/ledgerAccountBalance/LedgerAccountBalance.java @@ -16,7 +16,9 @@ public class LedgerAccountBalance { private String subscriptionId; private String unitId; private UnitType unitType; + private Timestamp createdAt; private Timestamp modifiedAt; + private Long resourceVersion; private ProvisionedBalance provisionedBalance; private OverdraftBalance overdraftBalance; @@ -32,10 +34,18 @@ public UnitType getUnitType() { return unitType; } + public Timestamp getCreatedAt() { + return createdAt; + } + public Timestamp getModifiedAt() { return modifiedAt; } + public Long getResourceVersion() { + return resourceVersion; + } + public ProvisionedBalance getProvisionedBalance() { return provisionedBalance; } @@ -87,8 +97,12 @@ public static LedgerAccountBalance fromJson(JsonObject jsonObj) { obj.unitType = UnitType.fromString(JsonUtil.getString(jsonObj, "unit_type")); + obj.createdAt = JsonUtil.getTimestamp(jsonObj, "created_at"); + obj.modifiedAt = JsonUtil.getTimestamp(jsonObj, "modified_at"); + obj.resourceVersion = JsonUtil.getLong(jsonObj, "resource_version"); + JsonObject __provisionedBalanceObj = JsonUtil.getJsonObject(jsonObj, "provisioned_balance"); if (__provisionedBalanceObj != null) { obj.provisionedBalance = ProvisionedBalance.fromJson(__provisionedBalanceObj); @@ -111,8 +125,12 @@ public String toString() { + unitId + ", unitType=" + unitType + + ", createdAt=" + + createdAt + ", modifiedAt=" + modifiedAt + + ", resourceVersion=" + + resourceVersion + ", provisionedBalance=" + provisionedBalance + ", overdraftBalance=" @@ -129,7 +147,9 @@ public boolean equals(Object o) { return java.util.Objects.equals(subscriptionId, that.subscriptionId) && java.util.Objects.equals(unitId, that.unitId) && java.util.Objects.equals(unitType, that.unitType) + && java.util.Objects.equals(createdAt, that.createdAt) && java.util.Objects.equals(modifiedAt, that.modifiedAt) + && java.util.Objects.equals(resourceVersion, that.resourceVersion) && java.util.Objects.equals(provisionedBalance, that.provisionedBalance) && java.util.Objects.equals(overdraftBalance, that.overdraftBalance); } @@ -138,7 +158,14 @@ public boolean equals(Object o) { public int hashCode() { return java.util.Objects.hash( - subscriptionId, unitId, unitType, modifiedAt, provisionedBalance, overdraftBalance); + subscriptionId, + unitId, + unitType, + createdAt, + modifiedAt, + resourceVersion, + provisionedBalance, + overdraftBalance); } public static class ProvisionedBalance { diff --git a/src/main/java/com/chargebee/v4/models/ledgerEntry/LedgerEntry.java b/src/main/java/com/chargebee/v4/models/ledgerEntry/LedgerEntry.java new file mode 100644 index 00000000..6ef1fe77 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/ledgerEntry/LedgerEntry.java @@ -0,0 +1,301 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.models.ledgerEntry; + +import com.chargebee.v4.internal.JsonUtil; +import com.google.gson.JsonObject; +import java.sql.Timestamp; + +public class LedgerEntry { + + private String id; + private String subscriptionId; + private AccountType accountType; + private String unitId; + private UnitType unitType; + private String amount; + private String grantBlockStartBalance; + private String grantBlockEndBalance; + private String accountStartBalance; + private String accountEndBalance; + private Type type; + private String ledgerOperationId; + private String grantBlockId; + private Timestamp createdAt; + private Timestamp modifiedAt; + + public String getId() { + return id; + } + + public String getSubscriptionId() { + return subscriptionId; + } + + public AccountType getAccountType() { + return accountType; + } + + public String getUnitId() { + return unitId; + } + + public UnitType getUnitType() { + return unitType; + } + + public String getAmount() { + return amount; + } + + public String getGrantBlockStartBalance() { + return grantBlockStartBalance; + } + + public String getGrantBlockEndBalance() { + return grantBlockEndBalance; + } + + public String getAccountStartBalance() { + return accountStartBalance; + } + + public String getAccountEndBalance() { + return accountEndBalance; + } + + public Type getType() { + return type; + } + + public String getLedgerOperationId() { + return ledgerOperationId; + } + + public String getGrantBlockId() { + return grantBlockId; + } + + public Timestamp getCreatedAt() { + return createdAt; + } + + public Timestamp getModifiedAt() { + return modifiedAt; + } + + public enum AccountType { + PROVISIONED("provisioned"), + + OVERDRAFT("overdraft"), + + /** An enum member indicating that AccountType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + AccountType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static AccountType fromString(String value) { + if (value == null) return _UNKNOWN; + for (AccountType enumValue : AccountType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum UnitType { + CREDIT_UNIT("credit_unit"), + + /** An enum member indicating that UnitType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + UnitType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static UnitType fromString(String value) { + if (value == null) return _UNKNOWN; + for (UnitType enumValue : UnitType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public enum Type { + CREDIT("credit"), + + DEBIT("debit"), + + HOLD("hold"), + + UNHOLD("unhold"), + + /** An enum member indicating that Type was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; + + Type(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static Type fromString(String value) { + if (value == null) return _UNKNOWN; + for (Type enumValue : Type.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } + } + + public static LedgerEntry fromJson(String json) { + return fromJson(JsonUtil.parse(json)); + } + + public static LedgerEntry fromJson(java.util.Map map) { + return fromJson(JsonUtil.toJson(map)); + } + + public static LedgerEntry fromJson(JsonObject jsonObj) { + LedgerEntry obj = new LedgerEntry(); + + obj.id = JsonUtil.getString(jsonObj, "id"); + + obj.subscriptionId = JsonUtil.getString(jsonObj, "subscription_id"); + + obj.accountType = AccountType.fromString(JsonUtil.getString(jsonObj, "account_type")); + + obj.unitId = JsonUtil.getString(jsonObj, "unit_id"); + + obj.unitType = UnitType.fromString(JsonUtil.getString(jsonObj, "unit_type")); + + obj.amount = JsonUtil.getString(jsonObj, "amount"); + + obj.grantBlockStartBalance = JsonUtil.getString(jsonObj, "grant_block_start_balance"); + + obj.grantBlockEndBalance = JsonUtil.getString(jsonObj, "grant_block_end_balance"); + + obj.accountStartBalance = JsonUtil.getString(jsonObj, "account_start_balance"); + + obj.accountEndBalance = JsonUtil.getString(jsonObj, "account_end_balance"); + + obj.type = Type.fromString(JsonUtil.getString(jsonObj, "type")); + + obj.ledgerOperationId = JsonUtil.getString(jsonObj, "ledger_operation_id"); + + obj.grantBlockId = JsonUtil.getString(jsonObj, "grant_block_id"); + + obj.createdAt = JsonUtil.getTimestamp(jsonObj, "created_at"); + + obj.modifiedAt = JsonUtil.getTimestamp(jsonObj, "modified_at"); + + return obj; + } + + @Override + public String toString() { + return "LedgerEntry{" + + "id=" + + id + + ", subscriptionId=" + + subscriptionId + + ", accountType=" + + accountType + + ", unitId=" + + unitId + + ", unitType=" + + unitType + + ", amount=" + + amount + + ", grantBlockStartBalance=" + + grantBlockStartBalance + + ", grantBlockEndBalance=" + + grantBlockEndBalance + + ", accountStartBalance=" + + accountStartBalance + + ", accountEndBalance=" + + accountEndBalance + + ", type=" + + type + + ", ledgerOperationId=" + + ledgerOperationId + + ", grantBlockId=" + + grantBlockId + + ", createdAt=" + + createdAt + + ", modifiedAt=" + + modifiedAt + + "}"; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + LedgerEntry that = (LedgerEntry) o; + return java.util.Objects.equals(id, that.id) + && java.util.Objects.equals(subscriptionId, that.subscriptionId) + && java.util.Objects.equals(accountType, that.accountType) + && java.util.Objects.equals(unitId, that.unitId) + && java.util.Objects.equals(unitType, that.unitType) + && java.util.Objects.equals(amount, that.amount) + && java.util.Objects.equals(grantBlockStartBalance, that.grantBlockStartBalance) + && java.util.Objects.equals(grantBlockEndBalance, that.grantBlockEndBalance) + && java.util.Objects.equals(accountStartBalance, that.accountStartBalance) + && java.util.Objects.equals(accountEndBalance, that.accountEndBalance) + && java.util.Objects.equals(type, that.type) + && java.util.Objects.equals(ledgerOperationId, that.ledgerOperationId) + && java.util.Objects.equals(grantBlockId, that.grantBlockId) + && java.util.Objects.equals(createdAt, that.createdAt) + && java.util.Objects.equals(modifiedAt, that.modifiedAt); + } + + @Override + public int hashCode() { + + return java.util.Objects.hash( + id, + subscriptionId, + accountType, + unitId, + unitType, + amount, + grantBlockStartBalance, + grantBlockEndBalance, + accountStartBalance, + accountEndBalance, + type, + ledgerOperationId, + grantBlockId, + createdAt, + modifiedAt); + } +} diff --git a/src/main/java/com/chargebee/v4/models/ledgerOperation/LedgerOperation.java b/src/main/java/com/chargebee/v4/models/ledgerOperation/LedgerOperation.java index 21a9948d..842efcea 100644 --- a/src/main/java/com/chargebee/v4/models/ledgerOperation/LedgerOperation.java +++ b/src/main/java/com/chargebee/v4/models/ledgerOperation/LedgerOperation.java @@ -14,6 +14,9 @@ public class LedgerOperation { private String id; + private String subscriptionId; + private String unitId; + private UnitType unitType; private Type type; private String amount; private String provisionedStartBalance; @@ -25,15 +28,24 @@ public class LedgerOperation { private Timestamp autoReleaseTimestamp; private Timestamp createdAt; private Timestamp modifiedAt; - private String subscriptionId; - private String unitId; - private UnitType unitType; private java.util.Map metadata; public String getId() { return id; } + public String getSubscriptionId() { + return subscriptionId; + } + + public String getUnitId() { + return unitId; + } + + public UnitType getUnitType() { + return unitType; + } + public Type getType() { return type; } @@ -78,20 +90,34 @@ public Timestamp getModifiedAt() { return modifiedAt; } - public String getSubscriptionId() { - return subscriptionId; + public java.util.Map getMetadata() { + return metadata; } - public String getUnitId() { - return unitId; - } + public enum UnitType { + CREDIT_UNIT("credit_unit"), - public UnitType getUnitType() { - return unitType; - } + /** An enum member indicating that UnitType was instantiated with an unknown value. */ + _UNKNOWN(null); + private final String value; - public java.util.Map getMetadata() { - return metadata; + UnitType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static UnitType fromString(String value) { + if (value == null) return _UNKNOWN; + for (UnitType enumValue : UnitType.values()) { + if (enumValue.value != null && enumValue.value.equals(value)) { + return enumValue; + } + } + return _UNKNOWN; + } } public enum Type { @@ -136,32 +162,6 @@ public static Type fromString(String value) { } } - public enum UnitType { - CREDIT_UNIT("credit_unit"), - - /** An enum member indicating that UnitType was instantiated with an unknown value. */ - _UNKNOWN(null); - private final String value; - - UnitType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static UnitType fromString(String value) { - if (value == null) return _UNKNOWN; - for (UnitType enumValue : UnitType.values()) { - if (enumValue.value != null && enumValue.value.equals(value)) { - return enumValue; - } - } - return _UNKNOWN; - } - } - public static LedgerOperation fromJson(String json) { return fromJson(JsonUtil.parse(json)); } @@ -175,6 +175,12 @@ public static LedgerOperation fromJson(JsonObject jsonObj) { obj.id = JsonUtil.getString(jsonObj, "id"); + obj.subscriptionId = JsonUtil.getString(jsonObj, "subscription_id"); + + obj.unitId = JsonUtil.getString(jsonObj, "unit_id"); + + obj.unitType = UnitType.fromString(JsonUtil.getString(jsonObj, "unit_type")); + obj.type = Type.fromString(JsonUtil.getString(jsonObj, "type")); obj.amount = JsonUtil.getString(jsonObj, "amount"); @@ -197,12 +203,6 @@ public static LedgerOperation fromJson(JsonObject jsonObj) { obj.modifiedAt = JsonUtil.getTimestamp(jsonObj, "modified_at"); - obj.subscriptionId = JsonUtil.getString(jsonObj, "subscription_id"); - - obj.unitId = JsonUtil.getString(jsonObj, "unit_id"); - - obj.unitType = UnitType.fromString(JsonUtil.getString(jsonObj, "unit_type")); - JsonObject __metadataObj = JsonUtil.getJsonObject(jsonObj, "metadata"); obj.metadata = __metadataObj != null @@ -217,6 +217,12 @@ public String toString() { return "LedgerOperation{" + "id=" + id + + ", subscriptionId=" + + subscriptionId + + ", unitId=" + + unitId + + ", unitType=" + + unitType + ", type=" + type + ", amount=" @@ -239,12 +245,6 @@ public String toString() { + createdAt + ", modifiedAt=" + modifiedAt - + ", subscriptionId=" - + subscriptionId - + ", unitId=" - + unitId - + ", unitType=" - + unitType + ", metadata=" + metadata + "}"; @@ -257,6 +257,9 @@ public boolean equals(Object o) { LedgerOperation that = (LedgerOperation) o; return java.util.Objects.equals(id, that.id) + && java.util.Objects.equals(subscriptionId, that.subscriptionId) + && java.util.Objects.equals(unitId, that.unitId) + && java.util.Objects.equals(unitType, that.unitType) && java.util.Objects.equals(type, that.type) && java.util.Objects.equals(amount, that.amount) && java.util.Objects.equals(provisionedStartBalance, that.provisionedStartBalance) @@ -268,9 +271,6 @@ public boolean equals(Object o) { && java.util.Objects.equals(autoReleaseTimestamp, that.autoReleaseTimestamp) && java.util.Objects.equals(createdAt, that.createdAt) && java.util.Objects.equals(modifiedAt, that.modifiedAt) - && java.util.Objects.equals(subscriptionId, that.subscriptionId) - && java.util.Objects.equals(unitId, that.unitId) - && java.util.Objects.equals(unitType, that.unitType) && java.util.Objects.equals(metadata, that.metadata); } @@ -279,6 +279,9 @@ public int hashCode() { return java.util.Objects.hash( id, + subscriptionId, + unitId, + unitType, type, amount, provisionedStartBalance, @@ -290,9 +293,6 @@ public int hashCode() { autoReleaseTimestamp, createdAt, modifiedAt, - subscriptionId, - unitId, - unitType, metadata); } } diff --git a/src/main/java/com/chargebee/v4/models/ledgerOperation/params/LedgerOperationAllocateParams.java b/src/main/java/com/chargebee/v4/models/ledgerOperation/params/LedgerOperationAllocateParams.java new file mode 100644 index 00000000..3c1d4b88 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/ledgerOperation/params/LedgerOperationAllocateParams.java @@ -0,0 +1,187 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ +package com.chargebee.v4.models.ledgerOperation.params; + +import com.chargebee.v4.internal.Recommended; +import com.chargebee.v4.internal.JsonUtil; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.sql.Timestamp; + +public final class LedgerOperationAllocateParams { + + private final String subscriptionId; + + private final String unitId; + + private final String amount; + + private final Timestamp expiresAt; + + private final java.util.Map metadata; + + private LedgerOperationAllocateParams(LedgerOperationAllocateBuilder builder) { + + this.subscriptionId = builder.subscriptionId; + + this.unitId = builder.unitId; + + this.amount = builder.amount; + + this.expiresAt = builder.expiresAt; + + this.metadata = builder.metadata; + } + + public String getSubscriptionId() { + return subscriptionId; + } + + public String getUnitId() { + return unitId; + } + + public String getAmount() { + return amount; + } + + public Timestamp getExpiresAt() { + return expiresAt; + } + + public java.util.Map getMetadata() { + return metadata; + } + + /** Get the form data for this request. */ + public Map toFormData() { + Map formData = new LinkedHashMap<>(); + + if (this.subscriptionId != null) { + + formData.put("subscription_id", this.subscriptionId); + } + + if (this.unitId != null) { + + formData.put("unit_id", this.unitId); + } + + if (this.amount != null) { + + formData.put("amount", this.amount); + } + + if (this.expiresAt != null) { + + formData.put("expires_at", this.expiresAt); + } + + if (this.metadata != null) { + + formData.put("metadata", JsonUtil.toJson(this.metadata)); + } + + return formData; + } + + /** + * Get the nested JSON body representation for this request. + * + *

Unlike {@link #toFormData()}, which flattens nested objects/arrays into bracketed {@code + * qs}-style keys for {@code application/x-www-form-urlencoded} requests, this method preserves + * the real object/array hierarchy so the payload can be serialized as a JSON string. Leaf values + * (e.g. {@code Timestamp}) are converted to their API representation by {@link JsonUtil} during + * serialization. + */ + public Map toJsonMap() { + Map jsonData = new LinkedHashMap<>(); + + if (this.subscriptionId != null) { + + jsonData.put("subscription_id", this.subscriptionId); + } + + if (this.unitId != null) { + + jsonData.put("unit_id", this.unitId); + } + + if (this.amount != null) { + + jsonData.put("amount", this.amount); + } + + if (this.expiresAt != null) { + + jsonData.put("expires_at", this.expiresAt); + } + + if (this.metadata != null) { + + jsonData.put("metadata", this.metadata); + } + + return jsonData; + } + + /** Get the JSON string representation for this request. */ + public String toJsonString() { + return JsonUtil.toJson(toJsonMap()); + } + + /** Create a new builder for LedgerOperationAllocateParams. */ + @Recommended(reason = "Preferred for reusability, validation, and LLM-friendliness") + public static LedgerOperationAllocateBuilder builder() { + return new LedgerOperationAllocateBuilder(); + } + + public static final class LedgerOperationAllocateBuilder { + + private String subscriptionId; + + private String unitId; + + private String amount; + + private Timestamp expiresAt; + + private java.util.Map metadata; + + private LedgerOperationAllocateBuilder() {} + + public LedgerOperationAllocateBuilder subscriptionId(String value) { + this.subscriptionId = value; + return this; + } + + public LedgerOperationAllocateBuilder unitId(String value) { + this.unitId = value; + return this; + } + + public LedgerOperationAllocateBuilder amount(String value) { + this.amount = value; + return this; + } + + public LedgerOperationAllocateBuilder expiresAt(Timestamp value) { + this.expiresAt = value; + return this; + } + + public LedgerOperationAllocateBuilder metadata(java.util.Map value) { + this.metadata = value; + return this; + } + + public LedgerOperationAllocateParams build() { + return new LedgerOperationAllocateParams(this); + } + } +} diff --git a/src/main/java/com/chargebee/v4/models/ledgerOperation/params/ListLedgerOperationsParams.java b/src/main/java/com/chargebee/v4/models/ledgerOperation/params/ListLedgerOperationsParams.java index 5de0838d..4816665c 100644 --- a/src/main/java/com/chargebee/v4/models/ledgerOperation/params/ListLedgerOperationsParams.java +++ b/src/main/java/com/chargebee/v4/models/ledgerOperation/params/ListLedgerOperationsParams.java @@ -198,7 +198,7 @@ public ListLedgerOperationsBuilder desc() { } } - public enum TypeIs { + public enum TypeIn { ALLOCATION("allocation"), CAPTURE("capture"), @@ -217,11 +217,11 @@ public enum TypeIs { ADJUSTMENT("adjustment"), - /** An enum member indicating that TypeIs was instantiated with an unknown value. */ + /** An enum member indicating that TypeIn was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; - TypeIs(String value) { + TypeIn(String value) { this.value = value; } @@ -229,9 +229,9 @@ public String getValue() { return value; } - public static TypeIs fromString(String value) { + public static TypeIn fromString(String value) { if (value == null) return _UNKNOWN; - for (TypeIs enumValue : TypeIs.values()) { + for (TypeIn enumValue : TypeIn.values()) { if (enumValue.value != null && enumValue.value.equals(value)) { return enumValue; } @@ -240,7 +240,7 @@ public static TypeIs fromString(String value) { } } - public enum TypeIn { + public enum TypeIs { ALLOCATION("allocation"), CAPTURE("capture"), @@ -259,11 +259,11 @@ public enum TypeIn { ADJUSTMENT("adjustment"), - /** An enum member indicating that TypeIn was instantiated with an unknown value. */ + /** An enum member indicating that TypeIs was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; - TypeIn(String value) { + TypeIs(String value) { this.value = value; } @@ -271,9 +271,9 @@ public String getValue() { return value; } - public static TypeIn fromString(String value) { + public static TypeIs fromString(String value) { if (value == null) return _UNKNOWN; - for (TypeIn enumValue : TypeIn.values()) { + for (TypeIs enumValue : TypeIs.values()) { if (enumValue.value != null && enumValue.value.equals(value)) { return enumValue; } diff --git a/src/main/java/com/chargebee/v4/models/ledgerOperation/responses/LedgerOperationAllocateResponse.java b/src/main/java/com/chargebee/v4/models/ledgerOperation/responses/LedgerOperationAllocateResponse.java new file mode 100644 index 00000000..943d49b2 --- /dev/null +++ b/src/main/java/com/chargebee/v4/models/ledgerOperation/responses/LedgerOperationAllocateResponse.java @@ -0,0 +1,180 @@ +package com.chargebee.v4.models.ledgerOperation.responses; + +import java.util.List; + +import com.chargebee.v4.models.ledgerOperation.LedgerOperation; + +import com.chargebee.v4.models.ledgerEntry.LedgerEntry; + +import com.chargebee.v4.models.ledgerAccountBalance.LedgerAccountBalance; + +import com.chargebee.v4.models.grantBlock.GrantBlock; + +import com.chargebee.v4.models.BaseResponse; +import com.chargebee.v4.internal.JsonUtil; +import com.google.gson.JsonObject; +import com.chargebee.v4.transport.Response; + +/** + * Immutable response object for LedgerOperationAllocate operation. Contains the response data from + * the API. + */ +public final class LedgerOperationAllocateResponse extends BaseResponse { + private final LedgerAccountBalance ledgerAccountBalance; + + private final List ledgerOperations; + + private final List grantBlocks; + + private final List ledgerEntries; + + private LedgerOperationAllocateResponse(Builder builder) { + super(builder.httpResponse); + + this.ledgerAccountBalance = builder.ledgerAccountBalance; + + this.ledgerOperations = builder.ledgerOperations; + + this.grantBlocks = builder.grantBlocks; + + this.ledgerEntries = builder.ledgerEntries; + } + + /** Parse JSON response into LedgerOperationAllocateResponse object. */ + public static LedgerOperationAllocateResponse fromJson(String json) { + return fromJson(json, null); + } + + /** Parse JSON response into LedgerOperationAllocateResponse object with HTTP response. */ + public static LedgerOperationAllocateResponse fromJson(String json, Response httpResponse) { + try { + JsonObject jsonObj = JsonUtil.parse(json); + Builder builder = builder(); + + JsonObject __ledgerAccountBalanceObj = + JsonUtil.getJsonObject(jsonObj, "ledger_account_balance"); + if (__ledgerAccountBalanceObj != null) { + builder.ledgerAccountBalance(LedgerAccountBalance.fromJson(__ledgerAccountBalanceObj)); + } + + builder.ledgerOperations( + JsonUtil.mapArray( + JsonUtil.getJsonArray(jsonObj, "ledger_operations"), LedgerOperation::fromJson)); + + builder.grantBlocks( + JsonUtil.mapArray(JsonUtil.getJsonArray(jsonObj, "grant_blocks"), GrantBlock::fromJson)); + + builder.ledgerEntries( + JsonUtil.mapArray( + JsonUtil.getJsonArray(jsonObj, "ledger_entries"), LedgerEntry::fromJson)); + + builder.httpResponse(httpResponse); + return builder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to parse LedgerOperationAllocateResponse from JSON", e); + } + } + + /** Create a new builder for LedgerOperationAllocateResponse. */ + public static Builder builder() { + return new Builder(); + } + + /** Builder for LedgerOperationAllocateResponse. */ + public static class Builder { + + private LedgerAccountBalance ledgerAccountBalance; + + private List ledgerOperations; + + private List grantBlocks; + + private List ledgerEntries; + + private Response httpResponse; + + private Builder() {} + + public Builder ledgerAccountBalance(LedgerAccountBalance ledgerAccountBalance) { + this.ledgerAccountBalance = ledgerAccountBalance; + return this; + } + + public Builder ledgerOperations(List ledgerOperations) { + this.ledgerOperations = ledgerOperations; + return this; + } + + public Builder grantBlocks(List grantBlocks) { + this.grantBlocks = grantBlocks; + return this; + } + + public Builder ledgerEntries(List ledgerEntries) { + this.ledgerEntries = ledgerEntries; + return this; + } + + public Builder httpResponse(Response httpResponse) { + this.httpResponse = httpResponse; + return this; + } + + public LedgerOperationAllocateResponse build() { + return new LedgerOperationAllocateResponse(this); + } + } + + /** Get the ledgerAccountBalance from the response. */ + public LedgerAccountBalance getLedgerAccountBalance() { + return ledgerAccountBalance; + } + + /** Get the ledgerOperations from the response. */ + public List getLedgerOperations() { + return ledgerOperations; + } + + /** Get the grantBlocks from the response. */ + public List getGrantBlocks() { + return grantBlocks; + } + + /** Get the ledgerEntries from the response. */ + public List getLedgerEntries() { + return ledgerEntries; + } + + @Override + public String toString() { + return "LedgerOperationAllocateResponse{" + + "ledgerAccountBalance=" + + ledgerAccountBalance + + ", ledgerOperations=" + + ledgerOperations + + ", grantBlocks=" + + grantBlocks + + ", ledgerEntries=" + + ledgerEntries + + "}"; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + LedgerOperationAllocateResponse that = (LedgerOperationAllocateResponse) o; + return java.util.Objects.equals(ledgerAccountBalance, that.ledgerAccountBalance) + && java.util.Objects.equals(ledgerOperations, that.ledgerOperations) + && java.util.Objects.equals(grantBlocks, that.grantBlocks) + && java.util.Objects.equals(ledgerEntries, that.ledgerEntries); + } + + @Override + public int hashCode() { + + return java.util.Objects.hash( + ledgerAccountBalance, ledgerOperations, grantBlocks, ledgerEntries); + } +} diff --git a/src/main/java/com/chargebee/v4/models/ledgerOperation/responses/LedgerOperationAuthorizeResponse.java b/src/main/java/com/chargebee/v4/models/ledgerOperation/responses/LedgerOperationAuthorizeResponse.java index 6f1d6d2d..0dc26c5a 100644 --- a/src/main/java/com/chargebee/v4/models/ledgerOperation/responses/LedgerOperationAuthorizeResponse.java +++ b/src/main/java/com/chargebee/v4/models/ledgerOperation/responses/LedgerOperationAuthorizeResponse.java @@ -1,9 +1,15 @@ package com.chargebee.v4.models.ledgerOperation.responses; +import java.util.List; + import com.chargebee.v4.models.ledgerOperation.LedgerOperation; +import com.chargebee.v4.models.ledgerEntry.LedgerEntry; + import com.chargebee.v4.models.ledgerAccountBalance.LedgerAccountBalance; +import com.chargebee.v4.models.grantBlock.GrantBlock; + import com.chargebee.v4.models.BaseResponse; import com.chargebee.v4.internal.JsonUtil; import com.google.gson.JsonObject; @@ -18,12 +24,20 @@ public final class LedgerOperationAuthorizeResponse extends BaseResponse { private final LedgerAccountBalance ledgerAccountBalance; + private final List grantBlocks; + + private final List ledgerEntries; + private LedgerOperationAuthorizeResponse(Builder builder) { super(builder.httpResponse); this.ledgerOperation = builder.ledgerOperation; this.ledgerAccountBalance = builder.ledgerAccountBalance; + + this.grantBlocks = builder.grantBlocks; + + this.ledgerEntries = builder.ledgerEntries; } /** Parse JSON response into LedgerOperationAuthorizeResponse object. */ @@ -48,6 +62,13 @@ public static LedgerOperationAuthorizeResponse fromJson(String json, Response ht builder.ledgerAccountBalance(LedgerAccountBalance.fromJson(__ledgerAccountBalanceObj)); } + builder.grantBlocks( + JsonUtil.mapArray(JsonUtil.getJsonArray(jsonObj, "grant_blocks"), GrantBlock::fromJson)); + + builder.ledgerEntries( + JsonUtil.mapArray( + JsonUtil.getJsonArray(jsonObj, "ledger_entries"), LedgerEntry::fromJson)); + builder.httpResponse(httpResponse); return builder.build(); } catch (Exception e) { @@ -67,6 +88,10 @@ public static class Builder { private LedgerAccountBalance ledgerAccountBalance; + private List grantBlocks; + + private List ledgerEntries; + private Response httpResponse; private Builder() {} @@ -81,6 +106,16 @@ public Builder ledgerAccountBalance(LedgerAccountBalance ledgerAccountBalance) { return this; } + public Builder grantBlocks(List grantBlocks) { + this.grantBlocks = grantBlocks; + return this; + } + + public Builder ledgerEntries(List ledgerEntries) { + this.ledgerEntries = ledgerEntries; + return this; + } + public Builder httpResponse(Response httpResponse) { this.httpResponse = httpResponse; return this; @@ -101,6 +136,16 @@ public LedgerAccountBalance getLedgerAccountBalance() { return ledgerAccountBalance; } + /** Get the grantBlocks from the response. */ + public List getGrantBlocks() { + return grantBlocks; + } + + /** Get the ledgerEntries from the response. */ + public List getLedgerEntries() { + return ledgerEntries; + } + @Override public String toString() { return "LedgerOperationAuthorizeResponse{" @@ -108,6 +153,10 @@ public String toString() { + ledgerOperation + ", ledgerAccountBalance=" + ledgerAccountBalance + + ", grantBlocks=" + + grantBlocks + + ", ledgerEntries=" + + ledgerEntries + "}"; } @@ -118,12 +167,15 @@ public boolean equals(Object o) { LedgerOperationAuthorizeResponse that = (LedgerOperationAuthorizeResponse) o; return java.util.Objects.equals(ledgerOperation, that.ledgerOperation) - && java.util.Objects.equals(ledgerAccountBalance, that.ledgerAccountBalance); + && java.util.Objects.equals(ledgerAccountBalance, that.ledgerAccountBalance) + && java.util.Objects.equals(grantBlocks, that.grantBlocks) + && java.util.Objects.equals(ledgerEntries, that.ledgerEntries); } @Override public int hashCode() { - return java.util.Objects.hash(ledgerOperation, ledgerAccountBalance); + return java.util.Objects.hash( + ledgerOperation, ledgerAccountBalance, grantBlocks, ledgerEntries); } } diff --git a/src/main/java/com/chargebee/v4/models/ledgerOperation/responses/LedgerOperationCaptureAuthorizationResponse.java b/src/main/java/com/chargebee/v4/models/ledgerOperation/responses/LedgerOperationCaptureAuthorizationResponse.java index a9c3fc03..d5cfbd5d 100644 --- a/src/main/java/com/chargebee/v4/models/ledgerOperation/responses/LedgerOperationCaptureAuthorizationResponse.java +++ b/src/main/java/com/chargebee/v4/models/ledgerOperation/responses/LedgerOperationCaptureAuthorizationResponse.java @@ -1,9 +1,15 @@ package com.chargebee.v4.models.ledgerOperation.responses; +import java.util.List; + import com.chargebee.v4.models.ledgerOperation.LedgerOperation; +import com.chargebee.v4.models.ledgerEntry.LedgerEntry; + import com.chargebee.v4.models.ledgerAccountBalance.LedgerAccountBalance; +import com.chargebee.v4.models.grantBlock.GrantBlock; + import com.chargebee.v4.models.BaseResponse; import com.chargebee.v4.internal.JsonUtil; import com.google.gson.JsonObject; @@ -18,12 +24,20 @@ public final class LedgerOperationCaptureAuthorizationResponse extends BaseRespo private final LedgerAccountBalance ledgerAccountBalance; + private final List grantBlocks; + + private final List ledgerEntries; + private LedgerOperationCaptureAuthorizationResponse(Builder builder) { super(builder.httpResponse); this.ledgerOperation = builder.ledgerOperation; this.ledgerAccountBalance = builder.ledgerAccountBalance; + + this.grantBlocks = builder.grantBlocks; + + this.ledgerEntries = builder.ledgerEntries; } /** Parse JSON response into LedgerOperationCaptureAuthorizationResponse object. */ @@ -51,6 +65,13 @@ public static LedgerOperationCaptureAuthorizationResponse fromJson( builder.ledgerAccountBalance(LedgerAccountBalance.fromJson(__ledgerAccountBalanceObj)); } + builder.grantBlocks( + JsonUtil.mapArray(JsonUtil.getJsonArray(jsonObj, "grant_blocks"), GrantBlock::fromJson)); + + builder.ledgerEntries( + JsonUtil.mapArray( + JsonUtil.getJsonArray(jsonObj, "ledger_entries"), LedgerEntry::fromJson)); + builder.httpResponse(httpResponse); return builder.build(); } catch (Exception e) { @@ -71,6 +92,10 @@ public static class Builder { private LedgerAccountBalance ledgerAccountBalance; + private List grantBlocks; + + private List ledgerEntries; + private Response httpResponse; private Builder() {} @@ -85,6 +110,16 @@ public Builder ledgerAccountBalance(LedgerAccountBalance ledgerAccountBalance) { return this; } + public Builder grantBlocks(List grantBlocks) { + this.grantBlocks = grantBlocks; + return this; + } + + public Builder ledgerEntries(List ledgerEntries) { + this.ledgerEntries = ledgerEntries; + return this; + } + public Builder httpResponse(Response httpResponse) { this.httpResponse = httpResponse; return this; @@ -105,6 +140,16 @@ public LedgerAccountBalance getLedgerAccountBalance() { return ledgerAccountBalance; } + /** Get the grantBlocks from the response. */ + public List getGrantBlocks() { + return grantBlocks; + } + + /** Get the ledgerEntries from the response. */ + public List getLedgerEntries() { + return ledgerEntries; + } + @Override public String toString() { return "LedgerOperationCaptureAuthorizationResponse{" @@ -112,6 +157,10 @@ public String toString() { + ledgerOperation + ", ledgerAccountBalance=" + ledgerAccountBalance + + ", grantBlocks=" + + grantBlocks + + ", ledgerEntries=" + + ledgerEntries + "}"; } @@ -123,12 +172,15 @@ public boolean equals(Object o) { LedgerOperationCaptureAuthorizationResponse that = (LedgerOperationCaptureAuthorizationResponse) o; return java.util.Objects.equals(ledgerOperation, that.ledgerOperation) - && java.util.Objects.equals(ledgerAccountBalance, that.ledgerAccountBalance); + && java.util.Objects.equals(ledgerAccountBalance, that.ledgerAccountBalance) + && java.util.Objects.equals(grantBlocks, that.grantBlocks) + && java.util.Objects.equals(ledgerEntries, that.ledgerEntries); } @Override public int hashCode() { - return java.util.Objects.hash(ledgerOperation, ledgerAccountBalance); + return java.util.Objects.hash( + ledgerOperation, ledgerAccountBalance, grantBlocks, ledgerEntries); } } diff --git a/src/main/java/com/chargebee/v4/models/ledgerOperation/responses/LedgerOperationCaptureResponse.java b/src/main/java/com/chargebee/v4/models/ledgerOperation/responses/LedgerOperationCaptureResponse.java index 72c5afd7..bcee5b26 100644 --- a/src/main/java/com/chargebee/v4/models/ledgerOperation/responses/LedgerOperationCaptureResponse.java +++ b/src/main/java/com/chargebee/v4/models/ledgerOperation/responses/LedgerOperationCaptureResponse.java @@ -1,9 +1,15 @@ package com.chargebee.v4.models.ledgerOperation.responses; +import java.util.List; + import com.chargebee.v4.models.ledgerOperation.LedgerOperation; +import com.chargebee.v4.models.ledgerEntry.LedgerEntry; + import com.chargebee.v4.models.ledgerAccountBalance.LedgerAccountBalance; +import com.chargebee.v4.models.grantBlock.GrantBlock; + import com.chargebee.v4.models.BaseResponse; import com.chargebee.v4.internal.JsonUtil; import com.google.gson.JsonObject; @@ -18,12 +24,20 @@ public final class LedgerOperationCaptureResponse extends BaseResponse { private final LedgerAccountBalance ledgerAccountBalance; + private final List grantBlocks; + + private final List ledgerEntries; + private LedgerOperationCaptureResponse(Builder builder) { super(builder.httpResponse); this.ledgerOperation = builder.ledgerOperation; this.ledgerAccountBalance = builder.ledgerAccountBalance; + + this.grantBlocks = builder.grantBlocks; + + this.ledgerEntries = builder.ledgerEntries; } /** Parse JSON response into LedgerOperationCaptureResponse object. */ @@ -48,6 +62,13 @@ public static LedgerOperationCaptureResponse fromJson(String json, Response http builder.ledgerAccountBalance(LedgerAccountBalance.fromJson(__ledgerAccountBalanceObj)); } + builder.grantBlocks( + JsonUtil.mapArray(JsonUtil.getJsonArray(jsonObj, "grant_blocks"), GrantBlock::fromJson)); + + builder.ledgerEntries( + JsonUtil.mapArray( + JsonUtil.getJsonArray(jsonObj, "ledger_entries"), LedgerEntry::fromJson)); + builder.httpResponse(httpResponse); return builder.build(); } catch (Exception e) { @@ -67,6 +88,10 @@ public static class Builder { private LedgerAccountBalance ledgerAccountBalance; + private List grantBlocks; + + private List ledgerEntries; + private Response httpResponse; private Builder() {} @@ -81,6 +106,16 @@ public Builder ledgerAccountBalance(LedgerAccountBalance ledgerAccountBalance) { return this; } + public Builder grantBlocks(List grantBlocks) { + this.grantBlocks = grantBlocks; + return this; + } + + public Builder ledgerEntries(List ledgerEntries) { + this.ledgerEntries = ledgerEntries; + return this; + } + public Builder httpResponse(Response httpResponse) { this.httpResponse = httpResponse; return this; @@ -101,6 +136,16 @@ public LedgerAccountBalance getLedgerAccountBalance() { return ledgerAccountBalance; } + /** Get the grantBlocks from the response. */ + public List getGrantBlocks() { + return grantBlocks; + } + + /** Get the ledgerEntries from the response. */ + public List getLedgerEntries() { + return ledgerEntries; + } + @Override public String toString() { return "LedgerOperationCaptureResponse{" @@ -108,6 +153,10 @@ public String toString() { + ledgerOperation + ", ledgerAccountBalance=" + ledgerAccountBalance + + ", grantBlocks=" + + grantBlocks + + ", ledgerEntries=" + + ledgerEntries + "}"; } @@ -118,12 +167,15 @@ public boolean equals(Object o) { LedgerOperationCaptureResponse that = (LedgerOperationCaptureResponse) o; return java.util.Objects.equals(ledgerOperation, that.ledgerOperation) - && java.util.Objects.equals(ledgerAccountBalance, that.ledgerAccountBalance); + && java.util.Objects.equals(ledgerAccountBalance, that.ledgerAccountBalance) + && java.util.Objects.equals(grantBlocks, that.grantBlocks) + && java.util.Objects.equals(ledgerEntries, that.ledgerEntries); } @Override public int hashCode() { - return java.util.Objects.hash(ledgerOperation, ledgerAccountBalance); + return java.util.Objects.hash( + ledgerOperation, ledgerAccountBalance, grantBlocks, ledgerEntries); } } diff --git a/src/main/java/com/chargebee/v4/models/ledgerOperation/responses/LedgerOperationReleaseAuthorizationResponse.java b/src/main/java/com/chargebee/v4/models/ledgerOperation/responses/LedgerOperationReleaseAuthorizationResponse.java index 42bb9fbb..8055b553 100644 --- a/src/main/java/com/chargebee/v4/models/ledgerOperation/responses/LedgerOperationReleaseAuthorizationResponse.java +++ b/src/main/java/com/chargebee/v4/models/ledgerOperation/responses/LedgerOperationReleaseAuthorizationResponse.java @@ -1,9 +1,15 @@ package com.chargebee.v4.models.ledgerOperation.responses; +import java.util.List; + import com.chargebee.v4.models.ledgerOperation.LedgerOperation; +import com.chargebee.v4.models.ledgerEntry.LedgerEntry; + import com.chargebee.v4.models.ledgerAccountBalance.LedgerAccountBalance; +import com.chargebee.v4.models.grantBlock.GrantBlock; + import com.chargebee.v4.models.BaseResponse; import com.chargebee.v4.internal.JsonUtil; import com.google.gson.JsonObject; @@ -18,12 +24,20 @@ public final class LedgerOperationReleaseAuthorizationResponse extends BaseRespo private final LedgerAccountBalance ledgerAccountBalance; + private final List grantBlocks; + + private final List ledgerEntries; + private LedgerOperationReleaseAuthorizationResponse(Builder builder) { super(builder.httpResponse); this.ledgerOperation = builder.ledgerOperation; this.ledgerAccountBalance = builder.ledgerAccountBalance; + + this.grantBlocks = builder.grantBlocks; + + this.ledgerEntries = builder.ledgerEntries; } /** Parse JSON response into LedgerOperationReleaseAuthorizationResponse object. */ @@ -51,6 +65,13 @@ public static LedgerOperationReleaseAuthorizationResponse fromJson( builder.ledgerAccountBalance(LedgerAccountBalance.fromJson(__ledgerAccountBalanceObj)); } + builder.grantBlocks( + JsonUtil.mapArray(JsonUtil.getJsonArray(jsonObj, "grant_blocks"), GrantBlock::fromJson)); + + builder.ledgerEntries( + JsonUtil.mapArray( + JsonUtil.getJsonArray(jsonObj, "ledger_entries"), LedgerEntry::fromJson)); + builder.httpResponse(httpResponse); return builder.build(); } catch (Exception e) { @@ -71,6 +92,10 @@ public static class Builder { private LedgerAccountBalance ledgerAccountBalance; + private List grantBlocks; + + private List ledgerEntries; + private Response httpResponse; private Builder() {} @@ -85,6 +110,16 @@ public Builder ledgerAccountBalance(LedgerAccountBalance ledgerAccountBalance) { return this; } + public Builder grantBlocks(List grantBlocks) { + this.grantBlocks = grantBlocks; + return this; + } + + public Builder ledgerEntries(List ledgerEntries) { + this.ledgerEntries = ledgerEntries; + return this; + } + public Builder httpResponse(Response httpResponse) { this.httpResponse = httpResponse; return this; @@ -105,6 +140,16 @@ public LedgerAccountBalance getLedgerAccountBalance() { return ledgerAccountBalance; } + /** Get the grantBlocks from the response. */ + public List getGrantBlocks() { + return grantBlocks; + } + + /** Get the ledgerEntries from the response. */ + public List getLedgerEntries() { + return ledgerEntries; + } + @Override public String toString() { return "LedgerOperationReleaseAuthorizationResponse{" @@ -112,6 +157,10 @@ public String toString() { + ledgerOperation + ", ledgerAccountBalance=" + ledgerAccountBalance + + ", grantBlocks=" + + grantBlocks + + ", ledgerEntries=" + + ledgerEntries + "}"; } @@ -123,12 +172,15 @@ public boolean equals(Object o) { LedgerOperationReleaseAuthorizationResponse that = (LedgerOperationReleaseAuthorizationResponse) o; return java.util.Objects.equals(ledgerOperation, that.ledgerOperation) - && java.util.Objects.equals(ledgerAccountBalance, that.ledgerAccountBalance); + && java.util.Objects.equals(ledgerAccountBalance, that.ledgerAccountBalance) + && java.util.Objects.equals(grantBlocks, that.grantBlocks) + && java.util.Objects.equals(ledgerEntries, that.ledgerEntries); } @Override public int hashCode() { - return java.util.Objects.hash(ledgerOperation, ledgerAccountBalance); + return java.util.Objects.hash( + ledgerOperation, ledgerAccountBalance, grantBlocks, ledgerEntries); } } diff --git a/src/main/java/com/chargebee/v4/models/paymentIntent/PaymentIntent.java b/src/main/java/com/chargebee/v4/models/paymentIntent/PaymentIntent.java index c38ff6b3..0cc1ee24 100644 --- a/src/main/java/com/chargebee/v4/models/paymentIntent/PaymentIntent.java +++ b/src/main/java/com/chargebee/v4/models/paymentIntent/PaymentIntent.java @@ -246,6 +246,14 @@ public enum PaymentMethodType { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that PaymentMethodType was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; @@ -622,6 +630,14 @@ public enum PaymentMethodType { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** * An enum member indicating that PaymentMethodType was instantiated with an unknown value. */ @@ -1137,6 +1153,14 @@ public enum PaymentMethodType { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** * An enum member indicating that PaymentMethodType was instantiated with an unknown value. */ diff --git a/src/main/java/com/chargebee/v4/models/paymentIntent/params/PaymentIntentCreateParams.java b/src/main/java/com/chargebee/v4/models/paymentIntent/params/PaymentIntentCreateParams.java index acaeb383..8a8ff02b 100644 --- a/src/main/java/com/chargebee/v4/models/paymentIntent/params/PaymentIntentCreateParams.java +++ b/src/main/java/com/chargebee/v4/models/paymentIntent/params/PaymentIntentCreateParams.java @@ -335,6 +335,14 @@ public enum PaymentMethodType { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that PaymentMethodType was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; diff --git a/src/main/java/com/chargebee/v4/models/paymentIntent/params/PaymentIntentUpdateParams.java b/src/main/java/com/chargebee/v4/models/paymentIntent/params/PaymentIntentUpdateParams.java index dcd2bc73..20b838bf 100644 --- a/src/main/java/com/chargebee/v4/models/paymentIntent/params/PaymentIntentUpdateParams.java +++ b/src/main/java/com/chargebee/v4/models/paymentIntent/params/PaymentIntentUpdateParams.java @@ -255,6 +255,14 @@ public enum PaymentMethodType { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that PaymentMethodType was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/PaymentSource.java b/src/main/java/com/chargebee/v4/models/paymentSource/PaymentSource.java index 9689462f..62f9fa95 100644 --- a/src/main/java/com/chargebee/v4/models/paymentSource/PaymentSource.java +++ b/src/main/java/com/chargebee/v4/models/paymentSource/PaymentSource.java @@ -236,6 +236,14 @@ public enum Type { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that Type was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceCreateUsingPaymentIntentParams.java b/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceCreateUsingPaymentIntentParams.java index 2dd32ed5..e4eed7aa 100644 --- a/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceCreateUsingPaymentIntentParams.java +++ b/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceCreateUsingPaymentIntentParams.java @@ -390,6 +390,14 @@ public enum PaymentMethodType { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** * An enum member indicating that PaymentMethodType was instantiated with an unknown value. */ diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceCreateUsingPermanentTokenParams.java b/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceCreateUsingPermanentTokenParams.java index cb134e6c..bec7549f 100644 --- a/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceCreateUsingPermanentTokenParams.java +++ b/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceCreateUsingPermanentTokenParams.java @@ -434,6 +434,14 @@ public enum Type { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that Type was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceCreateUsingTempTokenParams.java b/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceCreateUsingTempTokenParams.java index d7d6aace..03a9c3a1 100644 --- a/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceCreateUsingTempTokenParams.java +++ b/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceCreateUsingTempTokenParams.java @@ -282,6 +282,14 @@ public enum Type { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that Type was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; diff --git a/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceListParams.java b/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceListParams.java index b64fba99..a75f4ab2 100644 --- a/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceListParams.java +++ b/src/main/java/com/chargebee/v4/models/paymentSource/params/PaymentSourceListParams.java @@ -373,6 +373,14 @@ public enum TypeIs { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that TypeIs was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; @@ -497,6 +505,14 @@ public enum TypeIsNot { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that TypeIsNot was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; @@ -621,6 +637,14 @@ public enum TypeIn { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that TypeIn was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; @@ -745,6 +769,14 @@ public enum TypeNotIn { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that TypeNotIn was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; @@ -1061,6 +1093,14 @@ public enum Type { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that Type was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; diff --git a/src/main/java/com/chargebee/v4/models/purchase/params/PurchaseCreateParams.java b/src/main/java/com/chargebee/v4/models/purchase/params/PurchaseCreateParams.java index a0387c9d..aae413af 100644 --- a/src/main/java/com/chargebee/v4/models/purchase/params/PurchaseCreateParams.java +++ b/src/main/java/com/chargebee/v4/models/purchase/params/PurchaseCreateParams.java @@ -829,6 +829,14 @@ public enum PaymentMethodType { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** * An enum member indicating that PaymentMethodType was instantiated with an unknown value. */ diff --git a/src/main/java/com/chargebee/v4/models/ramp/params/RampListParams.java b/src/main/java/com/chargebee/v4/models/ramp/params/RampListParams.java index 3d48cea1..2fe4523f 100644 --- a/src/main/java/com/chargebee/v4/models/ramp/params/RampListParams.java +++ b/src/main/java/com/chargebee/v4/models/ramp/params/RampListParams.java @@ -202,7 +202,7 @@ public RampListBuilder desc() { } } - public enum StatusIs { + public enum StatusIn { SCHEDULED("scheduled"), SUCCEEDED("succeeded"), @@ -211,11 +211,11 @@ public enum StatusIs { DRAFT("draft"), - /** An enum member indicating that StatusIs was instantiated with an unknown value. */ + /** An enum member indicating that StatusIn was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; - StatusIs(String value) { + StatusIn(String value) { this.value = value; } @@ -223,9 +223,9 @@ public String getValue() { return value; } - public static StatusIs fromString(String value) { + public static StatusIn fromString(String value) { if (value == null) return _UNKNOWN; - for (StatusIs enumValue : StatusIs.values()) { + for (StatusIn enumValue : StatusIn.values()) { if (enumValue.value != null && enumValue.value.equals(value)) { return enumValue; } @@ -234,7 +234,7 @@ public static StatusIs fromString(String value) { } } - public enum StatusIn { + public enum StatusIs { SCHEDULED("scheduled"), SUCCEEDED("succeeded"), @@ -243,11 +243,11 @@ public enum StatusIn { DRAFT("draft"), - /** An enum member indicating that StatusIn was instantiated with an unknown value. */ + /** An enum member indicating that StatusIs was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; - StatusIn(String value) { + StatusIs(String value) { this.value = value; } @@ -255,9 +255,9 @@ public String getValue() { return value; } - public static StatusIn fromString(String value) { + public static StatusIs fromString(String value) { if (value == null) return _UNKNOWN; - for (StatusIn enumValue : StatusIn.values()) { + for (StatusIs enumValue : StatusIs.values()) { if (enumValue.value != null && enumValue.value.equals(value)) { return enumValue; } diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/ImportSubscriptionParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/ImportSubscriptionParams.java index 86566a92..741b9ea7 100644 --- a/src/main/java/com/chargebee/v4/models/subscription/params/ImportSubscriptionParams.java +++ b/src/main/java/com/chargebee/v4/models/subscription/params/ImportSubscriptionParams.java @@ -2650,6 +2650,14 @@ public enum Type { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that Type was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; @@ -3618,6 +3626,14 @@ public enum PaymentMethod { CUSTOM("custom"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that PaymentMethod was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionCancelForItemsParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionCancelForItemsParams.java index d6412fd0..f1c96f54 100644 --- a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionCancelForItemsParams.java +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionCancelForItemsParams.java @@ -33,6 +33,8 @@ public final class SubscriptionCancelForItemsParams { private final Timestamp invoiceDate; + private final Boolean includeCancellationDayInBilling; + private final String cancelReasonCode; private final Boolean decommissioned; @@ -59,6 +61,8 @@ private SubscriptionCancelForItemsParams(SubscriptionCancelForItemsBuilder build this.invoiceDate = builder.invoiceDate; + this.includeCancellationDayInBilling = builder.includeCancellationDayInBilling; + this.cancelReasonCode = builder.cancelReasonCode; this.decommissioned = builder.decommissioned; @@ -102,6 +106,10 @@ public Timestamp getInvoiceDate() { return invoiceDate; } + public Boolean getIncludeCancellationDayInBilling() { + return includeCancellationDayInBilling; + } + public String getCancelReasonCode() { return cancelReasonCode; } @@ -164,6 +172,11 @@ public Map toFormData() { formData.put("invoice_date", this.invoiceDate); } + if (this.includeCancellationDayInBilling != null) { + + formData.put("include_cancellation_day_in_billing", this.includeCancellationDayInBilling); + } + if (this.cancelReasonCode != null) { formData.put("cancel_reason_code", this.cancelReasonCode); @@ -218,6 +231,8 @@ public static final class SubscriptionCancelForItemsBuilder { private Timestamp invoiceDate; + private Boolean includeCancellationDayInBilling; + private String cancelReasonCode; private Boolean decommissioned; @@ -275,6 +290,11 @@ public SubscriptionCancelForItemsBuilder invoiceDate(Timestamp value) { return this; } + public SubscriptionCancelForItemsBuilder includeCancellationDayInBilling(Boolean value) { + this.includeCancellationDayInBilling = value; + return this; + } + public SubscriptionCancelForItemsBuilder cancelReasonCode(String value) { this.cancelReasonCode = value; return this; diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionCreateForCustomerParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionCreateForCustomerParams.java index fce774ca..ec3d576b 100644 --- a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionCreateForCustomerParams.java +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionCreateForCustomerParams.java @@ -1743,6 +1743,14 @@ public enum PaymentMethodType { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** * An enum member indicating that PaymentMethodType was instantiated with an unknown value. */ diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionCreateParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionCreateParams.java index 89c1a5f3..1925d982 100644 --- a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionCreateParams.java +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionCreateParams.java @@ -3470,6 +3470,14 @@ public enum Type { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that Type was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; @@ -3901,6 +3909,14 @@ public enum PaymentMethodType { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** * An enum member indicating that PaymentMethodType was instantiated with an unknown value. */ diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionCreateWithItemsParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionCreateWithItemsParams.java index d2afd489..60d0304b 100644 --- a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionCreateWithItemsParams.java +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionCreateWithItemsParams.java @@ -1798,6 +1798,14 @@ public enum PaymentMethodType { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** * An enum member indicating that PaymentMethodType was instantiated with an unknown value. */ diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionImportForCustomerParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionImportForCustomerParams.java index 7030eff9..1b697a03 100644 --- a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionImportForCustomerParams.java +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionImportForCustomerParams.java @@ -1240,6 +1240,14 @@ public enum PaymentMethod { CUSTOM("custom"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that PaymentMethod was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionImportForItemsParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionImportForItemsParams.java index bf14e6bd..dd9e996b 100644 --- a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionImportForItemsParams.java +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionImportForItemsParams.java @@ -1270,6 +1270,14 @@ public enum PaymentMethod { CUSTOM("custom"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that PaymentMethod was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionReactivateParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionReactivateParams.java index 0be2ab6d..9b7f6c52 100644 --- a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionReactivateParams.java +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionReactivateParams.java @@ -786,6 +786,14 @@ public enum PaymentMethodType { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** * An enum member indicating that PaymentMethodType was instantiated with an unknown value. */ diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionResumeParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionResumeParams.java index 41dd0c2a..5d6ad04e 100644 --- a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionResumeParams.java +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionResumeParams.java @@ -544,6 +544,14 @@ public enum PaymentMethodType { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** * An enum member indicating that PaymentMethodType was instantiated with an unknown value. */ diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionUpdateForItemsParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionUpdateForItemsParams.java index df982ca8..a79bdb44 100644 --- a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionUpdateForItemsParams.java +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionUpdateForItemsParams.java @@ -2247,6 +2247,14 @@ public enum Type { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that Type was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; @@ -2678,6 +2686,14 @@ public enum PaymentMethodType { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** * An enum member indicating that PaymentMethodType was instantiated with an unknown value. */ diff --git a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionUpdateParams.java b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionUpdateParams.java index dc146e3f..4fe6c83e 100644 --- a/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionUpdateParams.java +++ b/src/main/java/com/chargebee/v4/models/subscription/params/SubscriptionUpdateParams.java @@ -2162,6 +2162,14 @@ public enum Type { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that Type was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; @@ -2593,6 +2601,14 @@ public enum PaymentMethodType { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** * An enum member indicating that PaymentMethodType was instantiated with an unknown value. */ diff --git a/src/main/java/com/chargebee/v4/models/thirdPartyPaymentMethod/ThirdPartyPaymentMethod.java b/src/main/java/com/chargebee/v4/models/thirdPartyPaymentMethod/ThirdPartyPaymentMethod.java index 36571e79..3e32be23 100644 --- a/src/main/java/com/chargebee/v4/models/thirdPartyPaymentMethod/ThirdPartyPaymentMethod.java +++ b/src/main/java/com/chargebee/v4/models/thirdPartyPaymentMethod/ThirdPartyPaymentMethod.java @@ -134,6 +134,14 @@ public enum Type { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that Type was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; diff --git a/src/main/java/com/chargebee/v4/models/token/Token.java b/src/main/java/com/chargebee/v4/models/token/Token.java index d5e28e97..f937ddc7 100644 --- a/src/main/java/com/chargebee/v4/models/token/Token.java +++ b/src/main/java/com/chargebee/v4/models/token/Token.java @@ -321,6 +321,14 @@ public enum PaymentMethodType { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that PaymentMethodType was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; diff --git a/src/main/java/com/chargebee/v4/models/transaction/Transaction.java b/src/main/java/com/chargebee/v4/models/transaction/Transaction.java index b717c5fa..c113329b 100644 --- a/src/main/java/com/chargebee/v4/models/transaction/Transaction.java +++ b/src/main/java/com/chargebee/v4/models/transaction/Transaction.java @@ -367,6 +367,14 @@ public enum PaymentMethod { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that PaymentMethod was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; diff --git a/src/main/java/com/chargebee/v4/models/transaction/params/TransactionListParams.java b/src/main/java/com/chargebee/v4/models/transaction/params/TransactionListParams.java index cef313e4..b4e2d15d 100644 --- a/src/main/java/com/chargebee/v4/models/transaction/params/TransactionListParams.java +++ b/src/main/java/com/chargebee/v4/models/transaction/params/TransactionListParams.java @@ -692,6 +692,14 @@ public enum PaymentMethodIs { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that PaymentMethodIs was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; @@ -836,6 +844,14 @@ public enum PaymentMethodIsNot { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that PaymentMethodIsNot was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; @@ -980,6 +996,14 @@ public enum PaymentMethodIn { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that PaymentMethodIn was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; @@ -1124,6 +1148,14 @@ public enum PaymentMethodNotIn { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that PaymentMethodNotIn was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; @@ -2219,6 +2251,14 @@ public enum PaymentMethod { PROMPTPAY("promptpay"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that PaymentMethod was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; diff --git a/src/main/java/com/chargebee/v4/models/transaction/params/TransactionRecordRefundParams.java b/src/main/java/com/chargebee/v4/models/transaction/params/TransactionRecordRefundParams.java index 73d6690f..af075f0c 100644 --- a/src/main/java/com/chargebee/v4/models/transaction/params/TransactionRecordRefundParams.java +++ b/src/main/java/com/chargebee/v4/models/transaction/params/TransactionRecordRefundParams.java @@ -176,6 +176,14 @@ public enum PaymentMethod { CUSTOM("custom"), + DANA("dana"), + + TOUCH_N_GO("touch_n_go"), + + TAMARA("tamara"), + + QPAY("qpay"), + /** An enum member indicating that PaymentMethod was instantiated with an unknown value. */ _UNKNOWN(null); private final String value; diff --git a/src/main/java/com/chargebee/v4/services/CreditUnitService.java b/src/main/java/com/chargebee/v4/services/CreditUnitService.java new file mode 100644 index 00000000..43fd90dc --- /dev/null +++ b/src/main/java/com/chargebee/v4/services/CreditUnitService.java @@ -0,0 +1,248 @@ +/* + * This file is auto-generated by Chargebee. + * For more information on how to make changes to this file, please see the README. + * Reach out to dx@chargebee.com for any questions. + * Copyright 2025 Chargebee Inc. + */ + +package com.chargebee.v4.services; + +import com.chargebee.v4.client.ChargebeeClient; +import com.chargebee.v4.client.request.RequestOptions; +import com.chargebee.v4.exceptions.ChargebeeException; +import com.chargebee.v4.transport.Response; +import java.util.concurrent.CompletableFuture; + +import com.chargebee.v4.models.creditUnit.params.CreditUnitListParams; + +import com.chargebee.v4.models.creditUnit.params.CreditUnitCreateParams; + +import com.chargebee.v4.models.creditUnit.params.CreditUnitUpdateParams; + +import com.chargebee.v4.models.creditUnit.responses.CreditUnitListResponse; + +import com.chargebee.v4.models.creditUnit.responses.CreditUnitCreateResponse; + +import com.chargebee.v4.models.creditUnit.responses.CreditUnitArchiveResponse; + +import com.chargebee.v4.models.creditUnit.responses.CreditUnitUpdateResponse; + +import com.chargebee.v4.models.creditUnit.responses.CreditUnitReactivateResponse; + +public final class CreditUnitService extends BaseService { + + private final ServiceConfig config; + + public CreditUnitService(ChargebeeClient client) { + super(client); + this.config = ServiceConfig.defaultConfig(); + } + + private CreditUnitService(ChargebeeClient client, RequestOptions options) { + super(client, options); + this.config = ServiceConfig.defaultConfig(); + } + + private CreditUnitService(ChargebeeClient client, RequestOptions options, ServiceConfig config) { + super(client, options); + this.config = config; + } + + @Override + CreditUnitService with(RequestOptions newOptions) { + return new CreditUnitService(client, newOptions, config); + } + + /** + * Apply per-request options for this service instance. Users can chain .withOptions or .options + * to set headers and other options. + */ + public CreditUnitService withOptions(RequestOptions options) { + return with(options); + } + + // === Operations === + + /** list a creditUnit using immutable params (executes immediately) - returns raw Response. */ + Response listRaw(CreditUnitListParams params) throws ChargebeeException { + + return get( + "creditUnit", "list", "/credit_units", params != null ? params.toQueryParams() : null); + } + + /** list a creditUnit without params (executes immediately) - returns raw Response. */ + Response listRaw() throws ChargebeeException { + + return get("creditUnit", "list", "/credit_units", null); + } + + /** list a creditUnit using raw JSON payload (executes immediately) - returns raw Response. */ + Response listRaw(String jsonPayload) throws ChargebeeException { + + throw new UnsupportedOperationException("JSON payload not supported for GET operations"); + } + + public CreditUnitListResponse list(CreditUnitListParams params) throws ChargebeeException { + Response response = listRaw(params); + + return CreditUnitListResponse.fromJson(response.getBodyAsString(), this, params, response); + } + + /** Async variant of list for creditUnit with params. */ + public CompletableFuture listAsync(CreditUnitListParams params) { + + return getAsync( + "creditUnit", "list", "/credit_units", params != null ? params.toQueryParams() : null) + .thenApply( + response -> + CreditUnitListResponse.fromJson( + response.getBodyAsString(), this, params, response)); + } + + public CreditUnitListResponse list() throws ChargebeeException { + Response response = listRaw(); + + return CreditUnitListResponse.fromJson(response.getBodyAsString(), this, null, response); + } + + /** Async variant of list for creditUnit without params. */ + public CompletableFuture listAsync() { + + return getAsync("creditUnit", "list", "/credit_units", null) + .thenApply( + response -> + CreditUnitListResponse.fromJson(response.getBodyAsString(), this, null, response)); + } + + /** create a creditUnit using immutable params (executes immediately) - returns raw Response. */ + Response createRaw(CreditUnitCreateParams params) throws ChargebeeException { + + return post( + "creditUnit", "create", "/credit_units", params != null ? params.toFormData() : null); + } + + /** create a creditUnit using raw JSON payload (executes immediately) - returns raw Response. */ + Response createRaw(String jsonPayload) throws ChargebeeException { + + return postJson("creditUnit", "create", "/credit_units", jsonPayload); + } + + public CreditUnitCreateResponse create(CreditUnitCreateParams params) throws ChargebeeException { + Response response = createRaw(params); + + return CreditUnitCreateResponse.fromJson(response.getBodyAsString(), response); + } + + /** Async variant of create for creditUnit with params. */ + public CompletableFuture createAsync(CreditUnitCreateParams params) { + + return postAsync( + "creditUnit", "create", "/credit_units", params != null ? params.toFormData() : null) + .thenApply( + response -> CreditUnitCreateResponse.fromJson(response.getBodyAsString(), response)); + } + + /** archive a creditUnit (executes immediately) - returns raw Response. */ + Response archiveRaw(String creditUnitId) throws ChargebeeException { + String path = + buildPathWithParams( + "/credit_units/{credit-unit-id}/archive_command", "credit-unit-id", creditUnitId); + + return post("creditUnit", "archive", path, null); + } + + public CreditUnitArchiveResponse archive(String creditUnitId) throws ChargebeeException { + Response response = archiveRaw(creditUnitId); + return CreditUnitArchiveResponse.fromJson(response.getBodyAsString(), response); + } + + /** Async variant of archive for creditUnit without params. */ + public CompletableFuture archiveAsync(String creditUnitId) { + String path = + buildPathWithParams( + "/credit_units/{credit-unit-id}/archive_command", "credit-unit-id", creditUnitId); + + return postAsync("creditUnit", "archive", path, null) + .thenApply( + response -> CreditUnitArchiveResponse.fromJson(response.getBodyAsString(), response)); + } + + /** update a creditUnit (executes immediately) - returns raw Response. */ + Response updateRaw(String creditUnitId) throws ChargebeeException { + String path = + buildPathWithParams("/credit_units/{credit-unit-id}", "credit-unit-id", creditUnitId); + + return post("creditUnit", "update", path, null); + } + + /** update a creditUnit using immutable params (executes immediately) - returns raw Response. */ + Response updateRaw(String creditUnitId, CreditUnitUpdateParams params) throws ChargebeeException { + String path = + buildPathWithParams("/credit_units/{credit-unit-id}", "credit-unit-id", creditUnitId); + return post("creditUnit", "update", path, params.toFormData()); + } + + /** update a creditUnit using raw JSON payload (executes immediately) - returns raw Response. */ + Response updateRaw(String creditUnitId, String jsonPayload) throws ChargebeeException { + String path = + buildPathWithParams("/credit_units/{credit-unit-id}", "credit-unit-id", creditUnitId); + return postJson("creditUnit", "update", path, jsonPayload); + } + + public CreditUnitUpdateResponse update(String creditUnitId, CreditUnitUpdateParams params) + throws ChargebeeException { + Response response = updateRaw(creditUnitId, params); + return CreditUnitUpdateResponse.fromJson(response.getBodyAsString(), response); + } + + /** Async variant of update for creditUnit with params. */ + public CompletableFuture updateAsync( + String creditUnitId, CreditUnitUpdateParams params) { + String path = + buildPathWithParams("/credit_units/{credit-unit-id}", "credit-unit-id", creditUnitId); + return postAsync("creditUnit", "update", path, params.toFormData()) + .thenApply( + response -> CreditUnitUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + + public CreditUnitUpdateResponse update(String creditUnitId) throws ChargebeeException { + Response response = updateRaw(creditUnitId); + return CreditUnitUpdateResponse.fromJson(response.getBodyAsString(), response); + } + + /** Async variant of update for creditUnit without params. */ + public CompletableFuture updateAsync(String creditUnitId) { + String path = + buildPathWithParams("/credit_units/{credit-unit-id}", "credit-unit-id", creditUnitId); + + return postAsync("creditUnit", "update", path, null) + .thenApply( + response -> CreditUnitUpdateResponse.fromJson(response.getBodyAsString(), response)); + } + + /** reactivate a creditUnit (executes immediately) - returns raw Response. */ + Response reactivateRaw(String creditUnitId) throws ChargebeeException { + String path = + buildPathWithParams( + "/credit_units/{credit-unit-id}/reactivate_command", "credit-unit-id", creditUnitId); + + return post("creditUnit", "reactivate", path, null); + } + + public CreditUnitReactivateResponse reactivate(String creditUnitId) throws ChargebeeException { + Response response = reactivateRaw(creditUnitId); + return CreditUnitReactivateResponse.fromJson(response.getBodyAsString(), response); + } + + /** Async variant of reactivate for creditUnit without params. */ + public CompletableFuture reactivateAsync(String creditUnitId) { + String path = + buildPathWithParams( + "/credit_units/{credit-unit-id}/reactivate_command", "credit-unit-id", creditUnitId); + + return postAsync("creditUnit", "reactivate", path, null) + .thenApply( + response -> + CreditUnitReactivateResponse.fromJson(response.getBodyAsString(), response)); + } +} diff --git a/src/main/java/com/chargebee/v4/services/LedgerOperationService.java b/src/main/java/com/chargebee/v4/services/LedgerOperationService.java index 9ab63bbb..5a0ec9cf 100644 --- a/src/main/java/com/chargebee/v4/services/LedgerOperationService.java +++ b/src/main/java/com/chargebee/v4/services/LedgerOperationService.java @@ -17,6 +17,8 @@ import com.chargebee.v4.models.ledgerOperation.params.LedgerOperationCaptureParams; +import com.chargebee.v4.models.ledgerOperation.params.LedgerOperationAllocateParams; + import com.chargebee.v4.models.ledgerOperation.params.LedgerOperationAuthorizeParams; import com.chargebee.v4.models.ledgerOperation.params.ListLedgerOperationsParams; @@ -27,6 +29,8 @@ import com.chargebee.v4.models.ledgerOperation.responses.LedgerOperationCaptureResponse; +import com.chargebee.v4.models.ledgerOperation.responses.LedgerOperationAllocateResponse; + import com.chargebee.v4.models.ledgerOperation.responses.LedgerOperationAuthorizeResponse; import com.chargebee.v4.models.ledgerOperation.responses.ListLedgerOperationsResponse; @@ -161,6 +165,49 @@ public CompletableFuture captureAsync( LedgerOperationCaptureResponse.fromJson(response.getBodyAsString(), response)); } + /** + * allocate a ledgerOperation using immutable params (executes immediately) - returns raw + * Response. + */ + Response allocateRaw(LedgerOperationAllocateParams params) throws ChargebeeException { + + return postJson( + "ledgerOperation", + "allocate", + "/ledger_operations/allocate", + params != null ? params.toJsonString() : null); + } + + /** + * allocate a ledgerOperation using raw JSON payload (executes immediately) - returns raw + * Response. + */ + Response allocateRaw(String jsonPayload) throws ChargebeeException { + + return postJson("ledgerOperation", "allocate", "/ledger_operations/allocate", jsonPayload); + } + + public LedgerOperationAllocateResponse allocate(LedgerOperationAllocateParams params) + throws ChargebeeException { + Response response = allocateRaw(params); + + return LedgerOperationAllocateResponse.fromJson(response.getBodyAsString(), response); + } + + /** Async variant of allocate for ledgerOperation with params. */ + public CompletableFuture allocateAsync( + LedgerOperationAllocateParams params) { + + return postJsonAsync( + "ledgerOperation", + "allocate", + "/ledger_operations/allocate", + params != null ? params.toJsonString() : null) + .thenApply( + response -> + LedgerOperationAllocateResponse.fromJson(response.getBodyAsString(), response)); + } + /** * authorize a ledgerOperation using immutable params (executes immediately) - returns raw * Response.