From 94c53eb6b89ab1c7dc68b763e40a6995fc43b0b2 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Tue, 18 Jul 2023 16:38:07 +0000 Subject: [PATCH] feat(api)!: reorganize `check_transfer` and `network fields; add `request_details`; add `unknown` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Migration guide ### Check Transfers - `address_city` → `physical_check.mailing_address.city` - `address_line1` → `physical_check.mailing_address.line1` - `address_line2` → `physical_check.mailing_address.line2` - `address_state` → `physical_check.mailing_address.state` - `address_zip` → `physical_check.mailing_address.postal_code` - `message` → `physical_check.memo` - `note` → `physical_check.note` - `recipient_name` → `physical_check.recipient_name` - `return_address` → `physical_check.return_address` - `mailed_at` → `mailing.mailed_at` ### Declined transactions, Pending transactions, and Real-time decisions - `network` → `network_details.category` --- .../api/models/AchTransferSimulation.kt | 168 +-- .../api/models/CardAuthorizationSimulation.kt | 336 +++--- .../com/increase/api/models/CheckTransfer.kt | 1072 ++++++++++++----- .../api/models/CheckTransferCreateParams.kt | 786 +++++++----- .../api/models/DeclinedTransaction.kt | 164 +-- ...ealTimePaymentsTransferSimulationResult.kt | 168 +-- .../increase/api/models/PendingTransaction.kt | 164 +-- .../api/models/PointOfServiceEntryMode.kt | 6 + .../increase/api/models/RealTimeDecision.kt | 550 +++++++-- .../api/models/AchTransferSimulationTest.kt | 29 +- .../models/CardAuthorizationSimulationTest.kt | 64 +- .../models/CheckTransferCreateParamsTest.kt | 145 ++- .../increase/api/models/CheckTransferTest.kt | 99 +- .../api/models/DeclinedTransactionTest.kt | 18 +- ...imePaymentsTransferSimulationResultTest.kt | 38 +- .../api/models/PendingTransactionTest.kt | 19 +- .../api/models/RealTimeDecisionTest.kt | 47 +- .../blocking/CheckTransferServiceTest.kt | 42 +- 18 files changed, 2557 insertions(+), 1358 deletions(-) diff --git a/increase-kotlin-core/src/main/kotlin/com/increase/api/models/AchTransferSimulation.kt b/increase-kotlin-core/src/main/kotlin/com/increase/api/models/AchTransferSimulation.kt index 1aad9c5b4..7d3a756d1 100644 --- a/increase-kotlin-core/src/main/kotlin/com/increase/api/models/AchTransferSimulation.kt +++ b/increase-kotlin-core/src/main/kotlin/com/increase/api/models/AchTransferSimulation.kt @@ -14450,7 +14450,6 @@ private constructor( private val merchantCity: JsonField, private val merchantCountry: JsonField, private val physicalCardId: JsonField, - private val network: JsonField, private val networkDetails: JsonField, private val amount: JsonField, private val currency: JsonField, @@ -14495,9 +14494,6 @@ private constructor( */ fun physicalCardId(): String? = physicalCardId.getNullable("physical_card_id") - /** The payment network used to process this card authorization */ - fun network(): Network = network.getRequired("network") - /** Fields specific to the `network` */ fun networkDetails(): NetworkDetails = networkDetails.getRequired("network_details") @@ -14570,9 +14566,6 @@ private constructor( @ExcludeMissing fun _physicalCardId() = physicalCardId - /** The payment network used to process this card authorization */ - @JsonProperty("network") @ExcludeMissing fun _network() = network - /** Fields specific to the `network` */ @JsonProperty("network_details") @ExcludeMissing @@ -14624,7 +14617,6 @@ private constructor( merchantCity() merchantCountry() physicalCardId() - network() networkDetails().validate() amount() currency() @@ -14650,7 +14642,6 @@ private constructor( this.merchantCity == other.merchantCity && this.merchantCountry == other.merchantCountry && this.physicalCardId == other.physicalCardId && - this.network == other.network && this.networkDetails == other.networkDetails && this.amount == other.amount && this.currency == other.currency && @@ -14671,7 +14662,6 @@ private constructor( merchantCity, merchantCountry, physicalCardId, - network, networkDetails, amount, currency, @@ -14686,7 +14676,7 @@ private constructor( } override fun toString() = - "CardDecline{merchantAcceptorId=$merchantAcceptorId, merchantDescriptor=$merchantDescriptor, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, physicalCardId=$physicalCardId, network=$network, networkDetails=$networkDetails, amount=$amount, currency=$currency, reason=$reason, merchantState=$merchantState, realTimeDecisionId=$realTimeDecisionId, digitalWalletTokenId=$digitalWalletTokenId, additionalProperties=$additionalProperties}" + "CardDecline{merchantAcceptorId=$merchantAcceptorId, merchantDescriptor=$merchantDescriptor, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, physicalCardId=$physicalCardId, networkDetails=$networkDetails, amount=$amount, currency=$currency, reason=$reason, merchantState=$merchantState, realTimeDecisionId=$realTimeDecisionId, digitalWalletTokenId=$digitalWalletTokenId, additionalProperties=$additionalProperties}" companion object { @@ -14701,7 +14691,6 @@ private constructor( private var merchantCity: JsonField = JsonMissing.of() private var merchantCountry: JsonField = JsonMissing.of() private var physicalCardId: JsonField = JsonMissing.of() - private var network: JsonField = JsonMissing.of() private var networkDetails: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() @@ -14718,7 +14707,6 @@ private constructor( this.merchantCity = cardDecline.merchantCity this.merchantCountry = cardDecline.merchantCountry this.physicalCardId = cardDecline.physicalCardId - this.network = cardDecline.network this.networkDetails = cardDecline.networkDetails this.amount = cardDecline.amount this.currency = cardDecline.currency @@ -14813,14 +14801,6 @@ private constructor( this.physicalCardId = physicalCardId } - /** The payment network used to process this card authorization */ - fun network(network: Network) = network(JsonField.of(network)) - - /** The payment network used to process this card authorization */ - @JsonProperty("network") - @ExcludeMissing - fun network(network: JsonField) = apply { this.network = network } - /** Fields specific to the `network` */ fun networkDetails(networkDetails: NetworkDetails) = networkDetails(JsonField.of(networkDetails)) @@ -14936,7 +14916,6 @@ private constructor( merchantCity, merchantCountry, physicalCardId, - network, networkDetails, amount, currency, @@ -14948,63 +14927,12 @@ private constructor( ) } - class Network - @JsonCreator - private constructor( - private val value: JsonField, - ) { - - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Network && this.value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - - companion object { - - val VISA = Network(JsonField.of("visa")) - - fun of(value: String) = Network(JsonField.of(value)) - } - - enum class Known { - VISA, - } - - enum class Value { - VISA, - _UNKNOWN, - } - - fun value(): Value = - when (this) { - VISA -> Value.VISA - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - VISA -> Known.VISA - else -> throw IncreaseInvalidDataException("Unknown Network: $value") - } - - fun asString(): String = _value().asStringOrThrow() - } - /** Fields specific to the `network` */ @JsonDeserialize(builder = NetworkDetails.Builder::class) @NoAutoDetect class NetworkDetails private constructor( + private val category: JsonField, private val visa: JsonField, private val additionalProperties: Map, ) { @@ -15013,8 +14941,14 @@ private constructor( private var hashCode: Int = 0 + /** The payment network used to process this card authorization */ + fun category(): Category = category.getRequired("category") + /** Fields specific to the `visa` network */ - fun visa(): Visa = visa.getRequired("visa") + fun visa(): Visa? = visa.getNullable("visa") + + /** The payment network used to process this card authorization */ + @JsonProperty("category") @ExcludeMissing fun _category() = category /** Fields specific to the `visa` network */ @JsonProperty("visa") @ExcludeMissing fun _visa() = visa @@ -15025,7 +14959,8 @@ private constructor( fun validate(): NetworkDetails = apply { if (!validated) { - visa().validate() + category() + visa()?.validate() validated = true } } @@ -15038,19 +14973,25 @@ private constructor( } return other is NetworkDetails && + this.category == other.category && this.visa == other.visa && this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { if (hashCode == 0) { - hashCode = Objects.hash(visa, additionalProperties) + hashCode = + Objects.hash( + category, + visa, + additionalProperties, + ) } return hashCode } override fun toString() = - "NetworkDetails{visa=$visa, additionalProperties=$additionalProperties}" + "NetworkDetails{category=$category, visa=$visa, additionalProperties=$additionalProperties}" companion object { @@ -15059,15 +15000,27 @@ private constructor( class Builder { + private var category: JsonField = JsonMissing.of() private var visa: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() internal fun from(networkDetails: NetworkDetails) = apply { + this.category = networkDetails.category this.visa = networkDetails.visa additionalProperties(networkDetails.additionalProperties) } + /** The payment network used to process this card authorization */ + fun category(category: Category) = category(JsonField.of(category)) + + /** The payment network used to process this card authorization */ + @JsonProperty("category") + @ExcludeMissing + fun category(category: JsonField) = apply { + this.category = category + } + /** Fields specific to the `visa` network */ fun visa(visa: Visa) = visa(JsonField.of(visa)) @@ -15092,7 +15045,64 @@ private constructor( ) = apply { this.additionalProperties.putAll(additionalProperties) } fun build(): NetworkDetails = - NetworkDetails(visa, additionalProperties.toUnmodifiable()) + NetworkDetails( + category, + visa, + additionalProperties.toUnmodifiable(), + ) + } + + class Category + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Category && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + val VISA = Category(JsonField.of("visa")) + + fun of(value: String) = Category(JsonField.of(value)) + } + + enum class Known { + VISA, + } + + enum class Value { + VISA, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + VISA -> Value.VISA + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + VISA -> Known.VISA + else -> + throw IncreaseInvalidDataException("Unknown Category: $value") + } + + fun asString(): String = _value().asStringOrThrow() } /** Fields specific to the `visa` network */ diff --git a/increase-kotlin-core/src/main/kotlin/com/increase/api/models/CardAuthorizationSimulation.kt b/increase-kotlin-core/src/main/kotlin/com/increase/api/models/CardAuthorizationSimulation.kt index c4dd23620..70421c5d8 100644 --- a/increase-kotlin-core/src/main/kotlin/com/increase/api/models/CardAuthorizationSimulation.kt +++ b/increase-kotlin-core/src/main/kotlin/com/increase/api/models/CardAuthorizationSimulation.kt @@ -1776,7 +1776,6 @@ private constructor( private val merchantCity: JsonField, private val merchantCountry: JsonField, private val physicalCardId: JsonField, - private val network: JsonField, private val networkDetails: JsonField, private val amount: JsonField, private val currency: JsonField, @@ -1825,9 +1824,6 @@ private constructor( */ fun physicalCardId(): String? = physicalCardId.getNullable("physical_card_id") - /** The payment network used to process this card authorization */ - fun network(): Network = network.getRequired("network") - /** Fields specific to the `network` */ fun networkDetails(): NetworkDetails = networkDetails.getRequired("network_details") @@ -1913,9 +1909,6 @@ private constructor( @ExcludeMissing fun _physicalCardId() = physicalCardId - /** The payment network used to process this card authorization */ - @JsonProperty("network") @ExcludeMissing fun _network() = network - /** Fields specific to the `network` */ @JsonProperty("network_details") @ExcludeMissing @@ -1979,7 +1972,6 @@ private constructor( merchantCity() merchantCountry() physicalCardId() - network() networkDetails().validate() amount() currency() @@ -2007,7 +1999,6 @@ private constructor( this.merchantCity == other.merchantCity && this.merchantCountry == other.merchantCountry && this.physicalCardId == other.physicalCardId && - this.network == other.network && this.networkDetails == other.networkDetails && this.amount == other.amount && this.currency == other.currency && @@ -2030,7 +2021,6 @@ private constructor( merchantCity, merchantCountry, physicalCardId, - network, networkDetails, amount, currency, @@ -2046,7 +2036,7 @@ private constructor( } override fun toString() = - "CardAuthorization{id=$id, merchantAcceptorId=$merchantAcceptorId, merchantDescriptor=$merchantDescriptor, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, physicalCardId=$physicalCardId, network=$network, networkDetails=$networkDetails, amount=$amount, currency=$currency, expiresAt=$expiresAt, realTimeDecisionId=$realTimeDecisionId, digitalWalletTokenId=$digitalWalletTokenId, pendingTransactionId=$pendingTransactionId, type=$type, additionalProperties=$additionalProperties}" + "CardAuthorization{id=$id, merchantAcceptorId=$merchantAcceptorId, merchantDescriptor=$merchantDescriptor, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, physicalCardId=$physicalCardId, networkDetails=$networkDetails, amount=$amount, currency=$currency, expiresAt=$expiresAt, realTimeDecisionId=$realTimeDecisionId, digitalWalletTokenId=$digitalWalletTokenId, pendingTransactionId=$pendingTransactionId, type=$type, additionalProperties=$additionalProperties}" companion object { @@ -2062,7 +2052,6 @@ private constructor( private var merchantCity: JsonField = JsonMissing.of() private var merchantCountry: JsonField = JsonMissing.of() private var physicalCardId: JsonField = JsonMissing.of() - private var network: JsonField = JsonMissing.of() private var networkDetails: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() @@ -2081,7 +2070,6 @@ private constructor( this.merchantCity = cardAuthorization.merchantCity this.merchantCountry = cardAuthorization.merchantCountry this.physicalCardId = cardAuthorization.physicalCardId - this.network = cardAuthorization.network this.networkDetails = cardAuthorization.networkDetails this.amount = cardAuthorization.amount this.currency = cardAuthorization.currency @@ -2185,14 +2173,6 @@ private constructor( this.physicalCardId = physicalCardId } - /** The payment network used to process this card authorization */ - fun network(network: Network) = network(JsonField.of(network)) - - /** The payment network used to process this card authorization */ - @JsonProperty("network") - @ExcludeMissing - fun network(network: JsonField) = apply { this.network = network } - /** Fields specific to the `network` */ fun networkDetails(networkDetails: NetworkDetails) = networkDetails(JsonField.of(networkDetails)) @@ -2335,7 +2315,6 @@ private constructor( merchantCity, merchantCountry, physicalCardId, - network, networkDetails, amount, currency, @@ -2348,63 +2327,12 @@ private constructor( ) } - class Network - @JsonCreator - private constructor( - private val value: JsonField, - ) { - - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Network && this.value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - - companion object { - - val VISA = Network(JsonField.of("visa")) - - fun of(value: String) = Network(JsonField.of(value)) - } - - enum class Known { - VISA, - } - - enum class Value { - VISA, - _UNKNOWN, - } - - fun value(): Value = - when (this) { - VISA -> Value.VISA - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - VISA -> Known.VISA - else -> throw IncreaseInvalidDataException("Unknown Network: $value") - } - - fun asString(): String = _value().asStringOrThrow() - } - /** Fields specific to the `network` */ @JsonDeserialize(builder = NetworkDetails.Builder::class) @NoAutoDetect class NetworkDetails private constructor( + private val category: JsonField, private val visa: JsonField, private val additionalProperties: Map, ) { @@ -2413,8 +2341,14 @@ private constructor( private var hashCode: Int = 0 + /** The payment network used to process this card authorization */ + fun category(): Category = category.getRequired("category") + /** Fields specific to the `visa` network */ - fun visa(): Visa = visa.getRequired("visa") + fun visa(): Visa? = visa.getNullable("visa") + + /** The payment network used to process this card authorization */ + @JsonProperty("category") @ExcludeMissing fun _category() = category /** Fields specific to the `visa` network */ @JsonProperty("visa") @ExcludeMissing fun _visa() = visa @@ -2425,7 +2359,8 @@ private constructor( fun validate(): NetworkDetails = apply { if (!validated) { - visa().validate() + category() + visa()?.validate() validated = true } } @@ -2438,19 +2373,25 @@ private constructor( } return other is NetworkDetails && + this.category == other.category && this.visa == other.visa && this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { if (hashCode == 0) { - hashCode = Objects.hash(visa, additionalProperties) + hashCode = + Objects.hash( + category, + visa, + additionalProperties, + ) } return hashCode } override fun toString() = - "NetworkDetails{visa=$visa, additionalProperties=$additionalProperties}" + "NetworkDetails{category=$category, visa=$visa, additionalProperties=$additionalProperties}" companion object { @@ -2459,15 +2400,27 @@ private constructor( class Builder { + private var category: JsonField = JsonMissing.of() private var visa: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() internal fun from(networkDetails: NetworkDetails) = apply { + this.category = networkDetails.category this.visa = networkDetails.visa additionalProperties(networkDetails.additionalProperties) } + /** The payment network used to process this card authorization */ + fun category(category: Category) = category(JsonField.of(category)) + + /** The payment network used to process this card authorization */ + @JsonProperty("category") + @ExcludeMissing + fun category(category: JsonField) = apply { + this.category = category + } + /** Fields specific to the `visa` network */ fun visa(visa: Visa) = visa(JsonField.of(visa)) @@ -2492,7 +2445,64 @@ private constructor( ) = apply { this.additionalProperties.putAll(additionalProperties) } fun build(): NetworkDetails = - NetworkDetails(visa, additionalProperties.toUnmodifiable()) + NetworkDetails( + category, + visa, + additionalProperties.toUnmodifiable(), + ) + } + + class Category + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Category && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + val VISA = Category(JsonField.of("visa")) + + fun of(value: String) = Category(JsonField.of(value)) + } + + enum class Known { + VISA, + } + + enum class Value { + VISA, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + VISA -> Value.VISA + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + VISA -> Known.VISA + else -> + throw IncreaseInvalidDataException("Unknown Category: $value") + } + + fun asString(): String = _value().asStringOrThrow() } /** Fields specific to the `visa` network */ @@ -5966,7 +5976,6 @@ private constructor( private val merchantCity: JsonField, private val merchantCountry: JsonField, private val physicalCardId: JsonField, - private val network: JsonField, private val networkDetails: JsonField, private val amount: JsonField, private val currency: JsonField, @@ -6011,9 +6020,6 @@ private constructor( */ fun physicalCardId(): String? = physicalCardId.getNullable("physical_card_id") - /** The payment network used to process this card authorization */ - fun network(): Network = network.getRequired("network") - /** Fields specific to the `network` */ fun networkDetails(): NetworkDetails = networkDetails.getRequired("network_details") @@ -6086,9 +6092,6 @@ private constructor( @ExcludeMissing fun _physicalCardId() = physicalCardId - /** The payment network used to process this card authorization */ - @JsonProperty("network") @ExcludeMissing fun _network() = network - /** Fields specific to the `network` */ @JsonProperty("network_details") @ExcludeMissing @@ -6140,7 +6143,6 @@ private constructor( merchantCity() merchantCountry() physicalCardId() - network() networkDetails().validate() amount() currency() @@ -6166,7 +6168,6 @@ private constructor( this.merchantCity == other.merchantCity && this.merchantCountry == other.merchantCountry && this.physicalCardId == other.physicalCardId && - this.network == other.network && this.networkDetails == other.networkDetails && this.amount == other.amount && this.currency == other.currency && @@ -6187,7 +6188,6 @@ private constructor( merchantCity, merchantCountry, physicalCardId, - network, networkDetails, amount, currency, @@ -6202,7 +6202,7 @@ private constructor( } override fun toString() = - "CardDecline{merchantAcceptorId=$merchantAcceptorId, merchantDescriptor=$merchantDescriptor, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, physicalCardId=$physicalCardId, network=$network, networkDetails=$networkDetails, amount=$amount, currency=$currency, reason=$reason, merchantState=$merchantState, realTimeDecisionId=$realTimeDecisionId, digitalWalletTokenId=$digitalWalletTokenId, additionalProperties=$additionalProperties}" + "CardDecline{merchantAcceptorId=$merchantAcceptorId, merchantDescriptor=$merchantDescriptor, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, physicalCardId=$physicalCardId, networkDetails=$networkDetails, amount=$amount, currency=$currency, reason=$reason, merchantState=$merchantState, realTimeDecisionId=$realTimeDecisionId, digitalWalletTokenId=$digitalWalletTokenId, additionalProperties=$additionalProperties}" companion object { @@ -6217,7 +6217,6 @@ private constructor( private var merchantCity: JsonField = JsonMissing.of() private var merchantCountry: JsonField = JsonMissing.of() private var physicalCardId: JsonField = JsonMissing.of() - private var network: JsonField = JsonMissing.of() private var networkDetails: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() @@ -6234,7 +6233,6 @@ private constructor( this.merchantCity = cardDecline.merchantCity this.merchantCountry = cardDecline.merchantCountry this.physicalCardId = cardDecline.physicalCardId - this.network = cardDecline.network this.networkDetails = cardDecline.networkDetails this.amount = cardDecline.amount this.currency = cardDecline.currency @@ -6329,14 +6327,6 @@ private constructor( this.physicalCardId = physicalCardId } - /** The payment network used to process this card authorization */ - fun network(network: Network) = network(JsonField.of(network)) - - /** The payment network used to process this card authorization */ - @JsonProperty("network") - @ExcludeMissing - fun network(network: JsonField) = apply { this.network = network } - /** Fields specific to the `network` */ fun networkDetails(networkDetails: NetworkDetails) = networkDetails(JsonField.of(networkDetails)) @@ -6452,7 +6442,6 @@ private constructor( merchantCity, merchantCountry, physicalCardId, - network, networkDetails, amount, currency, @@ -6464,63 +6453,12 @@ private constructor( ) } - class Network - @JsonCreator - private constructor( - private val value: JsonField, - ) { - - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Network && this.value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - - companion object { - - val VISA = Network(JsonField.of("visa")) - - fun of(value: String) = Network(JsonField.of(value)) - } - - enum class Known { - VISA, - } - - enum class Value { - VISA, - _UNKNOWN, - } - - fun value(): Value = - when (this) { - VISA -> Value.VISA - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - VISA -> Known.VISA - else -> throw IncreaseInvalidDataException("Unknown Network: $value") - } - - fun asString(): String = _value().asStringOrThrow() - } - /** Fields specific to the `network` */ @JsonDeserialize(builder = NetworkDetails.Builder::class) @NoAutoDetect class NetworkDetails private constructor( + private val category: JsonField, private val visa: JsonField, private val additionalProperties: Map, ) { @@ -6529,8 +6467,14 @@ private constructor( private var hashCode: Int = 0 + /** The payment network used to process this card authorization */ + fun category(): Category = category.getRequired("category") + /** Fields specific to the `visa` network */ - fun visa(): Visa = visa.getRequired("visa") + fun visa(): Visa? = visa.getNullable("visa") + + /** The payment network used to process this card authorization */ + @JsonProperty("category") @ExcludeMissing fun _category() = category /** Fields specific to the `visa` network */ @JsonProperty("visa") @ExcludeMissing fun _visa() = visa @@ -6541,7 +6485,8 @@ private constructor( fun validate(): NetworkDetails = apply { if (!validated) { - visa().validate() + category() + visa()?.validate() validated = true } } @@ -6554,19 +6499,25 @@ private constructor( } return other is NetworkDetails && + this.category == other.category && this.visa == other.visa && this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { if (hashCode == 0) { - hashCode = Objects.hash(visa, additionalProperties) + hashCode = + Objects.hash( + category, + visa, + additionalProperties, + ) } return hashCode } override fun toString() = - "NetworkDetails{visa=$visa, additionalProperties=$additionalProperties}" + "NetworkDetails{category=$category, visa=$visa, additionalProperties=$additionalProperties}" companion object { @@ -6575,15 +6526,27 @@ private constructor( class Builder { + private var category: JsonField = JsonMissing.of() private var visa: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() internal fun from(networkDetails: NetworkDetails) = apply { + this.category = networkDetails.category this.visa = networkDetails.visa additionalProperties(networkDetails.additionalProperties) } + /** The payment network used to process this card authorization */ + fun category(category: Category) = category(JsonField.of(category)) + + /** The payment network used to process this card authorization */ + @JsonProperty("category") + @ExcludeMissing + fun category(category: JsonField) = apply { + this.category = category + } + /** Fields specific to the `visa` network */ fun visa(visa: Visa) = visa(JsonField.of(visa)) @@ -6608,7 +6571,64 @@ private constructor( ) = apply { this.additionalProperties.putAll(additionalProperties) } fun build(): NetworkDetails = - NetworkDetails(visa, additionalProperties.toUnmodifiable()) + NetworkDetails( + category, + visa, + additionalProperties.toUnmodifiable(), + ) + } + + class Category + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Category && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + val VISA = Category(JsonField.of("visa")) + + fun of(value: String) = Category(JsonField.of(value)) + } + + enum class Known { + VISA, + } + + enum class Value { + VISA, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + VISA -> Value.VISA + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + VISA -> Known.VISA + else -> + throw IncreaseInvalidDataException("Unknown Category: $value") + } + + fun asString(): String = _value().asStringOrThrow() } /** Fields specific to the `visa` network */ diff --git a/increase-kotlin-core/src/main/kotlin/com/increase/api/models/CheckTransfer.kt b/increase-kotlin-core/src/main/kotlin/com/increase/api/models/CheckTransfer.kt index 7fc0c2322..6d0457ab1 100644 --- a/increase-kotlin-core/src/main/kotlin/com/increase/api/models/CheckTransfer.kt +++ b/increase-kotlin-core/src/main/kotlin/com/increase/api/models/CheckTransfer.kt @@ -25,23 +25,16 @@ private constructor( private val accountNumber: JsonField, private val routingNumber: JsonField, private val checkNumber: JsonField, - private val addressLine1: JsonField, - private val addressLine2: JsonField, - private val addressCity: JsonField, - private val addressState: JsonField, - private val addressZip: JsonField, - private val returnAddress: JsonField, + private val fulfillmentMethod: JsonField, + private val physicalCheck: JsonField, private val amount: JsonField, private val createdAt: JsonField, private val currency: JsonField, private val approval: JsonField, private val cancellation: JsonField, private val id: JsonField, - private val mailedAt: JsonField, - private val message: JsonField, - private val note: JsonField, + private val mailing: JsonField, private val pendingTransactionId: JsonField, - private val recipientName: JsonField, private val status: JsonField, private val submission: JsonField, private val stopPaymentRequest: JsonField, @@ -73,23 +66,14 @@ private constructor( /** The check number printed on the check. */ fun checkNumber(): String = checkNumber.getRequired("check_number") - /** The street address of the check's destination. */ - fun addressLine1(): String? = addressLine1.getNullable("address_line1") + /** Whether Increase will print and mail the check or if you will do it yourself. */ + fun fulfillmentMethod(): FulfillmentMethod = fulfillmentMethod.getRequired("fulfillment_method") - /** The second line of the address of the check's destination. */ - fun addressLine2(): String? = addressLine2.getNullable("address_line2") - - /** The city of the check's destination. */ - fun addressCity(): String? = addressCity.getNullable("address_city") - - /** The state of the check's destination. */ - fun addressState(): String? = addressState.getNullable("address_state") - - /** The postal code of the check's destination. */ - fun addressZip(): String? = addressZip.getNullable("address_zip") - - /** The return address to be printed on the check. */ - fun returnAddress(): ReturnAddress? = returnAddress.getNullable("return_address") + /** + * Details relating to the physical check that Increase will print and mail. Will be present if + * and only if `fulfillment_method` is equal to `physical_check`. + */ + fun physicalCheck(): PhysicalCheck? = physicalCheck.getNullable("physical_check") /** The transfer amount in USD cents. */ fun amount(): Long = amount.getRequired("amount") @@ -118,24 +102,12 @@ private constructor( /** The Check transfer's identifier. */ fun id(): String = id.getRequired("id") - /** - * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the check was - * mailed. - */ - fun mailedAt(): OffsetDateTime? = mailedAt.getNullable("mailed_at") - - /** The descriptor that will be printed on the memo field on the check. */ - fun message(): String? = message.getNullable("message") - - /** The descriptor that will be printed on the letter included with the check. */ - fun note(): String? = note.getNullable("note") + /** If the check has been mailed by Increase, this will contain details of the shipment. */ + fun mailing(): Mailing? = mailing.getNullable("mailing") /** The identifier of the Pending Transaction associated with the check's creation. */ fun pendingTransactionId(): String? = pendingTransactionId.getNullable("pending_transaction_id") - /** The name that will be printed on the check. */ - fun recipientName(): String? = recipientName.getNullable("recipient_name") - /** The lifecycle status of the transfer. */ fun status(): Status = status.getRequired("status") @@ -177,23 +149,14 @@ private constructor( /** The check number printed on the check. */ @JsonProperty("check_number") @ExcludeMissing fun _checkNumber() = checkNumber - /** The street address of the check's destination. */ - @JsonProperty("address_line1") @ExcludeMissing fun _addressLine1() = addressLine1 - - /** The second line of the address of the check's destination. */ - @JsonProperty("address_line2") @ExcludeMissing fun _addressLine2() = addressLine2 + /** Whether Increase will print and mail the check or if you will do it yourself. */ + @JsonProperty("fulfillment_method") @ExcludeMissing fun _fulfillmentMethod() = fulfillmentMethod - /** The city of the check's destination. */ - @JsonProperty("address_city") @ExcludeMissing fun _addressCity() = addressCity - - /** The state of the check's destination. */ - @JsonProperty("address_state") @ExcludeMissing fun _addressState() = addressState - - /** The postal code of the check's destination. */ - @JsonProperty("address_zip") @ExcludeMissing fun _addressZip() = addressZip - - /** The return address to be printed on the check. */ - @JsonProperty("return_address") @ExcludeMissing fun _returnAddress() = returnAddress + /** + * Details relating to the physical check that Increase will print and mail. Will be present if + * and only if `fulfillment_method` is equal to `physical_check`. + */ + @JsonProperty("physical_check") @ExcludeMissing fun _physicalCheck() = physicalCheck /** The transfer amount in USD cents. */ @JsonProperty("amount") @ExcludeMissing fun _amount() = amount @@ -222,26 +185,14 @@ private constructor( /** The Check transfer's identifier. */ @JsonProperty("id") @ExcludeMissing fun _id() = id - /** - * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the check was - * mailed. - */ - @JsonProperty("mailed_at") @ExcludeMissing fun _mailedAt() = mailedAt - - /** The descriptor that will be printed on the memo field on the check. */ - @JsonProperty("message") @ExcludeMissing fun _message() = message - - /** The descriptor that will be printed on the letter included with the check. */ - @JsonProperty("note") @ExcludeMissing fun _note() = note + /** If the check has been mailed by Increase, this will contain details of the shipment. */ + @JsonProperty("mailing") @ExcludeMissing fun _mailing() = mailing /** The identifier of the Pending Transaction associated with the check's creation. */ @JsonProperty("pending_transaction_id") @ExcludeMissing fun _pendingTransactionId() = pendingTransactionId - /** The name that will be printed on the check. */ - @JsonProperty("recipient_name") @ExcludeMissing fun _recipientName() = recipientName - /** The lifecycle status of the transfer. */ @JsonProperty("status") @ExcludeMissing fun _status() = status @@ -276,23 +227,16 @@ private constructor( accountNumber() routingNumber() checkNumber() - addressLine1() - addressLine2() - addressCity() - addressState() - addressZip() - returnAddress()?.validate() + fulfillmentMethod() + physicalCheck()?.validate() amount() createdAt() currency() approval()?.validate() cancellation()?.validate() id() - mailedAt() - message() - note() + mailing()?.validate() pendingTransactionId() - recipientName() status() submission()?.validate() stopPaymentRequest()?.validate() @@ -316,23 +260,16 @@ private constructor( this.accountNumber == other.accountNumber && this.routingNumber == other.routingNumber && this.checkNumber == other.checkNumber && - this.addressLine1 == other.addressLine1 && - this.addressLine2 == other.addressLine2 && - this.addressCity == other.addressCity && - this.addressState == other.addressState && - this.addressZip == other.addressZip && - this.returnAddress == other.returnAddress && + this.fulfillmentMethod == other.fulfillmentMethod && + this.physicalCheck == other.physicalCheck && this.amount == other.amount && this.createdAt == other.createdAt && this.currency == other.currency && this.approval == other.approval && this.cancellation == other.cancellation && this.id == other.id && - this.mailedAt == other.mailedAt && - this.message == other.message && - this.note == other.note && + this.mailing == other.mailing && this.pendingTransactionId == other.pendingTransactionId && - this.recipientName == other.recipientName && this.status == other.status && this.submission == other.submission && this.stopPaymentRequest == other.stopPaymentRequest && @@ -351,23 +288,16 @@ private constructor( accountNumber, routingNumber, checkNumber, - addressLine1, - addressLine2, - addressCity, - addressState, - addressZip, - returnAddress, + fulfillmentMethod, + physicalCheck, amount, createdAt, currency, approval, cancellation, id, - mailedAt, - message, - note, + mailing, pendingTransactionId, - recipientName, status, submission, stopPaymentRequest, @@ -381,7 +311,7 @@ private constructor( } override fun toString() = - "CheckTransfer{accountId=$accountId, sourceAccountNumberId=$sourceAccountNumberId, accountNumber=$accountNumber, routingNumber=$routingNumber, checkNumber=$checkNumber, addressLine1=$addressLine1, addressLine2=$addressLine2, addressCity=$addressCity, addressState=$addressState, addressZip=$addressZip, returnAddress=$returnAddress, amount=$amount, createdAt=$createdAt, currency=$currency, approval=$approval, cancellation=$cancellation, id=$id, mailedAt=$mailedAt, message=$message, note=$note, pendingTransactionId=$pendingTransactionId, recipientName=$recipientName, status=$status, submission=$submission, stopPaymentRequest=$stopPaymentRequest, deposit=$deposit, uniqueIdentifier=$uniqueIdentifier, type=$type, additionalProperties=$additionalProperties}" + "CheckTransfer{accountId=$accountId, sourceAccountNumberId=$sourceAccountNumberId, accountNumber=$accountNumber, routingNumber=$routingNumber, checkNumber=$checkNumber, fulfillmentMethod=$fulfillmentMethod, physicalCheck=$physicalCheck, amount=$amount, createdAt=$createdAt, currency=$currency, approval=$approval, cancellation=$cancellation, id=$id, mailing=$mailing, pendingTransactionId=$pendingTransactionId, status=$status, submission=$submission, stopPaymentRequest=$stopPaymentRequest, deposit=$deposit, uniqueIdentifier=$uniqueIdentifier, type=$type, additionalProperties=$additionalProperties}" companion object { @@ -395,23 +325,16 @@ private constructor( private var accountNumber: JsonField = JsonMissing.of() private var routingNumber: JsonField = JsonMissing.of() private var checkNumber: JsonField = JsonMissing.of() - private var addressLine1: JsonField = JsonMissing.of() - private var addressLine2: JsonField = JsonMissing.of() - private var addressCity: JsonField = JsonMissing.of() - private var addressState: JsonField = JsonMissing.of() - private var addressZip: JsonField = JsonMissing.of() - private var returnAddress: JsonField = JsonMissing.of() + private var fulfillmentMethod: JsonField = JsonMissing.of() + private var physicalCheck: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() private var approval: JsonField = JsonMissing.of() private var cancellation: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var mailedAt: JsonField = JsonMissing.of() - private var message: JsonField = JsonMissing.of() - private var note: JsonField = JsonMissing.of() + private var mailing: JsonField = JsonMissing.of() private var pendingTransactionId: JsonField = JsonMissing.of() - private var recipientName: JsonField = JsonMissing.of() private var status: JsonField = JsonMissing.of() private var submission: JsonField = JsonMissing.of() private var stopPaymentRequest: JsonField = JsonMissing.of() @@ -426,23 +349,16 @@ private constructor( this.accountNumber = checkTransfer.accountNumber this.routingNumber = checkTransfer.routingNumber this.checkNumber = checkTransfer.checkNumber - this.addressLine1 = checkTransfer.addressLine1 - this.addressLine2 = checkTransfer.addressLine2 - this.addressCity = checkTransfer.addressCity - this.addressState = checkTransfer.addressState - this.addressZip = checkTransfer.addressZip - this.returnAddress = checkTransfer.returnAddress + this.fulfillmentMethod = checkTransfer.fulfillmentMethod + this.physicalCheck = checkTransfer.physicalCheck this.amount = checkTransfer.amount this.createdAt = checkTransfer.createdAt this.currency = checkTransfer.currency this.approval = checkTransfer.approval this.cancellation = checkTransfer.cancellation this.id = checkTransfer.id - this.mailedAt = checkTransfer.mailedAt - this.message = checkTransfer.message - this.note = checkTransfer.note + this.mailing = checkTransfer.mailing this.pendingTransactionId = checkTransfer.pendingTransactionId - this.recipientName = checkTransfer.recipientName this.status = checkTransfer.status this.submission = checkTransfer.submission this.stopPaymentRequest = checkTransfer.stopPaymentRequest @@ -505,60 +421,31 @@ private constructor( @ExcludeMissing fun checkNumber(checkNumber: JsonField) = apply { this.checkNumber = checkNumber } - /** The street address of the check's destination. */ - fun addressLine1(addressLine1: String) = addressLine1(JsonField.of(addressLine1)) - - /** The street address of the check's destination. */ - @JsonProperty("address_line1") - @ExcludeMissing - fun addressLine1(addressLine1: JsonField) = apply { - this.addressLine1 = addressLine1 - } - - /** The second line of the address of the check's destination. */ - fun addressLine2(addressLine2: String) = addressLine2(JsonField.of(addressLine2)) - - /** The second line of the address of the check's destination. */ - @JsonProperty("address_line2") - @ExcludeMissing - fun addressLine2(addressLine2: JsonField) = apply { - this.addressLine2 = addressLine2 - } - - /** The city of the check's destination. */ - fun addressCity(addressCity: String) = addressCity(JsonField.of(addressCity)) - - /** The city of the check's destination. */ - @JsonProperty("address_city") - @ExcludeMissing - fun addressCity(addressCity: JsonField) = apply { this.addressCity = addressCity } - - /** The state of the check's destination. */ - fun addressState(addressState: String) = addressState(JsonField.of(addressState)) + /** Whether Increase will print and mail the check or if you will do it yourself. */ + fun fulfillmentMethod(fulfillmentMethod: FulfillmentMethod) = + fulfillmentMethod(JsonField.of(fulfillmentMethod)) - /** The state of the check's destination. */ - @JsonProperty("address_state") + /** Whether Increase will print and mail the check or if you will do it yourself. */ + @JsonProperty("fulfillment_method") @ExcludeMissing - fun addressState(addressState: JsonField) = apply { - this.addressState = addressState + fun fulfillmentMethod(fulfillmentMethod: JsonField) = apply { + this.fulfillmentMethod = fulfillmentMethod } - /** The postal code of the check's destination. */ - fun addressZip(addressZip: String) = addressZip(JsonField.of(addressZip)) - - /** The postal code of the check's destination. */ - @JsonProperty("address_zip") - @ExcludeMissing - fun addressZip(addressZip: JsonField) = apply { this.addressZip = addressZip } - - /** The return address to be printed on the check. */ - fun returnAddress(returnAddress: ReturnAddress) = returnAddress(JsonField.of(returnAddress)) + /** + * Details relating to the physical check that Increase will print and mail. Will be present + * if and only if `fulfillment_method` is equal to `physical_check`. + */ + fun physicalCheck(physicalCheck: PhysicalCheck) = physicalCheck(JsonField.of(physicalCheck)) - /** The return address to be printed on the check. */ - @JsonProperty("return_address") + /** + * Details relating to the physical check that Increase will print and mail. Will be present + * if and only if `fulfillment_method` is equal to `physical_check`. + */ + @JsonProperty("physical_check") @ExcludeMissing - fun returnAddress(returnAddress: JsonField) = apply { - this.returnAddress = returnAddress + fun physicalCheck(physicalCheck: JsonField) = apply { + this.physicalCheck = physicalCheck } /** The transfer amount in USD cents. */ @@ -627,35 +514,13 @@ private constructor( /** The Check transfer's identifier. */ @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - /** - * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the check - * was mailed. - */ - fun mailedAt(mailedAt: OffsetDateTime) = mailedAt(JsonField.of(mailedAt)) - - /** - * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the check - * was mailed. - */ - @JsonProperty("mailed_at") - @ExcludeMissing - fun mailedAt(mailedAt: JsonField) = apply { this.mailedAt = mailedAt } - - /** The descriptor that will be printed on the memo field on the check. */ - fun message(message: String) = message(JsonField.of(message)) + /** If the check has been mailed by Increase, this will contain details of the shipment. */ + fun mailing(mailing: Mailing) = mailing(JsonField.of(mailing)) - /** The descriptor that will be printed on the memo field on the check. */ - @JsonProperty("message") + /** If the check has been mailed by Increase, this will contain details of the shipment. */ + @JsonProperty("mailing") @ExcludeMissing - fun message(message: JsonField) = apply { this.message = message } - - /** The descriptor that will be printed on the letter included with the check. */ - fun note(note: String) = note(JsonField.of(note)) - - /** The descriptor that will be printed on the letter included with the check. */ - @JsonProperty("note") - @ExcludeMissing - fun note(note: JsonField) = apply { this.note = note } + fun mailing(mailing: JsonField) = apply { this.mailing = mailing } /** The identifier of the Pending Transaction associated with the check's creation. */ fun pendingTransactionId(pendingTransactionId: String) = @@ -668,16 +533,6 @@ private constructor( this.pendingTransactionId = pendingTransactionId } - /** The name that will be printed on the check. */ - fun recipientName(recipientName: String) = recipientName(JsonField.of(recipientName)) - - /** The name that will be printed on the check. */ - @JsonProperty("recipient_name") - @ExcludeMissing - fun recipientName(recipientName: JsonField) = apply { - this.recipientName = recipientName - } - /** The lifecycle status of the transfer. */ fun status(status: Status) = status(JsonField.of(status)) @@ -763,23 +618,16 @@ private constructor( accountNumber, routingNumber, checkNumber, - addressLine1, - addressLine2, - addressCity, - addressState, - addressZip, - returnAddress, + fulfillmentMethod, + physicalCheck, amount, createdAt, currency, approval, cancellation, id, - mailedAt, - message, - note, + mailing, pendingTransactionId, - recipientName, status, submission, stopPaymentRequest, @@ -790,17 +638,76 @@ private constructor( ) } - /** The return address to be printed on the check. */ - @JsonDeserialize(builder = ReturnAddress.Builder::class) + class FulfillmentMethod + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is FulfillmentMethod && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + val PHYSICAL_CHECK = FulfillmentMethod(JsonField.of("physical_check")) + + val THIRD_PARTY = FulfillmentMethod(JsonField.of("third_party")) + + fun of(value: String) = FulfillmentMethod(JsonField.of(value)) + } + + enum class Known { + PHYSICAL_CHECK, + THIRD_PARTY, + } + + enum class Value { + PHYSICAL_CHECK, + THIRD_PARTY, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + PHYSICAL_CHECK -> Value.PHYSICAL_CHECK + THIRD_PARTY -> Value.THIRD_PARTY + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + PHYSICAL_CHECK -> Known.PHYSICAL_CHECK + THIRD_PARTY -> Known.THIRD_PARTY + else -> throw IncreaseInvalidDataException("Unknown FulfillmentMethod: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + /** + * Details relating to the physical check that Increase will print and mail. Will be present if + * and only if `fulfillment_method` is equal to `physical_check`. + */ + @JsonDeserialize(builder = PhysicalCheck.Builder::class) @NoAutoDetect - class ReturnAddress + class PhysicalCheck private constructor( - private val name: JsonField, - private val line1: JsonField, - private val line2: JsonField, - private val city: JsonField, - private val state: JsonField, - private val zip: JsonField, + private val memo: JsonField, + private val note: JsonField, + private val recipientName: JsonField, + private val mailingAddress: JsonField, + private val returnAddress: JsonField, private val additionalProperties: Map, ) { @@ -808,54 +715,47 @@ private constructor( private var hashCode: Int = 0 - /** The name of the address. */ - fun name(): String? = name.getNullable("name") - - /** The first line of the address. */ - fun line1(): String? = line1.getNullable("line1") - - /** The second line of the address. */ - fun line2(): String? = line2.getNullable("line2") + /** The descriptor that will be printed on the memo field on the check. */ + fun memo(): String? = memo.getNullable("memo") - /** The city of the address. */ - fun city(): String? = city.getNullable("city") + /** The descriptor that will be printed on the letter included with the check. */ + fun note(): String? = note.getNullable("note") - /** The US state of the address. */ - fun state(): String? = state.getNullable("state") + /** The name that will be printed on the check. */ + fun recipientName(): String? = recipientName.getNullable("recipient_name") - /** The postal code of the address. */ - fun zip(): String? = zip.getNullable("zip") + /** Details for where Increase will mail the check. */ + fun mailingAddress(): MailingAddress = mailingAddress.getRequired("mailing_address") - /** The name of the address. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name + /** The return address to be printed on the check. */ + fun returnAddress(): ReturnAddress? = returnAddress.getNullable("return_address") - /** The first line of the address. */ - @JsonProperty("line1") @ExcludeMissing fun _line1() = line1 + /** The descriptor that will be printed on the memo field on the check. */ + @JsonProperty("memo") @ExcludeMissing fun _memo() = memo - /** The second line of the address. */ - @JsonProperty("line2") @ExcludeMissing fun _line2() = line2 + /** The descriptor that will be printed on the letter included with the check. */ + @JsonProperty("note") @ExcludeMissing fun _note() = note - /** The city of the address. */ - @JsonProperty("city") @ExcludeMissing fun _city() = city + /** The name that will be printed on the check. */ + @JsonProperty("recipient_name") @ExcludeMissing fun _recipientName() = recipientName - /** The US state of the address. */ - @JsonProperty("state") @ExcludeMissing fun _state() = state + /** Details for where Increase will mail the check. */ + @JsonProperty("mailing_address") @ExcludeMissing fun _mailingAddress() = mailingAddress - /** The postal code of the address. */ - @JsonProperty("zip") @ExcludeMissing fun _zip() = zip + /** The return address to be printed on the check. */ + @JsonProperty("return_address") @ExcludeMissing fun _returnAddress() = returnAddress @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): ReturnAddress = apply { + fun validate(): PhysicalCheck = apply { if (!validated) { - name() - line1() - line2() - city() - state() - zip() + memo() + note() + recipientName() + mailingAddress().validate() + returnAddress()?.validate() validated = true } } @@ -867,13 +767,12 @@ private constructor( return true } - return other is ReturnAddress && - this.name == other.name && - this.line1 == other.line1 && - this.line2 == other.line2 && - this.city == other.city && - this.state == other.state && - this.zip == other.zip && + return other is PhysicalCheck && + this.memo == other.memo && + this.note == other.note && + this.recipientName == other.recipientName && + this.mailingAddress == other.mailingAddress && + this.returnAddress == other.returnAddress && this.additionalProperties == other.additionalProperties } @@ -881,12 +780,11 @@ private constructor( if (hashCode == 0) { hashCode = Objects.hash( - name, - line1, - line2, - city, - state, - zip, + memo, + note, + recipientName, + mailingAddress, + returnAddress, additionalProperties, ) } @@ -894,7 +792,7 @@ private constructor( } override fun toString() = - "ReturnAddress{name=$name, line1=$line1, line2=$line2, city=$city, state=$state, zip=$zip, additionalProperties=$additionalProperties}" + "PhysicalCheck{memo=$memo, note=$note, recipientName=$recipientName, mailingAddress=$mailingAddress, returnAddress=$returnAddress, additionalProperties=$additionalProperties}" companion object { @@ -903,71 +801,69 @@ private constructor( class Builder { - private var name: JsonField = JsonMissing.of() - private var line1: JsonField = JsonMissing.of() - private var line2: JsonField = JsonMissing.of() - private var city: JsonField = JsonMissing.of() - private var state: JsonField = JsonMissing.of() - private var zip: JsonField = JsonMissing.of() + private var memo: JsonField = JsonMissing.of() + private var note: JsonField = JsonMissing.of() + private var recipientName: JsonField = JsonMissing.of() + private var mailingAddress: JsonField = JsonMissing.of() + private var returnAddress: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() - internal fun from(returnAddress: ReturnAddress) = apply { - this.name = returnAddress.name - this.line1 = returnAddress.line1 - this.line2 = returnAddress.line2 - this.city = returnAddress.city - this.state = returnAddress.state - this.zip = returnAddress.zip - additionalProperties(returnAddress.additionalProperties) + internal fun from(physicalCheck: PhysicalCheck) = apply { + this.memo = physicalCheck.memo + this.note = physicalCheck.note + this.recipientName = physicalCheck.recipientName + this.mailingAddress = physicalCheck.mailingAddress + this.returnAddress = physicalCheck.returnAddress + additionalProperties(physicalCheck.additionalProperties) } - /** The name of the address. */ - fun name(name: String) = name(JsonField.of(name)) + /** The descriptor that will be printed on the memo field on the check. */ + fun memo(memo: String) = memo(JsonField.of(memo)) - /** The name of the address. */ - @JsonProperty("name") + /** The descriptor that will be printed on the memo field on the check. */ + @JsonProperty("memo") @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } + fun memo(memo: JsonField) = apply { this.memo = memo } - /** The first line of the address. */ - fun line1(line1: String) = line1(JsonField.of(line1)) + /** The descriptor that will be printed on the letter included with the check. */ + fun note(note: String) = note(JsonField.of(note)) - /** The first line of the address. */ - @JsonProperty("line1") + /** The descriptor that will be printed on the letter included with the check. */ + @JsonProperty("note") @ExcludeMissing - fun line1(line1: JsonField) = apply { this.line1 = line1 } + fun note(note: JsonField) = apply { this.note = note } - /** The second line of the address. */ - fun line2(line2: String) = line2(JsonField.of(line2)) + /** The name that will be printed on the check. */ + fun recipientName(recipientName: String) = recipientName(JsonField.of(recipientName)) - /** The second line of the address. */ - @JsonProperty("line2") + /** The name that will be printed on the check. */ + @JsonProperty("recipient_name") @ExcludeMissing - fun line2(line2: JsonField) = apply { this.line2 = line2 } - - /** The city of the address. */ - fun city(city: String) = city(JsonField.of(city)) - - /** The city of the address. */ - @JsonProperty("city") - @ExcludeMissing - fun city(city: JsonField) = apply { this.city = city } + fun recipientName(recipientName: JsonField) = apply { + this.recipientName = recipientName + } - /** The US state of the address. */ - fun state(state: String) = state(JsonField.of(state)) + /** Details for where Increase will mail the check. */ + fun mailingAddress(mailingAddress: MailingAddress) = + mailingAddress(JsonField.of(mailingAddress)) - /** The US state of the address. */ - @JsonProperty("state") + /** Details for where Increase will mail the check. */ + @JsonProperty("mailing_address") @ExcludeMissing - fun state(state: JsonField) = apply { this.state = state } + fun mailingAddress(mailingAddress: JsonField) = apply { + this.mailingAddress = mailingAddress + } - /** The postal code of the address. */ - fun zip(zip: String) = zip(JsonField.of(zip)) + /** The return address to be printed on the check. */ + fun returnAddress(returnAddress: ReturnAddress) = + returnAddress(JsonField.of(returnAddress)) - /** The postal code of the address. */ - @JsonProperty("zip") + /** The return address to be printed on the check. */ + @JsonProperty("return_address") @ExcludeMissing - fun zip(zip: JsonField) = apply { this.zip = zip } + fun returnAddress(returnAddress: JsonField) = apply { + this.returnAddress = returnAddress + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -983,17 +879,434 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): ReturnAddress = - ReturnAddress( - name, - line1, - line2, - city, - state, - zip, + fun build(): PhysicalCheck = + PhysicalCheck( + memo, + note, + recipientName, + mailingAddress, + returnAddress, additionalProperties.toUnmodifiable(), ) } + + /** Details for where Increase will mail the check. */ + @JsonDeserialize(builder = MailingAddress.Builder::class) + @NoAutoDetect + class MailingAddress + private constructor( + private val name: JsonField, + private val line1: JsonField, + private val line2: JsonField, + private val city: JsonField, + private val state: JsonField, + private val postalCode: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The name component of the check's mailing address. */ + fun name(): String? = name.getNullable("name") + + /** The street address of the check's destination. */ + fun line1(): String? = line1.getNullable("line1") + + /** The second line of the address of the check's destination. */ + fun line2(): String? = line2.getNullable("line2") + + /** The city of the check's destination. */ + fun city(): String? = city.getNullable("city") + + /** The state of the check's destination. */ + fun state(): String? = state.getNullable("state") + + /** The postal code of the check's destination. */ + fun postalCode(): String? = postalCode.getNullable("postal_code") + + /** The name component of the check's mailing address. */ + @JsonProperty("name") @ExcludeMissing fun _name() = name + + /** The street address of the check's destination. */ + @JsonProperty("line1") @ExcludeMissing fun _line1() = line1 + + /** The second line of the address of the check's destination. */ + @JsonProperty("line2") @ExcludeMissing fun _line2() = line2 + + /** The city of the check's destination. */ + @JsonProperty("city") @ExcludeMissing fun _city() = city + + /** The state of the check's destination. */ + @JsonProperty("state") @ExcludeMissing fun _state() = state + + /** The postal code of the check's destination. */ + @JsonProperty("postal_code") @ExcludeMissing fun _postalCode() = postalCode + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): MailingAddress = apply { + if (!validated) { + name() + line1() + line2() + city() + state() + postalCode() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is MailingAddress && + this.name == other.name && + this.line1 == other.line1 && + this.line2 == other.line2 && + this.city == other.city && + this.state == other.state && + this.postalCode == other.postalCode && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + name, + line1, + line2, + city, + state, + postalCode, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "MailingAddress{name=$name, line1=$line1, line2=$line2, city=$city, state=$state, postalCode=$postalCode, additionalProperties=$additionalProperties}" + + companion object { + + fun builder() = Builder() + } + + class Builder { + + private var name: JsonField = JsonMissing.of() + private var line1: JsonField = JsonMissing.of() + private var line2: JsonField = JsonMissing.of() + private var city: JsonField = JsonMissing.of() + private var state: JsonField = JsonMissing.of() + private var postalCode: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + internal fun from(mailingAddress: MailingAddress) = apply { + this.name = mailingAddress.name + this.line1 = mailingAddress.line1 + this.line2 = mailingAddress.line2 + this.city = mailingAddress.city + this.state = mailingAddress.state + this.postalCode = mailingAddress.postalCode + additionalProperties(mailingAddress.additionalProperties) + } + + /** The name component of the check's mailing address. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The name component of the check's mailing address. */ + @JsonProperty("name") + @ExcludeMissing + fun name(name: JsonField) = apply { this.name = name } + + /** The street address of the check's destination. */ + fun line1(line1: String) = line1(JsonField.of(line1)) + + /** The street address of the check's destination. */ + @JsonProperty("line1") + @ExcludeMissing + fun line1(line1: JsonField) = apply { this.line1 = line1 } + + /** The second line of the address of the check's destination. */ + fun line2(line2: String) = line2(JsonField.of(line2)) + + /** The second line of the address of the check's destination. */ + @JsonProperty("line2") + @ExcludeMissing + fun line2(line2: JsonField) = apply { this.line2 = line2 } + + /** The city of the check's destination. */ + fun city(city: String) = city(JsonField.of(city)) + + /** The city of the check's destination. */ + @JsonProperty("city") + @ExcludeMissing + fun city(city: JsonField) = apply { this.city = city } + + /** The state of the check's destination. */ + fun state(state: String) = state(JsonField.of(state)) + + /** The state of the check's destination. */ + @JsonProperty("state") + @ExcludeMissing + fun state(state: JsonField) = apply { this.state = state } + + /** The postal code of the check's destination. */ + fun postalCode(postalCode: String) = postalCode(JsonField.of(postalCode)) + + /** The postal code of the check's destination. */ + @JsonProperty("postal_code") + @ExcludeMissing + fun postalCode(postalCode: JsonField) = apply { + this.postalCode = postalCode + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): MailingAddress = + MailingAddress( + name, + line1, + line2, + city, + state, + postalCode, + additionalProperties.toUnmodifiable(), + ) + } + } + + /** The return address to be printed on the check. */ + @JsonDeserialize(builder = ReturnAddress.Builder::class) + @NoAutoDetect + class ReturnAddress + private constructor( + private val name: JsonField, + private val line1: JsonField, + private val line2: JsonField, + private val city: JsonField, + private val state: JsonField, + private val postalCode: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The name component of the check's return address. */ + fun name(): String? = name.getNullable("name") + + /** The street address of the check's destination. */ + fun line1(): String? = line1.getNullable("line1") + + /** The second line of the address of the check's destination. */ + fun line2(): String? = line2.getNullable("line2") + + /** The city of the check's destination. */ + fun city(): String? = city.getNullable("city") + + /** The state of the check's destination. */ + fun state(): String? = state.getNullable("state") + + /** The postal code of the check's destination. */ + fun postalCode(): String? = postalCode.getNullable("postal_code") + + /** The name component of the check's return address. */ + @JsonProperty("name") @ExcludeMissing fun _name() = name + + /** The street address of the check's destination. */ + @JsonProperty("line1") @ExcludeMissing fun _line1() = line1 + + /** The second line of the address of the check's destination. */ + @JsonProperty("line2") @ExcludeMissing fun _line2() = line2 + + /** The city of the check's destination. */ + @JsonProperty("city") @ExcludeMissing fun _city() = city + + /** The state of the check's destination. */ + @JsonProperty("state") @ExcludeMissing fun _state() = state + + /** The postal code of the check's destination. */ + @JsonProperty("postal_code") @ExcludeMissing fun _postalCode() = postalCode + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): ReturnAddress = apply { + if (!validated) { + name() + line1() + line2() + city() + state() + postalCode() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ReturnAddress && + this.name == other.name && + this.line1 == other.line1 && + this.line2 == other.line2 && + this.city == other.city && + this.state == other.state && + this.postalCode == other.postalCode && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + name, + line1, + line2, + city, + state, + postalCode, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "ReturnAddress{name=$name, line1=$line1, line2=$line2, city=$city, state=$state, postalCode=$postalCode, additionalProperties=$additionalProperties}" + + companion object { + + fun builder() = Builder() + } + + class Builder { + + private var name: JsonField = JsonMissing.of() + private var line1: JsonField = JsonMissing.of() + private var line2: JsonField = JsonMissing.of() + private var city: JsonField = JsonMissing.of() + private var state: JsonField = JsonMissing.of() + private var postalCode: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + internal fun from(returnAddress: ReturnAddress) = apply { + this.name = returnAddress.name + this.line1 = returnAddress.line1 + this.line2 = returnAddress.line2 + this.city = returnAddress.city + this.state = returnAddress.state + this.postalCode = returnAddress.postalCode + additionalProperties(returnAddress.additionalProperties) + } + + /** The name component of the check's return address. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The name component of the check's return address. */ + @JsonProperty("name") + @ExcludeMissing + fun name(name: JsonField) = apply { this.name = name } + + /** The street address of the check's destination. */ + fun line1(line1: String) = line1(JsonField.of(line1)) + + /** The street address of the check's destination. */ + @JsonProperty("line1") + @ExcludeMissing + fun line1(line1: JsonField) = apply { this.line1 = line1 } + + /** The second line of the address of the check's destination. */ + fun line2(line2: String) = line2(JsonField.of(line2)) + + /** The second line of the address of the check's destination. */ + @JsonProperty("line2") + @ExcludeMissing + fun line2(line2: JsonField) = apply { this.line2 = line2 } + + /** The city of the check's destination. */ + fun city(city: String) = city(JsonField.of(city)) + + /** The city of the check's destination. */ + @JsonProperty("city") + @ExcludeMissing + fun city(city: JsonField) = apply { this.city = city } + + /** The state of the check's destination. */ + fun state(state: String) = state(JsonField.of(state)) + + /** The state of the check's destination. */ + @JsonProperty("state") + @ExcludeMissing + fun state(state: JsonField) = apply { this.state = state } + + /** The postal code of the check's destination. */ + fun postalCode(postalCode: String) = postalCode(JsonField.of(postalCode)) + + /** The postal code of the check's destination. */ + @JsonProperty("postal_code") + @ExcludeMissing + fun postalCode(postalCode: JsonField) = apply { + this.postalCode = postalCode + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): ReturnAddress = + ReturnAddress( + name, + line1, + line2, + city, + state, + postalCode, + additionalProperties.toUnmodifiable(), + ) + } + } } class Currency @@ -1375,6 +1688,111 @@ private constructor( } } + /** If the check has been mailed by Increase, this will contain details of the shipment. */ + @JsonDeserialize(builder = Mailing.Builder::class) + @NoAutoDetect + class Mailing + private constructor( + private val mailedAt: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the check + * was mailed. + */ + fun mailedAt(): OffsetDateTime = mailedAt.getRequired("mailed_at") + + /** + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the check + * was mailed. + */ + @JsonProperty("mailed_at") @ExcludeMissing fun _mailedAt() = mailedAt + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Mailing = apply { + if (!validated) { + mailedAt() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Mailing && + this.mailedAt == other.mailedAt && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(mailedAt, additionalProperties) + } + return hashCode + } + + override fun toString() = + "Mailing{mailedAt=$mailedAt, additionalProperties=$additionalProperties}" + + companion object { + + fun builder() = Builder() + } + + class Builder { + + private var mailedAt: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + internal fun from(mailing: Mailing) = apply { + this.mailedAt = mailing.mailedAt + additionalProperties(mailing.additionalProperties) + } + + /** + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the + * check was mailed. + */ + fun mailedAt(mailedAt: OffsetDateTime) = mailedAt(JsonField.of(mailedAt)) + + /** + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the + * check was mailed. + */ + @JsonProperty("mailed_at") + @ExcludeMissing + fun mailedAt(mailedAt: JsonField) = apply { this.mailedAt = mailedAt } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): Mailing = Mailing(mailedAt, additionalProperties.toUnmodifiable()) + } + } + class Status @JsonCreator private constructor( diff --git a/increase-kotlin-core/src/main/kotlin/com/increase/api/models/CheckTransferCreateParams.kt b/increase-kotlin-core/src/main/kotlin/com/increase/api/models/CheckTransferCreateParams.kt index 6aa88d7f9..7b2fb1795 100644 --- a/increase-kotlin-core/src/main/kotlin/com/increase/api/models/CheckTransferCreateParams.kt +++ b/increase-kotlin-core/src/main/kotlin/com/increase/api/models/CheckTransferCreateParams.kt @@ -2,12 +2,15 @@ package com.increase.api.models 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.fasterxml.jackson.databind.annotation.JsonDeserialize import com.increase.api.core.ExcludeMissing +import com.increase.api.core.JsonField import com.increase.api.core.JsonValue import com.increase.api.core.NoAutoDetect import com.increase.api.core.toUnmodifiable +import com.increase.api.errors.IncreaseInvalidDataException import com.increase.api.models.* import java.util.Objects @@ -15,16 +18,9 @@ class CheckTransferCreateParams constructor( private val accountId: String, private val sourceAccountNumberId: String?, - private val addressLine1: String, - private val addressLine2: String?, - private val addressCity: String, - private val addressState: String, - private val addressZip: String, - private val returnAddress: ReturnAddress?, + private val fulfillmentMethod: FulfillmentMethod?, + private val physicalCheck: PhysicalCheck?, private val amount: Long, - private val message: String, - private val note: String?, - private val recipientName: String, private val requireApproval: Boolean?, private val uniqueIdentifier: String?, private val additionalQueryParams: Map>, @@ -36,26 +32,12 @@ constructor( fun sourceAccountNumberId(): String? = sourceAccountNumberId - fun addressLine1(): String = addressLine1 + fun fulfillmentMethod(): FulfillmentMethod? = fulfillmentMethod - fun addressLine2(): String? = addressLine2 - - fun addressCity(): String = addressCity - - fun addressState(): String = addressState - - fun addressZip(): String = addressZip - - fun returnAddress(): ReturnAddress? = returnAddress + fun physicalCheck(): PhysicalCheck? = physicalCheck fun amount(): Long = amount - fun message(): String = message - - fun note(): String? = note - - fun recipientName(): String = recipientName - fun requireApproval(): Boolean? = requireApproval fun uniqueIdentifier(): String? = uniqueIdentifier @@ -64,16 +46,9 @@ constructor( return CheckTransferCreateBody( accountId, sourceAccountNumberId, - addressLine1, - addressLine2, - addressCity, - addressState, - addressZip, - returnAddress, + fulfillmentMethod, + physicalCheck, amount, - message, - note, - recipientName, requireApproval, uniqueIdentifier, additionalBodyProperties, @@ -90,16 +65,9 @@ constructor( internal constructor( private val accountId: String?, private val sourceAccountNumberId: String?, - private val addressLine1: String?, - private val addressLine2: String?, - private val addressCity: String?, - private val addressState: String?, - private val addressZip: String?, - private val returnAddress: ReturnAddress?, + private val fulfillmentMethod: FulfillmentMethod?, + private val physicalCheck: PhysicalCheck?, private val amount: Long?, - private val message: String?, - private val note: String?, - private val recipientName: String?, private val requireApproval: Boolean?, private val uniqueIdentifier: String?, private val additionalProperties: Map, @@ -117,39 +85,20 @@ constructor( @JsonProperty("source_account_number_id") fun sourceAccountNumberId(): String? = sourceAccountNumberId - /** The street address of the check's destination. */ - @JsonProperty("address_line1") fun addressLine1(): String? = addressLine1 - - /** The second line of the address of the check's destination. */ - @JsonProperty("address_line2") fun addressLine2(): String? = addressLine2 - - /** The city of the check's destination. */ - @JsonProperty("address_city") fun addressCity(): String? = addressCity - - /** The state of the check's destination. */ - @JsonProperty("address_state") fun addressState(): String? = addressState - - /** The postal code of the check's destination. */ - @JsonProperty("address_zip") fun addressZip(): String? = addressZip + /** Whether Increase will print and mail the check or if you will do it yourself. */ + @JsonProperty("fulfillment_method") + fun fulfillmentMethod(): FulfillmentMethod? = fulfillmentMethod /** - * The return address to be printed on the check. If omitted this will default to the - * address of the Entity of the Account used to make the Check Transfer. + * Details relating to the physical check that Increase will print and mail. This is + * required if `fulfillment_method` is equal to `physical_check`. It must not be included if + * any other `fulfillment_method` is provided. */ - @JsonProperty("return_address") fun returnAddress(): ReturnAddress? = returnAddress + @JsonProperty("physical_check") fun physicalCheck(): PhysicalCheck? = physicalCheck /** The transfer amount in cents. */ @JsonProperty("amount") fun amount(): Long? = amount - /** The descriptor that will be printed on the memo field on the check. */ - @JsonProperty("message") fun message(): String? = message - - /** The descriptor that will be printed on the letter included with the check. */ - @JsonProperty("note") fun note(): String? = note - - /** The name that will be printed on the check. */ - @JsonProperty("recipient_name") fun recipientName(): String? = recipientName - /** Whether the transfer requires explicit approval via the dashboard or API. */ @JsonProperty("require_approval") fun requireApproval(): Boolean? = requireApproval @@ -174,16 +123,9 @@ constructor( return other is CheckTransferCreateBody && this.accountId == other.accountId && this.sourceAccountNumberId == other.sourceAccountNumberId && - this.addressLine1 == other.addressLine1 && - this.addressLine2 == other.addressLine2 && - this.addressCity == other.addressCity && - this.addressState == other.addressState && - this.addressZip == other.addressZip && - this.returnAddress == other.returnAddress && + this.fulfillmentMethod == other.fulfillmentMethod && + this.physicalCheck == other.physicalCheck && this.amount == other.amount && - this.message == other.message && - this.note == other.note && - this.recipientName == other.recipientName && this.requireApproval == other.requireApproval && this.uniqueIdentifier == other.uniqueIdentifier && this.additionalProperties == other.additionalProperties @@ -195,16 +137,9 @@ constructor( Objects.hash( accountId, sourceAccountNumberId, - addressLine1, - addressLine2, - addressCity, - addressState, - addressZip, - returnAddress, + fulfillmentMethod, + physicalCheck, amount, - message, - note, - recipientName, requireApproval, uniqueIdentifier, additionalProperties, @@ -214,7 +149,7 @@ constructor( } override fun toString() = - "CheckTransferCreateBody{accountId=$accountId, sourceAccountNumberId=$sourceAccountNumberId, addressLine1=$addressLine1, addressLine2=$addressLine2, addressCity=$addressCity, addressState=$addressState, addressZip=$addressZip, returnAddress=$returnAddress, amount=$amount, message=$message, note=$note, recipientName=$recipientName, requireApproval=$requireApproval, uniqueIdentifier=$uniqueIdentifier, additionalProperties=$additionalProperties}" + "CheckTransferCreateBody{accountId=$accountId, sourceAccountNumberId=$sourceAccountNumberId, fulfillmentMethod=$fulfillmentMethod, physicalCheck=$physicalCheck, amount=$amount, requireApproval=$requireApproval, uniqueIdentifier=$uniqueIdentifier, additionalProperties=$additionalProperties}" companion object { @@ -225,16 +160,9 @@ constructor( private var accountId: String? = null private var sourceAccountNumberId: String? = null - private var addressLine1: String? = null - private var addressLine2: String? = null - private var addressCity: String? = null - private var addressState: String? = null - private var addressZip: String? = null - private var returnAddress: ReturnAddress? = null + private var fulfillmentMethod: FulfillmentMethod? = null + private var physicalCheck: PhysicalCheck? = null private var amount: Long? = null - private var message: String? = null - private var note: String? = null - private var recipientName: String? = null private var requireApproval: Boolean? = null private var uniqueIdentifier: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -242,16 +170,9 @@ constructor( internal fun from(checkTransferCreateBody: CheckTransferCreateBody) = apply { this.accountId = checkTransferCreateBody.accountId this.sourceAccountNumberId = checkTransferCreateBody.sourceAccountNumberId - this.addressLine1 = checkTransferCreateBody.addressLine1 - this.addressLine2 = checkTransferCreateBody.addressLine2 - this.addressCity = checkTransferCreateBody.addressCity - this.addressState = checkTransferCreateBody.addressState - this.addressZip = checkTransferCreateBody.addressZip - this.returnAddress = checkTransferCreateBody.returnAddress + this.fulfillmentMethod = checkTransferCreateBody.fulfillmentMethod + this.physicalCheck = checkTransferCreateBody.physicalCheck this.amount = checkTransferCreateBody.amount - this.message = checkTransferCreateBody.message - this.note = checkTransferCreateBody.note - this.recipientName = checkTransferCreateBody.recipientName this.requireApproval = checkTransferCreateBody.requireApproval this.uniqueIdentifier = checkTransferCreateBody.uniqueIdentifier additionalProperties(checkTransferCreateBody.additionalProperties) @@ -270,48 +191,25 @@ constructor( this.sourceAccountNumberId = sourceAccountNumberId } - /** The street address of the check's destination. */ - @JsonProperty("address_line1") - fun addressLine1(addressLine1: String) = apply { this.addressLine1 = addressLine1 } - - /** The second line of the address of the check's destination. */ - @JsonProperty("address_line2") - fun addressLine2(addressLine2: String) = apply { this.addressLine2 = addressLine2 } - - /** The city of the check's destination. */ - @JsonProperty("address_city") - fun addressCity(addressCity: String) = apply { this.addressCity = addressCity } - - /** The state of the check's destination. */ - @JsonProperty("address_state") - fun addressState(addressState: String) = apply { this.addressState = addressState } - - /** The postal code of the check's destination. */ - @JsonProperty("address_zip") - fun addressZip(addressZip: String) = apply { this.addressZip = addressZip } + /** Whether Increase will print and mail the check or if you will do it yourself. */ + @JsonProperty("fulfillment_method") + fun fulfillmentMethod(fulfillmentMethod: FulfillmentMethod) = apply { + this.fulfillmentMethod = fulfillmentMethod + } /** - * The return address to be printed on the check. If omitted this will default to the - * address of the Entity of the Account used to make the Check Transfer. + * Details relating to the physical check that Increase will print and mail. This is + * required if `fulfillment_method` is equal to `physical_check`. It must not be + * included if any other `fulfillment_method` is provided. */ - @JsonProperty("return_address") - fun returnAddress(returnAddress: ReturnAddress) = apply { - this.returnAddress = returnAddress + @JsonProperty("physical_check") + fun physicalCheck(physicalCheck: PhysicalCheck) = apply { + this.physicalCheck = physicalCheck } /** The transfer amount in cents. */ @JsonProperty("amount") fun amount(amount: Long) = apply { this.amount = amount } - /** The descriptor that will be printed on the memo field on the check. */ - @JsonProperty("message") fun message(message: String) = apply { this.message = message } - - /** The descriptor that will be printed on the letter included with the check. */ - @JsonProperty("note") fun note(note: String) = apply { this.note = note } - - /** The name that will be printed on the check. */ - @JsonProperty("recipient_name") - fun recipientName(recipientName: String) = apply { this.recipientName = recipientName } - /** Whether the transfer requires explicit approval via the dashboard or API. */ @JsonProperty("require_approval") fun requireApproval(requireApproval: Boolean) = apply { @@ -346,16 +244,9 @@ constructor( CheckTransferCreateBody( checkNotNull(accountId) { "`accountId` is required but was not set" }, sourceAccountNumberId, - checkNotNull(addressLine1) { "`addressLine1` is required but was not set" }, - addressLine2, - checkNotNull(addressCity) { "`addressCity` is required but was not set" }, - checkNotNull(addressState) { "`addressState` is required but was not set" }, - checkNotNull(addressZip) { "`addressZip` is required but was not set" }, - returnAddress, + fulfillmentMethod, + physicalCheck, checkNotNull(amount) { "`amount` is required but was not set" }, - checkNotNull(message) { "`message` is required but was not set" }, - note, - checkNotNull(recipientName) { "`recipientName` is required but was not set" }, requireApproval, uniqueIdentifier, additionalProperties.toUnmodifiable(), @@ -377,16 +268,9 @@ constructor( return other is CheckTransferCreateParams && this.accountId == other.accountId && this.sourceAccountNumberId == other.sourceAccountNumberId && - this.addressLine1 == other.addressLine1 && - this.addressLine2 == other.addressLine2 && - this.addressCity == other.addressCity && - this.addressState == other.addressState && - this.addressZip == other.addressZip && - this.returnAddress == other.returnAddress && + this.fulfillmentMethod == other.fulfillmentMethod && + this.physicalCheck == other.physicalCheck && this.amount == other.amount && - this.message == other.message && - this.note == other.note && - this.recipientName == other.recipientName && this.requireApproval == other.requireApproval && this.uniqueIdentifier == other.uniqueIdentifier && this.additionalQueryParams == other.additionalQueryParams && @@ -398,16 +282,9 @@ constructor( return Objects.hash( accountId, sourceAccountNumberId, - addressLine1, - addressLine2, - addressCity, - addressState, - addressZip, - returnAddress, + fulfillmentMethod, + physicalCheck, amount, - message, - note, - recipientName, requireApproval, uniqueIdentifier, additionalQueryParams, @@ -417,7 +294,7 @@ constructor( } override fun toString() = - "CheckTransferCreateParams{accountId=$accountId, sourceAccountNumberId=$sourceAccountNumberId, addressLine1=$addressLine1, addressLine2=$addressLine2, addressCity=$addressCity, addressState=$addressState, addressZip=$addressZip, returnAddress=$returnAddress, amount=$amount, message=$message, note=$note, recipientName=$recipientName, requireApproval=$requireApproval, uniqueIdentifier=$uniqueIdentifier, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "CheckTransferCreateParams{accountId=$accountId, sourceAccountNumberId=$sourceAccountNumberId, fulfillmentMethod=$fulfillmentMethod, physicalCheck=$physicalCheck, amount=$amount, requireApproval=$requireApproval, uniqueIdentifier=$uniqueIdentifier, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -431,16 +308,9 @@ constructor( private var accountId: String? = null private var sourceAccountNumberId: String? = null - private var addressLine1: String? = null - private var addressLine2: String? = null - private var addressCity: String? = null - private var addressState: String? = null - private var addressZip: String? = null - private var returnAddress: ReturnAddress? = null + private var fulfillmentMethod: FulfillmentMethod? = null + private var physicalCheck: PhysicalCheck? = null private var amount: Long? = null - private var message: String? = null - private var note: String? = null - private var recipientName: String? = null private var requireApproval: Boolean? = null private var uniqueIdentifier: String? = null private var additionalQueryParams: MutableMap> = mutableMapOf() @@ -450,16 +320,9 @@ constructor( internal fun from(checkTransferCreateParams: CheckTransferCreateParams) = apply { this.accountId = checkTransferCreateParams.accountId this.sourceAccountNumberId = checkTransferCreateParams.sourceAccountNumberId - this.addressLine1 = checkTransferCreateParams.addressLine1 - this.addressLine2 = checkTransferCreateParams.addressLine2 - this.addressCity = checkTransferCreateParams.addressCity - this.addressState = checkTransferCreateParams.addressState - this.addressZip = checkTransferCreateParams.addressZip - this.returnAddress = checkTransferCreateParams.returnAddress + this.fulfillmentMethod = checkTransferCreateParams.fulfillmentMethod + this.physicalCheck = checkTransferCreateParams.physicalCheck this.amount = checkTransferCreateParams.amount - this.message = checkTransferCreateParams.message - this.note = checkTransferCreateParams.note - this.recipientName = checkTransferCreateParams.recipientName this.requireApproval = checkTransferCreateParams.requireApproval this.uniqueIdentifier = checkTransferCreateParams.uniqueIdentifier additionalQueryParams(checkTransferCreateParams.additionalQueryParams) @@ -478,41 +341,23 @@ constructor( this.sourceAccountNumberId = sourceAccountNumberId } - /** The street address of the check's destination. */ - fun addressLine1(addressLine1: String) = apply { this.addressLine1 = addressLine1 } - - /** The second line of the address of the check's destination. */ - fun addressLine2(addressLine2: String) = apply { this.addressLine2 = addressLine2 } - - /** The city of the check's destination. */ - fun addressCity(addressCity: String) = apply { this.addressCity = addressCity } - - /** The state of the check's destination. */ - fun addressState(addressState: String) = apply { this.addressState = addressState } - - /** The postal code of the check's destination. */ - fun addressZip(addressZip: String) = apply { this.addressZip = addressZip } + /** Whether Increase will print and mail the check or if you will do it yourself. */ + fun fulfillmentMethod(fulfillmentMethod: FulfillmentMethod) = apply { + this.fulfillmentMethod = fulfillmentMethod + } /** - * The return address to be printed on the check. If omitted this will default to the - * address of the Entity of the Account used to make the Check Transfer. + * Details relating to the physical check that Increase will print and mail. This is + * required if `fulfillment_method` is equal to `physical_check`. It must not be included if + * any other `fulfillment_method` is provided. */ - fun returnAddress(returnAddress: ReturnAddress) = apply { - this.returnAddress = returnAddress + fun physicalCheck(physicalCheck: PhysicalCheck) = apply { + this.physicalCheck = physicalCheck } /** The transfer amount in cents. */ fun amount(amount: Long) = apply { this.amount = amount } - /** The descriptor that will be printed on the memo field on the check. */ - fun message(message: String) = apply { this.message = message } - - /** The descriptor that will be printed on the letter included with the check. */ - fun note(note: String) = apply { this.note = note } - - /** The name that will be printed on the check. */ - fun recipientName(recipientName: String) = apply { this.recipientName = recipientName } - /** Whether the transfer requires explicit approval via the dashboard or API. */ fun requireApproval(requireApproval: Boolean) = apply { this.requireApproval = requireApproval @@ -585,16 +430,9 @@ constructor( CheckTransferCreateParams( checkNotNull(accountId) { "`accountId` is required but was not set" }, sourceAccountNumberId, - checkNotNull(addressLine1) { "`addressLine1` is required but was not set" }, - addressLine2, - checkNotNull(addressCity) { "`addressCity` is required but was not set" }, - checkNotNull(addressState) { "`addressState` is required but was not set" }, - checkNotNull(addressZip) { "`addressZip` is required but was not set" }, - returnAddress, + fulfillmentMethod, + physicalCheck, checkNotNull(amount) { "`amount` is required but was not set" }, - checkNotNull(message) { "`message` is required but was not set" }, - note, - checkNotNull(recipientName) { "`recipientName` is required but was not set" }, requireApproval, uniqueIdentifier, additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), @@ -603,42 +441,99 @@ constructor( ) } + class FulfillmentMethod + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is FulfillmentMethod && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + val PHYSICAL_CHECK = FulfillmentMethod(JsonField.of("physical_check")) + + val THIRD_PARTY = FulfillmentMethod(JsonField.of("third_party")) + + fun of(value: String) = FulfillmentMethod(JsonField.of(value)) + } + + enum class Known { + PHYSICAL_CHECK, + THIRD_PARTY, + } + + enum class Value { + PHYSICAL_CHECK, + THIRD_PARTY, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + PHYSICAL_CHECK -> Value.PHYSICAL_CHECK + THIRD_PARTY -> Value.THIRD_PARTY + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + PHYSICAL_CHECK -> Known.PHYSICAL_CHECK + THIRD_PARTY -> Known.THIRD_PARTY + else -> throw IncreaseInvalidDataException("Unknown FulfillmentMethod: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + /** - * The return address to be printed on the check. If omitted this will default to the address of - * the Entity of the Account used to make the Check Transfer. + * Details relating to the physical check that Increase will print and mail. This is required if + * `fulfillment_method` is equal to `physical_check`. It must not be included if any other + * `fulfillment_method` is provided. */ - @JsonDeserialize(builder = ReturnAddress.Builder::class) + @JsonDeserialize(builder = PhysicalCheck.Builder::class) @NoAutoDetect - class ReturnAddress + class PhysicalCheck private constructor( - private val name: String?, - private val line1: String?, - private val line2: String?, - private val city: String?, - private val state: String?, - private val zip: String?, + private val memo: String?, + private val note: String?, + private val recipientName: String?, + private val mailingAddress: MailingAddress?, + private val returnAddress: ReturnAddress?, private val additionalProperties: Map, ) { private var hashCode: Int = 0 - /** The name of the return address. */ - @JsonProperty("name") fun name(): String? = name - - /** The first line of the return address. */ - @JsonProperty("line1") fun line1(): String? = line1 + /** The descriptor that will be printed on the memo field on the check. */ + @JsonProperty("memo") fun memo(): String? = memo - /** The second line of the return address. */ - @JsonProperty("line2") fun line2(): String? = line2 + /** The descriptor that will be printed on the letter included with the check. */ + @JsonProperty("note") fun note(): String? = note - /** The city of the return address. */ - @JsonProperty("city") fun city(): String? = city + /** The name that will be printed on the check in the 'To:' field. */ + @JsonProperty("recipient_name") fun recipientName(): String? = recipientName - /** The US state of the return address. */ - @JsonProperty("state") fun state(): String? = state + /** Details for where Increase will mail the check. */ + @JsonProperty("mailing_address") fun mailingAddress(): MailingAddress? = mailingAddress - /** The postal code of the return address. */ - @JsonProperty("zip") fun zip(): String? = zip + /** + * The return address to be printed on the check. If omitted this will default to the + * address of the Entity of the Account used to make the Check Transfer. + */ + @JsonProperty("return_address") fun returnAddress(): ReturnAddress? = returnAddress @JsonAnyGetter @ExcludeMissing @@ -651,13 +546,12 @@ constructor( return true } - return other is ReturnAddress && - this.name == other.name && - this.line1 == other.line1 && - this.line2 == other.line2 && - this.city == other.city && - this.state == other.state && - this.zip == other.zip && + return other is PhysicalCheck && + this.memo == other.memo && + this.note == other.note && + this.recipientName == other.recipientName && + this.mailingAddress == other.mailingAddress && + this.returnAddress == other.returnAddress && this.additionalProperties == other.additionalProperties } @@ -665,12 +559,11 @@ constructor( if (hashCode == 0) { hashCode = Objects.hash( - name, - line1, - line2, - city, - state, - zip, + memo, + note, + recipientName, + mailingAddress, + returnAddress, additionalProperties, ) } @@ -678,7 +571,7 @@ constructor( } override fun toString() = - "ReturnAddress{name=$name, line1=$line1, line2=$line2, city=$city, state=$state, zip=$zip, additionalProperties=$additionalProperties}" + "PhysicalCheck{memo=$memo, note=$note, recipientName=$recipientName, mailingAddress=$mailingAddress, returnAddress=$returnAddress, additionalProperties=$additionalProperties}" companion object { @@ -687,41 +580,46 @@ constructor( class Builder { - private var name: String? = null - private var line1: String? = null - private var line2: String? = null - private var city: String? = null - private var state: String? = null - private var zip: String? = null + private var memo: String? = null + private var note: String? = null + private var recipientName: String? = null + private var mailingAddress: MailingAddress? = null + private var returnAddress: ReturnAddress? = null private var additionalProperties: MutableMap = mutableMapOf() - internal fun from(returnAddress: ReturnAddress) = apply { - this.name = returnAddress.name - this.line1 = returnAddress.line1 - this.line2 = returnAddress.line2 - this.city = returnAddress.city - this.state = returnAddress.state - this.zip = returnAddress.zip - additionalProperties(returnAddress.additionalProperties) + internal fun from(physicalCheck: PhysicalCheck) = apply { + this.memo = physicalCheck.memo + this.note = physicalCheck.note + this.recipientName = physicalCheck.recipientName + this.mailingAddress = physicalCheck.mailingAddress + this.returnAddress = physicalCheck.returnAddress + additionalProperties(physicalCheck.additionalProperties) } - /** The name of the return address. */ - @JsonProperty("name") fun name(name: String) = apply { this.name = name } - - /** The first line of the return address. */ - @JsonProperty("line1") fun line1(line1: String) = apply { this.line1 = line1 } + /** The descriptor that will be printed on the memo field on the check. */ + @JsonProperty("memo") fun memo(memo: String) = apply { this.memo = memo } - /** The second line of the return address. */ - @JsonProperty("line2") fun line2(line2: String) = apply { this.line2 = line2 } + /** The descriptor that will be printed on the letter included with the check. */ + @JsonProperty("note") fun note(note: String) = apply { this.note = note } - /** The city of the return address. */ - @JsonProperty("city") fun city(city: String) = apply { this.city = city } + /** The name that will be printed on the check in the 'To:' field. */ + @JsonProperty("recipient_name") + fun recipientName(recipientName: String) = apply { this.recipientName = recipientName } - /** The US state of the return address. */ - @JsonProperty("state") fun state(state: String) = apply { this.state = state } + /** Details for where Increase will mail the check. */ + @JsonProperty("mailing_address") + fun mailingAddress(mailingAddress: MailingAddress) = apply { + this.mailingAddress = mailingAddress + } - /** The postal code of the return address. */ - @JsonProperty("zip") fun zip(zip: String) = apply { this.zip = zip } + /** + * The return address to be printed on the check. If omitted this will default to the + * address of the Entity of the Account used to make the Check Transfer. + */ + @JsonProperty("return_address") + fun returnAddress(returnAddress: ReturnAddress) = apply { + this.returnAddress = returnAddress + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -737,16 +635,316 @@ constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): ReturnAddress = - ReturnAddress( - checkNotNull(name) { "`name` is required but was not set" }, - checkNotNull(line1) { "`line1` is required but was not set" }, - line2, - checkNotNull(city) { "`city` is required but was not set" }, - checkNotNull(state) { "`state` is required but was not set" }, - checkNotNull(zip) { "`zip` is required but was not set" }, + fun build(): PhysicalCheck = + PhysicalCheck( + checkNotNull(memo) { "`memo` is required but was not set" }, + note, + checkNotNull(recipientName) { "`recipientName` is required but was not set" }, + checkNotNull(mailingAddress) { "`mailingAddress` is required but was not set" }, + returnAddress, additionalProperties.toUnmodifiable(), ) } + + /** Details for where Increase will mail the check. */ + @JsonDeserialize(builder = MailingAddress.Builder::class) + @NoAutoDetect + class MailingAddress + private constructor( + private val name: String?, + private val line1: String?, + private val line2: String?, + private val city: String?, + private val state: String?, + private val postalCode: String?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** + * The name component of the check's destination address. Defaults to the provided + * `recipient_name` parameter. + */ + @JsonProperty("name") fun name(): String? = name + + /** The first line of the address component of the check's destination address. */ + @JsonProperty("line1") fun line1(): String? = line1 + + /** The second line of the address component of the check's destination address. */ + @JsonProperty("line2") fun line2(): String? = line2 + + /** The city component of the check's destination address. */ + @JsonProperty("city") fun city(): String? = city + + /** The US state component of the check's destination address. */ + @JsonProperty("state") fun state(): String? = state + + /** The postal code component of the check's destination address. */ + @JsonProperty("postal_code") fun postalCode(): String? = postalCode + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is MailingAddress && + this.name == other.name && + this.line1 == other.line1 && + this.line2 == other.line2 && + this.city == other.city && + this.state == other.state && + this.postalCode == other.postalCode && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + name, + line1, + line2, + city, + state, + postalCode, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "MailingAddress{name=$name, line1=$line1, line2=$line2, city=$city, state=$state, postalCode=$postalCode, additionalProperties=$additionalProperties}" + + companion object { + + fun builder() = Builder() + } + + class Builder { + + private var name: String? = null + private var line1: String? = null + private var line2: String? = null + private var city: String? = null + private var state: String? = null + private var postalCode: String? = null + private var additionalProperties: MutableMap = mutableMapOf() + + internal fun from(mailingAddress: MailingAddress) = apply { + this.name = mailingAddress.name + this.line1 = mailingAddress.line1 + this.line2 = mailingAddress.line2 + this.city = mailingAddress.city + this.state = mailingAddress.state + this.postalCode = mailingAddress.postalCode + additionalProperties(mailingAddress.additionalProperties) + } + + /** + * The name component of the check's destination address. Defaults to the provided + * `recipient_name` parameter. + */ + @JsonProperty("name") fun name(name: String) = apply { this.name = name } + + /** The first line of the address component of the check's destination address. */ + @JsonProperty("line1") fun line1(line1: String) = apply { this.line1 = line1 } + + /** The second line of the address component of the check's destination address. */ + @JsonProperty("line2") fun line2(line2: String) = apply { this.line2 = line2 } + + /** The city component of the check's destination address. */ + @JsonProperty("city") fun city(city: String) = apply { this.city = city } + + /** The US state component of the check's destination address. */ + @JsonProperty("state") fun state(state: String) = apply { this.state = state } + + /** The postal code component of the check's destination address. */ + @JsonProperty("postal_code") + fun postalCode(postalCode: String) = apply { this.postalCode = postalCode } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): MailingAddress = + MailingAddress( + name, + checkNotNull(line1) { "`line1` is required but was not set" }, + line2, + checkNotNull(city) { "`city` is required but was not set" }, + checkNotNull(state) { "`state` is required but was not set" }, + checkNotNull(postalCode) { "`postalCode` is required but was not set" }, + additionalProperties.toUnmodifiable(), + ) + } + } + + /** + * The return address to be printed on the check. If omitted this will default to the + * address of the Entity of the Account used to make the Check Transfer. + */ + @JsonDeserialize(builder = ReturnAddress.Builder::class) + @NoAutoDetect + class ReturnAddress + private constructor( + private val name: String?, + private val line1: String?, + private val line2: String?, + private val city: String?, + private val state: String?, + private val postalCode: String?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** The name of the return address. */ + @JsonProperty("name") fun name(): String? = name + + /** The first line of the return address. */ + @JsonProperty("line1") fun line1(): String? = line1 + + /** The second line of the return address. */ + @JsonProperty("line2") fun line2(): String? = line2 + + /** The city of the return address. */ + @JsonProperty("city") fun city(): String? = city + + /** The US state of the return address. */ + @JsonProperty("state") fun state(): String? = state + + /** The postal code of the return address. */ + @JsonProperty("postal_code") fun postalCode(): String? = postalCode + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ReturnAddress && + this.name == other.name && + this.line1 == other.line1 && + this.line2 == other.line2 && + this.city == other.city && + this.state == other.state && + this.postalCode == other.postalCode && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + name, + line1, + line2, + city, + state, + postalCode, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "ReturnAddress{name=$name, line1=$line1, line2=$line2, city=$city, state=$state, postalCode=$postalCode, additionalProperties=$additionalProperties}" + + companion object { + + fun builder() = Builder() + } + + class Builder { + + private var name: String? = null + private var line1: String? = null + private var line2: String? = null + private var city: String? = null + private var state: String? = null + private var postalCode: String? = null + private var additionalProperties: MutableMap = mutableMapOf() + + internal fun from(returnAddress: ReturnAddress) = apply { + this.name = returnAddress.name + this.line1 = returnAddress.line1 + this.line2 = returnAddress.line2 + this.city = returnAddress.city + this.state = returnAddress.state + this.postalCode = returnAddress.postalCode + additionalProperties(returnAddress.additionalProperties) + } + + /** The name of the return address. */ + @JsonProperty("name") fun name(name: String) = apply { this.name = name } + + /** The first line of the return address. */ + @JsonProperty("line1") fun line1(line1: String) = apply { this.line1 = line1 } + + /** The second line of the return address. */ + @JsonProperty("line2") fun line2(line2: String) = apply { this.line2 = line2 } + + /** The city of the return address. */ + @JsonProperty("city") fun city(city: String) = apply { this.city = city } + + /** The US state of the return address. */ + @JsonProperty("state") fun state(state: String) = apply { this.state = state } + + /** The postal code of the return address. */ + @JsonProperty("postal_code") + fun postalCode(postalCode: String) = apply { this.postalCode = postalCode } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): ReturnAddress = + ReturnAddress( + checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(line1) { "`line1` is required but was not set" }, + line2, + checkNotNull(city) { "`city` is required but was not set" }, + checkNotNull(state) { "`state` is required but was not set" }, + checkNotNull(postalCode) { "`postalCode` is required but was not set" }, + additionalProperties.toUnmodifiable(), + ) + } + } } } diff --git a/increase-kotlin-core/src/main/kotlin/com/increase/api/models/DeclinedTransaction.kt b/increase-kotlin-core/src/main/kotlin/com/increase/api/models/DeclinedTransaction.kt index 1e6f34d20..ff0e19aef 100644 --- a/increase-kotlin-core/src/main/kotlin/com/increase/api/models/DeclinedTransaction.kt +++ b/increase-kotlin-core/src/main/kotlin/com/increase/api/models/DeclinedTransaction.kt @@ -1407,7 +1407,6 @@ private constructor( private val merchantCity: JsonField, private val merchantCountry: JsonField, private val physicalCardId: JsonField, - private val network: JsonField, private val networkDetails: JsonField, private val amount: JsonField, private val currency: JsonField, @@ -1451,9 +1450,6 @@ private constructor( */ fun physicalCardId(): String? = physicalCardId.getNullable("physical_card_id") - /** The payment network used to process this card authorization */ - fun network(): Network = network.getRequired("network") - /** Fields specific to the `network` */ fun networkDetails(): NetworkDetails = networkDetails.getRequired("network_details") @@ -1523,9 +1519,6 @@ private constructor( */ @JsonProperty("physical_card_id") @ExcludeMissing fun _physicalCardId() = physicalCardId - /** The payment network used to process this card authorization */ - @JsonProperty("network") @ExcludeMissing fun _network() = network - /** Fields specific to the `network` */ @JsonProperty("network_details") @ExcludeMissing fun _networkDetails() = networkDetails @@ -1574,7 +1567,6 @@ private constructor( merchantCity() merchantCountry() physicalCardId() - network() networkDetails().validate() amount() currency() @@ -1600,7 +1592,6 @@ private constructor( this.merchantCity == other.merchantCity && this.merchantCountry == other.merchantCountry && this.physicalCardId == other.physicalCardId && - this.network == other.network && this.networkDetails == other.networkDetails && this.amount == other.amount && this.currency == other.currency && @@ -1621,7 +1612,6 @@ private constructor( merchantCity, merchantCountry, physicalCardId, - network, networkDetails, amount, currency, @@ -1636,7 +1626,7 @@ private constructor( } override fun toString() = - "CardDecline{merchantAcceptorId=$merchantAcceptorId, merchantDescriptor=$merchantDescriptor, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, physicalCardId=$physicalCardId, network=$network, networkDetails=$networkDetails, amount=$amount, currency=$currency, reason=$reason, merchantState=$merchantState, realTimeDecisionId=$realTimeDecisionId, digitalWalletTokenId=$digitalWalletTokenId, additionalProperties=$additionalProperties}" + "CardDecline{merchantAcceptorId=$merchantAcceptorId, merchantDescriptor=$merchantDescriptor, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, physicalCardId=$physicalCardId, networkDetails=$networkDetails, amount=$amount, currency=$currency, reason=$reason, merchantState=$merchantState, realTimeDecisionId=$realTimeDecisionId, digitalWalletTokenId=$digitalWalletTokenId, additionalProperties=$additionalProperties}" companion object { @@ -1651,7 +1641,6 @@ private constructor( private var merchantCity: JsonField = JsonMissing.of() private var merchantCountry: JsonField = JsonMissing.of() private var physicalCardId: JsonField = JsonMissing.of() - private var network: JsonField = JsonMissing.of() private var networkDetails: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() @@ -1668,7 +1657,6 @@ private constructor( this.merchantCity = cardDecline.merchantCity this.merchantCountry = cardDecline.merchantCountry this.physicalCardId = cardDecline.physicalCardId - this.network = cardDecline.network this.networkDetails = cardDecline.networkDetails this.amount = cardDecline.amount this.currency = cardDecline.currency @@ -1762,14 +1750,6 @@ private constructor( this.physicalCardId = physicalCardId } - /** The payment network used to process this card authorization */ - fun network(network: Network) = network(JsonField.of(network)) - - /** The payment network used to process this card authorization */ - @JsonProperty("network") - @ExcludeMissing - fun network(network: JsonField) = apply { this.network = network } - /** Fields specific to the `network` */ fun networkDetails(networkDetails: NetworkDetails) = networkDetails(JsonField.of(networkDetails)) @@ -1885,7 +1865,6 @@ private constructor( merchantCity, merchantCountry, physicalCardId, - network, networkDetails, amount, currency, @@ -1897,62 +1876,12 @@ private constructor( ) } - class Network - @JsonCreator - private constructor( - private val value: JsonField, - ) { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Network && this.value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - - companion object { - - val VISA = Network(JsonField.of("visa")) - - fun of(value: String) = Network(JsonField.of(value)) - } - - enum class Known { - VISA, - } - - enum class Value { - VISA, - _UNKNOWN, - } - - fun value(): Value = - when (this) { - VISA -> Value.VISA - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - VISA -> Known.VISA - else -> throw IncreaseInvalidDataException("Unknown Network: $value") - } - - fun asString(): String = _value().asStringOrThrow() - } - /** Fields specific to the `network` */ @JsonDeserialize(builder = NetworkDetails.Builder::class) @NoAutoDetect class NetworkDetails private constructor( + private val category: JsonField, private val visa: JsonField, private val additionalProperties: Map, ) { @@ -1961,8 +1890,14 @@ private constructor( private var hashCode: Int = 0 + /** The payment network used to process this card authorization */ + fun category(): Category = category.getRequired("category") + /** Fields specific to the `visa` network */ - fun visa(): Visa = visa.getRequired("visa") + fun visa(): Visa? = visa.getNullable("visa") + + /** The payment network used to process this card authorization */ + @JsonProperty("category") @ExcludeMissing fun _category() = category /** Fields specific to the `visa` network */ @JsonProperty("visa") @ExcludeMissing fun _visa() = visa @@ -1973,7 +1908,8 @@ private constructor( fun validate(): NetworkDetails = apply { if (!validated) { - visa().validate() + category() + visa()?.validate() validated = true } } @@ -1986,19 +1922,25 @@ private constructor( } return other is NetworkDetails && + this.category == other.category && this.visa == other.visa && this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { if (hashCode == 0) { - hashCode = Objects.hash(visa, additionalProperties) + hashCode = + Objects.hash( + category, + visa, + additionalProperties, + ) } return hashCode } override fun toString() = - "NetworkDetails{visa=$visa, additionalProperties=$additionalProperties}" + "NetworkDetails{category=$category, visa=$visa, additionalProperties=$additionalProperties}" companion object { @@ -2007,14 +1949,24 @@ private constructor( class Builder { + private var category: JsonField = JsonMissing.of() private var visa: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() internal fun from(networkDetails: NetworkDetails) = apply { + this.category = networkDetails.category this.visa = networkDetails.visa additionalProperties(networkDetails.additionalProperties) } + /** The payment network used to process this card authorization */ + fun category(category: Category) = category(JsonField.of(category)) + + /** The payment network used to process this card authorization */ + @JsonProperty("category") + @ExcludeMissing + fun category(category: JsonField) = apply { this.category = category } + /** Fields specific to the `visa` network */ fun visa(visa: Visa) = visa(JsonField.of(visa)) @@ -2039,7 +1991,63 @@ private constructor( } fun build(): NetworkDetails = - NetworkDetails(visa, additionalProperties.toUnmodifiable()) + NetworkDetails( + category, + visa, + additionalProperties.toUnmodifiable(), + ) + } + + class Category + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Category && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + val VISA = Category(JsonField.of("visa")) + + fun of(value: String) = Category(JsonField.of(value)) + } + + enum class Known { + VISA, + } + + enum class Value { + VISA, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + VISA -> Value.VISA + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + VISA -> Known.VISA + else -> throw IncreaseInvalidDataException("Unknown Category: $value") + } + + fun asString(): String = _value().asStringOrThrow() } /** Fields specific to the `visa` network */ diff --git a/increase-kotlin-core/src/main/kotlin/com/increase/api/models/InboundRealTimePaymentsTransferSimulationResult.kt b/increase-kotlin-core/src/main/kotlin/com/increase/api/models/InboundRealTimePaymentsTransferSimulationResult.kt index 8931b5088..5b2dd0e24 100644 --- a/increase-kotlin-core/src/main/kotlin/com/increase/api/models/InboundRealTimePaymentsTransferSimulationResult.kt +++ b/increase-kotlin-core/src/main/kotlin/com/increase/api/models/InboundRealTimePaymentsTransferSimulationResult.kt @@ -14456,7 +14456,6 @@ private constructor( private val merchantCity: JsonField, private val merchantCountry: JsonField, private val physicalCardId: JsonField, - private val network: JsonField, private val networkDetails: JsonField, private val amount: JsonField, private val currency: JsonField, @@ -14501,9 +14500,6 @@ private constructor( */ fun physicalCardId(): String? = physicalCardId.getNullable("physical_card_id") - /** The payment network used to process this card authorization */ - fun network(): Network = network.getRequired("network") - /** Fields specific to the `network` */ fun networkDetails(): NetworkDetails = networkDetails.getRequired("network_details") @@ -14576,9 +14572,6 @@ private constructor( @ExcludeMissing fun _physicalCardId() = physicalCardId - /** The payment network used to process this card authorization */ - @JsonProperty("network") @ExcludeMissing fun _network() = network - /** Fields specific to the `network` */ @JsonProperty("network_details") @ExcludeMissing @@ -14630,7 +14623,6 @@ private constructor( merchantCity() merchantCountry() physicalCardId() - network() networkDetails().validate() amount() currency() @@ -14656,7 +14648,6 @@ private constructor( this.merchantCity == other.merchantCity && this.merchantCountry == other.merchantCountry && this.physicalCardId == other.physicalCardId && - this.network == other.network && this.networkDetails == other.networkDetails && this.amount == other.amount && this.currency == other.currency && @@ -14677,7 +14668,6 @@ private constructor( merchantCity, merchantCountry, physicalCardId, - network, networkDetails, amount, currency, @@ -14692,7 +14682,7 @@ private constructor( } override fun toString() = - "CardDecline{merchantAcceptorId=$merchantAcceptorId, merchantDescriptor=$merchantDescriptor, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, physicalCardId=$physicalCardId, network=$network, networkDetails=$networkDetails, amount=$amount, currency=$currency, reason=$reason, merchantState=$merchantState, realTimeDecisionId=$realTimeDecisionId, digitalWalletTokenId=$digitalWalletTokenId, additionalProperties=$additionalProperties}" + "CardDecline{merchantAcceptorId=$merchantAcceptorId, merchantDescriptor=$merchantDescriptor, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, physicalCardId=$physicalCardId, networkDetails=$networkDetails, amount=$amount, currency=$currency, reason=$reason, merchantState=$merchantState, realTimeDecisionId=$realTimeDecisionId, digitalWalletTokenId=$digitalWalletTokenId, additionalProperties=$additionalProperties}" companion object { @@ -14707,7 +14697,6 @@ private constructor( private var merchantCity: JsonField = JsonMissing.of() private var merchantCountry: JsonField = JsonMissing.of() private var physicalCardId: JsonField = JsonMissing.of() - private var network: JsonField = JsonMissing.of() private var networkDetails: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() @@ -14724,7 +14713,6 @@ private constructor( this.merchantCity = cardDecline.merchantCity this.merchantCountry = cardDecline.merchantCountry this.physicalCardId = cardDecline.physicalCardId - this.network = cardDecline.network this.networkDetails = cardDecline.networkDetails this.amount = cardDecline.amount this.currency = cardDecline.currency @@ -14819,14 +14807,6 @@ private constructor( this.physicalCardId = physicalCardId } - /** The payment network used to process this card authorization */ - fun network(network: Network) = network(JsonField.of(network)) - - /** The payment network used to process this card authorization */ - @JsonProperty("network") - @ExcludeMissing - fun network(network: JsonField) = apply { this.network = network } - /** Fields specific to the `network` */ fun networkDetails(networkDetails: NetworkDetails) = networkDetails(JsonField.of(networkDetails)) @@ -14942,7 +14922,6 @@ private constructor( merchantCity, merchantCountry, physicalCardId, - network, networkDetails, amount, currency, @@ -14954,63 +14933,12 @@ private constructor( ) } - class Network - @JsonCreator - private constructor( - private val value: JsonField, - ) { - - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Network && this.value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - - companion object { - - val VISA = Network(JsonField.of("visa")) - - fun of(value: String) = Network(JsonField.of(value)) - } - - enum class Known { - VISA, - } - - enum class Value { - VISA, - _UNKNOWN, - } - - fun value(): Value = - when (this) { - VISA -> Value.VISA - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - VISA -> Known.VISA - else -> throw IncreaseInvalidDataException("Unknown Network: $value") - } - - fun asString(): String = _value().asStringOrThrow() - } - /** Fields specific to the `network` */ @JsonDeserialize(builder = NetworkDetails.Builder::class) @NoAutoDetect class NetworkDetails private constructor( + private val category: JsonField, private val visa: JsonField, private val additionalProperties: Map, ) { @@ -15019,8 +14947,14 @@ private constructor( private var hashCode: Int = 0 + /** The payment network used to process this card authorization */ + fun category(): Category = category.getRequired("category") + /** Fields specific to the `visa` network */ - fun visa(): Visa = visa.getRequired("visa") + fun visa(): Visa? = visa.getNullable("visa") + + /** The payment network used to process this card authorization */ + @JsonProperty("category") @ExcludeMissing fun _category() = category /** Fields specific to the `visa` network */ @JsonProperty("visa") @ExcludeMissing fun _visa() = visa @@ -15031,7 +14965,8 @@ private constructor( fun validate(): NetworkDetails = apply { if (!validated) { - visa().validate() + category() + visa()?.validate() validated = true } } @@ -15044,19 +14979,25 @@ private constructor( } return other is NetworkDetails && + this.category == other.category && this.visa == other.visa && this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { if (hashCode == 0) { - hashCode = Objects.hash(visa, additionalProperties) + hashCode = + Objects.hash( + category, + visa, + additionalProperties, + ) } return hashCode } override fun toString() = - "NetworkDetails{visa=$visa, additionalProperties=$additionalProperties}" + "NetworkDetails{category=$category, visa=$visa, additionalProperties=$additionalProperties}" companion object { @@ -15065,15 +15006,27 @@ private constructor( class Builder { + private var category: JsonField = JsonMissing.of() private var visa: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() internal fun from(networkDetails: NetworkDetails) = apply { + this.category = networkDetails.category this.visa = networkDetails.visa additionalProperties(networkDetails.additionalProperties) } + /** The payment network used to process this card authorization */ + fun category(category: Category) = category(JsonField.of(category)) + + /** The payment network used to process this card authorization */ + @JsonProperty("category") + @ExcludeMissing + fun category(category: JsonField) = apply { + this.category = category + } + /** Fields specific to the `visa` network */ fun visa(visa: Visa) = visa(JsonField.of(visa)) @@ -15098,7 +15051,64 @@ private constructor( ) = apply { this.additionalProperties.putAll(additionalProperties) } fun build(): NetworkDetails = - NetworkDetails(visa, additionalProperties.toUnmodifiable()) + NetworkDetails( + category, + visa, + additionalProperties.toUnmodifiable(), + ) + } + + class Category + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Category && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + val VISA = Category(JsonField.of("visa")) + + fun of(value: String) = Category(JsonField.of(value)) + } + + enum class Known { + VISA, + } + + enum class Value { + VISA, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + VISA -> Value.VISA + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + VISA -> Known.VISA + else -> + throw IncreaseInvalidDataException("Unknown Category: $value") + } + + fun asString(): String = _value().asStringOrThrow() } /** Fields specific to the `visa` network */ diff --git a/increase-kotlin-core/src/main/kotlin/com/increase/api/models/PendingTransaction.kt b/increase-kotlin-core/src/main/kotlin/com/increase/api/models/PendingTransaction.kt index 0a27f60e1..96f3eafca 100644 --- a/increase-kotlin-core/src/main/kotlin/com/increase/api/models/PendingTransaction.kt +++ b/increase-kotlin-core/src/main/kotlin/com/increase/api/models/PendingTransaction.kt @@ -1549,7 +1549,6 @@ private constructor( private val merchantCity: JsonField, private val merchantCountry: JsonField, private val physicalCardId: JsonField, - private val network: JsonField, private val networkDetails: JsonField, private val amount: JsonField, private val currency: JsonField, @@ -1597,9 +1596,6 @@ private constructor( */ fun physicalCardId(): String? = physicalCardId.getNullable("physical_card_id") - /** The payment network used to process this card authorization */ - fun network(): Network = network.getRequired("network") - /** Fields specific to the `network` */ fun networkDetails(): NetworkDetails = networkDetails.getRequired("network_details") @@ -1682,9 +1678,6 @@ private constructor( */ @JsonProperty("physical_card_id") @ExcludeMissing fun _physicalCardId() = physicalCardId - /** The payment network used to process this card authorization */ - @JsonProperty("network") @ExcludeMissing fun _network() = network - /** Fields specific to the `network` */ @JsonProperty("network_details") @ExcludeMissing fun _networkDetails() = networkDetails @@ -1745,7 +1738,6 @@ private constructor( merchantCity() merchantCountry() physicalCardId() - network() networkDetails().validate() amount() currency() @@ -1773,7 +1765,6 @@ private constructor( this.merchantCity == other.merchantCity && this.merchantCountry == other.merchantCountry && this.physicalCardId == other.physicalCardId && - this.network == other.network && this.networkDetails == other.networkDetails && this.amount == other.amount && this.currency == other.currency && @@ -1796,7 +1787,6 @@ private constructor( merchantCity, merchantCountry, physicalCardId, - network, networkDetails, amount, currency, @@ -1812,7 +1802,7 @@ private constructor( } override fun toString() = - "CardAuthorization{id=$id, merchantAcceptorId=$merchantAcceptorId, merchantDescriptor=$merchantDescriptor, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, physicalCardId=$physicalCardId, network=$network, networkDetails=$networkDetails, amount=$amount, currency=$currency, expiresAt=$expiresAt, realTimeDecisionId=$realTimeDecisionId, digitalWalletTokenId=$digitalWalletTokenId, pendingTransactionId=$pendingTransactionId, type=$type, additionalProperties=$additionalProperties}" + "CardAuthorization{id=$id, merchantAcceptorId=$merchantAcceptorId, merchantDescriptor=$merchantDescriptor, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, physicalCardId=$physicalCardId, networkDetails=$networkDetails, amount=$amount, currency=$currency, expiresAt=$expiresAt, realTimeDecisionId=$realTimeDecisionId, digitalWalletTokenId=$digitalWalletTokenId, pendingTransactionId=$pendingTransactionId, type=$type, additionalProperties=$additionalProperties}" companion object { @@ -1828,7 +1818,6 @@ private constructor( private var merchantCity: JsonField = JsonMissing.of() private var merchantCountry: JsonField = JsonMissing.of() private var physicalCardId: JsonField = JsonMissing.of() - private var network: JsonField = JsonMissing.of() private var networkDetails: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() @@ -1847,7 +1836,6 @@ private constructor( this.merchantCity = cardAuthorization.merchantCity this.merchantCountry = cardAuthorization.merchantCountry this.physicalCardId = cardAuthorization.physicalCardId - this.network = cardAuthorization.network this.networkDetails = cardAuthorization.networkDetails this.amount = cardAuthorization.amount this.currency = cardAuthorization.currency @@ -1950,14 +1938,6 @@ private constructor( this.physicalCardId = physicalCardId } - /** The payment network used to process this card authorization */ - fun network(network: Network) = network(JsonField.of(network)) - - /** The payment network used to process this card authorization */ - @JsonProperty("network") - @ExcludeMissing - fun network(network: JsonField) = apply { this.network = network } - /** Fields specific to the `network` */ fun networkDetails(networkDetails: NetworkDetails) = networkDetails(JsonField.of(networkDetails)) @@ -2096,7 +2076,6 @@ private constructor( merchantCity, merchantCountry, physicalCardId, - network, networkDetails, amount, currency, @@ -2109,62 +2088,12 @@ private constructor( ) } - class Network - @JsonCreator - private constructor( - private val value: JsonField, - ) { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Network && this.value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - - companion object { - - val VISA = Network(JsonField.of("visa")) - - fun of(value: String) = Network(JsonField.of(value)) - } - - enum class Known { - VISA, - } - - enum class Value { - VISA, - _UNKNOWN, - } - - fun value(): Value = - when (this) { - VISA -> Value.VISA - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - VISA -> Known.VISA - else -> throw IncreaseInvalidDataException("Unknown Network: $value") - } - - fun asString(): String = _value().asStringOrThrow() - } - /** Fields specific to the `network` */ @JsonDeserialize(builder = NetworkDetails.Builder::class) @NoAutoDetect class NetworkDetails private constructor( + private val category: JsonField, private val visa: JsonField, private val additionalProperties: Map, ) { @@ -2173,8 +2102,14 @@ private constructor( private var hashCode: Int = 0 + /** The payment network used to process this card authorization */ + fun category(): Category = category.getRequired("category") + /** Fields specific to the `visa` network */ - fun visa(): Visa = visa.getRequired("visa") + fun visa(): Visa? = visa.getNullable("visa") + + /** The payment network used to process this card authorization */ + @JsonProperty("category") @ExcludeMissing fun _category() = category /** Fields specific to the `visa` network */ @JsonProperty("visa") @ExcludeMissing fun _visa() = visa @@ -2185,7 +2120,8 @@ private constructor( fun validate(): NetworkDetails = apply { if (!validated) { - visa().validate() + category() + visa()?.validate() validated = true } } @@ -2198,19 +2134,25 @@ private constructor( } return other is NetworkDetails && + this.category == other.category && this.visa == other.visa && this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { if (hashCode == 0) { - hashCode = Objects.hash(visa, additionalProperties) + hashCode = + Objects.hash( + category, + visa, + additionalProperties, + ) } return hashCode } override fun toString() = - "NetworkDetails{visa=$visa, additionalProperties=$additionalProperties}" + "NetworkDetails{category=$category, visa=$visa, additionalProperties=$additionalProperties}" companion object { @@ -2219,14 +2161,24 @@ private constructor( class Builder { + private var category: JsonField = JsonMissing.of() private var visa: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() internal fun from(networkDetails: NetworkDetails) = apply { + this.category = networkDetails.category this.visa = networkDetails.visa additionalProperties(networkDetails.additionalProperties) } + /** The payment network used to process this card authorization */ + fun category(category: Category) = category(JsonField.of(category)) + + /** The payment network used to process this card authorization */ + @JsonProperty("category") + @ExcludeMissing + fun category(category: JsonField) = apply { this.category = category } + /** Fields specific to the `visa` network */ fun visa(visa: Visa) = visa(JsonField.of(visa)) @@ -2251,7 +2203,63 @@ private constructor( } fun build(): NetworkDetails = - NetworkDetails(visa, additionalProperties.toUnmodifiable()) + NetworkDetails( + category, + visa, + additionalProperties.toUnmodifiable(), + ) + } + + class Category + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Category && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + val VISA = Category(JsonField.of("visa")) + + fun of(value: String) = Category(JsonField.of(value)) + } + + enum class Known { + VISA, + } + + enum class Value { + VISA, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + VISA -> Value.VISA + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + VISA -> Known.VISA + else -> throw IncreaseInvalidDataException("Unknown Category: $value") + } + + fun asString(): String = _value().asStringOrThrow() } /** Fields specific to the `visa` network */ diff --git a/increase-kotlin-core/src/main/kotlin/com/increase/api/models/PointOfServiceEntryMode.kt b/increase-kotlin-core/src/main/kotlin/com/increase/api/models/PointOfServiceEntryMode.kt index 645337c41..2a711e832 100644 --- a/increase-kotlin-core/src/main/kotlin/com/increase/api/models/PointOfServiceEntryMode.kt +++ b/increase-kotlin-core/src/main/kotlin/com/increase/api/models/PointOfServiceEntryMode.kt @@ -27,6 +27,8 @@ private constructor( companion object { + val UNKNOWN = PointOfServiceEntryMode(JsonField.of("unknown")) + val MANUAL = PointOfServiceEntryMode(JsonField.of("manual")) val MAGNETIC_STRIPE_NO_CVV = PointOfServiceEntryMode(JsonField.of("magnetic_stripe_no_cvv")) @@ -52,6 +54,7 @@ private constructor( } enum class Known { + UNKNOWN, MANUAL, MAGNETIC_STRIPE_NO_CVV, OPTICAL_CODE, @@ -64,6 +67,7 @@ private constructor( } enum class Value { + UNKNOWN, MANUAL, MAGNETIC_STRIPE_NO_CVV, OPTICAL_CODE, @@ -78,6 +82,7 @@ private constructor( fun value(): Value = when (this) { + UNKNOWN -> Value.UNKNOWN MANUAL -> Value.MANUAL MAGNETIC_STRIPE_NO_CVV -> Value.MAGNETIC_STRIPE_NO_CVV OPTICAL_CODE -> Value.OPTICAL_CODE @@ -92,6 +97,7 @@ private constructor( fun known(): Known = when (this) { + UNKNOWN -> Known.UNKNOWN MANUAL -> Known.MANUAL MAGNETIC_STRIPE_NO_CVV -> Known.MAGNETIC_STRIPE_NO_CVV OPTICAL_CODE -> Known.OPTICAL_CODE diff --git a/increase-kotlin-core/src/main/kotlin/com/increase/api/models/RealTimeDecision.kt b/increase-kotlin-core/src/main/kotlin/com/increase/api/models/RealTimeDecision.kt index 6d60351aa..73653b786 100644 --- a/increase-kotlin-core/src/main/kotlin/com/increase/api/models/RealTimeDecision.kt +++ b/increase-kotlin-core/src/main/kotlin/com/increase/api/models/RealTimeDecision.kt @@ -480,7 +480,6 @@ private constructor( private val merchantCity: JsonField, private val merchantCountry: JsonField, private val physicalCardId: JsonField, - private val network: JsonField, private val networkDetails: JsonField, private val decision: JsonField, private val cardId: JsonField, @@ -489,6 +488,7 @@ private constructor( private val presentmentCurrency: JsonField, private val settlementAmount: JsonField, private val settlementCurrency: JsonField, + private val requestDetails: JsonField, private val additionalProperties: Map, ) { @@ -524,9 +524,6 @@ private constructor( */ fun physicalCardId(): String? = physicalCardId.getNullable("physical_card_id") - /** The payment network used to process this card authorization */ - fun network(): Network = network.getRequired("network") - /** Fields specific to the `network` */ fun networkDetails(): NetworkDetails = networkDetails.getRequired("network_details") @@ -563,6 +560,9 @@ private constructor( */ fun settlementCurrency(): String = settlementCurrency.getRequired("settlement_currency") + /** Fields specific to the type of request, such as an incremental authorization. */ + fun requestDetails(): RequestDetails = requestDetails.getRequired("request_details") + /** * The merchant identifier (commonly abbreviated as MID) of the merchant the card is * transacting with. @@ -596,9 +596,6 @@ private constructor( */ @JsonProperty("physical_card_id") @ExcludeMissing fun _physicalCardId() = physicalCardId - /** The payment network used to process this card authorization */ - @JsonProperty("network") @ExcludeMissing fun _network() = network - /** Fields specific to the `network` */ @JsonProperty("network_details") @ExcludeMissing fun _networkDetails() = networkDetails @@ -643,6 +640,9 @@ private constructor( @ExcludeMissing fun _settlementCurrency() = settlementCurrency + /** Fields specific to the type of request, such as an incremental authorization. */ + @JsonProperty("request_details") @ExcludeMissing fun _requestDetails() = requestDetails + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -655,7 +655,6 @@ private constructor( merchantCity() merchantCountry() physicalCardId() - network() networkDetails().validate() decision() cardId() @@ -664,6 +663,7 @@ private constructor( presentmentCurrency() settlementAmount() settlementCurrency() + requestDetails().validate() validated = true } } @@ -682,7 +682,6 @@ private constructor( this.merchantCity == other.merchantCity && this.merchantCountry == other.merchantCountry && this.physicalCardId == other.physicalCardId && - this.network == other.network && this.networkDetails == other.networkDetails && this.decision == other.decision && this.cardId == other.cardId && @@ -691,6 +690,7 @@ private constructor( this.presentmentCurrency == other.presentmentCurrency && this.settlementAmount == other.settlementAmount && this.settlementCurrency == other.settlementCurrency && + this.requestDetails == other.requestDetails && this.additionalProperties == other.additionalProperties } @@ -704,7 +704,6 @@ private constructor( merchantCity, merchantCountry, physicalCardId, - network, networkDetails, decision, cardId, @@ -713,6 +712,7 @@ private constructor( presentmentCurrency, settlementAmount, settlementCurrency, + requestDetails, additionalProperties, ) } @@ -720,7 +720,7 @@ private constructor( } override fun toString() = - "CardAuthorization{merchantAcceptorId=$merchantAcceptorId, merchantDescriptor=$merchantDescriptor, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, physicalCardId=$physicalCardId, network=$network, networkDetails=$networkDetails, decision=$decision, cardId=$cardId, accountId=$accountId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, settlementAmount=$settlementAmount, settlementCurrency=$settlementCurrency, additionalProperties=$additionalProperties}" + "CardAuthorization{merchantAcceptorId=$merchantAcceptorId, merchantDescriptor=$merchantDescriptor, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, physicalCardId=$physicalCardId, networkDetails=$networkDetails, decision=$decision, cardId=$cardId, accountId=$accountId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, settlementAmount=$settlementAmount, settlementCurrency=$settlementCurrency, requestDetails=$requestDetails, additionalProperties=$additionalProperties}" companion object { @@ -735,7 +735,6 @@ private constructor( private var merchantCity: JsonField = JsonMissing.of() private var merchantCountry: JsonField = JsonMissing.of() private var physicalCardId: JsonField = JsonMissing.of() - private var network: JsonField = JsonMissing.of() private var networkDetails: JsonField = JsonMissing.of() private var decision: JsonField = JsonMissing.of() private var cardId: JsonField = JsonMissing.of() @@ -744,6 +743,7 @@ private constructor( private var presentmentCurrency: JsonField = JsonMissing.of() private var settlementAmount: JsonField = JsonMissing.of() private var settlementCurrency: JsonField = JsonMissing.of() + private var requestDetails: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() internal fun from(cardAuthorization: CardAuthorization) = apply { @@ -753,7 +753,6 @@ private constructor( this.merchantCity = cardAuthorization.merchantCity this.merchantCountry = cardAuthorization.merchantCountry this.physicalCardId = cardAuthorization.physicalCardId - this.network = cardAuthorization.network this.networkDetails = cardAuthorization.networkDetails this.decision = cardAuthorization.decision this.cardId = cardAuthorization.cardId @@ -762,6 +761,7 @@ private constructor( this.presentmentCurrency = cardAuthorization.presentmentCurrency this.settlementAmount = cardAuthorization.settlementAmount this.settlementCurrency = cardAuthorization.settlementCurrency + this.requestDetails = cardAuthorization.requestDetails additionalProperties(cardAuthorization.additionalProperties) } @@ -848,14 +848,6 @@ private constructor( this.physicalCardId = physicalCardId } - /** The payment network used to process this card authorization */ - fun network(network: Network) = network(JsonField.of(network)) - - /** The payment network used to process this card authorization */ - @JsonProperty("network") - @ExcludeMissing - fun network(network: JsonField) = apply { this.network = network } - /** Fields specific to the `network` */ fun networkDetails(networkDetails: NetworkDetails) = networkDetails(JsonField.of(networkDetails)) @@ -961,6 +953,17 @@ private constructor( this.settlementCurrency = settlementCurrency } + /** Fields specific to the type of request, such as an incremental authorization. */ + fun requestDetails(requestDetails: RequestDetails) = + requestDetails(JsonField.of(requestDetails)) + + /** Fields specific to the type of request, such as an incremental authorization. */ + @JsonProperty("request_details") + @ExcludeMissing + fun requestDetails(requestDetails: JsonField) = apply { + this.requestDetails = requestDetails + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() this.additionalProperties.putAll(additionalProperties) @@ -983,7 +986,6 @@ private constructor( merchantCity, merchantCountry, physicalCardId, - network, networkDetails, decision, cardId, @@ -992,66 +994,17 @@ private constructor( presentmentCurrency, settlementAmount, settlementCurrency, + requestDetails, additionalProperties.toUnmodifiable(), ) } - class Network - @JsonCreator - private constructor( - private val value: JsonField, - ) { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Network && this.value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - - companion object { - - val VISA = Network(JsonField.of("visa")) - - fun of(value: String) = Network(JsonField.of(value)) - } - - enum class Known { - VISA, - } - - enum class Value { - VISA, - _UNKNOWN, - } - - fun value(): Value = - when (this) { - VISA -> Value.VISA - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - VISA -> Known.VISA - else -> throw IncreaseInvalidDataException("Unknown Network: $value") - } - - fun asString(): String = _value().asStringOrThrow() - } - /** Fields specific to the `network` */ @JsonDeserialize(builder = NetworkDetails.Builder::class) @NoAutoDetect class NetworkDetails private constructor( + private val category: JsonField, private val visa: JsonField, private val additionalProperties: Map, ) { @@ -1060,8 +1013,14 @@ private constructor( private var hashCode: Int = 0 + /** The payment network used to process this card authorization */ + fun category(): Category = category.getRequired("category") + /** Fields specific to the `visa` network */ - fun visa(): Visa = visa.getRequired("visa") + fun visa(): Visa? = visa.getNullable("visa") + + /** The payment network used to process this card authorization */ + @JsonProperty("category") @ExcludeMissing fun _category() = category /** Fields specific to the `visa` network */ @JsonProperty("visa") @ExcludeMissing fun _visa() = visa @@ -1072,7 +1031,8 @@ private constructor( fun validate(): NetworkDetails = apply { if (!validated) { - visa().validate() + category() + visa()?.validate() validated = true } } @@ -1085,19 +1045,25 @@ private constructor( } return other is NetworkDetails && + this.category == other.category && this.visa == other.visa && this.additionalProperties == other.additionalProperties } override fun hashCode(): Int { if (hashCode == 0) { - hashCode = Objects.hash(visa, additionalProperties) + hashCode = + Objects.hash( + category, + visa, + additionalProperties, + ) } return hashCode } override fun toString() = - "NetworkDetails{visa=$visa, additionalProperties=$additionalProperties}" + "NetworkDetails{category=$category, visa=$visa, additionalProperties=$additionalProperties}" companion object { @@ -1106,14 +1072,24 @@ private constructor( class Builder { + private var category: JsonField = JsonMissing.of() private var visa: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() internal fun from(networkDetails: NetworkDetails) = apply { + this.category = networkDetails.category this.visa = networkDetails.visa additionalProperties(networkDetails.additionalProperties) } + /** The payment network used to process this card authorization */ + fun category(category: Category) = category(JsonField.of(category)) + + /** The payment network used to process this card authorization */ + @JsonProperty("category") + @ExcludeMissing + fun category(category: JsonField) = apply { this.category = category } + /** Fields specific to the `visa` network */ fun visa(visa: Visa) = visa(JsonField.of(visa)) @@ -1138,7 +1114,62 @@ private constructor( } fun build(): NetworkDetails = - NetworkDetails(visa, additionalProperties.toUnmodifiable()) + NetworkDetails( + category, + visa, + additionalProperties.toUnmodifiable(), + ) + } + + class Category + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Category && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + val VISA = Category(JsonField.of("visa")) + + fun of(value: String) = Category(JsonField.of(value)) + } + + enum class Known { + VISA, + } + + enum class Value { + VISA, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + VISA -> Value.VISA + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + VISA -> Known.VISA + else -> throw IncreaseInvalidDataException("Unknown Category: $value") + } + + fun asString(): String = _value().asStringOrThrow() } /** Fields specific to the `visa` network */ @@ -1478,6 +1509,369 @@ private constructor( fun asString(): String = _value().asStringOrThrow() } + + /** Fields specific to the type of request, such as an incremental authorization. */ + @JsonDeserialize(builder = RequestDetails.Builder::class) + @NoAutoDetect + class RequestDetails + private constructor( + private val category: JsonField, + private val initialAuthorization: JsonValue, + private val incrementalAuthorization: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** + * The type of this request (e.g., an initial authorization or an incremental + * authorization.) + */ + fun category(): Category = category.getRequired("category") + + /** Fields specific to the categorty `incremental_authorization`. */ + fun incrementalAuthorization(): IncrementalAuthorization? = + incrementalAuthorization.getNullable("incremental_authorization") + + /** + * The type of this request (e.g., an initial authorization or an incremental + * authorization.) + */ + @JsonProperty("category") @ExcludeMissing fun _category() = category + + /** Fields specific to the category `initial_authorization`. */ + @JsonProperty("initial_authorization") + @ExcludeMissing + fun _initialAuthorization() = initialAuthorization + + /** Fields specific to the categorty `incremental_authorization`. */ + @JsonProperty("incremental_authorization") + @ExcludeMissing + fun _incrementalAuthorization() = incrementalAuthorization + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): RequestDetails = apply { + if (!validated) { + category() + incrementalAuthorization()?.validate() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RequestDetails && + this.category == other.category && + this.initialAuthorization == other.initialAuthorization && + this.incrementalAuthorization == other.incrementalAuthorization && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + category, + initialAuthorization, + incrementalAuthorization, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "RequestDetails{category=$category, initialAuthorization=$initialAuthorization, incrementalAuthorization=$incrementalAuthorization, additionalProperties=$additionalProperties}" + + companion object { + + fun builder() = Builder() + } + + class Builder { + + private var category: JsonField = JsonMissing.of() + private var initialAuthorization: JsonValue = JsonMissing.of() + private var incrementalAuthorization: JsonField = + JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + internal fun from(requestDetails: RequestDetails) = apply { + this.category = requestDetails.category + this.initialAuthorization = requestDetails.initialAuthorization + this.incrementalAuthorization = requestDetails.incrementalAuthorization + additionalProperties(requestDetails.additionalProperties) + } + + /** + * The type of this request (e.g., an initial authorization or an incremental + * authorization.) + */ + fun category(category: Category) = category(JsonField.of(category)) + + /** + * The type of this request (e.g., an initial authorization or an incremental + * authorization.) + */ + @JsonProperty("category") + @ExcludeMissing + fun category(category: JsonField) = apply { this.category = category } + + /** Fields specific to the category `initial_authorization`. */ + @JsonProperty("initial_authorization") + @ExcludeMissing + fun initialAuthorization(initialAuthorization: JsonValue) = apply { + this.initialAuthorization = initialAuthorization + } + + /** Fields specific to the categorty `incremental_authorization`. */ + fun incrementalAuthorization(incrementalAuthorization: IncrementalAuthorization) = + incrementalAuthorization(JsonField.of(incrementalAuthorization)) + + /** Fields specific to the categorty `incremental_authorization`. */ + @JsonProperty("incremental_authorization") + @ExcludeMissing + fun incrementalAuthorization( + incrementalAuthorization: JsonField + ) = apply { this.incrementalAuthorization = incrementalAuthorization } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): RequestDetails = + RequestDetails( + category, + initialAuthorization, + incrementalAuthorization, + additionalProperties.toUnmodifiable(), + ) + } + + class Category + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Category && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + val INITIAL_AUTHORIZATION = Category(JsonField.of("initial_authorization")) + + val INCREMENTAL_AUTHORIZATION = + Category(JsonField.of("incremental_authorization")) + + fun of(value: String) = Category(JsonField.of(value)) + } + + enum class Known { + INITIAL_AUTHORIZATION, + INCREMENTAL_AUTHORIZATION, + } + + enum class Value { + INITIAL_AUTHORIZATION, + INCREMENTAL_AUTHORIZATION, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + INITIAL_AUTHORIZATION -> Value.INITIAL_AUTHORIZATION + INCREMENTAL_AUTHORIZATION -> Value.INCREMENTAL_AUTHORIZATION + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + INITIAL_AUTHORIZATION -> Known.INITIAL_AUTHORIZATION + INCREMENTAL_AUTHORIZATION -> Known.INCREMENTAL_AUTHORIZATION + else -> throw IncreaseInvalidDataException("Unknown Category: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + /** Fields specific to the categorty `incremental_authorization`. */ + @JsonDeserialize(builder = IncrementalAuthorization.Builder::class) + @NoAutoDetect + class IncrementalAuthorization + private constructor( + private val cardPaymentId: JsonField, + private val originalCardAuthorizationId: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** The card payment for this authorization and increment. */ + fun cardPaymentId(): String = cardPaymentId.getRequired("card_payment_id") + + /** + * The identifier of the card authorization this request is attempting to increment. + */ + fun originalCardAuthorizationId(): String = + originalCardAuthorizationId.getRequired("original_card_authorization_id") + + /** The card payment for this authorization and increment. */ + @JsonProperty("card_payment_id") + @ExcludeMissing + fun _cardPaymentId() = cardPaymentId + + /** + * The identifier of the card authorization this request is attempting to increment. + */ + @JsonProperty("original_card_authorization_id") + @ExcludeMissing + fun _originalCardAuthorizationId() = originalCardAuthorizationId + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): IncrementalAuthorization = apply { + if (!validated) { + cardPaymentId() + originalCardAuthorizationId() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is IncrementalAuthorization && + this.cardPaymentId == other.cardPaymentId && + this.originalCardAuthorizationId == other.originalCardAuthorizationId && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + cardPaymentId, + originalCardAuthorizationId, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "IncrementalAuthorization{cardPaymentId=$cardPaymentId, originalCardAuthorizationId=$originalCardAuthorizationId, additionalProperties=$additionalProperties}" + + companion object { + + fun builder() = Builder() + } + + class Builder { + + private var cardPaymentId: JsonField = JsonMissing.of() + private var originalCardAuthorizationId: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + internal fun from(incrementalAuthorization: IncrementalAuthorization) = apply { + this.cardPaymentId = incrementalAuthorization.cardPaymentId + this.originalCardAuthorizationId = + incrementalAuthorization.originalCardAuthorizationId + additionalProperties(incrementalAuthorization.additionalProperties) + } + + /** The card payment for this authorization and increment. */ + fun cardPaymentId(cardPaymentId: String) = + cardPaymentId(JsonField.of(cardPaymentId)) + + /** The card payment for this authorization and increment. */ + @JsonProperty("card_payment_id") + @ExcludeMissing + fun cardPaymentId(cardPaymentId: JsonField) = apply { + this.cardPaymentId = cardPaymentId + } + + /** + * The identifier of the card authorization this request is attempting to + * increment. + */ + fun originalCardAuthorizationId(originalCardAuthorizationId: String) = + originalCardAuthorizationId(JsonField.of(originalCardAuthorizationId)) + + /** + * The identifier of the card authorization this request is attempting to + * increment. + */ + @JsonProperty("original_card_authorization_id") + @ExcludeMissing + fun originalCardAuthorizationId( + originalCardAuthorizationId: JsonField + ) = apply { this.originalCardAuthorizationId = originalCardAuthorizationId } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): IncrementalAuthorization = + IncrementalAuthorization( + cardPaymentId, + originalCardAuthorizationId, + additionalProperties.toUnmodifiable(), + ) + } + } + } } /** Fields related to a digital wallet token provisioning attempt. */ diff --git a/increase-kotlin-core/src/test/kotlin/com/increase/api/models/AchTransferSimulationTest.kt b/increase-kotlin-core/src/test/kotlin/com/increase/api/models/AchTransferSimulationTest.kt index 058ead90e..64a2c0f42 100644 --- a/increase-kotlin-core/src/test/kotlin/com/increase/api/models/AchTransferSimulationTest.kt +++ b/increase-kotlin-core/src/test/kotlin/com/increase/api/models/AchTransferSimulationTest.kt @@ -61,17 +61,18 @@ class AchTransferSimulationTest { .merchantCountry("string") .merchantDescriptor("string") .merchantState("string") - .network( - AchTransferSimulation.DeclinedTransaction.Source - .CardDecline - .Network - .VISA - ) .networkDetails( AchTransferSimulation.DeclinedTransaction.Source .CardDecline .NetworkDetails .builder() + .category( + AchTransferSimulation.DeclinedTransaction.Source + .CardDecline + .NetworkDetails + .Category + .VISA + ) .visa( AchTransferSimulation.DeclinedTransaction.Source .CardDecline @@ -89,7 +90,7 @@ class AchTransferSimulationTest { .MAIL_PHONE_ORDER ) .pointOfServiceEntryMode( - PointOfServiceEntryMode.MANUAL + PointOfServiceEntryMode.UNKNOWN ) .build() ) @@ -778,15 +779,17 @@ class AchTransferSimulationTest { .merchantCountry("string") .merchantDescriptor("string") .merchantState("string") - .network( - AchTransferSimulation.DeclinedTransaction.Source.CardDecline - .Network - .VISA - ) .networkDetails( AchTransferSimulation.DeclinedTransaction.Source.CardDecline .NetworkDetails .builder() + .category( + AchTransferSimulation.DeclinedTransaction.Source + .CardDecline + .NetworkDetails + .Category + .VISA + ) .visa( AchTransferSimulation.DeclinedTransaction.Source .CardDecline @@ -803,7 +806,7 @@ class AchTransferSimulationTest { .MAIL_PHONE_ORDER ) .pointOfServiceEntryMode( - PointOfServiceEntryMode.MANUAL + PointOfServiceEntryMode.UNKNOWN ) .build() ) diff --git a/increase-kotlin-core/src/test/kotlin/com/increase/api/models/CardAuthorizationSimulationTest.kt b/increase-kotlin-core/src/test/kotlin/com/increase/api/models/CardAuthorizationSimulationTest.kt index 66ca52a59..a85600a36 100644 --- a/increase-kotlin-core/src/test/kotlin/com/increase/api/models/CardAuthorizationSimulationTest.kt +++ b/increase-kotlin-core/src/test/kotlin/com/increase/api/models/CardAuthorizationSimulationTest.kt @@ -62,17 +62,19 @@ class CardAuthorizationSimulationTest { .merchantCountry("string") .merchantDescriptor("string") .merchantState("string") - .network( - CardAuthorizationSimulation.DeclinedTransaction.Source - .CardDecline - .Network - .VISA - ) .networkDetails( CardAuthorizationSimulation.DeclinedTransaction.Source .CardDecline .NetworkDetails .builder() + .category( + CardAuthorizationSimulation.DeclinedTransaction + .Source + .CardDecline + .NetworkDetails + .Category + .VISA + ) .visa( CardAuthorizationSimulation.DeclinedTransaction .Source @@ -91,7 +93,7 @@ class CardAuthorizationSimulationTest { .MAIL_PHONE_ORDER ) .pointOfServiceEntryMode( - PointOfServiceEntryMode.MANUAL + PointOfServiceEntryMode.UNKNOWN ) .build() ) @@ -290,17 +292,19 @@ class CardAuthorizationSimulationTest { .merchantCity("string") .merchantCountry("string") .merchantDescriptor("string") - .network( - CardAuthorizationSimulation.PendingTransaction.Source - .CardAuthorization - .Network - .VISA - ) .networkDetails( CardAuthorizationSimulation.PendingTransaction.Source .CardAuthorization .NetworkDetails .builder() + .category( + CardAuthorizationSimulation.PendingTransaction + .Source + .CardAuthorization + .NetworkDetails + .Category + .VISA + ) .visa( CardAuthorizationSimulation.PendingTransaction .Source @@ -319,7 +323,7 @@ class CardAuthorizationSimulationTest { .MAIL_PHONE_ORDER ) .pointOfServiceEntryMode( - PointOfServiceEntryMode.MANUAL + PointOfServiceEntryMode.UNKNOWN ) .build() ) @@ -485,17 +489,19 @@ class CardAuthorizationSimulationTest { .merchantCountry("string") .merchantDescriptor("string") .merchantState("string") - .network( - CardAuthorizationSimulation.DeclinedTransaction.Source - .CardDecline - .Network - .VISA - ) .networkDetails( CardAuthorizationSimulation.DeclinedTransaction.Source .CardDecline .NetworkDetails .builder() + .category( + CardAuthorizationSimulation.DeclinedTransaction + .Source + .CardDecline + .NetworkDetails + .Category + .VISA + ) .visa( CardAuthorizationSimulation.DeclinedTransaction .Source @@ -514,7 +520,7 @@ class CardAuthorizationSimulationTest { .MAIL_PHONE_ORDER ) .pointOfServiceEntryMode( - PointOfServiceEntryMode.MANUAL + PointOfServiceEntryMode.UNKNOWN ) .build() ) @@ -705,17 +711,19 @@ class CardAuthorizationSimulationTest { .merchantCity("string") .merchantCountry("string") .merchantDescriptor("string") - .network( - CardAuthorizationSimulation.PendingTransaction.Source - .CardAuthorization - .Network - .VISA - ) .networkDetails( CardAuthorizationSimulation.PendingTransaction.Source .CardAuthorization .NetworkDetails .builder() + .category( + CardAuthorizationSimulation.PendingTransaction + .Source + .CardAuthorization + .NetworkDetails + .Category + .VISA + ) .visa( CardAuthorizationSimulation.PendingTransaction .Source @@ -734,7 +742,7 @@ class CardAuthorizationSimulationTest { .MAIL_PHONE_ORDER ) .pointOfServiceEntryMode( - PointOfServiceEntryMode.MANUAL + PointOfServiceEntryMode.UNKNOWN ) .build() ) diff --git a/increase-kotlin-core/src/test/kotlin/com/increase/api/models/CheckTransferCreateParamsTest.kt b/increase-kotlin-core/src/test/kotlin/com/increase/api/models/CheckTransferCreateParamsTest.kt index fd1229d67..11bb43d49 100644 --- a/increase-kotlin-core/src/test/kotlin/com/increase/api/models/CheckTransferCreateParamsTest.kt +++ b/increase-kotlin-core/src/test/kotlin/com/increase/api/models/CheckTransferCreateParamsTest.kt @@ -11,25 +11,35 @@ class CheckTransferCreateParamsTest { CheckTransferCreateParams.builder() .accountId("string") .sourceAccountNumberId("string") - .addressLine1("x") - .addressLine2("x") - .addressCity("x") - .addressState("x") - .addressZip("x") - .returnAddress( - CheckTransferCreateParams.ReturnAddress.builder() - .city("x") - .line1("x") - .name("x") - .state("x") - .zip("x") - .line2("x") + .fulfillmentMethod(CheckTransferCreateParams.FulfillmentMethod.PHYSICAL_CHECK) + .physicalCheck( + CheckTransferCreateParams.PhysicalCheck.builder() + .mailingAddress( + CheckTransferCreateParams.PhysicalCheck.MailingAddress.builder() + .city("x") + .line1("x") + .postalCode("x") + .state("x") + .line2("x") + .name("x") + .build() + ) + .memo("x") + .recipientName("x") + .note("x") + .returnAddress( + CheckTransferCreateParams.PhysicalCheck.ReturnAddress.builder() + .city("x") + .line1("x") + .name("x") + .postalCode("x") + .state("x") + .line2("x") + .build() + ) .build() ) .amount(123L) - .message("x") - .note("x") - .recipientName("x") .requireApproval(true) .uniqueIdentifier("x") .build() @@ -41,25 +51,35 @@ class CheckTransferCreateParamsTest { CheckTransferCreateParams.builder() .accountId("string") .sourceAccountNumberId("string") - .addressLine1("x") - .addressLine2("x") - .addressCity("x") - .addressState("x") - .addressZip("x") - .returnAddress( - CheckTransferCreateParams.ReturnAddress.builder() - .city("x") - .line1("x") - .name("x") - .state("x") - .zip("x") - .line2("x") + .fulfillmentMethod(CheckTransferCreateParams.FulfillmentMethod.PHYSICAL_CHECK) + .physicalCheck( + CheckTransferCreateParams.PhysicalCheck.builder() + .mailingAddress( + CheckTransferCreateParams.PhysicalCheck.MailingAddress.builder() + .city("x") + .line1("x") + .postalCode("x") + .state("x") + .line2("x") + .name("x") + .build() + ) + .memo("x") + .recipientName("x") + .note("x") + .returnAddress( + CheckTransferCreateParams.PhysicalCheck.ReturnAddress.builder() + .city("x") + .line1("x") + .name("x") + .postalCode("x") + .state("x") + .line2("x") + .build() + ) .build() ) .amount(123L) - .message("x") - .note("x") - .recipientName("x") .requireApproval(true) .uniqueIdentifier("x") .build() @@ -67,52 +87,47 @@ class CheckTransferCreateParamsTest { assertThat(body).isNotNull assertThat(body.accountId()).isEqualTo("string") assertThat(body.sourceAccountNumberId()).isEqualTo("string") - assertThat(body.addressLine1()).isEqualTo("x") - assertThat(body.addressLine2()).isEqualTo("x") - assertThat(body.addressCity()).isEqualTo("x") - assertThat(body.addressState()).isEqualTo("x") - assertThat(body.addressZip()).isEqualTo("x") - assertThat(body.returnAddress()) + assertThat(body.fulfillmentMethod()) + .isEqualTo(CheckTransferCreateParams.FulfillmentMethod.PHYSICAL_CHECK) + assertThat(body.physicalCheck()) .isEqualTo( - CheckTransferCreateParams.ReturnAddress.builder() - .city("x") - .line1("x") - .name("x") - .state("x") - .zip("x") - .line2("x") + CheckTransferCreateParams.PhysicalCheck.builder() + .mailingAddress( + CheckTransferCreateParams.PhysicalCheck.MailingAddress.builder() + .city("x") + .line1("x") + .postalCode("x") + .state("x") + .line2("x") + .name("x") + .build() + ) + .memo("x") + .recipientName("x") + .note("x") + .returnAddress( + CheckTransferCreateParams.PhysicalCheck.ReturnAddress.builder() + .city("x") + .line1("x") + .name("x") + .postalCode("x") + .state("x") + .line2("x") + .build() + ) .build() ) assertThat(body.amount()).isEqualTo(123L) - assertThat(body.message()).isEqualTo("x") - assertThat(body.note()).isEqualTo("x") - assertThat(body.recipientName()).isEqualTo("x") assertThat(body.requireApproval()).isEqualTo(true) assertThat(body.uniqueIdentifier()).isEqualTo("x") } @Test fun getBodyWithoutOptionalFields() { - val params = - CheckTransferCreateParams.builder() - .accountId("string") - .addressLine1("x") - .addressCity("x") - .addressState("x") - .addressZip("x") - .amount(123L) - .message("x") - .recipientName("x") - .build() + val params = CheckTransferCreateParams.builder().accountId("string").amount(123L).build() val body = params.getBody() assertThat(body).isNotNull assertThat(body.accountId()).isEqualTo("string") - assertThat(body.addressLine1()).isEqualTo("x") - assertThat(body.addressCity()).isEqualTo("x") - assertThat(body.addressState()).isEqualTo("x") - assertThat(body.addressZip()).isEqualTo("x") assertThat(body.amount()).isEqualTo(123L) - assertThat(body.message()).isEqualTo("x") - assertThat(body.recipientName()).isEqualTo("x") } } diff --git a/increase-kotlin-core/src/test/kotlin/com/increase/api/models/CheckTransferTest.kt b/increase-kotlin-core/src/test/kotlin/com/increase/api/models/CheckTransferTest.kt index 3a21fc926..b7fbfeeda 100644 --- a/increase-kotlin-core/src/test/kotlin/com/increase/api/models/CheckTransferTest.kt +++ b/increase-kotlin-core/src/test/kotlin/com/increase/api/models/CheckTransferTest.kt @@ -13,11 +13,6 @@ class CheckTransferTest { .id("string") .accountId("string") .accountNumber("string") - .addressCity("string") - .addressLine1("string") - .addressLine2("string") - .addressState("string") - .addressZip("string") .amount(123L) .approval( CheckTransfer.Approval.builder() @@ -43,19 +38,38 @@ class CheckTransferTest { .type(CheckTransfer.Deposit.Type.CHECK_TRANSFER_DEPOSIT) .build() ) - .mailedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .message("string") - .note("string") + .fulfillmentMethod(CheckTransfer.FulfillmentMethod.PHYSICAL_CHECK) + .mailing( + CheckTransfer.Mailing.builder() + .mailedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) .pendingTransactionId("string") - .recipientName("string") - .returnAddress( - CheckTransfer.ReturnAddress.builder() - .city("string") - .line1("string") - .line2("string") - .name("string") - .state("string") - .zip("string") + .physicalCheck( + CheckTransfer.PhysicalCheck.builder() + .mailingAddress( + CheckTransfer.PhysicalCheck.MailingAddress.builder() + .city("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .state("string") + .build() + ) + .memo("string") + .note("string") + .recipientName("string") + .returnAddress( + CheckTransfer.PhysicalCheck.ReturnAddress.builder() + .city("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .state("string") + .build() + ) .build() ) .routingNumber("string") @@ -84,11 +98,6 @@ class CheckTransferTest { assertThat(checkTransfer.id()).isEqualTo("string") assertThat(checkTransfer.accountId()).isEqualTo("string") assertThat(checkTransfer.accountNumber()).isEqualTo("string") - assertThat(checkTransfer.addressCity()).isEqualTo("string") - assertThat(checkTransfer.addressLine1()).isEqualTo("string") - assertThat(checkTransfer.addressLine2()).isEqualTo("string") - assertThat(checkTransfer.addressState()).isEqualTo("string") - assertThat(checkTransfer.addressZip()).isEqualTo("string") assertThat(checkTransfer.amount()).isEqualTo(123L) assertThat(checkTransfer.approval()) .isEqualTo( @@ -118,21 +127,41 @@ class CheckTransferTest { .type(CheckTransfer.Deposit.Type.CHECK_TRANSFER_DEPOSIT) .build() ) - assertThat(checkTransfer.mailedAt()) - .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(checkTransfer.message()).isEqualTo("string") - assertThat(checkTransfer.note()).isEqualTo("string") + assertThat(checkTransfer.fulfillmentMethod()) + .isEqualTo(CheckTransfer.FulfillmentMethod.PHYSICAL_CHECK) + assertThat(checkTransfer.mailing()) + .isEqualTo( + CheckTransfer.Mailing.builder() + .mailedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) assertThat(checkTransfer.pendingTransactionId()).isEqualTo("string") - assertThat(checkTransfer.recipientName()).isEqualTo("string") - assertThat(checkTransfer.returnAddress()) + assertThat(checkTransfer.physicalCheck()) .isEqualTo( - CheckTransfer.ReturnAddress.builder() - .city("string") - .line1("string") - .line2("string") - .name("string") - .state("string") - .zip("string") + CheckTransfer.PhysicalCheck.builder() + .mailingAddress( + CheckTransfer.PhysicalCheck.MailingAddress.builder() + .city("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .state("string") + .build() + ) + .memo("string") + .note("string") + .recipientName("string") + .returnAddress( + CheckTransfer.PhysicalCheck.ReturnAddress.builder() + .city("string") + .line1("string") + .line2("string") + .name("string") + .postalCode("string") + .state("string") + .build() + ) .build() ) assertThat(checkTransfer.routingNumber()).isEqualTo("string") diff --git a/increase-kotlin-core/src/test/kotlin/com/increase/api/models/DeclinedTransactionTest.kt b/increase-kotlin-core/src/test/kotlin/com/increase/api/models/DeclinedTransactionTest.kt index 903bb8fe5..b46522798 100644 --- a/increase-kotlin-core/src/test/kotlin/com/increase/api/models/DeclinedTransactionTest.kt +++ b/increase-kotlin-core/src/test/kotlin/com/increase/api/models/DeclinedTransactionTest.kt @@ -46,9 +46,13 @@ class DeclinedTransactionTest { .merchantCountry("string") .merchantDescriptor("string") .merchantState("string") - .network(DeclinedTransaction.Source.CardDecline.Network.VISA) .networkDetails( DeclinedTransaction.Source.CardDecline.NetworkDetails.builder() + .category( + DeclinedTransaction.Source.CardDecline.NetworkDetails + .Category + .VISA + ) .visa( DeclinedTransaction.Source.CardDecline.NetworkDetails .Visa @@ -61,7 +65,7 @@ class DeclinedTransactionTest { .MAIL_PHONE_ORDER ) .pointOfServiceEntryMode( - PointOfServiceEntryMode.MANUAL + PointOfServiceEntryMode.UNKNOWN ) .build() ) @@ -215,9 +219,13 @@ class DeclinedTransactionTest { .merchantCountry("string") .merchantDescriptor("string") .merchantState("string") - .network(DeclinedTransaction.Source.CardDecline.Network.VISA) .networkDetails( DeclinedTransaction.Source.CardDecline.NetworkDetails.builder() + .category( + DeclinedTransaction.Source.CardDecline.NetworkDetails + .Category + .VISA + ) .visa( DeclinedTransaction.Source.CardDecline.NetworkDetails.Visa .builder() @@ -228,7 +236,9 @@ class DeclinedTransactionTest { .ElectronicCommerceIndicator .MAIL_PHONE_ORDER ) - .pointOfServiceEntryMode(PointOfServiceEntryMode.MANUAL) + .pointOfServiceEntryMode( + PointOfServiceEntryMode.UNKNOWN + ) .build() ) .build() diff --git a/increase-kotlin-core/src/test/kotlin/com/increase/api/models/InboundRealTimePaymentsTransferSimulationResultTest.kt b/increase-kotlin-core/src/test/kotlin/com/increase/api/models/InboundRealTimePaymentsTransferSimulationResultTest.kt index f3f65b4ac..715b377f3 100644 --- a/increase-kotlin-core/src/test/kotlin/com/increase/api/models/InboundRealTimePaymentsTransferSimulationResultTest.kt +++ b/increase-kotlin-core/src/test/kotlin/com/increase/api/models/InboundRealTimePaymentsTransferSimulationResultTest.kt @@ -79,14 +79,6 @@ class InboundRealTimePaymentsTransferSimulationResultTest { .merchantCountry("string") .merchantDescriptor("string") .merchantState("string") - .network( - InboundRealTimePaymentsTransferSimulationResult - .DeclinedTransaction - .Source - .CardDecline - .Network - .VISA - ) .networkDetails( InboundRealTimePaymentsTransferSimulationResult .DeclinedTransaction @@ -94,6 +86,15 @@ class InboundRealTimePaymentsTransferSimulationResultTest { .CardDecline .NetworkDetails .builder() + .category( + InboundRealTimePaymentsTransferSimulationResult + .DeclinedTransaction + .Source + .CardDecline + .NetworkDetails + .Category + .VISA + ) .visa( InboundRealTimePaymentsTransferSimulationResult .DeclinedTransaction @@ -113,7 +114,7 @@ class InboundRealTimePaymentsTransferSimulationResultTest { .MAIL_PHONE_ORDER ) .pointOfServiceEntryMode( - PointOfServiceEntryMode.MANUAL + PointOfServiceEntryMode.UNKNOWN ) .build() ) @@ -965,14 +966,6 @@ class InboundRealTimePaymentsTransferSimulationResultTest { .merchantCountry("string") .merchantDescriptor("string") .merchantState("string") - .network( - InboundRealTimePaymentsTransferSimulationResult - .DeclinedTransaction - .Source - .CardDecline - .Network - .VISA - ) .networkDetails( InboundRealTimePaymentsTransferSimulationResult .DeclinedTransaction @@ -980,6 +973,15 @@ class InboundRealTimePaymentsTransferSimulationResultTest { .CardDecline .NetworkDetails .builder() + .category( + InboundRealTimePaymentsTransferSimulationResult + .DeclinedTransaction + .Source + .CardDecline + .NetworkDetails + .Category + .VISA + ) .visa( InboundRealTimePaymentsTransferSimulationResult .DeclinedTransaction @@ -999,7 +1001,7 @@ class InboundRealTimePaymentsTransferSimulationResultTest { .MAIL_PHONE_ORDER ) .pointOfServiceEntryMode( - PointOfServiceEntryMode.MANUAL + PointOfServiceEntryMode.UNKNOWN ) .build() ) diff --git a/increase-kotlin-core/src/test/kotlin/com/increase/api/models/PendingTransactionTest.kt b/increase-kotlin-core/src/test/kotlin/com/increase/api/models/PendingTransactionTest.kt index 45dc8a61a..d95c72841 100644 --- a/increase-kotlin-core/src/test/kotlin/com/increase/api/models/PendingTransactionTest.kt +++ b/increase-kotlin-core/src/test/kotlin/com/increase/api/models/PendingTransactionTest.kt @@ -49,10 +49,15 @@ class PendingTransactionTest { .merchantCity("string") .merchantCountry("string") .merchantDescriptor("string") - .network(PendingTransaction.Source.CardAuthorization.Network.VISA) .networkDetails( PendingTransaction.Source.CardAuthorization.NetworkDetails .builder() + .category( + PendingTransaction.Source.CardAuthorization + .NetworkDetails + .Category + .VISA + ) .visa( PendingTransaction.Source.CardAuthorization .NetworkDetails @@ -66,7 +71,7 @@ class PendingTransactionTest { .MAIL_PHONE_ORDER ) .pointOfServiceEntryMode( - PointOfServiceEntryMode.MANUAL + PointOfServiceEntryMode.UNKNOWN ) .build() ) @@ -183,9 +188,13 @@ class PendingTransactionTest { .merchantCity("string") .merchantCountry("string") .merchantDescriptor("string") - .network(PendingTransaction.Source.CardAuthorization.Network.VISA) .networkDetails( PendingTransaction.Source.CardAuthorization.NetworkDetails.builder() + .category( + PendingTransaction.Source.CardAuthorization.NetworkDetails + .Category + .VISA + ) .visa( PendingTransaction.Source.CardAuthorization.NetworkDetails .Visa @@ -197,7 +206,9 @@ class PendingTransactionTest { .ElectronicCommerceIndicator .MAIL_PHONE_ORDER ) - .pointOfServiceEntryMode(PointOfServiceEntryMode.MANUAL) + .pointOfServiceEntryMode( + PointOfServiceEntryMode.UNKNOWN + ) .build() ) .build() diff --git a/increase-kotlin-core/src/test/kotlin/com/increase/api/models/RealTimeDecisionTest.kt b/increase-kotlin-core/src/test/kotlin/com/increase/api/models/RealTimeDecisionTest.kt index a2be3374b..5b878eb9a 100644 --- a/increase-kotlin-core/src/test/kotlin/com/increase/api/models/RealTimeDecisionTest.kt +++ b/increase-kotlin-core/src/test/kotlin/com/increase/api/models/RealTimeDecisionTest.kt @@ -1,5 +1,6 @@ package com.increase.api.models +import com.increase.api.core.JsonNull import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -21,9 +22,11 @@ class RealTimeDecisionTest { .merchantCity("string") .merchantCountry("string") .merchantDescriptor("string") - .network(RealTimeDecision.CardAuthorization.Network.VISA) .networkDetails( RealTimeDecision.CardAuthorization.NetworkDetails.builder() + .category( + RealTimeDecision.CardAuthorization.NetworkDetails.Category.VISA + ) .visa( RealTimeDecision.CardAuthorization.NetworkDetails.Visa.builder() .electronicCommerceIndicator( @@ -31,7 +34,7 @@ class RealTimeDecisionTest { .ElectronicCommerceIndicator .MAIL_PHONE_ORDER ) - .pointOfServiceEntryMode(PointOfServiceEntryMode.MANUAL) + .pointOfServiceEntryMode(PointOfServiceEntryMode.UNKNOWN) .build() ) .build() @@ -39,6 +42,23 @@ class RealTimeDecisionTest { .physicalCardId("string") .presentmentAmount(123L) .presentmentCurrency("string") + .requestDetails( + RealTimeDecision.CardAuthorization.RequestDetails.builder() + .category( + RealTimeDecision.CardAuthorization.RequestDetails.Category + .INITIAL_AUTHORIZATION + ) + .incrementalAuthorization( + RealTimeDecision.CardAuthorization.RequestDetails + .IncrementalAuthorization + .builder() + .cardPaymentId("string") + .originalCardAuthorizationId("string") + .build() + ) + .initialAuthorization(JsonNull.of()) + .build() + ) .settlementAmount(123L) .settlementCurrency("string") .build() @@ -83,9 +103,11 @@ class RealTimeDecisionTest { .merchantCity("string") .merchantCountry("string") .merchantDescriptor("string") - .network(RealTimeDecision.CardAuthorization.Network.VISA) .networkDetails( RealTimeDecision.CardAuthorization.NetworkDetails.builder() + .category( + RealTimeDecision.CardAuthorization.NetworkDetails.Category.VISA + ) .visa( RealTimeDecision.CardAuthorization.NetworkDetails.Visa.builder() .electronicCommerceIndicator( @@ -93,7 +115,7 @@ class RealTimeDecisionTest { .ElectronicCommerceIndicator .MAIL_PHONE_ORDER ) - .pointOfServiceEntryMode(PointOfServiceEntryMode.MANUAL) + .pointOfServiceEntryMode(PointOfServiceEntryMode.UNKNOWN) .build() ) .build() @@ -101,6 +123,23 @@ class RealTimeDecisionTest { .physicalCardId("string") .presentmentAmount(123L) .presentmentCurrency("string") + .requestDetails( + RealTimeDecision.CardAuthorization.RequestDetails.builder() + .category( + RealTimeDecision.CardAuthorization.RequestDetails.Category + .INITIAL_AUTHORIZATION + ) + .incrementalAuthorization( + RealTimeDecision.CardAuthorization.RequestDetails + .IncrementalAuthorization + .builder() + .cardPaymentId("string") + .originalCardAuthorizationId("string") + .build() + ) + .initialAuthorization(JsonNull.of()) + .build() + ) .settlementAmount(123L) .settlementCurrency("string") .build() diff --git a/increase-kotlin-core/src/test/kotlin/com/increase/api/services/blocking/CheckTransferServiceTest.kt b/increase-kotlin-core/src/test/kotlin/com/increase/api/services/blocking/CheckTransferServiceTest.kt index af8813eb6..7e3a08cd4 100644 --- a/increase-kotlin-core/src/test/kotlin/com/increase/api/services/blocking/CheckTransferServiceTest.kt +++ b/increase-kotlin-core/src/test/kotlin/com/increase/api/services/blocking/CheckTransferServiceTest.kt @@ -24,25 +24,35 @@ class CheckTransferServiceTest { CheckTransferCreateParams.builder() .accountId("string") .sourceAccountNumberId("string") - .addressLine1("x") - .addressLine2("x") - .addressCity("x") - .addressState("x") - .addressZip("x") - .returnAddress( - CheckTransferCreateParams.ReturnAddress.builder() - .city("x") - .line1("x") - .name("x") - .state("x") - .zip("x") - .line2("x") + .fulfillmentMethod(CheckTransferCreateParams.FulfillmentMethod.PHYSICAL_CHECK) + .physicalCheck( + CheckTransferCreateParams.PhysicalCheck.builder() + .mailingAddress( + CheckTransferCreateParams.PhysicalCheck.MailingAddress.builder() + .city("x") + .line1("x") + .postalCode("x") + .state("x") + .line2("x") + .name("x") + .build() + ) + .memo("x") + .recipientName("x") + .note("x") + .returnAddress( + CheckTransferCreateParams.PhysicalCheck.ReturnAddress.builder() + .city("x") + .line1("x") + .name("x") + .postalCode("x") + .state("x") + .line2("x") + .build() + ) .build() ) .amount(123L) - .message("x") - .note("x") - .recipientName("x") .requireApproval(true) .uniqueIdentifier("x") .build()