From 2283e169d17b96dae213c757a5a11290e03f066b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 16 Sep 2025 18:01:29 +0000 Subject: [PATCH 1/2] feat(api): api update --- .stats.yml | 4 +- .../api/models/wiretransfers/WireTransfer.kt | 903 +++++++++++++++- .../wiretransfers/WireTransferCreateParams.kt | 984 ++++++++++++++++-- .../WireTransferCreateParamsTest.kt | 58 +- .../WireTransferListPageResponseTest.kt | 51 + .../models/wiretransfers/WireTransferTest.kt | 54 +- .../async/WireTransferServiceAsyncTest.kt | 19 +- .../blocking/WireTransferServiceTest.kt | 19 +- 8 files changed, 1986 insertions(+), 106 deletions(-) diff --git a/.stats.yml b/.stats.yml index c27c54482..018fcf798 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 217 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-e81b9b39563d895c47a1eceb9fd7cac6bc3f8e6f21c57c1d01ae2cdf360b73ce.yml -openapi_spec_hash: 9eee6e29a9d53623d380e8afae9ef482 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-6d19e08b9b1b9aa23a3a0c86db6eb3500b3a4aaf2d9f549a0177c5bebe67d098.yml +openapi_spec_hash: eec4190f1aca04351de8891c6a9b37da config_hash: e1885b38eded054b77308a024c5d80cc diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/wiretransfers/WireTransfer.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/wiretransfers/WireTransfer.kt index 02e5639d9..7d062e045 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/wiretransfers/WireTransfer.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/wiretransfers/WireTransfer.kt @@ -49,6 +49,7 @@ private constructor( private val originatorAddressLine3: JsonField, private val originatorName: JsonField, private val pendingTransactionId: JsonField, + private val remittance: JsonField, private val reversal: JsonField, private val routingNumber: JsonField, private val sourceAccountNumberId: JsonField, @@ -118,6 +119,9 @@ private constructor( @JsonProperty("pending_transaction_id") @ExcludeMissing pendingTransactionId: JsonField = JsonMissing.of(), + @JsonProperty("remittance") + @ExcludeMissing + remittance: JsonField = JsonMissing.of(), @JsonProperty("reversal") @ExcludeMissing reversal: JsonField = JsonMissing.of(), @JsonProperty("routing_number") @ExcludeMissing @@ -157,6 +161,7 @@ private constructor( originatorAddressLine3, originatorName, pendingTransactionId, + remittance, reversal, routingNumber, sourceAccountNumberId, @@ -308,11 +313,10 @@ private constructor( /** * The message that will show on the recipient's bank statement. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * @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 messageToRecipient(): Optional = - messageToRecipient.getOptional("message_to_recipient") + fun messageToRecipient(): String = messageToRecipient.getRequired("message_to_recipient") /** * The transfer's network. @@ -369,6 +373,14 @@ private constructor( fun pendingTransactionId(): Optional = pendingTransactionId.getOptional("pending_transaction_id") + /** + * Remittance information sent with the wire transfer. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun remittance(): Optional = remittance.getOptional("remittance") + /** * If your transfer is reversed, this will contain details of the reversal. * @@ -630,6 +642,15 @@ private constructor( @ExcludeMissing fun _pendingTransactionId(): JsonField = pendingTransactionId + /** + * Returns the raw JSON value of [remittance]. + * + * Unlike [remittance], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("remittance") + @ExcludeMissing + fun _remittance(): JsonField = remittance + /** * Returns the raw JSON value of [reversal]. * @@ -730,6 +751,7 @@ private constructor( * .originatorAddressLine3() * .originatorName() * .pendingTransactionId() + * .remittance() * .reversal() * .routingNumber() * .sourceAccountNumberId() @@ -768,6 +790,7 @@ private constructor( private var originatorAddressLine3: JsonField? = null private var originatorName: JsonField? = null private var pendingTransactionId: JsonField? = null + private var remittance: JsonField? = null private var reversal: JsonField? = null private var routingNumber: JsonField? = null private var sourceAccountNumberId: JsonField? = null @@ -802,6 +825,7 @@ private constructor( originatorAddressLine3 = wireTransfer.originatorAddressLine3 originatorName = wireTransfer.originatorName pendingTransactionId = wireTransfer.pendingTransactionId + remittance = wireTransfer.remittance reversal = wireTransfer.reversal routingNumber = wireTransfer.routingNumber sourceAccountNumberId = wireTransfer.sourceAccountNumberId @@ -1097,14 +1121,8 @@ private constructor( } /** The message that will show on the recipient's bank statement. */ - fun messageToRecipient(messageToRecipient: String?) = - messageToRecipient(JsonField.ofNullable(messageToRecipient)) - - /** - * Alias for calling [Builder.messageToRecipient] with `messageToRecipient.orElse(null)`. - */ - fun messageToRecipient(messageToRecipient: Optional) = - messageToRecipient(messageToRecipient.getOrNull()) + fun messageToRecipient(messageToRecipient: String) = + messageToRecipient(JsonField.of(messageToRecipient)) /** * Sets [Builder.messageToRecipient] to an arbitrary JSON value. @@ -1240,6 +1258,21 @@ private constructor( this.pendingTransactionId = pendingTransactionId } + /** Remittance information sent with the wire transfer. */ + fun remittance(remittance: Remittance?) = remittance(JsonField.ofNullable(remittance)) + + /** Alias for calling [Builder.remittance] with `remittance.orElse(null)`. */ + fun remittance(remittance: Optional) = remittance(remittance.getOrNull()) + + /** + * Sets [Builder.remittance] to an arbitrary JSON value. + * + * You should usually call [Builder.remittance] with a well-typed [Remittance] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun remittance(remittance: JsonField) = apply { this.remittance = remittance } + /** If your transfer is reversed, this will contain details of the reversal. */ fun reversal(reversal: Reversal?) = reversal(JsonField.ofNullable(reversal)) @@ -1399,6 +1432,7 @@ private constructor( * .originatorAddressLine3() * .originatorName() * .pendingTransactionId() + * .remittance() * .reversal() * .routingNumber() * .sourceAccountNumberId() @@ -1435,6 +1469,7 @@ private constructor( checkRequired("originatorAddressLine3", originatorAddressLine3), checkRequired("originatorName", originatorName), checkRequired("pendingTransactionId", pendingTransactionId), + checkRequired("remittance", remittance), checkRequired("reversal", reversal), checkRequired("routingNumber", routingNumber), checkRequired("sourceAccountNumberId", sourceAccountNumberId), @@ -1476,6 +1511,7 @@ private constructor( originatorAddressLine3() originatorName() pendingTransactionId() + remittance().ifPresent { it.validate() } reversal().ifPresent { it.validate() } routingNumber() sourceAccountNumberId() @@ -1524,6 +1560,7 @@ private constructor( (if (originatorAddressLine3.asKnown().isPresent) 1 else 0) + (if (originatorName.asKnown().isPresent) 1 else 0) + (if (pendingTransactionId.asKnown().isPresent) 1 else 0) + + (remittance.asKnown().getOrNull()?.validity() ?: 0) + (reversal.asKnown().getOrNull()?.validity() ?: 0) + (if (routingNumber.asKnown().isPresent) 1 else 0) + (if (sourceAccountNumberId.asKnown().isPresent) 1 else 0) + @@ -3223,6 +3260,844 @@ private constructor( override fun toString() = value.toString() } + /** Remittance information sent with the wire transfer. */ + class Remittance + private constructor( + private val category: JsonField, + private val tax: JsonField, + private val unstructured: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("category") + @ExcludeMissing + category: JsonField = JsonMissing.of(), + @JsonProperty("tax") @ExcludeMissing tax: JsonField = JsonMissing.of(), + @JsonProperty("unstructured") + @ExcludeMissing + unstructured: JsonField = JsonMissing.of(), + ) : this(category, tax, unstructured, mutableMapOf()) + + /** + * The type of remittance information being passed. + * + * @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 category(): Category = category.getRequired("category") + + /** + * Internal Revenue Service (IRS) tax repayment information. Required if `category` is equal + * to `tax`. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun tax(): Optional = tax.getOptional("tax") + + /** + * Unstructured remittance information. Required if `category` is equal to `unstructured`. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun unstructured(): Optional = unstructured.getOptional("unstructured") + + /** + * Returns the raw JSON value of [category]. + * + * Unlike [category], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("category") @ExcludeMissing fun _category(): JsonField = category + + /** + * Returns the raw JSON value of [tax]. + * + * Unlike [tax], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tax") @ExcludeMissing fun _tax(): JsonField = tax + + /** + * Returns the raw JSON value of [unstructured]. + * + * Unlike [unstructured], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("unstructured") + @ExcludeMissing + fun _unstructured(): JsonField = unstructured + + @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 [Remittance]. + * + * The following fields are required: + * ```java + * .category() + * .tax() + * .unstructured() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Remittance]. */ + class Builder internal constructor() { + + private var category: JsonField? = null + private var tax: JsonField? = null + private var unstructured: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(remittance: Remittance) = apply { + category = remittance.category + tax = remittance.tax + unstructured = remittance.unstructured + additionalProperties = remittance.additionalProperties.toMutableMap() + } + + /** The type of remittance information being passed. */ + fun category(category: Category) = category(JsonField.of(category)) + + /** + * Sets [Builder.category] to an arbitrary JSON value. + * + * You should usually call [Builder.category] with a well-typed [Category] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun category(category: JsonField) = apply { this.category = category } + + /** + * Internal Revenue Service (IRS) tax repayment information. Required if `category` is + * equal to `tax`. + */ + fun tax(tax: Tax?) = tax(JsonField.ofNullable(tax)) + + /** Alias for calling [Builder.tax] with `tax.orElse(null)`. */ + fun tax(tax: Optional) = tax(tax.getOrNull()) + + /** + * Sets [Builder.tax] to an arbitrary JSON value. + * + * You should usually call [Builder.tax] with a well-typed [Tax] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun tax(tax: JsonField) = apply { this.tax = tax } + + /** + * Unstructured remittance information. Required if `category` is equal to + * `unstructured`. + */ + fun unstructured(unstructured: Unstructured?) = + unstructured(JsonField.ofNullable(unstructured)) + + /** Alias for calling [Builder.unstructured] with `unstructured.orElse(null)`. */ + fun unstructured(unstructured: Optional) = + unstructured(unstructured.getOrNull()) + + /** + * Sets [Builder.unstructured] to an arbitrary JSON value. + * + * You should usually call [Builder.unstructured] with a well-typed [Unstructured] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun unstructured(unstructured: JsonField) = apply { + this.unstructured = unstructured + } + + 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 [Remittance]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .category() + * .tax() + * .unstructured() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Remittance = + Remittance( + checkRequired("category", category), + checkRequired("tax", tax), + checkRequired("unstructured", unstructured), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Remittance = apply { + if (validated) { + return@apply + } + + category().validate() + tax().ifPresent { it.validate() } + unstructured().ifPresent { it.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 = + (category.asKnown().getOrNull()?.validity() ?: 0) + + (tax.asKnown().getOrNull()?.validity() ?: 0) + + (unstructured.asKnown().getOrNull()?.validity() ?: 0) + + /** The type of remittance information being passed. */ + class Category @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 wire transfer contains unstructured remittance information. */ + @JvmField val UNSTRUCTURED = of("unstructured") + + /** + * The wire transfer is for tax payment purposes to the Internal Revenue Service + * (IRS). + */ + @JvmField val TAX = of("tax") + + @JvmStatic fun of(value: String) = Category(JsonField.of(value)) + } + + /** An enum containing [Category]'s known values. */ + enum class Known { + /** The wire transfer contains unstructured remittance information. */ + UNSTRUCTURED, + /** + * The wire transfer is for tax payment purposes to the Internal Revenue Service + * (IRS). + */ + TAX, + } + + /** + * An enum containing [Category]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Category] 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 wire transfer contains unstructured remittance information. */ + UNSTRUCTURED, + /** + * The wire transfer is for tax payment purposes to the Internal Revenue Service + * (IRS). + */ + TAX, + /** + * An enum member indicating that [Category] 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) { + UNSTRUCTURED -> Value.UNSTRUCTURED + TAX -> Value.TAX + 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) { + UNSTRUCTURED -> Known.UNSTRUCTURED + TAX -> Known.TAX + else -> throw IncreaseInvalidDataException("Unknown Category: $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(): Category = 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 Category && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * Internal Revenue Service (IRS) tax repayment information. Required if `category` is equal + * to `tax`. + */ + class Tax + private constructor( + private val date: JsonField, + private val identificationNumber: JsonField, + private val typeCode: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("date") @ExcludeMissing date: JsonField = JsonMissing.of(), + @JsonProperty("identification_number") + @ExcludeMissing + identificationNumber: JsonField = JsonMissing.of(), + @JsonProperty("type_code") + @ExcludeMissing + typeCode: JsonField = JsonMissing.of(), + ) : this(date, identificationNumber, typeCode, mutableMapOf()) + + /** + * The month and year the tax payment is for, in YYYY-MM-DD format. The day is ignored. + * + * @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 date(): LocalDate = date.getRequired("date") + + /** + * The 9-digit Tax Identification Number (TIN) or Employer Identification Number (EIN). + * + * @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 identificationNumber(): String = + identificationNumber.getRequired("identification_number") + + /** + * The 5-character tax type code. + * + * @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 typeCode(): String = typeCode.getRequired("type_code") + + /** + * Returns the raw JSON value of [date]. + * + * Unlike [date], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("date") @ExcludeMissing fun _date(): JsonField = date + + /** + * Returns the raw JSON value of [identificationNumber]. + * + * Unlike [identificationNumber], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("identification_number") + @ExcludeMissing + fun _identificationNumber(): JsonField = identificationNumber + + /** + * Returns the raw JSON value of [typeCode]. + * + * Unlike [typeCode], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("type_code") @ExcludeMissing fun _typeCode(): JsonField = typeCode + + @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 [Tax]. + * + * The following fields are required: + * ```java + * .date() + * .identificationNumber() + * .typeCode() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Tax]. */ + class Builder internal constructor() { + + private var date: JsonField? = null + private var identificationNumber: JsonField? = null + private var typeCode: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(tax: Tax) = apply { + date = tax.date + identificationNumber = tax.identificationNumber + typeCode = tax.typeCode + additionalProperties = tax.additionalProperties.toMutableMap() + } + + /** + * The month and year the tax payment is for, in YYYY-MM-DD format. The day is + * ignored. + */ + fun date(date: LocalDate) = date(JsonField.of(date)) + + /** + * Sets [Builder.date] to an arbitrary JSON value. + * + * You should usually call [Builder.date] with a well-typed [LocalDate] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun date(date: JsonField) = apply { this.date = date } + + /** + * The 9-digit Tax Identification Number (TIN) or Employer Identification Number + * (EIN). + */ + fun identificationNumber(identificationNumber: String) = + identificationNumber(JsonField.of(identificationNumber)) + + /** + * Sets [Builder.identificationNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.identificationNumber] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun identificationNumber(identificationNumber: JsonField) = apply { + this.identificationNumber = identificationNumber + } + + /** The 5-character tax type code. */ + fun typeCode(typeCode: String) = typeCode(JsonField.of(typeCode)) + + /** + * Sets [Builder.typeCode] to an arbitrary JSON value. + * + * You should usually call [Builder.typeCode] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun typeCode(typeCode: JsonField) = apply { this.typeCode = typeCode } + + 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 [Tax]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .date() + * .identificationNumber() + * .typeCode() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Tax = + Tax( + checkRequired("date", date), + checkRequired("identificationNumber", identificationNumber), + checkRequired("typeCode", typeCode), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Tax = apply { + if (validated) { + return@apply + } + + date() + identificationNumber() + typeCode() + 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 (date.asKnown().isPresent) 1 else 0) + + (if (identificationNumber.asKnown().isPresent) 1 else 0) + + (if (typeCode.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Tax && + date == other.date && + identificationNumber == other.identificationNumber && + typeCode == other.typeCode && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(date, identificationNumber, typeCode, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Tax{date=$date, identificationNumber=$identificationNumber, typeCode=$typeCode, additionalProperties=$additionalProperties}" + } + + /** + * Unstructured remittance information. Required if `category` is equal to `unstructured`. + */ + class Unstructured + private constructor( + private val message: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("message") + @ExcludeMissing + message: JsonField = JsonMissing.of() + ) : this(message, mutableMapOf()) + + /** + * The message to the beneficiary. + * + * @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 message(): String = message.getRequired("message") + + /** + * Returns the raw JSON value of [message]. + * + * Unlike [message], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("message") @ExcludeMissing fun _message(): JsonField = message + + @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 [Unstructured]. + * + * The following fields are required: + * ```java + * .message() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Unstructured]. */ + class Builder internal constructor() { + + private var message: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(unstructured: Unstructured) = apply { + message = unstructured.message + additionalProperties = unstructured.additionalProperties.toMutableMap() + } + + /** The message to the beneficiary. */ + fun message(message: String) = message(JsonField.of(message)) + + /** + * Sets [Builder.message] to an arbitrary JSON value. + * + * You should usually call [Builder.message] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun message(message: JsonField) = apply { this.message = message } + + 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 [Unstructured]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .message() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Unstructured = + Unstructured( + checkRequired("message", message), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Unstructured = apply { + if (validated) { + return@apply + } + + message() + 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 (message.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Unstructured && + message == other.message && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(message, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Unstructured{message=$message, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Remittance && + category == other.category && + tax == other.tax && + unstructured == other.unstructured && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(category, tax, unstructured, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Remittance{category=$category, tax=$tax, unstructured=$unstructured, additionalProperties=$additionalProperties}" + } + /** If your transfer is reversed, this will contain details of the reversal. */ class Reversal private constructor( @@ -4626,6 +5501,7 @@ private constructor( originatorAddressLine3 == other.originatorAddressLine3 && originatorName == other.originatorName && pendingTransactionId == other.pendingTransactionId && + remittance == other.remittance && reversal == other.reversal && routingNumber == other.routingNumber && sourceAccountNumberId == other.sourceAccountNumberId && @@ -4661,6 +5537,7 @@ private constructor( originatorAddressLine3, originatorName, pendingTransactionId, + remittance, reversal, routingNumber, sourceAccountNumberId, @@ -4675,5 +5552,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "WireTransfer{id=$id, accountId=$accountId, accountNumber=$accountNumber, amount=$amount, approval=$approval, beneficiaryAddressLine1=$beneficiaryAddressLine1, beneficiaryAddressLine2=$beneficiaryAddressLine2, beneficiaryAddressLine3=$beneficiaryAddressLine3, beneficiaryName=$beneficiaryName, cancellation=$cancellation, createdAt=$createdAt, createdBy=$createdBy, currency=$currency, externalAccountId=$externalAccountId, idempotencyKey=$idempotencyKey, inboundWireDrawdownRequestId=$inboundWireDrawdownRequestId, messageToRecipient=$messageToRecipient, network=$network, originatorAddressLine1=$originatorAddressLine1, originatorAddressLine2=$originatorAddressLine2, originatorAddressLine3=$originatorAddressLine3, originatorName=$originatorName, pendingTransactionId=$pendingTransactionId, reversal=$reversal, routingNumber=$routingNumber, sourceAccountNumberId=$sourceAccountNumberId, status=$status, submission=$submission, transactionId=$transactionId, type=$type, additionalProperties=$additionalProperties}" + "WireTransfer{id=$id, accountId=$accountId, accountNumber=$accountNumber, amount=$amount, approval=$approval, beneficiaryAddressLine1=$beneficiaryAddressLine1, beneficiaryAddressLine2=$beneficiaryAddressLine2, beneficiaryAddressLine3=$beneficiaryAddressLine3, beneficiaryName=$beneficiaryName, cancellation=$cancellation, createdAt=$createdAt, createdBy=$createdBy, currency=$currency, externalAccountId=$externalAccountId, idempotencyKey=$idempotencyKey, inboundWireDrawdownRequestId=$inboundWireDrawdownRequestId, messageToRecipient=$messageToRecipient, network=$network, originatorAddressLine1=$originatorAddressLine1, originatorAddressLine2=$originatorAddressLine2, originatorAddressLine3=$originatorAddressLine3, originatorName=$originatorName, pendingTransactionId=$pendingTransactionId, remittance=$remittance, reversal=$reversal, routingNumber=$routingNumber, sourceAccountNumberId=$sourceAccountNumberId, status=$status, submission=$submission, transactionId=$transactionId, type=$type, additionalProperties=$additionalProperties}" } diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/wiretransfers/WireTransferCreateParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/wiretransfers/WireTransferCreateParams.kt index e7858351e..68f0c27db 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/wiretransfers/WireTransferCreateParams.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/wiretransfers/WireTransferCreateParams.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 a Wire Transfer */ class WireTransferCreateParams @@ -51,14 +54,6 @@ private constructor( */ fun beneficiaryName(): String = body.beneficiaryName() - /** - * The message that will show on the recipient's bank statement. - * - * @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 messageToRecipient(): String = body.messageToRecipient() - /** * The account number for the destination account. * @@ -144,6 +139,14 @@ private constructor( */ fun originatorName(): Optional = body.originatorName() + /** + * Additional remittance information related to the wire transfer. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun remittance(): Optional = body.remittance() + /** * Whether the transfer requires explicit approval via the dashboard or API. * @@ -190,14 +193,6 @@ private constructor( */ fun _beneficiaryName(): JsonField = body._beneficiaryName() - /** - * Returns the raw JSON value of [messageToRecipient]. - * - * Unlike [messageToRecipient], this method doesn't throw if the JSON field has an unexpected - * type. - */ - fun _messageToRecipient(): JsonField = body._messageToRecipient() - /** * Returns the raw JSON value of [accountNumber]. * @@ -276,6 +271,13 @@ private constructor( */ fun _originatorName(): JsonField = body._originatorName() + /** + * Returns the raw JSON value of [remittance]. + * + * Unlike [remittance], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _remittance(): JsonField = body._remittance() + /** * Returns the raw JSON value of [requireApproval]. * @@ -318,7 +320,6 @@ private constructor( * .accountId() * .amount() * .beneficiaryName() - * .messageToRecipient() * ``` */ @JvmStatic fun builder() = Builder() @@ -346,8 +347,8 @@ private constructor( * - [accountId] * - [amount] * - [beneficiaryName] - * - [messageToRecipient] * - [accountNumber] + * - [beneficiaryAddressLine1] * - etc. */ fun body(body: Body) = apply { this.body = body.toBuilder() } @@ -391,22 +392,6 @@ private constructor( body.beneficiaryName(beneficiaryName) } - /** The message that will show on the recipient's bank statement. */ - fun messageToRecipient(messageToRecipient: String) = apply { - body.messageToRecipient(messageToRecipient) - } - - /** - * Sets [Builder.messageToRecipient] to an arbitrary JSON value. - * - * You should usually call [Builder.messageToRecipient] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun messageToRecipient(messageToRecipient: JsonField) = apply { - body.messageToRecipient(messageToRecipient) - } - /** The account number for the destination account. */ fun accountNumber(accountNumber: String) = apply { body.accountNumber(accountNumber) } @@ -581,6 +566,18 @@ private constructor( body.originatorName(originatorName) } + /** Additional remittance information related to the wire transfer. */ + fun remittance(remittance: Remittance) = apply { body.remittance(remittance) } + + /** + * Sets [Builder.remittance] to an arbitrary JSON value. + * + * You should usually call [Builder.remittance] with a well-typed [Remittance] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun remittance(remittance: JsonField) = apply { body.remittance(remittance) } + /** Whether the transfer requires explicit approval via the dashboard or API. */ fun requireApproval(requireApproval: Boolean) = apply { body.requireApproval(requireApproval) @@ -757,7 +754,6 @@ private constructor( * .accountId() * .amount() * .beneficiaryName() - * .messageToRecipient() * ``` * * @throws IllegalStateException if any required field is unset. @@ -781,7 +777,6 @@ private constructor( private val accountId: JsonField, private val amount: JsonField, private val beneficiaryName: JsonField, - private val messageToRecipient: JsonField, private val accountNumber: JsonField, private val beneficiaryAddressLine1: JsonField, private val beneficiaryAddressLine2: JsonField, @@ -792,6 +787,7 @@ private constructor( private val originatorAddressLine2: JsonField, private val originatorAddressLine3: JsonField, private val originatorName: JsonField, + private val remittance: JsonField, private val requireApproval: JsonField, private val routingNumber: JsonField, private val sourceAccountNumberId: JsonField, @@ -807,9 +803,6 @@ private constructor( @JsonProperty("beneficiary_name") @ExcludeMissing beneficiaryName: JsonField = JsonMissing.of(), - @JsonProperty("message_to_recipient") - @ExcludeMissing - messageToRecipient: JsonField = JsonMissing.of(), @JsonProperty("account_number") @ExcludeMissing accountNumber: JsonField = JsonMissing.of(), @@ -840,6 +833,9 @@ private constructor( @JsonProperty("originator_name") @ExcludeMissing originatorName: JsonField = JsonMissing.of(), + @JsonProperty("remittance") + @ExcludeMissing + remittance: JsonField = JsonMissing.of(), @JsonProperty("require_approval") @ExcludeMissing requireApproval: JsonField = JsonMissing.of(), @@ -853,7 +849,6 @@ private constructor( accountId, amount, beneficiaryName, - messageToRecipient, accountNumber, beneficiaryAddressLine1, beneficiaryAddressLine2, @@ -864,6 +859,7 @@ private constructor( originatorAddressLine2, originatorAddressLine3, originatorName, + remittance, requireApproval, routingNumber, sourceAccountNumberId, @@ -894,14 +890,6 @@ private constructor( */ fun beneficiaryName(): String = beneficiaryName.getRequired("beneficiary_name") - /** - * The message that will show on the recipient's bank statement. - * - * @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 messageToRecipient(): String = messageToRecipient.getRequired("message_to_recipient") - /** * The account number for the destination account. * @@ -996,6 +984,14 @@ private constructor( */ fun originatorName(): Optional = originatorName.getOptional("originator_name") + /** + * Additional remittance information related to the wire transfer. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun remittance(): Optional = remittance.getOptional("remittance") + /** * Whether the transfer requires explicit approval via the dashboard or API. * @@ -1046,16 +1042,6 @@ private constructor( @ExcludeMissing fun _beneficiaryName(): JsonField = beneficiaryName - /** - * Returns the raw JSON value of [messageToRecipient]. - * - * Unlike [messageToRecipient], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("message_to_recipient") - @ExcludeMissing - fun _messageToRecipient(): JsonField = messageToRecipient - /** * Returns the raw JSON value of [accountNumber]. * @@ -1156,6 +1142,15 @@ private constructor( @ExcludeMissing fun _originatorName(): JsonField = originatorName + /** + * Returns the raw JSON value of [remittance]. + * + * Unlike [remittance], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("remittance") + @ExcludeMissing + fun _remittance(): JsonField = remittance + /** * Returns the raw JSON value of [requireApproval]. * @@ -1208,7 +1203,6 @@ private constructor( * .accountId() * .amount() * .beneficiaryName() - * .messageToRecipient() * ``` */ @JvmStatic fun builder() = Builder() @@ -1220,7 +1214,6 @@ private constructor( private var accountId: JsonField? = null private var amount: JsonField? = null private var beneficiaryName: JsonField? = null - private var messageToRecipient: JsonField? = null private var accountNumber: JsonField = JsonMissing.of() private var beneficiaryAddressLine1: JsonField = JsonMissing.of() private var beneficiaryAddressLine2: JsonField = JsonMissing.of() @@ -1231,6 +1224,7 @@ private constructor( private var originatorAddressLine2: JsonField = JsonMissing.of() private var originatorAddressLine3: JsonField = JsonMissing.of() private var originatorName: JsonField = JsonMissing.of() + private var remittance: JsonField = JsonMissing.of() private var requireApproval: JsonField = JsonMissing.of() private var routingNumber: JsonField = JsonMissing.of() private var sourceAccountNumberId: JsonField = JsonMissing.of() @@ -1241,7 +1235,6 @@ private constructor( accountId = body.accountId amount = body.amount beneficiaryName = body.beneficiaryName - messageToRecipient = body.messageToRecipient accountNumber = body.accountNumber beneficiaryAddressLine1 = body.beneficiaryAddressLine1 beneficiaryAddressLine2 = body.beneficiaryAddressLine2 @@ -1252,6 +1245,7 @@ private constructor( originatorAddressLine2 = body.originatorAddressLine2 originatorAddressLine3 = body.originatorAddressLine3 originatorName = body.originatorName + remittance = body.remittance requireApproval = body.requireApproval routingNumber = body.routingNumber sourceAccountNumberId = body.sourceAccountNumberId @@ -1297,21 +1291,6 @@ private constructor( this.beneficiaryName = beneficiaryName } - /** The message that will show on the recipient's bank statement. */ - fun messageToRecipient(messageToRecipient: String) = - messageToRecipient(JsonField.of(messageToRecipient)) - - /** - * Sets [Builder.messageToRecipient] to an arbitrary JSON value. - * - * You should usually call [Builder.messageToRecipient] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun messageToRecipient(messageToRecipient: JsonField) = apply { - this.messageToRecipient = messageToRecipient - } - /** The account number for the destination account. */ fun accountNumber(accountNumber: String) = accountNumber(JsonField.of(accountNumber)) @@ -1480,6 +1459,20 @@ private constructor( this.originatorName = originatorName } + /** Additional remittance information related to the wire transfer. */ + fun remittance(remittance: Remittance) = remittance(JsonField.of(remittance)) + + /** + * Sets [Builder.remittance] to an arbitrary JSON value. + * + * You should usually call [Builder.remittance] with a well-typed [Remittance] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun remittance(remittance: JsonField) = apply { + this.remittance = remittance + } + /** Whether the transfer requires explicit approval via the dashboard or API. */ fun requireApproval(requireApproval: Boolean) = requireApproval(JsonField.of(requireApproval)) @@ -1556,7 +1549,6 @@ private constructor( * .accountId() * .amount() * .beneficiaryName() - * .messageToRecipient() * ``` * * @throws IllegalStateException if any required field is unset. @@ -1566,7 +1558,6 @@ private constructor( checkRequired("accountId", accountId), checkRequired("amount", amount), checkRequired("beneficiaryName", beneficiaryName), - checkRequired("messageToRecipient", messageToRecipient), accountNumber, beneficiaryAddressLine1, beneficiaryAddressLine2, @@ -1577,6 +1568,7 @@ private constructor( originatorAddressLine2, originatorAddressLine3, originatorName, + remittance, requireApproval, routingNumber, sourceAccountNumberId, @@ -1594,7 +1586,6 @@ private constructor( accountId() amount() beneficiaryName() - messageToRecipient() accountNumber() beneficiaryAddressLine1() beneficiaryAddressLine2() @@ -1605,6 +1596,7 @@ private constructor( originatorAddressLine2() originatorAddressLine3() originatorName() + remittance().ifPresent { it.validate() } requireApproval() routingNumber() sourceAccountNumberId() @@ -1630,7 +1622,6 @@ private constructor( (if (accountId.asKnown().isPresent) 1 else 0) + (if (amount.asKnown().isPresent) 1 else 0) + (if (beneficiaryName.asKnown().isPresent) 1 else 0) + - (if (messageToRecipient.asKnown().isPresent) 1 else 0) + (if (accountNumber.asKnown().isPresent) 1 else 0) + (if (beneficiaryAddressLine1.asKnown().isPresent) 1 else 0) + (if (beneficiaryAddressLine2.asKnown().isPresent) 1 else 0) + @@ -1641,6 +1632,7 @@ private constructor( (if (originatorAddressLine2.asKnown().isPresent) 1 else 0) + (if (originatorAddressLine3.asKnown().isPresent) 1 else 0) + (if (originatorName.asKnown().isPresent) 1 else 0) + + (remittance.asKnown().getOrNull()?.validity() ?: 0) + (if (requireApproval.asKnown().isPresent) 1 else 0) + (if (routingNumber.asKnown().isPresent) 1 else 0) + (if (sourceAccountNumberId.asKnown().isPresent) 1 else 0) @@ -1654,7 +1646,6 @@ private constructor( accountId == other.accountId && amount == other.amount && beneficiaryName == other.beneficiaryName && - messageToRecipient == other.messageToRecipient && accountNumber == other.accountNumber && beneficiaryAddressLine1 == other.beneficiaryAddressLine1 && beneficiaryAddressLine2 == other.beneficiaryAddressLine2 && @@ -1665,6 +1656,7 @@ private constructor( originatorAddressLine2 == other.originatorAddressLine2 && originatorAddressLine3 == other.originatorAddressLine3 && originatorName == other.originatorName && + remittance == other.remittance && requireApproval == other.requireApproval && routingNumber == other.routingNumber && sourceAccountNumberId == other.sourceAccountNumberId && @@ -1676,7 +1668,6 @@ private constructor( accountId, amount, beneficiaryName, - messageToRecipient, accountNumber, beneficiaryAddressLine1, beneficiaryAddressLine2, @@ -1687,6 +1678,7 @@ private constructor( originatorAddressLine2, originatorAddressLine3, originatorName, + remittance, requireApproval, routingNumber, sourceAccountNumberId, @@ -1697,7 +1689,833 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Body{accountId=$accountId, amount=$amount, beneficiaryName=$beneficiaryName, messageToRecipient=$messageToRecipient, accountNumber=$accountNumber, beneficiaryAddressLine1=$beneficiaryAddressLine1, beneficiaryAddressLine2=$beneficiaryAddressLine2, beneficiaryAddressLine3=$beneficiaryAddressLine3, externalAccountId=$externalAccountId, inboundWireDrawdownRequestId=$inboundWireDrawdownRequestId, originatorAddressLine1=$originatorAddressLine1, originatorAddressLine2=$originatorAddressLine2, originatorAddressLine3=$originatorAddressLine3, originatorName=$originatorName, requireApproval=$requireApproval, routingNumber=$routingNumber, sourceAccountNumberId=$sourceAccountNumberId, additionalProperties=$additionalProperties}" + "Body{accountId=$accountId, amount=$amount, beneficiaryName=$beneficiaryName, accountNumber=$accountNumber, beneficiaryAddressLine1=$beneficiaryAddressLine1, beneficiaryAddressLine2=$beneficiaryAddressLine2, beneficiaryAddressLine3=$beneficiaryAddressLine3, externalAccountId=$externalAccountId, inboundWireDrawdownRequestId=$inboundWireDrawdownRequestId, originatorAddressLine1=$originatorAddressLine1, originatorAddressLine2=$originatorAddressLine2, originatorAddressLine3=$originatorAddressLine3, originatorName=$originatorName, remittance=$remittance, requireApproval=$requireApproval, routingNumber=$routingNumber, sourceAccountNumberId=$sourceAccountNumberId, additionalProperties=$additionalProperties}" + } + + /** Additional remittance information related to the wire transfer. */ + class Remittance + private constructor( + private val category: JsonField, + private val tax: JsonField, + private val unstructured: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("category") + @ExcludeMissing + category: JsonField = JsonMissing.of(), + @JsonProperty("tax") @ExcludeMissing tax: JsonField = JsonMissing.of(), + @JsonProperty("unstructured") + @ExcludeMissing + unstructured: JsonField = JsonMissing.of(), + ) : this(category, tax, unstructured, mutableMapOf()) + + /** + * The type of remittance information being passed. + * + * @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 category(): Category = category.getRequired("category") + + /** + * Internal Revenue Service (IRS) tax repayment information. Required if `category` is equal + * to `tax`. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun tax(): Optional = tax.getOptional("tax") + + /** + * Unstructured remittance information. Required if `category` is equal to `unstructured`. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun unstructured(): Optional = unstructured.getOptional("unstructured") + + /** + * Returns the raw JSON value of [category]. + * + * Unlike [category], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("category") @ExcludeMissing fun _category(): JsonField = category + + /** + * Returns the raw JSON value of [tax]. + * + * Unlike [tax], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tax") @ExcludeMissing fun _tax(): JsonField = tax + + /** + * Returns the raw JSON value of [unstructured]. + * + * Unlike [unstructured], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("unstructured") + @ExcludeMissing + fun _unstructured(): JsonField = unstructured + + @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 [Remittance]. + * + * The following fields are required: + * ```java + * .category() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Remittance]. */ + class Builder internal constructor() { + + private var category: JsonField? = null + private var tax: JsonField = JsonMissing.of() + private var unstructured: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(remittance: Remittance) = apply { + category = remittance.category + tax = remittance.tax + unstructured = remittance.unstructured + additionalProperties = remittance.additionalProperties.toMutableMap() + } + + /** The type of remittance information being passed. */ + fun category(category: Category) = category(JsonField.of(category)) + + /** + * Sets [Builder.category] to an arbitrary JSON value. + * + * You should usually call [Builder.category] with a well-typed [Category] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun category(category: JsonField) = apply { this.category = category } + + /** + * Internal Revenue Service (IRS) tax repayment information. Required if `category` is + * equal to `tax`. + */ + fun tax(tax: Tax) = tax(JsonField.of(tax)) + + /** + * Sets [Builder.tax] to an arbitrary JSON value. + * + * You should usually call [Builder.tax] with a well-typed [Tax] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun tax(tax: JsonField) = apply { this.tax = tax } + + /** + * Unstructured remittance information. Required if `category` is equal to + * `unstructured`. + */ + fun unstructured(unstructured: Unstructured) = unstructured(JsonField.of(unstructured)) + + /** + * Sets [Builder.unstructured] to an arbitrary JSON value. + * + * You should usually call [Builder.unstructured] with a well-typed [Unstructured] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun unstructured(unstructured: JsonField) = apply { + this.unstructured = unstructured + } + + 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 [Remittance]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .category() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Remittance = + Remittance( + checkRequired("category", category), + tax, + unstructured, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Remittance = apply { + if (validated) { + return@apply + } + + category().validate() + tax().ifPresent { it.validate() } + unstructured().ifPresent { it.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 = + (category.asKnown().getOrNull()?.validity() ?: 0) + + (tax.asKnown().getOrNull()?.validity() ?: 0) + + (unstructured.asKnown().getOrNull()?.validity() ?: 0) + + /** The type of remittance information being passed. */ + class Category @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 wire transfer contains unstructured remittance information. */ + @JvmField val UNSTRUCTURED = of("unstructured") + + /** + * The wire transfer is for tax payment purposes to the Internal Revenue Service + * (IRS). + */ + @JvmField val TAX = of("tax") + + @JvmStatic fun of(value: String) = Category(JsonField.of(value)) + } + + /** An enum containing [Category]'s known values. */ + enum class Known { + /** The wire transfer contains unstructured remittance information. */ + UNSTRUCTURED, + /** + * The wire transfer is for tax payment purposes to the Internal Revenue Service + * (IRS). + */ + TAX, + } + + /** + * An enum containing [Category]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Category] 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 wire transfer contains unstructured remittance information. */ + UNSTRUCTURED, + /** + * The wire transfer is for tax payment purposes to the Internal Revenue Service + * (IRS). + */ + TAX, + /** + * An enum member indicating that [Category] 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) { + UNSTRUCTURED -> Value.UNSTRUCTURED + TAX -> Value.TAX + 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) { + UNSTRUCTURED -> Known.UNSTRUCTURED + TAX -> Known.TAX + else -> throw IncreaseInvalidDataException("Unknown Category: $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(): Category = 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 Category && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * Internal Revenue Service (IRS) tax repayment information. Required if `category` is equal + * to `tax`. + */ + class Tax + private constructor( + private val date: JsonField, + private val identificationNumber: JsonField, + private val typeCode: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("date") @ExcludeMissing date: JsonField = JsonMissing.of(), + @JsonProperty("identification_number") + @ExcludeMissing + identificationNumber: JsonField = JsonMissing.of(), + @JsonProperty("type_code") + @ExcludeMissing + typeCode: JsonField = JsonMissing.of(), + ) : this(date, identificationNumber, typeCode, mutableMapOf()) + + /** + * The month and year the tax payment is for, in YYYY-MM-DD format. The day is ignored. + * + * @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 date(): LocalDate = date.getRequired("date") + + /** + * The 9-digit Tax Identification Number (TIN) or Employer Identification Number (EIN). + * + * @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 identificationNumber(): String = + identificationNumber.getRequired("identification_number") + + /** + * The 5-character tax type code. + * + * @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 typeCode(): String = typeCode.getRequired("type_code") + + /** + * Returns the raw JSON value of [date]. + * + * Unlike [date], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("date") @ExcludeMissing fun _date(): JsonField = date + + /** + * Returns the raw JSON value of [identificationNumber]. + * + * Unlike [identificationNumber], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("identification_number") + @ExcludeMissing + fun _identificationNumber(): JsonField = identificationNumber + + /** + * Returns the raw JSON value of [typeCode]. + * + * Unlike [typeCode], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("type_code") @ExcludeMissing fun _typeCode(): JsonField = typeCode + + @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 [Tax]. + * + * The following fields are required: + * ```java + * .date() + * .identificationNumber() + * .typeCode() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Tax]. */ + class Builder internal constructor() { + + private var date: JsonField? = null + private var identificationNumber: JsonField? = null + private var typeCode: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(tax: Tax) = apply { + date = tax.date + identificationNumber = tax.identificationNumber + typeCode = tax.typeCode + additionalProperties = tax.additionalProperties.toMutableMap() + } + + /** + * The month and year the tax payment is for, in YYYY-MM-DD format. The day is + * ignored. + */ + fun date(date: LocalDate) = date(JsonField.of(date)) + + /** + * Sets [Builder.date] to an arbitrary JSON value. + * + * You should usually call [Builder.date] with a well-typed [LocalDate] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun date(date: JsonField) = apply { this.date = date } + + /** + * The 9-digit Tax Identification Number (TIN) or Employer Identification Number + * (EIN). + */ + fun identificationNumber(identificationNumber: String) = + identificationNumber(JsonField.of(identificationNumber)) + + /** + * Sets [Builder.identificationNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.identificationNumber] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun identificationNumber(identificationNumber: JsonField) = apply { + this.identificationNumber = identificationNumber + } + + /** The 5-character tax type code. */ + fun typeCode(typeCode: String) = typeCode(JsonField.of(typeCode)) + + /** + * Sets [Builder.typeCode] to an arbitrary JSON value. + * + * You should usually call [Builder.typeCode] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun typeCode(typeCode: JsonField) = apply { this.typeCode = typeCode } + + 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 [Tax]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .date() + * .identificationNumber() + * .typeCode() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Tax = + Tax( + checkRequired("date", date), + checkRequired("identificationNumber", identificationNumber), + checkRequired("typeCode", typeCode), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Tax = apply { + if (validated) { + return@apply + } + + date() + identificationNumber() + typeCode() + 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 (date.asKnown().isPresent) 1 else 0) + + (if (identificationNumber.asKnown().isPresent) 1 else 0) + + (if (typeCode.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Tax && + date == other.date && + identificationNumber == other.identificationNumber && + typeCode == other.typeCode && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(date, identificationNumber, typeCode, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Tax{date=$date, identificationNumber=$identificationNumber, typeCode=$typeCode, additionalProperties=$additionalProperties}" + } + + /** + * Unstructured remittance information. Required if `category` is equal to `unstructured`. + */ + class Unstructured + private constructor( + private val message: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("message") + @ExcludeMissing + message: JsonField = JsonMissing.of() + ) : this(message, mutableMapOf()) + + /** + * The message to the beneficiary. + * + * @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 message(): String = message.getRequired("message") + + /** + * Returns the raw JSON value of [message]. + * + * Unlike [message], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("message") @ExcludeMissing fun _message(): JsonField = message + + @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 [Unstructured]. + * + * The following fields are required: + * ```java + * .message() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Unstructured]. */ + class Builder internal constructor() { + + private var message: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(unstructured: Unstructured) = apply { + message = unstructured.message + additionalProperties = unstructured.additionalProperties.toMutableMap() + } + + /** The message to the beneficiary. */ + fun message(message: String) = message(JsonField.of(message)) + + /** + * Sets [Builder.message] to an arbitrary JSON value. + * + * You should usually call [Builder.message] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun message(message: JsonField) = apply { this.message = message } + + 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 [Unstructured]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .message() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Unstructured = + Unstructured( + checkRequired("message", message), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Unstructured = apply { + if (validated) { + return@apply + } + + message() + 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 (message.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Unstructured && + message == other.message && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(message, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Unstructured{message=$message, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Remittance && + category == other.category && + tax == other.tax && + unstructured == other.unstructured && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(category, tax, unstructured, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Remittance{category=$category, tax=$tax, unstructured=$unstructured, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/wiretransfers/WireTransferCreateParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/wiretransfers/WireTransferCreateParamsTest.kt index 70f96a94b..6e16a8322 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/wiretransfers/WireTransferCreateParamsTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/wiretransfers/WireTransferCreateParamsTest.kt @@ -2,6 +2,7 @@ package com.increase.api.models.wiretransfers +import java.time.LocalDate import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -13,7 +14,6 @@ internal class WireTransferCreateParamsTest { .accountId("account_in71c4amph0vgo2qllky") .amount(100L) .beneficiaryName("Ian Crease") - .messageToRecipient("New account transfer") .accountNumber("987654321") .beneficiaryAddressLine1("33 Liberty Street") .beneficiaryAddressLine2("New York") @@ -24,6 +24,23 @@ internal class WireTransferCreateParamsTest { .originatorAddressLine2("x") .originatorAddressLine3("x") .originatorName("x") + .remittance( + WireTransferCreateParams.Remittance.builder() + .category(WireTransferCreateParams.Remittance.Category.UNSTRUCTURED) + .tax( + WireTransferCreateParams.Remittance.Tax.builder() + .date(LocalDate.parse("2019-12-27")) + .identificationNumber("xxxxxxxxx") + .typeCode("xxxxx") + .build() + ) + .unstructured( + WireTransferCreateParams.Remittance.Unstructured.builder() + .message("New account transfer") + .build() + ) + .build() + ) .requireApproval(true) .routingNumber("101050001") .sourceAccountNumberId("source_account_number_id") @@ -37,7 +54,6 @@ internal class WireTransferCreateParamsTest { .accountId("account_in71c4amph0vgo2qllky") .amount(100L) .beneficiaryName("Ian Crease") - .messageToRecipient("New account transfer") .accountNumber("987654321") .beneficiaryAddressLine1("33 Liberty Street") .beneficiaryAddressLine2("New York") @@ -48,6 +64,23 @@ internal class WireTransferCreateParamsTest { .originatorAddressLine2("x") .originatorAddressLine3("x") .originatorName("x") + .remittance( + WireTransferCreateParams.Remittance.builder() + .category(WireTransferCreateParams.Remittance.Category.UNSTRUCTURED) + .tax( + WireTransferCreateParams.Remittance.Tax.builder() + .date(LocalDate.parse("2019-12-27")) + .identificationNumber("xxxxxxxxx") + .typeCode("xxxxx") + .build() + ) + .unstructured( + WireTransferCreateParams.Remittance.Unstructured.builder() + .message("New account transfer") + .build() + ) + .build() + ) .requireApproval(true) .routingNumber("101050001") .sourceAccountNumberId("source_account_number_id") @@ -58,7 +91,6 @@ internal class WireTransferCreateParamsTest { assertThat(body.accountId()).isEqualTo("account_in71c4amph0vgo2qllky") assertThat(body.amount()).isEqualTo(100L) assertThat(body.beneficiaryName()).isEqualTo("Ian Crease") - assertThat(body.messageToRecipient()).isEqualTo("New account transfer") assertThat(body.accountNumber()).contains("987654321") assertThat(body.beneficiaryAddressLine1()).contains("33 Liberty Street") assertThat(body.beneficiaryAddressLine2()).contains("New York") @@ -69,6 +101,24 @@ internal class WireTransferCreateParamsTest { assertThat(body.originatorAddressLine2()).contains("x") assertThat(body.originatorAddressLine3()).contains("x") assertThat(body.originatorName()).contains("x") + assertThat(body.remittance()) + .contains( + WireTransferCreateParams.Remittance.builder() + .category(WireTransferCreateParams.Remittance.Category.UNSTRUCTURED) + .tax( + WireTransferCreateParams.Remittance.Tax.builder() + .date(LocalDate.parse("2019-12-27")) + .identificationNumber("xxxxxxxxx") + .typeCode("xxxxx") + .build() + ) + .unstructured( + WireTransferCreateParams.Remittance.Unstructured.builder() + .message("New account transfer") + .build() + ) + .build() + ) assertThat(body.requireApproval()).contains(true) assertThat(body.routingNumber()).contains("101050001") assertThat(body.sourceAccountNumberId()).contains("source_account_number_id") @@ -81,7 +131,6 @@ internal class WireTransferCreateParamsTest { .accountId("account_in71c4amph0vgo2qllky") .amount(100L) .beneficiaryName("Ian Crease") - .messageToRecipient("New account transfer") .build() val body = params._body() @@ -89,6 +138,5 @@ internal class WireTransferCreateParamsTest { assertThat(body.accountId()).isEqualTo("account_in71c4amph0vgo2qllky") assertThat(body.amount()).isEqualTo(100L) assertThat(body.beneficiaryName()).isEqualTo("Ian Crease") - assertThat(body.messageToRecipient()).isEqualTo("New account transfer") } } diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/wiretransfers/WireTransferListPageResponseTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/wiretransfers/WireTransferListPageResponseTest.kt index f6b9f0435..b49e84363 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/wiretransfers/WireTransferListPageResponseTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/wiretransfers/WireTransferListPageResponseTest.kt @@ -69,6 +69,23 @@ internal class WireTransferListPageResponseTest { .originatorAddressLine3(null) .originatorName(null) .pendingTransactionId(null) + .remittance( + WireTransfer.Remittance.builder() + .category(WireTransfer.Remittance.Category.UNSTRUCTURED) + .tax( + WireTransfer.Remittance.Tax.builder() + .date(LocalDate.parse("2019-12-27")) + .identificationNumber("identification_number") + .typeCode("type_code") + .build() + ) + .unstructured( + WireTransfer.Remittance.Unstructured.builder() + .message("Payment for invoice 12345") + .build() + ) + .build() + ) .reversal( WireTransfer.Reversal.builder() .amount(0L) @@ -160,6 +177,23 @@ internal class WireTransferListPageResponseTest { .originatorAddressLine3(null) .originatorName(null) .pendingTransactionId(null) + .remittance( + WireTransfer.Remittance.builder() + .category(WireTransfer.Remittance.Category.UNSTRUCTURED) + .tax( + WireTransfer.Remittance.Tax.builder() + .date(LocalDate.parse("2019-12-27")) + .identificationNumber("identification_number") + .typeCode("type_code") + .build() + ) + .unstructured( + WireTransfer.Remittance.Unstructured.builder() + .message("Payment for invoice 12345") + .build() + ) + .build() + ) .reversal( WireTransfer.Reversal.builder() .amount(0L) @@ -255,6 +289,23 @@ internal class WireTransferListPageResponseTest { .originatorAddressLine3(null) .originatorName(null) .pendingTransactionId(null) + .remittance( + WireTransfer.Remittance.builder() + .category(WireTransfer.Remittance.Category.UNSTRUCTURED) + .tax( + WireTransfer.Remittance.Tax.builder() + .date(LocalDate.parse("2019-12-27")) + .identificationNumber("identification_number") + .typeCode("type_code") + .build() + ) + .unstructured( + WireTransfer.Remittance.Unstructured.builder() + .message("Payment for invoice 12345") + .build() + ) + .build() + ) .reversal( WireTransfer.Reversal.builder() .amount(0L) diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/wiretransfers/WireTransferTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/wiretransfers/WireTransferTest.kt index 51be45536..47a78cbe3 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/wiretransfers/WireTransferTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/wiretransfers/WireTransferTest.kt @@ -63,6 +63,23 @@ internal class WireTransferTest { .originatorAddressLine3(null) .originatorName(null) .pendingTransactionId(null) + .remittance( + WireTransfer.Remittance.builder() + .category(WireTransfer.Remittance.Category.UNSTRUCTURED) + .tax( + WireTransfer.Remittance.Tax.builder() + .date(LocalDate.parse("2019-12-27")) + .identificationNumber("identification_number") + .typeCode("type_code") + .build() + ) + .unstructured( + WireTransfer.Remittance.Unstructured.builder() + .message("Payment for invoice 12345") + .build() + ) + .build() + ) .reversal( WireTransfer.Reversal.builder() .amount(0L) @@ -135,13 +152,31 @@ internal class WireTransferTest { .contains("external_account_ukk55lr923a3ac0pp7iv") assertThat(wireTransfer.idempotencyKey()).isEmpty assertThat(wireTransfer.inboundWireDrawdownRequestId()).isEmpty - assertThat(wireTransfer.messageToRecipient()).contains("Message to recipient") + assertThat(wireTransfer.messageToRecipient()).isEqualTo("Message to recipient") assertThat(wireTransfer.network()).isEqualTo(WireTransfer.Network.WIRE) assertThat(wireTransfer.originatorAddressLine1()).isEmpty assertThat(wireTransfer.originatorAddressLine2()).isEmpty assertThat(wireTransfer.originatorAddressLine3()).isEmpty assertThat(wireTransfer.originatorName()).isEmpty assertThat(wireTransfer.pendingTransactionId()).isEmpty + assertThat(wireTransfer.remittance()) + .contains( + WireTransfer.Remittance.builder() + .category(WireTransfer.Remittance.Category.UNSTRUCTURED) + .tax( + WireTransfer.Remittance.Tax.builder() + .date(LocalDate.parse("2019-12-27")) + .identificationNumber("identification_number") + .typeCode("type_code") + .build() + ) + .unstructured( + WireTransfer.Remittance.Unstructured.builder() + .message("Payment for invoice 12345") + .build() + ) + .build() + ) assertThat(wireTransfer.reversal()) .contains( WireTransfer.Reversal.builder() @@ -228,6 +263,23 @@ internal class WireTransferTest { .originatorAddressLine3(null) .originatorName(null) .pendingTransactionId(null) + .remittance( + WireTransfer.Remittance.builder() + .category(WireTransfer.Remittance.Category.UNSTRUCTURED) + .tax( + WireTransfer.Remittance.Tax.builder() + .date(LocalDate.parse("2019-12-27")) + .identificationNumber("identification_number") + .typeCode("type_code") + .build() + ) + .unstructured( + WireTransfer.Remittance.Unstructured.builder() + .message("Payment for invoice 12345") + .build() + ) + .build() + ) .reversal( WireTransfer.Reversal.builder() .amount(0L) diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/async/WireTransferServiceAsyncTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/async/WireTransferServiceAsyncTest.kt index 3904c42a1..62061e437 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/async/WireTransferServiceAsyncTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/async/WireTransferServiceAsyncTest.kt @@ -5,6 +5,7 @@ package com.increase.api.services.async import com.increase.api.TestServerExtension import com.increase.api.client.okhttp.IncreaseOkHttpClientAsync import com.increase.api.models.wiretransfers.WireTransferCreateParams +import java.time.LocalDate import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -26,7 +27,6 @@ internal class WireTransferServiceAsyncTest { .accountId("account_in71c4amph0vgo2qllky") .amount(100L) .beneficiaryName("Ian Crease") - .messageToRecipient("New account transfer") .accountNumber("987654321") .beneficiaryAddressLine1("33 Liberty Street") .beneficiaryAddressLine2("New York") @@ -37,6 +37,23 @@ internal class WireTransferServiceAsyncTest { .originatorAddressLine2("x") .originatorAddressLine3("x") .originatorName("x") + .remittance( + WireTransferCreateParams.Remittance.builder() + .category(WireTransferCreateParams.Remittance.Category.UNSTRUCTURED) + .tax( + WireTransferCreateParams.Remittance.Tax.builder() + .date(LocalDate.parse("2019-12-27")) + .identificationNumber("xxxxxxxxx") + .typeCode("xxxxx") + .build() + ) + .unstructured( + WireTransferCreateParams.Remittance.Unstructured.builder() + .message("New account transfer") + .build() + ) + .build() + ) .requireApproval(true) .routingNumber("101050001") .sourceAccountNumberId("source_account_number_id") diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/WireTransferServiceTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/WireTransferServiceTest.kt index 740f1a6f4..5537e5dce 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/WireTransferServiceTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/WireTransferServiceTest.kt @@ -5,6 +5,7 @@ package com.increase.api.services.blocking import com.increase.api.TestServerExtension import com.increase.api.client.okhttp.IncreaseOkHttpClient import com.increase.api.models.wiretransfers.WireTransferCreateParams +import java.time.LocalDate import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -26,7 +27,6 @@ internal class WireTransferServiceTest { .accountId("account_in71c4amph0vgo2qllky") .amount(100L) .beneficiaryName("Ian Crease") - .messageToRecipient("New account transfer") .accountNumber("987654321") .beneficiaryAddressLine1("33 Liberty Street") .beneficiaryAddressLine2("New York") @@ -37,6 +37,23 @@ internal class WireTransferServiceTest { .originatorAddressLine2("x") .originatorAddressLine3("x") .originatorName("x") + .remittance( + WireTransferCreateParams.Remittance.builder() + .category(WireTransferCreateParams.Remittance.Category.UNSTRUCTURED) + .tax( + WireTransferCreateParams.Remittance.Tax.builder() + .date(LocalDate.parse("2019-12-27")) + .identificationNumber("xxxxxxxxx") + .typeCode("xxxxx") + .build() + ) + .unstructured( + WireTransferCreateParams.Remittance.Unstructured.builder() + .message("New account transfer") + .build() + ) + .build() + ) .requireApproval(true) .routingNumber("101050001") .sourceAccountNumberId("source_account_number_id") From b7e9221cae006bf56a163993ad9d6b9fdd66a6fb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 16 Sep 2025 18:02:01 +0000 Subject: [PATCH 2/2] release: 0.327.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ README.md | 10 +++++----- build.gradle.kts | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6b2a97d56..90be2bf17 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.326.0" + ".": "0.327.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index e3713f53d..b31643dec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.327.0 (2025-09-16) + +Full Changelog: [v0.326.0...v0.327.0](https://github.com/Increase/increase-java/compare/v0.326.0...v0.327.0) + +### Features + +* **api:** api update ([2283e16](https://github.com/Increase/increase-java/commit/2283e169d17b96dae213c757a5a11290e03f066b)) + ## 0.326.0 (2025-09-16) Full Changelog: [v0.325.0...v0.326.0](https://github.com/Increase/increase-java/compare/v0.325.0...v0.326.0) diff --git a/README.md b/README.md index f7f4d006f..e129ffb5a 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.increase.api/increase-java)](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.326.0) -[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.326.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.326.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.increase.api/increase-java)](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.327.0) +[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.327.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.327.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.326.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.327.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.326.0") +implementation("com.increase.api:increase-java:0.327.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.326.0") com.increase.api increase-java - 0.326.0 + 0.327.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index d30492b7b..d31cca316 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.increase.api" - version = "0.326.0" // x-release-please-version + version = "0.327.0" // x-release-please-version } subprojects {