diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b9d5185..46a500d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,61 @@ +### v3.52.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). + + + ### v3.51.0 (2026-07-21) * * * ### New Resources: diff --git a/VERSION b/VERSION index 84ba969c..7ac0b0a6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.51.0 +3.52.0 diff --git a/pom.xml b/pom.xml index 8991a737..a6f56a9a 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.chargebee chargebee-java - 3.51.0 + 3.52.0 jar diff --git a/src/main/java/com/chargebee/Environment.java b/src/main/java/com/chargebee/Environment.java index 7bb9977e..71c56c4e 100644 --- a/src/main/java/com/chargebee/Environment.java +++ b/src/main/java/com/chargebee/Environment.java @@ -38,7 +38,7 @@ public class Environment { public static final String API_VERSION = "v2"; - public static final String LIBRARY_VERSION = "3.51.0"; + public static final String LIBRARY_VERSION = "3.52.0"; private final String apiBaseUrl; diff --git a/src/main/java/com/chargebee/internal/ResultBase.java b/src/main/java/com/chargebee/internal/ResultBase.java index 29ffe93b..390b511e 100644 --- a/src/main/java/com/chargebee/internal/ResultBase.java +++ b/src/main/java/com/chargebee/internal/ResultBase.java @@ -280,6 +280,10 @@ public Metadata metadata() { return (Metadata)get("metadata"); } + public CreditUnit creditUnit() { + return (CreditUnit)get("credit_unit"); + } + public SubscriptionEntitlement subscriptionEntitlement() { return (SubscriptionEntitlement)get("subscription_entitlement"); } @@ -432,6 +436,10 @@ public GrantBlock grantBlock() { return (GrantBlock)get("grant_block"); } + public LedgerEntry ledgerEntry() { + return (LedgerEntry)get("ledger_entry"); + } + public PromotionalGrant promotionalGrant() { return (PromotionalGrant)get("promotional_grant"); } @@ -496,6 +504,10 @@ public List grantBlocks() { return (List) getList("grant_blocks", "grant_block"); } + public List ledgerEntries() { + return (List) getList("ledger_entries", "ledger_entry"); + } + private List getList(String pluralName, String singularName) { JSONArray listModels = jsonObj.optJSONArray(pluralName); diff --git a/src/main/java/com/chargebee/models/Alert.java b/src/main/java/com/chargebee/models/Alert.java index f9cf3335..33d49f1a 100644 --- a/src/main/java/com/chargebee/models/Alert.java +++ b/src/main/java/com/chargebee/models/Alert.java @@ -104,6 +104,10 @@ public String currencyCode() { return optString("currency_code"); } + public String unitId() { + return optString("unit_id"); + } + public String subscriptionId() { return optString("subscription_id"); } @@ -124,8 +128,8 @@ public Timestamp updatedAt() { return reqTimestamp("updated_at"); } - public List threshold() { - return optList("threshold", Alert.Threshold.class); + public Alert.Threshold threshold() { + return optSubResource("threshold", Alert.Threshold.class); } public List filterConditions() { @@ -205,6 +209,12 @@ public CreateRequest currencyCode(String currencyCode) { } + public CreateRequest unitId(String unitId) { + params.addOpt("unit_id", unitId); + return this; + } + + public CreateRequest subscriptionId(String subscriptionId) { params.addOpt("subscription_id", subscriptionId); return this; diff --git a/src/main/java/com/chargebee/models/AttachedItem.java b/src/main/java/com/chargebee/models/AttachedItem.java index 812348b9..41643aa0 100644 --- a/src/main/java/com/chargebee/models/AttachedItem.java +++ b/src/main/java/com/chargebee/models/AttachedItem.java @@ -76,11 +76,11 @@ public Integer billingCycles() { } public ChargeOnEvent chargeOnEvent() { - return reqEnum("charge_on_event", ChargeOnEvent.class); + return optEnum("charge_on_event", ChargeOnEvent.class); } public Boolean chargeOnce() { - return reqBoolean("charge_once"); + return optBoolean("charge_once"); } public Timestamp createdAt() { diff --git a/src/main/java/com/chargebee/models/CreditUnit.java b/src/main/java/com/chargebee/models/CreditUnit.java new file mode 100644 index 00000000..040c534f --- /dev/null +++ b/src/main/java/com/chargebee/models/CreditUnit.java @@ -0,0 +1,201 @@ +package com.chargebee.models; + +import com.chargebee.*; +import com.chargebee.internal.*; +import com.chargebee.filters.*; +import com.chargebee.filters.enums.SortOrder; +import com.chargebee.internal.HttpUtil.Method; +import com.chargebee.models.enums.*; +import org.json.*; +import java.io.*; +import java.sql.Timestamp; +import java.util.*; + +public class CreditUnit extends Resource { + + public enum Status { + ACTIVE, + ARCHIVED, + _UNKNOWN; /*Indicates unexpected value for this enum. You can get this when there is a + java-client version incompatibility. We suggest you to upgrade to the latest version */ + } + + //Constructors + //============ + + public CreditUnit(String jsonStr) { + super(jsonStr); + } + + public CreditUnit(JSONObject jsonObj) { + super(jsonObj); + } + + // Fields + //======= + + public String id() { + return reqString("id"); + } + + public String name() { + return reqString("name"); + } + + public String externalName() { + return reqString("external_name"); + } + + public Status status() { + return optEnum("status", Status.class); + } + + public Long resourceVersion() { + return optLong("resource_version"); + } + + public Timestamp updatedAt() { + return optTimestamp("updated_at"); + } + + public Timestamp createdAt() { + return reqTimestamp("created_at"); + } + + public String createdBy() { + return optString("created_by"); + } + + public String updatedBy() { + return optString("updated_by"); + } + + public Boolean isUnlimited() { + return reqBoolean("is_unlimited"); + } + + public String overdraftAmount() { + return optString("overdraft_amount"); + } + + // Operations + //=========== + + public static CreditUnitListRequest list() { + String uri = uri("credit_units"); + return new CreditUnitListRequest(uri); + } + + public static CreateRequest create() { + String uri = uri("credit_units"); + return new CreateRequest(Method.POST, uri); + } + + public static UpdateRequest update(String id) { + String uri = uri("credit_units", nullCheck(id)); + return new UpdateRequest(Method.POST, uri); + } + + public static Request archive(String id) { + String uri = uri("credit_units", nullCheck(id), "archive_command"); + return new Request(Method.POST, uri); + } + + public static Request reactivate(String id) { + String uri = uri("credit_units", nullCheck(id), "reactivate_command"); + return new Request(Method.POST, uri); + } + + + // Operation Request Classes + //========================== + + public static class CreditUnitListRequest extends ListRequest { + + private CreditUnitListRequest(String uri) { + super(uri); + } + + public EnumFilter status() { + return new EnumFilter("status",this); + } + + + public StringFilter id() { + return new StringFilter("id",this).supportsMultiOperators(true); + } + + + @Override + public Params params() { + return params; + } + } + + public static class CreateRequest extends Request { + + private CreateRequest(Method httpMeth, String uri) { + super(httpMeth, uri); + } + + public CreateRequest id(String id) { + params.add("id", id); + return this; + } + + + public CreateRequest name(String name) { + params.add("name", name); + return this; + } + + + public CreateRequest isUnlimited(Boolean isUnlimited) { + params.add("is_unlimited", isUnlimited); + return this; + } + + + public CreateRequest overdraftAmount(String overdraftAmount) { + params.addOpt("overdraft_amount", overdraftAmount); + return this; + } + + + public CreateRequest externalName(String externalName) { + params.addOpt("external_name", externalName); + return this; + } + + + @Override + public Params params() { + return params; + } + } + + public static class UpdateRequest extends Request { + + private UpdateRequest(Method httpMeth, String uri) { + super(httpMeth, uri); + } + + public UpdateRequest name(String name) { + params.addOpt("name", name); + return this; + } + + + public UpdateRequest externalName(String externalName) { + params.addOpt("external_name", externalName); + return this; + } + + + @Override + public Params params() { + return params; + } + } + +} diff --git a/src/main/java/com/chargebee/models/Customer.java b/src/main/java/com/chargebee/models/Customer.java index eb33e290..cc0a86bd 100644 --- a/src/main/java/com/chargebee/models/Customer.java +++ b/src/main/java/com/chargebee/models/Customer.java @@ -209,7 +209,7 @@ public Boolean sendBillingEmail() { public static class PaymentMethod extends Resource { public enum Type { - CARD,PAYPAL_EXPRESS_CHECKOUT,AMAZON_PAYMENTS,DIRECT_DEBIT,GENERIC,ALIPAY,UNIONPAY,APPLE_PAY,WECHAT_PAY,IDEAL,GOOGLE_PAY,SOFORT,BANCONTACT,GIROPAY,DOTPAY,UPI,NETBANKING_EMANDATES,VENMO,PAY_TO,FASTER_PAYMENTS,SEPA_INSTANT_TRANSFER,AUTOMATED_BANK_TRANSFER,KLARNA_PAY_NOW,ONLINE_BANKING_POLAND,PAYCONIQ_BY_BANCONTACT,ELECTRONIC_PAYMENT_STANDARD,KBC_PAYMENT_BUTTON,PAY_BY_BANK,TRUSTLY,STABLECOIN,KAKAO_PAY,NAVER_PAY,REVOLUT_PAY,CASH_APP_PAY,TWINT,GO_PAY,GRAB_PAY,PAY_CO,AFTER_PAY,SWISH,PAYME,PIX,KLARNA,ALIPAY_HK,PAYPAY,GCASH,SOUTH_KOREAN_CARDS,PAYNOW,BIZUM,PROMPTPAY, + CARD,PAYPAL_EXPRESS_CHECKOUT,AMAZON_PAYMENTS,DIRECT_DEBIT,GENERIC,ALIPAY,UNIONPAY,APPLE_PAY,WECHAT_PAY,IDEAL,GOOGLE_PAY,SOFORT,BANCONTACT,GIROPAY,DOTPAY,UPI,NETBANKING_EMANDATES,VENMO,PAY_TO,FASTER_PAYMENTS,SEPA_INSTANT_TRANSFER,AUTOMATED_BANK_TRANSFER,KLARNA_PAY_NOW,ONLINE_BANKING_POLAND,PAYCONIQ_BY_BANCONTACT,ELECTRONIC_PAYMENT_STANDARD,KBC_PAYMENT_BUTTON,PAY_BY_BANK,TRUSTLY,STABLECOIN,KAKAO_PAY,NAVER_PAY,REVOLUT_PAY,CASH_APP_PAY,TWINT,GO_PAY,GRAB_PAY,PAY_CO,AFTER_PAY,SWISH,PAYME,PIX,KLARNA,ALIPAY_HK,PAYPAY,GCASH,SOUTH_KOREAN_CARDS,PAYNOW,BIZUM,PROMPTPAY,DANA,TOUCH_N_GO,TAMARA,QPAY, _UNKNOWN; /*Indicates unexpected value for this enum. You can get this when there is a java-client version incompatibility. We suggest you to upgrade to the latest version */ } diff --git a/src/main/java/com/chargebee/models/Estimate.java b/src/main/java/com/chargebee/models/Estimate.java index 0983d63d..e5bd2045 100644 --- a/src/main/java/com/chargebee/models/Estimate.java +++ b/src/main/java/com/chargebee/models/Estimate.java @@ -2637,6 +2637,12 @@ public CancelSubscriptionForItemsRequest invoiceDate(Timestamp invoiceDate) { } + public CancelSubscriptionForItemsRequest includeCancellationDayInBilling(Boolean includeCancellationDayInBilling) { + params.addOpt("include_cancellation_day_in_billing", includeCancellationDayInBilling); + return this; + } + + public CancelSubscriptionForItemsRequest cancelReasonCode(String cancelReasonCode) { params.addOpt("cancel_reason_code", cancelReasonCode); return this; diff --git a/src/main/java/com/chargebee/models/GrantBlock.java b/src/main/java/com/chargebee/models/GrantBlock.java index 24d59c49..38f789f2 100644 --- a/src/main/java/com/chargebee/models/GrantBlock.java +++ b/src/main/java/com/chargebee/models/GrantBlock.java @@ -13,16 +13,6 @@ public class GrantBlock extends Resource { - public enum GrantSource { - SUBSCRIPTION_CREATED, - SUBSCRIPTION_CHANGED, - TOP_UP, - PROMOTIONAL_GRANTS, - ROLLOVER, - _UNKNOWN; /*Indicates unexpected value for this enum. You can get this when there is a - java-client version incompatibility. We suggest you to upgrade to the latest version */ - } - public enum AccountType { PROVISIONED, OVERDRAFT, @@ -36,6 +26,18 @@ public enum UnitType { java-client version incompatibility. We suggest you to upgrade to the latest version */ } + public enum GrantSource { + SUBSCRIPTION_CREATED, + SUBSCRIPTION_CHANGED, + TOP_UP, + PROMOTIONAL_GRANTS, + ROLLOVER, + GRANT_RENEWAL, + SUBSCRIPTION_RENEWED, + _UNKNOWN; /*Indicates unexpected value for this enum. You can get this when there is a + java-client version incompatibility. We suggest you to upgrade to the latest version */ + } + //Constructors //============ @@ -54,6 +56,22 @@ public String id() { return reqString("id"); } + public String subscriptionId() { + return optString("subscription_id"); + } + + public AccountType accountType() { + return optEnum("account_type", AccountType.class); + } + + public String unitId() { + return optString("unit_id"); + } + + public UnitType unitType() { + return optEnum("unit_type", UnitType.class); + } + public String grantedAmount() { return reqString("granted_amount"); } @@ -103,19 +121,15 @@ public GrantSource grantSource() { } public Timestamp createdAt() { - return optTimestamp("created_at"); + return reqTimestamp("created_at"); } - public AccountType accountType() { - return optEnum("account_type", AccountType.class); + public Timestamp modifiedAt() { + return reqTimestamp("modified_at"); } - public String unitId() { - return optString("unit_id"); - } - - public UnitType unitType() { - return optEnum("unit_type", UnitType.class); + public Long resourceVersion() { + return optLong("resource_version"); } public JSONObject metadata() { @@ -150,6 +164,11 @@ public StringFilter unitId() { } + public EnumFilter accountType() { + return new EnumFilter("account_type",this); + } + + public TimestampFilter effectiveFrom() { return new TimestampFilter("effective_from",this); } diff --git a/src/main/java/com/chargebee/models/LedgerAccountBalance.java b/src/main/java/com/chargebee/models/LedgerAccountBalance.java index f282f87d..a3fb9d1e 100644 --- a/src/main/java/com/chargebee/models/LedgerAccountBalance.java +++ b/src/main/java/com/chargebee/models/LedgerAccountBalance.java @@ -95,8 +95,16 @@ public UnitType unitType() { return reqEnum("unit_type", UnitType.class); } + public Timestamp createdAt() { + return reqTimestamp("created_at"); + } + public Timestamp modifiedAt() { - return optTimestamp("modified_at"); + return reqTimestamp("modified_at"); + } + + public Long resourceVersion() { + return optLong("resource_version"); } public LedgerAccountBalance.ProvisionedBalance provisionedBalance() { diff --git a/src/main/java/com/chargebee/models/LedgerEntry.java b/src/main/java/com/chargebee/models/LedgerEntry.java new file mode 100644 index 00000000..804a5676 --- /dev/null +++ b/src/main/java/com/chargebee/models/LedgerEntry.java @@ -0,0 +1,107 @@ +package com.chargebee.models; + +import com.chargebee.*; +import com.chargebee.internal.*; +import com.chargebee.filters.*; +import com.chargebee.filters.enums.SortOrder; +import com.chargebee.internal.HttpUtil.Method; +import com.chargebee.models.enums.*; +import org.json.*; +import java.io.*; +import java.sql.Timestamp; +import java.util.*; + +public class LedgerEntry extends Resource { + + public enum AccountType { + PROVISIONED, + OVERDRAFT, + _UNKNOWN; /*Indicates unexpected value for this enum. You can get this when there is a + java-client version incompatibility. We suggest you to upgrade to the latest version */ + } + + public enum UnitType { + CREDIT_UNIT, + _UNKNOWN; /*Indicates unexpected value for this enum. You can get this when there is a + java-client version incompatibility. We suggest you to upgrade to the latest version */ + } + + //Constructors + //============ + + public LedgerEntry(String jsonStr) { + super(jsonStr); + } + + public LedgerEntry(JSONObject jsonObj) { + super(jsonObj); + } + + // Fields + //======= + + public String id() { + return reqString("id"); + } + + public String subscriptionId() { + return optString("subscription_id"); + } + + public AccountType accountType() { + return optEnum("account_type", AccountType.class); + } + + public String unitId() { + return optString("unit_id"); + } + + public UnitType unitType() { + return optEnum("unit_type", UnitType.class); + } + + public String amount() { + return reqString("amount"); + } + + public String grantBlockStartBalance() { + return reqString("grant_block_start_balance"); + } + + public String grantBlockEndBalance() { + return reqString("grant_block_end_balance"); + } + + public String accountStartBalance() { + return reqString("account_start_balance"); + } + + public String accountEndBalance() { + return reqString("account_end_balance"); + } + + public Type type() { + return reqEnum("type", Type.class); + } + + public String ledgerOperationId() { + return reqString("ledger_operation_id"); + } + + public String grantBlockId() { + return reqString("grant_block_id"); + } + + public Timestamp createdAt() { + return reqTimestamp("created_at"); + } + + public Timestamp modifiedAt() { + return reqTimestamp("modified_at"); + } + + // Operations + //=========== + + +} diff --git a/src/main/java/com/chargebee/models/LedgerOperation.java b/src/main/java/com/chargebee/models/LedgerOperation.java index f993959e..0e247e78 100644 --- a/src/main/java/com/chargebee/models/LedgerOperation.java +++ b/src/main/java/com/chargebee/models/LedgerOperation.java @@ -13,6 +13,12 @@ public class LedgerOperation extends Resource { + public enum UnitType { + CREDIT_UNIT, + _UNKNOWN; /*Indicates unexpected value for this enum. You can get this when there is a + java-client version incompatibility. We suggest you to upgrade to the latest version */ + } + public enum Type { ALLOCATION, CAPTURE, @@ -27,12 +33,6 @@ public enum Type { java-client version incompatibility. We suggest you to upgrade to the latest version */ } - public enum UnitType { - CREDIT_UNIT, - _UNKNOWN; /*Indicates unexpected value for this enum. You can get this when there is a - java-client version incompatibility. We suggest you to upgrade to the latest version */ - } - //Constructors //============ @@ -51,6 +51,18 @@ public String id() { return reqString("id"); } + public String subscriptionId() { + return optString("subscription_id"); + } + + public String unitId() { + return optString("unit_id"); + } + + public UnitType unitType() { + return optEnum("unit_type", UnitType.class); + } + public Type type() { return reqEnum("type", Type.class); } @@ -80,7 +92,7 @@ public String parentLedgerOperationId() { } public Timestamp ledgerOperationTimestamp() { - return optTimestamp("ledger_operation_timestamp"); + return reqTimestamp("ledger_operation_timestamp"); } public Timestamp autoReleaseTimestamp() { @@ -88,23 +100,11 @@ public Timestamp autoReleaseTimestamp() { } public Timestamp createdAt() { - return optTimestamp("created_at"); + return reqTimestamp("created_at"); } public Timestamp modifiedAt() { - return optTimestamp("modified_at"); - } - - public String subscriptionId() { - return optString("subscription_id"); - } - - public String unitId() { - return optString("unit_id"); - } - - public UnitType unitType() { - return optEnum("unit_type", UnitType.class); + return reqTimestamp("modified_at"); } public Map metadata() { @@ -144,6 +144,11 @@ public static ReleaseAuthorizationRequest releaseAuthorization() { return new ReleaseAuthorizationRequest(Method.POST, uri).setIdempotency(false); } + public static AllocateRequest allocate() { + String uri = uri("ledger_operations", "allocate"); + return new AllocateRequest(Method.POST, uri).setIdempotency(false); + } + // Operation Request Classes //========================== @@ -364,6 +369,49 @@ public ReleaseAuthorizationRequest metadata(Map metadata) { + @Override + public Params params() { + return params; + } + } + + public static class AllocateRequest extends Request { + + private AllocateRequest(Method httpMeth, String uri) { + super(httpMeth, uri, null, null,true); + } + + public AllocateRequest subscriptionId(String subscriptionId) { + params.add("subscription_id", subscriptionId); + return this; + } + + + public AllocateRequest unitId(String unitId) { + params.add("unit_id", unitId); + return this; + } + + + public AllocateRequest amount(String amount) { + params.add("amount", amount); + return this; + } + + + public AllocateRequest expiresAt(Timestamp expiresAt) { + params.add("expires_at", expiresAt); + return this; + } + + + public AllocateRequest metadata(Map metadata) { + params.addOpt("metadata", metadata); + return this; + } + + + @Override public Params params() { return params; diff --git a/src/main/java/com/chargebee/models/PaymentIntent.java b/src/main/java/com/chargebee/models/PaymentIntent.java index a4a31d21..cbc2b392 100644 --- a/src/main/java/com/chargebee/models/PaymentIntent.java +++ b/src/main/java/com/chargebee/models/PaymentIntent.java @@ -72,6 +72,10 @@ public enum PaymentMethodType { PAYNOW, BIZUM, PROMPTPAY, + DANA, + TOUCH_N_GO, + TAMARA, + QPAY, _UNKNOWN; /*Indicates unexpected value for this enum. You can get this when there is a java-client version incompatibility. We suggest you to upgrade to the latest version */ } diff --git a/src/main/java/com/chargebee/models/Subscription.java b/src/main/java/com/chargebee/models/Subscription.java index 135595f1..c9a23f41 100644 --- a/src/main/java/com/chargebee/models/Subscription.java +++ b/src/main/java/com/chargebee/models/Subscription.java @@ -6936,6 +6936,12 @@ public CancelForItemsRequest invoiceDate(Timestamp invoiceDate) { } + public CancelForItemsRequest includeCancellationDayInBilling(Boolean includeCancellationDayInBilling) { + params.addOpt("include_cancellation_day_in_billing", includeCancellationDayInBilling); + return this; + } + + public CancelForItemsRequest cancelReasonCode(String cancelReasonCode) { params.addOpt("cancel_reason_code", cancelReasonCode); return this; diff --git a/src/main/java/com/chargebee/models/enums/EnabledEvents.java b/src/main/java/com/chargebee/models/enums/EnabledEvents.java index 3a275a26..f619e9ea 100644 --- a/src/main/java/com/chargebee/models/enums/EnabledEvents.java +++ b/src/main/java/com/chargebee/models/enums/EnabledEvents.java @@ -224,6 +224,10 @@ public enum EnabledEvents { ALERT_STATUS_CHANGED, OMNICHANNEL_SUBSCRIPTION_ITEM_UPDATED, OMNICHANNEL_SUBSCRIPTION_ITEM_RECOVERED, + LEDGER_ACCOUNT_BALANCE_UPDATED, + GRANT_BLOCKS_CREATED, + GRANT_BLOCKS_UPDATED, + LEDGER_UPDATED, PLAN_CREATED, PLAN_UPDATED, PLAN_DELETED, diff --git a/src/main/java/com/chargebee/models/enums/EventType.java b/src/main/java/com/chargebee/models/enums/EventType.java index fdc21312..909b6cc7 100644 --- a/src/main/java/com/chargebee/models/enums/EventType.java +++ b/src/main/java/com/chargebee/models/enums/EventType.java @@ -233,6 +233,10 @@ public enum EventType { ALERT_STATUS_CHANGED, OMNICHANNEL_SUBSCRIPTION_ITEM_UPDATED, OMNICHANNEL_SUBSCRIPTION_ITEM_RECOVERED, + LEDGER_ACCOUNT_BALANCE_UPDATED, + GRANT_BLOCKS_CREATED, + GRANT_BLOCKS_UPDATED, + LEDGER_UPDATED, PLAN_CREATED, PLAN_UPDATED, PLAN_DELETED, diff --git a/src/main/java/com/chargebee/models/enums/PaymentMethod.java b/src/main/java/com/chargebee/models/enums/PaymentMethod.java index cea78ce1..25d23785 100644 --- a/src/main/java/com/chargebee/models/enums/PaymentMethod.java +++ b/src/main/java/com/chargebee/models/enums/PaymentMethod.java @@ -6,6 +6,10 @@ public enum PaymentMethod { BANK_TRANSFER, OTHER, CUSTOM, + DANA, + TOUCH_N_GO, + TAMARA, + QPAY, CHARGEBACK, CARD, AMAZON_PAYMENTS, diff --git a/src/main/java/com/chargebee/models/enums/PaymentMethodType.java b/src/main/java/com/chargebee/models/enums/PaymentMethodType.java index 81e79a97..3627d31e 100644 --- a/src/main/java/com/chargebee/models/enums/PaymentMethodType.java +++ b/src/main/java/com/chargebee/models/enums/PaymentMethodType.java @@ -51,6 +51,10 @@ public enum PaymentMethodType { PAYNOW, BIZUM, PROMPTPAY, + DANA, + TOUCH_N_GO, + TAMARA, + QPAY, _UNKNOWN; /*Indicates unexpected value for this enum. You can get this when there is a java-client version incompatibility. We suggest you to upgrade to the latest version */ } \ No newline at end of file diff --git a/src/main/java/com/chargebee/models/enums/Type.java b/src/main/java/com/chargebee/models/enums/Type.java index 033e4ecd..af0bf8ed 100644 --- a/src/main/java/com/chargebee/models/enums/Type.java +++ b/src/main/java/com/chargebee/models/enums/Type.java @@ -51,6 +51,10 @@ public enum Type { PAYNOW, BIZUM, PROMPTPAY, + DANA, + TOUCH_N_GO, + TAMARA, + QPAY, FREE_TRIAL, PAY_UP_FRONT, PAY_AS_YOU_GO, @@ -58,6 +62,11 @@ public enum Type { COMPOUND, USAGE_EXCEEDED, SPEND_EXCEEDED, + CREDIT_BALANCE_DROPPED, + CREDIT, + DEBIT, + HOLD, + UNHOLD, _UNKNOWN; /*Indicates unexpected value for this enum. You can get this when there is a java-client version incompatibility. We suggest you to upgrade to the latest version */ } \ No newline at end of file