diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 85c79bb04..bfd4e4464 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.408.0"
+ ".": "0.409.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 91752aeff..df82cbc8f 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 232
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-3309070d0c282e00842afa3021c80774f8e1f3a4517959927adfd9ffaa81c94c.yml
-openapi_spec_hash: 57927271c019ee8ddd428afa8a57baaf
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-994727afca8b769c05b3531b0e560cfc71b7d2c45a49b54e09bbf73d0dbcaa1f.yml
+openapi_spec_hash: bb1c55d7e08fb038a7383976bba226d1
config_hash: 27e44ed36b9c5617b580ead7231a594a
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e4fa52c41..a96b0112a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
# Changelog
+## 0.409.0 (2026-01-30)
+
+Full Changelog: [v0.408.0...v0.409.0](https://github.com/Increase/increase-java/compare/v0.408.0...v0.409.0)
+
+### Features
+
+* **api:** api update ([633a11f](https://github.com/Increase/increase-java/commit/633a11f61f35bcbea16924486453cea8edb831ec))
+
## 0.408.0 (2026-01-30)
Full Changelog: [v0.407.0...v0.408.0](https://github.com/Increase/increase-java/compare/v0.407.0...v0.408.0)
diff --git a/README.md b/README.md
index c8e357112..b3f99daca 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.408.0)
-[](https://javadoc.io/doc/com.increase.api/increase-java/0.408.0)
+[](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.409.0)
+[](https://javadoc.io/doc/com.increase.api/increase-java/0.409.0)
@@ -13,7 +13,7 @@ The Increase Java SDK is similar to the Increase Kotlin SDK but with minor diffe
-The REST API documentation can be found on [increase.com](https://increase.com/documentation). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.increase.api/increase-java/0.408.0).
+The REST API documentation can be found on [increase.com](https://increase.com/documentation). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.increase.api/increase-java/0.409.0).
@@ -24,7 +24,7 @@ The REST API documentation can be found on [increase.com](https://increase.com/d
### Gradle
```kotlin
-implementation("com.increase.api:increase-java:0.408.0")
+implementation("com.increase.api:increase-java:0.409.0")
```
### Maven
@@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.408.0")
com.increase.api
increase-java
- 0.408.0
+ 0.409.0
```
diff --git a/build.gradle.kts b/build.gradle.kts
index 9d3812209..a3bc6c537 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.increase.api"
- version = "0.408.0" // x-release-please-version
+ version = "0.409.0" // x-release-please-version
}
subprojects {
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/accounts/Account.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/accounts/Account.kt
index f217c1e07..9b2de97fe 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/models/accounts/Account.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/accounts/Account.kt
@@ -34,11 +34,13 @@ private constructor(
private val createdAt: JsonField,
private val currency: JsonField,
private val entityId: JsonField,
+ private val funding: JsonField,
private val idempotencyKey: JsonField,
private val informationalEntityId: JsonField,
private val interestAccrued: JsonField,
private val interestAccruedAt: JsonField,
private val interestRate: JsonField,
+ private val loan: JsonField,
private val name: JsonField,
private val programId: JsonField,
private val status: JsonField,
@@ -61,6 +63,7 @@ private constructor(
createdAt: JsonField = JsonMissing.of(),
@JsonProperty("currency") @ExcludeMissing currency: JsonField = JsonMissing.of(),
@JsonProperty("entity_id") @ExcludeMissing entityId: JsonField = JsonMissing.of(),
+ @JsonProperty("funding") @ExcludeMissing funding: JsonField = JsonMissing.of(),
@JsonProperty("idempotency_key")
@ExcludeMissing
idempotencyKey: JsonField = JsonMissing.of(),
@@ -76,6 +79,7 @@ private constructor(
@JsonProperty("interest_rate")
@ExcludeMissing
interestRate: JsonField = JsonMissing.of(),
+ @JsonProperty("loan") @ExcludeMissing loan: JsonField = JsonMissing.of(),
@JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(),
@JsonProperty("program_id") @ExcludeMissing programId: JsonField = JsonMissing.of(),
@JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(),
@@ -88,11 +92,13 @@ private constructor(
createdAt,
currency,
entityId,
+ funding,
idempotencyKey,
informationalEntityId,
interestAccrued,
interestAccruedAt,
interestRate,
+ loan,
name,
programId,
status,
@@ -159,6 +165,14 @@ private constructor(
*/
fun entityId(): String = entityId.getRequired("entity_id")
+ /**
+ * Whether the Account is funded by a loan or by deposits.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun funding(): Optional = funding.getOptional("funding")
+
/**
* The idempotency key you chose for this object. This value is unique across Increase and is
* used to ensure that a request is only processed once. Learn more about
@@ -207,6 +221,14 @@ private constructor(
*/
fun interestRate(): String = interestRate.getRequired("interest_rate")
+ /**
+ * The Account's loan-related information, if the Account is a loan account.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun loan(): Optional = loan.getOptional("loan")
+
/**
* The name you choose for the Account.
*
@@ -294,6 +316,13 @@ private constructor(
*/
@JsonProperty("entity_id") @ExcludeMissing fun _entityId(): JsonField = entityId
+ /**
+ * Returns the raw JSON value of [funding].
+ *
+ * Unlike [funding], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("funding") @ExcludeMissing fun _funding(): JsonField = funding
+
/**
* Returns the raw JSON value of [idempotencyKey].
*
@@ -341,6 +370,13 @@ private constructor(
@ExcludeMissing
fun _interestRate(): JsonField = interestRate
+ /**
+ * Returns the raw JSON value of [loan].
+ *
+ * Unlike [loan], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("loan") @ExcludeMissing fun _loan(): JsonField = loan
+
/**
* Returns the raw JSON value of [name].
*
@@ -395,11 +431,13 @@ private constructor(
* .createdAt()
* .currency()
* .entityId()
+ * .funding()
* .idempotencyKey()
* .informationalEntityId()
* .interestAccrued()
* .interestAccruedAt()
* .interestRate()
+ * .loan()
* .name()
* .programId()
* .status()
@@ -419,11 +457,13 @@ private constructor(
private var createdAt: JsonField? = null
private var currency: JsonField? = null
private var entityId: JsonField? = null
+ private var funding: JsonField? = null
private var idempotencyKey: JsonField? = null
private var informationalEntityId: JsonField? = null
private var interestAccrued: JsonField? = null
private var interestAccruedAt: JsonField? = null
private var interestRate: JsonField? = null
+ private var loan: JsonField? = null
private var name: JsonField? = null
private var programId: JsonField? = null
private var status: JsonField? = null
@@ -439,11 +479,13 @@ private constructor(
createdAt = account.createdAt
currency = account.currency
entityId = account.entityId
+ funding = account.funding
idempotencyKey = account.idempotencyKey
informationalEntityId = account.informationalEntityId
interestAccrued = account.interestAccrued
interestAccruedAt = account.interestAccruedAt
interestRate = account.interestRate
+ loan = account.loan
name = account.name
programId = account.programId
status = account.status
@@ -554,6 +596,20 @@ private constructor(
*/
fun entityId(entityId: JsonField) = apply { this.entityId = entityId }
+ /** Whether the Account is funded by a loan or by deposits. */
+ fun funding(funding: Funding?) = funding(JsonField.ofNullable(funding))
+
+ /** Alias for calling [Builder.funding] with `funding.orElse(null)`. */
+ fun funding(funding: Optional) = funding(funding.getOrNull())
+
+ /**
+ * Sets [Builder.funding] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.funding] with a well-typed [Funding] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun funding(funding: JsonField) = apply { this.funding = funding }
+
/**
* The idempotency key you chose for this object. This value is unique across Increase and
* is used to ensure that a request is only processed once. Learn more about
@@ -659,6 +715,20 @@ private constructor(
this.interestRate = interestRate
}
+ /** The Account's loan-related information, if the Account is a loan account. */
+ fun loan(loan: Loan?) = loan(JsonField.ofNullable(loan))
+
+ /** Alias for calling [Builder.loan] with `loan.orElse(null)`. */
+ fun loan(loan: Optional) = loan(loan.getOrNull())
+
+ /**
+ * Sets [Builder.loan] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.loan] with a well-typed [Loan] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun loan(loan: JsonField) = apply { this.loan = loan }
+
/** The name you choose for the Account. */
fun name(name: String) = name(JsonField.of(name))
@@ -742,11 +812,13 @@ private constructor(
* .createdAt()
* .currency()
* .entityId()
+ * .funding()
* .idempotencyKey()
* .informationalEntityId()
* .interestAccrued()
* .interestAccruedAt()
* .interestRate()
+ * .loan()
* .name()
* .programId()
* .status()
@@ -764,11 +836,13 @@ private constructor(
checkRequired("createdAt", createdAt),
checkRequired("currency", currency),
checkRequired("entityId", entityId),
+ checkRequired("funding", funding),
checkRequired("idempotencyKey", idempotencyKey),
checkRequired("informationalEntityId", informationalEntityId),
checkRequired("interestAccrued", interestAccrued),
checkRequired("interestAccruedAt", interestAccruedAt),
checkRequired("interestRate", interestRate),
+ checkRequired("loan", loan),
checkRequired("name", name),
checkRequired("programId", programId),
checkRequired("status", status),
@@ -791,11 +865,13 @@ private constructor(
createdAt()
currency().validate()
entityId()
+ funding().ifPresent { it.validate() }
idempotencyKey()
informationalEntityId()
interestAccrued()
interestAccruedAt()
interestRate()
+ loan().ifPresent { it.validate() }
name()
programId()
status().validate()
@@ -825,11 +901,13 @@ private constructor(
(if (createdAt.asKnown().isPresent) 1 else 0) +
(currency.asKnown().getOrNull()?.validity() ?: 0) +
(if (entityId.asKnown().isPresent) 1 else 0) +
+ (funding.asKnown().getOrNull()?.validity() ?: 0) +
(if (idempotencyKey.asKnown().isPresent) 1 else 0) +
(if (informationalEntityId.asKnown().isPresent) 1 else 0) +
(if (interestAccrued.asKnown().isPresent) 1 else 0) +
(if (interestAccruedAt.asKnown().isPresent) 1 else 0) +
(if (interestRate.asKnown().isPresent) 1 else 0) +
+ (loan.asKnown().getOrNull()?.validity() ?: 0) +
(if (name.asKnown().isPresent) 1 else 0) +
(if (programId.asKnown().isPresent) 1 else 0) +
(status.asKnown().getOrNull()?.validity() ?: 0) +
@@ -1103,6 +1181,678 @@ private constructor(
override fun toString() = value.toString()
}
+ /** Whether the Account is funded by a loan or by deposits. */
+ class Funding @JsonCreator private constructor(private val value: JsonField) : Enum {
+
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
+ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
+
+ companion object {
+
+ /**
+ * An account funded by a loan. Before opening a loan account, contact
+ * support@increase.com to set up a loan program.
+ */
+ @JvmField val LOAN = of("loan")
+
+ /** An account funded by deposits. */
+ @JvmField val DEPOSITS = of("deposits")
+
+ @JvmStatic fun of(value: String) = Funding(JsonField.of(value))
+ }
+
+ /** An enum containing [Funding]'s known values. */
+ enum class Known {
+ /**
+ * An account funded by a loan. Before opening a loan account, contact
+ * support@increase.com to set up a loan program.
+ */
+ LOAN,
+ /** An account funded by deposits. */
+ DEPOSITS,
+ }
+
+ /**
+ * An enum containing [Funding]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Funding] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
+ enum class Value {
+ /**
+ * An account funded by a loan. Before opening a loan account, contact
+ * support@increase.com to set up a loan program.
+ */
+ LOAN,
+ /** An account funded by deposits. */
+ DEPOSITS,
+ /** An enum member indicating that [Funding] was instantiated with an unknown value. */
+ _UNKNOWN,
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
+ fun value(): Value =
+ when (this) {
+ LOAN -> Value.LOAN
+ DEPOSITS -> Value.DEPOSITS
+ else -> Value._UNKNOWN
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws IncreaseInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
+ fun known(): Known =
+ when (this) {
+ LOAN -> Known.LOAN
+ DEPOSITS -> Known.DEPOSITS
+ else -> throw IncreaseInvalidDataException("Unknown Funding: $value")
+ }
+
+ /**
+ * Returns this class instance's primitive wire representation.
+ *
+ * This differs from the [toString] method because that method is primarily for debugging
+ * and generally doesn't throw.
+ *
+ * @throws IncreaseInvalidDataException if this class instance's value does not have the
+ * expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow {
+ IncreaseInvalidDataException("Value is not a String")
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Funding = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: IncreaseInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Funding && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ /** The Account's loan-related information, if the Account is a loan account. */
+ class Loan
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val creditLimit: JsonField,
+ private val gracePeriodDays: JsonField,
+ private val maturityDate: JsonField,
+ private val statementDayOfMonth: JsonField,
+ private val statementPaymentType: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("credit_limit")
+ @ExcludeMissing
+ creditLimit: JsonField = JsonMissing.of(),
+ @JsonProperty("grace_period_days")
+ @ExcludeMissing
+ gracePeriodDays: JsonField = JsonMissing.of(),
+ @JsonProperty("maturity_date")
+ @ExcludeMissing
+ maturityDate: JsonField = JsonMissing.of(),
+ @JsonProperty("statement_day_of_month")
+ @ExcludeMissing
+ statementDayOfMonth: JsonField = JsonMissing.of(),
+ @JsonProperty("statement_payment_type")
+ @ExcludeMissing
+ statementPaymentType: JsonField = JsonMissing.of(),
+ ) : this(
+ creditLimit,
+ gracePeriodDays,
+ maturityDate,
+ statementDayOfMonth,
+ statementPaymentType,
+ mutableMapOf(),
+ )
+
+ /**
+ * The maximum amount of money that can be borrowed on the Account.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun creditLimit(): Long = creditLimit.getRequired("credit_limit")
+
+ /**
+ * The number of days after the statement date that the Account can be past due before being
+ * considered delinquent.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun gracePeriodDays(): Long = gracePeriodDays.getRequired("grace_period_days")
+
+ /**
+ * The date on which the loan matures.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun maturityDate(): Optional = maturityDate.getOptional("maturity_date")
+
+ /**
+ * The day of the month on which the loan statement is generated.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun statementDayOfMonth(): Long = statementDayOfMonth.getRequired("statement_day_of_month")
+
+ /**
+ * The type of payment for the loan.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun statementPaymentType(): StatementPaymentType =
+ statementPaymentType.getRequired("statement_payment_type")
+
+ /**
+ * Returns the raw JSON value of [creditLimit].
+ *
+ * Unlike [creditLimit], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("credit_limit")
+ @ExcludeMissing
+ fun _creditLimit(): JsonField = creditLimit
+
+ /**
+ * Returns the raw JSON value of [gracePeriodDays].
+ *
+ * Unlike [gracePeriodDays], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("grace_period_days")
+ @ExcludeMissing
+ fun _gracePeriodDays(): JsonField = gracePeriodDays
+
+ /**
+ * Returns the raw JSON value of [maturityDate].
+ *
+ * Unlike [maturityDate], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("maturity_date")
+ @ExcludeMissing
+ fun _maturityDate(): JsonField = maturityDate
+
+ /**
+ * Returns the raw JSON value of [statementDayOfMonth].
+ *
+ * Unlike [statementDayOfMonth], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("statement_day_of_month")
+ @ExcludeMissing
+ fun _statementDayOfMonth(): JsonField = statementDayOfMonth
+
+ /**
+ * Returns the raw JSON value of [statementPaymentType].
+ *
+ * Unlike [statementPaymentType], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("statement_payment_type")
+ @ExcludeMissing
+ fun _statementPaymentType(): JsonField = statementPaymentType
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [Loan].
+ *
+ * The following fields are required:
+ * ```java
+ * .creditLimit()
+ * .gracePeriodDays()
+ * .maturityDate()
+ * .statementDayOfMonth()
+ * .statementPaymentType()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Loan]. */
+ class Builder internal constructor() {
+
+ private var creditLimit: JsonField? = null
+ private var gracePeriodDays: JsonField? = null
+ private var maturityDate: JsonField? = null
+ private var statementDayOfMonth: JsonField? = null
+ private var statementPaymentType: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(loan: Loan) = apply {
+ creditLimit = loan.creditLimit
+ gracePeriodDays = loan.gracePeriodDays
+ maturityDate = loan.maturityDate
+ statementDayOfMonth = loan.statementDayOfMonth
+ statementPaymentType = loan.statementPaymentType
+ additionalProperties = loan.additionalProperties.toMutableMap()
+ }
+
+ /** The maximum amount of money that can be borrowed on the Account. */
+ fun creditLimit(creditLimit: Long) = creditLimit(JsonField.of(creditLimit))
+
+ /**
+ * Sets [Builder.creditLimit] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.creditLimit] with a well-typed [Long] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun creditLimit(creditLimit: JsonField) = apply { this.creditLimit = creditLimit }
+
+ /**
+ * The number of days after the statement date that the Account can be past due before
+ * being considered delinquent.
+ */
+ fun gracePeriodDays(gracePeriodDays: Long) =
+ gracePeriodDays(JsonField.of(gracePeriodDays))
+
+ /**
+ * Sets [Builder.gracePeriodDays] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.gracePeriodDays] with a well-typed [Long] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun gracePeriodDays(gracePeriodDays: JsonField) = apply {
+ this.gracePeriodDays = gracePeriodDays
+ }
+
+ /** The date on which the loan matures. */
+ fun maturityDate(maturityDate: LocalDate?) =
+ maturityDate(JsonField.ofNullable(maturityDate))
+
+ /** Alias for calling [Builder.maturityDate] with `maturityDate.orElse(null)`. */
+ fun maturityDate(maturityDate: Optional) =
+ maturityDate(maturityDate.getOrNull())
+
+ /**
+ * Sets [Builder.maturityDate] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.maturityDate] with a well-typed [LocalDate] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun maturityDate(maturityDate: JsonField) = apply {
+ this.maturityDate = maturityDate
+ }
+
+ /** The day of the month on which the loan statement is generated. */
+ fun statementDayOfMonth(statementDayOfMonth: Long) =
+ statementDayOfMonth(JsonField.of(statementDayOfMonth))
+
+ /**
+ * Sets [Builder.statementDayOfMonth] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.statementDayOfMonth] with a well-typed [Long] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun statementDayOfMonth(statementDayOfMonth: JsonField) = apply {
+ this.statementDayOfMonth = statementDayOfMonth
+ }
+
+ /** The type of payment for the loan. */
+ fun statementPaymentType(statementPaymentType: StatementPaymentType) =
+ statementPaymentType(JsonField.of(statementPaymentType))
+
+ /**
+ * Sets [Builder.statementPaymentType] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.statementPaymentType] with a well-typed
+ * [StatementPaymentType] value instead. This method is primarily for setting the field
+ * to an undocumented or not yet supported value.
+ */
+ fun statementPaymentType(statementPaymentType: JsonField) =
+ apply {
+ this.statementPaymentType = statementPaymentType
+ }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [Loan].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .creditLimit()
+ * .gracePeriodDays()
+ * .maturityDate()
+ * .statementDayOfMonth()
+ * .statementPaymentType()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): Loan =
+ Loan(
+ checkRequired("creditLimit", creditLimit),
+ checkRequired("gracePeriodDays", gracePeriodDays),
+ checkRequired("maturityDate", maturityDate),
+ checkRequired("statementDayOfMonth", statementDayOfMonth),
+ checkRequired("statementPaymentType", statementPaymentType),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Loan = apply {
+ if (validated) {
+ return@apply
+ }
+
+ creditLimit()
+ gracePeriodDays()
+ maturityDate()
+ statementDayOfMonth()
+ statementPaymentType().validate()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: IncreaseInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (creditLimit.asKnown().isPresent) 1 else 0) +
+ (if (gracePeriodDays.asKnown().isPresent) 1 else 0) +
+ (if (maturityDate.asKnown().isPresent) 1 else 0) +
+ (if (statementDayOfMonth.asKnown().isPresent) 1 else 0) +
+ (statementPaymentType.asKnown().getOrNull()?.validity() ?: 0)
+
+ /** The type of payment for the loan. */
+ class StatementPaymentType
+ @JsonCreator
+ private constructor(private val value: JsonField) : Enum {
+
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is
+ * on an older version than the API, then the API may respond with new members that the
+ * SDK is unaware of.
+ */
+ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
+
+ companion object {
+
+ /**
+ * The borrower must pay the full balance of the loan at the end of the statement
+ * period.
+ */
+ @JvmField val BALANCE = of("balance")
+
+ /**
+ * The borrower must pay the accrued interest at the end of the statement period.
+ */
+ @JvmField val INTEREST_UNTIL_MATURITY = of("interest_until_maturity")
+
+ @JvmStatic fun of(value: String) = StatementPaymentType(JsonField.of(value))
+ }
+
+ /** An enum containing [StatementPaymentType]'s known values. */
+ enum class Known {
+ /**
+ * The borrower must pay the full balance of the loan at the end of the statement
+ * period.
+ */
+ BALANCE,
+ /**
+ * The borrower must pay the accrued interest at the end of the statement period.
+ */
+ INTEREST_UNTIL_MATURITY,
+ }
+
+ /**
+ * An enum containing [StatementPaymentType]'s known values, as well as an [_UNKNOWN]
+ * member.
+ *
+ * An instance of [StatementPaymentType] can contain an unknown value in a couple of
+ * cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if
+ * the SDK is on an older version than the API, then the API may respond with new
+ * members that the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
+ enum class Value {
+ /**
+ * The borrower must pay the full balance of the loan at the end of the statement
+ * period.
+ */
+ BALANCE,
+ /**
+ * The borrower must pay the accrued interest at the end of the statement period.
+ */
+ INTEREST_UNTIL_MATURITY,
+ /**
+ * An enum member indicating that [StatementPaymentType] was instantiated with an
+ * unknown value.
+ */
+ _UNKNOWN,
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value, or
+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you
+ * want to throw for the unknown case.
+ */
+ fun value(): Value =
+ when (this) {
+ BALANCE -> Value.BALANCE
+ INTEREST_UNTIL_MATURITY -> Value.INTEREST_UNTIL_MATURITY
+ else -> Value._UNKNOWN
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and
+ * don't want to throw for the unknown case.
+ *
+ * @throws IncreaseInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
+ fun known(): Known =
+ when (this) {
+ BALANCE -> Known.BALANCE
+ INTEREST_UNTIL_MATURITY -> Known.INTEREST_UNTIL_MATURITY
+ else ->
+ throw IncreaseInvalidDataException("Unknown StatementPaymentType: $value")
+ }
+
+ /**
+ * Returns this class instance's primitive wire representation.
+ *
+ * This differs from the [toString] method because that method is primarily for
+ * debugging and generally doesn't throw.
+ *
+ * @throws IncreaseInvalidDataException if this class instance's value does not have the
+ * expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow {
+ IncreaseInvalidDataException("Value is not a String")
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): StatementPaymentType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: IncreaseInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is StatementPaymentType && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Loan &&
+ creditLimit == other.creditLimit &&
+ gracePeriodDays == other.gracePeriodDays &&
+ maturityDate == other.maturityDate &&
+ statementDayOfMonth == other.statementDayOfMonth &&
+ statementPaymentType == other.statementPaymentType &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(
+ creditLimit,
+ gracePeriodDays,
+ maturityDate,
+ statementDayOfMonth,
+ statementPaymentType,
+ additionalProperties,
+ )
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Loan{creditLimit=$creditLimit, gracePeriodDays=$gracePeriodDays, maturityDate=$maturityDate, statementDayOfMonth=$statementDayOfMonth, statementPaymentType=$statementPaymentType, additionalProperties=$additionalProperties}"
+ }
+
/** The status of the Account. */
class Status @JsonCreator private constructor(private val value: JsonField) : Enum {
@@ -1372,11 +2122,13 @@ private constructor(
createdAt == other.createdAt &&
currency == other.currency &&
entityId == other.entityId &&
+ funding == other.funding &&
idempotencyKey == other.idempotencyKey &&
informationalEntityId == other.informationalEntityId &&
interestAccrued == other.interestAccrued &&
interestAccruedAt == other.interestAccruedAt &&
interestRate == other.interestRate &&
+ loan == other.loan &&
name == other.name &&
programId == other.programId &&
status == other.status &&
@@ -1393,11 +2145,13 @@ private constructor(
createdAt,
currency,
entityId,
+ funding,
idempotencyKey,
informationalEntityId,
interestAccrued,
interestAccruedAt,
interestRate,
+ loan,
name,
programId,
status,
@@ -1409,5 +2163,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "Account{id=$id, accountRevenueRate=$accountRevenueRate, bank=$bank, closedAt=$closedAt, createdAt=$createdAt, currency=$currency, entityId=$entityId, idempotencyKey=$idempotencyKey, informationalEntityId=$informationalEntityId, interestAccrued=$interestAccrued, interestAccruedAt=$interestAccruedAt, interestRate=$interestRate, name=$name, programId=$programId, status=$status, type=$type, additionalProperties=$additionalProperties}"
+ "Account{id=$id, accountRevenueRate=$accountRevenueRate, bank=$bank, closedAt=$closedAt, createdAt=$createdAt, currency=$currency, entityId=$entityId, funding=$funding, idempotencyKey=$idempotencyKey, informationalEntityId=$informationalEntityId, interestAccrued=$interestAccrued, interestAccruedAt=$interestAccruedAt, interestRate=$interestRate, loan=$loan, name=$name, programId=$programId, status=$status, type=$type, additionalProperties=$additionalProperties}"
}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/accounts/AccountCreateParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/accounts/AccountCreateParams.kt
index 34891d29d..a2d111a24 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/models/accounts/AccountCreateParams.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/accounts/AccountCreateParams.kt
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
import com.fasterxml.jackson.annotation.JsonCreator
import com.fasterxml.jackson.annotation.JsonProperty
+import com.increase.api.core.Enum
import com.increase.api.core.ExcludeMissing
import com.increase.api.core.JsonField
import com.increase.api.core.JsonMissing
@@ -15,9 +16,11 @@ import com.increase.api.core.checkRequired
import com.increase.api.core.http.Headers
import com.increase.api.core.http.QueryParams
import com.increase.api.errors.IncreaseInvalidDataException
+import java.time.LocalDate
import java.util.Collections
import java.util.Objects
import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
/** Create an Account */
class AccountCreateParams
@@ -43,6 +46,14 @@ private constructor(
*/
fun entityId(): Optional = body.entityId()
+ /**
+ * Whether the Account is funded by a loan or by deposits.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun funding(): Optional = body.funding()
+
/**
* The identifier of an Entity that, while not owning the Account, is associated with its
* activity. This is generally the beneficiary of the funds.
@@ -52,6 +63,14 @@ private constructor(
*/
fun informationalEntityId(): Optional = body.informationalEntityId()
+ /**
+ * The loan details for the account.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun loan(): Optional = body.loan()
+
/**
* The identifier for the Program that this Account falls under. Required if you operate more
* than one Program.
@@ -75,6 +94,13 @@ private constructor(
*/
fun _entityId(): JsonField = body._entityId()
+ /**
+ * Returns the raw JSON value of [funding].
+ *
+ * Unlike [funding], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ fun _funding(): JsonField = body._funding()
+
/**
* Returns the raw JSON value of [informationalEntityId].
*
@@ -83,6 +109,13 @@ private constructor(
*/
fun _informationalEntityId(): JsonField = body._informationalEntityId()
+ /**
+ * Returns the raw JSON value of [loan].
+ *
+ * Unlike [loan], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ fun _loan(): JsonField = body._loan()
+
/**
* Returns the raw JSON value of [programId].
*
@@ -134,8 +167,10 @@ private constructor(
* Otherwise, it's more convenient to use the top-level setters instead:
* - [name]
* - [entityId]
+ * - [funding]
* - [informationalEntityId]
- * - [programId]
+ * - [loan]
+ * - etc.
*/
fun body(body: Body) = apply { this.body = body.toBuilder() }
@@ -161,6 +196,17 @@ private constructor(
*/
fun entityId(entityId: JsonField) = apply { body.entityId(entityId) }
+ /** Whether the Account is funded by a loan or by deposits. */
+ fun funding(funding: Funding) = apply { body.funding(funding) }
+
+ /**
+ * Sets [Builder.funding] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.funding] with a well-typed [Funding] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun funding(funding: JsonField) = apply { body.funding(funding) }
+
/**
* The identifier of an Entity that, while not owning the Account, is associated with its
* activity. This is generally the beneficiary of the funds.
@@ -180,6 +226,17 @@ private constructor(
body.informationalEntityId(informationalEntityId)
}
+ /** The loan details for the account. */
+ fun loan(loan: Loan) = apply { body.loan(loan) }
+
+ /**
+ * Sets [Builder.loan] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.loan] with a well-typed [Loan] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun loan(loan: JsonField) = apply { body.loan(loan) }
+
/**
* The identifier for the Program that this Account falls under. Required if you operate
* more than one Program.
@@ -343,7 +400,9 @@ private constructor(
private constructor(
private val name: JsonField,
private val entityId: JsonField,
+ private val funding: JsonField,
private val informationalEntityId: JsonField,
+ private val loan: JsonField,
private val programId: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -354,13 +413,15 @@ private constructor(
@JsonProperty("entity_id")
@ExcludeMissing
entityId: JsonField = JsonMissing.of(),
+ @JsonProperty("funding") @ExcludeMissing funding: JsonField = JsonMissing.of(),
@JsonProperty("informational_entity_id")
@ExcludeMissing
informationalEntityId: JsonField = JsonMissing.of(),
+ @JsonProperty("loan") @ExcludeMissing loan: JsonField = JsonMissing.of(),
@JsonProperty("program_id")
@ExcludeMissing
programId: JsonField = JsonMissing.of(),
- ) : this(name, entityId, informationalEntityId, programId, mutableMapOf())
+ ) : this(name, entityId, funding, informationalEntityId, loan, programId, mutableMapOf())
/**
* The name you choose for the Account.
@@ -378,6 +439,14 @@ private constructor(
*/
fun entityId(): Optional = entityId.getOptional("entity_id")
+ /**
+ * Whether the Account is funded by a loan or by deposits.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun funding(): Optional = funding.getOptional("funding")
+
/**
* The identifier of an Entity that, while not owning the Account, is associated with its
* activity. This is generally the beneficiary of the funds.
@@ -388,6 +457,14 @@ private constructor(
fun informationalEntityId(): Optional =
informationalEntityId.getOptional("informational_entity_id")
+ /**
+ * The loan details for the account.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun loan(): Optional = loan.getOptional("loan")
+
/**
* The identifier for the Program that this Account falls under. Required if you operate
* more than one Program.
@@ -411,6 +488,13 @@ private constructor(
*/
@JsonProperty("entity_id") @ExcludeMissing fun _entityId(): JsonField = entityId
+ /**
+ * Returns the raw JSON value of [funding].
+ *
+ * Unlike [funding], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("funding") @ExcludeMissing fun _funding(): JsonField = funding
+
/**
* Returns the raw JSON value of [informationalEntityId].
*
@@ -421,6 +505,13 @@ private constructor(
@ExcludeMissing
fun _informationalEntityId(): JsonField = informationalEntityId
+ /**
+ * Returns the raw JSON value of [loan].
+ *
+ * Unlike [loan], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("loan") @ExcludeMissing fun _loan(): JsonField = loan
+
/**
* Returns the raw JSON value of [programId].
*
@@ -458,7 +549,9 @@ private constructor(
private var name: JsonField? = null
private var entityId: JsonField = JsonMissing.of()
+ private var funding: JsonField = JsonMissing.of()
private var informationalEntityId: JsonField = JsonMissing.of()
+ private var loan: JsonField = JsonMissing.of()
private var programId: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@@ -466,7 +559,9 @@ private constructor(
internal fun from(body: Body) = apply {
name = body.name
entityId = body.entityId
+ funding = body.funding
informationalEntityId = body.informationalEntityId
+ loan = body.loan
programId = body.programId
additionalProperties = body.additionalProperties.toMutableMap()
}
@@ -495,6 +590,18 @@ private constructor(
*/
fun entityId(entityId: JsonField) = apply { this.entityId = entityId }
+ /** Whether the Account is funded by a loan or by deposits. */
+ fun funding(funding: Funding) = funding(JsonField.of(funding))
+
+ /**
+ * Sets [Builder.funding] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.funding] with a well-typed [Funding] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun funding(funding: JsonField) = apply { this.funding = funding }
+
/**
* The identifier of an Entity that, while not owning the Account, is associated with
* its activity. This is generally the beneficiary of the funds.
@@ -513,6 +620,18 @@ private constructor(
this.informationalEntityId = informationalEntityId
}
+ /** The loan details for the account. */
+ fun loan(loan: Loan) = loan(JsonField.of(loan))
+
+ /**
+ * Sets [Builder.loan] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.loan] with a well-typed [Loan] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun loan(loan: JsonField) = apply { this.loan = loan }
+
/**
* The identifier for the Program that this Account falls under. Required if you operate
* more than one Program.
@@ -563,7 +682,9 @@ private constructor(
Body(
checkRequired("name", name),
entityId,
+ funding,
informationalEntityId,
+ loan,
programId,
additionalProperties.toMutableMap(),
)
@@ -578,7 +699,9 @@ private constructor(
name()
entityId()
+ funding().ifPresent { it.validate() }
informationalEntityId()
+ loan().ifPresent { it.validate() }
programId()
validated = true
}
@@ -601,7 +724,9 @@ private constructor(
internal fun validity(): Int =
(if (name.asKnown().isPresent) 1 else 0) +
(if (entityId.asKnown().isPresent) 1 else 0) +
+ (funding.asKnown().getOrNull()?.validity() ?: 0) +
(if (informationalEntityId.asKnown().isPresent) 1 else 0) +
+ (loan.asKnown().getOrNull()?.validity() ?: 0) +
(if (programId.asKnown().isPresent) 1 else 0)
override fun equals(other: Any?): Boolean {
@@ -612,19 +737,694 @@ private constructor(
return other is Body &&
name == other.name &&
entityId == other.entityId &&
+ funding == other.funding &&
informationalEntityId == other.informationalEntityId &&
+ loan == other.loan &&
programId == other.programId &&
additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy {
- Objects.hash(name, entityId, informationalEntityId, programId, additionalProperties)
+ Objects.hash(
+ name,
+ entityId,
+ funding,
+ informationalEntityId,
+ loan,
+ programId,
+ additionalProperties,
+ )
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Body{name=$name, entityId=$entityId, funding=$funding, informationalEntityId=$informationalEntityId, loan=$loan, programId=$programId, additionalProperties=$additionalProperties}"
+ }
+
+ /** Whether the Account is funded by a loan or by deposits. */
+ class Funding @JsonCreator private constructor(private val value: JsonField) : Enum {
+
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
+ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
+
+ companion object {
+
+ /**
+ * An account funded by a loan. Before opening a loan account, contact
+ * support@increase.com to set up a loan program.
+ */
+ @JvmField val LOAN = of("loan")
+
+ /** An account funded by deposits. */
+ @JvmField val DEPOSITS = of("deposits")
+
+ @JvmStatic fun of(value: String) = Funding(JsonField.of(value))
+ }
+
+ /** An enum containing [Funding]'s known values. */
+ enum class Known {
+ /**
+ * An account funded by a loan. Before opening a loan account, contact
+ * support@increase.com to set up a loan program.
+ */
+ LOAN,
+ /** An account funded by deposits. */
+ DEPOSITS,
+ }
+
+ /**
+ * An enum containing [Funding]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Funding] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
+ enum class Value {
+ /**
+ * An account funded by a loan. Before opening a loan account, contact
+ * support@increase.com to set up a loan program.
+ */
+ LOAN,
+ /** An account funded by deposits. */
+ DEPOSITS,
+ /** An enum member indicating that [Funding] was instantiated with an unknown value. */
+ _UNKNOWN,
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
+ fun value(): Value =
+ when (this) {
+ LOAN -> Value.LOAN
+ DEPOSITS -> Value.DEPOSITS
+ else -> Value._UNKNOWN
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws IncreaseInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
+ fun known(): Known =
+ when (this) {
+ LOAN -> Known.LOAN
+ DEPOSITS -> Known.DEPOSITS
+ else -> throw IncreaseInvalidDataException("Unknown Funding: $value")
+ }
+
+ /**
+ * Returns this class instance's primitive wire representation.
+ *
+ * This differs from the [toString] method because that method is primarily for debugging
+ * and generally doesn't throw.
+ *
+ * @throws IncreaseInvalidDataException if this class instance's value does not have the
+ * expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow {
+ IncreaseInvalidDataException("Value is not a String")
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Funding = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: IncreaseInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Funding && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ /** The loan details for the account. */
+ class Loan
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val creditLimit: JsonField,
+ private val gracePeriodDays: JsonField,
+ private val statementDayOfMonth: JsonField,
+ private val statementPaymentType: JsonField,
+ private val maturityDate: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("credit_limit")
+ @ExcludeMissing
+ creditLimit: JsonField = JsonMissing.of(),
+ @JsonProperty("grace_period_days")
+ @ExcludeMissing
+ gracePeriodDays: JsonField = JsonMissing.of(),
+ @JsonProperty("statement_day_of_month")
+ @ExcludeMissing
+ statementDayOfMonth: JsonField = JsonMissing.of(),
+ @JsonProperty("statement_payment_type")
+ @ExcludeMissing
+ statementPaymentType: JsonField = JsonMissing.of(),
+ @JsonProperty("maturity_date")
+ @ExcludeMissing
+ maturityDate: JsonField = JsonMissing.of(),
+ ) : this(
+ creditLimit,
+ gracePeriodDays,
+ statementDayOfMonth,
+ statementPaymentType,
+ maturityDate,
+ mutableMapOf(),
+ )
+
+ /**
+ * The maximum amount of money that can be drawn from the Account.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun creditLimit(): Long = creditLimit.getRequired("credit_limit")
+
+ /**
+ * The number of days after the statement date that the Account can be past due before being
+ * considered delinquent.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun gracePeriodDays(): Long = gracePeriodDays.getRequired("grace_period_days")
+
+ /**
+ * The day of the month on which the loan statement is generated.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun statementDayOfMonth(): Long = statementDayOfMonth.getRequired("statement_day_of_month")
+
+ /**
+ * The type of statement payment for the account.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun statementPaymentType(): StatementPaymentType =
+ statementPaymentType.getRequired("statement_payment_type")
+
+ /**
+ * The date on which the loan matures.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun maturityDate(): Optional = maturityDate.getOptional("maturity_date")
+
+ /**
+ * Returns the raw JSON value of [creditLimit].
+ *
+ * Unlike [creditLimit], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("credit_limit")
+ @ExcludeMissing
+ fun _creditLimit(): JsonField = creditLimit
+
+ /**
+ * Returns the raw JSON value of [gracePeriodDays].
+ *
+ * Unlike [gracePeriodDays], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("grace_period_days")
+ @ExcludeMissing
+ fun _gracePeriodDays(): JsonField = gracePeriodDays
+
+ /**
+ * Returns the raw JSON value of [statementDayOfMonth].
+ *
+ * Unlike [statementDayOfMonth], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("statement_day_of_month")
+ @ExcludeMissing
+ fun _statementDayOfMonth(): JsonField = statementDayOfMonth
+
+ /**
+ * Returns the raw JSON value of [statementPaymentType].
+ *
+ * Unlike [statementPaymentType], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("statement_payment_type")
+ @ExcludeMissing
+ fun _statementPaymentType(): JsonField = statementPaymentType
+
+ /**
+ * Returns the raw JSON value of [maturityDate].
+ *
+ * Unlike [maturityDate], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("maturity_date")
+ @ExcludeMissing
+ fun _maturityDate(): JsonField = maturityDate
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [Loan].
+ *
+ * The following fields are required:
+ * ```java
+ * .creditLimit()
+ * .gracePeriodDays()
+ * .statementDayOfMonth()
+ * .statementPaymentType()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Loan]. */
+ class Builder internal constructor() {
+
+ private var creditLimit: JsonField? = null
+ private var gracePeriodDays: JsonField? = null
+ private var statementDayOfMonth: JsonField? = null
+ private var statementPaymentType: JsonField? = null
+ private var maturityDate: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(loan: Loan) = apply {
+ creditLimit = loan.creditLimit
+ gracePeriodDays = loan.gracePeriodDays
+ statementDayOfMonth = loan.statementDayOfMonth
+ statementPaymentType = loan.statementPaymentType
+ maturityDate = loan.maturityDate
+ additionalProperties = loan.additionalProperties.toMutableMap()
+ }
+
+ /** The maximum amount of money that can be drawn from the Account. */
+ fun creditLimit(creditLimit: Long) = creditLimit(JsonField.of(creditLimit))
+
+ /**
+ * Sets [Builder.creditLimit] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.creditLimit] with a well-typed [Long] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun creditLimit(creditLimit: JsonField) = apply { this.creditLimit = creditLimit }
+
+ /**
+ * The number of days after the statement date that the Account can be past due before
+ * being considered delinquent.
+ */
+ fun gracePeriodDays(gracePeriodDays: Long) =
+ gracePeriodDays(JsonField.of(gracePeriodDays))
+
+ /**
+ * Sets [Builder.gracePeriodDays] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.gracePeriodDays] with a well-typed [Long] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun gracePeriodDays(gracePeriodDays: JsonField) = apply {
+ this.gracePeriodDays = gracePeriodDays
+ }
+
+ /** The day of the month on which the loan statement is generated. */
+ fun statementDayOfMonth(statementDayOfMonth: Long) =
+ statementDayOfMonth(JsonField.of(statementDayOfMonth))
+
+ /**
+ * Sets [Builder.statementDayOfMonth] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.statementDayOfMonth] with a well-typed [Long] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun statementDayOfMonth(statementDayOfMonth: JsonField) = apply {
+ this.statementDayOfMonth = statementDayOfMonth
+ }
+
+ /** The type of statement payment for the account. */
+ fun statementPaymentType(statementPaymentType: StatementPaymentType) =
+ statementPaymentType(JsonField.of(statementPaymentType))
+
+ /**
+ * Sets [Builder.statementPaymentType] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.statementPaymentType] with a well-typed
+ * [StatementPaymentType] value instead. This method is primarily for setting the field
+ * to an undocumented or not yet supported value.
+ */
+ fun statementPaymentType(statementPaymentType: JsonField) =
+ apply {
+ this.statementPaymentType = statementPaymentType
+ }
+
+ /** The date on which the loan matures. */
+ fun maturityDate(maturityDate: LocalDate) = maturityDate(JsonField.of(maturityDate))
+
+ /**
+ * Sets [Builder.maturityDate] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.maturityDate] with a well-typed [LocalDate] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun maturityDate(maturityDate: JsonField) = apply {
+ this.maturityDate = maturityDate
+ }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [Loan].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .creditLimit()
+ * .gracePeriodDays()
+ * .statementDayOfMonth()
+ * .statementPaymentType()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): Loan =
+ Loan(
+ checkRequired("creditLimit", creditLimit),
+ checkRequired("gracePeriodDays", gracePeriodDays),
+ checkRequired("statementDayOfMonth", statementDayOfMonth),
+ checkRequired("statementPaymentType", statementPaymentType),
+ maturityDate,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Loan = apply {
+ if (validated) {
+ return@apply
+ }
+
+ creditLimit()
+ gracePeriodDays()
+ statementDayOfMonth()
+ statementPaymentType().validate()
+ maturityDate()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: IncreaseInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (creditLimit.asKnown().isPresent) 1 else 0) +
+ (if (gracePeriodDays.asKnown().isPresent) 1 else 0) +
+ (if (statementDayOfMonth.asKnown().isPresent) 1 else 0) +
+ (statementPaymentType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (maturityDate.asKnown().isPresent) 1 else 0)
+
+ /** The type of statement payment for the account. */
+ class StatementPaymentType
+ @JsonCreator
+ private constructor(private val value: JsonField) : Enum {
+
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is
+ * on an older version than the API, then the API may respond with new members that the
+ * SDK is unaware of.
+ */
+ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
+
+ companion object {
+
+ /**
+ * The borrower must pay the full balance of the loan at the end of the statement
+ * period.
+ */
+ @JvmField val BALANCE = of("balance")
+
+ /**
+ * The borrower must pay the accrued interest at the end of the statement period.
+ */
+ @JvmField val INTEREST_UNTIL_MATURITY = of("interest_until_maturity")
+
+ @JvmStatic fun of(value: String) = StatementPaymentType(JsonField.of(value))
+ }
+
+ /** An enum containing [StatementPaymentType]'s known values. */
+ enum class Known {
+ /**
+ * The borrower must pay the full balance of the loan at the end of the statement
+ * period.
+ */
+ BALANCE,
+ /**
+ * The borrower must pay the accrued interest at the end of the statement period.
+ */
+ INTEREST_UNTIL_MATURITY,
+ }
+
+ /**
+ * An enum containing [StatementPaymentType]'s known values, as well as an [_UNKNOWN]
+ * member.
+ *
+ * An instance of [StatementPaymentType] can contain an unknown value in a couple of
+ * cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if
+ * the SDK is on an older version than the API, then the API may respond with new
+ * members that the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
+ enum class Value {
+ /**
+ * The borrower must pay the full balance of the loan at the end of the statement
+ * period.
+ */
+ BALANCE,
+ /**
+ * The borrower must pay the accrued interest at the end of the statement period.
+ */
+ INTEREST_UNTIL_MATURITY,
+ /**
+ * An enum member indicating that [StatementPaymentType] was instantiated with an
+ * unknown value.
+ */
+ _UNKNOWN,
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value, or
+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you
+ * want to throw for the unknown case.
+ */
+ fun value(): Value =
+ when (this) {
+ BALANCE -> Value.BALANCE
+ INTEREST_UNTIL_MATURITY -> Value.INTEREST_UNTIL_MATURITY
+ else -> Value._UNKNOWN
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and
+ * don't want to throw for the unknown case.
+ *
+ * @throws IncreaseInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
+ fun known(): Known =
+ when (this) {
+ BALANCE -> Known.BALANCE
+ INTEREST_UNTIL_MATURITY -> Known.INTEREST_UNTIL_MATURITY
+ else ->
+ throw IncreaseInvalidDataException("Unknown StatementPaymentType: $value")
+ }
+
+ /**
+ * Returns this class instance's primitive wire representation.
+ *
+ * This differs from the [toString] method because that method is primarily for
+ * debugging and generally doesn't throw.
+ *
+ * @throws IncreaseInvalidDataException if this class instance's value does not have the
+ * expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow {
+ IncreaseInvalidDataException("Value is not a String")
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): StatementPaymentType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: IncreaseInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is StatementPaymentType && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Loan &&
+ creditLimit == other.creditLimit &&
+ gracePeriodDays == other.gracePeriodDays &&
+ statementDayOfMonth == other.statementDayOfMonth &&
+ statementPaymentType == other.statementPaymentType &&
+ maturityDate == other.maturityDate &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(
+ creditLimit,
+ gracePeriodDays,
+ statementDayOfMonth,
+ statementPaymentType,
+ maturityDate,
+ additionalProperties,
+ )
}
override fun hashCode(): Int = hashCode
override fun toString() =
- "Body{name=$name, entityId=$entityId, informationalEntityId=$informationalEntityId, programId=$programId, additionalProperties=$additionalProperties}"
+ "Loan{creditLimit=$creditLimit, gracePeriodDays=$gracePeriodDays, statementDayOfMonth=$statementDayOfMonth, statementPaymentType=$statementPaymentType, maturityDate=$maturityDate, additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/accounts/AccountUpdateParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/accounts/AccountUpdateParams.kt
index 08071586c..aaedb4915 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/models/accounts/AccountUpdateParams.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/accounts/AccountUpdateParams.kt
@@ -11,6 +11,7 @@ import com.increase.api.core.JsonField
import com.increase.api.core.JsonMissing
import com.increase.api.core.JsonValue
import com.increase.api.core.Params
+import com.increase.api.core.checkRequired
import com.increase.api.core.http.Headers
import com.increase.api.core.http.QueryParams
import com.increase.api.errors.IncreaseInvalidDataException
@@ -31,6 +32,14 @@ private constructor(
/** The identifier of the Account to update. */
fun accountId(): Optional = Optional.ofNullable(accountId)
+ /**
+ * The loan details for the account.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun loan(): Optional = body.loan()
+
/**
* The new name of the Account.
*
@@ -39,6 +48,13 @@ private constructor(
*/
fun name(): Optional = body.name()
+ /**
+ * Returns the raw JSON value of [loan].
+ *
+ * Unlike [loan], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ fun _loan(): JsonField = body._loan()
+
/**
* Returns the raw JSON value of [name].
*
@@ -91,10 +107,22 @@ private constructor(
*
* This is generally only useful if you are already constructing the body separately.
* Otherwise, it's more convenient to use the top-level setters instead:
+ * - [loan]
* - [name]
*/
fun body(body: Body) = apply { this.body = body.toBuilder() }
+ /** The loan details for the account. */
+ fun loan(loan: Loan) = apply { body.loan(loan) }
+
+ /**
+ * Sets [Builder.loan] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.loan] with a well-typed [Loan] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun loan(loan: JsonField) = apply { body.loan(loan) }
+
/** The new name of the Account. */
fun name(name: String) = apply { body.name(name) }
@@ -252,14 +280,24 @@ private constructor(
class Body
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
+ private val loan: JsonField,
private val name: JsonField,
private val additionalProperties: MutableMap,
) {
@JsonCreator
private constructor(
- @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of()
- ) : this(name, mutableMapOf())
+ @JsonProperty("loan") @ExcludeMissing loan: JsonField = JsonMissing.of(),
+ @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(),
+ ) : this(loan, name, mutableMapOf())
+
+ /**
+ * The loan details for the account.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun loan(): Optional = loan.getOptional("loan")
/**
* The new name of the Account.
@@ -269,6 +307,13 @@ private constructor(
*/
fun name(): Optional = name.getOptional("name")
+ /**
+ * Returns the raw JSON value of [loan].
+ *
+ * Unlike [loan], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("loan") @ExcludeMissing fun _loan(): JsonField = loan
+
/**
* Returns the raw JSON value of [name].
*
@@ -297,15 +342,29 @@ private constructor(
/** A builder for [Body]. */
class Builder internal constructor() {
+ private var loan: JsonField = JsonMissing.of()
private var name: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
internal fun from(body: Body) = apply {
+ loan = body.loan
name = body.name
additionalProperties = body.additionalProperties.toMutableMap()
}
+ /** The loan details for the account. */
+ fun loan(loan: Loan) = loan(JsonField.of(loan))
+
+ /**
+ * Sets [Builder.loan] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.loan] with a well-typed [Loan] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun loan(loan: JsonField) = apply { this.loan = loan }
+
/** The new name of the Account. */
fun name(name: String) = name(JsonField.of(name))
@@ -342,7 +401,7 @@ private constructor(
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
- fun build(): Body = Body(name, additionalProperties.toMutableMap())
+ fun build(): Body = Body(loan, name, additionalProperties.toMutableMap())
}
private var validated: Boolean = false
@@ -352,6 +411,7 @@ private constructor(
return@apply
}
+ loan().ifPresent { it.validate() }
name()
validated = true
}
@@ -370,7 +430,9 @@ private constructor(
*
* Used for best match union deserialization.
*/
- @JvmSynthetic internal fun validity(): Int = (if (name.asKnown().isPresent) 1 else 0)
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (loan.asKnown().getOrNull()?.validity() ?: 0) + (if (name.asKnown().isPresent) 1 else 0)
override fun equals(other: Any?): Boolean {
if (this === other) {
@@ -378,15 +440,178 @@ private constructor(
}
return other is Body &&
+ loan == other.loan &&
name == other.name &&
additionalProperties == other.additionalProperties
}
- private val hashCode: Int by lazy { Objects.hash(name, additionalProperties) }
+ private val hashCode: Int by lazy { Objects.hash(loan, name, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Body{loan=$loan, name=$name, additionalProperties=$additionalProperties}"
+ }
+
+ /** The loan details for the account. */
+ class Loan
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val creditLimit: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("credit_limit")
+ @ExcludeMissing
+ creditLimit: JsonField = JsonMissing.of()
+ ) : this(creditLimit, mutableMapOf())
+
+ /**
+ * The maximum amount of money that can be drawn from the Account.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun creditLimit(): Long = creditLimit.getRequired("credit_limit")
+
+ /**
+ * Returns the raw JSON value of [creditLimit].
+ *
+ * Unlike [creditLimit], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("credit_limit")
+ @ExcludeMissing
+ fun _creditLimit(): JsonField = creditLimit
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [Loan].
+ *
+ * The following fields are required:
+ * ```java
+ * .creditLimit()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Loan]. */
+ class Builder internal constructor() {
+
+ private var creditLimit: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(loan: Loan) = apply {
+ creditLimit = loan.creditLimit
+ additionalProperties = loan.additionalProperties.toMutableMap()
+ }
+
+ /** The maximum amount of money that can be drawn from the Account. */
+ fun creditLimit(creditLimit: Long) = creditLimit(JsonField.of(creditLimit))
+
+ /**
+ * Sets [Builder.creditLimit] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.creditLimit] with a well-typed [Long] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun creditLimit(creditLimit: JsonField) = apply { this.creditLimit = creditLimit }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [Loan].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .creditLimit()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): Loan =
+ Loan(checkRequired("creditLimit", creditLimit), additionalProperties.toMutableMap())
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Loan = apply {
+ if (validated) {
+ return@apply
+ }
+
+ creditLimit()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: IncreaseInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = (if (creditLimit.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Loan &&
+ creditLimit == other.creditLimit &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(creditLimit, additionalProperties) }
override fun hashCode(): Int = hashCode
- override fun toString() = "Body{name=$name, additionalProperties=$additionalProperties}"
+ override fun toString() =
+ "Loan{creditLimit=$creditLimit, additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/accounts/BalanceLookup.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/accounts/BalanceLookup.kt
index b818c0609..91c5f8aa6 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/models/accounts/BalanceLookup.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/accounts/BalanceLookup.kt
@@ -13,8 +13,10 @@ import com.increase.api.core.JsonMissing
import com.increase.api.core.JsonValue
import com.increase.api.core.checkRequired
import com.increase.api.errors.IncreaseInvalidDataException
+import java.time.OffsetDateTime
import java.util.Collections
import java.util.Objects
+import java.util.Optional
import kotlin.jvm.optionals.getOrNull
/** Represents a request to lookup the balance of an Account at a given point in time. */
@@ -24,6 +26,7 @@ private constructor(
private val accountId: JsonField,
private val availableBalance: JsonField,
private val currentBalance: JsonField,
+ private val loan: JsonField,
private val type: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -37,8 +40,9 @@ private constructor(
@JsonProperty("current_balance")
@ExcludeMissing
currentBalance: JsonField = JsonMissing.of(),
+ @JsonProperty("loan") @ExcludeMissing loan: JsonField = JsonMissing.of(),
@JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(),
- ) : this(accountId, availableBalance, currentBalance, type, mutableMapOf())
+ ) : this(accountId, availableBalance, currentBalance, loan, type, mutableMapOf())
/**
* The identifier for the account for which the balance was queried.
@@ -66,6 +70,14 @@ private constructor(
*/
fun currentBalance(): Long = currentBalance.getRequired("current_balance")
+ /**
+ * The loan balances for the Account.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun loan(): Optional = loan.getOptional("loan")
+
/**
* A constant representing the object's type. For this resource it will always be
* `balance_lookup`.
@@ -101,6 +113,13 @@ private constructor(
@ExcludeMissing
fun _currentBalance(): JsonField = currentBalance
+ /**
+ * Returns the raw JSON value of [loan].
+ *
+ * Unlike [loan], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("loan") @ExcludeMissing fun _loan(): JsonField = loan
+
/**
* Returns the raw JSON value of [type].
*
@@ -130,6 +149,7 @@ private constructor(
* .accountId()
* .availableBalance()
* .currentBalance()
+ * .loan()
* .type()
* ```
*/
@@ -142,6 +162,7 @@ private constructor(
private var accountId: JsonField? = null
private var availableBalance: JsonField? = null
private var currentBalance: JsonField? = null
+ private var loan: JsonField? = null
private var type: JsonField? = null
private var additionalProperties: MutableMap = mutableMapOf()
@@ -150,6 +171,7 @@ private constructor(
accountId = balanceLookup.accountId
availableBalance = balanceLookup.availableBalance
currentBalance = balanceLookup.currentBalance
+ loan = balanceLookup.loan
type = balanceLookup.type
additionalProperties = balanceLookup.additionalProperties.toMutableMap()
}
@@ -201,6 +223,20 @@ private constructor(
this.currentBalance = currentBalance
}
+ /** The loan balances for the Account. */
+ fun loan(loan: Loan?) = loan(JsonField.ofNullable(loan))
+
+ /** Alias for calling [Builder.loan] with `loan.orElse(null)`. */
+ fun loan(loan: Optional) = loan(loan.getOrNull())
+
+ /**
+ * Sets [Builder.loan] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.loan] with a well-typed [Loan] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun loan(loan: JsonField) = apply { this.loan = loan }
+
/**
* A constant representing the object's type. For this resource it will always be
* `balance_lookup`.
@@ -244,6 +280,7 @@ private constructor(
* .accountId()
* .availableBalance()
* .currentBalance()
+ * .loan()
* .type()
* ```
*
@@ -254,6 +291,7 @@ private constructor(
checkRequired("accountId", accountId),
checkRequired("availableBalance", availableBalance),
checkRequired("currentBalance", currentBalance),
+ checkRequired("loan", loan),
checkRequired("type", type),
additionalProperties.toMutableMap(),
)
@@ -269,6 +307,7 @@ private constructor(
accountId()
availableBalance()
currentBalance()
+ loan().ifPresent { it.validate() }
type().validate()
validated = true
}
@@ -291,8 +330,265 @@ private constructor(
(if (accountId.asKnown().isPresent) 1 else 0) +
(if (availableBalance.asKnown().isPresent) 1 else 0) +
(if (currentBalance.asKnown().isPresent) 1 else 0) +
+ (loan.asKnown().getOrNull()?.validity() ?: 0) +
(type.asKnown().getOrNull()?.validity() ?: 0)
+ /** The loan balances for the Account. */
+ class Loan
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val dueAt: JsonField,
+ private val dueBalance: JsonField,
+ private val pastDueBalance: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("due_at")
+ @ExcludeMissing
+ dueAt: JsonField = JsonMissing.of(),
+ @JsonProperty("due_balance")
+ @ExcludeMissing
+ dueBalance: JsonField = JsonMissing.of(),
+ @JsonProperty("past_due_balance")
+ @ExcludeMissing
+ pastDueBalance: JsonField = JsonMissing.of(),
+ ) : this(dueAt, dueBalance, pastDueBalance, mutableMapOf())
+
+ /**
+ * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the loan payment is
+ * due.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun dueAt(): Optional = dueAt.getOptional("due_at")
+
+ /**
+ * The total amount due on the loan.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun dueBalance(): Long = dueBalance.getRequired("due_balance")
+
+ /**
+ * The amount past due on the loan.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun pastDueBalance(): Long = pastDueBalance.getRequired("past_due_balance")
+
+ /**
+ * Returns the raw JSON value of [dueAt].
+ *
+ * Unlike [dueAt], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("due_at") @ExcludeMissing fun _dueAt(): JsonField = dueAt
+
+ /**
+ * Returns the raw JSON value of [dueBalance].
+ *
+ * Unlike [dueBalance], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("due_balance") @ExcludeMissing fun _dueBalance(): JsonField = dueBalance
+
+ /**
+ * Returns the raw JSON value of [pastDueBalance].
+ *
+ * Unlike [pastDueBalance], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("past_due_balance")
+ @ExcludeMissing
+ fun _pastDueBalance(): JsonField = pastDueBalance
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [Loan].
+ *
+ * The following fields are required:
+ * ```java
+ * .dueAt()
+ * .dueBalance()
+ * .pastDueBalance()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Loan]. */
+ class Builder internal constructor() {
+
+ private var dueAt: JsonField? = null
+ private var dueBalance: JsonField? = null
+ private var pastDueBalance: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(loan: Loan) = apply {
+ dueAt = loan.dueAt
+ dueBalance = loan.dueBalance
+ pastDueBalance = loan.pastDueBalance
+ additionalProperties = loan.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the loan payment
+ * is due.
+ */
+ fun dueAt(dueAt: OffsetDateTime?) = dueAt(JsonField.ofNullable(dueAt))
+
+ /** Alias for calling [Builder.dueAt] with `dueAt.orElse(null)`. */
+ fun dueAt(dueAt: Optional) = dueAt(dueAt.getOrNull())
+
+ /**
+ * Sets [Builder.dueAt] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.dueAt] with a well-typed [OffsetDateTime] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun dueAt(dueAt: JsonField) = apply { this.dueAt = dueAt }
+
+ /** The total amount due on the loan. */
+ fun dueBalance(dueBalance: Long) = dueBalance(JsonField.of(dueBalance))
+
+ /**
+ * Sets [Builder.dueBalance] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.dueBalance] with a well-typed [Long] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun dueBalance(dueBalance: JsonField) = apply { this.dueBalance = dueBalance }
+
+ /** The amount past due on the loan. */
+ fun pastDueBalance(pastDueBalance: Long) = pastDueBalance(JsonField.of(pastDueBalance))
+
+ /**
+ * Sets [Builder.pastDueBalance] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.pastDueBalance] with a well-typed [Long] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun pastDueBalance(pastDueBalance: JsonField) = apply {
+ this.pastDueBalance = pastDueBalance
+ }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [Loan].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .dueAt()
+ * .dueBalance()
+ * .pastDueBalance()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): Loan =
+ Loan(
+ checkRequired("dueAt", dueAt),
+ checkRequired("dueBalance", dueBalance),
+ checkRequired("pastDueBalance", pastDueBalance),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Loan = apply {
+ if (validated) {
+ return@apply
+ }
+
+ dueAt()
+ dueBalance()
+ pastDueBalance()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: IncreaseInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (dueAt.asKnown().isPresent) 1 else 0) +
+ (if (dueBalance.asKnown().isPresent) 1 else 0) +
+ (if (pastDueBalance.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Loan &&
+ dueAt == other.dueAt &&
+ dueBalance == other.dueBalance &&
+ pastDueBalance == other.pastDueBalance &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(dueAt, dueBalance, pastDueBalance, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Loan{dueAt=$dueAt, dueBalance=$dueBalance, pastDueBalance=$pastDueBalance, additionalProperties=$additionalProperties}"
+ }
+
/**
* A constant representing the object's type. For this resource it will always be
* `balance_lookup`.
@@ -427,16 +723,17 @@ private constructor(
accountId == other.accountId &&
availableBalance == other.availableBalance &&
currentBalance == other.currentBalance &&
+ loan == other.loan &&
type == other.type &&
additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy {
- Objects.hash(accountId, availableBalance, currentBalance, type, additionalProperties)
+ Objects.hash(accountId, availableBalance, currentBalance, loan, type, additionalProperties)
}
override fun hashCode(): Int = hashCode
override fun toString() =
- "BalanceLookup{accountId=$accountId, availableBalance=$availableBalance, currentBalance=$currentBalance, type=$type, additionalProperties=$additionalProperties}"
+ "BalanceLookup{accountId=$accountId, availableBalance=$availableBalance, currentBalance=$currentBalance, loan=$loan, type=$type, additionalProperties=$additionalProperties}"
}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/accountstatements/AccountStatement.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/accountstatements/AccountStatement.kt
index 2d367f4ce..131405744 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/models/accountstatements/AccountStatement.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/accountstatements/AccountStatement.kt
@@ -16,6 +16,7 @@ import com.increase.api.errors.IncreaseInvalidDataException
import java.time.OffsetDateTime
import java.util.Collections
import java.util.Objects
+import java.util.Optional
import kotlin.jvm.optionals.getOrNull
/**
@@ -30,6 +31,7 @@ private constructor(
private val createdAt: JsonField,
private val endingBalance: JsonField,
private val fileId: JsonField,
+ private val loan: JsonField,
private val startingBalance: JsonField,
private val statementPeriodEnd: JsonField,
private val statementPeriodStart: JsonField,
@@ -48,6 +50,7 @@ private constructor(
@ExcludeMissing
endingBalance: JsonField = JsonMissing.of(),
@JsonProperty("file_id") @ExcludeMissing fileId: JsonField = JsonMissing.of(),
+ @JsonProperty("loan") @ExcludeMissing loan: JsonField = JsonMissing.of(),
@JsonProperty("starting_balance")
@ExcludeMissing
startingBalance: JsonField = JsonMissing.of(),
@@ -64,6 +67,7 @@ private constructor(
createdAt,
endingBalance,
fileId,
+ loan,
startingBalance,
statementPeriodEnd,
statementPeriodStart,
@@ -112,6 +116,14 @@ private constructor(
*/
fun fileId(): String = fileId.getRequired("file_id")
+ /**
+ * The loan balances.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun loan(): Optional = loan.getOptional("loan")
+
/**
* The Account's balance at the start of its statement period.
*
@@ -188,6 +200,13 @@ private constructor(
*/
@JsonProperty("file_id") @ExcludeMissing fun _fileId(): JsonField = fileId
+ /**
+ * Returns the raw JSON value of [loan].
+ *
+ * Unlike [loan], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("loan") @ExcludeMissing fun _loan(): JsonField = loan
+
/**
* Returns the raw JSON value of [startingBalance].
*
@@ -248,6 +267,7 @@ private constructor(
* .createdAt()
* .endingBalance()
* .fileId()
+ * .loan()
* .startingBalance()
* .statementPeriodEnd()
* .statementPeriodStart()
@@ -265,6 +285,7 @@ private constructor(
private var createdAt: JsonField? = null
private var endingBalance: JsonField? = null
private var fileId: JsonField? = null
+ private var loan: JsonField? = null
private var startingBalance: JsonField? = null
private var statementPeriodEnd: JsonField? = null
private var statementPeriodStart: JsonField