From 78ee0ad80dfda080447395d3c3b457f5904d1ee0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 27 Mar 2026 16:51:17 +0000 Subject: [PATCH 1/3] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 46d00e014..1c40aac3d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 236 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-57310f0e57b0996b79f938ef778b40e54f5b62cefb78c3e6405cefacfa704c66.yml openapi_spec_hash: c6d65e9ebf76cb81a5395b8ab4251a95 -config_hash: 0997ade8b52ec04e82d5b0c3b61bb51e +config_hash: 4945e03affdf289484733306e4797f81 From 8fdd5170cbf62b0f697ebeb8bc0c377fd58211b6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 30 Mar 2026 20:37:57 +0000 Subject: [PATCH 2/3] feat(api): api update --- .stats.yml | 4 +- .../api/models/cardpayments/CardPayment.kt | 52636 ++++++++++------ .../DeclinedTransaction.kt | 1378 +- .../pendingtransactions/PendingTransaction.kt | 1377 +- .../api/models/transactions/Transaction.kt | 26680 ++++---- .../CardPaymentListPageResponseTest.kt | 2560 +- .../models/cardpayments/CardPaymentTest.kt | 1985 +- ...DeclinedTransactionListPageResponseTest.kt | 60 + .../DeclinedTransactionTest.kt | 50 + .../PendingTransactionListPageResponseTest.kt | 67 + .../PendingTransactionTest.kt | 54 + .../CardAuthorizationCreateResponseTest.kt | 127 + .../TransactionListPageResponseTest.kt | 163 + .../models/transactions/TransactionTest.kt | 133 + 14 files changed, 55819 insertions(+), 31455 deletions(-) diff --git a/.stats.yml b/.stats.yml index 1c40aac3d..d76d554a2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 236 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-57310f0e57b0996b79f938ef778b40e54f5b62cefb78c3e6405cefacfa704c66.yml -openapi_spec_hash: c6d65e9ebf76cb81a5395b8ab4251a95 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-1537e933795625528b93b601e286a513458f9aad05160ee018383e6b29986956.yml +openapi_spec_hash: f34d800917618bf012b466c1f88e8eca config_hash: 4945e03affdf289484733306e4797f81 diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/cardpayments/CardPayment.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/cardpayments/CardPayment.kt index 10c33c762..5553e3244 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/cardpayments/CardPayment.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/cardpayments/CardPayment.kt @@ -36,7 +36,6 @@ private constructor( private val digitalWalletTokenId: JsonField, private val elements: JsonField>, private val physicalCardId: JsonField, - private val schemeFees: JsonField>, private val state: JsonField, private val type: JsonField, private val additionalProperties: MutableMap, @@ -59,9 +58,6 @@ private constructor( @JsonProperty("physical_card_id") @ExcludeMissing physicalCardId: JsonField = JsonMissing.of(), - @JsonProperty("scheme_fees") - @ExcludeMissing - schemeFees: JsonField> = JsonMissing.of(), @JsonProperty("state") @ExcludeMissing state: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), ) : this( @@ -72,7 +68,6 @@ private constructor( digitalWalletTokenId, elements, physicalCardId, - schemeFees, state, type, mutableMapOf(), @@ -136,14 +131,6 @@ private constructor( */ fun physicalCardId(): Optional = physicalCardId.getOptional("physical_card_id") - /** - * The scheme fees associated with this card payment. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun schemeFees(): List = schemeFees.getRequired("scheme_fees") - /** * The summarized state of this card payment. * @@ -217,15 +204,6 @@ private constructor( @ExcludeMissing fun _physicalCardId(): JsonField = physicalCardId - /** - * Returns the raw JSON value of [schemeFees]. - * - * Unlike [schemeFees], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("scheme_fees") - @ExcludeMissing - fun _schemeFees(): JsonField> = schemeFees - /** * Returns the raw JSON value of [state]. * @@ -266,7 +244,6 @@ private constructor( * .digitalWalletTokenId() * .elements() * .physicalCardId() - * .schemeFees() * .state() * .type() * ``` @@ -284,7 +261,6 @@ private constructor( private var digitalWalletTokenId: JsonField? = null private var elements: JsonField>? = null private var physicalCardId: JsonField? = null - private var schemeFees: JsonField>? = null private var state: JsonField? = null private var type: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -298,7 +274,6 @@ private constructor( digitalWalletTokenId = cardPayment.digitalWalletTokenId elements = cardPayment.elements.map { it.toMutableList() } physicalCardId = cardPayment.physicalCardId - schemeFees = cardPayment.schemeFees.map { it.toMutableList() } state = cardPayment.state type = cardPayment.type additionalProperties = cardPayment.additionalProperties.toMutableMap() @@ -420,32 +395,6 @@ private constructor( this.physicalCardId = physicalCardId } - /** The scheme fees associated with this card payment. */ - fun schemeFees(schemeFees: List) = schemeFees(JsonField.of(schemeFees)) - - /** - * Sets [Builder.schemeFees] to an arbitrary JSON value. - * - * You should usually call [Builder.schemeFees] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun schemeFees(schemeFees: JsonField>) = apply { - this.schemeFees = schemeFees.map { it.toMutableList() } - } - - /** - * Adds a single [SchemeFee] to [schemeFees]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addSchemeFee(schemeFee: SchemeFee) = apply { - schemeFees = - (schemeFees ?: JsonField.of(mutableListOf())).also { - checkKnown("schemeFees", it).add(schemeFee) - } - } - /** The summarized state of this card payment. */ fun state(state: State) = state(JsonField.of(state)) @@ -504,7 +453,6 @@ private constructor( * .digitalWalletTokenId() * .elements() * .physicalCardId() - * .schemeFees() * .state() * .type() * ``` @@ -520,7 +468,6 @@ private constructor( checkRequired("digitalWalletTokenId", digitalWalletTokenId), checkRequired("elements", elements).map { it.toImmutable() }, checkRequired("physicalCardId", physicalCardId), - checkRequired("schemeFees", schemeFees).map { it.toImmutable() }, checkRequired("state", state), checkRequired("type", type), additionalProperties.toMutableMap(), @@ -541,7 +488,6 @@ private constructor( digitalWalletTokenId() elements().forEach { it.validate() } physicalCardId() - schemeFees().forEach { it.validate() } state().validate() type().validate() validated = true @@ -569,7 +515,6 @@ private constructor( (if (digitalWalletTokenId.asKnown().isPresent) 1 else 0) + (elements.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (physicalCardId.asKnown().isPresent) 1 else 0) + - (schemeFees.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (state.asKnown().getOrNull()?.validity() ?: 0) + (type.asKnown().getOrNull()?.validity() ?: 0) @@ -8524,6 +8469,7 @@ private constructor( private val presentmentCurrency: JsonField, private val processingCategory: JsonField, private val realTimeDecisionId: JsonField, + private val schemeFees: JsonField>, private val terminalId: JsonField, private val type: JsonField, private val verification: JsonField, @@ -8603,6 +8549,9 @@ private constructor( @JsonProperty("real_time_decision_id") @ExcludeMissing realTimeDecisionId: JsonField = JsonMissing.of(), + @JsonProperty("scheme_fees") + @ExcludeMissing + schemeFees: JsonField> = JsonMissing.of(), @JsonProperty("terminal_id") @ExcludeMissing terminalId: JsonField = JsonMissing.of(), @@ -8636,6 +8585,7 @@ private constructor( presentmentCurrency, processingCategory, realTimeDecisionId, + schemeFees, terminalId, type, verification, @@ -8886,6 +8836,15 @@ private constructor( fun realTimeDecisionId(): Optional = realTimeDecisionId.getOptional("real_time_decision_id") + /** + * The scheme fees associated with this card authorization. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun schemeFees(): List = schemeFees.getRequired("scheme_fees") + /** * The terminal identifier (commonly abbreviated as TID) of the terminal the card is * transacting with. @@ -9158,6 +9117,16 @@ private constructor( @ExcludeMissing fun _realTimeDecisionId(): JsonField = realTimeDecisionId + /** + * Returns the raw JSON value of [schemeFees]. + * + * Unlike [schemeFees], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("scheme_fees") + @ExcludeMissing + fun _schemeFees(): JsonField> = schemeFees + /** * Returns the raw JSON value of [terminalId]. * @@ -9229,6 +9198,7 @@ private constructor( * .presentmentCurrency() * .processingCategory() * .realTimeDecisionId() + * .schemeFees() * .terminalId() * .type() * .verification() @@ -9265,6 +9235,7 @@ private constructor( private var presentmentCurrency: JsonField? = null private var processingCategory: JsonField? = null private var realTimeDecisionId: JsonField? = null + private var schemeFees: JsonField>? = null private var terminalId: JsonField? = null private var type: JsonField? = null private var verification: JsonField? = null @@ -9297,6 +9268,7 @@ private constructor( presentmentCurrency = cardAuthorization.presentmentCurrency processingCategory = cardAuthorization.processingCategory realTimeDecisionId = cardAuthorization.realTimeDecisionId + schemeFees = cardAuthorization.schemeFees.map { it.toMutableList() } terminalId = cardAuthorization.terminalId type = cardAuthorization.type verification = cardAuthorization.verification @@ -9770,6 +9742,32 @@ private constructor( this.realTimeDecisionId = realTimeDecisionId } + /** The scheme fees associated with this card authorization. */ + fun schemeFees(schemeFees: List) = schemeFees(JsonField.of(schemeFees)) + + /** + * Sets [Builder.schemeFees] to an arbitrary JSON value. + * + * You should usually call [Builder.schemeFees] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun schemeFees(schemeFees: JsonField>) = apply { + this.schemeFees = schemeFees.map { it.toMutableList() } + } + + /** + * Adds a single [SchemeFee] to [schemeFees]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addSchemeFee(schemeFee: SchemeFee) = apply { + schemeFees = + (schemeFees ?: JsonField.of(mutableListOf())).also { + checkKnown("schemeFees", it).add(schemeFee) + } + } + /** * The terminal identifier (commonly abbreviated as TID) of the terminal the card is * transacting with. @@ -9874,6 +9872,7 @@ private constructor( * .presentmentCurrency() * .processingCategory() * .realTimeDecisionId() + * .schemeFees() * .terminalId() * .type() * .verification() @@ -9908,6 +9907,7 @@ private constructor( checkRequired("presentmentCurrency", presentmentCurrency), checkRequired("processingCategory", processingCategory), checkRequired("realTimeDecisionId", realTimeDecisionId), + checkRequired("schemeFees", schemeFees).map { it.toImmutable() }, checkRequired("terminalId", terminalId), checkRequired("type", type), checkRequired("verification", verification), @@ -9947,6 +9947,7 @@ private constructor( presentmentCurrency() processingCategory().validate() realTimeDecisionId() + schemeFees().forEach { it.validate() } terminalId() type().validate() verification().validate() @@ -9994,6 +9995,7 @@ private constructor( (if (presentmentCurrency.asKnown().isPresent) 1 else 0) + (processingCategory.asKnown().getOrNull()?.validity() ?: 0) + (if (realTimeDecisionId.asKnown().isPresent) 1 else 0) + + (schemeFees.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (terminalId.asKnown().isPresent) 1 else 0) + (type.asKnown().getOrNull()?.validity() ?: 0) + (verification.asKnown().getOrNull()?.validity() ?: 0) @@ -15994,217 +15996,162 @@ private constructor( override fun toString() = value.toString() } - /** - * A constant representing the object's type. For this resource it will always be - * `card_authorization`. - */ - class Type @JsonCreator private constructor(private val value: JsonField) : - Enum { + class SchemeFee + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val amount: JsonField, + private val createdAt: JsonField, + private val currency: JsonField, + private val feeType: JsonField, + private val fixedComponent: JsonField, + private val variableRate: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + createdAt: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("fee_type") + @ExcludeMissing + feeType: JsonField = JsonMissing.of(), + @JsonProperty("fixed_component") + @ExcludeMissing + fixedComponent: JsonField = JsonMissing.of(), + @JsonProperty("variable_rate") + @ExcludeMissing + variableRate: JsonField = JsonMissing.of(), + ) : this( + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, + mutableMapOf(), + ) /** - * Returns this class instance's raw value. + * The fee amount given as a string containing a decimal number. * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CARD_AUTHORIZATION = of("card_authorization") - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - /** An enum containing [Type]'s known values. */ - enum class Known { - CARD_AUTHORIZATION - } + fun amount(): String = amount.getRequired("amount") /** - * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + * created. * - * An instance of [Type] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). */ - enum class Value { - CARD_AUTHORIZATION, - /** - * An enum member indicating that [Type] was instantiated with an unknown value. - */ - _UNKNOWN, - } + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). */ - fun value(): Value = - when (this) { - CARD_AUTHORIZATION -> Value.CARD_AUTHORIZATION - else -> Value._UNKNOWN - } + fun currency(): Currency = currency.getRequired("currency") /** - * Returns an enum member corresponding to this class instance's value. + * The type of fee being assessed. * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a not a - * known member. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). */ - fun known(): Known = - when (this) { - CARD_AUTHORIZATION -> Known.CARD_AUTHORIZATION - else -> throw IncreaseInvalidDataException("Unknown Type: $value") - } + fun feeType(): FeeType = feeType.getRequired("fee_type") /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. + * The fixed component of the fee, if applicable, given in major units of the fee + * amount. * - * @throws IncreaseInvalidDataException if this class instance's value does not have - * the expected primitive type. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Type = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + fun fixedComponent(): Optional = + fixedComponent.getOptional("fixed_component") /** - * Returns a score indicating how many valid values are contained in this object - * recursively. + * The variable rate component of the fee, if applicable, given as a decimal (e.g., + * 0.015 for 1.5%). * - * Used for best match union deserialization. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Type && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** Fields related to verification of cardholder-provided values. */ - class Verification - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val cardVerificationCode: JsonField, - private val cardholderAddress: JsonField, - private val cardholderName: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("card_verification_code") - @ExcludeMissing - cardVerificationCode: JsonField = JsonMissing.of(), - @JsonProperty("cardholder_address") - @ExcludeMissing - cardholderAddress: JsonField = JsonMissing.of(), - @JsonProperty("cardholder_name") - @ExcludeMissing - cardholderName: JsonField = JsonMissing.of(), - ) : this(cardVerificationCode, cardholderAddress, cardholderName, mutableMapOf()) + fun variableRate(): Optional = variableRate.getOptional("variable_rate") /** - * Fields related to verification of the Card Verification Code, a 3-digit code on - * the back of the card. + * Returns the raw JSON value of [amount]. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun cardVerificationCode(): CardVerificationCode = - cardVerificationCode.getRequired("card_verification_code") + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount /** - * Cardholder address provided in the authorization request and the address on file - * we verified it against. + * Returns the raw JSON value of [createdAt]. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun cardholderAddress(): CardholderAddress = - cardholderAddress.getRequired("cardholder_address") + @JsonProperty("created_at") + @ExcludeMissing + fun _createdAt(): JsonField = createdAt /** - * Cardholder name provided in the authorization request. + * Returns the raw JSON value of [currency]. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun cardholderName(): Optional = - cardholderName.getOptional("cardholder_name") + @JsonProperty("currency") + @ExcludeMissing + fun _currency(): JsonField = currency /** - * Returns the raw JSON value of [cardVerificationCode]. + * Returns the raw JSON value of [feeType]. * - * Unlike [cardVerificationCode], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [feeType], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("card_verification_code") + @JsonProperty("fee_type") @ExcludeMissing - fun _cardVerificationCode(): JsonField = cardVerificationCode + fun _feeType(): JsonField = feeType /** - * Returns the raw JSON value of [cardholderAddress]. + * Returns the raw JSON value of [fixedComponent]. * - * Unlike [cardholderAddress], this method doesn't throw if the JSON field has an + * Unlike [fixedComponent], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("cardholder_address") + @JsonProperty("fixed_component") @ExcludeMissing - fun _cardholderAddress(): JsonField = cardholderAddress + fun _fixedComponent(): JsonField = fixedComponent /** - * Returns the raw JSON value of [cardholderName]. + * Returns the raw JSON value of [variableRate]. * - * Unlike [cardholderName], this method doesn't throw if the JSON field has an + * Unlike [variableRate], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("cardholder_name") + @JsonProperty("variable_rate") @ExcludeMissing - fun _cardholderName(): JsonField = cardholderName + fun _variableRate(): JsonField = variableRate @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -16221,90 +16168,146 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [Verification]. + * Returns a mutable builder for constructing an instance of [SchemeFee]. * * The following fields are required: * ```java - * .cardVerificationCode() - * .cardholderAddress() - * .cardholderName() + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [Verification]. */ + /** A builder for [SchemeFee]. */ class Builder internal constructor() { - private var cardVerificationCode: JsonField? = null - private var cardholderAddress: JsonField? = null - private var cardholderName: JsonField? = null + private var amount: JsonField? = null + private var createdAt: JsonField? = null + private var currency: JsonField? = null + private var feeType: JsonField? = null + private var fixedComponent: JsonField? = null + private var variableRate: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(verification: Verification) = apply { - cardVerificationCode = verification.cardVerificationCode - cardholderAddress = verification.cardholderAddress - cardholderName = verification.cardholderName - additionalProperties = verification.additionalProperties.toMutableMap() + internal fun from(schemeFee: SchemeFee) = apply { + amount = schemeFee.amount + createdAt = schemeFee.createdAt + currency = schemeFee.currency + feeType = schemeFee.feeType + fixedComponent = schemeFee.fixedComponent + variableRate = schemeFee.variableRate + additionalProperties = schemeFee.additionalProperties.toMutableMap() } + /** The fee amount given as a string containing a decimal number. */ + fun amount(amount: String) = amount(JsonField.of(amount)) + /** - * Fields related to verification of the Card Verification Code, a 3-digit code - * on the back of the card. + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - fun cardVerificationCode(cardVerificationCode: CardVerificationCode) = - cardVerificationCode(JsonField.of(cardVerificationCode)) + fun amount(amount: JsonField) = apply { this.amount = amount } /** - * Sets [Builder.cardVerificationCode] to an arbitrary JSON value. + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee + * was created. + */ + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + /** + * Sets [Builder.createdAt] to an arbitrary JSON value. * - * You should usually call [Builder.cardVerificationCode] with a well-typed - * [CardVerificationCode] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. + * You should usually call [Builder.createdAt] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - fun cardVerificationCode( - cardVerificationCode: JsonField - ) = apply { this.cardVerificationCode = cardVerificationCode } + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt + } /** - * Cardholder address provided in the authorization request and the address on - * file we verified it against. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. */ - fun cardholderAddress(cardholderAddress: CardholderAddress) = - cardholderAddress(JsonField.of(cardholderAddress)) + fun currency(currency: Currency) = currency(JsonField.of(currency)) /** - * Sets [Builder.cardholderAddress] to an arbitrary JSON value. + * Sets [Builder.currency] to an arbitrary JSON value. * - * You should usually call [Builder.cardholderAddress] with a well-typed - * [CardholderAddress] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * You should usually call [Builder.currency] with a well-typed [Currency] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - fun cardholderAddress(cardholderAddress: JsonField) = apply { - this.cardholderAddress = cardholderAddress + fun currency(currency: JsonField) = apply { this.currency = currency } + + /** The type of fee being assessed. */ + fun feeType(feeType: FeeType) = feeType(JsonField.of(feeType)) + + /** + * Sets [Builder.feeType] to an arbitrary JSON value. + * + * You should usually call [Builder.feeType] with a well-typed [FeeType] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun feeType(feeType: JsonField) = apply { this.feeType = feeType } + + /** + * The fixed component of the fee, if applicable, given in major units of the + * fee amount. + */ + fun fixedComponent(fixedComponent: String?) = + fixedComponent(JsonField.ofNullable(fixedComponent)) + + /** + * Alias for calling [Builder.fixedComponent] with + * `fixedComponent.orElse(null)`. + */ + fun fixedComponent(fixedComponent: Optional) = + fixedComponent(fixedComponent.getOrNull()) + + /** + * Sets [Builder.fixedComponent] to an arbitrary JSON value. + * + * You should usually call [Builder.fixedComponent] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun fixedComponent(fixedComponent: JsonField) = apply { + this.fixedComponent = fixedComponent } - /** Cardholder name provided in the authorization request. */ - fun cardholderName(cardholderName: CardholderName?) = - cardholderName(JsonField.ofNullable(cardholderName)) + /** + * The variable rate component of the fee, if applicable, given as a decimal + * (e.g., 0.015 for 1.5%). + */ + fun variableRate(variableRate: String?) = + variableRate(JsonField.ofNullable(variableRate)) /** - * Alias for calling [Builder.cardholderName] with - * `cardholderName.orElse(null)`. + * Alias for calling [Builder.variableRate] with `variableRate.orElse(null)`. */ - fun cardholderName(cardholderName: Optional) = - cardholderName(cardholderName.getOrNull()) + fun variableRate(variableRate: Optional) = + variableRate(variableRate.getOrNull()) /** - * Sets [Builder.cardholderName] to an arbitrary JSON value. + * Sets [Builder.variableRate] to an arbitrary JSON value. * - * You should usually call [Builder.cardholderName] with a well-typed - * [CardholderName] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * You should usually call [Builder.variableRate] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ - fun cardholderName(cardholderName: JsonField) = apply { - this.cardholderName = cardholderName + fun variableRate(variableRate: JsonField) = apply { + this.variableRate = variableRate } fun additionalProperties(additionalProperties: Map) = apply { @@ -16330,38 +16333,47 @@ private constructor( } /** - * Returns an immutable instance of [Verification]. + * Returns an immutable instance of [SchemeFee]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .cardVerificationCode() - * .cardholderAddress() - * .cardholderName() + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): Verification = - Verification( - checkRequired("cardVerificationCode", cardVerificationCode), - checkRequired("cardholderAddress", cardholderAddress), - checkRequired("cardholderName", cardholderName), + fun build(): SchemeFee = + SchemeFee( + checkRequired("amount", amount), + checkRequired("createdAt", createdAt), + checkRequired("currency", currency), + checkRequired("feeType", feeType), + checkRequired("fixedComponent", fixedComponent), + checkRequired("variableRate", variableRate), additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): Verification = apply { + fun validate(): SchemeFee = apply { if (validated) { return@apply } - cardVerificationCode().validate() - cardholderAddress().validate() - cardholderName().ifPresent { it.validate() } + amount() + createdAt() + currency().validate() + feeType().validate() + fixedComponent() + variableRate() validated = true } @@ -16381,148 +16393,116 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (cardVerificationCode.asKnown().getOrNull()?.validity() ?: 0) + - (cardholderAddress.asKnown().getOrNull()?.validity() ?: 0) + - (cardholderName.asKnown().getOrNull()?.validity() ?: 0) + (if (amount.asKnown().isPresent) 1 else 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (currency.asKnown().getOrNull()?.validity() ?: 0) + + (feeType.asKnown().getOrNull()?.validity() ?: 0) + + (if (fixedComponent.asKnown().isPresent) 1 else 0) + + (if (variableRate.asKnown().isPresent) 1 else 0) /** - * Fields related to verification of the Card Verification Code, a 3-digit code on - * the back of the card. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. */ - class CardVerificationCode - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val result: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("result") - @ExcludeMissing - result: JsonField = JsonMissing.of() - ) : this(result, mutableMapOf()) - - /** - * The result of verifying the Card Verification Code. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). - */ - fun result(): Result = result.getRequired("result") + class Currency + @JsonCreator + private constructor(private val value: JsonField) : Enum { /** - * Returns the raw JSON value of [result]. + * Returns this class instance's raw value. * - * Unlike [result], this method doesn't throw if the JSON field has an - * unexpected type. + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. */ - @JsonProperty("result") - @ExcludeMissing - fun _result(): JsonField = result - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value companion object { - /** - * Returns a mutable builder for constructing an instance of - * [CardVerificationCode]. - * - * The following fields are required: - * ```java - * .result() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CardVerificationCode]. */ - class Builder internal constructor() { - - private var result: JsonField? = null - private var additionalProperties: MutableMap = - mutableMapOf() + /** US Dollar (USD) */ + @JvmField val USD = of("USD") - @JvmSynthetic - internal fun from(cardVerificationCode: CardVerificationCode) = apply { - result = cardVerificationCode.result - additionalProperties = - cardVerificationCode.additionalProperties.toMutableMap() - } + @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) + } - /** The result of verifying the Card Verification Code. */ - fun result(result: Result) = result(JsonField.of(result)) + /** An enum containing [Currency]'s known values. */ + enum class Known { + /** US Dollar (USD) */ + USD + } + /** + * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Currency] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** US Dollar (USD) */ + USD, /** - * Sets [Builder.result] to an arbitrary JSON value. - * - * You should usually call [Builder.result] with a well-typed [Result] value - * instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * An enum member indicating that [Currency] was instantiated with an + * unknown value. */ - fun result(result: JsonField) = apply { this.result = result } - - fun additionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + _UNKNOWN, + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + USD -> Value.USD + else -> Value._UNKNOWN } - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + USD -> Known.USD + else -> throw IncreaseInvalidDataException("Unknown Currency: $value") } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") } - /** - * Returns an immutable instance of [CardVerificationCode]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .result() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CardVerificationCode = - CardVerificationCode( - checkRequired("result", result), - additionalProperties.toMutableMap(), - ) - } - private var validated: Boolean = false - fun validate(): CardVerificationCode = apply { + fun validate(): Currency = apply { if (validated) { return@apply } - result().validate() + known() validated = true } @@ -16541,537 +16521,730 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = (result.asKnown().getOrNull()?.validity() ?: 0) + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - /** The result of verifying the Card Verification Code. */ - class Result - @JsonCreator - private constructor(private val value: JsonField) : Enum { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Currency && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** The type of fee being assessed. */ + class FeeType + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY = + of("visa_international_service_assessment_single_currency") - companion object { + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY = + of("visa_international_service_assessment_cross_currency") - /** - * No card verification code was provided in the authorization request. - */ - @JvmField val NOT_CHECKED = of("not_checked") + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + @JvmField + val VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE = + of("visa_authorization_domestic_point_of_sale") - /** The card verification code matched the one on file. */ - @JvmField val MATCH = of("match") + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + @JvmField + val VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_international_point_of_sale") - /** The card verification code did not match the one on file. */ - @JvmField val NO_MATCH = of("no_match") + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + @JvmField + val VISA_AUTHORIZATION_CANADA_POINT_OF_SALE = + of("visa_authorization_canada_point_of_sale") - @JvmStatic fun of(value: String) = Result(JsonField.of(value)) - } + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + @JvmField + val VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE = + of("visa_authorization_reversal_point_of_sale") - /** An enum containing [Result]'s known values. */ - enum class Known { - /** - * No card verification code was provided in the authorization request. - */ - NOT_CHECKED, - /** The card verification code matched the one on file. */ - MATCH, - /** The card verification code did not match the one on file. */ - NO_MATCH, - } + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + @JvmField + val VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_reversal_international_point_of_sale") /** - * An enum containing [Result]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [Result] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. */ - enum class Value { - /** - * No card verification code was provided in the authorization request. - */ - NOT_CHECKED, - /** The card verification code matched the one on file. */ - MATCH, - /** The card verification code did not match the one on file. */ - NO_MATCH, - /** - * An enum member indicating that [Result] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } + @JvmField + val VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE = + of("visa_authorization_address_verification_service") /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). */ - fun value(): Value = - when (this) { - NOT_CHECKED -> Value.NOT_CHECKED - MATCH -> Value.MATCH - NO_MATCH -> Value.NO_MATCH - else -> Value._UNKNOWN - } + @JvmField + val VISA_ADVANCED_AUTHORIZATION = of("visa_advanced_authorization") /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. */ - fun known(): Known = - when (this) { - NOT_CHECKED -> Known.NOT_CHECKED - MATCH -> Known.MATCH - NO_MATCH -> Known.NO_MATCH - else -> throw IncreaseInvalidDataException("Unknown Result: $value") - } + @JvmField val VISA_MESSAGE_TRANSMISSION = of("visa_message_transmission") /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + @JvmField + val VISA_ACCOUNT_VERIFICATION_DOMESTIC = + of("visa_account_verification_domestic") - private var validated: Boolean = false + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_INTERNATIONAL = + of("visa_account_verification_international") - fun validate(): Result = apply { - if (validated) { - return@apply - } + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_CANADA = + of("visa_account_verification_canada") - known() - validated = true - } + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + @JvmField + val VISA_CORPORATE_ACCEPTANCE_FEE = of("visa_corporate_acceptance_fee") - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + @JvmField + val VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE = + of("visa_consumer_debit_acceptance_fee") /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + @JvmField + val VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE = + of("visa_business_debit_acceptance_fee") - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + @JvmField + val VISA_PURCHASING_ACCEPTANCE_FEE = of("visa_purchasing_acceptance_fee") - return other is Result && value == other.value - } + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + @JvmField val VISA_PURCHASE_DOMESTIC = of("visa_purchase_domestic") - override fun hashCode() = value.hashCode() + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + @JvmField + val VISA_PURCHASE_INTERNATIONAL = of("visa_purchase_international") - override fun toString() = value.toString() - } + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_CREDIT_PURCHASE_TOKEN = of("visa_credit_purchase_token") - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_DEBIT_PURCHASE_TOKEN = of("visa_debit_purchase_token") - return other is CardVerificationCode && - result == other.result && - additionalProperties == other.additionalProperties - } + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + @JvmField val VISA_CLEARING_TRANSMISSION = of("visa_clearing_transmission") - private val hashCode: Int by lazy { Objects.hash(result, additionalProperties) } + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + @JvmField val VISA_DIRECT_AUTHORIZATION = of("visa_direct_authorization") - override fun hashCode(): Int = hashCode + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + @JvmField + val VISA_DIRECT_TRANSACTION_DOMESTIC = + of("visa_direct_transaction_domestic") - override fun toString() = - "CardVerificationCode{result=$result, additionalProperties=$additionalProperties}" - } + /** Issuer card service fee for Commercial Credit cards. */ + @JvmField + val VISA_SERVICE_COMMERCIAL_CREDIT = of("visa_service_commercial_credit") - /** - * Cardholder address provided in the authorization request and the address on file - * we verified it against. - */ - class CardholderAddress - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val actualLine1: JsonField, - private val actualPostalCode: JsonField, - private val providedLine1: JsonField, - private val providedPostalCode: JsonField, - private val result: JsonField, - private val additionalProperties: MutableMap, - ) { + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + @JvmField + val VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT = + of("visa_advertising_service_commercial_credit") - @JsonCreator - private constructor( - @JsonProperty("actual_line1") - @ExcludeMissing - actualLine1: JsonField = JsonMissing.of(), - @JsonProperty("actual_postal_code") - @ExcludeMissing - actualPostalCode: JsonField = JsonMissing.of(), - @JsonProperty("provided_line1") - @ExcludeMissing - providedLine1: JsonField = JsonMissing.of(), - @JsonProperty("provided_postal_code") - @ExcludeMissing - providedPostalCode: JsonField = JsonMissing.of(), - @JsonProperty("result") - @ExcludeMissing - result: JsonField = JsonMissing.of(), - ) : this( - actualLine1, - actualPostalCode, - providedLine1, - providedPostalCode, - result, - mutableMapOf(), - ) + /** Issuer Community Growth Acceleration Program Fee. */ + @JvmField + val VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM = + of("visa_community_growth_acceleration_program") - /** - * Line 1 of the address on file for the cardholder. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun actualLine1(): Optional = actualLine1.getOptional("actual_line1") + /** Issuer Processing Guarantee for Commercial Credit cards. */ + @JvmField + val VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT = + of("visa_processing_guarantee_commercial_credit") - /** - * The postal code of the address on file for the cardholder. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun actualPostalCode(): Optional = - actualPostalCode.getOptional("actual_postal_code") + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + @JvmField val PULSE_SWITCH_FEE = of("pulse_switch_fee") - /** - * The cardholder address line 1 provided for verification in the authorization - * request. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun providedLine1(): Optional = - providedLine1.getOptional("provided_line1") + @JvmStatic fun of(value: String) = FeeType(JsonField.of(value)) + } - /** - * The postal code provided for verification in the authorization request. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun providedPostalCode(): Optional = - providedPostalCode.getOptional("provided_postal_code") - - /** - * The address verification result returned to the card network. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). - */ - fun result(): Result = result.getRequired("result") - - /** - * Returns the raw JSON value of [actualLine1]. - * - * Unlike [actualLine1], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("actual_line1") - @ExcludeMissing - fun _actualLine1(): JsonField = actualLine1 - - /** - * Returns the raw JSON value of [actualPostalCode]. - * - * Unlike [actualPostalCode], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("actual_postal_code") - @ExcludeMissing - fun _actualPostalCode(): JsonField = actualPostalCode - - /** - * Returns the raw JSON value of [providedLine1]. - * - * Unlike [providedLine1], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("provided_line1") - @ExcludeMissing - fun _providedLine1(): JsonField = providedLine1 - - /** - * Returns the raw JSON value of [providedPostalCode]. - * - * Unlike [providedPostalCode], this method doesn't throw if the JSON field has - * an unexpected type. - */ - @JsonProperty("provided_postal_code") - @ExcludeMissing - fun _providedPostalCode(): JsonField = providedPostalCode + /** An enum containing [FeeType]'s known values. */ + enum class Known { + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + VISA_ADVANCED_AUTHORIZATION, + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + VISA_MESSAGE_TRANSMISSION, + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_DOMESTIC, + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, + } /** - * Returns the raw JSON value of [result]. + * An enum containing [FeeType]'s known values, as well as an [_UNKNOWN] member. * - * Unlike [result], this method doesn't throw if the JSON field has an - * unexpected type. + * An instance of [FeeType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. */ - @JsonProperty("result") - @ExcludeMissing - fun _result(): JsonField = result - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - + enum class Value { /** - * Returns a mutable builder for constructing an instance of - * [CardholderAddress]. - * - * The following fields are required: - * ```java - * .actualLine1() - * .actualPostalCode() - * .providedLine1() - * .providedPostalCode() - * .result() - * ``` + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CardholderAddress]. */ - class Builder internal constructor() { - - private var actualLine1: JsonField? = null - private var actualPostalCode: JsonField? = null - private var providedLine1: JsonField? = null - private var providedPostalCode: JsonField? = null - private var result: JsonField? = null - private var additionalProperties: MutableMap = - mutableMapOf() - - @JvmSynthetic - internal fun from(cardholderAddress: CardholderAddress) = apply { - actualLine1 = cardholderAddress.actualLine1 - actualPostalCode = cardholderAddress.actualPostalCode - providedLine1 = cardholderAddress.providedLine1 - providedPostalCode = cardholderAddress.providedPostalCode - result = cardholderAddress.result - additionalProperties = - cardholderAddress.additionalProperties.toMutableMap() - } - - /** Line 1 of the address on file for the cardholder. */ - fun actualLine1(actualLine1: String?) = - actualLine1(JsonField.ofNullable(actualLine1)) - + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, /** - * Alias for calling [Builder.actualLine1] with `actualLine1.orElse(null)`. + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. */ - fun actualLine1(actualLine1: Optional) = - actualLine1(actualLine1.getOrNull()) - + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, /** - * Sets [Builder.actualLine1] to an arbitrary JSON value. - * - * You should usually call [Builder.actualLine1] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. */ - fun actualLine1(actualLine1: JsonField) = apply { - this.actualLine1 = actualLine1 - } - - /** The postal code of the address on file for the cardholder. */ - fun actualPostalCode(actualPostalCode: String?) = - actualPostalCode(JsonField.ofNullable(actualPostalCode)) - + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, /** - * Alias for calling [Builder.actualPostalCode] with - * `actualPostalCode.orElse(null)`. + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. */ - fun actualPostalCode(actualPostalCode: Optional) = - actualPostalCode(actualPostalCode.getOrNull()) - + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, /** - * Sets [Builder.actualPostalCode] to an arbitrary JSON value. - * - * You should usually call [Builder.actualPostalCode] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. */ - fun actualPostalCode(actualPostalCode: JsonField) = apply { - this.actualPostalCode = actualPostalCode - } - + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, /** - * The cardholder address line 1 provided for verification in the + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous * authorization request. */ - fun providedLine1(providedLine1: String?) = - providedLine1(JsonField.ofNullable(providedLine1)) - + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, /** - * Alias for calling [Builder.providedLine1] with - * `providedLine1.orElse(null)`. + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. */ - fun providedLine1(providedLine1: Optional) = - providedLine1(providedLine1.getOrNull()) - + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, /** - * Sets [Builder.providedLine1] to an arbitrary JSON value. - * - * You should usually call [Builder.providedLine1] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. */ - fun providedLine1(providedLine1: JsonField) = apply { - this.providedLine1 = providedLine1 - } - + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, /** - * The postal code provided for verification in the authorization request. + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). */ - fun providedPostalCode(providedPostalCode: String?) = - providedPostalCode(JsonField.ofNullable(providedPostalCode)) - + VISA_ADVANCED_AUTHORIZATION, /** - * Alias for calling [Builder.providedPostalCode] with - * `providedPostalCode.orElse(null)`. + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. */ - fun providedPostalCode(providedPostalCode: Optional) = - providedPostalCode(providedPostalCode.getOrNull()) - + VISA_MESSAGE_TRANSMISSION, /** - * Sets [Builder.providedPostalCode] to an arbitrary JSON value. - * - * You should usually call [Builder.providedPostalCode] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. */ - fun providedPostalCode(providedPostalCode: JsonField) = apply { - this.providedPostalCode = providedPostalCode - } - - /** The address verification result returned to the card network. */ - fun result(result: Result) = result(JsonField.of(result)) - + VISA_ACCOUNT_VERIFICATION_DOMESTIC, /** - * Sets [Builder.result] to an arbitrary JSON value. - * - * You should usually call [Builder.result] with a well-typed [Result] value - * instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. */ - fun result(result: JsonField) = apply { this.result = result } - - fun additionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, + /** + * An enum member indicating that [FeeType] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Value.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Value.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Value.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Value.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Value.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Value.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Value.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Value.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Value.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Value.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Value.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Value.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Value.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Value.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Value.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Value.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Value.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Value.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Value.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Value.PULSE_SWITCH_FEE + else -> Value._UNKNOWN } - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Known.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Known.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Known.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Known.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Known.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Known.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Known.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Known.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Known.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Known.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Known.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Known.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Known.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Known.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Known.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Known.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Known.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Known.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Known.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Known.PULSE_SWITCH_FEE + else -> throw IncreaseInvalidDataException("Unknown FeeType: $value") } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") } - /** - * Returns an immutable instance of [CardholderAddress]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .actualLine1() - * .actualPostalCode() - * .providedLine1() - * .providedPostalCode() - * .result() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CardholderAddress = - CardholderAddress( - checkRequired("actualLine1", actualLine1), - checkRequired("actualPostalCode", actualPostalCode), - checkRequired("providedLine1", providedLine1), - checkRequired("providedPostalCode", providedPostalCode), - checkRequired("result", result), - additionalProperties.toMutableMap(), - ) - } - private var validated: Boolean = false - fun validate(): CardholderAddress = apply { + fun validate(): FeeType = apply { if (validated) { return@apply } - actualLine1() - actualPostalCode() - providedLine1() - providedPostalCode() - result().validate() + known() validated = true } @@ -17090,462 +17263,533 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = - (if (actualLine1.asKnown().isPresent) 1 else 0) + - (if (actualPostalCode.asKnown().isPresent) 1 else 0) + - (if (providedLine1.asKnown().isPresent) 1 else 0) + - (if (providedPostalCode.asKnown().isPresent) 1 else 0) + - (result.asKnown().getOrNull()?.validity() ?: 0) + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - /** The address verification result returned to the card network. */ - class Result - @JsonCreator - private constructor(private val value: JsonField) : Enum { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + return other is FeeType && value == other.value + } - companion object { + override fun hashCode() = value.hashCode() - /** No address information was provided in the authorization request. */ - @JvmField val NOT_CHECKED = of("not_checked") + override fun toString() = value.toString() + } - /** - * Postal code matches, but the street address does not match or was not - * provided. - */ - @JvmField - val POSTAL_CODE_MATCH_ADDRESS_NO_MATCH = - of("postal_code_match_address_no_match") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Postal code does not match, but the street address matches or was not - * provided. - */ - @JvmField - val POSTAL_CODE_NO_MATCH_ADDRESS_MATCH = - of("postal_code_no_match_address_match") + return other is SchemeFee && + amount == other.amount && + createdAt == other.createdAt && + currency == other.currency && + feeType == other.feeType && + fixedComponent == other.fixedComponent && + variableRate == other.variableRate && + additionalProperties == other.additionalProperties + } - /** Postal code and street address match. */ - @JvmField val MATCH = of("match") + private val hashCode: Int by lazy { + Objects.hash( + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, + additionalProperties, + ) + } - /** Postal code and street address do not match. */ - @JvmField val NO_MATCH = of("no_match") + override fun hashCode(): Int = hashCode - /** - * Postal code matches, but the street address was not verified. - * (deprecated) - */ - @JvmField - val POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED = - of("postal_code_match_address_not_checked") + override fun toString() = + "SchemeFee{amount=$amount, createdAt=$createdAt, currency=$currency, feeType=$feeType, fixedComponent=$fixedComponent, variableRate=$variableRate, additionalProperties=$additionalProperties}" + } - @JvmStatic fun of(value: String) = Result(JsonField.of(value)) - } + /** + * A constant representing the object's type. For this resource it will always be + * `card_authorization`. + */ + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { - /** An enum containing [Result]'s known values. */ - enum class Known { - /** No address information was provided in the authorization request. */ - NOT_CHECKED, - /** - * Postal code matches, but the street address does not match or was not - * provided. - */ - POSTAL_CODE_MATCH_ADDRESS_NO_MATCH, - /** - * Postal code does not match, but the street address matches or was not - * provided. - */ - POSTAL_CODE_NO_MATCH_ADDRESS_MATCH, - /** Postal code and street address match. */ - MATCH, - /** Postal code and street address do not match. */ - NO_MATCH, - /** - * Postal code matches, but the street address was not verified. - * (deprecated) - */ - POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED, - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /** - * An enum containing [Result]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [Result] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** No address information was provided in the authorization request. */ - NOT_CHECKED, - /** - * Postal code matches, but the street address does not match or was not - * provided. - */ - POSTAL_CODE_MATCH_ADDRESS_NO_MATCH, - /** - * Postal code does not match, but the street address matches or was not - * provided. - */ - POSTAL_CODE_NO_MATCH_ADDRESS_MATCH, - /** Postal code and street address match. */ - MATCH, - /** Postal code and street address do not match. */ - NO_MATCH, - /** - * Postal code matches, but the street address was not verified. - * (deprecated) - */ - POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED, - /** - * An enum member indicating that [Result] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } + companion object { - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - NOT_CHECKED -> Value.NOT_CHECKED - POSTAL_CODE_MATCH_ADDRESS_NO_MATCH -> - Value.POSTAL_CODE_MATCH_ADDRESS_NO_MATCH - POSTAL_CODE_NO_MATCH_ADDRESS_MATCH -> - Value.POSTAL_CODE_NO_MATCH_ADDRESS_MATCH - MATCH -> Value.MATCH - NO_MATCH -> Value.NO_MATCH - POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED -> - Value.POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - NOT_CHECKED -> Known.NOT_CHECKED - POSTAL_CODE_MATCH_ADDRESS_NO_MATCH -> - Known.POSTAL_CODE_MATCH_ADDRESS_NO_MATCH - POSTAL_CODE_NO_MATCH_ADDRESS_MATCH -> - Known.POSTAL_CODE_NO_MATCH_ADDRESS_MATCH - MATCH -> Known.MATCH - NO_MATCH -> Known.NO_MATCH - POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED -> - Known.POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED - else -> throw IncreaseInvalidDataException("Unknown Result: $value") - } + @JvmField val CARD_AUTHORIZATION = of("card_authorization") - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } - private var validated: Boolean = false + /** An enum containing [Type]'s known values. */ + enum class Known { + CARD_AUTHORIZATION + } - fun validate(): Result = apply { - if (validated) { - return@apply - } + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + CARD_AUTHORIZATION, + /** + * An enum member indicating that [Type] was instantiated with an unknown value. + */ + _UNKNOWN, + } - known() - validated = true - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + CARD_AUTHORIZATION -> Value.CARD_AUTHORIZATION + else -> Value._UNKNOWN + } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + CARD_AUTHORIZATION -> Known.CARD_AUTHORIZATION + else -> throw IncreaseInvalidDataException("Unknown Type: $value") + } - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + private var validated: Boolean = false - return other is Result && value == other.value - } + fun validate(): Type = apply { + if (validated) { + return@apply + } - override fun hashCode() = value.hashCode() + known() + validated = true + } - override fun toString() = value.toString() + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - return other is CardholderAddress && - actualLine1 == other.actualLine1 && - actualPostalCode == other.actualPostalCode && - providedLine1 == other.providedLine1 && - providedPostalCode == other.providedPostalCode && - result == other.result && - additionalProperties == other.additionalProperties + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - private val hashCode: Int by lazy { - Objects.hash( - actualLine1, - actualPostalCode, - providedLine1, - providedPostalCode, - result, - additionalProperties, - ) - } + return other is Type && value == other.value + } - override fun hashCode(): Int = hashCode + override fun hashCode() = value.hashCode() - override fun toString() = - "CardholderAddress{actualLine1=$actualLine1, actualPostalCode=$actualPostalCode, providedLine1=$providedLine1, providedPostalCode=$providedPostalCode, result=$result, additionalProperties=$additionalProperties}" - } + override fun toString() = value.toString() + } - /** Cardholder name provided in the authorization request. */ - class CardholderName - @JsonCreator(mode = JsonCreator.Mode.DISABLED) + /** Fields related to verification of cardholder-provided values. */ + class Verification + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val cardVerificationCode: JsonField, + private val cardholderAddress: JsonField, + private val cardholderName: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator private constructor( - private val providedFirstName: JsonField, - private val providedLastName: JsonField, - private val providedMiddleName: JsonField, - private val additionalProperties: MutableMap, - ) { + @JsonProperty("card_verification_code") + @ExcludeMissing + cardVerificationCode: JsonField = JsonMissing.of(), + @JsonProperty("cardholder_address") + @ExcludeMissing + cardholderAddress: JsonField = JsonMissing.of(), + @JsonProperty("cardholder_name") + @ExcludeMissing + cardholderName: JsonField = JsonMissing.of(), + ) : this(cardVerificationCode, cardholderAddress, cardholderName, mutableMapOf()) - @JsonCreator - private constructor( - @JsonProperty("provided_first_name") - @ExcludeMissing - providedFirstName: JsonField = JsonMissing.of(), - @JsonProperty("provided_last_name") - @ExcludeMissing - providedLastName: JsonField = JsonMissing.of(), - @JsonProperty("provided_middle_name") - @ExcludeMissing - providedMiddleName: JsonField = JsonMissing.of(), - ) : this( - providedFirstName, - providedLastName, - providedMiddleName, - mutableMapOf(), - ) + /** + * Fields related to verification of the Card Verification Code, a 3-digit code on + * the back of the card. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun cardVerificationCode(): CardVerificationCode = + cardVerificationCode.getRequired("card_verification_code") + + /** + * Cardholder address provided in the authorization request and the address on file + * we verified it against. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun cardholderAddress(): CardholderAddress = + cardholderAddress.getRequired("cardholder_address") + + /** + * Cardholder name provided in the authorization request. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun cardholderName(): Optional = + cardholderName.getOptional("cardholder_name") + + /** + * Returns the raw JSON value of [cardVerificationCode]. + * + * Unlike [cardVerificationCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("card_verification_code") + @ExcludeMissing + fun _cardVerificationCode(): JsonField = cardVerificationCode + + /** + * Returns the raw JSON value of [cardholderAddress]. + * + * Unlike [cardholderAddress], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("cardholder_address") + @ExcludeMissing + fun _cardholderAddress(): JsonField = cardholderAddress + + /** + * Returns the raw JSON value of [cardholderName]. + * + * Unlike [cardholderName], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("cardholder_name") + @ExcludeMissing + fun _cardholderName(): JsonField = cardholderName + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { /** - * The first name provided for verification in the authorization request. + * Returns a mutable builder for constructing an instance of [Verification]. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * The following fields are required: + * ```java + * .cardVerificationCode() + * .cardholderAddress() + * .cardholderName() + * ``` */ - fun providedFirstName(): Optional = - providedFirstName.getOptional("provided_first_name") + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Verification]. */ + class Builder internal constructor() { + + private var cardVerificationCode: JsonField? = null + private var cardholderAddress: JsonField? = null + private var cardholderName: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(verification: Verification) = apply { + cardVerificationCode = verification.cardVerificationCode + cardholderAddress = verification.cardholderAddress + cardholderName = verification.cardholderName + additionalProperties = verification.additionalProperties.toMutableMap() + } /** - * The last name provided for verification in the authorization request. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * Fields related to verification of the Card Verification Code, a 3-digit code + * on the back of the card. */ - fun providedLastName(): Optional = - providedLastName.getOptional("provided_last_name") + fun cardVerificationCode(cardVerificationCode: CardVerificationCode) = + cardVerificationCode(JsonField.of(cardVerificationCode)) /** - * The middle name provided for verification in the authorization request. + * Sets [Builder.cardVerificationCode] to an arbitrary JSON value. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * You should usually call [Builder.cardVerificationCode] with a well-typed + * [CardVerificationCode] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. */ - fun providedMiddleName(): Optional = - providedMiddleName.getOptional("provided_middle_name") + fun cardVerificationCode( + cardVerificationCode: JsonField + ) = apply { this.cardVerificationCode = cardVerificationCode } /** - * Returns the raw JSON value of [providedFirstName]. - * - * Unlike [providedFirstName], this method doesn't throw if the JSON field has - * an unexpected type. + * Cardholder address provided in the authorization request and the address on + * file we verified it against. */ - @JsonProperty("provided_first_name") - @ExcludeMissing - fun _providedFirstName(): JsonField = providedFirstName + fun cardholderAddress(cardholderAddress: CardholderAddress) = + cardholderAddress(JsonField.of(cardholderAddress)) /** - * Returns the raw JSON value of [providedLastName]. + * Sets [Builder.cardholderAddress] to an arbitrary JSON value. * - * Unlike [providedLastName], this method doesn't throw if the JSON field has an - * unexpected type. + * You should usually call [Builder.cardholderAddress] with a well-typed + * [CardholderAddress] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - @JsonProperty("provided_last_name") - @ExcludeMissing - fun _providedLastName(): JsonField = providedLastName + fun cardholderAddress(cardholderAddress: JsonField) = apply { + this.cardholderAddress = cardholderAddress + } + + /** Cardholder name provided in the authorization request. */ + fun cardholderName(cardholderName: CardholderName?) = + cardholderName(JsonField.ofNullable(cardholderName)) /** - * Returns the raw JSON value of [providedMiddleName]. + * Alias for calling [Builder.cardholderName] with + * `cardholderName.orElse(null)`. + */ + fun cardholderName(cardholderName: Optional) = + cardholderName(cardholderName.getOrNull()) + + /** + * Sets [Builder.cardholderName] to an arbitrary JSON value. * - * Unlike [providedMiddleName], this method doesn't throw if the JSON field has - * an unexpected type. + * You should usually call [Builder.cardholderName] with a well-typed + * [CardholderName] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - @JsonProperty("provided_middle_name") - @ExcludeMissing - fun _providedMiddleName(): JsonField = providedMiddleName + fun cardholderName(cardholderName: JsonField) = apply { + this.cardholderName = cardholderName + } - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun toBuilder() = Builder().from(this) + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - companion object { + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * Returns a mutable builder for constructing an instance of - * [CardholderName]. - * - * The following fields are required: - * ```java - * .providedFirstName() - * .providedLastName() - * .providedMiddleName() - * ``` - */ - @JvmStatic fun builder() = Builder() + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } - /** A builder for [CardholderName]. */ - class Builder internal constructor() { + /** + * Returns an immutable instance of [Verification]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .cardVerificationCode() + * .cardholderAddress() + * .cardholderName() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Verification = + Verification( + checkRequired("cardVerificationCode", cardVerificationCode), + checkRequired("cardholderAddress", cardholderAddress), + checkRequired("cardholderName", cardholderName), + additionalProperties.toMutableMap(), + ) + } - private var providedFirstName: JsonField? = null - private var providedLastName: JsonField? = null - private var providedMiddleName: JsonField? = null - private var additionalProperties: MutableMap = - mutableMapOf() + private var validated: Boolean = false - @JvmSynthetic - internal fun from(cardholderName: CardholderName) = apply { - providedFirstName = cardholderName.providedFirstName - providedLastName = cardholderName.providedLastName - providedMiddleName = cardholderName.providedMiddleName - additionalProperties = - cardholderName.additionalProperties.toMutableMap() - } + fun validate(): Verification = apply { + if (validated) { + return@apply + } - /** - * The first name provided for verification in the authorization request. - */ - fun providedFirstName(providedFirstName: String?) = - providedFirstName(JsonField.ofNullable(providedFirstName)) + cardVerificationCode().validate() + cardholderAddress().validate() + cardholderName().ifPresent { it.validate() } + validated = true + } - /** - * Alias for calling [Builder.providedFirstName] with - * `providedFirstName.orElse(null)`. - */ - fun providedFirstName(providedFirstName: Optional) = - providedFirstName(providedFirstName.getOrNull()) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * Sets [Builder.providedFirstName] to an arbitrary JSON value. - * - * You should usually call [Builder.providedFirstName] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun providedFirstName(providedFirstName: JsonField) = apply { - this.providedFirstName = providedFirstName - } + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (cardVerificationCode.asKnown().getOrNull()?.validity() ?: 0) + + (cardholderAddress.asKnown().getOrNull()?.validity() ?: 0) + + (cardholderName.asKnown().getOrNull()?.validity() ?: 0) - /** The last name provided for verification in the authorization request. */ - fun providedLastName(providedLastName: String?) = - providedLastName(JsonField.ofNullable(providedLastName)) + /** + * Fields related to verification of the Card Verification Code, a 3-digit code on + * the back of the card. + */ + class CardVerificationCode + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val result: JsonField, + private val additionalProperties: MutableMap, + ) { - /** - * Alias for calling [Builder.providedLastName] with - * `providedLastName.orElse(null)`. - */ - fun providedLastName(providedLastName: Optional) = - providedLastName(providedLastName.getOrNull()) + @JsonCreator + private constructor( + @JsonProperty("result") + @ExcludeMissing + result: JsonField = JsonMissing.of() + ) : this(result, mutableMapOf()) + + /** + * The result of verifying the Card Verification Code. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun result(): Result = result.getRequired("result") + + /** + * Returns the raw JSON value of [result]. + * + * Unlike [result], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("result") + @ExcludeMissing + fun _result(): JsonField = result + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { /** - * Sets [Builder.providedLastName] to an arbitrary JSON value. + * Returns a mutable builder for constructing an instance of + * [CardVerificationCode]. * - * You should usually call [Builder.providedLastName] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * The following fields are required: + * ```java + * .result() + * ``` */ - fun providedLastName(providedLastName: JsonField) = apply { - this.providedLastName = providedLastName - } + @JvmStatic fun builder() = Builder() + } - /** - * The middle name provided for verification in the authorization request. - */ - fun providedMiddleName(providedMiddleName: String?) = - providedMiddleName(JsonField.ofNullable(providedMiddleName)) + /** A builder for [CardVerificationCode]. */ + class Builder internal constructor() { - /** - * Alias for calling [Builder.providedMiddleName] with - * `providedMiddleName.orElse(null)`. - */ - fun providedMiddleName(providedMiddleName: Optional) = - providedMiddleName(providedMiddleName.getOrNull()) + private var result: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(cardVerificationCode: CardVerificationCode) = apply { + result = cardVerificationCode.result + additionalProperties = + cardVerificationCode.additionalProperties.toMutableMap() + } + + /** The result of verifying the Card Verification Code. */ + fun result(result: Result) = result(JsonField.of(result)) /** - * Sets [Builder.providedMiddleName] to an arbitrary JSON value. + * Sets [Builder.result] to an arbitrary JSON value. * - * You should usually call [Builder.providedMiddleName] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * You should usually call [Builder.result] with a well-typed [Result] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ - fun providedMiddleName(providedMiddleName: JsonField) = apply { - this.providedMiddleName = providedMiddleName - } + fun result(result: JsonField) = apply { this.result = result } fun additionalProperties(additionalProperties: Map) = apply { @@ -17570,38 +17814,32 @@ private constructor( } /** - * Returns an immutable instance of [CardholderName]. + * Returns an immutable instance of [CardVerificationCode]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .providedFirstName() - * .providedLastName() - * .providedMiddleName() + * .result() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): CardholderName = - CardholderName( - checkRequired("providedFirstName", providedFirstName), - checkRequired("providedLastName", providedLastName), - checkRequired("providedMiddleName", providedMiddleName), + fun build(): CardVerificationCode = + CardVerificationCode( + checkRequired("result", result), additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): CardholderName = apply { + fun validate(): CardVerificationCode = apply { if (validated) { return@apply } - providedFirstName() - providedLastName() - providedMiddleName() + result().validate() validated = true } @@ -17620,922 +17858,1142 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = - (if (providedFirstName.asKnown().isPresent) 1 else 0) + - (if (providedLastName.asKnown().isPresent) 1 else 0) + - (if (providedMiddleName.asKnown().isPresent) 1 else 0) + internal fun validity(): Int = (result.asKnown().getOrNull()?.validity() ?: 0) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** The result of verifying the Card Verification Code. */ + class Result + @JsonCreator + private constructor(private val value: JsonField) : Enum { - return other is CardholderName && - providedFirstName == other.providedFirstName && - providedLastName == other.providedLastName && - providedMiddleName == other.providedMiddleName && - additionalProperties == other.additionalProperties - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - private val hashCode: Int by lazy { - Objects.hash( - providedFirstName, - providedLastName, - providedMiddleName, - additionalProperties, - ) - } + companion object { - override fun hashCode(): Int = hashCode + /** + * No card verification code was provided in the authorization request. + */ + @JvmField val NOT_CHECKED = of("not_checked") - override fun toString() = - "CardholderName{providedFirstName=$providedFirstName, providedLastName=$providedLastName, providedMiddleName=$providedMiddleName, additionalProperties=$additionalProperties}" - } + /** The card verification code matched the one on file. */ + @JvmField val MATCH = of("match") - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** The card verification code did not match the one on file. */ + @JvmField val NO_MATCH = of("no_match") - return other is Verification && - cardVerificationCode == other.cardVerificationCode && - cardholderAddress == other.cardholderAddress && - cardholderName == other.cardholderName && - additionalProperties == other.additionalProperties - } + @JvmStatic fun of(value: String) = Result(JsonField.of(value)) + } - private val hashCode: Int by lazy { - Objects.hash( - cardVerificationCode, - cardholderAddress, - cardholderName, - additionalProperties, - ) - } + /** An enum containing [Result]'s known values. */ + enum class Known { + /** + * No card verification code was provided in the authorization request. + */ + NOT_CHECKED, + /** The card verification code matched the one on file. */ + MATCH, + /** The card verification code did not match the one on file. */ + NO_MATCH, + } - override fun hashCode(): Int = hashCode + /** + * An enum containing [Result]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Result] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** + * No card verification code was provided in the authorization request. + */ + NOT_CHECKED, + /** The card verification code matched the one on file. */ + MATCH, + /** The card verification code did not match the one on file. */ + NO_MATCH, + /** + * An enum member indicating that [Result] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - override fun toString() = - "Verification{cardVerificationCode=$cardVerificationCode, cardholderAddress=$cardholderAddress, cardholderName=$cardholderName, additionalProperties=$additionalProperties}" - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NOT_CHECKED -> Value.NOT_CHECKED + MATCH -> Value.MATCH + NO_MATCH -> Value.NO_MATCH + else -> Value._UNKNOWN + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + NOT_CHECKED -> Known.NOT_CHECKED + MATCH -> Known.MATCH + NO_MATCH -> Known.NO_MATCH + else -> throw IncreaseInvalidDataException("Unknown Result: $value") + } - return other is CardAuthorization && - id == other.id && - actioner == other.actioner && - additionalAmounts == other.additionalAmounts && - amount == other.amount && - cardPaymentId == other.cardPaymentId && - currency == other.currency && - digitalWalletTokenId == other.digitalWalletTokenId && - direction == other.direction && - expiresAt == other.expiresAt && - merchantAcceptorId == other.merchantAcceptorId && - merchantCategoryCode == other.merchantCategoryCode && - merchantCity == other.merchantCity && - merchantCountry == other.merchantCountry && - merchantDescriptor == other.merchantDescriptor && - merchantPostalCode == other.merchantPostalCode && - merchantState == other.merchantState && - networkDetails == other.networkDetails && - networkIdentifiers == other.networkIdentifiers && - networkRiskScore == other.networkRiskScore && - pendingTransactionId == other.pendingTransactionId && - physicalCardId == other.physicalCardId && - presentmentAmount == other.presentmentAmount && - presentmentCurrency == other.presentmentCurrency && - processingCategory == other.processingCategory && - realTimeDecisionId == other.realTimeDecisionId && - terminalId == other.terminalId && - type == other.type && - verification == other.verification && - additionalProperties == other.additionalProperties - } + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - private val hashCode: Int by lazy { - Objects.hash( - id, - actioner, - additionalAmounts, - amount, - cardPaymentId, - currency, - digitalWalletTokenId, - direction, - expiresAt, - merchantAcceptorId, - merchantCategoryCode, - merchantCity, - merchantCountry, - merchantDescriptor, - merchantPostalCode, - merchantState, - networkDetails, - networkIdentifiers, - networkRiskScore, - pendingTransactionId, - physicalCardId, - presentmentAmount, - presentmentCurrency, - processingCategory, - realTimeDecisionId, - terminalId, - type, - verification, - additionalProperties, - ) - } + private var validated: Boolean = false - override fun hashCode(): Int = hashCode + fun validate(): Result = apply { + if (validated) { + return@apply + } - override fun toString() = - "CardAuthorization{id=$id, actioner=$actioner, additionalAmounts=$additionalAmounts, amount=$amount, cardPaymentId=$cardPaymentId, currency=$currency, digitalWalletTokenId=$digitalWalletTokenId, direction=$direction, expiresAt=$expiresAt, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkDetails=$networkDetails, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, pendingTransactionId=$pendingTransactionId, physicalCardId=$physicalCardId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, processingCategory=$processingCategory, realTimeDecisionId=$realTimeDecisionId, terminalId=$terminalId, type=$type, verification=$verification, additionalProperties=$additionalProperties}" - } + known() + validated = true + } - /** - * A Card Authorization Expiration object. This field will be present in the JSON response - * if and only if `category` is equal to `card_authorization_expiration`. Card Authorization - * Expirations are cancellations of authorizations that were never settled by the acquirer. - */ - class CardAuthorizationExpiration - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val id: JsonField, - private val cardAuthorizationId: JsonField, - private val currency: JsonField, - private val expiredAmount: JsonField, - private val network: JsonField, - private val type: JsonField, - private val additionalProperties: MutableMap, - ) { + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("card_authorization_id") - @ExcludeMissing - cardAuthorizationId: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - currency: JsonField = JsonMissing.of(), - @JsonProperty("expired_amount") - @ExcludeMissing - expiredAmount: JsonField = JsonMissing.of(), - @JsonProperty("network") - @ExcludeMissing - network: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - ) : this( - id, - cardAuthorizationId, - currency, - expiredAmount, - network, - type, - mutableMapOf(), - ) + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - /** - * The Card Authorization Expiration identifier. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun id(): String = id.getRequired("id") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * The identifier for the Card Authorization this reverses. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun cardAuthorizationId(): String = - cardAuthorizationId.getRequired("card_authorization_id") + return other is Result && value == other.value + } - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the reversal's - * currency. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun currency(): Currency = currency.getRequired("currency") + override fun hashCode() = value.hashCode() - /** - * The amount of this authorization expiration in the minor unit of the transaction's - * currency. For dollars, for example, this is cents. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun expiredAmount(): Long = expiredAmount.getRequired("expired_amount") + override fun toString() = value.toString() + } - /** - * The card network used to process this card authorization. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun network(): Network = network.getRequired("network") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * A constant representing the object's type. For this resource it will always be - * `card_authorization_expiration`. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun type(): Type = type.getRequired("type") + return other is CardVerificationCode && + result == other.result && + additionalProperties == other.additionalProperties + } - /** - * Returns the raw JSON value of [id]. - * - * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + private val hashCode: Int by lazy { Objects.hash(result, additionalProperties) } - /** - * Returns the raw JSON value of [cardAuthorizationId]. - * - * Unlike [cardAuthorizationId], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("card_authorization_id") - @ExcludeMissing - fun _cardAuthorizationId(): JsonField = cardAuthorizationId + override fun hashCode(): Int = hashCode - /** - * Returns the raw JSON value of [currency]. - * - * Unlike [currency], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("currency") - @ExcludeMissing - fun _currency(): JsonField = currency + override fun toString() = + "CardVerificationCode{result=$result, additionalProperties=$additionalProperties}" + } - /** - * Returns the raw JSON value of [expiredAmount]. - * - * Unlike [expiredAmount], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("expired_amount") - @ExcludeMissing - fun _expiredAmount(): JsonField = expiredAmount + /** + * Cardholder address provided in the authorization request and the address on file + * we verified it against. + */ + class CardholderAddress + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val actualLine1: JsonField, + private val actualPostalCode: JsonField, + private val providedLine1: JsonField, + private val providedPostalCode: JsonField, + private val result: JsonField, + private val additionalProperties: MutableMap, + ) { - /** - * Returns the raw JSON value of [network]. - * - * Unlike [network], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("network") @ExcludeMissing fun _network(): JsonField = network + @JsonCreator + private constructor( + @JsonProperty("actual_line1") + @ExcludeMissing + actualLine1: JsonField = JsonMissing.of(), + @JsonProperty("actual_postal_code") + @ExcludeMissing + actualPostalCode: JsonField = JsonMissing.of(), + @JsonProperty("provided_line1") + @ExcludeMissing + providedLine1: JsonField = JsonMissing.of(), + @JsonProperty("provided_postal_code") + @ExcludeMissing + providedPostalCode: JsonField = JsonMissing.of(), + @JsonProperty("result") + @ExcludeMissing + result: JsonField = JsonMissing.of(), + ) : this( + actualLine1, + actualPostalCode, + providedLine1, + providedPostalCode, + result, + mutableMapOf(), + ) - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + /** + * Line 1 of the address on file for the cardholder. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun actualLine1(): Optional = actualLine1.getOptional("actual_line1") - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** + * The postal code of the address on file for the cardholder. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun actualPostalCode(): Optional = + actualPostalCode.getOptional("actual_postal_code") - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** + * The cardholder address line 1 provided for verification in the authorization + * request. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun providedLine1(): Optional = + providedLine1.getOptional("provided_line1") - fun toBuilder() = Builder().from(this) + /** + * The postal code provided for verification in the authorization request. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun providedPostalCode(): Optional = + providedPostalCode.getOptional("provided_postal_code") - companion object { + /** + * The address verification result returned to the card network. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun result(): Result = result.getRequired("result") - /** - * Returns a mutable builder for constructing an instance of - * [CardAuthorizationExpiration]. - * - * The following fields are required: - * ```java - * .id() - * .cardAuthorizationId() - * .currency() - * .expiredAmount() - * .network() - * .type() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + /** + * Returns the raw JSON value of [actualLine1]. + * + * Unlike [actualLine1], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("actual_line1") + @ExcludeMissing + fun _actualLine1(): JsonField = actualLine1 - /** A builder for [CardAuthorizationExpiration]. */ - class Builder internal constructor() { + /** + * Returns the raw JSON value of [actualPostalCode]. + * + * Unlike [actualPostalCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("actual_postal_code") + @ExcludeMissing + fun _actualPostalCode(): JsonField = actualPostalCode - private var id: JsonField? = null - private var cardAuthorizationId: JsonField? = null - private var currency: JsonField? = null - private var expiredAmount: JsonField? = null - private var network: JsonField? = null - private var type: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** + * Returns the raw JSON value of [providedLine1]. + * + * Unlike [providedLine1], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("provided_line1") + @ExcludeMissing + fun _providedLine1(): JsonField = providedLine1 - @JvmSynthetic - internal fun from(cardAuthorizationExpiration: CardAuthorizationExpiration) = - apply { - id = cardAuthorizationExpiration.id - cardAuthorizationId = cardAuthorizationExpiration.cardAuthorizationId - currency = cardAuthorizationExpiration.currency - expiredAmount = cardAuthorizationExpiration.expiredAmount - network = cardAuthorizationExpiration.network - type = cardAuthorizationExpiration.type - additionalProperties = - cardAuthorizationExpiration.additionalProperties.toMutableMap() + /** + * Returns the raw JSON value of [providedPostalCode]. + * + * Unlike [providedPostalCode], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("provided_postal_code") + @ExcludeMissing + fun _providedPostalCode(): JsonField = providedPostalCode + + /** + * Returns the raw JSON value of [result]. + * + * Unlike [result], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("result") + @ExcludeMissing + fun _result(): JsonField = result + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) } - /** The Card Authorization Expiration identifier. */ - fun id(id: String) = id(JsonField.of(id)) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** - * Sets [Builder.id] to an arbitrary JSON value. - * - * You should usually call [Builder.id] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun id(id: JsonField) = apply { this.id = id } + fun toBuilder() = Builder().from(this) - /** The identifier for the Card Authorization this reverses. */ - fun cardAuthorizationId(cardAuthorizationId: String) = - cardAuthorizationId(JsonField.of(cardAuthorizationId)) + companion object { - /** - * Sets [Builder.cardAuthorizationId] to an arbitrary JSON value. - * - * You should usually call [Builder.cardAuthorizationId] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun cardAuthorizationId(cardAuthorizationId: JsonField) = apply { - this.cardAuthorizationId = cardAuthorizationId - } + /** + * Returns a mutable builder for constructing an instance of + * [CardholderAddress]. + * + * The following fields are required: + * ```java + * .actualLine1() + * .actualPostalCode() + * .providedLine1() + * .providedPostalCode() + * .result() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the reversal's - * currency. - */ - fun currency(currency: Currency) = currency(JsonField.of(currency)) + /** A builder for [CardholderAddress]. */ + class Builder internal constructor() { - /** - * Sets [Builder.currency] to an arbitrary JSON value. - * - * You should usually call [Builder.currency] with a well-typed [Currency] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun currency(currency: JsonField) = apply { this.currency = currency } + private var actualLine1: JsonField? = null + private var actualPostalCode: JsonField? = null + private var providedLine1: JsonField? = null + private var providedPostalCode: JsonField? = null + private var result: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() - /** - * The amount of this authorization expiration in the minor unit of the - * transaction's currency. For dollars, for example, this is cents. - */ - fun expiredAmount(expiredAmount: Long) = expiredAmount(JsonField.of(expiredAmount)) + @JvmSynthetic + internal fun from(cardholderAddress: CardholderAddress) = apply { + actualLine1 = cardholderAddress.actualLine1 + actualPostalCode = cardholderAddress.actualPostalCode + providedLine1 = cardholderAddress.providedLine1 + providedPostalCode = cardholderAddress.providedPostalCode + result = cardholderAddress.result + additionalProperties = + cardholderAddress.additionalProperties.toMutableMap() + } - /** - * Sets [Builder.expiredAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.expiredAmount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun expiredAmount(expiredAmount: JsonField) = apply { - this.expiredAmount = expiredAmount - } + /** Line 1 of the address on file for the cardholder. */ + fun actualLine1(actualLine1: String?) = + actualLine1(JsonField.ofNullable(actualLine1)) - /** The card network used to process this card authorization. */ - fun network(network: Network) = network(JsonField.of(network)) + /** + * Alias for calling [Builder.actualLine1] with `actualLine1.orElse(null)`. + */ + fun actualLine1(actualLine1: Optional) = + actualLine1(actualLine1.getOrNull()) - /** - * Sets [Builder.network] to an arbitrary JSON value. - * - * You should usually call [Builder.network] with a well-typed [Network] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun network(network: JsonField) = apply { this.network = network } + /** + * Sets [Builder.actualLine1] to an arbitrary JSON value. + * + * You should usually call [Builder.actualLine1] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun actualLine1(actualLine1: JsonField) = apply { + this.actualLine1 = actualLine1 + } - /** - * A constant representing the object's type. For this resource it will always be - * `card_authorization_expiration`. - */ - fun type(type: Type) = type(JsonField.of(type)) + /** The postal code of the address on file for the cardholder. */ + fun actualPostalCode(actualPostalCode: String?) = + actualPostalCode(JsonField.ofNullable(actualPostalCode)) - /** - * Sets [Builder.type] to an arbitrary JSON value. - * - * You should usually call [Builder.type] with a well-typed [Type] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun type(type: JsonField) = apply { this.type = type } + /** + * Alias for calling [Builder.actualPostalCode] with + * `actualPostalCode.orElse(null)`. + */ + fun actualPostalCode(actualPostalCode: Optional) = + actualPostalCode(actualPostalCode.getOrNull()) - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** + * Sets [Builder.actualPostalCode] to an arbitrary JSON value. + * + * You should usually call [Builder.actualPostalCode] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun actualPostalCode(actualPostalCode: JsonField) = apply { + this.actualPostalCode = actualPostalCode + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** + * The cardholder address line 1 provided for verification in the + * authorization request. + */ + fun providedLine1(providedLine1: String?) = + providedLine1(JsonField.ofNullable(providedLine1)) - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + /** + * Alias for calling [Builder.providedLine1] with + * `providedLine1.orElse(null)`. + */ + fun providedLine1(providedLine1: Optional) = + providedLine1(providedLine1.getOrNull()) - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** + * Sets [Builder.providedLine1] to an arbitrary JSON value. + * + * You should usually call [Builder.providedLine1] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun providedLine1(providedLine1: JsonField) = apply { + this.providedLine1 = providedLine1 + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** + * The postal code provided for verification in the authorization request. + */ + fun providedPostalCode(providedPostalCode: String?) = + providedPostalCode(JsonField.ofNullable(providedPostalCode)) - /** - * Returns an immutable instance of [CardAuthorizationExpiration]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .cardAuthorizationId() - * .currency() - * .expiredAmount() - * .network() - * .type() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CardAuthorizationExpiration = - CardAuthorizationExpiration( - checkRequired("id", id), - checkRequired("cardAuthorizationId", cardAuthorizationId), - checkRequired("currency", currency), - checkRequired("expiredAmount", expiredAmount), - checkRequired("network", network), - checkRequired("type", type), - additionalProperties.toMutableMap(), - ) - } + /** + * Alias for calling [Builder.providedPostalCode] with + * `providedPostalCode.orElse(null)`. + */ + fun providedPostalCode(providedPostalCode: Optional) = + providedPostalCode(providedPostalCode.getOrNull()) - private var validated: Boolean = false + /** + * Sets [Builder.providedPostalCode] to an arbitrary JSON value. + * + * You should usually call [Builder.providedPostalCode] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun providedPostalCode(providedPostalCode: JsonField) = apply { + this.providedPostalCode = providedPostalCode + } - fun validate(): CardAuthorizationExpiration = apply { - if (validated) { - return@apply - } + /** The address verification result returned to the card network. */ + fun result(result: Result) = result(JsonField.of(result)) - id() - cardAuthorizationId() - currency().validate() - expiredAmount() - network().validate() - type().validate() - validated = true - } + /** + * Sets [Builder.result] to an arbitrary JSON value. + * + * You should usually call [Builder.result] with a well-typed [Result] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun result(result: JsonField) = apply { this.result = result } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (id.asKnown().isPresent) 1 else 0) + - (if (cardAuthorizationId.asKnown().isPresent) 1 else 0) + - (currency.asKnown().getOrNull()?.validity() ?: 0) + - (if (expiredAmount.asKnown().isPresent) 1 else 0) + - (network.asKnown().getOrNull()?.validity() ?: 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the reversal's - * currency. - */ - class Currency @JsonCreator private constructor(private val value: JsonField) : - Enum { + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - companion object { + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** US Dollar (USD) */ - @JvmField val USD = of("USD") + /** + * Returns an immutable instance of [CardholderAddress]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .actualLine1() + * .actualPostalCode() + * .providedLine1() + * .providedPostalCode() + * .result() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CardholderAddress = + CardholderAddress( + checkRequired("actualLine1", actualLine1), + checkRequired("actualPostalCode", actualPostalCode), + checkRequired("providedLine1", providedLine1), + checkRequired("providedPostalCode", providedPostalCode), + checkRequired("result", result), + additionalProperties.toMutableMap(), + ) + } - @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) - } + private var validated: Boolean = false - /** An enum containing [Currency]'s known values. */ - enum class Known { - /** US Dollar (USD) */ - USD - } + fun validate(): CardholderAddress = apply { + if (validated) { + return@apply + } + + actualLine1() + actualPostalCode() + providedLine1() + providedPostalCode() + result().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Currency] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** US Dollar (USD) */ - USD, /** - * An enum member indicating that [Currency] was instantiated with an unknown - * value. + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. */ - _UNKNOWN, - } + @JvmSynthetic + internal fun validity(): Int = + (if (actualLine1.asKnown().isPresent) 1 else 0) + + (if (actualPostalCode.asKnown().isPresent) 1 else 0) + + (if (providedLine1.asKnown().isPresent) 1 else 0) + + (if (providedPostalCode.asKnown().isPresent) 1 else 0) + + (result.asKnown().getOrNull()?.validity() ?: 0) - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USD -> Value.USD - else -> Value._UNKNOWN - } + /** The address verification result returned to the card network. */ + class Result + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - USD -> Known.USD - else -> throw IncreaseInvalidDataException("Unknown Currency: $value") - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + companion object { - private var validated: Boolean = false + /** No address information was provided in the authorization request. */ + @JvmField val NOT_CHECKED = of("not_checked") - fun validate(): Currency = apply { - if (validated) { - return@apply - } + /** + * Postal code matches, but the street address does not match or was not + * provided. + */ + @JvmField + val POSTAL_CODE_MATCH_ADDRESS_NO_MATCH = + of("postal_code_match_address_no_match") - known() - validated = true - } + /** + * Postal code does not match, but the street address matches or was not + * provided. + */ + @JvmField + val POSTAL_CODE_NO_MATCH_ADDRESS_MATCH = + of("postal_code_no_match_address_match") - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** Postal code and street address match. */ + @JvmField val MATCH = of("match") - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + /** Postal code and street address do not match. */ + @JvmField val NO_MATCH = of("no_match") - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Postal code matches, but the street address was not verified. + * (deprecated) + */ + @JvmField + val POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED = + of("postal_code_match_address_not_checked") - return other is Currency && value == other.value - } + @JvmStatic fun of(value: String) = Result(JsonField.of(value)) + } - override fun hashCode() = value.hashCode() + /** An enum containing [Result]'s known values. */ + enum class Known { + /** No address information was provided in the authorization request. */ + NOT_CHECKED, + /** + * Postal code matches, but the street address does not match or was not + * provided. + */ + POSTAL_CODE_MATCH_ADDRESS_NO_MATCH, + /** + * Postal code does not match, but the street address matches or was not + * provided. + */ + POSTAL_CODE_NO_MATCH_ADDRESS_MATCH, + /** Postal code and street address match. */ + MATCH, + /** Postal code and street address do not match. */ + NO_MATCH, + /** + * Postal code matches, but the street address was not verified. + * (deprecated) + */ + POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED, + } - override fun toString() = value.toString() - } + /** + * An enum containing [Result]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Result] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** No address information was provided in the authorization request. */ + NOT_CHECKED, + /** + * Postal code matches, but the street address does not match or was not + * provided. + */ + POSTAL_CODE_MATCH_ADDRESS_NO_MATCH, + /** + * Postal code does not match, but the street address matches or was not + * provided. + */ + POSTAL_CODE_NO_MATCH_ADDRESS_MATCH, + /** Postal code and street address match. */ + MATCH, + /** Postal code and street address do not match. */ + NO_MATCH, + /** + * Postal code matches, but the street address was not verified. + * (deprecated) + */ + POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED, + /** + * An enum member indicating that [Result] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** The card network used to process this card authorization. */ - class Network @JsonCreator private constructor(private val value: JsonField) : - Enum { + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NOT_CHECKED -> Value.NOT_CHECKED + POSTAL_CODE_MATCH_ADDRESS_NO_MATCH -> + Value.POSTAL_CODE_MATCH_ADDRESS_NO_MATCH + POSTAL_CODE_NO_MATCH_ADDRESS_MATCH -> + Value.POSTAL_CODE_NO_MATCH_ADDRESS_MATCH + MATCH -> Value.MATCH + NO_MATCH -> Value.NO_MATCH + POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED -> + Value.POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED + else -> Value._UNKNOWN + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + NOT_CHECKED -> Known.NOT_CHECKED + POSTAL_CODE_MATCH_ADDRESS_NO_MATCH -> + Known.POSTAL_CODE_MATCH_ADDRESS_NO_MATCH + POSTAL_CODE_NO_MATCH_ADDRESS_MATCH -> + Known.POSTAL_CODE_NO_MATCH_ADDRESS_MATCH + MATCH -> Known.MATCH + NO_MATCH -> Known.NO_MATCH + POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED -> + Known.POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED + else -> throw IncreaseInvalidDataException("Unknown Result: $value") + } - companion object { + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - /** Visa */ - @JvmField val VISA = of("visa") + private var validated: Boolean = false - /** Pulse */ - @JvmField val PULSE = of("pulse") + fun validate(): Result = apply { + if (validated) { + return@apply + } - @JvmStatic fun of(value: String) = Network(JsonField.of(value)) - } + known() + validated = true + } - /** An enum containing [Network]'s known values. */ - enum class Known { - /** Visa */ - VISA, - /** Pulse */ - PULSE, - } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * An enum containing [Network]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Network] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** Visa */ - VISA, - /** Pulse */ - PULSE, - /** - * An enum member indicating that [Network] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - VISA -> Value.VISA - PULSE -> Value.PULSE - else -> Value._UNKNOWN - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - VISA -> Known.VISA - PULSE -> Known.PULSE - else -> throw IncreaseInvalidDataException("Unknown Network: $value") - } + return other is Result && value == other.value + } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } - private var validated: Boolean = false + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun validate(): Network = apply { - if (validated) { - return@apply + return other is CardholderAddress && + actualLine1 == other.actualLine1 && + actualPostalCode == other.actualPostalCode && + providedLine1 == other.providedLine1 && + providedPostalCode == other.providedPostalCode && + result == other.result && + additionalProperties == other.additionalProperties } - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false + private val hashCode: Int by lazy { + Objects.hash( + actualLine1, + actualPostalCode, + providedLine1, + providedPostalCode, + result, + additionalProperties, + ) } - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun hashCode(): Int = hashCode - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Network && value == other.value + override fun toString() = + "CardholderAddress{actualLine1=$actualLine1, actualPostalCode=$actualPostalCode, providedLine1=$providedLine1, providedPostalCode=$providedPostalCode, result=$result, additionalProperties=$additionalProperties}" } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } + /** Cardholder name provided in the authorization request. */ + class CardholderName + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val providedFirstName: JsonField, + private val providedLastName: JsonField, + private val providedMiddleName: JsonField, + private val additionalProperties: MutableMap, + ) { - /** - * A constant representing the object's type. For this resource it will always be - * `card_authorization_expiration`. - */ - class Type @JsonCreator private constructor(private val value: JsonField) : - Enum { + @JsonCreator + private constructor( + @JsonProperty("provided_first_name") + @ExcludeMissing + providedFirstName: JsonField = JsonMissing.of(), + @JsonProperty("provided_last_name") + @ExcludeMissing + providedLastName: JsonField = JsonMissing.of(), + @JsonProperty("provided_middle_name") + @ExcludeMissing + providedMiddleName: JsonField = JsonMissing.of(), + ) : this( + providedFirstName, + providedLastName, + providedMiddleName, + mutableMapOf(), + ) - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + /** + * The first name provided for verification in the authorization request. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun providedFirstName(): Optional = + providedFirstName.getOptional("provided_first_name") - companion object { + /** + * The last name provided for verification in the authorization request. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun providedLastName(): Optional = + providedLastName.getOptional("provided_last_name") - @JvmField - val CARD_AUTHORIZATION_EXPIRATION = of("card_authorization_expiration") + /** + * The middle name provided for verification in the authorization request. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun providedMiddleName(): Optional = + providedMiddleName.getOptional("provided_middle_name") - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } + /** + * Returns the raw JSON value of [providedFirstName]. + * + * Unlike [providedFirstName], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("provided_first_name") + @ExcludeMissing + fun _providedFirstName(): JsonField = providedFirstName - /** An enum containing [Type]'s known values. */ - enum class Known { - CARD_AUTHORIZATION_EXPIRATION - } + /** + * Returns the raw JSON value of [providedLastName]. + * + * Unlike [providedLastName], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("provided_last_name") + @ExcludeMissing + fun _providedLastName(): JsonField = providedLastName - /** - * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Type] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CARD_AUTHORIZATION_EXPIRATION, /** - * An enum member indicating that [Type] was instantiated with an unknown value. + * Returns the raw JSON value of [providedMiddleName]. + * + * Unlike [providedMiddleName], this method doesn't throw if the JSON field has + * an unexpected type. */ - _UNKNOWN, - } + @JsonProperty("provided_middle_name") + @ExcludeMissing + fun _providedMiddleName(): JsonField = providedMiddleName - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CARD_AUTHORIZATION_EXPIRATION -> Value.CARD_AUTHORIZATION_EXPIRATION - else -> Value._UNKNOWN + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - CARD_AUTHORIZATION_EXPIRATION -> Known.CARD_AUTHORIZATION_EXPIRATION - else -> throw IncreaseInvalidDataException("Unknown Type: $value") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [CardholderName]. + * + * The following fields are required: + * ```java + * .providedFirstName() + * .providedLastName() + * .providedMiddleName() + * ``` + */ + @JvmStatic fun builder() = Builder() } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") + /** A builder for [CardholderName]. */ + class Builder internal constructor() { + + private var providedFirstName: JsonField? = null + private var providedLastName: JsonField? = null + private var providedMiddleName: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(cardholderName: CardholderName) = apply { + providedFirstName = cardholderName.providedFirstName + providedLastName = cardholderName.providedLastName + providedMiddleName = cardholderName.providedMiddleName + additionalProperties = + cardholderName.additionalProperties.toMutableMap() + } + + /** + * The first name provided for verification in the authorization request. + */ + fun providedFirstName(providedFirstName: String?) = + providedFirstName(JsonField.ofNullable(providedFirstName)) + + /** + * Alias for calling [Builder.providedFirstName] with + * `providedFirstName.orElse(null)`. + */ + fun providedFirstName(providedFirstName: Optional) = + providedFirstName(providedFirstName.getOrNull()) + + /** + * Sets [Builder.providedFirstName] to an arbitrary JSON value. + * + * You should usually call [Builder.providedFirstName] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun providedFirstName(providedFirstName: JsonField) = apply { + this.providedFirstName = providedFirstName + } + + /** The last name provided for verification in the authorization request. */ + fun providedLastName(providedLastName: String?) = + providedLastName(JsonField.ofNullable(providedLastName)) + + /** + * Alias for calling [Builder.providedLastName] with + * `providedLastName.orElse(null)`. + */ + fun providedLastName(providedLastName: Optional) = + providedLastName(providedLastName.getOrNull()) + + /** + * Sets [Builder.providedLastName] to an arbitrary JSON value. + * + * You should usually call [Builder.providedLastName] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun providedLastName(providedLastName: JsonField) = apply { + this.providedLastName = providedLastName + } + + /** + * The middle name provided for verification in the authorization request. + */ + fun providedMiddleName(providedMiddleName: String?) = + providedMiddleName(JsonField.ofNullable(providedMiddleName)) + + /** + * Alias for calling [Builder.providedMiddleName] with + * `providedMiddleName.orElse(null)`. + */ + fun providedMiddleName(providedMiddleName: Optional) = + providedMiddleName(providedMiddleName.getOrNull()) + + /** + * Sets [Builder.providedMiddleName] to an arbitrary JSON value. + * + * You should usually call [Builder.providedMiddleName] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun providedMiddleName(providedMiddleName: JsonField) = apply { + this.providedMiddleName = providedMiddleName + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [CardholderName]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .providedFirstName() + * .providedLastName() + * .providedMiddleName() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CardholderName = + CardholderName( + checkRequired("providedFirstName", providedFirstName), + checkRequired("providedLastName", providedLastName), + checkRequired("providedMiddleName", providedMiddleName), + additionalProperties.toMutableMap(), + ) } - private var validated: Boolean = false + private var validated: Boolean = false - fun validate(): Type = apply { - if (validated) { - return@apply + fun validate(): CardholderName = apply { + if (validated) { + return@apply + } + + providedFirstName() + providedLastName() + providedMiddleName() + validated = true } - known() - validated = true - } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (providedFirstName.asKnown().isPresent) 1 else 0) + + (if (providedLastName.asKnown().isPresent) 1 else 0) + + (if (providedMiddleName.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is CardholderName && + providedFirstName == other.providedFirstName && + providedLastName == other.providedLastName && + providedMiddleName == other.providedMiddleName && + additionalProperties == other.additionalProperties } - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + private val hashCode: Int by lazy { + Objects.hash( + providedFirstName, + providedLastName, + providedMiddleName, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "CardholderName{providedFirstName=$providedFirstName, providedLastName=$providedLastName, providedMiddleName=$providedMiddleName, additionalProperties=$additionalProperties}" + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is Type && value == other.value + return other is Verification && + cardVerificationCode == other.cardVerificationCode && + cardholderAddress == other.cardholderAddress && + cardholderName == other.cardholderName && + additionalProperties == other.additionalProperties } - override fun hashCode() = value.hashCode() + private val hashCode: Int by lazy { + Objects.hash( + cardVerificationCode, + cardholderAddress, + cardholderName, + additionalProperties, + ) + } - override fun toString() = value.toString() + override fun hashCode(): Int = hashCode + + override fun toString() = + "Verification{cardVerificationCode=$cardVerificationCode, cardholderAddress=$cardholderAddress, cardholderName=$cardholderName, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -18543,24 +19001,70 @@ private constructor( return true } - return other is CardAuthorizationExpiration && + return other is CardAuthorization && id == other.id && - cardAuthorizationId == other.cardAuthorizationId && + actioner == other.actioner && + additionalAmounts == other.additionalAmounts && + amount == other.amount && + cardPaymentId == other.cardPaymentId && currency == other.currency && - expiredAmount == other.expiredAmount && - network == other.network && + digitalWalletTokenId == other.digitalWalletTokenId && + direction == other.direction && + expiresAt == other.expiresAt && + merchantAcceptorId == other.merchantAcceptorId && + merchantCategoryCode == other.merchantCategoryCode && + merchantCity == other.merchantCity && + merchantCountry == other.merchantCountry && + merchantDescriptor == other.merchantDescriptor && + merchantPostalCode == other.merchantPostalCode && + merchantState == other.merchantState && + networkDetails == other.networkDetails && + networkIdentifiers == other.networkIdentifiers && + networkRiskScore == other.networkRiskScore && + pendingTransactionId == other.pendingTransactionId && + physicalCardId == other.physicalCardId && + presentmentAmount == other.presentmentAmount && + presentmentCurrency == other.presentmentCurrency && + processingCategory == other.processingCategory && + realTimeDecisionId == other.realTimeDecisionId && + schemeFees == other.schemeFees && + terminalId == other.terminalId && type == other.type && + verification == other.verification && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { Objects.hash( id, - cardAuthorizationId, + actioner, + additionalAmounts, + amount, + cardPaymentId, currency, - expiredAmount, - network, + digitalWalletTokenId, + direction, + expiresAt, + merchantAcceptorId, + merchantCategoryCode, + merchantCity, + merchantCountry, + merchantDescriptor, + merchantPostalCode, + merchantState, + networkDetails, + networkIdentifiers, + networkRiskScore, + pendingTransactionId, + physicalCardId, + presentmentAmount, + presentmentCurrency, + processingCategory, + realTimeDecisionId, + schemeFees, + terminalId, type, + verification, additionalProperties, ) } @@ -18568,130 +19072,54 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CardAuthorizationExpiration{id=$id, cardAuthorizationId=$cardAuthorizationId, currency=$currency, expiredAmount=$expiredAmount, network=$network, type=$type, additionalProperties=$additionalProperties}" + "CardAuthorization{id=$id, actioner=$actioner, additionalAmounts=$additionalAmounts, amount=$amount, cardPaymentId=$cardPaymentId, currency=$currency, digitalWalletTokenId=$digitalWalletTokenId, direction=$direction, expiresAt=$expiresAt, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkDetails=$networkDetails, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, pendingTransactionId=$pendingTransactionId, physicalCardId=$physicalCardId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, processingCategory=$processingCategory, realTimeDecisionId=$realTimeDecisionId, schemeFees=$schemeFees, terminalId=$terminalId, type=$type, verification=$verification, additionalProperties=$additionalProperties}" } /** - * A Card Balance Inquiry object. This field will be present in the JSON response if and - * only if `category` is equal to `card_balance_inquiry`. Card Balance Inquiries are - * transactions that allow merchants to check the available balance on a card without - * placing a hold on funds, commonly used when a customer requests their balance at an ATM. + * A Card Authorization Expiration object. This field will be present in the JSON response + * if and only if `category` is equal to `card_authorization_expiration`. Card Authorization + * Expirations are cancellations of authorizations that were never settled by the acquirer. */ - class CardBalanceInquiry + class CardAuthorizationExpiration @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val id: JsonField, - private val additionalAmounts: JsonField, - private val balance: JsonField, - private val cardPaymentId: JsonField, + private val cardAuthorizationId: JsonField, private val currency: JsonField, - private val digitalWalletTokenId: JsonField, - private val merchantAcceptorId: JsonField, - private val merchantCategoryCode: JsonField, - private val merchantCity: JsonField, - private val merchantCountry: JsonField, - private val merchantDescriptor: JsonField, - private val merchantPostalCode: JsonField, - private val merchantState: JsonField, - private val networkDetails: JsonField, - private val networkIdentifiers: JsonField, - private val networkRiskScore: JsonField, - private val physicalCardId: JsonField, - private val realTimeDecisionId: JsonField, - private val terminalId: JsonField, + private val expiredAmount: JsonField, + private val network: JsonField, private val type: JsonField, - private val verification: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("additional_amounts") - @ExcludeMissing - additionalAmounts: JsonField = JsonMissing.of(), - @JsonProperty("balance") - @ExcludeMissing - balance: JsonField = JsonMissing.of(), - @JsonProperty("card_payment_id") + @JsonProperty("card_authorization_id") @ExcludeMissing - cardPaymentId: JsonField = JsonMissing.of(), + cardAuthorizationId: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing currency: JsonField = JsonMissing.of(), - @JsonProperty("digital_wallet_token_id") + @JsonProperty("expired_amount") @ExcludeMissing - digitalWalletTokenId: JsonField = JsonMissing.of(), - @JsonProperty("merchant_acceptor_id") - @ExcludeMissing - merchantAcceptorId: JsonField = JsonMissing.of(), - @JsonProperty("merchant_category_code") - @ExcludeMissing - merchantCategoryCode: JsonField = JsonMissing.of(), - @JsonProperty("merchant_city") - @ExcludeMissing - merchantCity: JsonField = JsonMissing.of(), - @JsonProperty("merchant_country") - @ExcludeMissing - merchantCountry: JsonField = JsonMissing.of(), - @JsonProperty("merchant_descriptor") - @ExcludeMissing - merchantDescriptor: JsonField = JsonMissing.of(), - @JsonProperty("merchant_postal_code") - @ExcludeMissing - merchantPostalCode: JsonField = JsonMissing.of(), - @JsonProperty("merchant_state") - @ExcludeMissing - merchantState: JsonField = JsonMissing.of(), - @JsonProperty("network_details") - @ExcludeMissing - networkDetails: JsonField = JsonMissing.of(), - @JsonProperty("network_identifiers") - @ExcludeMissing - networkIdentifiers: JsonField = JsonMissing.of(), - @JsonProperty("network_risk_score") - @ExcludeMissing - networkRiskScore: JsonField = JsonMissing.of(), - @JsonProperty("physical_card_id") - @ExcludeMissing - physicalCardId: JsonField = JsonMissing.of(), - @JsonProperty("real_time_decision_id") - @ExcludeMissing - realTimeDecisionId: JsonField = JsonMissing.of(), - @JsonProperty("terminal_id") + expiredAmount: JsonField = JsonMissing.of(), + @JsonProperty("network") @ExcludeMissing - terminalId: JsonField = JsonMissing.of(), + network: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - @JsonProperty("verification") - @ExcludeMissing - verification: JsonField = JsonMissing.of(), ) : this( id, - additionalAmounts, - balance, - cardPaymentId, + cardAuthorizationId, currency, - digitalWalletTokenId, - merchantAcceptorId, - merchantCategoryCode, - merchantCity, - merchantCountry, - merchantDescriptor, - merchantPostalCode, - merchantState, - networkDetails, - networkIdentifiers, - networkRiskScore, - physicalCardId, - realTimeDecisionId, - terminalId, + expiredAmount, + network, type, - verification, mutableMapOf(), ) /** - * The Card Balance Inquiry identifier. + * The Card Authorization Expiration identifier. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected @@ -18700,38 +19128,17 @@ private constructor( fun id(): String = id.getRequired("id") /** - * Additional amounts associated with the card authorization, such as ATM surcharges - * fees. These are usually a subset of the `amount` field and are used to provide more - * detailed information about the transaction. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun additionalAmounts(): AdditionalAmounts = - additionalAmounts.getRequired("additional_amounts") - - /** - * The balance amount in the minor unit of the account's currency. For dollars, for - * example, this is cents. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun balance(): Long = balance.getRequired("balance") - - /** - * The ID of the Card Payment this transaction belongs to. + * The identifier for the Card Authorization this reverses. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected * value). */ - fun cardPaymentId(): String = cardPaymentId.getRequired("card_payment_id") + fun cardAuthorizationId(): String = + cardAuthorizationId.getRequired("card_authorization_id") /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the account's + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the reversal's * currency. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is @@ -18741,141 +19148,27 @@ private constructor( fun currency(): Currency = currency.getRequired("currency") /** - * If the authorization was made via a Digital Wallet Token (such as an Apple Pay - * purchase), the identifier of the token that was used. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun digitalWalletTokenId(): Optional = - digitalWalletTokenId.getOptional("digital_wallet_token_id") - - /** - * The merchant identifier (commonly abbreviated as MID) of the merchant the card is - * transacting with. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun merchantAcceptorId(): String = - merchantAcceptorId.getRequired("merchant_acceptor_id") - - /** - * The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card is - * transacting with. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun merchantCategoryCode(): String = - merchantCategoryCode.getRequired("merchant_category_code") - - /** - * The city the merchant resides in. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun merchantCity(): Optional = merchantCity.getOptional("merchant_city") - - /** - * The country the merchant resides in. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun merchantCountry(): String = merchantCountry.getRequired("merchant_country") - - /** - * The merchant descriptor of the merchant the card is transacting with. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun merchantDescriptor(): String = merchantDescriptor.getRequired("merchant_descriptor") - - /** - * The merchant's postal code. For US merchants this is either a 5-digit or 9-digit ZIP - * code, where the first 5 and last 4 are separated by a dash. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun merchantPostalCode(): Optional = - merchantPostalCode.getOptional("merchant_postal_code") - - /** - * The state the merchant resides in. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun merchantState(): Optional = merchantState.getOptional("merchant_state") - - /** - * Fields specific to the `network`. + * The amount of this authorization expiration in the minor unit of the transaction's + * currency. For dollars, for example, this is cents. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected * value). */ - fun networkDetails(): NetworkDetails = networkDetails.getRequired("network_details") + fun expiredAmount(): Long = expiredAmount.getRequired("expired_amount") /** - * Network-specific identifiers for a specific request or transaction. + * The card network used to process this card authorization. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected * value). */ - fun networkIdentifiers(): NetworkIdentifiers = - networkIdentifiers.getRequired("network_identifiers") - - /** - * The risk score generated by the card network. For Visa this is the Visa Advanced - * Authorization risk score, from 0 to 99, where 99 is the riskiest. For Pulse the score - * is from 0 to 999, where 999 is the riskiest. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun networkRiskScore(): Optional = - networkRiskScore.getOptional("network_risk_score") - - /** - * If the authorization was made in-person with a physical card, the Physical Card that - * was used. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun physicalCardId(): Optional = physicalCardId.getOptional("physical_card_id") - - /** - * The identifier of the Real-Time Decision sent to approve or decline this transaction. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun realTimeDecisionId(): Optional = - realTimeDecisionId.getOptional("real_time_decision_id") - - /** - * The terminal identifier (commonly abbreviated as TID) of the terminal the card is - * transacting with. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun terminalId(): Optional = terminalId.getOptional("terminal_id") + fun network(): Network = network.getRequired("network") /** * A constant representing the object's type. For this resource it will always be - * `card_balance_inquiry`. + * `card_authorization_expiration`. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected @@ -18883,15 +19176,6 @@ private constructor( */ fun type(): Type = type.getRequired("type") - /** - * Fields related to verification of cardholder-provided values. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun verification(): Verification = verification.getRequired("verification") - /** * Returns the raw JSON value of [id]. * @@ -18900,31 +19184,14 @@ private constructor( @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id /** - * Returns the raw JSON value of [additionalAmounts]. + * Returns the raw JSON value of [cardAuthorizationId]. * - * Unlike [additionalAmounts], this method doesn't throw if the JSON field has an + * Unlike [cardAuthorizationId], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("additional_amounts") - @ExcludeMissing - fun _additionalAmounts(): JsonField = additionalAmounts - - /** - * Returns the raw JSON value of [balance]. - * - * Unlike [balance], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("balance") @ExcludeMissing fun _balance(): JsonField = balance - - /** - * Returns the raw JSON value of [cardPaymentId]. - * - * Unlike [cardPaymentId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("card_payment_id") + @JsonProperty("card_authorization_id") @ExcludeMissing - fun _cardPaymentId(): JsonField = cardPaymentId + fun _cardAuthorizationId(): JsonField = cardAuthorizationId /** * Returns the raw JSON value of [currency]. @@ -18937,144 +19204,21 @@ private constructor( fun _currency(): JsonField = currency /** - * Returns the raw JSON value of [digitalWalletTokenId]. - * - * Unlike [digitalWalletTokenId], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("digital_wallet_token_id") - @ExcludeMissing - fun _digitalWalletTokenId(): JsonField = digitalWalletTokenId - - /** - * Returns the raw JSON value of [merchantAcceptorId]. - * - * Unlike [merchantAcceptorId], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("merchant_acceptor_id") - @ExcludeMissing - fun _merchantAcceptorId(): JsonField = merchantAcceptorId - - /** - * Returns the raw JSON value of [merchantCategoryCode]. - * - * Unlike [merchantCategoryCode], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("merchant_category_code") - @ExcludeMissing - fun _merchantCategoryCode(): JsonField = merchantCategoryCode - - /** - * Returns the raw JSON value of [merchantCity]. - * - * Unlike [merchantCity], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("merchant_city") - @ExcludeMissing - fun _merchantCity(): JsonField = merchantCity - - /** - * Returns the raw JSON value of [merchantCountry]. - * - * Unlike [merchantCountry], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("merchant_country") - @ExcludeMissing - fun _merchantCountry(): JsonField = merchantCountry - - /** - * Returns the raw JSON value of [merchantDescriptor]. - * - * Unlike [merchantDescriptor], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("merchant_descriptor") - @ExcludeMissing - fun _merchantDescriptor(): JsonField = merchantDescriptor - - /** - * Returns the raw JSON value of [merchantPostalCode]. - * - * Unlike [merchantPostalCode], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("merchant_postal_code") - @ExcludeMissing - fun _merchantPostalCode(): JsonField = merchantPostalCode - - /** - * Returns the raw JSON value of [merchantState]. + * Returns the raw JSON value of [expiredAmount]. * - * Unlike [merchantState], this method doesn't throw if the JSON field has an unexpected + * Unlike [expiredAmount], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("merchant_state") - @ExcludeMissing - fun _merchantState(): JsonField = merchantState - - /** - * Returns the raw JSON value of [networkDetails]. - * - * Unlike [networkDetails], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("network_details") - @ExcludeMissing - fun _networkDetails(): JsonField = networkDetails - - /** - * Returns the raw JSON value of [networkIdentifiers]. - * - * Unlike [networkIdentifiers], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("network_identifiers") - @ExcludeMissing - fun _networkIdentifiers(): JsonField = networkIdentifiers - - /** - * Returns the raw JSON value of [networkRiskScore]. - * - * Unlike [networkRiskScore], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("network_risk_score") - @ExcludeMissing - fun _networkRiskScore(): JsonField = networkRiskScore - - /** - * Returns the raw JSON value of [physicalCardId]. - * - * Unlike [physicalCardId], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("physical_card_id") - @ExcludeMissing - fun _physicalCardId(): JsonField = physicalCardId - - /** - * Returns the raw JSON value of [realTimeDecisionId]. - * - * Unlike [realTimeDecisionId], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("real_time_decision_id") + @JsonProperty("expired_amount") @ExcludeMissing - fun _realTimeDecisionId(): JsonField = realTimeDecisionId + fun _expiredAmount(): JsonField = expiredAmount /** - * Returns the raw JSON value of [terminalId]. + * Returns the raw JSON value of [network]. * - * Unlike [terminalId], this method doesn't throw if the JSON field has an unexpected - * type. + * Unlike [network], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("terminal_id") - @ExcludeMissing - fun _terminalId(): JsonField = terminalId + @JsonProperty("network") @ExcludeMissing fun _network(): JsonField = network /** * Returns the raw JSON value of [type]. @@ -19083,16 +19227,6 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - /** - * Returns the raw JSON value of [verification]. - * - * Unlike [verification], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("verification") - @ExcludeMissing - fun _verification(): JsonField = verification - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -19108,89 +19242,47 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [CardBalanceInquiry]. + * Returns a mutable builder for constructing an instance of + * [CardAuthorizationExpiration]. * * The following fields are required: * ```java * .id() - * .additionalAmounts() - * .balance() - * .cardPaymentId() + * .cardAuthorizationId() * .currency() - * .digitalWalletTokenId() - * .merchantAcceptorId() - * .merchantCategoryCode() - * .merchantCity() - * .merchantCountry() - * .merchantDescriptor() - * .merchantPostalCode() - * .merchantState() - * .networkDetails() - * .networkIdentifiers() - * .networkRiskScore() - * .physicalCardId() - * .realTimeDecisionId() - * .terminalId() + * .expiredAmount() + * .network() * .type() - * .verification() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [CardBalanceInquiry]. */ + /** A builder for [CardAuthorizationExpiration]. */ class Builder internal constructor() { private var id: JsonField? = null - private var additionalAmounts: JsonField? = null - private var balance: JsonField? = null - private var cardPaymentId: JsonField? = null + private var cardAuthorizationId: JsonField? = null private var currency: JsonField? = null - private var digitalWalletTokenId: JsonField? = null - private var merchantAcceptorId: JsonField? = null - private var merchantCategoryCode: JsonField? = null - private var merchantCity: JsonField? = null - private var merchantCountry: JsonField? = null - private var merchantDescriptor: JsonField? = null - private var merchantPostalCode: JsonField? = null - private var merchantState: JsonField? = null - private var networkDetails: JsonField? = null - private var networkIdentifiers: JsonField? = null - private var networkRiskScore: JsonField? = null - private var physicalCardId: JsonField? = null - private var realTimeDecisionId: JsonField? = null - private var terminalId: JsonField? = null + private var expiredAmount: JsonField? = null + private var network: JsonField? = null private var type: JsonField? = null - private var verification: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(cardBalanceInquiry: CardBalanceInquiry) = apply { - id = cardBalanceInquiry.id - additionalAmounts = cardBalanceInquiry.additionalAmounts - balance = cardBalanceInquiry.balance - cardPaymentId = cardBalanceInquiry.cardPaymentId - currency = cardBalanceInquiry.currency - digitalWalletTokenId = cardBalanceInquiry.digitalWalletTokenId - merchantAcceptorId = cardBalanceInquiry.merchantAcceptorId - merchantCategoryCode = cardBalanceInquiry.merchantCategoryCode - merchantCity = cardBalanceInquiry.merchantCity - merchantCountry = cardBalanceInquiry.merchantCountry - merchantDescriptor = cardBalanceInquiry.merchantDescriptor - merchantPostalCode = cardBalanceInquiry.merchantPostalCode - merchantState = cardBalanceInquiry.merchantState - networkDetails = cardBalanceInquiry.networkDetails - networkIdentifiers = cardBalanceInquiry.networkIdentifiers - networkRiskScore = cardBalanceInquiry.networkRiskScore - physicalCardId = cardBalanceInquiry.physicalCardId - realTimeDecisionId = cardBalanceInquiry.realTimeDecisionId - terminalId = cardBalanceInquiry.terminalId - type = cardBalanceInquiry.type - verification = cardBalanceInquiry.verification - additionalProperties = cardBalanceInquiry.additionalProperties.toMutableMap() - } + internal fun from(cardAuthorizationExpiration: CardAuthorizationExpiration) = + apply { + id = cardAuthorizationExpiration.id + cardAuthorizationId = cardAuthorizationExpiration.cardAuthorizationId + currency = cardAuthorizationExpiration.currency + expiredAmount = cardAuthorizationExpiration.expiredAmount + network = cardAuthorizationExpiration.network + type = cardAuthorizationExpiration.type + additionalProperties = + cardAuthorizationExpiration.additionalProperties.toMutableMap() + } - /** The Card Balance Inquiry identifier. */ + /** The Card Authorization Expiration identifier. */ fun id(id: String) = id(JsonField.of(id)) /** @@ -19202,58 +19294,24 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - /** - * Additional amounts associated with the card authorization, such as ATM surcharges - * fees. These are usually a subset of the `amount` field and are used to provide - * more detailed information about the transaction. - */ - fun additionalAmounts(additionalAmounts: AdditionalAmounts) = - additionalAmounts(JsonField.of(additionalAmounts)) + /** The identifier for the Card Authorization this reverses. */ + fun cardAuthorizationId(cardAuthorizationId: String) = + cardAuthorizationId(JsonField.of(cardAuthorizationId)) /** - * Sets [Builder.additionalAmounts] to an arbitrary JSON value. + * Sets [Builder.cardAuthorizationId] to an arbitrary JSON value. * - * You should usually call [Builder.additionalAmounts] with a well-typed - * [AdditionalAmounts] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. + * You should usually call [Builder.cardAuthorizationId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. */ - fun additionalAmounts(additionalAmounts: JsonField) = apply { - this.additionalAmounts = additionalAmounts + fun cardAuthorizationId(cardAuthorizationId: JsonField) = apply { + this.cardAuthorizationId = cardAuthorizationId } /** - * The balance amount in the minor unit of the account's currency. For dollars, for - * example, this is cents. - */ - fun balance(balance: Long) = balance(JsonField.of(balance)) - - /** - * Sets [Builder.balance] to an arbitrary JSON value. - * - * You should usually call [Builder.balance] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun balance(balance: JsonField) = apply { this.balance = balance } - - /** The ID of the Card Payment this transaction belongs to. */ - fun cardPaymentId(cardPaymentId: String) = - cardPaymentId(JsonField.of(cardPaymentId)) - - /** - * Sets [Builder.cardPaymentId] to an arbitrary JSON value. - * - * You should usually call [Builder.cardPaymentId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun cardPaymentId(cardPaymentId: JsonField) = apply { - this.cardPaymentId = cardPaymentId - } - - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the account's - * currency. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the reversal's + * currency. */ fun currency(currency: Currency) = currency(JsonField.of(currency)) @@ -19267,295 +19325,37 @@ private constructor( fun currency(currency: JsonField) = apply { this.currency = currency } /** - * If the authorization was made via a Digital Wallet Token (such as an Apple Pay - * purchase), the identifier of the token that was used. - */ - fun digitalWalletTokenId(digitalWalletTokenId: String?) = - digitalWalletTokenId(JsonField.ofNullable(digitalWalletTokenId)) - - /** - * Alias for calling [Builder.digitalWalletTokenId] with - * `digitalWalletTokenId.orElse(null)`. - */ - fun digitalWalletTokenId(digitalWalletTokenId: Optional) = - digitalWalletTokenId(digitalWalletTokenId.getOrNull()) - - /** - * Sets [Builder.digitalWalletTokenId] to an arbitrary JSON value. - * - * You should usually call [Builder.digitalWalletTokenId] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun digitalWalletTokenId(digitalWalletTokenId: JsonField) = apply { - this.digitalWalletTokenId = digitalWalletTokenId - } - - /** - * The merchant identifier (commonly abbreviated as MID) of the merchant the card is - * transacting with. - */ - fun merchantAcceptorId(merchantAcceptorId: String) = - merchantAcceptorId(JsonField.of(merchantAcceptorId)) - - /** - * Sets [Builder.merchantAcceptorId] to an arbitrary JSON value. - * - * You should usually call [Builder.merchantAcceptorId] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun merchantAcceptorId(merchantAcceptorId: JsonField) = apply { - this.merchantAcceptorId = merchantAcceptorId - } - - /** - * The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card - * is transacting with. - */ - fun merchantCategoryCode(merchantCategoryCode: String) = - merchantCategoryCode(JsonField.of(merchantCategoryCode)) - - /** - * Sets [Builder.merchantCategoryCode] to an arbitrary JSON value. - * - * You should usually call [Builder.merchantCategoryCode] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun merchantCategoryCode(merchantCategoryCode: JsonField) = apply { - this.merchantCategoryCode = merchantCategoryCode - } - - /** The city the merchant resides in. */ - fun merchantCity(merchantCity: String?) = - merchantCity(JsonField.ofNullable(merchantCity)) - - /** Alias for calling [Builder.merchantCity] with `merchantCity.orElse(null)`. */ - fun merchantCity(merchantCity: Optional) = - merchantCity(merchantCity.getOrNull()) - - /** - * Sets [Builder.merchantCity] to an arbitrary JSON value. - * - * You should usually call [Builder.merchantCity] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun merchantCity(merchantCity: JsonField) = apply { - this.merchantCity = merchantCity - } - - /** The country the merchant resides in. */ - fun merchantCountry(merchantCountry: String) = - merchantCountry(JsonField.of(merchantCountry)) - - /** - * Sets [Builder.merchantCountry] to an arbitrary JSON value. - * - * You should usually call [Builder.merchantCountry] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun merchantCountry(merchantCountry: JsonField) = apply { - this.merchantCountry = merchantCountry - } - - /** The merchant descriptor of the merchant the card is transacting with. */ - fun merchantDescriptor(merchantDescriptor: String) = - merchantDescriptor(JsonField.of(merchantDescriptor)) - - /** - * Sets [Builder.merchantDescriptor] to an arbitrary JSON value. - * - * You should usually call [Builder.merchantDescriptor] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun merchantDescriptor(merchantDescriptor: JsonField) = apply { - this.merchantDescriptor = merchantDescriptor - } - - /** - * The merchant's postal code. For US merchants this is either a 5-digit or 9-digit - * ZIP code, where the first 5 and last 4 are separated by a dash. - */ - fun merchantPostalCode(merchantPostalCode: String?) = - merchantPostalCode(JsonField.ofNullable(merchantPostalCode)) - - /** - * Alias for calling [Builder.merchantPostalCode] with - * `merchantPostalCode.orElse(null)`. - */ - fun merchantPostalCode(merchantPostalCode: Optional) = - merchantPostalCode(merchantPostalCode.getOrNull()) - - /** - * Sets [Builder.merchantPostalCode] to an arbitrary JSON value. - * - * You should usually call [Builder.merchantPostalCode] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun merchantPostalCode(merchantPostalCode: JsonField) = apply { - this.merchantPostalCode = merchantPostalCode - } - - /** The state the merchant resides in. */ - fun merchantState(merchantState: String?) = - merchantState(JsonField.ofNullable(merchantState)) - - /** Alias for calling [Builder.merchantState] with `merchantState.orElse(null)`. */ - fun merchantState(merchantState: Optional) = - merchantState(merchantState.getOrNull()) - - /** - * Sets [Builder.merchantState] to an arbitrary JSON value. - * - * You should usually call [Builder.merchantState] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun merchantState(merchantState: JsonField) = apply { - this.merchantState = merchantState - } - - /** Fields specific to the `network`. */ - fun networkDetails(networkDetails: NetworkDetails) = - networkDetails(JsonField.of(networkDetails)) - - /** - * Sets [Builder.networkDetails] to an arbitrary JSON value. - * - * You should usually call [Builder.networkDetails] with a well-typed - * [NetworkDetails] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun networkDetails(networkDetails: JsonField) = apply { - this.networkDetails = networkDetails - } - - /** Network-specific identifiers for a specific request or transaction. */ - fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) = - networkIdentifiers(JsonField.of(networkIdentifiers)) - - /** - * Sets [Builder.networkIdentifiers] to an arbitrary JSON value. - * - * You should usually call [Builder.networkIdentifiers] with a well-typed - * [NetworkIdentifiers] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun networkIdentifiers(networkIdentifiers: JsonField) = apply { - this.networkIdentifiers = networkIdentifiers - } - - /** - * The risk score generated by the card network. For Visa this is the Visa Advanced - * Authorization risk score, from 0 to 99, where 99 is the riskiest. For Pulse the - * score is from 0 to 999, where 999 is the riskiest. - */ - fun networkRiskScore(networkRiskScore: Long?) = - networkRiskScore(JsonField.ofNullable(networkRiskScore)) - - /** - * Alias for [Builder.networkRiskScore]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun networkRiskScore(networkRiskScore: Long) = - networkRiskScore(networkRiskScore as Long?) - - /** - * Alias for calling [Builder.networkRiskScore] with - * `networkRiskScore.orElse(null)`. - */ - fun networkRiskScore(networkRiskScore: Optional) = - networkRiskScore(networkRiskScore.getOrNull()) - - /** - * Sets [Builder.networkRiskScore] to an arbitrary JSON value. - * - * You should usually call [Builder.networkRiskScore] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun networkRiskScore(networkRiskScore: JsonField) = apply { - this.networkRiskScore = networkRiskScore - } - - /** - * If the authorization was made in-person with a physical card, the Physical Card - * that was used. - */ - fun physicalCardId(physicalCardId: String?) = - physicalCardId(JsonField.ofNullable(physicalCardId)) - - /** - * Alias for calling [Builder.physicalCardId] with `physicalCardId.orElse(null)`. + * The amount of this authorization expiration in the minor unit of the + * transaction's currency. For dollars, for example, this is cents. */ - fun physicalCardId(physicalCardId: Optional) = - physicalCardId(physicalCardId.getOrNull()) + fun expiredAmount(expiredAmount: Long) = expiredAmount(JsonField.of(expiredAmount)) /** - * Sets [Builder.physicalCardId] to an arbitrary JSON value. + * Sets [Builder.expiredAmount] to an arbitrary JSON value. * - * You should usually call [Builder.physicalCardId] with a well-typed [String] value + * You should usually call [Builder.expiredAmount] with a well-typed [Long] value * instead. This method is primarily for setting the field to an undocumented or not * yet supported value. */ - fun physicalCardId(physicalCardId: JsonField) = apply { - this.physicalCardId = physicalCardId - } - - /** - * The identifier of the Real-Time Decision sent to approve or decline this - * transaction. - */ - fun realTimeDecisionId(realTimeDecisionId: String?) = - realTimeDecisionId(JsonField.ofNullable(realTimeDecisionId)) - - /** - * Alias for calling [Builder.realTimeDecisionId] with - * `realTimeDecisionId.orElse(null)`. - */ - fun realTimeDecisionId(realTimeDecisionId: Optional) = - realTimeDecisionId(realTimeDecisionId.getOrNull()) - - /** - * Sets [Builder.realTimeDecisionId] to an arbitrary JSON value. - * - * You should usually call [Builder.realTimeDecisionId] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun realTimeDecisionId(realTimeDecisionId: JsonField) = apply { - this.realTimeDecisionId = realTimeDecisionId + fun expiredAmount(expiredAmount: JsonField) = apply { + this.expiredAmount = expiredAmount } - /** - * The terminal identifier (commonly abbreviated as TID) of the terminal the card is - * transacting with. - */ - fun terminalId(terminalId: String?) = terminalId(JsonField.ofNullable(terminalId)) - - /** Alias for calling [Builder.terminalId] with `terminalId.orElse(null)`. */ - fun terminalId(terminalId: Optional) = terminalId(terminalId.getOrNull()) + /** The card network used to process this card authorization. */ + fun network(network: Network) = network(JsonField.of(network)) /** - * Sets [Builder.terminalId] to an arbitrary JSON value. + * Sets [Builder.network] to an arbitrary JSON value. * - * You should usually call [Builder.terminalId] with a well-typed [String] value + * You should usually call [Builder.network] with a well-typed [Network] value * instead. This method is primarily for setting the field to an undocumented or not * yet supported value. */ - fun terminalId(terminalId: JsonField) = apply { - this.terminalId = terminalId - } + fun network(network: JsonField) = apply { this.network = network } /** * A constant representing the object's type. For this resource it will always be - * `card_balance_inquiry`. + * `card_authorization_expiration`. */ fun type(type: Type) = type(JsonField.of(type)) @@ -19568,21 +19368,6 @@ private constructor( */ fun type(type: JsonField) = apply { this.type = type } - /** Fields related to verification of cardholder-provided values. */ - fun verification(verification: Verification) = - verification(JsonField.of(verification)) - - /** - * Sets [Builder.verification] to an arbitrary JSON value. - * - * You should usually call [Builder.verification] with a well-typed [Verification] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun verification(verification: JsonField) = apply { - this.verification = verification - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -19606,92 +19391,47 @@ private constructor( } /** - * Returns an immutable instance of [CardBalanceInquiry]. + * Returns an immutable instance of [CardAuthorizationExpiration]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java * .id() - * .additionalAmounts() - * .balance() - * .cardPaymentId() + * .cardAuthorizationId() * .currency() - * .digitalWalletTokenId() - * .merchantAcceptorId() - * .merchantCategoryCode() - * .merchantCity() - * .merchantCountry() - * .merchantDescriptor() - * .merchantPostalCode() - * .merchantState() - * .networkDetails() - * .networkIdentifiers() - * .networkRiskScore() - * .physicalCardId() - * .realTimeDecisionId() - * .terminalId() + * .expiredAmount() + * .network() * .type() - * .verification() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): CardBalanceInquiry = - CardBalanceInquiry( + fun build(): CardAuthorizationExpiration = + CardAuthorizationExpiration( checkRequired("id", id), - checkRequired("additionalAmounts", additionalAmounts), - checkRequired("balance", balance), - checkRequired("cardPaymentId", cardPaymentId), + checkRequired("cardAuthorizationId", cardAuthorizationId), checkRequired("currency", currency), - checkRequired("digitalWalletTokenId", digitalWalletTokenId), - checkRequired("merchantAcceptorId", merchantAcceptorId), - checkRequired("merchantCategoryCode", merchantCategoryCode), - checkRequired("merchantCity", merchantCity), - checkRequired("merchantCountry", merchantCountry), - checkRequired("merchantDescriptor", merchantDescriptor), - checkRequired("merchantPostalCode", merchantPostalCode), - checkRequired("merchantState", merchantState), - checkRequired("networkDetails", networkDetails), - checkRequired("networkIdentifiers", networkIdentifiers), - checkRequired("networkRiskScore", networkRiskScore), - checkRequired("physicalCardId", physicalCardId), - checkRequired("realTimeDecisionId", realTimeDecisionId), - checkRequired("terminalId", terminalId), + checkRequired("expiredAmount", expiredAmount), + checkRequired("network", network), checkRequired("type", type), - checkRequired("verification", verification), additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): CardBalanceInquiry = apply { + fun validate(): CardAuthorizationExpiration = apply { if (validated) { return@apply } id() - additionalAmounts().validate() - balance() - cardPaymentId() + cardAuthorizationId() currency().validate() - digitalWalletTokenId() - merchantAcceptorId() - merchantCategoryCode() - merchantCity() - merchantCountry() - merchantDescriptor() - merchantPostalCode() - merchantState() - networkDetails().validate() - networkIdentifiers().validate() - networkRiskScore() - physicalCardId() - realTimeDecisionId() - terminalId() + expiredAmount() + network().validate() type().validate() - verification().validate() validated = true } @@ -19712,376 +19452,2012 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (additionalAmounts.asKnown().getOrNull()?.validity() ?: 0) + - (if (balance.asKnown().isPresent) 1 else 0) + - (if (cardPaymentId.asKnown().isPresent) 1 else 0) + + (if (cardAuthorizationId.asKnown().isPresent) 1 else 0) + (currency.asKnown().getOrNull()?.validity() ?: 0) + - (if (digitalWalletTokenId.asKnown().isPresent) 1 else 0) + - (if (merchantAcceptorId.asKnown().isPresent) 1 else 0) + - (if (merchantCategoryCode.asKnown().isPresent) 1 else 0) + - (if (merchantCity.asKnown().isPresent) 1 else 0) + - (if (merchantCountry.asKnown().isPresent) 1 else 0) + - (if (merchantDescriptor.asKnown().isPresent) 1 else 0) + - (if (merchantPostalCode.asKnown().isPresent) 1 else 0) + - (if (merchantState.asKnown().isPresent) 1 else 0) + - (networkDetails.asKnown().getOrNull()?.validity() ?: 0) + - (networkIdentifiers.asKnown().getOrNull()?.validity() ?: 0) + - (if (networkRiskScore.asKnown().isPresent) 1 else 0) + - (if (physicalCardId.asKnown().isPresent) 1 else 0) + - (if (realTimeDecisionId.asKnown().isPresent) 1 else 0) + - (if (terminalId.asKnown().isPresent) 1 else 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) + - (verification.asKnown().getOrNull()?.validity() ?: 0) + (if (expiredAmount.asKnown().isPresent) 1 else 0) + + (network.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) /** - * Additional amounts associated with the card authorization, such as ATM surcharges - * fees. These are usually a subset of the `amount` field and are used to provide more - * detailed information about the transaction. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the reversal's + * currency. */ - class AdditionalAmounts - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val clinic: JsonField, - private val dental: JsonField, - private val original: JsonField, - private val prescription: JsonField, - private val surcharge: JsonField, - private val totalCumulative: JsonField, - private val totalHealthcare: JsonField, - private val transit: JsonField, - private val unknown: JsonField, - private val vision: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("clinic") - @ExcludeMissing - clinic: JsonField = JsonMissing.of(), - @JsonProperty("dental") - @ExcludeMissing - dental: JsonField = JsonMissing.of(), - @JsonProperty("original") - @ExcludeMissing - original: JsonField = JsonMissing.of(), - @JsonProperty("prescription") - @ExcludeMissing - prescription: JsonField = JsonMissing.of(), - @JsonProperty("surcharge") - @ExcludeMissing - surcharge: JsonField = JsonMissing.of(), - @JsonProperty("total_cumulative") - @ExcludeMissing - totalCumulative: JsonField = JsonMissing.of(), - @JsonProperty("total_healthcare") - @ExcludeMissing - totalHealthcare: JsonField = JsonMissing.of(), - @JsonProperty("transit") - @ExcludeMissing - transit: JsonField = JsonMissing.of(), - @JsonProperty("unknown") - @ExcludeMissing - unknown: JsonField = JsonMissing.of(), - @JsonProperty("vision") - @ExcludeMissing - vision: JsonField = JsonMissing.of(), - ) : this( - clinic, - dental, - original, - prescription, - surcharge, - totalCumulative, - totalHealthcare, - transit, - unknown, - vision, - mutableMapOf(), - ) + class Currency @JsonCreator private constructor(private val value: JsonField) : + Enum { /** - * The part of this transaction amount that was for clinic-related services. + * Returns this class instance's raw value. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. */ - fun clinic(): Optional = clinic.getOptional("clinic") + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /** - * The part of this transaction amount that was for dental-related services. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun dental(): Optional = dental.getOptional("dental") + companion object { - /** - * The original pre-authorized amount. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun original(): Optional = original.getOptional("original") + /** US Dollar (USD) */ + @JvmField val USD = of("USD") - /** - * The part of this transaction amount that was for healthcare prescriptions. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun prescription(): Optional = - prescription.getOptional("prescription") + @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) + } + + /** An enum containing [Currency]'s known values. */ + enum class Known { + /** US Dollar (USD) */ + USD + } /** - * The surcharge amount charged for this transaction by the merchant. + * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] member. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * An instance of [Currency] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. */ - fun surcharge(): Optional = surcharge.getOptional("surcharge") + enum class Value { + /** US Dollar (USD) */ + USD, + /** + * An enum member indicating that [Currency] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } /** - * The total amount of a series of incremental authorizations, optionally provided. + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. */ - fun totalCumulative(): Optional = - totalCumulative.getOptional("total_cumulative") + fun value(): Value = + when (this) { + USD -> Value.USD + else -> Value._UNKNOWN + } /** - * The total amount of healthcare-related additional amounts. + * Returns an enum member corresponding to this class instance's value. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not a + * known member. */ - fun totalHealthcare(): Optional = - totalHealthcare.getOptional("total_healthcare") + fun known(): Known = + when (this) { + USD -> Known.USD + else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + } /** - * The part of this transaction amount that was for transit-related services. + * Returns this class instance's primitive wire representation. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not have + * the expected primitive type. */ - fun transit(): Optional = transit.getOptional("transit") + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Currency = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } /** - * An unknown additional amount. + * Returns a score indicating how many valid values are contained in this object + * recursively. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * Used for best match union deserialization. */ - fun unknown(): Optional = unknown.getOptional("unknown") + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Currency && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** The card network used to process this card authorization. */ + class Network @JsonCreator private constructor(private val value: JsonField) : + Enum { /** - * The part of this transaction amount that was for vision-related services. + * Returns this class instance's raw value. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. */ - fun vision(): Optional = vision.getOptional("vision") + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + /** Visa */ + @JvmField val VISA = of("visa") + + /** Pulse */ + @JvmField val PULSE = of("pulse") + + @JvmStatic fun of(value: String) = Network(JsonField.of(value)) + } + + /** An enum containing [Network]'s known values. */ + enum class Known { + /** Visa */ + VISA, + /** Pulse */ + PULSE, + } /** - * Returns the raw JSON value of [clinic]. + * An enum containing [Network]'s known values, as well as an [_UNKNOWN] member. * - * Unlike [clinic], this method doesn't throw if the JSON field has an unexpected - * type. + * An instance of [Network] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. */ - @JsonProperty("clinic") @ExcludeMissing fun _clinic(): JsonField = clinic + enum class Value { + /** Visa */ + VISA, + /** Pulse */ + PULSE, + /** + * An enum member indicating that [Network] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } /** - * Returns the raw JSON value of [dental]. + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. * - * Unlike [dental], this method doesn't throw if the JSON field has an unexpected - * type. + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. */ - @JsonProperty("dental") @ExcludeMissing fun _dental(): JsonField = dental + fun value(): Value = + when (this) { + VISA -> Value.VISA + PULSE -> Value.PULSE + else -> Value._UNKNOWN + } /** - * Returns the raw JSON value of [original]. + * Returns an enum member corresponding to this class instance's value. * - * Unlike [original], this method doesn't throw if the JSON field has an unexpected - * type. + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not a + * known member. */ - @JsonProperty("original") - @ExcludeMissing - fun _original(): JsonField = original + fun known(): Known = + when (this) { + VISA -> Known.VISA + PULSE -> Known.PULSE + else -> throw IncreaseInvalidDataException("Unknown Network: $value") + } /** - * Returns the raw JSON value of [prescription]. + * Returns this class instance's primitive wire representation. * - * Unlike [prescription], this method doesn't throw if the JSON field has an - * unexpected type. + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not have + * the expected primitive type. */ - @JsonProperty("prescription") - @ExcludeMissing - fun _prescription(): JsonField = prescription + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Network = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } /** - * Returns the raw JSON value of [surcharge]. + * Returns a score indicating how many valid values are contained in this object + * recursively. * - * Unlike [surcharge], this method doesn't throw if the JSON field has an unexpected - * type. + * Used for best match union deserialization. */ - @JsonProperty("surcharge") - @ExcludeMissing - fun _surcharge(): JsonField = surcharge + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Network && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * A constant representing the object's type. For this resource it will always be + * `card_authorization_expiration`. + */ + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { /** - * Returns the raw JSON value of [totalCumulative]. + * Returns this class instance's raw value. * - * Unlike [totalCumulative], this method doesn't throw if the JSON field has an - * unexpected type. + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. */ - @JsonProperty("total_cumulative") - @ExcludeMissing - fun _totalCumulative(): JsonField = totalCumulative + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField + val CARD_AUTHORIZATION_EXPIRATION = of("card_authorization_expiration") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + CARD_AUTHORIZATION_EXPIRATION + } /** - * Returns the raw JSON value of [totalHealthcare]. + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. * - * Unlike [totalHealthcare], this method doesn't throw if the JSON field has an - * unexpected type. + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. */ - @JsonProperty("total_healthcare") - @ExcludeMissing - fun _totalHealthcare(): JsonField = totalHealthcare + enum class Value { + CARD_AUTHORIZATION_EXPIRATION, + /** + * An enum member indicating that [Type] was instantiated with an unknown value. + */ + _UNKNOWN, + } /** - * Returns the raw JSON value of [transit]. + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. * - * Unlike [transit], this method doesn't throw if the JSON field has an unexpected - * type. + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. */ - @JsonProperty("transit") - @ExcludeMissing - fun _transit(): JsonField = transit + fun value(): Value = + when (this) { + CARD_AUTHORIZATION_EXPIRATION -> Value.CARD_AUTHORIZATION_EXPIRATION + else -> Value._UNKNOWN + } /** - * Returns the raw JSON value of [unknown]. + * Returns an enum member corresponding to this class instance's value. * - * Unlike [unknown], this method doesn't throw if the JSON field has an unexpected - * type. + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not a + * known member. */ - @JsonProperty("unknown") - @ExcludeMissing - fun _unknown(): JsonField = unknown + fun known(): Known = + when (this) { + CARD_AUTHORIZATION_EXPIRATION -> Known.CARD_AUTHORIZATION_EXPIRATION + else -> throw IncreaseInvalidDataException("Unknown Type: $value") + } /** - * Returns the raw JSON value of [vision]. + * Returns this class instance's primitive wire representation. * - * Unlike [vision], this method doesn't throw if the JSON field has an unexpected - * type. + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not have + * the expected primitive type. */ - @JsonProperty("vision") @ExcludeMissing fun _vision(): JsonField = vision - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - fun toBuilder() = Builder().from(this) + private var validated: Boolean = false - companion object { + fun validate(): Type = apply { + if (validated) { + return@apply + } - /** - * Returns a mutable builder for constructing an instance of - * [AdditionalAmounts]. - * - * The following fields are required: - * ```java - * .clinic() - * .dental() - * .original() - * .prescription() - * .surcharge() - * .totalCumulative() - * .totalHealthcare() - * .transit() - * .unknown() - * .vision() - * ``` - */ - @JvmStatic fun builder() = Builder() + known() + validated = true } - /** A builder for [AdditionalAmounts]. */ - class Builder internal constructor() { + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - private var clinic: JsonField? = null - private var dental: JsonField? = null - private var original: JsonField? = null - private var prescription: JsonField? = null - private var surcharge: JsonField? = null - private var totalCumulative: JsonField? = null - private var totalHealthcare: JsonField? = null - private var transit: JsonField? = null - private var unknown: JsonField? = null - private var vision: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - @JvmSynthetic - internal fun from(additionalAmounts: AdditionalAmounts) = apply { - clinic = additionalAmounts.clinic - dental = additionalAmounts.dental - original = additionalAmounts.original - prescription = additionalAmounts.prescription - surcharge = additionalAmounts.surcharge - totalCumulative = additionalAmounts.totalCumulative - totalHealthcare = additionalAmounts.totalHealthcare - transit = additionalAmounts.transit - unknown = additionalAmounts.unknown - vision = additionalAmounts.vision - additionalProperties = additionalAmounts.additionalProperties.toMutableMap() + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - /** The part of this transaction amount that was for clinic-related services. */ - fun clinic(clinic: Clinic?) = clinic(JsonField.ofNullable(clinic)) + return other is Type && value == other.value + } - /** Alias for calling [Builder.clinic] with `clinic.orElse(null)`. */ - fun clinic(clinic: Optional) = clinic(clinic.getOrNull()) + override fun hashCode() = value.hashCode() - /** - * Sets [Builder.clinic] to an arbitrary JSON value. - * - * You should usually call [Builder.clinic] with a well-typed [Clinic] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun clinic(clinic: JsonField) = apply { this.clinic = clinic } + override fun toString() = value.toString() + } - /** The part of this transaction amount that was for dental-related services. */ - fun dental(dental: Dental?) = dental(JsonField.ofNullable(dental)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** Alias for calling [Builder.dental] with `dental.orElse(null)`. */ - fun dental(dental: Optional) = dental(dental.getOrNull()) + return other is CardAuthorizationExpiration && + id == other.id && + cardAuthorizationId == other.cardAuthorizationId && + currency == other.currency && + expiredAmount == other.expiredAmount && + network == other.network && + type == other.type && + additionalProperties == other.additionalProperties + } - /** - * Sets [Builder.dental] to an arbitrary JSON value. - * - * You should usually call [Builder.dental] with a well-typed [Dental] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun dental(dental: JsonField) = apply { this.dental = dental } + private val hashCode: Int by lazy { + Objects.hash( + id, + cardAuthorizationId, + currency, + expiredAmount, + network, + type, + additionalProperties, + ) + } - /** The original pre-authorized amount. */ - fun original(original: Original?) = original(JsonField.ofNullable(original)) + override fun hashCode(): Int = hashCode - /** Alias for calling [Builder.original] with `original.orElse(null)`. */ - fun original(original: Optional) = original(original.getOrNull()) + override fun toString() = + "CardAuthorizationExpiration{id=$id, cardAuthorizationId=$cardAuthorizationId, currency=$currency, expiredAmount=$expiredAmount, network=$network, type=$type, additionalProperties=$additionalProperties}" + } - /** - * Sets [Builder.original] to an arbitrary JSON value. - * - * You should usually call [Builder.original] with a well-typed [Original] value + /** + * A Card Balance Inquiry object. This field will be present in the JSON response if and + * only if `category` is equal to `card_balance_inquiry`. Card Balance Inquiries are + * transactions that allow merchants to check the available balance on a card without + * placing a hold on funds, commonly used when a customer requests their balance at an ATM. + */ + class CardBalanceInquiry + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val additionalAmounts: JsonField, + private val balance: JsonField, + private val cardPaymentId: JsonField, + private val currency: JsonField, + private val digitalWalletTokenId: JsonField, + private val merchantAcceptorId: JsonField, + private val merchantCategoryCode: JsonField, + private val merchantCity: JsonField, + private val merchantCountry: JsonField, + private val merchantDescriptor: JsonField, + private val merchantPostalCode: JsonField, + private val merchantState: JsonField, + private val networkDetails: JsonField, + private val networkIdentifiers: JsonField, + private val networkRiskScore: JsonField, + private val physicalCardId: JsonField, + private val realTimeDecisionId: JsonField, + private val schemeFees: JsonField>, + private val terminalId: JsonField, + private val type: JsonField, + private val verification: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("additional_amounts") + @ExcludeMissing + additionalAmounts: JsonField = JsonMissing.of(), + @JsonProperty("balance") + @ExcludeMissing + balance: JsonField = JsonMissing.of(), + @JsonProperty("card_payment_id") + @ExcludeMissing + cardPaymentId: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("digital_wallet_token_id") + @ExcludeMissing + digitalWalletTokenId: JsonField = JsonMissing.of(), + @JsonProperty("merchant_acceptor_id") + @ExcludeMissing + merchantAcceptorId: JsonField = JsonMissing.of(), + @JsonProperty("merchant_category_code") + @ExcludeMissing + merchantCategoryCode: JsonField = JsonMissing.of(), + @JsonProperty("merchant_city") + @ExcludeMissing + merchantCity: JsonField = JsonMissing.of(), + @JsonProperty("merchant_country") + @ExcludeMissing + merchantCountry: JsonField = JsonMissing.of(), + @JsonProperty("merchant_descriptor") + @ExcludeMissing + merchantDescriptor: JsonField = JsonMissing.of(), + @JsonProperty("merchant_postal_code") + @ExcludeMissing + merchantPostalCode: JsonField = JsonMissing.of(), + @JsonProperty("merchant_state") + @ExcludeMissing + merchantState: JsonField = JsonMissing.of(), + @JsonProperty("network_details") + @ExcludeMissing + networkDetails: JsonField = JsonMissing.of(), + @JsonProperty("network_identifiers") + @ExcludeMissing + networkIdentifiers: JsonField = JsonMissing.of(), + @JsonProperty("network_risk_score") + @ExcludeMissing + networkRiskScore: JsonField = JsonMissing.of(), + @JsonProperty("physical_card_id") + @ExcludeMissing + physicalCardId: JsonField = JsonMissing.of(), + @JsonProperty("real_time_decision_id") + @ExcludeMissing + realTimeDecisionId: JsonField = JsonMissing.of(), + @JsonProperty("scheme_fees") + @ExcludeMissing + schemeFees: JsonField> = JsonMissing.of(), + @JsonProperty("terminal_id") + @ExcludeMissing + terminalId: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("verification") + @ExcludeMissing + verification: JsonField = JsonMissing.of(), + ) : this( + id, + additionalAmounts, + balance, + cardPaymentId, + currency, + digitalWalletTokenId, + merchantAcceptorId, + merchantCategoryCode, + merchantCity, + merchantCountry, + merchantDescriptor, + merchantPostalCode, + merchantState, + networkDetails, + networkIdentifiers, + networkRiskScore, + physicalCardId, + realTimeDecisionId, + schemeFees, + terminalId, + type, + verification, + mutableMapOf(), + ) + + /** + * The Card Balance Inquiry identifier. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun id(): String = id.getRequired("id") + + /** + * Additional amounts associated with the card authorization, such as ATM surcharges + * fees. These are usually a subset of the `amount` field and are used to provide more + * detailed information about the transaction. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun additionalAmounts(): AdditionalAmounts = + additionalAmounts.getRequired("additional_amounts") + + /** + * The balance amount in the minor unit of the account's currency. For dollars, for + * example, this is cents. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun balance(): Long = balance.getRequired("balance") + + /** + * The ID of the Card Payment this transaction belongs to. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun cardPaymentId(): String = cardPaymentId.getRequired("card_payment_id") + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the account's + * currency. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun currency(): Currency = currency.getRequired("currency") + + /** + * If the authorization was made via a Digital Wallet Token (such as an Apple Pay + * purchase), the identifier of the token that was used. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun digitalWalletTokenId(): Optional = + digitalWalletTokenId.getOptional("digital_wallet_token_id") + + /** + * The merchant identifier (commonly abbreviated as MID) of the merchant the card is + * transacting with. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun merchantAcceptorId(): String = + merchantAcceptorId.getRequired("merchant_acceptor_id") + + /** + * The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card is + * transacting with. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun merchantCategoryCode(): String = + merchantCategoryCode.getRequired("merchant_category_code") + + /** + * The city the merchant resides in. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun merchantCity(): Optional = merchantCity.getOptional("merchant_city") + + /** + * The country the merchant resides in. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun merchantCountry(): String = merchantCountry.getRequired("merchant_country") + + /** + * The merchant descriptor of the merchant the card is transacting with. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun merchantDescriptor(): String = merchantDescriptor.getRequired("merchant_descriptor") + + /** + * The merchant's postal code. For US merchants this is either a 5-digit or 9-digit ZIP + * code, where the first 5 and last 4 are separated by a dash. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun merchantPostalCode(): Optional = + merchantPostalCode.getOptional("merchant_postal_code") + + /** + * The state the merchant resides in. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun merchantState(): Optional = merchantState.getOptional("merchant_state") + + /** + * Fields specific to the `network`. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun networkDetails(): NetworkDetails = networkDetails.getRequired("network_details") + + /** + * Network-specific identifiers for a specific request or transaction. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun networkIdentifiers(): NetworkIdentifiers = + networkIdentifiers.getRequired("network_identifiers") + + /** + * The risk score generated by the card network. For Visa this is the Visa Advanced + * Authorization risk score, from 0 to 99, where 99 is the riskiest. For Pulse the score + * is from 0 to 999, where 999 is the riskiest. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun networkRiskScore(): Optional = + networkRiskScore.getOptional("network_risk_score") + + /** + * If the authorization was made in-person with a physical card, the Physical Card that + * was used. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun physicalCardId(): Optional = physicalCardId.getOptional("physical_card_id") + + /** + * The identifier of the Real-Time Decision sent to approve or decline this transaction. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun realTimeDecisionId(): Optional = + realTimeDecisionId.getOptional("real_time_decision_id") + + /** + * The scheme fees associated with this card balance inquiry. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun schemeFees(): List = schemeFees.getRequired("scheme_fees") + + /** + * The terminal identifier (commonly abbreviated as TID) of the terminal the card is + * transacting with. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun terminalId(): Optional = terminalId.getOptional("terminal_id") + + /** + * A constant representing the object's type. For this resource it will always be + * `card_balance_inquiry`. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun type(): Type = type.getRequired("type") + + /** + * Fields related to verification of cardholder-provided values. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun verification(): Verification = verification.getRequired("verification") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [additionalAmounts]. + * + * Unlike [additionalAmounts], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("additional_amounts") + @ExcludeMissing + fun _additionalAmounts(): JsonField = additionalAmounts + + /** + * Returns the raw JSON value of [balance]. + * + * Unlike [balance], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("balance") @ExcludeMissing fun _balance(): JsonField = balance + + /** + * Returns the raw JSON value of [cardPaymentId]. + * + * Unlike [cardPaymentId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("card_payment_id") + @ExcludeMissing + fun _cardPaymentId(): JsonField = cardPaymentId + + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("currency") + @ExcludeMissing + fun _currency(): JsonField = currency + + /** + * Returns the raw JSON value of [digitalWalletTokenId]. + * + * Unlike [digitalWalletTokenId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("digital_wallet_token_id") + @ExcludeMissing + fun _digitalWalletTokenId(): JsonField = digitalWalletTokenId + + /** + * Returns the raw JSON value of [merchantAcceptorId]. + * + * Unlike [merchantAcceptorId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("merchant_acceptor_id") + @ExcludeMissing + fun _merchantAcceptorId(): JsonField = merchantAcceptorId + + /** + * Returns the raw JSON value of [merchantCategoryCode]. + * + * Unlike [merchantCategoryCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("merchant_category_code") + @ExcludeMissing + fun _merchantCategoryCode(): JsonField = merchantCategoryCode + + /** + * Returns the raw JSON value of [merchantCity]. + * + * Unlike [merchantCity], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("merchant_city") + @ExcludeMissing + fun _merchantCity(): JsonField = merchantCity + + /** + * Returns the raw JSON value of [merchantCountry]. + * + * Unlike [merchantCountry], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("merchant_country") + @ExcludeMissing + fun _merchantCountry(): JsonField = merchantCountry + + /** + * Returns the raw JSON value of [merchantDescriptor]. + * + * Unlike [merchantDescriptor], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("merchant_descriptor") + @ExcludeMissing + fun _merchantDescriptor(): JsonField = merchantDescriptor + + /** + * Returns the raw JSON value of [merchantPostalCode]. + * + * Unlike [merchantPostalCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("merchant_postal_code") + @ExcludeMissing + fun _merchantPostalCode(): JsonField = merchantPostalCode + + /** + * Returns the raw JSON value of [merchantState]. + * + * Unlike [merchantState], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("merchant_state") + @ExcludeMissing + fun _merchantState(): JsonField = merchantState + + /** + * Returns the raw JSON value of [networkDetails]. + * + * Unlike [networkDetails], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("network_details") + @ExcludeMissing + fun _networkDetails(): JsonField = networkDetails + + /** + * Returns the raw JSON value of [networkIdentifiers]. + * + * Unlike [networkIdentifiers], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("network_identifiers") + @ExcludeMissing + fun _networkIdentifiers(): JsonField = networkIdentifiers + + /** + * Returns the raw JSON value of [networkRiskScore]. + * + * Unlike [networkRiskScore], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("network_risk_score") + @ExcludeMissing + fun _networkRiskScore(): JsonField = networkRiskScore + + /** + * Returns the raw JSON value of [physicalCardId]. + * + * Unlike [physicalCardId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("physical_card_id") + @ExcludeMissing + fun _physicalCardId(): JsonField = physicalCardId + + /** + * Returns the raw JSON value of [realTimeDecisionId]. + * + * Unlike [realTimeDecisionId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("real_time_decision_id") + @ExcludeMissing + fun _realTimeDecisionId(): JsonField = realTimeDecisionId + + /** + * Returns the raw JSON value of [schemeFees]. + * + * Unlike [schemeFees], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("scheme_fees") + @ExcludeMissing + fun _schemeFees(): JsonField> = schemeFees + + /** + * Returns the raw JSON value of [terminalId]. + * + * Unlike [terminalId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("terminal_id") + @ExcludeMissing + fun _terminalId(): JsonField = terminalId + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [verification]. + * + * Unlike [verification], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("verification") + @ExcludeMissing + fun _verification(): JsonField = verification + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [CardBalanceInquiry]. + * + * The following fields are required: + * ```java + * .id() + * .additionalAmounts() + * .balance() + * .cardPaymentId() + * .currency() + * .digitalWalletTokenId() + * .merchantAcceptorId() + * .merchantCategoryCode() + * .merchantCity() + * .merchantCountry() + * .merchantDescriptor() + * .merchantPostalCode() + * .merchantState() + * .networkDetails() + * .networkIdentifiers() + * .networkRiskScore() + * .physicalCardId() + * .realTimeDecisionId() + * .schemeFees() + * .terminalId() + * .type() + * .verification() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [CardBalanceInquiry]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var additionalAmounts: JsonField? = null + private var balance: JsonField? = null + private var cardPaymentId: JsonField? = null + private var currency: JsonField? = null + private var digitalWalletTokenId: JsonField? = null + private var merchantAcceptorId: JsonField? = null + private var merchantCategoryCode: JsonField? = null + private var merchantCity: JsonField? = null + private var merchantCountry: JsonField? = null + private var merchantDescriptor: JsonField? = null + private var merchantPostalCode: JsonField? = null + private var merchantState: JsonField? = null + private var networkDetails: JsonField? = null + private var networkIdentifiers: JsonField? = null + private var networkRiskScore: JsonField? = null + private var physicalCardId: JsonField? = null + private var realTimeDecisionId: JsonField? = null + private var schemeFees: JsonField>? = null + private var terminalId: JsonField? = null + private var type: JsonField? = null + private var verification: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(cardBalanceInquiry: CardBalanceInquiry) = apply { + id = cardBalanceInquiry.id + additionalAmounts = cardBalanceInquiry.additionalAmounts + balance = cardBalanceInquiry.balance + cardPaymentId = cardBalanceInquiry.cardPaymentId + currency = cardBalanceInquiry.currency + digitalWalletTokenId = cardBalanceInquiry.digitalWalletTokenId + merchantAcceptorId = cardBalanceInquiry.merchantAcceptorId + merchantCategoryCode = cardBalanceInquiry.merchantCategoryCode + merchantCity = cardBalanceInquiry.merchantCity + merchantCountry = cardBalanceInquiry.merchantCountry + merchantDescriptor = cardBalanceInquiry.merchantDescriptor + merchantPostalCode = cardBalanceInquiry.merchantPostalCode + merchantState = cardBalanceInquiry.merchantState + networkDetails = cardBalanceInquiry.networkDetails + networkIdentifiers = cardBalanceInquiry.networkIdentifiers + networkRiskScore = cardBalanceInquiry.networkRiskScore + physicalCardId = cardBalanceInquiry.physicalCardId + realTimeDecisionId = cardBalanceInquiry.realTimeDecisionId + schemeFees = cardBalanceInquiry.schemeFees.map { it.toMutableList() } + terminalId = cardBalanceInquiry.terminalId + type = cardBalanceInquiry.type + verification = cardBalanceInquiry.verification + additionalProperties = cardBalanceInquiry.additionalProperties.toMutableMap() + } + + /** The Card Balance Inquiry identifier. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** + * Additional amounts associated with the card authorization, such as ATM surcharges + * fees. These are usually a subset of the `amount` field and are used to provide + * more detailed information about the transaction. + */ + fun additionalAmounts(additionalAmounts: AdditionalAmounts) = + additionalAmounts(JsonField.of(additionalAmounts)) + + /** + * Sets [Builder.additionalAmounts] to an arbitrary JSON value. + * + * You should usually call [Builder.additionalAmounts] with a well-typed + * [AdditionalAmounts] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun additionalAmounts(additionalAmounts: JsonField) = apply { + this.additionalAmounts = additionalAmounts + } + + /** + * The balance amount in the minor unit of the account's currency. For dollars, for + * example, this is cents. + */ + fun balance(balance: Long) = balance(JsonField.of(balance)) + + /** + * Sets [Builder.balance] to an arbitrary JSON value. + * + * You should usually call [Builder.balance] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun balance(balance: JsonField) = apply { this.balance = balance } + + /** The ID of the Card Payment this transaction belongs to. */ + fun cardPaymentId(cardPaymentId: String) = + cardPaymentId(JsonField.of(cardPaymentId)) + + /** + * Sets [Builder.cardPaymentId] to an arbitrary JSON value. + * + * You should usually call [Builder.cardPaymentId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun cardPaymentId(cardPaymentId: JsonField) = apply { + this.cardPaymentId = cardPaymentId + } + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the account's + * currency. + */ + fun currency(currency: Currency) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [Currency] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } + + /** + * If the authorization was made via a Digital Wallet Token (such as an Apple Pay + * purchase), the identifier of the token that was used. + */ + fun digitalWalletTokenId(digitalWalletTokenId: String?) = + digitalWalletTokenId(JsonField.ofNullable(digitalWalletTokenId)) + + /** + * Alias for calling [Builder.digitalWalletTokenId] with + * `digitalWalletTokenId.orElse(null)`. + */ + fun digitalWalletTokenId(digitalWalletTokenId: Optional) = + digitalWalletTokenId(digitalWalletTokenId.getOrNull()) + + /** + * Sets [Builder.digitalWalletTokenId] to an arbitrary JSON value. + * + * You should usually call [Builder.digitalWalletTokenId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun digitalWalletTokenId(digitalWalletTokenId: JsonField) = apply { + this.digitalWalletTokenId = digitalWalletTokenId + } + + /** + * The merchant identifier (commonly abbreviated as MID) of the merchant the card is + * transacting with. + */ + fun merchantAcceptorId(merchantAcceptorId: String) = + merchantAcceptorId(JsonField.of(merchantAcceptorId)) + + /** + * Sets [Builder.merchantAcceptorId] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantAcceptorId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun merchantAcceptorId(merchantAcceptorId: JsonField) = apply { + this.merchantAcceptorId = merchantAcceptorId + } + + /** + * The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card + * is transacting with. + */ + fun merchantCategoryCode(merchantCategoryCode: String) = + merchantCategoryCode(JsonField.of(merchantCategoryCode)) + + /** + * Sets [Builder.merchantCategoryCode] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantCategoryCode] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun merchantCategoryCode(merchantCategoryCode: JsonField) = apply { + this.merchantCategoryCode = merchantCategoryCode + } + + /** The city the merchant resides in. */ + fun merchantCity(merchantCity: String?) = + merchantCity(JsonField.ofNullable(merchantCity)) + + /** Alias for calling [Builder.merchantCity] with `merchantCity.orElse(null)`. */ + fun merchantCity(merchantCity: Optional) = + merchantCity(merchantCity.getOrNull()) + + /** + * Sets [Builder.merchantCity] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantCity] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun merchantCity(merchantCity: JsonField) = apply { + this.merchantCity = merchantCity + } + + /** The country the merchant resides in. */ + fun merchantCountry(merchantCountry: String) = + merchantCountry(JsonField.of(merchantCountry)) + + /** + * Sets [Builder.merchantCountry] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantCountry] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun merchantCountry(merchantCountry: JsonField) = apply { + this.merchantCountry = merchantCountry + } + + /** The merchant descriptor of the merchant the card is transacting with. */ + fun merchantDescriptor(merchantDescriptor: String) = + merchantDescriptor(JsonField.of(merchantDescriptor)) + + /** + * Sets [Builder.merchantDescriptor] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantDescriptor] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun merchantDescriptor(merchantDescriptor: JsonField) = apply { + this.merchantDescriptor = merchantDescriptor + } + + /** + * The merchant's postal code. For US merchants this is either a 5-digit or 9-digit + * ZIP code, where the first 5 and last 4 are separated by a dash. + */ + fun merchantPostalCode(merchantPostalCode: String?) = + merchantPostalCode(JsonField.ofNullable(merchantPostalCode)) + + /** + * Alias for calling [Builder.merchantPostalCode] with + * `merchantPostalCode.orElse(null)`. + */ + fun merchantPostalCode(merchantPostalCode: Optional) = + merchantPostalCode(merchantPostalCode.getOrNull()) + + /** + * Sets [Builder.merchantPostalCode] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantPostalCode] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun merchantPostalCode(merchantPostalCode: JsonField) = apply { + this.merchantPostalCode = merchantPostalCode + } + + /** The state the merchant resides in. */ + fun merchantState(merchantState: String?) = + merchantState(JsonField.ofNullable(merchantState)) + + /** Alias for calling [Builder.merchantState] with `merchantState.orElse(null)`. */ + fun merchantState(merchantState: Optional) = + merchantState(merchantState.getOrNull()) + + /** + * Sets [Builder.merchantState] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantState] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun merchantState(merchantState: JsonField) = apply { + this.merchantState = merchantState + } + + /** Fields specific to the `network`. */ + fun networkDetails(networkDetails: NetworkDetails) = + networkDetails(JsonField.of(networkDetails)) + + /** + * Sets [Builder.networkDetails] to an arbitrary JSON value. + * + * You should usually call [Builder.networkDetails] with a well-typed + * [NetworkDetails] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun networkDetails(networkDetails: JsonField) = apply { + this.networkDetails = networkDetails + } + + /** Network-specific identifiers for a specific request or transaction. */ + fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) = + networkIdentifiers(JsonField.of(networkIdentifiers)) + + /** + * Sets [Builder.networkIdentifiers] to an arbitrary JSON value. + * + * You should usually call [Builder.networkIdentifiers] with a well-typed + * [NetworkIdentifiers] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun networkIdentifiers(networkIdentifiers: JsonField) = apply { + this.networkIdentifiers = networkIdentifiers + } + + /** + * The risk score generated by the card network. For Visa this is the Visa Advanced + * Authorization risk score, from 0 to 99, where 99 is the riskiest. For Pulse the + * score is from 0 to 999, where 999 is the riskiest. + */ + fun networkRiskScore(networkRiskScore: Long?) = + networkRiskScore(JsonField.ofNullable(networkRiskScore)) + + /** + * Alias for [Builder.networkRiskScore]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun networkRiskScore(networkRiskScore: Long) = + networkRiskScore(networkRiskScore as Long?) + + /** + * Alias for calling [Builder.networkRiskScore] with + * `networkRiskScore.orElse(null)`. + */ + fun networkRiskScore(networkRiskScore: Optional) = + networkRiskScore(networkRiskScore.getOrNull()) + + /** + * Sets [Builder.networkRiskScore] to an arbitrary JSON value. + * + * You should usually call [Builder.networkRiskScore] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun networkRiskScore(networkRiskScore: JsonField) = apply { + this.networkRiskScore = networkRiskScore + } + + /** + * If the authorization was made in-person with a physical card, the Physical Card + * that was used. + */ + fun physicalCardId(physicalCardId: String?) = + physicalCardId(JsonField.ofNullable(physicalCardId)) + + /** + * Alias for calling [Builder.physicalCardId] with `physicalCardId.orElse(null)`. + */ + fun physicalCardId(physicalCardId: Optional) = + physicalCardId(physicalCardId.getOrNull()) + + /** + * Sets [Builder.physicalCardId] to an arbitrary JSON value. + * + * You should usually call [Builder.physicalCardId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun physicalCardId(physicalCardId: JsonField) = apply { + this.physicalCardId = physicalCardId + } + + /** + * The identifier of the Real-Time Decision sent to approve or decline this + * transaction. + */ + fun realTimeDecisionId(realTimeDecisionId: String?) = + realTimeDecisionId(JsonField.ofNullable(realTimeDecisionId)) + + /** + * Alias for calling [Builder.realTimeDecisionId] with + * `realTimeDecisionId.orElse(null)`. + */ + fun realTimeDecisionId(realTimeDecisionId: Optional) = + realTimeDecisionId(realTimeDecisionId.getOrNull()) + + /** + * Sets [Builder.realTimeDecisionId] to an arbitrary JSON value. + * + * You should usually call [Builder.realTimeDecisionId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun realTimeDecisionId(realTimeDecisionId: JsonField) = apply { + this.realTimeDecisionId = realTimeDecisionId + } + + /** The scheme fees associated with this card balance inquiry. */ + fun schemeFees(schemeFees: List) = schemeFees(JsonField.of(schemeFees)) + + /** + * Sets [Builder.schemeFees] to an arbitrary JSON value. + * + * You should usually call [Builder.schemeFees] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun schemeFees(schemeFees: JsonField>) = apply { + this.schemeFees = schemeFees.map { it.toMutableList() } + } + + /** + * Adds a single [SchemeFee] to [schemeFees]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addSchemeFee(schemeFee: SchemeFee) = apply { + schemeFees = + (schemeFees ?: JsonField.of(mutableListOf())).also { + checkKnown("schemeFees", it).add(schemeFee) + } + } + + /** + * The terminal identifier (commonly abbreviated as TID) of the terminal the card is + * transacting with. + */ + fun terminalId(terminalId: String?) = terminalId(JsonField.ofNullable(terminalId)) + + /** Alias for calling [Builder.terminalId] with `terminalId.orElse(null)`. */ + fun terminalId(terminalId: Optional) = terminalId(terminalId.getOrNull()) + + /** + * Sets [Builder.terminalId] to an arbitrary JSON value. + * + * You should usually call [Builder.terminalId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun terminalId(terminalId: JsonField) = apply { + this.terminalId = terminalId + } + + /** + * A constant representing the object's type. For this resource it will always be + * `card_balance_inquiry`. + */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** Fields related to verification of cardholder-provided values. */ + fun verification(verification: Verification) = + verification(JsonField.of(verification)) + + /** + * Sets [Builder.verification] to an arbitrary JSON value. + * + * You should usually call [Builder.verification] with a well-typed [Verification] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun verification(verification: JsonField) = apply { + this.verification = verification + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [CardBalanceInquiry]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .additionalAmounts() + * .balance() + * .cardPaymentId() + * .currency() + * .digitalWalletTokenId() + * .merchantAcceptorId() + * .merchantCategoryCode() + * .merchantCity() + * .merchantCountry() + * .merchantDescriptor() + * .merchantPostalCode() + * .merchantState() + * .networkDetails() + * .networkIdentifiers() + * .networkRiskScore() + * .physicalCardId() + * .realTimeDecisionId() + * .schemeFees() + * .terminalId() + * .type() + * .verification() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CardBalanceInquiry = + CardBalanceInquiry( + checkRequired("id", id), + checkRequired("additionalAmounts", additionalAmounts), + checkRequired("balance", balance), + checkRequired("cardPaymentId", cardPaymentId), + checkRequired("currency", currency), + checkRequired("digitalWalletTokenId", digitalWalletTokenId), + checkRequired("merchantAcceptorId", merchantAcceptorId), + checkRequired("merchantCategoryCode", merchantCategoryCode), + checkRequired("merchantCity", merchantCity), + checkRequired("merchantCountry", merchantCountry), + checkRequired("merchantDescriptor", merchantDescriptor), + checkRequired("merchantPostalCode", merchantPostalCode), + checkRequired("merchantState", merchantState), + checkRequired("networkDetails", networkDetails), + checkRequired("networkIdentifiers", networkIdentifiers), + checkRequired("networkRiskScore", networkRiskScore), + checkRequired("physicalCardId", physicalCardId), + checkRequired("realTimeDecisionId", realTimeDecisionId), + checkRequired("schemeFees", schemeFees).map { it.toImmutable() }, + checkRequired("terminalId", terminalId), + checkRequired("type", type), + checkRequired("verification", verification), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): CardBalanceInquiry = apply { + if (validated) { + return@apply + } + + id() + additionalAmounts().validate() + balance() + cardPaymentId() + currency().validate() + digitalWalletTokenId() + merchantAcceptorId() + merchantCategoryCode() + merchantCity() + merchantCountry() + merchantDescriptor() + merchantPostalCode() + merchantState() + networkDetails().validate() + networkIdentifiers().validate() + networkRiskScore() + physicalCardId() + realTimeDecisionId() + schemeFees().forEach { it.validate() } + terminalId() + type().validate() + verification().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (additionalAmounts.asKnown().getOrNull()?.validity() ?: 0) + + (if (balance.asKnown().isPresent) 1 else 0) + + (if (cardPaymentId.asKnown().isPresent) 1 else 0) + + (currency.asKnown().getOrNull()?.validity() ?: 0) + + (if (digitalWalletTokenId.asKnown().isPresent) 1 else 0) + + (if (merchantAcceptorId.asKnown().isPresent) 1 else 0) + + (if (merchantCategoryCode.asKnown().isPresent) 1 else 0) + + (if (merchantCity.asKnown().isPresent) 1 else 0) + + (if (merchantCountry.asKnown().isPresent) 1 else 0) + + (if (merchantDescriptor.asKnown().isPresent) 1 else 0) + + (if (merchantPostalCode.asKnown().isPresent) 1 else 0) + + (if (merchantState.asKnown().isPresent) 1 else 0) + + (networkDetails.asKnown().getOrNull()?.validity() ?: 0) + + (networkIdentifiers.asKnown().getOrNull()?.validity() ?: 0) + + (if (networkRiskScore.asKnown().isPresent) 1 else 0) + + (if (physicalCardId.asKnown().isPresent) 1 else 0) + + (if (realTimeDecisionId.asKnown().isPresent) 1 else 0) + + (schemeFees.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (terminalId.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (verification.asKnown().getOrNull()?.validity() ?: 0) + + /** + * Additional amounts associated with the card authorization, such as ATM surcharges + * fees. These are usually a subset of the `amount` field and are used to provide more + * detailed information about the transaction. + */ + class AdditionalAmounts + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val clinic: JsonField, + private val dental: JsonField, + private val original: JsonField, + private val prescription: JsonField, + private val surcharge: JsonField, + private val totalCumulative: JsonField, + private val totalHealthcare: JsonField, + private val transit: JsonField, + private val unknown: JsonField, + private val vision: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("clinic") + @ExcludeMissing + clinic: JsonField = JsonMissing.of(), + @JsonProperty("dental") + @ExcludeMissing + dental: JsonField = JsonMissing.of(), + @JsonProperty("original") + @ExcludeMissing + original: JsonField = JsonMissing.of(), + @JsonProperty("prescription") + @ExcludeMissing + prescription: JsonField = JsonMissing.of(), + @JsonProperty("surcharge") + @ExcludeMissing + surcharge: JsonField = JsonMissing.of(), + @JsonProperty("total_cumulative") + @ExcludeMissing + totalCumulative: JsonField = JsonMissing.of(), + @JsonProperty("total_healthcare") + @ExcludeMissing + totalHealthcare: JsonField = JsonMissing.of(), + @JsonProperty("transit") + @ExcludeMissing + transit: JsonField = JsonMissing.of(), + @JsonProperty("unknown") + @ExcludeMissing + unknown: JsonField = JsonMissing.of(), + @JsonProperty("vision") + @ExcludeMissing + vision: JsonField = JsonMissing.of(), + ) : this( + clinic, + dental, + original, + prescription, + surcharge, + totalCumulative, + totalHealthcare, + transit, + unknown, + vision, + mutableMapOf(), + ) + + /** + * The part of this transaction amount that was for clinic-related services. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun clinic(): Optional = clinic.getOptional("clinic") + + /** + * The part of this transaction amount that was for dental-related services. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun dental(): Optional = dental.getOptional("dental") + + /** + * The original pre-authorized amount. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun original(): Optional = original.getOptional("original") + + /** + * The part of this transaction amount that was for healthcare prescriptions. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun prescription(): Optional = + prescription.getOptional("prescription") + + /** + * The surcharge amount charged for this transaction by the merchant. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun surcharge(): Optional = surcharge.getOptional("surcharge") + + /** + * The total amount of a series of incremental authorizations, optionally provided. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun totalCumulative(): Optional = + totalCumulative.getOptional("total_cumulative") + + /** + * The total amount of healthcare-related additional amounts. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun totalHealthcare(): Optional = + totalHealthcare.getOptional("total_healthcare") + + /** + * The part of this transaction amount that was for transit-related services. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun transit(): Optional = transit.getOptional("transit") + + /** + * An unknown additional amount. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun unknown(): Optional = unknown.getOptional("unknown") + + /** + * The part of this transaction amount that was for vision-related services. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun vision(): Optional = vision.getOptional("vision") + + /** + * Returns the raw JSON value of [clinic]. + * + * Unlike [clinic], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("clinic") @ExcludeMissing fun _clinic(): JsonField = clinic + + /** + * Returns the raw JSON value of [dental]. + * + * Unlike [dental], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dental") @ExcludeMissing fun _dental(): JsonField = dental + + /** + * Returns the raw JSON value of [original]. + * + * Unlike [original], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("original") + @ExcludeMissing + fun _original(): JsonField = original + + /** + * Returns the raw JSON value of [prescription]. + * + * Unlike [prescription], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("prescription") + @ExcludeMissing + fun _prescription(): JsonField = prescription + + /** + * Returns the raw JSON value of [surcharge]. + * + * Unlike [surcharge], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("surcharge") + @ExcludeMissing + fun _surcharge(): JsonField = surcharge + + /** + * Returns the raw JSON value of [totalCumulative]. + * + * Unlike [totalCumulative], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("total_cumulative") + @ExcludeMissing + fun _totalCumulative(): JsonField = totalCumulative + + /** + * Returns the raw JSON value of [totalHealthcare]. + * + * Unlike [totalHealthcare], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("total_healthcare") + @ExcludeMissing + fun _totalHealthcare(): JsonField = totalHealthcare + + /** + * Returns the raw JSON value of [transit]. + * + * Unlike [transit], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("transit") + @ExcludeMissing + fun _transit(): JsonField = transit + + /** + * Returns the raw JSON value of [unknown]. + * + * Unlike [unknown], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("unknown") + @ExcludeMissing + fun _unknown(): JsonField = unknown + + /** + * Returns the raw JSON value of [vision]. + * + * Unlike [vision], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("vision") @ExcludeMissing fun _vision(): JsonField = vision + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [AdditionalAmounts]. + * + * The following fields are required: + * ```java + * .clinic() + * .dental() + * .original() + * .prescription() + * .surcharge() + * .totalCumulative() + * .totalHealthcare() + * .transit() + * .unknown() + * .vision() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AdditionalAmounts]. */ + class Builder internal constructor() { + + private var clinic: JsonField? = null + private var dental: JsonField? = null + private var original: JsonField? = null + private var prescription: JsonField? = null + private var surcharge: JsonField? = null + private var totalCumulative: JsonField? = null + private var totalHealthcare: JsonField? = null + private var transit: JsonField? = null + private var unknown: JsonField? = null + private var vision: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(additionalAmounts: AdditionalAmounts) = apply { + clinic = additionalAmounts.clinic + dental = additionalAmounts.dental + original = additionalAmounts.original + prescription = additionalAmounts.prescription + surcharge = additionalAmounts.surcharge + totalCumulative = additionalAmounts.totalCumulative + totalHealthcare = additionalAmounts.totalHealthcare + transit = additionalAmounts.transit + unknown = additionalAmounts.unknown + vision = additionalAmounts.vision + additionalProperties = additionalAmounts.additionalProperties.toMutableMap() + } + + /** The part of this transaction amount that was for clinic-related services. */ + fun clinic(clinic: Clinic?) = clinic(JsonField.ofNullable(clinic)) + + /** Alias for calling [Builder.clinic] with `clinic.orElse(null)`. */ + fun clinic(clinic: Optional) = clinic(clinic.getOrNull()) + + /** + * Sets [Builder.clinic] to an arbitrary JSON value. + * + * You should usually call [Builder.clinic] with a well-typed [Clinic] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun clinic(clinic: JsonField) = apply { this.clinic = clinic } + + /** The part of this transaction amount that was for dental-related services. */ + fun dental(dental: Dental?) = dental(JsonField.ofNullable(dental)) + + /** Alias for calling [Builder.dental] with `dental.orElse(null)`. */ + fun dental(dental: Optional) = dental(dental.getOrNull()) + + /** + * Sets [Builder.dental] to an arbitrary JSON value. + * + * You should usually call [Builder.dental] with a well-typed [Dental] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dental(dental: JsonField) = apply { this.dental = dental } + + /** The original pre-authorized amount. */ + fun original(original: Original?) = original(JsonField.ofNullable(original)) + + /** Alias for calling [Builder.original] with `original.orElse(null)`. */ + fun original(original: Optional) = original(original.getOrNull()) + + /** + * Sets [Builder.original] to an arbitrary JSON value. + * + * You should usually call [Builder.original] with a well-typed [Original] value * instead. This method is primarily for setting the field to an undocumented or * not yet supported value. */ @@ -23224,11 +24600,403 @@ private constructor( private var validated: Boolean = false - fun validate(): Pulse = apply { + fun validate(): Pulse = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = 0 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Pulse && additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "Pulse{additionalProperties=$additionalProperties}" + } + + /** Fields specific to the `visa` network. */ + class Visa + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val electronicCommerceIndicator: JsonField, + private val pointOfServiceEntryMode: JsonField, + private val standInProcessingReason: JsonField, + private val terminalEntryCapability: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("electronic_commerce_indicator") + @ExcludeMissing + electronicCommerceIndicator: JsonField = + JsonMissing.of(), + @JsonProperty("point_of_service_entry_mode") + @ExcludeMissing + pointOfServiceEntryMode: JsonField = + JsonMissing.of(), + @JsonProperty("stand_in_processing_reason") + @ExcludeMissing + standInProcessingReason: JsonField = + JsonMissing.of(), + @JsonProperty("terminal_entry_capability") + @ExcludeMissing + terminalEntryCapability: JsonField = + JsonMissing.of(), + ) : this( + electronicCommerceIndicator, + pointOfServiceEntryMode, + standInProcessingReason, + terminalEntryCapability, + mutableMapOf(), + ) + + /** + * For electronic commerce transactions, this identifies the level of security + * used in obtaining the customer's payment credential. For mail or telephone + * order transactions, identifies the type of mail or telephone order. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun electronicCommerceIndicator(): Optional = + electronicCommerceIndicator.getOptional("electronic_commerce_indicator") + + /** + * The method used to enter the cardholder's primary account number and card + * expiration date. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun pointOfServiceEntryMode(): Optional = + pointOfServiceEntryMode.getOptional("point_of_service_entry_mode") + + /** + * Only present when `actioner: network`. Describes why a card authorization was + * approved or declined by Visa through stand-in processing. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun standInProcessingReason(): Optional = + standInProcessingReason.getOptional("stand_in_processing_reason") + + /** + * The capability of the terminal being used to read the card. Shows whether a + * terminal can e.g., accept chip cards or if it only supports magnetic stripe + * reads. This reflects the highest capability of the terminal — for example, a + * terminal that supports both chip and magnetic stripe will be identified as + * chip-capable. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun terminalEntryCapability(): Optional = + terminalEntryCapability.getOptional("terminal_entry_capability") + + /** + * Returns the raw JSON value of [electronicCommerceIndicator]. + * + * Unlike [electronicCommerceIndicator], this method doesn't throw if the JSON + * field has an unexpected type. + */ + @JsonProperty("electronic_commerce_indicator") + @ExcludeMissing + fun _electronicCommerceIndicator(): JsonField = + electronicCommerceIndicator + + /** + * Returns the raw JSON value of [pointOfServiceEntryMode]. + * + * Unlike [pointOfServiceEntryMode], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("point_of_service_entry_mode") + @ExcludeMissing + fun _pointOfServiceEntryMode(): JsonField = + pointOfServiceEntryMode + + /** + * Returns the raw JSON value of [standInProcessingReason]. + * + * Unlike [standInProcessingReason], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("stand_in_processing_reason") + @ExcludeMissing + fun _standInProcessingReason(): JsonField = + standInProcessingReason + + /** + * Returns the raw JSON value of [terminalEntryCapability]. + * + * Unlike [terminalEntryCapability], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("terminal_entry_capability") + @ExcludeMissing + fun _terminalEntryCapability(): JsonField = + terminalEntryCapability + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Visa]. + * + * The following fields are required: + * ```java + * .electronicCommerceIndicator() + * .pointOfServiceEntryMode() + * .standInProcessingReason() + * .terminalEntryCapability() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Visa]. */ + class Builder internal constructor() { + + private var electronicCommerceIndicator: + JsonField? = + null + private var pointOfServiceEntryMode: JsonField? = + null + private var standInProcessingReason: JsonField? = + null + private var terminalEntryCapability: JsonField? = + null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(visa: Visa) = apply { + electronicCommerceIndicator = visa.electronicCommerceIndicator + pointOfServiceEntryMode = visa.pointOfServiceEntryMode + standInProcessingReason = visa.standInProcessingReason + terminalEntryCapability = visa.terminalEntryCapability + additionalProperties = visa.additionalProperties.toMutableMap() + } + + /** + * For electronic commerce transactions, this identifies the level of + * security used in obtaining the customer's payment credential. For mail or + * telephone order transactions, identifies the type of mail or telephone + * order. + */ + fun electronicCommerceIndicator( + electronicCommerceIndicator: ElectronicCommerceIndicator? + ) = + electronicCommerceIndicator( + JsonField.ofNullable(electronicCommerceIndicator) + ) + + /** + * Alias for calling [Builder.electronicCommerceIndicator] with + * `electronicCommerceIndicator.orElse(null)`. + */ + fun electronicCommerceIndicator( + electronicCommerceIndicator: Optional + ) = electronicCommerceIndicator(electronicCommerceIndicator.getOrNull()) + + /** + * Sets [Builder.electronicCommerceIndicator] to an arbitrary JSON value. + * + * You should usually call [Builder.electronicCommerceIndicator] with a + * well-typed [ElectronicCommerceIndicator] value instead. This method is + * primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun electronicCommerceIndicator( + electronicCommerceIndicator: JsonField + ) = apply { this.electronicCommerceIndicator = electronicCommerceIndicator } + + /** + * The method used to enter the cardholder's primary account number and card + * expiration date. + */ + fun pointOfServiceEntryMode( + pointOfServiceEntryMode: PointOfServiceEntryMode? + ) = pointOfServiceEntryMode(JsonField.ofNullable(pointOfServiceEntryMode)) + + /** + * Alias for calling [Builder.pointOfServiceEntryMode] with + * `pointOfServiceEntryMode.orElse(null)`. + */ + fun pointOfServiceEntryMode( + pointOfServiceEntryMode: Optional + ) = pointOfServiceEntryMode(pointOfServiceEntryMode.getOrNull()) + + /** + * Sets [Builder.pointOfServiceEntryMode] to an arbitrary JSON value. + * + * You should usually call [Builder.pointOfServiceEntryMode] with a + * well-typed [PointOfServiceEntryMode] value instead. This method is + * primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun pointOfServiceEntryMode( + pointOfServiceEntryMode: JsonField + ) = apply { this.pointOfServiceEntryMode = pointOfServiceEntryMode } + + /** + * Only present when `actioner: network`. Describes why a card authorization + * was approved or declined by Visa through stand-in processing. + */ + fun standInProcessingReason( + standInProcessingReason: StandInProcessingReason? + ) = standInProcessingReason(JsonField.ofNullable(standInProcessingReason)) + + /** + * Alias for calling [Builder.standInProcessingReason] with + * `standInProcessingReason.orElse(null)`. + */ + fun standInProcessingReason( + standInProcessingReason: Optional + ) = standInProcessingReason(standInProcessingReason.getOrNull()) + + /** + * Sets [Builder.standInProcessingReason] to an arbitrary JSON value. + * + * You should usually call [Builder.standInProcessingReason] with a + * well-typed [StandInProcessingReason] value instead. This method is + * primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun standInProcessingReason( + standInProcessingReason: JsonField + ) = apply { this.standInProcessingReason = standInProcessingReason } + + /** + * The capability of the terminal being used to read the card. Shows whether + * a terminal can e.g., accept chip cards or if it only supports magnetic + * stripe reads. This reflects the highest capability of the terminal — for + * example, a terminal that supports both chip and magnetic stripe will be + * identified as chip-capable. + */ + fun terminalEntryCapability( + terminalEntryCapability: TerminalEntryCapability? + ) = terminalEntryCapability(JsonField.ofNullable(terminalEntryCapability)) + + /** + * Alias for calling [Builder.terminalEntryCapability] with + * `terminalEntryCapability.orElse(null)`. + */ + fun terminalEntryCapability( + terminalEntryCapability: Optional + ) = terminalEntryCapability(terminalEntryCapability.getOrNull()) + + /** + * Sets [Builder.terminalEntryCapability] to an arbitrary JSON value. + * + * You should usually call [Builder.terminalEntryCapability] with a + * well-typed [TerminalEntryCapability] value instead. This method is + * primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun terminalEntryCapability( + terminalEntryCapability: JsonField + ) = apply { this.terminalEntryCapability = terminalEntryCapability } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Visa]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .electronicCommerceIndicator() + * .pointOfServiceEntryMode() + * .standInProcessingReason() + * .terminalEntryCapability() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Visa = + Visa( + checkRequired( + "electronicCommerceIndicator", + electronicCommerceIndicator, + ), + checkRequired("pointOfServiceEntryMode", pointOfServiceEntryMode), + checkRequired("standInProcessingReason", standInProcessingReason), + checkRequired("terminalEntryCapability", terminalEntryCapability), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Visa = apply { if (validated) { return@apply } + electronicCommerceIndicator().ifPresent { it.validate() } + pointOfServiceEntryMode().ifPresent { it.validate() } + standInProcessingReason().ifPresent { it.validate() } + terminalEntryCapability().ifPresent { it.validate() } validated = true } @@ -23246,411 +25014,847 @@ private constructor( * * Used for best match union deserialization. */ - @JvmSynthetic internal fun validity(): Int = 0 + @JvmSynthetic + internal fun validity(): Int = + (electronicCommerceIndicator.asKnown().getOrNull()?.validity() ?: 0) + + (pointOfServiceEntryMode.asKnown().getOrNull()?.validity() ?: 0) + + (standInProcessingReason.asKnown().getOrNull()?.validity() ?: 0) + + (terminalEntryCapability.asKnown().getOrNull()?.validity() ?: 0) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * For electronic commerce transactions, this identifies the level of security + * used in obtaining the customer's payment credential. For mail or telephone + * order transactions, identifies the type of mail or telephone order. + */ + class ElectronicCommerceIndicator + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** + * Single transaction of a mail/phone order: Use to indicate that the + * transaction is a mail/phone order purchase, not a recurring + * transaction or installment payment. For domestic transactions in the + * US region, this value may also indicate one bill payment transaction + * in the card-present or card-absent environments. + */ + @JvmField val MAIL_PHONE_ORDER = of("mail_phone_order") + + /** + * Recurring transaction: Payment indicator used to indicate a recurring + * transaction that originates from an acquirer in the US region. + */ + @JvmField val RECURRING = of("recurring") + + /** + * Installment payment: Payment indicator used to indicate one purchase + * of goods or services that is billed to the account in multiple + * charges over a period of time agreed upon by the cardholder and + * merchant from transactions that originate from an acquirer in the US + * region. + */ + @JvmField val INSTALLMENT = of("installment") + + /** + * Unknown classification: other mail order: Use to indicate that the + * type of mail/telephone order is unknown. + */ + @JvmField val UNKNOWN_MAIL_PHONE_ORDER = of("unknown_mail_phone_order") + + /** + * Secure electronic commerce transaction: Use to indicate that the + * electronic commerce transaction has been authenticated using e.g., + * 3-D Secure + */ + @JvmField + val SECURE_ELECTRONIC_COMMERCE = of("secure_electronic_commerce") + + /** + * Non-authenticated security transaction at a 3-D Secure-capable + * merchant, and merchant attempted to authenticate the cardholder using + * 3-D Secure: Use to identify an electronic commerce transaction where + * the merchant attempted to authenticate the cardholder using 3-D + * Secure, but was unable to complete the authentication because the + * issuer or cardholder does not participate in the 3-D Secure program. + */ + @JvmField + val NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT = + of("non_authenticated_security_transaction_at_3ds_capable_merchant") + + /** + * Non-authenticated security transaction: Use to identify an electronic + * commerce transaction that uses data encryption for security however, + * cardholder authentication is not performed using 3-D Secure. + */ + @JvmField + val NON_AUTHENTICATED_SECURITY_TRANSACTION = + of("non_authenticated_security_transaction") + + /** + * Non-secure transaction: Use to identify an electronic commerce + * transaction that has no data protection. + */ + @JvmField val NON_SECURE_TRANSACTION = of("non_secure_transaction") + + @JvmStatic + fun of(value: String) = ElectronicCommerceIndicator(JsonField.of(value)) } - return other is Pulse && additionalProperties == other.additionalProperties - } + /** An enum containing [ElectronicCommerceIndicator]'s known values. */ + enum class Known { + /** + * Single transaction of a mail/phone order: Use to indicate that the + * transaction is a mail/phone order purchase, not a recurring + * transaction or installment payment. For domestic transactions in the + * US region, this value may also indicate one bill payment transaction + * in the card-present or card-absent environments. + */ + MAIL_PHONE_ORDER, + /** + * Recurring transaction: Payment indicator used to indicate a recurring + * transaction that originates from an acquirer in the US region. + */ + RECURRING, + /** + * Installment payment: Payment indicator used to indicate one purchase + * of goods or services that is billed to the account in multiple + * charges over a period of time agreed upon by the cardholder and + * merchant from transactions that originate from an acquirer in the US + * region. + */ + INSTALLMENT, + /** + * Unknown classification: other mail order: Use to indicate that the + * type of mail/telephone order is unknown. + */ + UNKNOWN_MAIL_PHONE_ORDER, + /** + * Secure electronic commerce transaction: Use to indicate that the + * electronic commerce transaction has been authenticated using e.g., + * 3-D Secure + */ + SECURE_ELECTRONIC_COMMERCE, + /** + * Non-authenticated security transaction at a 3-D Secure-capable + * merchant, and merchant attempted to authenticate the cardholder using + * 3-D Secure: Use to identify an electronic commerce transaction where + * the merchant attempted to authenticate the cardholder using 3-D + * Secure, but was unable to complete the authentication because the + * issuer or cardholder does not participate in the 3-D Secure program. + */ + NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT, + /** + * Non-authenticated security transaction: Use to identify an electronic + * commerce transaction that uses data encryption for security however, + * cardholder authentication is not performed using 3-D Secure. + */ + NON_AUTHENTICATED_SECURITY_TRANSACTION, + /** + * Non-secure transaction: Use to identify an electronic commerce + * transaction that has no data protection. + */ + NON_SECURE_TRANSACTION, + } - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /** + * An enum containing [ElectronicCommerceIndicator]'s known values, as well + * as an [_UNKNOWN] member. + * + * An instance of [ElectronicCommerceIndicator] can contain an unknown value + * in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** + * Single transaction of a mail/phone order: Use to indicate that the + * transaction is a mail/phone order purchase, not a recurring + * transaction or installment payment. For domestic transactions in the + * US region, this value may also indicate one bill payment transaction + * in the card-present or card-absent environments. + */ + MAIL_PHONE_ORDER, + /** + * Recurring transaction: Payment indicator used to indicate a recurring + * transaction that originates from an acquirer in the US region. + */ + RECURRING, + /** + * Installment payment: Payment indicator used to indicate one purchase + * of goods or services that is billed to the account in multiple + * charges over a period of time agreed upon by the cardholder and + * merchant from transactions that originate from an acquirer in the US + * region. + */ + INSTALLMENT, + /** + * Unknown classification: other mail order: Use to indicate that the + * type of mail/telephone order is unknown. + */ + UNKNOWN_MAIL_PHONE_ORDER, + /** + * Secure electronic commerce transaction: Use to indicate that the + * electronic commerce transaction has been authenticated using e.g., + * 3-D Secure + */ + SECURE_ELECTRONIC_COMMERCE, + /** + * Non-authenticated security transaction at a 3-D Secure-capable + * merchant, and merchant attempted to authenticate the cardholder using + * 3-D Secure: Use to identify an electronic commerce transaction where + * the merchant attempted to authenticate the cardholder using 3-D + * Secure, but was unable to complete the authentication because the + * issuer or cardholder does not participate in the 3-D Secure program. + */ + NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT, + /** + * Non-authenticated security transaction: Use to identify an electronic + * commerce transaction that uses data encryption for security however, + * cardholder authentication is not performed using 3-D Secure. + */ + NON_AUTHENTICATED_SECURITY_TRANSACTION, + /** + * Non-secure transaction: Use to identify an electronic commerce + * transaction that has no data protection. + */ + NON_SECURE_TRANSACTION, + /** + * An enum member indicating that [ElectronicCommerceIndicator] was + * instantiated with an unknown value. + */ + _UNKNOWN, + } - override fun hashCode(): Int = hashCode + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + MAIL_PHONE_ORDER -> Value.MAIL_PHONE_ORDER + RECURRING -> Value.RECURRING + INSTALLMENT -> Value.INSTALLMENT + UNKNOWN_MAIL_PHONE_ORDER -> Value.UNKNOWN_MAIL_PHONE_ORDER + SECURE_ELECTRONIC_COMMERCE -> Value.SECURE_ELECTRONIC_COMMERCE + NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT -> + Value + .NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT + NON_AUTHENTICATED_SECURITY_TRANSACTION -> + Value.NON_AUTHENTICATED_SECURITY_TRANSACTION + NON_SECURE_TRANSACTION -> Value.NON_SECURE_TRANSACTION + else -> Value._UNKNOWN + } - override fun toString() = "Pulse{additionalProperties=$additionalProperties}" - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + MAIL_PHONE_ORDER -> Known.MAIL_PHONE_ORDER + RECURRING -> Known.RECURRING + INSTALLMENT -> Known.INSTALLMENT + UNKNOWN_MAIL_PHONE_ORDER -> Known.UNKNOWN_MAIL_PHONE_ORDER + SECURE_ELECTRONIC_COMMERCE -> Known.SECURE_ELECTRONIC_COMMERCE + NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT -> + Known + .NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT + NON_AUTHENTICATED_SECURITY_TRANSACTION -> + Known.NON_AUTHENTICATED_SECURITY_TRANSACTION + NON_SECURE_TRANSACTION -> Known.NON_SECURE_TRANSACTION + else -> + throw IncreaseInvalidDataException( + "Unknown ElectronicCommerceIndicator: $value" + ) + } - /** Fields specific to the `visa` network. */ - class Visa - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val electronicCommerceIndicator: JsonField, - private val pointOfServiceEntryMode: JsonField, - private val standInProcessingReason: JsonField, - private val terminalEntryCapability: JsonField, - private val additionalProperties: MutableMap, - ) { + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - @JsonCreator - private constructor( - @JsonProperty("electronic_commerce_indicator") - @ExcludeMissing - electronicCommerceIndicator: JsonField = - JsonMissing.of(), - @JsonProperty("point_of_service_entry_mode") - @ExcludeMissing - pointOfServiceEntryMode: JsonField = - JsonMissing.of(), - @JsonProperty("stand_in_processing_reason") - @ExcludeMissing - standInProcessingReason: JsonField = - JsonMissing.of(), - @JsonProperty("terminal_entry_capability") - @ExcludeMissing - terminalEntryCapability: JsonField = - JsonMissing.of(), - ) : this( - electronicCommerceIndicator, - pointOfServiceEntryMode, - standInProcessingReason, - terminalEntryCapability, - mutableMapOf(), - ) + private var validated: Boolean = false - /** - * For electronic commerce transactions, this identifies the level of security - * used in obtaining the customer's payment credential. For mail or telephone - * order transactions, identifies the type of mail or telephone order. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun electronicCommerceIndicator(): Optional = - electronicCommerceIndicator.getOptional("electronic_commerce_indicator") + fun validate(): ElectronicCommerceIndicator = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ElectronicCommerceIndicator && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } /** * The method used to enter the cardholder's primary account number and card * expiration date. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). */ - fun pointOfServiceEntryMode(): Optional = - pointOfServiceEntryMode.getOptional("point_of_service_entry_mode") + class PointOfServiceEntryMode + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** - * Only present when `actioner: network`. Describes why a card authorization was - * approved or declined by Visa through stand-in processing. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun standInProcessingReason(): Optional = - standInProcessingReason.getOptional("stand_in_processing_reason") + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** - * The capability of the terminal being used to read the card. Shows whether a - * terminal can e.g., accept chip cards or if it only supports magnetic stripe - * reads. This reflects the highest capability of the terminal — for example, a - * terminal that supports both chip and magnetic stripe will be identified as - * chip-capable. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun terminalEntryCapability(): Optional = - terminalEntryCapability.getOptional("terminal_entry_capability") + companion object { - /** - * Returns the raw JSON value of [electronicCommerceIndicator]. - * - * Unlike [electronicCommerceIndicator], this method doesn't throw if the JSON - * field has an unexpected type. - */ - @JsonProperty("electronic_commerce_indicator") - @ExcludeMissing - fun _electronicCommerceIndicator(): JsonField = - electronicCommerceIndicator + /** Unknown */ + @JvmField val UNKNOWN = of("unknown") - /** - * Returns the raw JSON value of [pointOfServiceEntryMode]. - * - * Unlike [pointOfServiceEntryMode], this method doesn't throw if the JSON field - * has an unexpected type. - */ - @JsonProperty("point_of_service_entry_mode") - @ExcludeMissing - fun _pointOfServiceEntryMode(): JsonField = - pointOfServiceEntryMode + /** Manual key entry */ + @JvmField val MANUAL = of("manual") - /** - * Returns the raw JSON value of [standInProcessingReason]. - * - * Unlike [standInProcessingReason], this method doesn't throw if the JSON field - * has an unexpected type. - */ - @JsonProperty("stand_in_processing_reason") - @ExcludeMissing - fun _standInProcessingReason(): JsonField = - standInProcessingReason + /** Magnetic stripe read, without card verification value */ + @JvmField val MAGNETIC_STRIPE_NO_CVV = of("magnetic_stripe_no_cvv") - /** - * Returns the raw JSON value of [terminalEntryCapability]. - * - * Unlike [terminalEntryCapability], this method doesn't throw if the JSON field - * has an unexpected type. - */ - @JsonProperty("terminal_entry_capability") - @ExcludeMissing - fun _terminalEntryCapability(): JsonField = - terminalEntryCapability + /** Optical code */ + @JvmField val OPTICAL_CODE = of("optical_code") - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** Contact chip card */ + @JvmField val INTEGRATED_CIRCUIT_CARD = of("integrated_circuit_card") - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** Contactless read of chip card */ + @JvmField val CONTACTLESS = of("contactless") - fun toBuilder() = Builder().from(this) + /** + * Transaction initiated using a credential that has previously been + * stored on file + */ + @JvmField val CREDENTIAL_ON_FILE = of("credential_on_file") - companion object { + /** Magnetic stripe read */ + @JvmField val MAGNETIC_STRIPE = of("magnetic_stripe") - /** - * Returns a mutable builder for constructing an instance of [Visa]. - * - * The following fields are required: - * ```java - * .electronicCommerceIndicator() - * .pointOfServiceEntryMode() - * .standInProcessingReason() - * .terminalEntryCapability() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + /** Contactless read of magnetic stripe data */ + @JvmField + val CONTACTLESS_MAGNETIC_STRIPE = of("contactless_magnetic_stripe") - /** A builder for [Visa]. */ - class Builder internal constructor() { + /** Contact chip card, without card verification value */ + @JvmField + val INTEGRATED_CIRCUIT_CARD_NO_CVV = + of("integrated_circuit_card_no_cvv") - private var electronicCommerceIndicator: - JsonField? = - null - private var pointOfServiceEntryMode: JsonField? = - null - private var standInProcessingReason: JsonField? = - null - private var terminalEntryCapability: JsonField? = - null - private var additionalProperties: MutableMap = - mutableMapOf() + @JvmStatic + fun of(value: String) = PointOfServiceEntryMode(JsonField.of(value)) + } - @JvmSynthetic - internal fun from(visa: Visa) = apply { - electronicCommerceIndicator = visa.electronicCommerceIndicator - pointOfServiceEntryMode = visa.pointOfServiceEntryMode - standInProcessingReason = visa.standInProcessingReason - terminalEntryCapability = visa.terminalEntryCapability - additionalProperties = visa.additionalProperties.toMutableMap() + /** An enum containing [PointOfServiceEntryMode]'s known values. */ + enum class Known { + /** Unknown */ + UNKNOWN, + /** Manual key entry */ + MANUAL, + /** Magnetic stripe read, without card verification value */ + MAGNETIC_STRIPE_NO_CVV, + /** Optical code */ + OPTICAL_CODE, + /** Contact chip card */ + INTEGRATED_CIRCUIT_CARD, + /** Contactless read of chip card */ + CONTACTLESS, + /** + * Transaction initiated using a credential that has previously been + * stored on file + */ + CREDENTIAL_ON_FILE, + /** Magnetic stripe read */ + MAGNETIC_STRIPE, + /** Contactless read of magnetic stripe data */ + CONTACTLESS_MAGNETIC_STRIPE, + /** Contact chip card, without card verification value */ + INTEGRATED_CIRCUIT_CARD_NO_CVV, } /** - * For electronic commerce transactions, this identifies the level of - * security used in obtaining the customer's payment credential. For mail or - * telephone order transactions, identifies the type of mail or telephone - * order. + * An enum containing [PointOfServiceEntryMode]'s known values, as well as + * an [_UNKNOWN] member. + * + * An instance of [PointOfServiceEntryMode] can contain an unknown value in + * a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. */ - fun electronicCommerceIndicator( - electronicCommerceIndicator: ElectronicCommerceIndicator? - ) = - electronicCommerceIndicator( - JsonField.ofNullable(electronicCommerceIndicator) - ) + enum class Value { + /** Unknown */ + UNKNOWN, + /** Manual key entry */ + MANUAL, + /** Magnetic stripe read, without card verification value */ + MAGNETIC_STRIPE_NO_CVV, + /** Optical code */ + OPTICAL_CODE, + /** Contact chip card */ + INTEGRATED_CIRCUIT_CARD, + /** Contactless read of chip card */ + CONTACTLESS, + /** + * Transaction initiated using a credential that has previously been + * stored on file + */ + CREDENTIAL_ON_FILE, + /** Magnetic stripe read */ + MAGNETIC_STRIPE, + /** Contactless read of magnetic stripe data */ + CONTACTLESS_MAGNETIC_STRIPE, + /** Contact chip card, without card verification value */ + INTEGRATED_CIRCUIT_CARD_NO_CVV, + /** + * An enum member indicating that [PointOfServiceEntryMode] was + * instantiated with an unknown value. + */ + _UNKNOWN, + } /** - * Alias for calling [Builder.electronicCommerceIndicator] with - * `electronicCommerceIndicator.orElse(null)`. + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. */ - fun electronicCommerceIndicator( - electronicCommerceIndicator: Optional - ) = electronicCommerceIndicator(electronicCommerceIndicator.getOrNull()) + 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 + INTEGRATED_CIRCUIT_CARD -> Value.INTEGRATED_CIRCUIT_CARD + CONTACTLESS -> Value.CONTACTLESS + CREDENTIAL_ON_FILE -> Value.CREDENTIAL_ON_FILE + MAGNETIC_STRIPE -> Value.MAGNETIC_STRIPE + CONTACTLESS_MAGNETIC_STRIPE -> Value.CONTACTLESS_MAGNETIC_STRIPE + INTEGRATED_CIRCUIT_CARD_NO_CVV -> + Value.INTEGRATED_CIRCUIT_CARD_NO_CVV + else -> Value._UNKNOWN + } /** - * Sets [Builder.electronicCommerceIndicator] to an arbitrary JSON value. + * Returns an enum member corresponding to this class instance's value. * - * You should usually call [Builder.electronicCommerceIndicator] with a - * well-typed [ElectronicCommerceIndicator] value instead. This method is - * primarily for setting the field to an undocumented or not yet supported - * value. + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. */ - fun electronicCommerceIndicator( - electronicCommerceIndicator: JsonField - ) = apply { this.electronicCommerceIndicator = electronicCommerceIndicator } + 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 + INTEGRATED_CIRCUIT_CARD -> Known.INTEGRATED_CIRCUIT_CARD + CONTACTLESS -> Known.CONTACTLESS + CREDENTIAL_ON_FILE -> Known.CREDENTIAL_ON_FILE + MAGNETIC_STRIPE -> Known.MAGNETIC_STRIPE + CONTACTLESS_MAGNETIC_STRIPE -> Known.CONTACTLESS_MAGNETIC_STRIPE + INTEGRATED_CIRCUIT_CARD_NO_CVV -> + Known.INTEGRATED_CIRCUIT_CARD_NO_CVV + else -> + throw IncreaseInvalidDataException( + "Unknown PointOfServiceEntryMode: $value" + ) + } /** - * The method used to enter the cardholder's primary account number and card - * expiration date. + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. */ - fun pointOfServiceEntryMode( - pointOfServiceEntryMode: PointOfServiceEntryMode? - ) = pointOfServiceEntryMode(JsonField.ofNullable(pointOfServiceEntryMode)) + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - /** - * Alias for calling [Builder.pointOfServiceEntryMode] with - * `pointOfServiceEntryMode.orElse(null)`. - */ - fun pointOfServiceEntryMode( - pointOfServiceEntryMode: Optional - ) = pointOfServiceEntryMode(pointOfServiceEntryMode.getOrNull()) + private var validated: Boolean = false - /** - * Sets [Builder.pointOfServiceEntryMode] to an arbitrary JSON value. - * - * You should usually call [Builder.pointOfServiceEntryMode] with a - * well-typed [PointOfServiceEntryMode] value instead. This method is - * primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun pointOfServiceEntryMode( - pointOfServiceEntryMode: JsonField - ) = apply { this.pointOfServiceEntryMode = pointOfServiceEntryMode } + fun validate(): PointOfServiceEntryMode = apply { + if (validated) { + return@apply + } - /** - * Only present when `actioner: network`. Describes why a card authorization - * was approved or declined by Visa through stand-in processing. - */ - fun standInProcessingReason( - standInProcessingReason: StandInProcessingReason? - ) = standInProcessingReason(JsonField.ofNullable(standInProcessingReason)) + known() + validated = true + } - /** - * Alias for calling [Builder.standInProcessingReason] with - * `standInProcessingReason.orElse(null)`. - */ - fun standInProcessingReason( - standInProcessingReason: Optional - ) = standInProcessingReason(standInProcessingReason.getOrNull()) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } /** - * Sets [Builder.standInProcessingReason] to an arbitrary JSON value. + * Returns a score indicating how many valid values are contained in this + * object recursively. * - * You should usually call [Builder.standInProcessingReason] with a - * well-typed [StandInProcessingReason] value instead. This method is - * primarily for setting the field to an undocumented or not yet supported - * value. + * Used for best match union deserialization. */ - fun standInProcessingReason( - standInProcessingReason: JsonField - ) = apply { this.standInProcessingReason = standInProcessingReason } + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - /** - * The capability of the terminal being used to read the card. Shows whether - * a terminal can e.g., accept chip cards or if it only supports magnetic - * stripe reads. This reflects the highest capability of the terminal — for - * example, a terminal that supports both chip and magnetic stripe will be - * identified as chip-capable. - */ - fun terminalEntryCapability( - terminalEntryCapability: TerminalEntryCapability? - ) = terminalEntryCapability(JsonField.ofNullable(terminalEntryCapability)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Alias for calling [Builder.terminalEntryCapability] with - * `terminalEntryCapability.orElse(null)`. - */ - fun terminalEntryCapability( - terminalEntryCapability: Optional - ) = terminalEntryCapability(terminalEntryCapability.getOrNull()) + return other is PointOfServiceEntryMode && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * Only present when `actioner: network`. Describes why a card authorization was + * approved or declined by Visa through stand-in processing. + */ + class StandInProcessingReason + @JsonCreator + private constructor(private val value: JsonField) : Enum { /** - * Sets [Builder.terminalEntryCapability] to an arbitrary JSON value. + * Returns this class instance's raw value. * - * You should usually call [Builder.terminalEntryCapability] with a - * well-typed [TerminalEntryCapability] value instead. This method is - * primarily for setting the field to an undocumented or not yet supported - * value. + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. */ - fun terminalEntryCapability( - terminalEntryCapability: JsonField - ) = apply { this.terminalEntryCapability = terminalEntryCapability } + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - fun additionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + companion object { - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** Increase failed to process the authorization in a timely manner. */ + @JvmField val ISSUER_ERROR = of("issuer_error") - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } + /** The physical card read had an invalid CVV or dCVV. */ + @JvmField val INVALID_PHYSICAL_CARD = of("invalid_physical_card") - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + /** + * The card's authorization request cryptogram was invalid. The + * cryptogram can be from a physical card or a Digital Wallet Token + * purchase. + */ + @JvmField val INVALID_CRYPTOGRAM = of("invalid_cryptogram") + + /** The 3DS cardholder authentication verification value was invalid. */ + @JvmField + val INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE = + of("invalid_cardholder_authentication_verification_value") + + /** + * An internal Visa error occurred. Visa uses this reason code for + * certain expected occurrences as well, such as Application Transaction + * Counter (ATC) replays. + */ + @JvmField val INTERNAL_VISA_ERROR = of("internal_visa_error") + + /** + * The merchant has enabled Visa's Transaction Advisory Service and + * requires further authentication to perform the transaction. In + * practice this is often utilized at fuel pumps to tell the cardholder + * to see the cashier. + */ + @JvmField + val MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED = + of("merchant_transaction_advisory_service_authentication_required") + + /** + * The transaction was blocked by Visa's Payment Fraud Disruption + * service due to fraudulent Acquirer behavior, such as card testing. + */ + @JvmField + val PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK = + of("payment_fraud_disruption_acquirer_block") + + /** An unspecific reason for stand-in processing. */ + @JvmField val OTHER = of("other") + + @JvmStatic + fun of(value: String) = StandInProcessingReason(JsonField.of(value)) } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + /** An enum containing [StandInProcessingReason]'s known values. */ + enum class Known { + /** Increase failed to process the authorization in a timely manner. */ + ISSUER_ERROR, + /** The physical card read had an invalid CVV or dCVV. */ + INVALID_PHYSICAL_CARD, + /** + * The card's authorization request cryptogram was invalid. The + * cryptogram can be from a physical card or a Digital Wallet Token + * purchase. + */ + INVALID_CRYPTOGRAM, + /** The 3DS cardholder authentication verification value was invalid. */ + INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE, + /** + * An internal Visa error occurred. Visa uses this reason code for + * certain expected occurrences as well, such as Application Transaction + * Counter (ATC) replays. + */ + INTERNAL_VISA_ERROR, + /** + * The merchant has enabled Visa's Transaction Advisory Service and + * requires further authentication to perform the transaction. In + * practice this is often utilized at fuel pumps to tell the cardholder + * to see the cashier. + */ + MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED, + /** + * The transaction was blocked by Visa's Payment Fraud Disruption + * service due to fraudulent Acquirer behavior, such as card testing. + */ + PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK, + /** An unspecific reason for stand-in processing. */ + OTHER, } /** - * Returns an immutable instance of [Visa]. + * An enum containing [StandInProcessingReason]'s known values, as well as + * an [_UNKNOWN] member. * - * Further updates to this [Builder] will not mutate the returned instance. + * An instance of [StandInProcessingReason] can contain an unknown value in + * a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** Increase failed to process the authorization in a timely manner. */ + ISSUER_ERROR, + /** The physical card read had an invalid CVV or dCVV. */ + INVALID_PHYSICAL_CARD, + /** + * The card's authorization request cryptogram was invalid. The + * cryptogram can be from a physical card or a Digital Wallet Token + * purchase. + */ + INVALID_CRYPTOGRAM, + /** The 3DS cardholder authentication verification value was invalid. */ + INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE, + /** + * An internal Visa error occurred. Visa uses this reason code for + * certain expected occurrences as well, such as Application Transaction + * Counter (ATC) replays. + */ + INTERNAL_VISA_ERROR, + /** + * The merchant has enabled Visa's Transaction Advisory Service and + * requires further authentication to perform the transaction. In + * practice this is often utilized at fuel pumps to tell the cardholder + * to see the cashier. + */ + MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED, + /** + * The transaction was blocked by Visa's Payment Fraud Disruption + * service due to fraudulent Acquirer behavior, such as card testing. + */ + PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK, + /** An unspecific reason for stand-in processing. */ + OTHER, + /** + * An enum member indicating that [StandInProcessingReason] was + * instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. * - * The following fields are required: - * ```java - * .electronicCommerceIndicator() - * .pointOfServiceEntryMode() - * .standInProcessingReason() - * .terminalEntryCapability() - * ``` + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ISSUER_ERROR -> Value.ISSUER_ERROR + INVALID_PHYSICAL_CARD -> Value.INVALID_PHYSICAL_CARD + INVALID_CRYPTOGRAM -> Value.INVALID_CRYPTOGRAM + INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE -> + Value.INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE + INTERNAL_VISA_ERROR -> Value.INTERNAL_VISA_ERROR + MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED -> + Value + .MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED + PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK -> + Value.PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK + OTHER -> Value.OTHER + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. * - * @throws IllegalStateException if any required field is unset. + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. */ - fun build(): Visa = - Visa( - checkRequired( - "electronicCommerceIndicator", - electronicCommerceIndicator, - ), - checkRequired("pointOfServiceEntryMode", pointOfServiceEntryMode), - checkRequired("standInProcessingReason", standInProcessingReason), - checkRequired("terminalEntryCapability", terminalEntryCapability), - additionalProperties.toMutableMap(), - ) - } + fun known(): Known = + when (this) { + ISSUER_ERROR -> Known.ISSUER_ERROR + INVALID_PHYSICAL_CARD -> Known.INVALID_PHYSICAL_CARD + INVALID_CRYPTOGRAM -> Known.INVALID_CRYPTOGRAM + INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE -> + Known.INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE + INTERNAL_VISA_ERROR -> Known.INTERNAL_VISA_ERROR + MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED -> + Known + .MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED + PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK -> + Known.PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK + OTHER -> Known.OTHER + else -> + throw IncreaseInvalidDataException( + "Unknown StandInProcessingReason: $value" + ) + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - private var validated: Boolean = false + private var validated: Boolean = false - fun validate(): Visa = apply { - if (validated) { - return@apply + fun validate(): StandInProcessingReason = apply { + if (validated) { + return@apply + } + + known() + validated = true } - electronicCommerceIndicator().ifPresent { it.validate() } - pointOfServiceEntryMode().ifPresent { it.validate() } - standInProcessingReason().ifPresent { it.validate() } - terminalEntryCapability().ifPresent { it.validate() } - validated = true - } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is StandInProcessingReason && value == other.value } - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (electronicCommerceIndicator.asKnown().getOrNull()?.validity() ?: 0) + - (pointOfServiceEntryMode.asKnown().getOrNull()?.validity() ?: 0) + - (standInProcessingReason.asKnown().getOrNull()?.validity() ?: 0) + - (terminalEntryCapability.asKnown().getOrNull()?.validity() ?: 0) + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } /** - * For electronic commerce transactions, this identifies the level of security - * used in obtaining the customer's payment credential. For mail or telephone - * order transactions, identifies the type of mail or telephone order. + * The capability of the terminal being used to read the card. Shows whether a + * terminal can e.g., accept chip cards or if it only supports magnetic stripe + * reads. This reflects the highest capability of the terminal — for example, a + * terminal that supports both chip and magnetic stripe will be identified as + * chip-capable. */ - class ElectronicCommerceIndicator + class TerminalEntryCapability @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -23667,1484 +25871,1971 @@ private constructor( companion object { - /** - * Single transaction of a mail/phone order: Use to indicate that the - * transaction is a mail/phone order purchase, not a recurring - * transaction or installment payment. For domestic transactions in the - * US region, this value may also indicate one bill payment transaction - * in the card-present or card-absent environments. - */ - @JvmField val MAIL_PHONE_ORDER = of("mail_phone_order") + /** Unknown */ + @JvmField val UNKNOWN = of("unknown") - /** - * Recurring transaction: Payment indicator used to indicate a recurring - * transaction that originates from an acquirer in the US region. - */ - @JvmField val RECURRING = of("recurring") + /** No terminal was used for this transaction. */ + @JvmField val TERMINAL_NOT_USED = of("terminal_not_used") /** - * Installment payment: Payment indicator used to indicate one purchase - * of goods or services that is billed to the account in multiple - * charges over a period of time agreed upon by the cardholder and - * merchant from transactions that originate from an acquirer in the US - * region. + * The terminal can only read magnetic stripes and does not have chip or + * contactless reading capability. */ - @JvmField val INSTALLMENT = of("installment") + @JvmField val MAGNETIC_STRIPE = of("magnetic_stripe") - /** - * Unknown classification: other mail order: Use to indicate that the - * type of mail/telephone order is unknown. - */ - @JvmField val UNKNOWN_MAIL_PHONE_ORDER = of("unknown_mail_phone_order") + /** The terminal can only read barcodes. */ + @JvmField val BARCODE = of("barcode") /** - * Secure electronic commerce transaction: Use to indicate that the - * electronic commerce transaction has been authenticated using e.g., - * 3-D Secure + * The terminal can only read cards via Optical Character Recognition. */ @JvmField - val SECURE_ELECTRONIC_COMMERCE = of("secure_electronic_commerce") + val OPTICAL_CHARACTER_RECOGNITION = of("optical_character_recognition") /** - * Non-authenticated security transaction at a 3-D Secure-capable - * merchant, and merchant attempted to authenticate the cardholder using - * 3-D Secure: Use to identify an electronic commerce transaction where - * the merchant attempted to authenticate the cardholder using 3-D - * Secure, but was unable to complete the authentication because the - * issuer or cardholder does not participate in the 3-D Secure program. + * The terminal supports contact chip cards and can also read the + * magnetic stripe. If contact chip is supported, this value is used + * regardless of whether contactless is also supported. */ - @JvmField - val NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT = - of("non_authenticated_security_transaction_at_3ds_capable_merchant") + @JvmField val CHIP_OR_CONTACTLESS = of("chip_or_contactless") /** - * Non-authenticated security transaction: Use to identify an electronic - * commerce transaction that uses data encryption for security however, - * cardholder authentication is not performed using 3-D Secure. + * The terminal supports contactless reads but does not support contact + * chip. Only used when the terminal lacks contact chip capability. */ - @JvmField - val NON_AUTHENTICATED_SECURITY_TRANSACTION = - of("non_authenticated_security_transaction") + @JvmField val CONTACTLESS_ONLY = of("contactless_only") - /** - * Non-secure transaction: Use to identify an electronic commerce - * transaction that has no data protection. - */ - @JvmField val NON_SECURE_TRANSACTION = of("non_secure_transaction") + /** The terminal has no card reading capability. */ + @JvmField val NO_CAPABILITY = of("no_capability") @JvmStatic - fun of(value: String) = ElectronicCommerceIndicator(JsonField.of(value)) + fun of(value: String) = TerminalEntryCapability(JsonField.of(value)) } - /** An enum containing [ElectronicCommerceIndicator]'s known values. */ + /** An enum containing [TerminalEntryCapability]'s known values. */ enum class Known { + /** Unknown */ + UNKNOWN, + /** No terminal was used for this transaction. */ + TERMINAL_NOT_USED, /** - * Single transaction of a mail/phone order: Use to indicate that the - * transaction is a mail/phone order purchase, not a recurring - * transaction or installment payment. For domestic transactions in the - * US region, this value may also indicate one bill payment transaction - * in the card-present or card-absent environments. + * The terminal can only read magnetic stripes and does not have chip or + * contactless reading capability. */ - MAIL_PHONE_ORDER, + MAGNETIC_STRIPE, + /** The terminal can only read barcodes. */ + BARCODE, /** - * Recurring transaction: Payment indicator used to indicate a recurring - * transaction that originates from an acquirer in the US region. + * The terminal can only read cards via Optical Character Recognition. */ - RECURRING, + OPTICAL_CHARACTER_RECOGNITION, /** - * Installment payment: Payment indicator used to indicate one purchase - * of goods or services that is billed to the account in multiple - * charges over a period of time agreed upon by the cardholder and - * merchant from transactions that originate from an acquirer in the US - * region. + * The terminal supports contact chip cards and can also read the + * magnetic stripe. If contact chip is supported, this value is used + * regardless of whether contactless is also supported. */ - INSTALLMENT, + CHIP_OR_CONTACTLESS, /** - * Unknown classification: other mail order: Use to indicate that the - * type of mail/telephone order is unknown. + * The terminal supports contactless reads but does not support contact + * chip. Only used when the terminal lacks contact chip capability. */ - UNKNOWN_MAIL_PHONE_ORDER, + CONTACTLESS_ONLY, + /** The terminal has no card reading capability. */ + NO_CAPABILITY, + } + + /** + * An enum containing [TerminalEntryCapability]'s known values, as well as + * an [_UNKNOWN] member. + * + * An instance of [TerminalEntryCapability] can contain an unknown value in + * a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** Unknown */ + UNKNOWN, + /** No terminal was used for this transaction. */ + TERMINAL_NOT_USED, /** - * Secure electronic commerce transaction: Use to indicate that the - * electronic commerce transaction has been authenticated using e.g., - * 3-D Secure + * The terminal can only read magnetic stripes and does not have chip or + * contactless reading capability. */ - SECURE_ELECTRONIC_COMMERCE, + MAGNETIC_STRIPE, + /** The terminal can only read barcodes. */ + BARCODE, /** - * Non-authenticated security transaction at a 3-D Secure-capable - * merchant, and merchant attempted to authenticate the cardholder using - * 3-D Secure: Use to identify an electronic commerce transaction where - * the merchant attempted to authenticate the cardholder using 3-D - * Secure, but was unable to complete the authentication because the - * issuer or cardholder does not participate in the 3-D Secure program. + * The terminal can only read cards via Optical Character Recognition. */ - NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT, + OPTICAL_CHARACTER_RECOGNITION, /** - * Non-authenticated security transaction: Use to identify an electronic - * commerce transaction that uses data encryption for security however, - * cardholder authentication is not performed using 3-D Secure. + * The terminal supports contact chip cards and can also read the + * magnetic stripe. If contact chip is supported, this value is used + * regardless of whether contactless is also supported. */ - NON_AUTHENTICATED_SECURITY_TRANSACTION, + CHIP_OR_CONTACTLESS, /** - * Non-secure transaction: Use to identify an electronic commerce - * transaction that has no data protection. + * The terminal supports contactless reads but does not support contact + * chip. Only used when the terminal lacks contact chip capability. */ - NON_SECURE_TRANSACTION, + CONTACTLESS_ONLY, + /** The terminal has no card reading capability. */ + NO_CAPABILITY, + /** + * An enum member indicating that [TerminalEntryCapability] was + * instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + UNKNOWN -> Value.UNKNOWN + TERMINAL_NOT_USED -> Value.TERMINAL_NOT_USED + MAGNETIC_STRIPE -> Value.MAGNETIC_STRIPE + BARCODE -> Value.BARCODE + OPTICAL_CHARACTER_RECOGNITION -> Value.OPTICAL_CHARACTER_RECOGNITION + CHIP_OR_CONTACTLESS -> Value.CHIP_OR_CONTACTLESS + CONTACTLESS_ONLY -> Value.CONTACTLESS_ONLY + NO_CAPABILITY -> Value.NO_CAPABILITY + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + UNKNOWN -> Known.UNKNOWN + TERMINAL_NOT_USED -> Known.TERMINAL_NOT_USED + MAGNETIC_STRIPE -> Known.MAGNETIC_STRIPE + BARCODE -> Known.BARCODE + OPTICAL_CHARACTER_RECOGNITION -> Known.OPTICAL_CHARACTER_RECOGNITION + CHIP_OR_CONTACTLESS -> Known.CHIP_OR_CONTACTLESS + CONTACTLESS_ONLY -> Known.CONTACTLESS_ONLY + NO_CAPABILITY -> Known.NO_CAPABILITY + else -> + throw IncreaseInvalidDataException( + "Unknown TerminalEntryCapability: $value" + ) + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): TerminalEntryCapability = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is TerminalEntryCapability && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - /** - * An enum containing [ElectronicCommerceIndicator]'s known values, as well - * as an [_UNKNOWN] member. - * - * An instance of [ElectronicCommerceIndicator] can contain an unknown value - * in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** - * Single transaction of a mail/phone order: Use to indicate that the - * transaction is a mail/phone order purchase, not a recurring - * transaction or installment payment. For domestic transactions in the - * US region, this value may also indicate one bill payment transaction - * in the card-present or card-absent environments. - */ - MAIL_PHONE_ORDER, - /** - * Recurring transaction: Payment indicator used to indicate a recurring - * transaction that originates from an acquirer in the US region. - */ - RECURRING, - /** - * Installment payment: Payment indicator used to indicate one purchase - * of goods or services that is billed to the account in multiple - * charges over a period of time agreed upon by the cardholder and - * merchant from transactions that originate from an acquirer in the US - * region. - */ - INSTALLMENT, - /** - * Unknown classification: other mail order: Use to indicate that the - * type of mail/telephone order is unknown. - */ - UNKNOWN_MAIL_PHONE_ORDER, - /** - * Secure electronic commerce transaction: Use to indicate that the - * electronic commerce transaction has been authenticated using e.g., - * 3-D Secure - */ - SECURE_ELECTRONIC_COMMERCE, - /** - * Non-authenticated security transaction at a 3-D Secure-capable - * merchant, and merchant attempted to authenticate the cardholder using - * 3-D Secure: Use to identify an electronic commerce transaction where - * the merchant attempted to authenticate the cardholder using 3-D - * Secure, but was unable to complete the authentication because the - * issuer or cardholder does not participate in the 3-D Secure program. - */ - NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT, - /** - * Non-authenticated security transaction: Use to identify an electronic - * commerce transaction that uses data encryption for security however, - * cardholder authentication is not performed using 3-D Secure. - */ - NON_AUTHENTICATED_SECURITY_TRANSACTION, - /** - * Non-secure transaction: Use to identify an electronic commerce - * transaction that has no data protection. - */ - NON_SECURE_TRANSACTION, - /** - * An enum member indicating that [ElectronicCommerceIndicator] was - * instantiated with an unknown value. - */ - _UNKNOWN, - } + return other is Visa && + electronicCommerceIndicator == other.electronicCommerceIndicator && + pointOfServiceEntryMode == other.pointOfServiceEntryMode && + standInProcessingReason == other.standInProcessingReason && + terminalEntryCapability == other.terminalEntryCapability && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + electronicCommerceIndicator, + pointOfServiceEntryMode, + standInProcessingReason, + terminalEntryCapability, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Visa{electronicCommerceIndicator=$electronicCommerceIndicator, pointOfServiceEntryMode=$pointOfServiceEntryMode, standInProcessingReason=$standInProcessingReason, terminalEntryCapability=$terminalEntryCapability, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is NetworkDetails && + category == other.category && + pulse == other.pulse && + visa == other.visa && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(category, pulse, visa, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "NetworkDetails{category=$category, pulse=$pulse, visa=$visa, additionalProperties=$additionalProperties}" + } + + /** Network-specific identifiers for a specific request or transaction. */ + class NetworkIdentifiers + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val authorizationIdentificationResponse: JsonField, + private val retrievalReferenceNumber: JsonField, + private val traceNumber: JsonField, + private val transactionId: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("authorization_identification_response") + @ExcludeMissing + authorizationIdentificationResponse: JsonField = JsonMissing.of(), + @JsonProperty("retrieval_reference_number") + @ExcludeMissing + retrievalReferenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("trace_number") + @ExcludeMissing + traceNumber: JsonField = JsonMissing.of(), + @JsonProperty("transaction_id") + @ExcludeMissing + transactionId: JsonField = JsonMissing.of(), + ) : this( + authorizationIdentificationResponse, + retrievalReferenceNumber, + traceNumber, + transactionId, + mutableMapOf(), + ) + + /** + * The randomly generated 6-character Authorization Identification Response code + * sent back to the acquirer in an approved response. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun authorizationIdentificationResponse(): Optional = + authorizationIdentificationResponse.getOptional( + "authorization_identification_response" + ) + + /** + * A life-cycle identifier used across e.g., an authorization and a reversal. + * Expected to be unique per acquirer within a window of time. For some card + * networks the retrieval reference number includes the trace counter. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun retrievalReferenceNumber(): Optional = + retrievalReferenceNumber.getOptional("retrieval_reference_number") + + /** + * A counter used to verify an individual authorization. Expected to be unique per + * acquirer within a window of time. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun traceNumber(): Optional = traceNumber.getOptional("trace_number") + + /** + * A globally unique transaction identifier provided by the card network, used + * across multiple life-cycle requests. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun transactionId(): Optional = transactionId.getOptional("transaction_id") + + /** + * Returns the raw JSON value of [authorizationIdentificationResponse]. + * + * Unlike [authorizationIdentificationResponse], this method doesn't throw if the + * JSON field has an unexpected type. + */ + @JsonProperty("authorization_identification_response") + @ExcludeMissing + fun _authorizationIdentificationResponse(): JsonField = + authorizationIdentificationResponse + + /** + * Returns the raw JSON value of [retrievalReferenceNumber]. + * + * Unlike [retrievalReferenceNumber], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("retrieval_reference_number") + @ExcludeMissing + fun _retrievalReferenceNumber(): JsonField = retrievalReferenceNumber + + /** + * Returns the raw JSON value of [traceNumber]. + * + * Unlike [traceNumber], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("trace_number") + @ExcludeMissing + fun _traceNumber(): JsonField = traceNumber + + /** + * Returns the raw JSON value of [transactionId]. + * + * Unlike [transactionId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("transaction_id") + @ExcludeMissing + fun _transactionId(): JsonField = transactionId + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MAIL_PHONE_ORDER -> Value.MAIL_PHONE_ORDER - RECURRING -> Value.RECURRING - INSTALLMENT -> Value.INSTALLMENT - UNKNOWN_MAIL_PHONE_ORDER -> Value.UNKNOWN_MAIL_PHONE_ORDER - SECURE_ELECTRONIC_COMMERCE -> Value.SECURE_ELECTRONIC_COMMERCE - NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT -> - Value - .NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT - NON_AUTHENTICATED_SECURITY_TRANSACTION -> - Value.NON_AUTHENTICATED_SECURITY_TRANSACTION - NON_SECURE_TRANSACTION -> Value.NON_SECURE_TRANSACTION - else -> Value._UNKNOWN - } + companion object { - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - MAIL_PHONE_ORDER -> Known.MAIL_PHONE_ORDER - RECURRING -> Known.RECURRING - INSTALLMENT -> Known.INSTALLMENT - UNKNOWN_MAIL_PHONE_ORDER -> Known.UNKNOWN_MAIL_PHONE_ORDER - SECURE_ELECTRONIC_COMMERCE -> Known.SECURE_ELECTRONIC_COMMERCE - NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT -> - Known - .NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT - NON_AUTHENTICATED_SECURITY_TRANSACTION -> - Known.NON_AUTHENTICATED_SECURITY_TRANSACTION - NON_SECURE_TRANSACTION -> Known.NON_SECURE_TRANSACTION - else -> - throw IncreaseInvalidDataException( - "Unknown ElectronicCommerceIndicator: $value" - ) - } + /** + * Returns a mutable builder for constructing an instance of + * [NetworkIdentifiers]. + * + * The following fields are required: + * ```java + * .authorizationIdentificationResponse() + * .retrievalReferenceNumber() + * .traceNumber() + * .transactionId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + /** A builder for [NetworkIdentifiers]. */ + class Builder internal constructor() { - private var validated: Boolean = false + private var authorizationIdentificationResponse: JsonField? = null + private var retrievalReferenceNumber: JsonField? = null + private var traceNumber: JsonField? = null + private var transactionId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - fun validate(): ElectronicCommerceIndicator = apply { - if (validated) { - return@apply - } + @JvmSynthetic + internal fun from(networkIdentifiers: NetworkIdentifiers) = apply { + authorizationIdentificationResponse = + networkIdentifiers.authorizationIdentificationResponse + retrievalReferenceNumber = networkIdentifiers.retrievalReferenceNumber + traceNumber = networkIdentifiers.traceNumber + transactionId = networkIdentifiers.transactionId + additionalProperties = + networkIdentifiers.additionalProperties.toMutableMap() + } - known() - validated = true - } + /** + * The randomly generated 6-character Authorization Identification Response code + * sent back to the acquirer in an approved response. + */ + fun authorizationIdentificationResponse( + authorizationIdentificationResponse: String? + ) = + authorizationIdentificationResponse( + JsonField.ofNullable(authorizationIdentificationResponse) + ) - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * Alias for calling [Builder.authorizationIdentificationResponse] with + * `authorizationIdentificationResponse.orElse(null)`. + */ + fun authorizationIdentificationResponse( + authorizationIdentificationResponse: Optional + ) = + authorizationIdentificationResponse( + authorizationIdentificationResponse.getOrNull() + ) - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + /** + * Sets [Builder.authorizationIdentificationResponse] to an arbitrary JSON + * value. + * + * You should usually call [Builder.authorizationIdentificationResponse] with a + * well-typed [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun authorizationIdentificationResponse( + authorizationIdentificationResponse: JsonField + ) = apply { + this.authorizationIdentificationResponse = + authorizationIdentificationResponse + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * A life-cycle identifier used across e.g., an authorization and a reversal. + * Expected to be unique per acquirer within a window of time. For some card + * networks the retrieval reference number includes the trace counter. + */ + fun retrievalReferenceNumber(retrievalReferenceNumber: String?) = + retrievalReferenceNumber(JsonField.ofNullable(retrievalReferenceNumber)) - return other is ElectronicCommerceIndicator && value == other.value + /** + * Alias for calling [Builder.retrievalReferenceNumber] with + * `retrievalReferenceNumber.orElse(null)`. + */ + fun retrievalReferenceNumber(retrievalReferenceNumber: Optional) = + retrievalReferenceNumber(retrievalReferenceNumber.getOrNull()) + + /** + * Sets [Builder.retrievalReferenceNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.retrievalReferenceNumber] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun retrievalReferenceNumber(retrievalReferenceNumber: JsonField) = + apply { + this.retrievalReferenceNumber = retrievalReferenceNumber } - override fun hashCode() = value.hashCode() + /** + * A counter used to verify an individual authorization. Expected to be unique + * per acquirer within a window of time. + */ + fun traceNumber(traceNumber: String?) = + traceNumber(JsonField.ofNullable(traceNumber)) - override fun toString() = value.toString() + /** Alias for calling [Builder.traceNumber] with `traceNumber.orElse(null)`. */ + fun traceNumber(traceNumber: Optional) = + traceNumber(traceNumber.getOrNull()) + + /** + * Sets [Builder.traceNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.traceNumber] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun traceNumber(traceNumber: JsonField) = apply { + this.traceNumber = traceNumber } /** - * The method used to enter the cardholder's primary account number and card - * expiration date. + * A globally unique transaction identifier provided by the card network, used + * across multiple life-cycle requests. */ - class PointOfServiceEntryMode - @JsonCreator - private constructor(private val value: JsonField) : Enum { + fun transactionId(transactionId: String?) = + transactionId(JsonField.ofNullable(transactionId)) - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + /** + * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`. + */ + fun transactionId(transactionId: Optional) = + transactionId(transactionId.getOrNull()) - companion object { + /** + * Sets [Builder.transactionId] to an arbitrary JSON value. + * + * You should usually call [Builder.transactionId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun transactionId(transactionId: JsonField) = apply { + this.transactionId = transactionId + } - /** Unknown */ - @JvmField val UNKNOWN = of("unknown") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** Manual key entry */ - @JvmField val MANUAL = of("manual") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** Magnetic stripe read, without card verification value */ - @JvmField val MAGNETIC_STRIPE_NO_CVV = of("magnetic_stripe_no_cvv") + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** Optical code */ - @JvmField val OPTICAL_CODE = of("optical_code") + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** Contact chip card */ - @JvmField val INTEGRATED_CIRCUIT_CARD = of("integrated_circuit_card") + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** Contactless read of chip card */ - @JvmField val CONTACTLESS = of("contactless") + /** + * Returns an immutable instance of [NetworkIdentifiers]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .authorizationIdentificationResponse() + * .retrievalReferenceNumber() + * .traceNumber() + * .transactionId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): NetworkIdentifiers = + NetworkIdentifiers( + checkRequired( + "authorizationIdentificationResponse", + authorizationIdentificationResponse, + ), + checkRequired("retrievalReferenceNumber", retrievalReferenceNumber), + checkRequired("traceNumber", traceNumber), + checkRequired("transactionId", transactionId), + additionalProperties.toMutableMap(), + ) + } - /** - * Transaction initiated using a credential that has previously been - * stored on file - */ - @JvmField val CREDENTIAL_ON_FILE = of("credential_on_file") + private var validated: Boolean = false - /** Magnetic stripe read */ - @JvmField val MAGNETIC_STRIPE = of("magnetic_stripe") + fun validate(): NetworkIdentifiers = apply { + if (validated) { + return@apply + } - /** Contactless read of magnetic stripe data */ - @JvmField - val CONTACTLESS_MAGNETIC_STRIPE = of("contactless_magnetic_stripe") + authorizationIdentificationResponse() + retrievalReferenceNumber() + traceNumber() + transactionId() + validated = true + } - /** Contact chip card, without card verification value */ - @JvmField - val INTEGRATED_CIRCUIT_CARD_NO_CVV = - of("integrated_circuit_card_no_cvv") + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - @JvmStatic - fun of(value: String) = PointOfServiceEntryMode(JsonField.of(value)) - } + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (authorizationIdentificationResponse.asKnown().isPresent) 1 else 0) + + (if (retrievalReferenceNumber.asKnown().isPresent) 1 else 0) + + (if (traceNumber.asKnown().isPresent) 1 else 0) + + (if (transactionId.asKnown().isPresent) 1 else 0) - /** An enum containing [PointOfServiceEntryMode]'s known values. */ - enum class Known { - /** Unknown */ - UNKNOWN, - /** Manual key entry */ - MANUAL, - /** Magnetic stripe read, without card verification value */ - MAGNETIC_STRIPE_NO_CVV, - /** Optical code */ - OPTICAL_CODE, - /** Contact chip card */ - INTEGRATED_CIRCUIT_CARD, - /** Contactless read of chip card */ - CONTACTLESS, - /** - * Transaction initiated using a credential that has previously been - * stored on file - */ - CREDENTIAL_ON_FILE, - /** Magnetic stripe read */ - MAGNETIC_STRIPE, - /** Contactless read of magnetic stripe data */ - CONTACTLESS_MAGNETIC_STRIPE, - /** Contact chip card, without card verification value */ - INTEGRATED_CIRCUIT_CARD_NO_CVV, - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * An enum containing [PointOfServiceEntryMode]'s known values, as well as - * an [_UNKNOWN] member. - * - * An instance of [PointOfServiceEntryMode] can contain an unknown value in - * a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** Unknown */ - UNKNOWN, - /** Manual key entry */ - MANUAL, - /** Magnetic stripe read, without card verification value */ - MAGNETIC_STRIPE_NO_CVV, - /** Optical code */ - OPTICAL_CODE, - /** Contact chip card */ - INTEGRATED_CIRCUIT_CARD, - /** Contactless read of chip card */ - CONTACTLESS, - /** - * Transaction initiated using a credential that has previously been - * stored on file - */ - CREDENTIAL_ON_FILE, - /** Magnetic stripe read */ - MAGNETIC_STRIPE, - /** Contactless read of magnetic stripe data */ - CONTACTLESS_MAGNETIC_STRIPE, - /** Contact chip card, without card verification value */ - INTEGRATED_CIRCUIT_CARD_NO_CVV, - /** - * An enum member indicating that [PointOfServiceEntryMode] was - * instantiated with an unknown value. - */ - _UNKNOWN, - } + return other is NetworkIdentifiers && + authorizationIdentificationResponse == + other.authorizationIdentificationResponse && + retrievalReferenceNumber == other.retrievalReferenceNumber && + traceNumber == other.traceNumber && + transactionId == other.transactionId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + authorizationIdentificationResponse, + retrievalReferenceNumber, + traceNumber, + transactionId, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "NetworkIdentifiers{authorizationIdentificationResponse=$authorizationIdentificationResponse, retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}" + } + + class SchemeFee + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val amount: JsonField, + private val createdAt: JsonField, + private val currency: JsonField, + private val feeType: JsonField, + private val fixedComponent: JsonField, + private val variableRate: JsonField, + private val additionalProperties: MutableMap, + ) { - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - UNKNOWN -> Value.UNKNOWN - MANUAL -> Value.MANUAL - MAGNETIC_STRIPE_NO_CVV -> Value.MAGNETIC_STRIPE_NO_CVV - OPTICAL_CODE -> Value.OPTICAL_CODE - INTEGRATED_CIRCUIT_CARD -> Value.INTEGRATED_CIRCUIT_CARD - CONTACTLESS -> Value.CONTACTLESS - CREDENTIAL_ON_FILE -> Value.CREDENTIAL_ON_FILE - MAGNETIC_STRIPE -> Value.MAGNETIC_STRIPE - CONTACTLESS_MAGNETIC_STRIPE -> Value.CONTACTLESS_MAGNETIC_STRIPE - INTEGRATED_CIRCUIT_CARD_NO_CVV -> - Value.INTEGRATED_CIRCUIT_CARD_NO_CVV - else -> Value._UNKNOWN - } + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + createdAt: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("fee_type") + @ExcludeMissing + feeType: JsonField = JsonMissing.of(), + @JsonProperty("fixed_component") + @ExcludeMissing + fixedComponent: JsonField = JsonMissing.of(), + @JsonProperty("variable_rate") + @ExcludeMissing + variableRate: JsonField = JsonMissing.of(), + ) : this( + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, + mutableMapOf(), + ) - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - UNKNOWN -> Known.UNKNOWN - MANUAL -> Known.MANUAL - MAGNETIC_STRIPE_NO_CVV -> Known.MAGNETIC_STRIPE_NO_CVV - OPTICAL_CODE -> Known.OPTICAL_CODE - INTEGRATED_CIRCUIT_CARD -> Known.INTEGRATED_CIRCUIT_CARD - CONTACTLESS -> Known.CONTACTLESS - CREDENTIAL_ON_FILE -> Known.CREDENTIAL_ON_FILE - MAGNETIC_STRIPE -> Known.MAGNETIC_STRIPE - CONTACTLESS_MAGNETIC_STRIPE -> Known.CONTACTLESS_MAGNETIC_STRIPE - INTEGRATED_CIRCUIT_CARD_NO_CVV -> - Known.INTEGRATED_CIRCUIT_CARD_NO_CVV - else -> - throw IncreaseInvalidDataException( - "Unknown PointOfServiceEntryMode: $value" - ) - } + /** + * The fee amount given as a string containing a decimal number. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun amount(): String = amount.getRequired("amount") - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + /** + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + * created. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - private var validated: Boolean = false + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun currency(): Currency = currency.getRequired("currency") - fun validate(): PointOfServiceEntryMode = apply { - if (validated) { - return@apply - } + /** + * The type of fee being assessed. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun feeType(): FeeType = feeType.getRequired("fee_type") - known() - validated = true - } + /** + * The fixed component of the fee, if applicable, given in major units of the fee + * amount. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun fixedComponent(): Optional = + fixedComponent.getOptional("fixed_component") - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * The variable rate component of the fee, if applicable, given as a decimal (e.g., + * 0.015 for 1.5%). + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun variableRate(): Optional = variableRate.getOptional("variable_rate") - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Returns the raw JSON value of [createdAt]. + * + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("created_at") + @ExcludeMissing + fun _createdAt(): JsonField = createdAt - return other is PointOfServiceEntryMode && value == other.value - } + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("currency") + @ExcludeMissing + fun _currency(): JsonField = currency - override fun hashCode() = value.hashCode() + /** + * Returns the raw JSON value of [feeType]. + * + * Unlike [feeType], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("fee_type") + @ExcludeMissing + fun _feeType(): JsonField = feeType - override fun toString() = value.toString() - } + /** + * Returns the raw JSON value of [fixedComponent]. + * + * Unlike [fixedComponent], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("fixed_component") + @ExcludeMissing + fun _fixedComponent(): JsonField = fixedComponent - /** - * Only present when `actioner: network`. Describes why a card authorization was - * approved or declined by Visa through stand-in processing. - */ - class StandInProcessingReason - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** + * Returns the raw JSON value of [variableRate]. + * + * Unlike [variableRate], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("variable_rate") + @ExcludeMissing + fun _variableRate(): JsonField = variableRate - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - companion object { + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** Increase failed to process the authorization in a timely manner. */ - @JvmField val ISSUER_ERROR = of("issuer_error") + fun toBuilder() = Builder().from(this) - /** The physical card read had an invalid CVV or dCVV. */ - @JvmField val INVALID_PHYSICAL_CARD = of("invalid_physical_card") + companion object { - /** - * The card's authorization request cryptogram was invalid. The - * cryptogram can be from a physical card or a Digital Wallet Token - * purchase. - */ - @JvmField val INVALID_CRYPTOGRAM = of("invalid_cryptogram") + /** + * Returns a mutable builder for constructing an instance of [SchemeFee]. + * + * The following fields are required: + * ```java + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - /** The 3DS cardholder authentication verification value was invalid. */ - @JvmField - val INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE = - of("invalid_cardholder_authentication_verification_value") + /** A builder for [SchemeFee]. */ + class Builder internal constructor() { - /** - * An internal Visa error occurred. Visa uses this reason code for - * certain expected occurrences as well, such as Application Transaction - * Counter (ATC) replays. - */ - @JvmField val INTERNAL_VISA_ERROR = of("internal_visa_error") + private var amount: JsonField? = null + private var createdAt: JsonField? = null + private var currency: JsonField? = null + private var feeType: JsonField? = null + private var fixedComponent: JsonField? = null + private var variableRate: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** - * The merchant has enabled Visa's Transaction Advisory Service and - * requires further authentication to perform the transaction. In - * practice this is often utilized at fuel pumps to tell the cardholder - * to see the cashier. - */ - @JvmField - val MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED = - of("merchant_transaction_advisory_service_authentication_required") + @JvmSynthetic + internal fun from(schemeFee: SchemeFee) = apply { + amount = schemeFee.amount + createdAt = schemeFee.createdAt + currency = schemeFee.currency + feeType = schemeFee.feeType + fixedComponent = schemeFee.fixedComponent + variableRate = schemeFee.variableRate + additionalProperties = schemeFee.additionalProperties.toMutableMap() + } - /** - * The transaction was blocked by Visa's Payment Fraud Disruption - * service due to fraudulent Acquirer behavior, such as card testing. - */ - @JvmField - val PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK = - of("payment_fraud_disruption_acquirer_block") + /** The fee amount given as a string containing a decimal number. */ + fun amount(amount: String) = amount(JsonField.of(amount)) - /** An unspecific reason for stand-in processing. */ - @JvmField val OTHER = of("other") + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun amount(amount: JsonField) = apply { this.amount = amount } - @JvmStatic - fun of(value: String) = StandInProcessingReason(JsonField.of(value)) - } + /** + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee + * was created. + */ + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - /** An enum containing [StandInProcessingReason]'s known values. */ - enum class Known { - /** Increase failed to process the authorization in a timely manner. */ - ISSUER_ERROR, - /** The physical card read had an invalid CVV or dCVV. */ - INVALID_PHYSICAL_CARD, - /** - * The card's authorization request cryptogram was invalid. The - * cryptogram can be from a physical card or a Digital Wallet Token - * purchase. - */ - INVALID_CRYPTOGRAM, - /** The 3DS cardholder authentication verification value was invalid. */ - INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE, - /** - * An internal Visa error occurred. Visa uses this reason code for - * certain expected occurrences as well, such as Application Transaction - * Counter (ATC) replays. - */ - INTERNAL_VISA_ERROR, - /** - * The merchant has enabled Visa's Transaction Advisory Service and - * requires further authentication to perform the transaction. In - * practice this is often utilized at fuel pumps to tell the cardholder - * to see the cashier. - */ - MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED, - /** - * The transaction was blocked by Visa's Payment Fraud Disruption - * service due to fraudulent Acquirer behavior, such as card testing. - */ - PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK, - /** An unspecific reason for stand-in processing. */ - OTHER, - } + /** + * Sets [Builder.createdAt] to an arbitrary JSON value. + * + * You should usually call [Builder.createdAt] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt + } - /** - * An enum containing [StandInProcessingReason]'s known values, as well as - * an [_UNKNOWN] member. - * - * An instance of [StandInProcessingReason] can contain an unknown value in - * a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** Increase failed to process the authorization in a timely manner. */ - ISSUER_ERROR, - /** The physical card read had an invalid CVV or dCVV. */ - INVALID_PHYSICAL_CARD, - /** - * The card's authorization request cryptogram was invalid. The - * cryptogram can be from a physical card or a Digital Wallet Token - * purchase. - */ - INVALID_CRYPTOGRAM, - /** The 3DS cardholder authentication verification value was invalid. */ - INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE, - /** - * An internal Visa error occurred. Visa uses this reason code for - * certain expected occurrences as well, such as Application Transaction - * Counter (ATC) replays. - */ - INTERNAL_VISA_ERROR, - /** - * The merchant has enabled Visa's Transaction Advisory Service and - * requires further authentication to perform the transaction. In - * practice this is often utilized at fuel pumps to tell the cardholder - * to see the cashier. - */ - MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED, - /** - * The transaction was blocked by Visa's Payment Fraud Disruption - * service due to fraudulent Acquirer behavior, such as card testing. - */ - PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK, - /** An unspecific reason for stand-in processing. */ - OTHER, - /** - * An enum member indicating that [StandInProcessingReason] was - * instantiated with an unknown value. - */ - _UNKNOWN, - } + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + */ + fun currency(currency: Currency) = currency(JsonField.of(currency)) - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ISSUER_ERROR -> Value.ISSUER_ERROR - INVALID_PHYSICAL_CARD -> Value.INVALID_PHYSICAL_CARD - INVALID_CRYPTOGRAM -> Value.INVALID_CRYPTOGRAM - INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE -> - Value.INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE - INTERNAL_VISA_ERROR -> Value.INTERNAL_VISA_ERROR - MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED -> - Value - .MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED - PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK -> - Value.PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK - OTHER -> Value.OTHER - else -> Value._UNKNOWN - } + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [Currency] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - ISSUER_ERROR -> Known.ISSUER_ERROR - INVALID_PHYSICAL_CARD -> Known.INVALID_PHYSICAL_CARD - INVALID_CRYPTOGRAM -> Known.INVALID_CRYPTOGRAM - INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE -> - Known.INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE - INTERNAL_VISA_ERROR -> Known.INTERNAL_VISA_ERROR - MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED -> - Known - .MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED - PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK -> - Known.PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK - OTHER -> Known.OTHER - else -> - throw IncreaseInvalidDataException( - "Unknown StandInProcessingReason: $value" - ) - } + /** The type of fee being assessed. */ + fun feeType(feeType: FeeType) = feeType(JsonField.of(feeType)) - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + /** + * Sets [Builder.feeType] to an arbitrary JSON value. + * + * You should usually call [Builder.feeType] with a well-typed [FeeType] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun feeType(feeType: JsonField) = apply { this.feeType = feeType } - private var validated: Boolean = false + /** + * The fixed component of the fee, if applicable, given in major units of the + * fee amount. + */ + fun fixedComponent(fixedComponent: String?) = + fixedComponent(JsonField.ofNullable(fixedComponent)) - fun validate(): StandInProcessingReason = apply { - if (validated) { - return@apply - } + /** + * Alias for calling [Builder.fixedComponent] with + * `fixedComponent.orElse(null)`. + */ + fun fixedComponent(fixedComponent: Optional) = + fixedComponent(fixedComponent.getOrNull()) - known() - validated = true - } + /** + * Sets [Builder.fixedComponent] to an arbitrary JSON value. + * + * You should usually call [Builder.fixedComponent] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun fixedComponent(fixedComponent: JsonField) = apply { + this.fixedComponent = fixedComponent + } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * The variable rate component of the fee, if applicable, given as a decimal + * (e.g., 0.015 for 1.5%). + */ + fun variableRate(variableRate: String?) = + variableRate(JsonField.ofNullable(variableRate)) - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + /** + * Alias for calling [Builder.variableRate] with `variableRate.orElse(null)`. + */ + fun variableRate(variableRate: Optional) = + variableRate(variableRate.getOrNull()) + + /** + * Sets [Builder.variableRate] to an arbitrary JSON value. + * + * You should usually call [Builder.variableRate] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun variableRate(variableRate: JsonField) = apply { + this.variableRate = variableRate + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - return other is StandInProcessingReason && value == other.value + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) } - override fun hashCode() = value.hashCode() + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - override fun toString() = value.toString() + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } /** - * The capability of the terminal being used to read the card. Shows whether a - * terminal can e.g., accept chip cards or if it only supports magnetic stripe - * reads. This reflects the highest capability of the terminal — for example, a - * terminal that supports both chip and magnetic stripe will be identified as - * chip-capable. + * Returns an immutable instance of [SchemeFee]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() + * ``` + * + * @throws IllegalStateException if any required field is unset. */ - class TerminalEntryCapability - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - /** Unknown */ - @JvmField val UNKNOWN = of("unknown") - - /** No terminal was used for this transaction. */ - @JvmField val TERMINAL_NOT_USED = of("terminal_not_used") + fun build(): SchemeFee = + SchemeFee( + checkRequired("amount", amount), + checkRequired("createdAt", createdAt), + checkRequired("currency", currency), + checkRequired("feeType", feeType), + checkRequired("fixedComponent", fixedComponent), + checkRequired("variableRate", variableRate), + additionalProperties.toMutableMap(), + ) + } - /** - * The terminal can only read magnetic stripes and does not have chip or - * contactless reading capability. - */ - @JvmField val MAGNETIC_STRIPE = of("magnetic_stripe") + private var validated: Boolean = false - /** The terminal can only read barcodes. */ - @JvmField val BARCODE = of("barcode") + fun validate(): SchemeFee = apply { + if (validated) { + return@apply + } - /** - * The terminal can only read cards via Optical Character Recognition. - */ - @JvmField - val OPTICAL_CHARACTER_RECOGNITION = of("optical_character_recognition") + amount() + createdAt() + currency().validate() + feeType().validate() + fixedComponent() + variableRate() + validated = true + } - /** - * The terminal supports contact chip cards and can also read the - * magnetic stripe. If contact chip is supported, this value is used - * regardless of whether contactless is also supported. - */ - @JvmField val CHIP_OR_CONTACTLESS = of("chip_or_contactless") + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * The terminal supports contactless reads but does not support contact - * chip. Only used when the terminal lacks contact chip capability. - */ - @JvmField val CONTACTLESS_ONLY = of("contactless_only") + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (currency.asKnown().getOrNull()?.validity() ?: 0) + + (feeType.asKnown().getOrNull()?.validity() ?: 0) + + (if (fixedComponent.asKnown().isPresent) 1 else 0) + + (if (variableRate.asKnown().isPresent) 1 else 0) - /** The terminal has no card reading capability. */ - @JvmField val NO_CAPABILITY = of("no_capability") + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + */ + class Currency + @JsonCreator + private constructor(private val value: JsonField) : Enum { - @JvmStatic - fun of(value: String) = TerminalEntryCapability(JsonField.of(value)) - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** An enum containing [TerminalEntryCapability]'s known values. */ - enum class Known { - /** Unknown */ - UNKNOWN, - /** No terminal was used for this transaction. */ - TERMINAL_NOT_USED, - /** - * The terminal can only read magnetic stripes and does not have chip or - * contactless reading capability. - */ - MAGNETIC_STRIPE, - /** The terminal can only read barcodes. */ - BARCODE, - /** - * The terminal can only read cards via Optical Character Recognition. - */ - OPTICAL_CHARACTER_RECOGNITION, - /** - * The terminal supports contact chip cards and can also read the - * magnetic stripe. If contact chip is supported, this value is used - * regardless of whether contactless is also supported. - */ - CHIP_OR_CONTACTLESS, - /** - * The terminal supports contactless reads but does not support contact - * chip. Only used when the terminal lacks contact chip capability. - */ - CONTACTLESS_ONLY, - /** The terminal has no card reading capability. */ - NO_CAPABILITY, - } + companion object { - /** - * An enum containing [TerminalEntryCapability]'s known values, as well as - * an [_UNKNOWN] member. - * - * An instance of [TerminalEntryCapability] can contain an unknown value in - * a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** Unknown */ - UNKNOWN, - /** No terminal was used for this transaction. */ - TERMINAL_NOT_USED, - /** - * The terminal can only read magnetic stripes and does not have chip or - * contactless reading capability. - */ - MAGNETIC_STRIPE, - /** The terminal can only read barcodes. */ - BARCODE, - /** - * The terminal can only read cards via Optical Character Recognition. - */ - OPTICAL_CHARACTER_RECOGNITION, - /** - * The terminal supports contact chip cards and can also read the - * magnetic stripe. If contact chip is supported, this value is used - * regardless of whether contactless is also supported. - */ - CHIP_OR_CONTACTLESS, - /** - * The terminal supports contactless reads but does not support contact - * chip. Only used when the terminal lacks contact chip capability. - */ - CONTACTLESS_ONLY, - /** The terminal has no card reading capability. */ - NO_CAPABILITY, - /** - * An enum member indicating that [TerminalEntryCapability] was - * instantiated with an unknown value. - */ - _UNKNOWN, - } + /** US Dollar (USD) */ + @JvmField val USD = of("USD") - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - UNKNOWN -> Value.UNKNOWN - TERMINAL_NOT_USED -> Value.TERMINAL_NOT_USED - MAGNETIC_STRIPE -> Value.MAGNETIC_STRIPE - BARCODE -> Value.BARCODE - OPTICAL_CHARACTER_RECOGNITION -> Value.OPTICAL_CHARACTER_RECOGNITION - CHIP_OR_CONTACTLESS -> Value.CHIP_OR_CONTACTLESS - CONTACTLESS_ONLY -> Value.CONTACTLESS_ONLY - NO_CAPABILITY -> Value.NO_CAPABILITY - else -> Value._UNKNOWN - } + @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) + } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - UNKNOWN -> Known.UNKNOWN - TERMINAL_NOT_USED -> Known.TERMINAL_NOT_USED - MAGNETIC_STRIPE -> Known.MAGNETIC_STRIPE - BARCODE -> Known.BARCODE - OPTICAL_CHARACTER_RECOGNITION -> Known.OPTICAL_CHARACTER_RECOGNITION - CHIP_OR_CONTACTLESS -> Known.CHIP_OR_CONTACTLESS - CONTACTLESS_ONLY -> Known.CONTACTLESS_ONLY - NO_CAPABILITY -> Known.NO_CAPABILITY - else -> - throw IncreaseInvalidDataException( - "Unknown TerminalEntryCapability: $value" - ) - } + /** An enum containing [Currency]'s known values. */ + enum class Known { + /** US Dollar (USD) */ + USD + } + /** + * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Currency] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** US Dollar (USD) */ + USD, /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. + * An enum member indicating that [Currency] was instantiated with an + * unknown value. */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + _UNKNOWN, + } - private var validated: Boolean = false + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + USD -> Value.USD + else -> Value._UNKNOWN + } - fun validate(): TerminalEntryCapability = apply { - if (validated) { - return@apply - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + USD -> Known.USD + else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + } - known() - validated = true + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + private var validated: Boolean = false - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + fun validate(): Currency = apply { + if (validated) { + return@apply + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + known() + validated = true + } - return other is TerminalEntryCapability && value == other.value + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is Visa && - electronicCommerceIndicator == other.electronicCommerceIndicator && - pointOfServiceEntryMode == other.pointOfServiceEntryMode && - standInProcessingReason == other.standInProcessingReason && - terminalEntryCapability == other.terminalEntryCapability && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - electronicCommerceIndicator, - pointOfServiceEntryMode, - standInProcessingReason, - terminalEntryCapability, - additionalProperties, - ) + return other is Currency && value == other.value } - override fun hashCode(): Int = hashCode + override fun hashCode() = value.hashCode() - override fun toString() = - "Visa{electronicCommerceIndicator=$electronicCommerceIndicator, pointOfServiceEntryMode=$pointOfServiceEntryMode, standInProcessingReason=$standInProcessingReason, terminalEntryCapability=$terminalEntryCapability, additionalProperties=$additionalProperties}" + override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** The type of fee being assessed. */ + class FeeType + @JsonCreator + private constructor(private val value: JsonField) : Enum { - return other is NetworkDetails && - category == other.category && - pulse == other.pulse && - visa == other.visa && - additionalProperties == other.additionalProperties - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - private val hashCode: Int by lazy { - Objects.hash(category, pulse, visa, additionalProperties) - } + companion object { - override fun hashCode(): Int = hashCode + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY = + of("visa_international_service_assessment_single_currency") - override fun toString() = - "NetworkDetails{category=$category, pulse=$pulse, visa=$visa, additionalProperties=$additionalProperties}" - } + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY = + of("visa_international_service_assessment_cross_currency") - /** Network-specific identifiers for a specific request or transaction. */ - class NetworkIdentifiers - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val authorizationIdentificationResponse: JsonField, - private val retrievalReferenceNumber: JsonField, - private val traceNumber: JsonField, - private val transactionId: JsonField, - private val additionalProperties: MutableMap, - ) { + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + @JvmField + val VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE = + of("visa_authorization_domestic_point_of_sale") - @JsonCreator - private constructor( - @JsonProperty("authorization_identification_response") - @ExcludeMissing - authorizationIdentificationResponse: JsonField = JsonMissing.of(), - @JsonProperty("retrieval_reference_number") - @ExcludeMissing - retrievalReferenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("trace_number") - @ExcludeMissing - traceNumber: JsonField = JsonMissing.of(), - @JsonProperty("transaction_id") - @ExcludeMissing - transactionId: JsonField = JsonMissing.of(), - ) : this( - authorizationIdentificationResponse, - retrievalReferenceNumber, - traceNumber, - transactionId, - mutableMapOf(), - ) + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + @JvmField + val VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_international_point_of_sale") - /** - * The randomly generated 6-character Authorization Identification Response code - * sent back to the acquirer in an approved response. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun authorizationIdentificationResponse(): Optional = - authorizationIdentificationResponse.getOptional( - "authorization_identification_response" - ) + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + @JvmField + val VISA_AUTHORIZATION_CANADA_POINT_OF_SALE = + of("visa_authorization_canada_point_of_sale") - /** - * A life-cycle identifier used across e.g., an authorization and a reversal. - * Expected to be unique per acquirer within a window of time. For some card - * networks the retrieval reference number includes the trace counter. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun retrievalReferenceNumber(): Optional = - retrievalReferenceNumber.getOptional("retrieval_reference_number") + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + @JvmField + val VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE = + of("visa_authorization_reversal_point_of_sale") - /** - * A counter used to verify an individual authorization. Expected to be unique per - * acquirer within a window of time. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun traceNumber(): Optional = traceNumber.getOptional("trace_number") + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + @JvmField + val VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_reversal_international_point_of_sale") - /** - * A globally unique transaction identifier provided by the card network, used - * across multiple life-cycle requests. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun transactionId(): Optional = transactionId.getOptional("transaction_id") + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + @JvmField + val VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE = + of("visa_authorization_address_verification_service") - /** - * Returns the raw JSON value of [authorizationIdentificationResponse]. - * - * Unlike [authorizationIdentificationResponse], this method doesn't throw if the - * JSON field has an unexpected type. - */ - @JsonProperty("authorization_identification_response") - @ExcludeMissing - fun _authorizationIdentificationResponse(): JsonField = - authorizationIdentificationResponse + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + @JvmField + val VISA_ADVANCED_AUTHORIZATION = of("visa_advanced_authorization") - /** - * Returns the raw JSON value of [retrievalReferenceNumber]. - * - * Unlike [retrievalReferenceNumber], this method doesn't throw if the JSON field - * has an unexpected type. - */ - @JsonProperty("retrieval_reference_number") - @ExcludeMissing - fun _retrievalReferenceNumber(): JsonField = retrievalReferenceNumber + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + @JvmField val VISA_MESSAGE_TRANSMISSION = of("visa_message_transmission") - /** - * Returns the raw JSON value of [traceNumber]. - * - * Unlike [traceNumber], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("trace_number") - @ExcludeMissing - fun _traceNumber(): JsonField = traceNumber + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_DOMESTIC = + of("visa_account_verification_domestic") - /** - * Returns the raw JSON value of [transactionId]. - * - * Unlike [transactionId], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("transaction_id") - @ExcludeMissing - fun _transactionId(): JsonField = transactionId + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_INTERNATIONAL = + of("visa_account_verification_international") - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_CANADA = + of("visa_account_verification_canada") - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + @JvmField + val VISA_CORPORATE_ACCEPTANCE_FEE = of("visa_corporate_acceptance_fee") - fun toBuilder() = Builder().from(this) + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + @JvmField + val VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE = + of("visa_consumer_debit_acceptance_fee") - companion object { + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + @JvmField + val VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE = + of("visa_business_debit_acceptance_fee") - /** - * Returns a mutable builder for constructing an instance of - * [NetworkIdentifiers]. - * - * The following fields are required: - * ```java - * .authorizationIdentificationResponse() - * .retrievalReferenceNumber() - * .traceNumber() - * .transactionId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + @JvmField + val VISA_PURCHASING_ACCEPTANCE_FEE = of("visa_purchasing_acceptance_fee") - /** A builder for [NetworkIdentifiers]. */ - class Builder internal constructor() { + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + @JvmField val VISA_PURCHASE_DOMESTIC = of("visa_purchase_domestic") - private var authorizationIdentificationResponse: JsonField? = null - private var retrievalReferenceNumber: JsonField? = null - private var traceNumber: JsonField? = null - private var transactionId: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + @JvmField + val VISA_PURCHASE_INTERNATIONAL = of("visa_purchase_international") - @JvmSynthetic - internal fun from(networkIdentifiers: NetworkIdentifiers) = apply { - authorizationIdentificationResponse = - networkIdentifiers.authorizationIdentificationResponse - retrievalReferenceNumber = networkIdentifiers.retrievalReferenceNumber - traceNumber = networkIdentifiers.traceNumber - transactionId = networkIdentifiers.transactionId - additionalProperties = - networkIdentifiers.additionalProperties.toMutableMap() - } + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_CREDIT_PURCHASE_TOKEN = of("visa_credit_purchase_token") - /** - * The randomly generated 6-character Authorization Identification Response code - * sent back to the acquirer in an approved response. - */ - fun authorizationIdentificationResponse( - authorizationIdentificationResponse: String? - ) = - authorizationIdentificationResponse( - JsonField.ofNullable(authorizationIdentificationResponse) - ) + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_DEBIT_PURCHASE_TOKEN = of("visa_debit_purchase_token") - /** - * Alias for calling [Builder.authorizationIdentificationResponse] with - * `authorizationIdentificationResponse.orElse(null)`. - */ - fun authorizationIdentificationResponse( - authorizationIdentificationResponse: Optional - ) = - authorizationIdentificationResponse( - authorizationIdentificationResponse.getOrNull() - ) + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + @JvmField val VISA_CLEARING_TRANSMISSION = of("visa_clearing_transmission") - /** - * Sets [Builder.authorizationIdentificationResponse] to an arbitrary JSON - * value. - * - * You should usually call [Builder.authorizationIdentificationResponse] with a - * well-typed [String] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun authorizationIdentificationResponse( - authorizationIdentificationResponse: JsonField - ) = apply { - this.authorizationIdentificationResponse = - authorizationIdentificationResponse - } + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + @JvmField val VISA_DIRECT_AUTHORIZATION = of("visa_direct_authorization") - /** - * A life-cycle identifier used across e.g., an authorization and a reversal. - * Expected to be unique per acquirer within a window of time. For some card - * networks the retrieval reference number includes the trace counter. - */ - fun retrievalReferenceNumber(retrievalReferenceNumber: String?) = - retrievalReferenceNumber(JsonField.ofNullable(retrievalReferenceNumber)) + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + @JvmField + val VISA_DIRECT_TRANSACTION_DOMESTIC = + of("visa_direct_transaction_domestic") - /** - * Alias for calling [Builder.retrievalReferenceNumber] with - * `retrievalReferenceNumber.orElse(null)`. - */ - fun retrievalReferenceNumber(retrievalReferenceNumber: Optional) = - retrievalReferenceNumber(retrievalReferenceNumber.getOrNull()) + /** Issuer card service fee for Commercial Credit cards. */ + @JvmField + val VISA_SERVICE_COMMERCIAL_CREDIT = of("visa_service_commercial_credit") - /** - * Sets [Builder.retrievalReferenceNumber] to an arbitrary JSON value. - * - * You should usually call [Builder.retrievalReferenceNumber] with a well-typed - * [String] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun retrievalReferenceNumber(retrievalReferenceNumber: JsonField) = - apply { - this.retrievalReferenceNumber = retrievalReferenceNumber - } + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + @JvmField + val VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT = + of("visa_advertising_service_commercial_credit") - /** - * A counter used to verify an individual authorization. Expected to be unique - * per acquirer within a window of time. - */ - fun traceNumber(traceNumber: String?) = - traceNumber(JsonField.ofNullable(traceNumber)) + /** Issuer Community Growth Acceleration Program Fee. */ + @JvmField + val VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM = + of("visa_community_growth_acceleration_program") - /** Alias for calling [Builder.traceNumber] with `traceNumber.orElse(null)`. */ - fun traceNumber(traceNumber: Optional) = - traceNumber(traceNumber.getOrNull()) + /** Issuer Processing Guarantee for Commercial Credit cards. */ + @JvmField + val VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT = + of("visa_processing_guarantee_commercial_credit") + + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + @JvmField val PULSE_SWITCH_FEE = of("pulse_switch_fee") + + @JvmStatic fun of(value: String) = FeeType(JsonField.of(value)) + } + + /** An enum containing [FeeType]'s known values. */ + enum class Known { + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + VISA_ADVANCED_AUTHORIZATION, + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + VISA_MESSAGE_TRANSMISSION, + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_DOMESTIC, + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, + } /** - * Sets [Builder.traceNumber] to an arbitrary JSON value. + * An enum containing [FeeType]'s known values, as well as an [_UNKNOWN] member. * - * You should usually call [Builder.traceNumber] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * An instance of [FeeType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. */ - fun traceNumber(traceNumber: JsonField) = apply { - this.traceNumber = traceNumber + enum class Value { + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + VISA_ADVANCED_AUTHORIZATION, + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + VISA_MESSAGE_TRANSMISSION, + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_DOMESTIC, + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, + /** + * An enum member indicating that [FeeType] was instantiated with an unknown + * value. + */ + _UNKNOWN, } /** - * A globally unique transaction identifier provided by the card network, used - * across multiple life-cycle requests. + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. */ - fun transactionId(transactionId: String?) = - transactionId(JsonField.ofNullable(transactionId)) + fun value(): Value = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Value.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Value.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Value.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Value.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Value.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Value.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Value.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Value.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Value.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Value.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Value.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Value.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Value.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Value.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Value.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Value.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Value.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Value.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Value.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Value.PULSE_SWITCH_FEE + else -> Value._UNKNOWN + } /** - * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`. + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. */ - fun transactionId(transactionId: Optional) = - transactionId(transactionId.getOrNull()) + fun known(): Known = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Known.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Known.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Known.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Known.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Known.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Known.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Known.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Known.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Known.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Known.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Known.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Known.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Known.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Known.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Known.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Known.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Known.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Known.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Known.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Known.PULSE_SWITCH_FEE + else -> throw IncreaseInvalidDataException("Unknown FeeType: $value") + } /** - * Sets [Builder.transactionId] to an arbitrary JSON value. + * Returns this class instance's primitive wire representation. * - * You should usually call [Builder.transactionId] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. */ - fun transactionId(transactionId: JsonField) = apply { - this.transactionId = transactionId - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + private var validated: Boolean = false - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + fun validate(): FeeType = apply { + if (validated) { + return@apply } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + known() + validated = true } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } /** - * Returns an immutable instance of [NetworkIdentifiers]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .authorizationIdentificationResponse() - * .retrievalReferenceNumber() - * .traceNumber() - * .transactionId() - * ``` + * Returns a score indicating how many valid values are contained in this object + * recursively. * - * @throws IllegalStateException if any required field is unset. + * Used for best match union deserialization. */ - fun build(): NetworkIdentifiers = - NetworkIdentifiers( - checkRequired( - "authorizationIdentificationResponse", - authorizationIdentificationResponse, - ), - checkRequired("retrievalReferenceNumber", retrievalReferenceNumber), - checkRequired("traceNumber", traceNumber), - checkRequired("transactionId", transactionId), - additionalProperties.toMutableMap(), - ) - } + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - private var validated: Boolean = false + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun validate(): NetworkIdentifiers = apply { - if (validated) { - return@apply + return other is FeeType && value == other.value } - authorizationIdentificationResponse() - retrievalReferenceNumber() - traceNumber() - transactionId() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + override fun hashCode() = value.hashCode() - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (authorizationIdentificationResponse.asKnown().isPresent) 1 else 0) + - (if (retrievalReferenceNumber.asKnown().isPresent) 1 else 0) + - (if (traceNumber.asKnown().isPresent) 1 else 0) + - (if (transactionId.asKnown().isPresent) 1 else 0) + override fun toString() = value.toString() + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is NetworkIdentifiers && - authorizationIdentificationResponse == - other.authorizationIdentificationResponse && - retrievalReferenceNumber == other.retrievalReferenceNumber && - traceNumber == other.traceNumber && - transactionId == other.transactionId && + return other is SchemeFee && + amount == other.amount && + createdAt == other.createdAt && + currency == other.currency && + feeType == other.feeType && + fixedComponent == other.fixedComponent && + variableRate == other.variableRate && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { Objects.hash( - authorizationIdentificationResponse, - retrievalReferenceNumber, - traceNumber, - transactionId, + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, additionalProperties, ) } @@ -25152,7 +27843,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NetworkIdentifiers{authorizationIdentificationResponse=$authorizationIdentificationResponse, retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}" + "SchemeFee{amount=$amount, createdAt=$createdAt, currency=$currency, feeType=$feeType, fixedComponent=$fixedComponent, variableRate=$variableRate, additionalProperties=$additionalProperties}" } /** @@ -26864,6 +29555,7 @@ private constructor( networkRiskScore == other.networkRiskScore && physicalCardId == other.physicalCardId && realTimeDecisionId == other.realTimeDecisionId && + schemeFees == other.schemeFees && terminalId == other.terminalId && type == other.type && verification == other.verification && @@ -26890,6 +29582,7 @@ private constructor( networkRiskScore, physicalCardId, realTimeDecisionId, + schemeFees, terminalId, type, verification, @@ -26900,7 +29593,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CardBalanceInquiry{id=$id, additionalAmounts=$additionalAmounts, balance=$balance, cardPaymentId=$cardPaymentId, currency=$currency, digitalWalletTokenId=$digitalWalletTokenId, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkDetails=$networkDetails, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, physicalCardId=$physicalCardId, realTimeDecisionId=$realTimeDecisionId, terminalId=$terminalId, type=$type, verification=$verification, additionalProperties=$additionalProperties}" + "CardBalanceInquiry{id=$id, additionalAmounts=$additionalAmounts, balance=$balance, cardPaymentId=$cardPaymentId, currency=$currency, digitalWalletTokenId=$digitalWalletTokenId, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkDetails=$networkDetails, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, physicalCardId=$physicalCardId, realTimeDecisionId=$realTimeDecisionId, schemeFees=$schemeFees, terminalId=$terminalId, type=$type, verification=$verification, additionalProperties=$additionalProperties}" } /** @@ -26937,6 +29630,7 @@ private constructor( private val realTimeDecisionId: JsonField, private val realTimeDecisionReason: JsonField, private val reason: JsonField, + private val schemeFees: JsonField>, private val terminalId: JsonField, private val verification: JsonField, private val additionalProperties: MutableMap, @@ -27021,6 +29715,9 @@ private constructor( @JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(), + @JsonProperty("scheme_fees") + @ExcludeMissing + schemeFees: JsonField> = JsonMissing.of(), @JsonProperty("terminal_id") @ExcludeMissing terminalId: JsonField = JsonMissing.of(), @@ -27055,6 +29752,7 @@ private constructor( realTimeDecisionId, realTimeDecisionReason, reason, + schemeFees, terminalId, verification, mutableMapOf(), @@ -27323,6 +30021,15 @@ private constructor( */ fun reason(): Reason = reason.getRequired("reason") + /** + * The scheme fees associated with this card decline. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun schemeFees(): List = schemeFees.getRequired("scheme_fees") + /** * The terminal identifier (commonly abbreviated as TID) of the terminal the card is * transacting with. @@ -27604,6 +30311,16 @@ private constructor( */ @JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason + /** + * Returns the raw JSON value of [schemeFees]. + * + * Unlike [schemeFees], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("scheme_fees") + @ExcludeMissing + fun _schemeFees(): JsonField> = schemeFees + /** * Returns the raw JSON value of [terminalId]. * @@ -27670,6 +30387,7 @@ private constructor( * .realTimeDecisionId() * .realTimeDecisionReason() * .reason() + * .schemeFees() * .terminalId() * .verification() * ``` @@ -27707,6 +30425,7 @@ private constructor( private var realTimeDecisionId: JsonField? = null private var realTimeDecisionReason: JsonField? = null private var reason: JsonField? = null + private var schemeFees: JsonField>? = null private var terminalId: JsonField? = null private var verification: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -27740,6 +30459,7 @@ private constructor( realTimeDecisionId = cardDecline.realTimeDecisionId realTimeDecisionReason = cardDecline.realTimeDecisionReason reason = cardDecline.reason + schemeFees = cardDecline.schemeFees.map { it.toMutableList() } terminalId = cardDecline.terminalId verification = cardDecline.verification additionalProperties = cardDecline.additionalProperties.toMutableMap() @@ -28253,6 +30973,32 @@ private constructor( */ fun reason(reason: JsonField) = apply { this.reason = reason } + /** The scheme fees associated with this card decline. */ + fun schemeFees(schemeFees: List) = schemeFees(JsonField.of(schemeFees)) + + /** + * Sets [Builder.schemeFees] to an arbitrary JSON value. + * + * You should usually call [Builder.schemeFees] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun schemeFees(schemeFees: JsonField>) = apply { + this.schemeFees = schemeFees.map { it.toMutableList() } + } + + /** + * Adds a single [SchemeFee] to [schemeFees]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addSchemeFee(schemeFee: SchemeFee) = apply { + schemeFees = + (schemeFees ?: JsonField.of(mutableListOf())).also { + checkKnown("schemeFees", it).add(schemeFee) + } + } + /** * The terminal identifier (commonly abbreviated as TID) of the terminal the card is * transacting with. @@ -28344,6 +31090,7 @@ private constructor( * .realTimeDecisionId() * .realTimeDecisionReason() * .reason() + * .schemeFees() * .terminalId() * .verification() * ``` @@ -28382,6 +31129,7 @@ private constructor( checkRequired("realTimeDecisionId", realTimeDecisionId), checkRequired("realTimeDecisionReason", realTimeDecisionReason), checkRequired("reason", reason), + checkRequired("schemeFees", schemeFees).map { it.toImmutable() }, checkRequired("terminalId", terminalId), checkRequired("verification", verification), additionalProperties.toMutableMap(), @@ -28422,6 +31170,7 @@ private constructor( realTimeDecisionId() realTimeDecisionReason().ifPresent { it.validate() } reason().validate() + schemeFees().forEach { it.validate() } terminalId() verification().validate() validated = true @@ -28470,6 +31219,7 @@ private constructor( (if (realTimeDecisionId.asKnown().isPresent) 1 else 0) + (realTimeDecisionReason.asKnown().getOrNull()?.validity() ?: 0) + (reason.asKnown().getOrNull()?.validity() ?: 0) + + (schemeFees.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (terminalId.asKnown().isPresent) 1 else 0) + (verification.asKnown().getOrNull()?.validity() ?: 0) @@ -33840,307 +36590,837 @@ private constructor( ) /** - * The randomly generated 6-character Authorization Identification Response code - * sent back to the acquirer in an approved response. + * The randomly generated 6-character Authorization Identification Response code + * sent back to the acquirer in an approved response. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun authorizationIdentificationResponse(): Optional = + authorizationIdentificationResponse.getOptional( + "authorization_identification_response" + ) + + /** + * A life-cycle identifier used across e.g., an authorization and a reversal. + * Expected to be unique per acquirer within a window of time. For some card + * networks the retrieval reference number includes the trace counter. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun retrievalReferenceNumber(): Optional = + retrievalReferenceNumber.getOptional("retrieval_reference_number") + + /** + * A counter used to verify an individual authorization. Expected to be unique per + * acquirer within a window of time. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun traceNumber(): Optional = traceNumber.getOptional("trace_number") + + /** + * A globally unique transaction identifier provided by the card network, used + * across multiple life-cycle requests. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun transactionId(): Optional = transactionId.getOptional("transaction_id") + + /** + * Returns the raw JSON value of [authorizationIdentificationResponse]. + * + * Unlike [authorizationIdentificationResponse], this method doesn't throw if the + * JSON field has an unexpected type. + */ + @JsonProperty("authorization_identification_response") + @ExcludeMissing + fun _authorizationIdentificationResponse(): JsonField = + authorizationIdentificationResponse + + /** + * Returns the raw JSON value of [retrievalReferenceNumber]. + * + * Unlike [retrievalReferenceNumber], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("retrieval_reference_number") + @ExcludeMissing + fun _retrievalReferenceNumber(): JsonField = retrievalReferenceNumber + + /** + * Returns the raw JSON value of [traceNumber]. + * + * Unlike [traceNumber], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("trace_number") + @ExcludeMissing + fun _traceNumber(): JsonField = traceNumber + + /** + * Returns the raw JSON value of [transactionId]. + * + * Unlike [transactionId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("transaction_id") + @ExcludeMissing + fun _transactionId(): JsonField = transactionId + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [NetworkIdentifiers]. + * + * The following fields are required: + * ```java + * .authorizationIdentificationResponse() + * .retrievalReferenceNumber() + * .traceNumber() + * .transactionId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [NetworkIdentifiers]. */ + class Builder internal constructor() { + + private var authorizationIdentificationResponse: JsonField? = null + private var retrievalReferenceNumber: JsonField? = null + private var traceNumber: JsonField? = null + private var transactionId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(networkIdentifiers: NetworkIdentifiers) = apply { + authorizationIdentificationResponse = + networkIdentifiers.authorizationIdentificationResponse + retrievalReferenceNumber = networkIdentifiers.retrievalReferenceNumber + traceNumber = networkIdentifiers.traceNumber + transactionId = networkIdentifiers.transactionId + additionalProperties = + networkIdentifiers.additionalProperties.toMutableMap() + } + + /** + * The randomly generated 6-character Authorization Identification Response code + * sent back to the acquirer in an approved response. + */ + fun authorizationIdentificationResponse( + authorizationIdentificationResponse: String? + ) = + authorizationIdentificationResponse( + JsonField.ofNullable(authorizationIdentificationResponse) + ) + + /** + * Alias for calling [Builder.authorizationIdentificationResponse] with + * `authorizationIdentificationResponse.orElse(null)`. + */ + fun authorizationIdentificationResponse( + authorizationIdentificationResponse: Optional + ) = + authorizationIdentificationResponse( + authorizationIdentificationResponse.getOrNull() + ) + + /** + * Sets [Builder.authorizationIdentificationResponse] to an arbitrary JSON + * value. + * + * You should usually call [Builder.authorizationIdentificationResponse] with a + * well-typed [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun authorizationIdentificationResponse( + authorizationIdentificationResponse: JsonField + ) = apply { + this.authorizationIdentificationResponse = + authorizationIdentificationResponse + } + + /** + * A life-cycle identifier used across e.g., an authorization and a reversal. + * Expected to be unique per acquirer within a window of time. For some card + * networks the retrieval reference number includes the trace counter. + */ + fun retrievalReferenceNumber(retrievalReferenceNumber: String?) = + retrievalReferenceNumber(JsonField.ofNullable(retrievalReferenceNumber)) + + /** + * Alias for calling [Builder.retrievalReferenceNumber] with + * `retrievalReferenceNumber.orElse(null)`. + */ + fun retrievalReferenceNumber(retrievalReferenceNumber: Optional) = + retrievalReferenceNumber(retrievalReferenceNumber.getOrNull()) + + /** + * Sets [Builder.retrievalReferenceNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.retrievalReferenceNumber] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun retrievalReferenceNumber(retrievalReferenceNumber: JsonField) = + apply { + this.retrievalReferenceNumber = retrievalReferenceNumber + } + + /** + * A counter used to verify an individual authorization. Expected to be unique + * per acquirer within a window of time. + */ + fun traceNumber(traceNumber: String?) = + traceNumber(JsonField.ofNullable(traceNumber)) + + /** Alias for calling [Builder.traceNumber] with `traceNumber.orElse(null)`. */ + fun traceNumber(traceNumber: Optional) = + traceNumber(traceNumber.getOrNull()) + + /** + * Sets [Builder.traceNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.traceNumber] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun traceNumber(traceNumber: JsonField) = apply { + this.traceNumber = traceNumber + } + + /** + * A globally unique transaction identifier provided by the card network, used + * across multiple life-cycle requests. + */ + fun transactionId(transactionId: String?) = + transactionId(JsonField.ofNullable(transactionId)) + + /** + * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`. + */ + fun transactionId(transactionId: Optional) = + transactionId(transactionId.getOrNull()) + + /** + * Sets [Builder.transactionId] to an arbitrary JSON value. + * + * You should usually call [Builder.transactionId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun transactionId(transactionId: JsonField) = apply { + this.transactionId = transactionId + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [NetworkIdentifiers]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .authorizationIdentificationResponse() + * .retrievalReferenceNumber() + * .traceNumber() + * .transactionId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): NetworkIdentifiers = + NetworkIdentifiers( + checkRequired( + "authorizationIdentificationResponse", + authorizationIdentificationResponse, + ), + checkRequired("retrievalReferenceNumber", retrievalReferenceNumber), + checkRequired("traceNumber", traceNumber), + checkRequired("transactionId", transactionId), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): NetworkIdentifiers = apply { + if (validated) { + return@apply + } + + authorizationIdentificationResponse() + retrievalReferenceNumber() + traceNumber() + transactionId() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (authorizationIdentificationResponse.asKnown().isPresent) 1 else 0) + + (if (retrievalReferenceNumber.asKnown().isPresent) 1 else 0) + + (if (traceNumber.asKnown().isPresent) 1 else 0) + + (if (transactionId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is NetworkIdentifiers && + authorizationIdentificationResponse == + other.authorizationIdentificationResponse && + retrievalReferenceNumber == other.retrievalReferenceNumber && + traceNumber == other.traceNumber && + transactionId == other.transactionId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + authorizationIdentificationResponse, + retrievalReferenceNumber, + traceNumber, + transactionId, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "NetworkIdentifiers{authorizationIdentificationResponse=$authorizationIdentificationResponse, retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}" + } + + /** + * The processing category describes the intent behind the authorization, such as + * whether it was used for bill payments or an automatic fuel dispenser. + */ + class ProcessingCategory + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + /** + * Account funding transactions are transactions used to e.g., fund an account + * or transfer funds between accounts. + */ + @JvmField val ACCOUNT_FUNDING = of("account_funding") + + /** + * Automatic fuel dispenser authorizations occur when a card is used at a gas + * pump, prior to the actual transaction amount being known. They are followed + * by an advice message that updates the amount of the pending transaction. + */ + @JvmField val AUTOMATIC_FUEL_DISPENSER = of("automatic_fuel_dispenser") + + /** A transaction used to pay a bill. */ + @JvmField val BILL_PAYMENT = of("bill_payment") + + /** Original credit transactions are used to send money to a cardholder. */ + @JvmField val ORIGINAL_CREDIT = of("original_credit") + + /** A regular purchase. */ + @JvmField val PURCHASE = of("purchase") + + /** + * Quasi-cash transactions represent purchases of items which may be convertible + * to cash. + */ + @JvmField val QUASI_CASH = of("quasi_cash") + + /** + * A refund card authorization, sometimes referred to as a credit voucher + * authorization, where funds are credited to the cardholder. + */ + @JvmField val REFUND = of("refund") + + /** + * Cash disbursement transactions are used to withdraw cash from an ATM or a + * point of sale. + */ + @JvmField val CASH_DISBURSEMENT = of("cash_disbursement") + + /** + * A balance inquiry transaction is used to check the balance of an account + * associated with a card. + */ + @JvmField val BALANCE_INQUIRY = of("balance_inquiry") + + /** The processing category is unknown. */ + @JvmField val UNKNOWN = of("unknown") + + @JvmStatic fun of(value: String) = ProcessingCategory(JsonField.of(value)) + } + + /** An enum containing [ProcessingCategory]'s known values. */ + enum class Known { + /** + * Account funding transactions are transactions used to e.g., fund an account + * or transfer funds between accounts. + */ + ACCOUNT_FUNDING, + /** + * Automatic fuel dispenser authorizations occur when a card is used at a gas + * pump, prior to the actual transaction amount being known. They are followed + * by an advice message that updates the amount of the pending transaction. + */ + AUTOMATIC_FUEL_DISPENSER, + /** A transaction used to pay a bill. */ + BILL_PAYMENT, + /** Original credit transactions are used to send money to a cardholder. */ + ORIGINAL_CREDIT, + /** A regular purchase. */ + PURCHASE, + /** + * Quasi-cash transactions represent purchases of items which may be convertible + * to cash. + */ + QUASI_CASH, + /** + * A refund card authorization, sometimes referred to as a credit voucher + * authorization, where funds are credited to the cardholder. + */ + REFUND, + /** + * Cash disbursement transactions are used to withdraw cash from an ATM or a + * point of sale. + */ + CASH_DISBURSEMENT, + /** + * A balance inquiry transaction is used to check the balance of an account + * associated with a card. + */ + BALANCE_INQUIRY, + /** The processing category is unknown. */ + UNKNOWN, + } + + /** + * An enum containing [ProcessingCategory]'s known values, as well as an [_UNKNOWN] + * member. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * An instance of [ProcessingCategory] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. */ - fun authorizationIdentificationResponse(): Optional = - authorizationIdentificationResponse.getOptional( - "authorization_identification_response" - ) + enum class Value { + /** + * Account funding transactions are transactions used to e.g., fund an account + * or transfer funds between accounts. + */ + ACCOUNT_FUNDING, + /** + * Automatic fuel dispenser authorizations occur when a card is used at a gas + * pump, prior to the actual transaction amount being known. They are followed + * by an advice message that updates the amount of the pending transaction. + */ + AUTOMATIC_FUEL_DISPENSER, + /** A transaction used to pay a bill. */ + BILL_PAYMENT, + /** Original credit transactions are used to send money to a cardholder. */ + ORIGINAL_CREDIT, + /** A regular purchase. */ + PURCHASE, + /** + * Quasi-cash transactions represent purchases of items which may be convertible + * to cash. + */ + QUASI_CASH, + /** + * A refund card authorization, sometimes referred to as a credit voucher + * authorization, where funds are credited to the cardholder. + */ + REFUND, + /** + * Cash disbursement transactions are used to withdraw cash from an ATM or a + * point of sale. + */ + CASH_DISBURSEMENT, + /** + * A balance inquiry transaction is used to check the balance of an account + * associated with a card. + */ + BALANCE_INQUIRY, + /** The processing category is unknown. */ + UNKNOWN, + /** + * An enum member indicating that [ProcessingCategory] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } /** - * A life-cycle identifier used across e.g., an authorization and a reversal. - * Expected to be unique per acquirer within a window of time. For some card - * networks the retrieval reference number includes the trace counter. + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. */ - fun retrievalReferenceNumber(): Optional = - retrievalReferenceNumber.getOptional("retrieval_reference_number") + fun value(): Value = + when (this) { + ACCOUNT_FUNDING -> Value.ACCOUNT_FUNDING + AUTOMATIC_FUEL_DISPENSER -> Value.AUTOMATIC_FUEL_DISPENSER + BILL_PAYMENT -> Value.BILL_PAYMENT + ORIGINAL_CREDIT -> Value.ORIGINAL_CREDIT + PURCHASE -> Value.PURCHASE + QUASI_CASH -> Value.QUASI_CASH + REFUND -> Value.REFUND + CASH_DISBURSEMENT -> Value.CASH_DISBURSEMENT + BALANCE_INQUIRY -> Value.BALANCE_INQUIRY + UNKNOWN -> Value.UNKNOWN + else -> Value._UNKNOWN + } /** - * A counter used to verify an individual authorization. Expected to be unique per - * acquirer within a window of time. + * Returns an enum member corresponding to this class instance's value. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun traceNumber(): Optional = traceNumber.getOptional("trace_number") - - /** - * A globally unique transaction identifier provided by the card network, used - * across multiple life-cycle requests. + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * @throws IncreaseInvalidDataException if this class instance's value is a not a + * known member. */ - fun transactionId(): Optional = transactionId.getOptional("transaction_id") + fun known(): Known = + when (this) { + ACCOUNT_FUNDING -> Known.ACCOUNT_FUNDING + AUTOMATIC_FUEL_DISPENSER -> Known.AUTOMATIC_FUEL_DISPENSER + BILL_PAYMENT -> Known.BILL_PAYMENT + ORIGINAL_CREDIT -> Known.ORIGINAL_CREDIT + PURCHASE -> Known.PURCHASE + QUASI_CASH -> Known.QUASI_CASH + REFUND -> Known.REFUND + CASH_DISBURSEMENT -> Known.CASH_DISBURSEMENT + BALANCE_INQUIRY -> Known.BALANCE_INQUIRY + UNKNOWN -> Known.UNKNOWN + else -> + throw IncreaseInvalidDataException("Unknown ProcessingCategory: $value") + } /** - * Returns the raw JSON value of [authorizationIdentificationResponse]. + * Returns this class instance's primitive wire representation. * - * Unlike [authorizationIdentificationResponse], this method doesn't throw if the - * JSON field has an unexpected type. - */ - @JsonProperty("authorization_identification_response") - @ExcludeMissing - fun _authorizationIdentificationResponse(): JsonField = - authorizationIdentificationResponse - - /** - * Returns the raw JSON value of [retrievalReferenceNumber]. + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. * - * Unlike [retrievalReferenceNumber], this method doesn't throw if the JSON field - * has an unexpected type. + * @throws IncreaseInvalidDataException if this class instance's value does not have + * the expected primitive type. */ - @JsonProperty("retrieval_reference_number") - @ExcludeMissing - fun _retrievalReferenceNumber(): JsonField = retrievalReferenceNumber + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - /** - * Returns the raw JSON value of [traceNumber]. - * - * Unlike [traceNumber], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("trace_number") - @ExcludeMissing - fun _traceNumber(): JsonField = traceNumber + private var validated: Boolean = false + + fun validate(): ProcessingCategory = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } /** - * Returns the raw JSON value of [transactionId]. + * Returns a score indicating how many valid values are contained in this object + * recursively. * - * Unlike [transactionId], this method doesn't throw if the JSON field has an - * unexpected type. + * Used for best match union deserialization. */ - @JsonProperty("transaction_id") - @ExcludeMissing - fun _transactionId(): JsonField = transactionId + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProcessingCategory && value == other.value } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + override fun hashCode() = value.hashCode() - fun toBuilder() = Builder().from(this) + override fun toString() = value.toString() + } + + /** This is present if a specific decline reason was given in the real-time decision. */ + class RealTimeDecisionReason + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { /** - * Returns a mutable builder for constructing an instance of - * [NetworkIdentifiers]. - * - * The following fields are required: - * ```java - * .authorizationIdentificationResponse() - * .retrievalReferenceNumber() - * .traceNumber() - * .transactionId() - * ``` + * The cardholder does not have sufficient funds to cover the transaction. The + * merchant may attempt to process the transaction again. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [NetworkIdentifiers]. */ - class Builder internal constructor() { - - private var authorizationIdentificationResponse: JsonField? = null - private var retrievalReferenceNumber: JsonField? = null - private var traceNumber: JsonField? = null - private var transactionId: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(networkIdentifiers: NetworkIdentifiers) = apply { - authorizationIdentificationResponse = - networkIdentifiers.authorizationIdentificationResponse - retrievalReferenceNumber = networkIdentifiers.retrievalReferenceNumber - traceNumber = networkIdentifiers.traceNumber - transactionId = networkIdentifiers.transactionId - additionalProperties = - networkIdentifiers.additionalProperties.toMutableMap() - } + @JvmField val INSUFFICIENT_FUNDS = of("insufficient_funds") /** - * The randomly generated 6-character Authorization Identification Response code - * sent back to the acquirer in an approved response. + * This type of transaction is not allowed for this card. This transaction + * should not be retried. */ - fun authorizationIdentificationResponse( - authorizationIdentificationResponse: String? - ) = - authorizationIdentificationResponse( - JsonField.ofNullable(authorizationIdentificationResponse) - ) + @JvmField val TRANSACTION_NEVER_ALLOWED = of("transaction_never_allowed") /** - * Alias for calling [Builder.authorizationIdentificationResponse] with - * `authorizationIdentificationResponse.orElse(null)`. + * The transaction amount exceeds the cardholder's approval limit. The merchant + * may attempt to process the transaction again. */ - fun authorizationIdentificationResponse( - authorizationIdentificationResponse: Optional - ) = - authorizationIdentificationResponse( - authorizationIdentificationResponse.getOrNull() - ) + @JvmField val EXCEEDS_APPROVAL_LIMIT = of("exceeds_approval_limit") /** - * Sets [Builder.authorizationIdentificationResponse] to an arbitrary JSON - * value. - * - * You should usually call [Builder.authorizationIdentificationResponse] with a - * well-typed [String] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * The card has been temporarily disabled or not yet activated. The merchant may + * attempt to process the transaction again. */ - fun authorizationIdentificationResponse( - authorizationIdentificationResponse: JsonField - ) = apply { - this.authorizationIdentificationResponse = - authorizationIdentificationResponse - } + @JvmField val CARD_TEMPORARILY_DISABLED = of("card_temporarily_disabled") /** - * A life-cycle identifier used across e.g., an authorization and a reversal. - * Expected to be unique per acquirer within a window of time. For some card - * networks the retrieval reference number includes the trace counter. + * The transaction is suspected to be fraudulent. The merchant may attempt to + * process the transaction again. */ - fun retrievalReferenceNumber(retrievalReferenceNumber: String?) = - retrievalReferenceNumber(JsonField.ofNullable(retrievalReferenceNumber)) + @JvmField val SUSPECTED_FRAUD = of("suspected_fraud") /** - * Alias for calling [Builder.retrievalReferenceNumber] with - * `retrievalReferenceNumber.orElse(null)`. + * The transaction was declined for another reason. The merchant may attempt to + * process the transaction again. This should be used sparingly. */ - fun retrievalReferenceNumber(retrievalReferenceNumber: Optional) = - retrievalReferenceNumber(retrievalReferenceNumber.getOrNull()) + @JvmField val OTHER = of("other") + + @JvmStatic fun of(value: String) = RealTimeDecisionReason(JsonField.of(value)) + } + /** An enum containing [RealTimeDecisionReason]'s known values. */ + enum class Known { /** - * Sets [Builder.retrievalReferenceNumber] to an arbitrary JSON value. - * - * You should usually call [Builder.retrievalReferenceNumber] with a well-typed - * [String] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * The cardholder does not have sufficient funds to cover the transaction. The + * merchant may attempt to process the transaction again. */ - fun retrievalReferenceNumber(retrievalReferenceNumber: JsonField) = - apply { - this.retrievalReferenceNumber = retrievalReferenceNumber - } - + INSUFFICIENT_FUNDS, /** - * A counter used to verify an individual authorization. Expected to be unique - * per acquirer within a window of time. + * This type of transaction is not allowed for this card. This transaction + * should not be retried. */ - fun traceNumber(traceNumber: String?) = - traceNumber(JsonField.ofNullable(traceNumber)) - - /** Alias for calling [Builder.traceNumber] with `traceNumber.orElse(null)`. */ - fun traceNumber(traceNumber: Optional) = - traceNumber(traceNumber.getOrNull()) - + TRANSACTION_NEVER_ALLOWED, /** - * Sets [Builder.traceNumber] to an arbitrary JSON value. - * - * You should usually call [Builder.traceNumber] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * The transaction amount exceeds the cardholder's approval limit. The merchant + * may attempt to process the transaction again. */ - fun traceNumber(traceNumber: JsonField) = apply { - this.traceNumber = traceNumber - } - + EXCEEDS_APPROVAL_LIMIT, /** - * A globally unique transaction identifier provided by the card network, used - * across multiple life-cycle requests. + * The card has been temporarily disabled or not yet activated. The merchant may + * attempt to process the transaction again. */ - fun transactionId(transactionId: String?) = - transactionId(JsonField.ofNullable(transactionId)) - + CARD_TEMPORARILY_DISABLED, /** - * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`. + * The transaction is suspected to be fraudulent. The merchant may attempt to + * process the transaction again. */ - fun transactionId(transactionId: Optional) = - transactionId(transactionId.getOrNull()) - + SUSPECTED_FRAUD, /** - * Sets [Builder.transactionId] to an arbitrary JSON value. - * - * You should usually call [Builder.transactionId] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * The transaction was declined for another reason. The merchant may attempt to + * process the transaction again. This should be used sparingly. */ - fun transactionId(transactionId: JsonField) = apply { - this.transactionId = transactionId - } + OTHER, + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** + * An enum containing [RealTimeDecisionReason]'s known values, as well as an + * [_UNKNOWN] member. + * + * An instance of [RealTimeDecisionReason] can contain an unknown value in a couple + * of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** + * The cardholder does not have sufficient funds to cover the transaction. The + * merchant may attempt to process the transaction again. + */ + INSUFFICIENT_FUNDS, + /** + * This type of transaction is not allowed for this card. This transaction + * should not be retried. + */ + TRANSACTION_NEVER_ALLOWED, + /** + * The transaction amount exceeds the cardholder's approval limit. The merchant + * may attempt to process the transaction again. + */ + EXCEEDS_APPROVAL_LIMIT, + /** + * The card has been temporarily disabled or not yet activated. The merchant may + * attempt to process the transaction again. + */ + CARD_TEMPORARILY_DISABLED, + /** + * The transaction is suspected to be fraudulent. The merchant may attempt to + * process the transaction again. + */ + SUSPECTED_FRAUD, + /** + * The transaction was declined for another reason. The merchant may attempt to + * process the transaction again. This should be used sparingly. + */ + OTHER, + /** + * An enum member indicating that [RealTimeDecisionReason] was instantiated with + * an unknown value. + */ + _UNKNOWN, + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + INSUFFICIENT_FUNDS -> Value.INSUFFICIENT_FUNDS + TRANSACTION_NEVER_ALLOWED -> Value.TRANSACTION_NEVER_ALLOWED + EXCEEDS_APPROVAL_LIMIT -> Value.EXCEEDS_APPROVAL_LIMIT + CARD_TEMPORARILY_DISABLED -> Value.CARD_TEMPORARILY_DISABLED + SUSPECTED_FRAUD -> Value.SUSPECTED_FRAUD + OTHER -> Value.OTHER + else -> Value._UNKNOWN } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + INSUFFICIENT_FUNDS -> Known.INSUFFICIENT_FUNDS + TRANSACTION_NEVER_ALLOWED -> Known.TRANSACTION_NEVER_ALLOWED + EXCEEDS_APPROVAL_LIMIT -> Known.EXCEEDS_APPROVAL_LIMIT + CARD_TEMPORARILY_DISABLED -> Known.CARD_TEMPORARILY_DISABLED + SUSPECTED_FRAUD -> Known.SUSPECTED_FRAUD + OTHER -> Known.OTHER + else -> + throw IncreaseInvalidDataException( + "Unknown RealTimeDecisionReason: $value" + ) } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") } - /** - * Returns an immutable instance of [NetworkIdentifiers]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .authorizationIdentificationResponse() - * .retrievalReferenceNumber() - * .traceNumber() - * .transactionId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): NetworkIdentifiers = - NetworkIdentifiers( - checkRequired( - "authorizationIdentificationResponse", - authorizationIdentificationResponse, - ), - checkRequired("retrievalReferenceNumber", retrievalReferenceNumber), - checkRequired("traceNumber", traceNumber), - checkRequired("transactionId", transactionId), - additionalProperties.toMutableMap(), - ) - } - private var validated: Boolean = false - fun validate(): NetworkIdentifiers = apply { + fun validate(): RealTimeDecisionReason = apply { if (validated) { return@apply } - authorizationIdentificationResponse() - retrievalReferenceNumber() - traceNumber() - transactionId() + known() validated = true } @@ -34158,50 +37438,24 @@ private constructor( * * Used for best match union deserialization. */ - @JvmSynthetic - internal fun validity(): Int = - (if (authorizationIdentificationResponse.asKnown().isPresent) 1 else 0) + - (if (retrievalReferenceNumber.asKnown().isPresent) 1 else 0) + - (if (traceNumber.asKnown().isPresent) 1 else 0) + - (if (transactionId.asKnown().isPresent) 1 else 0) + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is NetworkIdentifiers && - authorizationIdentificationResponse == - other.authorizationIdentificationResponse && - retrievalReferenceNumber == other.retrievalReferenceNumber && - traceNumber == other.traceNumber && - transactionId == other.transactionId && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - authorizationIdentificationResponse, - retrievalReferenceNumber, - traceNumber, - transactionId, - additionalProperties, - ) + return other is RealTimeDecisionReason && value == other.value } - override fun hashCode(): Int = hashCode + override fun hashCode() = value.hashCode() - override fun toString() = - "NetworkIdentifiers{authorizationIdentificationResponse=$authorizationIdentificationResponse, retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}" + override fun toString() = value.toString() } - /** - * The processing category describes the intent behind the authorization, such as - * whether it was used for bill payments or an automatic fuel dispenser. - */ - class ProcessingCategory - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** Why the transaction was declined. */ + class Reason @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -34215,155 +37469,220 @@ private constructor( companion object { - /** - * Account funding transactions are transactions used to e.g., fund an account - * or transfer funds between accounts. - */ - @JvmField val ACCOUNT_FUNDING = of("account_funding") + /** The account has been closed. */ + @JvmField val ACCOUNT_CLOSED = of("account_closed") + + /** The Card was not active. */ + @JvmField val CARD_NOT_ACTIVE = of("card_not_active") + + /** The Card has been canceled. */ + @JvmField val CARD_CANCELED = of("card_canceled") + + /** The Physical Card was not active. */ + @JvmField val PHYSICAL_CARD_NOT_ACTIVE = of("physical_card_not_active") + + /** The account's entity was not active. */ + @JvmField val ENTITY_NOT_ACTIVE = of("entity_not_active") + + /** The account was inactive. */ + @JvmField val GROUP_LOCKED = of("group_locked") + + /** The Card's Account did not have a sufficient available balance. */ + @JvmField val INSUFFICIENT_FUNDS = of("insufficient_funds") + + /** The given CVV2 did not match the card's value. */ + @JvmField val CVV2_MISMATCH = of("cvv2_mismatch") + + /** The given PIN did not match the card's value. */ + @JvmField val PIN_MISMATCH = of("pin_mismatch") /** - * Automatic fuel dispenser authorizations occur when a card is used at a gas - * pump, prior to the actual transaction amount being known. They are followed - * by an advice message that updates the amount of the pending transaction. + * The given expiration date did not match the card's value. Only applies when a + * CVV2 is present. */ - @JvmField val AUTOMATIC_FUEL_DISPENSER = of("automatic_fuel_dispenser") + @JvmField val CARD_EXPIRATION_MISMATCH = of("card_expiration_mismatch") - /** A transaction used to pay a bill. */ - @JvmField val BILL_PAYMENT = of("bill_payment") + /** The attempted card transaction is not allowed per Increase's terms. */ + @JvmField val TRANSACTION_NOT_ALLOWED = of("transaction_not_allowed") - /** Original credit transactions are used to send money to a cardholder. */ - @JvmField val ORIGINAL_CREDIT = of("original_credit") + /** The transaction was blocked by a Limit. */ + @JvmField val BREACHES_LIMIT = of("breaches_limit") - /** A regular purchase. */ - @JvmField val PURCHASE = of("purchase") + /** Your application declined the transaction via webhook. */ + @JvmField val WEBHOOK_DECLINED = of("webhook_declined") + + /** Your application webhook did not respond without the required timeout. */ + @JvmField val WEBHOOK_TIMED_OUT = of("webhook_timed_out") + + /** Declined by stand-in processing. */ + @JvmField + val DECLINED_BY_STAND_IN_PROCESSING = of("declined_by_stand_in_processing") + + /** The card read had an invalid CVV or dCVV. */ + @JvmField val INVALID_PHYSICAL_CARD = of("invalid_physical_card") /** - * Quasi-cash transactions represent purchases of items which may be convertible - * to cash. + * The original card authorization for this incremental authorization does not + * exist. */ - @JvmField val QUASI_CASH = of("quasi_cash") + @JvmField + val MISSING_ORIGINAL_AUTHORIZATION = of("missing_original_authorization") /** - * A refund card authorization, sometimes referred to as a credit voucher - * authorization, where funds are credited to the cardholder. + * The card's authorization request cryptogram was invalid. The cryptogram can + * be from a physical card or a Digital Wallet Token purchase. */ - @JvmField val REFUND = of("refund") + @JvmField val INVALID_CRYPTOGRAM = of("invalid_cryptogram") + + /** The transaction was declined because the 3DS authentication failed. */ + @JvmField val FAILED_3DS_AUTHENTICATION = of("failed_3ds_authentication") /** - * Cash disbursement transactions are used to withdraw cash from an ATM or a - * point of sale. + * The transaction was suspected to be used by a card tester to test for valid + * card numbers. */ - @JvmField val CASH_DISBURSEMENT = of("cash_disbursement") + @JvmField val SUSPECTED_CARD_TESTING = of("suspected_card_testing") /** - * A balance inquiry transaction is used to check the balance of an account - * associated with a card. + * The transaction was suspected to be fraudulent. Please reach out to + * support@increase.com for more information. */ - @JvmField val BALANCE_INQUIRY = of("balance_inquiry") - - /** The processing category is unknown. */ - @JvmField val UNKNOWN = of("unknown") + @JvmField val SUSPECTED_FRAUD = of("suspected_fraud") - @JvmStatic fun of(value: String) = ProcessingCategory(JsonField.of(value)) + @JvmStatic fun of(value: String) = Reason(JsonField.of(value)) } - /** An enum containing [ProcessingCategory]'s known values. */ + /** An enum containing [Reason]'s known values. */ enum class Known { + /** The account has been closed. */ + ACCOUNT_CLOSED, + /** The Card was not active. */ + CARD_NOT_ACTIVE, + /** The Card has been canceled. */ + CARD_CANCELED, + /** The Physical Card was not active. */ + PHYSICAL_CARD_NOT_ACTIVE, + /** The account's entity was not active. */ + ENTITY_NOT_ACTIVE, + /** The account was inactive. */ + GROUP_LOCKED, + /** The Card's Account did not have a sufficient available balance. */ + INSUFFICIENT_FUNDS, + /** The given CVV2 did not match the card's value. */ + CVV2_MISMATCH, + /** The given PIN did not match the card's value. */ + PIN_MISMATCH, /** - * Account funding transactions are transactions used to e.g., fund an account - * or transfer funds between accounts. - */ - ACCOUNT_FUNDING, - /** - * Automatic fuel dispenser authorizations occur when a card is used at a gas - * pump, prior to the actual transaction amount being known. They are followed - * by an advice message that updates the amount of the pending transaction. + * The given expiration date did not match the card's value. Only applies when a + * CVV2 is present. */ - AUTOMATIC_FUEL_DISPENSER, - /** A transaction used to pay a bill. */ - BILL_PAYMENT, - /** Original credit transactions are used to send money to a cardholder. */ - ORIGINAL_CREDIT, - /** A regular purchase. */ - PURCHASE, + CARD_EXPIRATION_MISMATCH, + /** The attempted card transaction is not allowed per Increase's terms. */ + TRANSACTION_NOT_ALLOWED, + /** The transaction was blocked by a Limit. */ + BREACHES_LIMIT, + /** Your application declined the transaction via webhook. */ + WEBHOOK_DECLINED, + /** Your application webhook did not respond without the required timeout. */ + WEBHOOK_TIMED_OUT, + /** Declined by stand-in processing. */ + DECLINED_BY_STAND_IN_PROCESSING, + /** The card read had an invalid CVV or dCVV. */ + INVALID_PHYSICAL_CARD, /** - * Quasi-cash transactions represent purchases of items which may be convertible - * to cash. + * The original card authorization for this incremental authorization does not + * exist. */ - QUASI_CASH, + MISSING_ORIGINAL_AUTHORIZATION, /** - * A refund card authorization, sometimes referred to as a credit voucher - * authorization, where funds are credited to the cardholder. + * The card's authorization request cryptogram was invalid. The cryptogram can + * be from a physical card or a Digital Wallet Token purchase. */ - REFUND, + INVALID_CRYPTOGRAM, + /** The transaction was declined because the 3DS authentication failed. */ + FAILED_3DS_AUTHENTICATION, /** - * Cash disbursement transactions are used to withdraw cash from an ATM or a - * point of sale. + * The transaction was suspected to be used by a card tester to test for valid + * card numbers. */ - CASH_DISBURSEMENT, + SUSPECTED_CARD_TESTING, /** - * A balance inquiry transaction is used to check the balance of an account - * associated with a card. + * The transaction was suspected to be fraudulent. Please reach out to + * support@increase.com for more information. */ - BALANCE_INQUIRY, - /** The processing category is unknown. */ - UNKNOWN, + SUSPECTED_FRAUD, } /** - * An enum containing [ProcessingCategory]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [Reason]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [ProcessingCategory] can contain an unknown value in a couple of - * cases: + * An instance of [Reason] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, * if the SDK is on an older version than the API, then the API may respond with * new members that the SDK is unaware of. * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { + /** The account has been closed. */ + ACCOUNT_CLOSED, + /** The Card was not active. */ + CARD_NOT_ACTIVE, + /** The Card has been canceled. */ + CARD_CANCELED, + /** The Physical Card was not active. */ + PHYSICAL_CARD_NOT_ACTIVE, + /** The account's entity was not active. */ + ENTITY_NOT_ACTIVE, + /** The account was inactive. */ + GROUP_LOCKED, + /** The Card's Account did not have a sufficient available balance. */ + INSUFFICIENT_FUNDS, + /** The given CVV2 did not match the card's value. */ + CVV2_MISMATCH, + /** The given PIN did not match the card's value. */ + PIN_MISMATCH, /** - * Account funding transactions are transactions used to e.g., fund an account - * or transfer funds between accounts. - */ - ACCOUNT_FUNDING, - /** - * Automatic fuel dispenser authorizations occur when a card is used at a gas - * pump, prior to the actual transaction amount being known. They are followed - * by an advice message that updates the amount of the pending transaction. + * The given expiration date did not match the card's value. Only applies when a + * CVV2 is present. */ - AUTOMATIC_FUEL_DISPENSER, - /** A transaction used to pay a bill. */ - BILL_PAYMENT, - /** Original credit transactions are used to send money to a cardholder. */ - ORIGINAL_CREDIT, - /** A regular purchase. */ - PURCHASE, + CARD_EXPIRATION_MISMATCH, + /** The attempted card transaction is not allowed per Increase's terms. */ + TRANSACTION_NOT_ALLOWED, + /** The transaction was blocked by a Limit. */ + BREACHES_LIMIT, + /** Your application declined the transaction via webhook. */ + WEBHOOK_DECLINED, + /** Your application webhook did not respond without the required timeout. */ + WEBHOOK_TIMED_OUT, + /** Declined by stand-in processing. */ + DECLINED_BY_STAND_IN_PROCESSING, + /** The card read had an invalid CVV or dCVV. */ + INVALID_PHYSICAL_CARD, /** - * Quasi-cash transactions represent purchases of items which may be convertible - * to cash. + * The original card authorization for this incremental authorization does not + * exist. */ - QUASI_CASH, + MISSING_ORIGINAL_AUTHORIZATION, /** - * A refund card authorization, sometimes referred to as a credit voucher - * authorization, where funds are credited to the cardholder. + * The card's authorization request cryptogram was invalid. The cryptogram can + * be from a physical card or a Digital Wallet Token purchase. */ - REFUND, + INVALID_CRYPTOGRAM, + /** The transaction was declined because the 3DS authentication failed. */ + FAILED_3DS_AUTHENTICATION, /** - * Cash disbursement transactions are used to withdraw cash from an ATM or a - * point of sale. + * The transaction was suspected to be used by a card tester to test for valid + * card numbers. */ - CASH_DISBURSEMENT, + SUSPECTED_CARD_TESTING, /** - * A balance inquiry transaction is used to check the balance of an account - * associated with a card. + * The transaction was suspected to be fraudulent. Please reach out to + * support@increase.com for more information. */ - BALANCE_INQUIRY, - /** The processing category is unknown. */ - UNKNOWN, + SUSPECTED_FRAUD, /** - * An enum member indicating that [ProcessingCategory] was instantiated with an - * unknown value. + * An enum member indicating that [Reason] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -34377,16 +37696,27 @@ private constructor( */ fun value(): Value = when (this) { - ACCOUNT_FUNDING -> Value.ACCOUNT_FUNDING - AUTOMATIC_FUEL_DISPENSER -> Value.AUTOMATIC_FUEL_DISPENSER - BILL_PAYMENT -> Value.BILL_PAYMENT - ORIGINAL_CREDIT -> Value.ORIGINAL_CREDIT - PURCHASE -> Value.PURCHASE - QUASI_CASH -> Value.QUASI_CASH - REFUND -> Value.REFUND - CASH_DISBURSEMENT -> Value.CASH_DISBURSEMENT - BALANCE_INQUIRY -> Value.BALANCE_INQUIRY - UNKNOWN -> Value.UNKNOWN + ACCOUNT_CLOSED -> Value.ACCOUNT_CLOSED + CARD_NOT_ACTIVE -> Value.CARD_NOT_ACTIVE + CARD_CANCELED -> Value.CARD_CANCELED + PHYSICAL_CARD_NOT_ACTIVE -> Value.PHYSICAL_CARD_NOT_ACTIVE + ENTITY_NOT_ACTIVE -> Value.ENTITY_NOT_ACTIVE + GROUP_LOCKED -> Value.GROUP_LOCKED + INSUFFICIENT_FUNDS -> Value.INSUFFICIENT_FUNDS + CVV2_MISMATCH -> Value.CVV2_MISMATCH + PIN_MISMATCH -> Value.PIN_MISMATCH + CARD_EXPIRATION_MISMATCH -> Value.CARD_EXPIRATION_MISMATCH + TRANSACTION_NOT_ALLOWED -> Value.TRANSACTION_NOT_ALLOWED + BREACHES_LIMIT -> Value.BREACHES_LIMIT + WEBHOOK_DECLINED -> Value.WEBHOOK_DECLINED + WEBHOOK_TIMED_OUT -> Value.WEBHOOK_TIMED_OUT + DECLINED_BY_STAND_IN_PROCESSING -> Value.DECLINED_BY_STAND_IN_PROCESSING + INVALID_PHYSICAL_CARD -> Value.INVALID_PHYSICAL_CARD + MISSING_ORIGINAL_AUTHORIZATION -> Value.MISSING_ORIGINAL_AUTHORIZATION + INVALID_CRYPTOGRAM -> Value.INVALID_CRYPTOGRAM + FAILED_3DS_AUTHENTICATION -> Value.FAILED_3DS_AUTHENTICATION + SUSPECTED_CARD_TESTING -> Value.SUSPECTED_CARD_TESTING + SUSPECTED_FRAUD -> Value.SUSPECTED_FRAUD else -> Value._UNKNOWN } @@ -34401,18 +37731,28 @@ private constructor( */ fun known(): Known = when (this) { - ACCOUNT_FUNDING -> Known.ACCOUNT_FUNDING - AUTOMATIC_FUEL_DISPENSER -> Known.AUTOMATIC_FUEL_DISPENSER - BILL_PAYMENT -> Known.BILL_PAYMENT - ORIGINAL_CREDIT -> Known.ORIGINAL_CREDIT - PURCHASE -> Known.PURCHASE - QUASI_CASH -> Known.QUASI_CASH - REFUND -> Known.REFUND - CASH_DISBURSEMENT -> Known.CASH_DISBURSEMENT - BALANCE_INQUIRY -> Known.BALANCE_INQUIRY - UNKNOWN -> Known.UNKNOWN - else -> - throw IncreaseInvalidDataException("Unknown ProcessingCategory: $value") + ACCOUNT_CLOSED -> Known.ACCOUNT_CLOSED + CARD_NOT_ACTIVE -> Known.CARD_NOT_ACTIVE + CARD_CANCELED -> Known.CARD_CANCELED + PHYSICAL_CARD_NOT_ACTIVE -> Known.PHYSICAL_CARD_NOT_ACTIVE + ENTITY_NOT_ACTIVE -> Known.ENTITY_NOT_ACTIVE + GROUP_LOCKED -> Known.GROUP_LOCKED + INSUFFICIENT_FUNDS -> Known.INSUFFICIENT_FUNDS + CVV2_MISMATCH -> Known.CVV2_MISMATCH + PIN_MISMATCH -> Known.PIN_MISMATCH + CARD_EXPIRATION_MISMATCH -> Known.CARD_EXPIRATION_MISMATCH + TRANSACTION_NOT_ALLOWED -> Known.TRANSACTION_NOT_ALLOWED + BREACHES_LIMIT -> Known.BREACHES_LIMIT + WEBHOOK_DECLINED -> Known.WEBHOOK_DECLINED + WEBHOOK_TIMED_OUT -> Known.WEBHOOK_TIMED_OUT + DECLINED_BY_STAND_IN_PROCESSING -> Known.DECLINED_BY_STAND_IN_PROCESSING + INVALID_PHYSICAL_CARD -> Known.INVALID_PHYSICAL_CARD + MISSING_ORIGINAL_AUTHORIZATION -> Known.MISSING_ORIGINAL_AUTHORIZATION + INVALID_CRYPTOGRAM -> Known.INVALID_CRYPTOGRAM + FAILED_3DS_AUTHENTICATION -> Known.FAILED_3DS_AUTHENTICATION + SUSPECTED_CARD_TESTING -> Known.SUSPECTED_CARD_TESTING + SUSPECTED_FRAUD -> Known.SUSPECTED_FRAUD + else -> throw IncreaseInvalidDataException("Unknown Reason: $value") } /** @@ -34431,7 +37771,7 @@ private constructor( private var validated: Boolean = false - fun validate(): ProcessingCategory = apply { + fun validate(): Reason = apply { if (validated) { return@apply } @@ -34461,216 +37801,392 @@ private constructor( return true } - return other is ProcessingCategory && value == other.value + return other is Reason && value == other.value } override fun hashCode() = value.hashCode() - override fun toString() = value.toString() - } + override fun toString() = value.toString() + } + + class SchemeFee + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val amount: JsonField, + private val createdAt: JsonField, + private val currency: JsonField, + private val feeType: JsonField, + private val fixedComponent: JsonField, + private val variableRate: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + createdAt: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("fee_type") + @ExcludeMissing + feeType: JsonField = JsonMissing.of(), + @JsonProperty("fixed_component") + @ExcludeMissing + fixedComponent: JsonField = JsonMissing.of(), + @JsonProperty("variable_rate") + @ExcludeMissing + variableRate: JsonField = JsonMissing.of(), + ) : this( + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, + mutableMapOf(), + ) + + /** + * The fee amount given as a string containing a decimal number. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun amount(): String = amount.getRequired("amount") + + /** + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + * created. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun currency(): Currency = currency.getRequired("currency") + + /** + * The type of fee being assessed. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun feeType(): FeeType = feeType.getRequired("fee_type") + + /** + * The fixed component of the fee, if applicable, given in major units of the fee + * amount. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun fixedComponent(): Optional = + fixedComponent.getOptional("fixed_component") + + /** + * The variable rate component of the fee, if applicable, given as a decimal (e.g., + * 0.015 for 1.5%). + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun variableRate(): Optional = variableRate.getOptional("variable_rate") + + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + + /** + * Returns the raw JSON value of [createdAt]. + * + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("created_at") + @ExcludeMissing + fun _createdAt(): JsonField = createdAt + + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("currency") + @ExcludeMissing + fun _currency(): JsonField = currency + + /** + * Returns the raw JSON value of [feeType]. + * + * Unlike [feeType], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("fee_type") + @ExcludeMissing + fun _feeType(): JsonField = feeType - /** This is present if a specific decline reason was given in the real-time decision. */ - class RealTimeDecisionReason - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** + * Returns the raw JSON value of [fixedComponent]. + * + * Unlike [fixedComponent], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("fixed_component") + @ExcludeMissing + fun _fixedComponent(): JsonField = fixedComponent /** - * Returns this class instance's raw value. + * Returns the raw JSON value of [variableRate]. * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. + * Unlike [variableRate], this method doesn't throw if the JSON field has an + * unexpected type. */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JsonProperty("variable_rate") + @ExcludeMissing + fun _variableRate(): JsonField = variableRate + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) companion object { /** - * The cardholder does not have sufficient funds to cover the transaction. The - * merchant may attempt to process the transaction again. + * Returns a mutable builder for constructing an instance of [SchemeFee]. + * + * The following fields are required: + * ```java + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() + * ``` */ - @JvmField val INSUFFICIENT_FUNDS = of("insufficient_funds") + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SchemeFee]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var createdAt: JsonField? = null + private var currency: JsonField? = null + private var feeType: JsonField? = null + private var fixedComponent: JsonField? = null + private var variableRate: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(schemeFee: SchemeFee) = apply { + amount = schemeFee.amount + createdAt = schemeFee.createdAt + currency = schemeFee.currency + feeType = schemeFee.feeType + fixedComponent = schemeFee.fixedComponent + variableRate = schemeFee.variableRate + additionalProperties = schemeFee.additionalProperties.toMutableMap() + } + + /** The fee amount given as a string containing a decimal number. */ + fun amount(amount: String) = amount(JsonField.of(amount)) /** - * This type of transaction is not allowed for this card. This transaction - * should not be retried. + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - @JvmField val TRANSACTION_NEVER_ALLOWED = of("transaction_never_allowed") + fun amount(amount: JsonField) = apply { this.amount = amount } /** - * The transaction amount exceeds the cardholder's approval limit. The merchant - * may attempt to process the transaction again. + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee + * was created. */ - @JvmField val EXCEEDS_APPROVAL_LIMIT = of("exceeds_approval_limit") + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) /** - * The card has been temporarily disabled or not yet activated. The merchant may - * attempt to process the transaction again. + * Sets [Builder.createdAt] to an arbitrary JSON value. + * + * You should usually call [Builder.createdAt] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - @JvmField val CARD_TEMPORARILY_DISABLED = of("card_temporarily_disabled") + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt + } /** - * The transaction is suspected to be fraudulent. The merchant may attempt to - * process the transaction again. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. */ - @JvmField val SUSPECTED_FRAUD = of("suspected_fraud") + fun currency(currency: Currency) = currency(JsonField.of(currency)) /** - * The transaction was declined for another reason. The merchant may attempt to - * process the transaction again. This should be used sparingly. + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [Currency] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - @JvmField val OTHER = of("other") + fun currency(currency: JsonField) = apply { this.currency = currency } - @JvmStatic fun of(value: String) = RealTimeDecisionReason(JsonField.of(value)) - } + /** The type of fee being assessed. */ + fun feeType(feeType: FeeType) = feeType(JsonField.of(feeType)) - /** An enum containing [RealTimeDecisionReason]'s known values. */ - enum class Known { - /** - * The cardholder does not have sufficient funds to cover the transaction. The - * merchant may attempt to process the transaction again. - */ - INSUFFICIENT_FUNDS, - /** - * This type of transaction is not allowed for this card. This transaction - * should not be retried. - */ - TRANSACTION_NEVER_ALLOWED, /** - * The transaction amount exceeds the cardholder's approval limit. The merchant - * may attempt to process the transaction again. - */ - EXCEEDS_APPROVAL_LIMIT, - /** - * The card has been temporarily disabled or not yet activated. The merchant may - * attempt to process the transaction again. - */ - CARD_TEMPORARILY_DISABLED, - /** - * The transaction is suspected to be fraudulent. The merchant may attempt to - * process the transaction again. - */ - SUSPECTED_FRAUD, - /** - * The transaction was declined for another reason. The merchant may attempt to - * process the transaction again. This should be used sparingly. + * Sets [Builder.feeType] to an arbitrary JSON value. + * + * You should usually call [Builder.feeType] with a well-typed [FeeType] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - OTHER, - } + fun feeType(feeType: JsonField) = apply { this.feeType = feeType } - /** - * An enum containing [RealTimeDecisionReason]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [RealTimeDecisionReason] can contain an unknown value in a couple - * of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** - * The cardholder does not have sufficient funds to cover the transaction. The - * merchant may attempt to process the transaction again. - */ - INSUFFICIENT_FUNDS, /** - * This type of transaction is not allowed for this card. This transaction - * should not be retried. + * The fixed component of the fee, if applicable, given in major units of the + * fee amount. */ - TRANSACTION_NEVER_ALLOWED, + fun fixedComponent(fixedComponent: String?) = + fixedComponent(JsonField.ofNullable(fixedComponent)) + /** - * The transaction amount exceeds the cardholder's approval limit. The merchant - * may attempt to process the transaction again. + * Alias for calling [Builder.fixedComponent] with + * `fixedComponent.orElse(null)`. */ - EXCEEDS_APPROVAL_LIMIT, + fun fixedComponent(fixedComponent: Optional) = + fixedComponent(fixedComponent.getOrNull()) + /** - * The card has been temporarily disabled or not yet activated. The merchant may - * attempt to process the transaction again. + * Sets [Builder.fixedComponent] to an arbitrary JSON value. + * + * You should usually call [Builder.fixedComponent] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ - CARD_TEMPORARILY_DISABLED, + fun fixedComponent(fixedComponent: JsonField) = apply { + this.fixedComponent = fixedComponent + } + /** - * The transaction is suspected to be fraudulent. The merchant may attempt to - * process the transaction again. + * The variable rate component of the fee, if applicable, given as a decimal + * (e.g., 0.015 for 1.5%). */ - SUSPECTED_FRAUD, + fun variableRate(variableRate: String?) = + variableRate(JsonField.ofNullable(variableRate)) + /** - * The transaction was declined for another reason. The merchant may attempt to - * process the transaction again. This should be used sparingly. + * Alias for calling [Builder.variableRate] with `variableRate.orElse(null)`. */ - OTHER, + fun variableRate(variableRate: Optional) = + variableRate(variableRate.getOrNull()) + /** - * An enum member indicating that [RealTimeDecisionReason] was instantiated with - * an unknown value. + * Sets [Builder.variableRate] to an arbitrary JSON value. + * + * You should usually call [Builder.variableRate] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ - _UNKNOWN, - } + fun variableRate(variableRate: JsonField) = apply { + this.variableRate = variableRate + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - INSUFFICIENT_FUNDS -> Value.INSUFFICIENT_FUNDS - TRANSACTION_NEVER_ALLOWED -> Value.TRANSACTION_NEVER_ALLOWED - EXCEEDS_APPROVAL_LIMIT -> Value.EXCEEDS_APPROVAL_LIMIT - CARD_TEMPORARILY_DISABLED -> Value.CARD_TEMPORARILY_DISABLED - SUSPECTED_FRAUD -> Value.SUSPECTED_FRAUD - OTHER -> Value.OTHER - else -> Value._UNKNOWN + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - INSUFFICIENT_FUNDS -> Known.INSUFFICIENT_FUNDS - TRANSACTION_NEVER_ALLOWED -> Known.TRANSACTION_NEVER_ALLOWED - EXCEEDS_APPROVAL_LIMIT -> Known.EXCEEDS_APPROVAL_LIMIT - CARD_TEMPORARILY_DISABLED -> Known.CARD_TEMPORARILY_DISABLED - SUSPECTED_FRAUD -> Known.SUSPECTED_FRAUD - OTHER -> Known.OTHER - else -> - throw IncreaseInvalidDataException( - "Unknown RealTimeDecisionReason: $value" - ) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [SchemeFee]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SchemeFee = + SchemeFee( + checkRequired("amount", amount), + checkRequired("createdAt", createdAt), + checkRequired("currency", currency), + checkRequired("feeType", feeType), + checkRequired("fixedComponent", fixedComponent), + checkRequired("variableRate", variableRate), + additionalProperties.toMutableMap(), + ) + } + private var validated: Boolean = false - fun validate(): RealTimeDecisionReason = apply { + fun validate(): SchemeFee = apply { if (validated) { return@apply } - known() + amount() + createdAt() + currency().validate() + feeType().validate() + fixedComponent() + variableRate() validated = true } @@ -34688,375 +38204,924 @@ private constructor( * * Used for best match union deserialization. */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (currency.asKnown().getOrNull()?.validity() ?: 0) + + (feeType.asKnown().getOrNull()?.validity() ?: 0) + + (if (fixedComponent.asKnown().isPresent) 1 else 0) + + (if (variableRate.asKnown().isPresent) 1 else 0) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + */ + class Currency + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** US Dollar (USD) */ + @JvmField val USD = of("USD") + + @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) } - return other is RealTimeDecisionReason && value == other.value + /** An enum containing [Currency]'s known values. */ + enum class Known { + /** US Dollar (USD) */ + USD + } + + /** + * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Currency] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** US Dollar (USD) */ + USD, + /** + * An enum member indicating that [Currency] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + USD -> Value.USD + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + USD -> Known.USD + else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Currency = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Currency && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } - override fun hashCode() = value.hashCode() + /** The type of fee being assessed. */ + class FeeType + @JsonCreator + private constructor(private val value: JsonField) : Enum { - override fun toString() = value.toString() - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** Why the transaction was declined. */ - class Reason @JsonCreator private constructor(private val value: JsonField) : - Enum { + companion object { - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY = + of("visa_international_service_assessment_single_currency") - companion object { + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY = + of("visa_international_service_assessment_cross_currency") - /** The account has been closed. */ - @JvmField val ACCOUNT_CLOSED = of("account_closed") + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + @JvmField + val VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE = + of("visa_authorization_domestic_point_of_sale") - /** The Card was not active. */ - @JvmField val CARD_NOT_ACTIVE = of("card_not_active") + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + @JvmField + val VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_international_point_of_sale") - /** The Card has been canceled. */ - @JvmField val CARD_CANCELED = of("card_canceled") + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + @JvmField + val VISA_AUTHORIZATION_CANADA_POINT_OF_SALE = + of("visa_authorization_canada_point_of_sale") - /** The Physical Card was not active. */ - @JvmField val PHYSICAL_CARD_NOT_ACTIVE = of("physical_card_not_active") + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + @JvmField + val VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE = + of("visa_authorization_reversal_point_of_sale") - /** The account's entity was not active. */ - @JvmField val ENTITY_NOT_ACTIVE = of("entity_not_active") + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + @JvmField + val VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_reversal_international_point_of_sale") + + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + @JvmField + val VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE = + of("visa_authorization_address_verification_service") + + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + @JvmField + val VISA_ADVANCED_AUTHORIZATION = of("visa_advanced_authorization") + + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + @JvmField val VISA_MESSAGE_TRANSMISSION = of("visa_message_transmission") + + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_DOMESTIC = + of("visa_account_verification_domestic") + + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_INTERNATIONAL = + of("visa_account_verification_international") + + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_CANADA = + of("visa_account_verification_canada") + + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + @JvmField + val VISA_CORPORATE_ACCEPTANCE_FEE = of("visa_corporate_acceptance_fee") + + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + @JvmField + val VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE = + of("visa_consumer_debit_acceptance_fee") + + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + @JvmField + val VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE = + of("visa_business_debit_acceptance_fee") + + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + @JvmField + val VISA_PURCHASING_ACCEPTANCE_FEE = of("visa_purchasing_acceptance_fee") - /** The account was inactive. */ - @JvmField val GROUP_LOCKED = of("group_locked") + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + @JvmField val VISA_PURCHASE_DOMESTIC = of("visa_purchase_domestic") - /** The Card's Account did not have a sufficient available balance. */ - @JvmField val INSUFFICIENT_FUNDS = of("insufficient_funds") + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + @JvmField + val VISA_PURCHASE_INTERNATIONAL = of("visa_purchase_international") - /** The given CVV2 did not match the card's value. */ - @JvmField val CVV2_MISMATCH = of("cvv2_mismatch") + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_CREDIT_PURCHASE_TOKEN = of("visa_credit_purchase_token") - /** The given PIN did not match the card's value. */ - @JvmField val PIN_MISMATCH = of("pin_mismatch") + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_DEBIT_PURCHASE_TOKEN = of("visa_debit_purchase_token") - /** - * The given expiration date did not match the card's value. Only applies when a - * CVV2 is present. - */ - @JvmField val CARD_EXPIRATION_MISMATCH = of("card_expiration_mismatch") + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + @JvmField val VISA_CLEARING_TRANSMISSION = of("visa_clearing_transmission") - /** The attempted card transaction is not allowed per Increase's terms. */ - @JvmField val TRANSACTION_NOT_ALLOWED = of("transaction_not_allowed") + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + @JvmField val VISA_DIRECT_AUTHORIZATION = of("visa_direct_authorization") - /** The transaction was blocked by a Limit. */ - @JvmField val BREACHES_LIMIT = of("breaches_limit") + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + @JvmField + val VISA_DIRECT_TRANSACTION_DOMESTIC = + of("visa_direct_transaction_domestic") - /** Your application declined the transaction via webhook. */ - @JvmField val WEBHOOK_DECLINED = of("webhook_declined") + /** Issuer card service fee for Commercial Credit cards. */ + @JvmField + val VISA_SERVICE_COMMERCIAL_CREDIT = of("visa_service_commercial_credit") - /** Your application webhook did not respond without the required timeout. */ - @JvmField val WEBHOOK_TIMED_OUT = of("webhook_timed_out") + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + @JvmField + val VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT = + of("visa_advertising_service_commercial_credit") - /** Declined by stand-in processing. */ - @JvmField - val DECLINED_BY_STAND_IN_PROCESSING = of("declined_by_stand_in_processing") + /** Issuer Community Growth Acceleration Program Fee. */ + @JvmField + val VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM = + of("visa_community_growth_acceleration_program") - /** The card read had an invalid CVV or dCVV. */ - @JvmField val INVALID_PHYSICAL_CARD = of("invalid_physical_card") + /** Issuer Processing Guarantee for Commercial Credit cards. */ + @JvmField + val VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT = + of("visa_processing_guarantee_commercial_credit") - /** - * The original card authorization for this incremental authorization does not - * exist. - */ - @JvmField - val MISSING_ORIGINAL_AUTHORIZATION = of("missing_original_authorization") + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + @JvmField val PULSE_SWITCH_FEE = of("pulse_switch_fee") - /** - * The card's authorization request cryptogram was invalid. The cryptogram can - * be from a physical card or a Digital Wallet Token purchase. - */ - @JvmField val INVALID_CRYPTOGRAM = of("invalid_cryptogram") + @JvmStatic fun of(value: String) = FeeType(JsonField.of(value)) + } - /** The transaction was declined because the 3DS authentication failed. */ - @JvmField val FAILED_3DS_AUTHENTICATION = of("failed_3ds_authentication") + /** An enum containing [FeeType]'s known values. */ + enum class Known { + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + VISA_ADVANCED_AUTHORIZATION, + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + VISA_MESSAGE_TRANSMISSION, + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_DOMESTIC, + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, + } /** - * The transaction was suspected to be used by a card tester to test for valid - * card numbers. + * An enum containing [FeeType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [FeeType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. */ - @JvmField val SUSPECTED_CARD_TESTING = of("suspected_card_testing") + enum class Value { + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + VISA_ADVANCED_AUTHORIZATION, + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + VISA_MESSAGE_TRANSMISSION, + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_DOMESTIC, + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, + /** + * An enum member indicating that [FeeType] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } /** - * The transaction was suspected to be fraudulent. Please reach out to - * support@increase.com for more information. + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. */ - @JvmField val SUSPECTED_FRAUD = of("suspected_fraud") - - @JvmStatic fun of(value: String) = Reason(JsonField.of(value)) - } + fun value(): Value = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Value.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Value.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Value.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Value.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Value.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Value.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Value.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Value.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Value.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Value.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Value.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Value.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Value.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Value.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Value.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Value.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Value.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Value.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Value.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Value.PULSE_SWITCH_FEE + else -> Value._UNKNOWN + } - /** An enum containing [Reason]'s known values. */ - enum class Known { - /** The account has been closed. */ - ACCOUNT_CLOSED, - /** The Card was not active. */ - CARD_NOT_ACTIVE, - /** The Card has been canceled. */ - CARD_CANCELED, - /** The Physical Card was not active. */ - PHYSICAL_CARD_NOT_ACTIVE, - /** The account's entity was not active. */ - ENTITY_NOT_ACTIVE, - /** The account was inactive. */ - GROUP_LOCKED, - /** The Card's Account did not have a sufficient available balance. */ - INSUFFICIENT_FUNDS, - /** The given CVV2 did not match the card's value. */ - CVV2_MISMATCH, - /** The given PIN did not match the card's value. */ - PIN_MISMATCH, - /** - * The given expiration date did not match the card's value. Only applies when a - * CVV2 is present. - */ - CARD_EXPIRATION_MISMATCH, - /** The attempted card transaction is not allowed per Increase's terms. */ - TRANSACTION_NOT_ALLOWED, - /** The transaction was blocked by a Limit. */ - BREACHES_LIMIT, - /** Your application declined the transaction via webhook. */ - WEBHOOK_DECLINED, - /** Your application webhook did not respond without the required timeout. */ - WEBHOOK_TIMED_OUT, - /** Declined by stand-in processing. */ - DECLINED_BY_STAND_IN_PROCESSING, - /** The card read had an invalid CVV or dCVV. */ - INVALID_PHYSICAL_CARD, - /** - * The original card authorization for this incremental authorization does not - * exist. - */ - MISSING_ORIGINAL_AUTHORIZATION, - /** - * The card's authorization request cryptogram was invalid. The cryptogram can - * be from a physical card or a Digital Wallet Token purchase. - */ - INVALID_CRYPTOGRAM, - /** The transaction was declined because the 3DS authentication failed. */ - FAILED_3DS_AUTHENTICATION, - /** - * The transaction was suspected to be used by a card tester to test for valid - * card numbers. - */ - SUSPECTED_CARD_TESTING, /** - * The transaction was suspected to be fraudulent. Please reach out to - * support@increase.com for more information. + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. */ - SUSPECTED_FRAUD, - } + fun known(): Known = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Known.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Known.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Known.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Known.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Known.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Known.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Known.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Known.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Known.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Known.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Known.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Known.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Known.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Known.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Known.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Known.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Known.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Known.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Known.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Known.PULSE_SWITCH_FEE + else -> throw IncreaseInvalidDataException("Unknown FeeType: $value") + } - /** - * An enum containing [Reason]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Reason] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** The account has been closed. */ - ACCOUNT_CLOSED, - /** The Card was not active. */ - CARD_NOT_ACTIVE, - /** The Card has been canceled. */ - CARD_CANCELED, - /** The Physical Card was not active. */ - PHYSICAL_CARD_NOT_ACTIVE, - /** The account's entity was not active. */ - ENTITY_NOT_ACTIVE, - /** The account was inactive. */ - GROUP_LOCKED, - /** The Card's Account did not have a sufficient available balance. */ - INSUFFICIENT_FUNDS, - /** The given CVV2 did not match the card's value. */ - CVV2_MISMATCH, - /** The given PIN did not match the card's value. */ - PIN_MISMATCH, - /** - * The given expiration date did not match the card's value. Only applies when a - * CVV2 is present. - */ - CARD_EXPIRATION_MISMATCH, - /** The attempted card transaction is not allowed per Increase's terms. */ - TRANSACTION_NOT_ALLOWED, - /** The transaction was blocked by a Limit. */ - BREACHES_LIMIT, - /** Your application declined the transaction via webhook. */ - WEBHOOK_DECLINED, - /** Your application webhook did not respond without the required timeout. */ - WEBHOOK_TIMED_OUT, - /** Declined by stand-in processing. */ - DECLINED_BY_STAND_IN_PROCESSING, - /** The card read had an invalid CVV or dCVV. */ - INVALID_PHYSICAL_CARD, - /** - * The original card authorization for this incremental authorization does not - * exist. - */ - MISSING_ORIGINAL_AUTHORIZATION, - /** - * The card's authorization request cryptogram was invalid. The cryptogram can - * be from a physical card or a Digital Wallet Token purchase. - */ - INVALID_CRYPTOGRAM, - /** The transaction was declined because the 3DS authentication failed. */ - FAILED_3DS_AUTHENTICATION, - /** - * The transaction was suspected to be used by a card tester to test for valid - * card numbers. - */ - SUSPECTED_CARD_TESTING, /** - * The transaction was suspected to be fraudulent. Please reach out to - * support@increase.com for more information. - */ - SUSPECTED_FRAUD, - /** - * An enum member indicating that [Reason] was instantiated with an unknown - * value. + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. */ - _UNKNOWN, - } + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ACCOUNT_CLOSED -> Value.ACCOUNT_CLOSED - CARD_NOT_ACTIVE -> Value.CARD_NOT_ACTIVE - CARD_CANCELED -> Value.CARD_CANCELED - PHYSICAL_CARD_NOT_ACTIVE -> Value.PHYSICAL_CARD_NOT_ACTIVE - ENTITY_NOT_ACTIVE -> Value.ENTITY_NOT_ACTIVE - GROUP_LOCKED -> Value.GROUP_LOCKED - INSUFFICIENT_FUNDS -> Value.INSUFFICIENT_FUNDS - CVV2_MISMATCH -> Value.CVV2_MISMATCH - PIN_MISMATCH -> Value.PIN_MISMATCH - CARD_EXPIRATION_MISMATCH -> Value.CARD_EXPIRATION_MISMATCH - TRANSACTION_NOT_ALLOWED -> Value.TRANSACTION_NOT_ALLOWED - BREACHES_LIMIT -> Value.BREACHES_LIMIT - WEBHOOK_DECLINED -> Value.WEBHOOK_DECLINED - WEBHOOK_TIMED_OUT -> Value.WEBHOOK_TIMED_OUT - DECLINED_BY_STAND_IN_PROCESSING -> Value.DECLINED_BY_STAND_IN_PROCESSING - INVALID_PHYSICAL_CARD -> Value.INVALID_PHYSICAL_CARD - MISSING_ORIGINAL_AUTHORIZATION -> Value.MISSING_ORIGINAL_AUTHORIZATION - INVALID_CRYPTOGRAM -> Value.INVALID_CRYPTOGRAM - FAILED_3DS_AUTHENTICATION -> Value.FAILED_3DS_AUTHENTICATION - SUSPECTED_CARD_TESTING -> Value.SUSPECTED_CARD_TESTING - SUSPECTED_FRAUD -> Value.SUSPECTED_FRAUD - else -> Value._UNKNOWN - } + private var validated: Boolean = false - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - ACCOUNT_CLOSED -> Known.ACCOUNT_CLOSED - CARD_NOT_ACTIVE -> Known.CARD_NOT_ACTIVE - CARD_CANCELED -> Known.CARD_CANCELED - PHYSICAL_CARD_NOT_ACTIVE -> Known.PHYSICAL_CARD_NOT_ACTIVE - ENTITY_NOT_ACTIVE -> Known.ENTITY_NOT_ACTIVE - GROUP_LOCKED -> Known.GROUP_LOCKED - INSUFFICIENT_FUNDS -> Known.INSUFFICIENT_FUNDS - CVV2_MISMATCH -> Known.CVV2_MISMATCH - PIN_MISMATCH -> Known.PIN_MISMATCH - CARD_EXPIRATION_MISMATCH -> Known.CARD_EXPIRATION_MISMATCH - TRANSACTION_NOT_ALLOWED -> Known.TRANSACTION_NOT_ALLOWED - BREACHES_LIMIT -> Known.BREACHES_LIMIT - WEBHOOK_DECLINED -> Known.WEBHOOK_DECLINED - WEBHOOK_TIMED_OUT -> Known.WEBHOOK_TIMED_OUT - DECLINED_BY_STAND_IN_PROCESSING -> Known.DECLINED_BY_STAND_IN_PROCESSING - INVALID_PHYSICAL_CARD -> Known.INVALID_PHYSICAL_CARD - MISSING_ORIGINAL_AUTHORIZATION -> Known.MISSING_ORIGINAL_AUTHORIZATION - INVALID_CRYPTOGRAM -> Known.INVALID_CRYPTOGRAM - FAILED_3DS_AUTHENTICATION -> Known.FAILED_3DS_AUTHENTICATION - SUSPECTED_CARD_TESTING -> Known.SUSPECTED_CARD_TESTING - SUSPECTED_FRAUD -> Known.SUSPECTED_FRAUD - else -> throw IncreaseInvalidDataException("Unknown Reason: $value") - } + fun validate(): FeeType = apply { + if (validated) { + return@apply + } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") + known() + validated = true } - private var validated: Boolean = false + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - fun validate(): Reason = apply { - if (validated) { - return@apply - } + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - known() - validated = true - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false + return other is FeeType && value == other.value } - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is Reason && value == other.value + return other is SchemeFee && + amount == other.amount && + createdAt == other.createdAt && + currency == other.currency && + feeType == other.feeType && + fixedComponent == other.fixedComponent && + variableRate == other.variableRate && + additionalProperties == other.additionalProperties } - override fun hashCode() = value.hashCode() + private val hashCode: Int by lazy { + Objects.hash( + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, + additionalProperties, + ) + } - override fun toString() = value.toString() + override fun hashCode(): Int = hashCode + + override fun toString() = + "SchemeFee{amount=$amount, createdAt=$createdAt, currency=$currency, feeType=$feeType, fixedComponent=$fixedComponent, variableRate=$variableRate, additionalProperties=$additionalProperties}" } /** Fields related to verification of cardholder-provided values. */ @@ -36649,6 +40714,7 @@ private constructor( realTimeDecisionId == other.realTimeDecisionId && realTimeDecisionReason == other.realTimeDecisionReason && reason == other.reason && + schemeFees == other.schemeFees && terminalId == other.terminalId && verification == other.verification && additionalProperties == other.additionalProperties @@ -36683,6 +40749,7 @@ private constructor( realTimeDecisionId, realTimeDecisionReason, reason, + schemeFees, terminalId, verification, additionalProperties, @@ -36692,7 +40759,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CardDecline{id=$id, actioner=$actioner, additionalAmounts=$additionalAmounts, amount=$amount, cardPaymentId=$cardPaymentId, currency=$currency, declinedTransactionId=$declinedTransactionId, digitalWalletTokenId=$digitalWalletTokenId, direction=$direction, incrementedCardAuthorizationId=$incrementedCardAuthorizationId, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkDetails=$networkDetails, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, physicalCardId=$physicalCardId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, processingCategory=$processingCategory, realTimeDecisionId=$realTimeDecisionId, realTimeDecisionReason=$realTimeDecisionReason, reason=$reason, terminalId=$terminalId, verification=$verification, additionalProperties=$additionalProperties}" + "CardDecline{id=$id, actioner=$actioner, additionalAmounts=$additionalAmounts, amount=$amount, cardPaymentId=$cardPaymentId, currency=$currency, declinedTransactionId=$declinedTransactionId, digitalWalletTokenId=$digitalWalletTokenId, direction=$direction, incrementedCardAuthorizationId=$incrementedCardAuthorizationId, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkDetails=$networkDetails, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, physicalCardId=$physicalCardId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, processingCategory=$processingCategory, realTimeDecisionId=$realTimeDecisionId, realTimeDecisionReason=$realTimeDecisionReason, reason=$reason, schemeFees=$schemeFees, terminalId=$terminalId, verification=$verification, additionalProperties=$additionalProperties}" } /** @@ -36726,6 +40793,7 @@ private constructor( private val presentmentCurrency: JsonField, private val processingCategory: JsonField, private val realTimeDecisionId: JsonField, + private val schemeFees: JsonField>, private val terminalId: JsonField, private val transactionId: JsonField, private val type: JsonField, @@ -36800,6 +40868,9 @@ private constructor( @JsonProperty("real_time_decision_id") @ExcludeMissing realTimeDecisionId: JsonField = JsonMissing.of(), + @JsonProperty("scheme_fees") + @ExcludeMissing + schemeFees: JsonField> = JsonMissing.of(), @JsonProperty("terminal_id") @ExcludeMissing terminalId: JsonField = JsonMissing.of(), @@ -36834,6 +40905,7 @@ private constructor( presentmentCurrency, processingCategory, realTimeDecisionId, + schemeFees, terminalId, transactionId, type, @@ -37066,6 +41138,15 @@ private constructor( fun realTimeDecisionId(): Optional = realTimeDecisionId.getOptional("real_time_decision_id") + /** + * The scheme fees associated with this card financial. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun schemeFees(): List = schemeFees.getRequired("scheme_fees") + /** * The terminal identifier (commonly abbreviated as TID) of the terminal the card is * transacting with. @@ -37327,6 +41408,16 @@ private constructor( @ExcludeMissing fun _realTimeDecisionId(): JsonField = realTimeDecisionId + /** + * Returns the raw JSON value of [schemeFees]. + * + * Unlike [schemeFees], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("scheme_fees") + @ExcludeMissing + fun _schemeFees(): JsonField> = schemeFees + /** * Returns the raw JSON value of [terminalId]. * @@ -37406,6 +41497,7 @@ private constructor( * .presentmentCurrency() * .processingCategory() * .realTimeDecisionId() + * .schemeFees() * .terminalId() * .transactionId() * .type() @@ -37441,6 +41533,7 @@ private constructor( private var presentmentCurrency: JsonField? = null private var processingCategory: JsonField? = null private var realTimeDecisionId: JsonField? = null + private var schemeFees: JsonField>? = null private var terminalId: JsonField? = null private var transactionId: JsonField? = null private var type: JsonField? = null @@ -37472,6 +41565,7 @@ private constructor( presentmentCurrency = cardFinancial.presentmentCurrency processingCategory = cardFinancial.processingCategory realTimeDecisionId = cardFinancial.realTimeDecisionId + schemeFees = cardFinancial.schemeFees.map { it.toMutableList() } terminalId = cardFinancial.terminalId transactionId = cardFinancial.transactionId type = cardFinancial.type @@ -37907,6 +42001,32 @@ private constructor( this.realTimeDecisionId = realTimeDecisionId } + /** The scheme fees associated with this card financial. */ + fun schemeFees(schemeFees: List) = schemeFees(JsonField.of(schemeFees)) + + /** + * Sets [Builder.schemeFees] to an arbitrary JSON value. + * + * You should usually call [Builder.schemeFees] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun schemeFees(schemeFees: JsonField>) = apply { + this.schemeFees = schemeFees.map { it.toMutableList() } + } + + /** + * Adds a single [SchemeFee] to [schemeFees]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addSchemeFee(schemeFee: SchemeFee) = apply { + schemeFees = + (schemeFees ?: JsonField.of(mutableListOf())).also { + checkKnown("schemeFees", it).add(schemeFee) + } + } + /** * The terminal identifier (commonly abbreviated as TID) of the terminal the card is * transacting with. @@ -38024,6 +42144,7 @@ private constructor( * .presentmentCurrency() * .processingCategory() * .realTimeDecisionId() + * .schemeFees() * .terminalId() * .transactionId() * .type() @@ -38057,6 +42178,7 @@ private constructor( checkRequired("presentmentCurrency", presentmentCurrency), checkRequired("processingCategory", processingCategory), checkRequired("realTimeDecisionId", realTimeDecisionId), + checkRequired("schemeFees", schemeFees).map { it.toImmutable() }, checkRequired("terminalId", terminalId), checkRequired("transactionId", transactionId), checkRequired("type", type), @@ -38095,6 +42217,7 @@ private constructor( presentmentCurrency() processingCategory().validate() realTimeDecisionId() + schemeFees().forEach { it.validate() } terminalId() transactionId() type().validate() @@ -38141,6 +42264,7 @@ private constructor( (if (presentmentCurrency.asKnown().isPresent) 1 else 0) + (processingCategory.asKnown().getOrNull()?.validity() ?: 0) + (if (realTimeDecisionId.asKnown().isPresent) 1 else 0) + + (schemeFees.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (terminalId.asKnown().isPresent) 1 else 0) + (if (transactionId.asKnown().isPresent) 1 else 0) + (type.asKnown().getOrNull()?.validity() ?: 0) + @@ -42958,78 +47082,334 @@ private constructor( of("invalid_cardholder_authentication_verification_value") /** - * An internal Visa error occurred. Visa uses this reason code for - * certain expected occurrences as well, such as Application Transaction - * Counter (ATC) replays. + * An internal Visa error occurred. Visa uses this reason code for + * certain expected occurrences as well, such as Application Transaction + * Counter (ATC) replays. + */ + @JvmField val INTERNAL_VISA_ERROR = of("internal_visa_error") + + /** + * The merchant has enabled Visa's Transaction Advisory Service and + * requires further authentication to perform the transaction. In + * practice this is often utilized at fuel pumps to tell the cardholder + * to see the cashier. + */ + @JvmField + val MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED = + of("merchant_transaction_advisory_service_authentication_required") + + /** + * The transaction was blocked by Visa's Payment Fraud Disruption + * service due to fraudulent Acquirer behavior, such as card testing. + */ + @JvmField + val PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK = + of("payment_fraud_disruption_acquirer_block") + + /** An unspecific reason for stand-in processing. */ + @JvmField val OTHER = of("other") + + @JvmStatic + fun of(value: String) = StandInProcessingReason(JsonField.of(value)) + } + + /** An enum containing [StandInProcessingReason]'s known values. */ + enum class Known { + /** Increase failed to process the authorization in a timely manner. */ + ISSUER_ERROR, + /** The physical card read had an invalid CVV or dCVV. */ + INVALID_PHYSICAL_CARD, + /** + * The card's authorization request cryptogram was invalid. The + * cryptogram can be from a physical card or a Digital Wallet Token + * purchase. + */ + INVALID_CRYPTOGRAM, + /** The 3DS cardholder authentication verification value was invalid. */ + INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE, + /** + * An internal Visa error occurred. Visa uses this reason code for + * certain expected occurrences as well, such as Application Transaction + * Counter (ATC) replays. + */ + INTERNAL_VISA_ERROR, + /** + * The merchant has enabled Visa's Transaction Advisory Service and + * requires further authentication to perform the transaction. In + * practice this is often utilized at fuel pumps to tell the cardholder + * to see the cashier. + */ + MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED, + /** + * The transaction was blocked by Visa's Payment Fraud Disruption + * service due to fraudulent Acquirer behavior, such as card testing. + */ + PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK, + /** An unspecific reason for stand-in processing. */ + OTHER, + } + + /** + * An enum containing [StandInProcessingReason]'s known values, as well as + * an [_UNKNOWN] member. + * + * An instance of [StandInProcessingReason] can contain an unknown value in + * a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** Increase failed to process the authorization in a timely manner. */ + ISSUER_ERROR, + /** The physical card read had an invalid CVV or dCVV. */ + INVALID_PHYSICAL_CARD, + /** + * The card's authorization request cryptogram was invalid. The + * cryptogram can be from a physical card or a Digital Wallet Token + * purchase. + */ + INVALID_CRYPTOGRAM, + /** The 3DS cardholder authentication verification value was invalid. */ + INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE, + /** + * An internal Visa error occurred. Visa uses this reason code for + * certain expected occurrences as well, such as Application Transaction + * Counter (ATC) replays. + */ + INTERNAL_VISA_ERROR, + /** + * The merchant has enabled Visa's Transaction Advisory Service and + * requires further authentication to perform the transaction. In + * practice this is often utilized at fuel pumps to tell the cardholder + * to see the cashier. + */ + MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED, + /** + * The transaction was blocked by Visa's Payment Fraud Disruption + * service due to fraudulent Acquirer behavior, such as card testing. + */ + PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK, + /** An unspecific reason for stand-in processing. */ + OTHER, + /** + * An enum member indicating that [StandInProcessingReason] was + * instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ISSUER_ERROR -> Value.ISSUER_ERROR + INVALID_PHYSICAL_CARD -> Value.INVALID_PHYSICAL_CARD + INVALID_CRYPTOGRAM -> Value.INVALID_CRYPTOGRAM + INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE -> + Value.INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE + INTERNAL_VISA_ERROR -> Value.INTERNAL_VISA_ERROR + MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED -> + Value + .MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED + PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK -> + Value.PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK + OTHER -> Value.OTHER + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + ISSUER_ERROR -> Known.ISSUER_ERROR + INVALID_PHYSICAL_CARD -> Known.INVALID_PHYSICAL_CARD + INVALID_CRYPTOGRAM -> Known.INVALID_CRYPTOGRAM + INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE -> + Known.INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE + INTERNAL_VISA_ERROR -> Known.INTERNAL_VISA_ERROR + MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED -> + Known + .MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED + PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK -> + Known.PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK + OTHER -> Known.OTHER + else -> + throw IncreaseInvalidDataException( + "Unknown StandInProcessingReason: $value" + ) + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): StandInProcessingReason = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is StandInProcessingReason && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * The capability of the terminal being used to read the card. Shows whether a + * terminal can e.g., accept chip cards or if it only supports magnetic stripe + * reads. This reflects the highest capability of the terminal — for example, a + * terminal that supports both chip and magnetic stripe will be identified as + * chip-capable. + */ + class TerminalEntryCapability + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** Unknown */ + @JvmField val UNKNOWN = of("unknown") + + /** No terminal was used for this transaction. */ + @JvmField val TERMINAL_NOT_USED = of("terminal_not_used") + + /** + * The terminal can only read magnetic stripes and does not have chip or + * contactless reading capability. + */ + @JvmField val MAGNETIC_STRIPE = of("magnetic_stripe") + + /** The terminal can only read barcodes. */ + @JvmField val BARCODE = of("barcode") + + /** + * The terminal can only read cards via Optical Character Recognition. */ - @JvmField val INTERNAL_VISA_ERROR = of("internal_visa_error") + @JvmField + val OPTICAL_CHARACTER_RECOGNITION = of("optical_character_recognition") /** - * The merchant has enabled Visa's Transaction Advisory Service and - * requires further authentication to perform the transaction. In - * practice this is often utilized at fuel pumps to tell the cardholder - * to see the cashier. + * The terminal supports contact chip cards and can also read the + * magnetic stripe. If contact chip is supported, this value is used + * regardless of whether contactless is also supported. */ - @JvmField - val MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED = - of("merchant_transaction_advisory_service_authentication_required") + @JvmField val CHIP_OR_CONTACTLESS = of("chip_or_contactless") /** - * The transaction was blocked by Visa's Payment Fraud Disruption - * service due to fraudulent Acquirer behavior, such as card testing. + * The terminal supports contactless reads but does not support contact + * chip. Only used when the terminal lacks contact chip capability. */ - @JvmField - val PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK = - of("payment_fraud_disruption_acquirer_block") + @JvmField val CONTACTLESS_ONLY = of("contactless_only") - /** An unspecific reason for stand-in processing. */ - @JvmField val OTHER = of("other") + /** The terminal has no card reading capability. */ + @JvmField val NO_CAPABILITY = of("no_capability") @JvmStatic - fun of(value: String) = StandInProcessingReason(JsonField.of(value)) + fun of(value: String) = TerminalEntryCapability(JsonField.of(value)) } - /** An enum containing [StandInProcessingReason]'s known values. */ + /** An enum containing [TerminalEntryCapability]'s known values. */ enum class Known { - /** Increase failed to process the authorization in a timely manner. */ - ISSUER_ERROR, - /** The physical card read had an invalid CVV or dCVV. */ - INVALID_PHYSICAL_CARD, + /** Unknown */ + UNKNOWN, + /** No terminal was used for this transaction. */ + TERMINAL_NOT_USED, /** - * The card's authorization request cryptogram was invalid. The - * cryptogram can be from a physical card or a Digital Wallet Token - * purchase. + * The terminal can only read magnetic stripes and does not have chip or + * contactless reading capability. */ - INVALID_CRYPTOGRAM, - /** The 3DS cardholder authentication verification value was invalid. */ - INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE, + MAGNETIC_STRIPE, + /** The terminal can only read barcodes. */ + BARCODE, /** - * An internal Visa error occurred. Visa uses this reason code for - * certain expected occurrences as well, such as Application Transaction - * Counter (ATC) replays. + * The terminal can only read cards via Optical Character Recognition. */ - INTERNAL_VISA_ERROR, + OPTICAL_CHARACTER_RECOGNITION, /** - * The merchant has enabled Visa's Transaction Advisory Service and - * requires further authentication to perform the transaction. In - * practice this is often utilized at fuel pumps to tell the cardholder - * to see the cashier. + * The terminal supports contact chip cards and can also read the + * magnetic stripe. If contact chip is supported, this value is used + * regardless of whether contactless is also supported. */ - MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED, + CHIP_OR_CONTACTLESS, /** - * The transaction was blocked by Visa's Payment Fraud Disruption - * service due to fraudulent Acquirer behavior, such as card testing. + * The terminal supports contactless reads but does not support contact + * chip. Only used when the terminal lacks contact chip capability. */ - PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK, - /** An unspecific reason for stand-in processing. */ - OTHER, + CONTACTLESS_ONLY, + /** The terminal has no card reading capability. */ + NO_CAPABILITY, } /** - * An enum containing [StandInProcessingReason]'s known values, as well as + * An enum containing [TerminalEntryCapability]'s known values, as well as * an [_UNKNOWN] member. * - * An instance of [StandInProcessingReason] can contain an unknown value in + * An instance of [TerminalEntryCapability] can contain an unknown value in * a couple of cases: * - It was deserialized from data that doesn't match any known member. For * example, if the SDK is on an older version than the API, then the API @@ -43037,40 +47417,36 @@ private constructor( * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - /** Increase failed to process the authorization in a timely manner. */ - ISSUER_ERROR, - /** The physical card read had an invalid CVV or dCVV. */ - INVALID_PHYSICAL_CARD, + /** Unknown */ + UNKNOWN, + /** No terminal was used for this transaction. */ + TERMINAL_NOT_USED, /** - * The card's authorization request cryptogram was invalid. The - * cryptogram can be from a physical card or a Digital Wallet Token - * purchase. + * The terminal can only read magnetic stripes and does not have chip or + * contactless reading capability. */ - INVALID_CRYPTOGRAM, - /** The 3DS cardholder authentication verification value was invalid. */ - INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE, + MAGNETIC_STRIPE, + /** The terminal can only read barcodes. */ + BARCODE, /** - * An internal Visa error occurred. Visa uses this reason code for - * certain expected occurrences as well, such as Application Transaction - * Counter (ATC) replays. + * The terminal can only read cards via Optical Character Recognition. */ - INTERNAL_VISA_ERROR, + OPTICAL_CHARACTER_RECOGNITION, /** - * The merchant has enabled Visa's Transaction Advisory Service and - * requires further authentication to perform the transaction. In - * practice this is often utilized at fuel pumps to tell the cardholder - * to see the cashier. + * The terminal supports contact chip cards and can also read the + * magnetic stripe. If contact chip is supported, this value is used + * regardless of whether contactless is also supported. */ - MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED, + CHIP_OR_CONTACTLESS, /** - * The transaction was blocked by Visa's Payment Fraud Disruption - * service due to fraudulent Acquirer behavior, such as card testing. + * The terminal supports contactless reads but does not support contact + * chip. Only used when the terminal lacks contact chip capability. */ - PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK, - /** An unspecific reason for stand-in processing. */ - OTHER, + CONTACTLESS_ONLY, + /** The terminal has no card reading capability. */ + NO_CAPABILITY, /** - * An enum member indicating that [StandInProcessingReason] was + * An enum member indicating that [TerminalEntryCapability] was * instantiated with an unknown value. */ _UNKNOWN, @@ -43085,18 +47461,14 @@ private constructor( */ fun value(): Value = when (this) { - ISSUER_ERROR -> Value.ISSUER_ERROR - INVALID_PHYSICAL_CARD -> Value.INVALID_PHYSICAL_CARD - INVALID_CRYPTOGRAM -> Value.INVALID_CRYPTOGRAM - INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE -> - Value.INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE - INTERNAL_VISA_ERROR -> Value.INTERNAL_VISA_ERROR - MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED -> - Value - .MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED - PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK -> - Value.PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK - OTHER -> Value.OTHER + UNKNOWN -> Value.UNKNOWN + TERMINAL_NOT_USED -> Value.TERMINAL_NOT_USED + MAGNETIC_STRIPE -> Value.MAGNETIC_STRIPE + BARCODE -> Value.BARCODE + OPTICAL_CHARACTER_RECOGNITION -> Value.OPTICAL_CHARACTER_RECOGNITION + CHIP_OR_CONTACTLESS -> Value.CHIP_OR_CONTACTLESS + CONTACTLESS_ONLY -> Value.CONTACTLESS_ONLY + NO_CAPABILITY -> Value.NO_CAPABILITY else -> Value._UNKNOWN } @@ -43111,21 +47483,17 @@ private constructor( */ fun known(): Known = when (this) { - ISSUER_ERROR -> Known.ISSUER_ERROR - INVALID_PHYSICAL_CARD -> Known.INVALID_PHYSICAL_CARD - INVALID_CRYPTOGRAM -> Known.INVALID_CRYPTOGRAM - INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE -> - Known.INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE - INTERNAL_VISA_ERROR -> Known.INTERNAL_VISA_ERROR - MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED -> - Known - .MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED - PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK -> - Known.PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK - OTHER -> Known.OTHER + UNKNOWN -> Known.UNKNOWN + TERMINAL_NOT_USED -> Known.TERMINAL_NOT_USED + MAGNETIC_STRIPE -> Known.MAGNETIC_STRIPE + BARCODE -> Known.BARCODE + OPTICAL_CHARACTER_RECOGNITION -> Known.OPTICAL_CHARACTER_RECOGNITION + CHIP_OR_CONTACTLESS -> Known.CHIP_OR_CONTACTLESS + CONTACTLESS_ONLY -> Known.CONTACTLESS_ONLY + NO_CAPABILITY -> Known.NO_CAPABILITY else -> throw IncreaseInvalidDataException( - "Unknown StandInProcessingReason: $value" + "Unknown TerminalEntryCapability: $value" ) } @@ -43145,7 +47513,7 @@ private constructor( private var validated: Boolean = false - fun validate(): StandInProcessingReason = apply { + fun validate(): TerminalEntryCapability = apply { if (validated) { return@apply } @@ -43162,437 +47530,898 @@ private constructor( false } - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is TerminalEntryCapability && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Visa && + electronicCommerceIndicator == other.electronicCommerceIndicator && + pointOfServiceEntryMode == other.pointOfServiceEntryMode && + standInProcessingReason == other.standInProcessingReason && + terminalEntryCapability == other.terminalEntryCapability && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + electronicCommerceIndicator, + pointOfServiceEntryMode, + standInProcessingReason, + terminalEntryCapability, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Visa{electronicCommerceIndicator=$electronicCommerceIndicator, pointOfServiceEntryMode=$pointOfServiceEntryMode, standInProcessingReason=$standInProcessingReason, terminalEntryCapability=$terminalEntryCapability, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is NetworkDetails && + category == other.category && + pulse == other.pulse && + visa == other.visa && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(category, pulse, visa, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "NetworkDetails{category=$category, pulse=$pulse, visa=$visa, additionalProperties=$additionalProperties}" + } + + /** Network-specific identifiers for a specific request or transaction. */ + class NetworkIdentifiers + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val authorizationIdentificationResponse: JsonField, + private val retrievalReferenceNumber: JsonField, + private val traceNumber: JsonField, + private val transactionId: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("authorization_identification_response") + @ExcludeMissing + authorizationIdentificationResponse: JsonField = JsonMissing.of(), + @JsonProperty("retrieval_reference_number") + @ExcludeMissing + retrievalReferenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("trace_number") + @ExcludeMissing + traceNumber: JsonField = JsonMissing.of(), + @JsonProperty("transaction_id") + @ExcludeMissing + transactionId: JsonField = JsonMissing.of(), + ) : this( + authorizationIdentificationResponse, + retrievalReferenceNumber, + traceNumber, + transactionId, + mutableMapOf(), + ) + + /** + * The randomly generated 6-character Authorization Identification Response code + * sent back to the acquirer in an approved response. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun authorizationIdentificationResponse(): Optional = + authorizationIdentificationResponse.getOptional( + "authorization_identification_response" + ) + + /** + * A life-cycle identifier used across e.g., an authorization and a reversal. + * Expected to be unique per acquirer within a window of time. For some card + * networks the retrieval reference number includes the trace counter. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun retrievalReferenceNumber(): Optional = + retrievalReferenceNumber.getOptional("retrieval_reference_number") + + /** + * A counter used to verify an individual authorization. Expected to be unique per + * acquirer within a window of time. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun traceNumber(): Optional = traceNumber.getOptional("trace_number") + + /** + * A globally unique transaction identifier provided by the card network, used + * across multiple life-cycle requests. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun transactionId(): Optional = transactionId.getOptional("transaction_id") + + /** + * Returns the raw JSON value of [authorizationIdentificationResponse]. + * + * Unlike [authorizationIdentificationResponse], this method doesn't throw if the + * JSON field has an unexpected type. + */ + @JsonProperty("authorization_identification_response") + @ExcludeMissing + fun _authorizationIdentificationResponse(): JsonField = + authorizationIdentificationResponse + + /** + * Returns the raw JSON value of [retrievalReferenceNumber]. + * + * Unlike [retrievalReferenceNumber], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("retrieval_reference_number") + @ExcludeMissing + fun _retrievalReferenceNumber(): JsonField = retrievalReferenceNumber + + /** + * Returns the raw JSON value of [traceNumber]. + * + * Unlike [traceNumber], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("trace_number") + @ExcludeMissing + fun _traceNumber(): JsonField = traceNumber + + /** + * Returns the raw JSON value of [transactionId]. + * + * Unlike [transactionId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("transaction_id") + @ExcludeMissing + fun _transactionId(): JsonField = transactionId + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [NetworkIdentifiers]. + * + * The following fields are required: + * ```java + * .authorizationIdentificationResponse() + * .retrievalReferenceNumber() + * .traceNumber() + * .transactionId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [NetworkIdentifiers]. */ + class Builder internal constructor() { + + private var authorizationIdentificationResponse: JsonField? = null + private var retrievalReferenceNumber: JsonField? = null + private var traceNumber: JsonField? = null + private var transactionId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(networkIdentifiers: NetworkIdentifiers) = apply { + authorizationIdentificationResponse = + networkIdentifiers.authorizationIdentificationResponse + retrievalReferenceNumber = networkIdentifiers.retrievalReferenceNumber + traceNumber = networkIdentifiers.traceNumber + transactionId = networkIdentifiers.transactionId + additionalProperties = + networkIdentifiers.additionalProperties.toMutableMap() + } + + /** + * The randomly generated 6-character Authorization Identification Response code + * sent back to the acquirer in an approved response. + */ + fun authorizationIdentificationResponse( + authorizationIdentificationResponse: String? + ) = + authorizationIdentificationResponse( + JsonField.ofNullable(authorizationIdentificationResponse) + ) + + /** + * Alias for calling [Builder.authorizationIdentificationResponse] with + * `authorizationIdentificationResponse.orElse(null)`. + */ + fun authorizationIdentificationResponse( + authorizationIdentificationResponse: Optional + ) = + authorizationIdentificationResponse( + authorizationIdentificationResponse.getOrNull() + ) + + /** + * Sets [Builder.authorizationIdentificationResponse] to an arbitrary JSON + * value. + * + * You should usually call [Builder.authorizationIdentificationResponse] with a + * well-typed [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun authorizationIdentificationResponse( + authorizationIdentificationResponse: JsonField + ) = apply { + this.authorizationIdentificationResponse = + authorizationIdentificationResponse + } + + /** + * A life-cycle identifier used across e.g., an authorization and a reversal. + * Expected to be unique per acquirer within a window of time. For some card + * networks the retrieval reference number includes the trace counter. + */ + fun retrievalReferenceNumber(retrievalReferenceNumber: String?) = + retrievalReferenceNumber(JsonField.ofNullable(retrievalReferenceNumber)) + + /** + * Alias for calling [Builder.retrievalReferenceNumber] with + * `retrievalReferenceNumber.orElse(null)`. + */ + fun retrievalReferenceNumber(retrievalReferenceNumber: Optional) = + retrievalReferenceNumber(retrievalReferenceNumber.getOrNull()) + + /** + * Sets [Builder.retrievalReferenceNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.retrievalReferenceNumber] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun retrievalReferenceNumber(retrievalReferenceNumber: JsonField) = + apply { + this.retrievalReferenceNumber = retrievalReferenceNumber + } + + /** + * A counter used to verify an individual authorization. Expected to be unique + * per acquirer within a window of time. + */ + fun traceNumber(traceNumber: String?) = + traceNumber(JsonField.ofNullable(traceNumber)) + + /** Alias for calling [Builder.traceNumber] with `traceNumber.orElse(null)`. */ + fun traceNumber(traceNumber: Optional) = + traceNumber(traceNumber.getOrNull()) + + /** + * Sets [Builder.traceNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.traceNumber] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun traceNumber(traceNumber: JsonField) = apply { + this.traceNumber = traceNumber + } + + /** + * A globally unique transaction identifier provided by the card network, used + * across multiple life-cycle requests. + */ + fun transactionId(transactionId: String?) = + transactionId(JsonField.ofNullable(transactionId)) + + /** + * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`. + */ + fun transactionId(transactionId: Optional) = + transactionId(transactionId.getOrNull()) + + /** + * Sets [Builder.transactionId] to an arbitrary JSON value. + * + * You should usually call [Builder.transactionId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun transactionId(transactionId: JsonField) = apply { + this.transactionId = transactionId + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - return other is StandInProcessingReason && value == other.value + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) } - override fun hashCode() = value.hashCode() + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - override fun toString() = value.toString() + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } /** - * The capability of the terminal being used to read the card. Shows whether a - * terminal can e.g., accept chip cards or if it only supports magnetic stripe - * reads. This reflects the highest capability of the terminal — for example, a - * terminal that supports both chip and magnetic stripe will be identified as - * chip-capable. + * Returns an immutable instance of [NetworkIdentifiers]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .authorizationIdentificationResponse() + * .retrievalReferenceNumber() + * .traceNumber() + * .transactionId() + * ``` + * + * @throws IllegalStateException if any required field is unset. */ - class TerminalEntryCapability - @JsonCreator - private constructor(private val value: JsonField) : Enum { + fun build(): NetworkIdentifiers = + NetworkIdentifiers( + checkRequired( + "authorizationIdentificationResponse", + authorizationIdentificationResponse, + ), + checkRequired("retrievalReferenceNumber", retrievalReferenceNumber), + checkRequired("traceNumber", traceNumber), + checkRequired("transactionId", transactionId), + additionalProperties.toMutableMap(), + ) + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + private var validated: Boolean = false - companion object { + fun validate(): NetworkIdentifiers = apply { + if (validated) { + return@apply + } - /** Unknown */ - @JvmField val UNKNOWN = of("unknown") + authorizationIdentificationResponse() + retrievalReferenceNumber() + traceNumber() + transactionId() + validated = true + } - /** No terminal was used for this transaction. */ - @JvmField val TERMINAL_NOT_USED = of("terminal_not_used") + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * The terminal can only read magnetic stripes and does not have chip or - * contactless reading capability. - */ - @JvmField val MAGNETIC_STRIPE = of("magnetic_stripe") + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (authorizationIdentificationResponse.asKnown().isPresent) 1 else 0) + + (if (retrievalReferenceNumber.asKnown().isPresent) 1 else 0) + + (if (traceNumber.asKnown().isPresent) 1 else 0) + + (if (transactionId.asKnown().isPresent) 1 else 0) - /** The terminal can only read barcodes. */ - @JvmField val BARCODE = of("barcode") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * The terminal can only read cards via Optical Character Recognition. - */ - @JvmField - val OPTICAL_CHARACTER_RECOGNITION = of("optical_character_recognition") + return other is NetworkIdentifiers && + authorizationIdentificationResponse == + other.authorizationIdentificationResponse && + retrievalReferenceNumber == other.retrievalReferenceNumber && + traceNumber == other.traceNumber && + transactionId == other.transactionId && + additionalProperties == other.additionalProperties + } - /** - * The terminal supports contact chip cards and can also read the - * magnetic stripe. If contact chip is supported, this value is used - * regardless of whether contactless is also supported. - */ - @JvmField val CHIP_OR_CONTACTLESS = of("chip_or_contactless") + private val hashCode: Int by lazy { + Objects.hash( + authorizationIdentificationResponse, + retrievalReferenceNumber, + traceNumber, + transactionId, + additionalProperties, + ) + } - /** - * The terminal supports contactless reads but does not support contact - * chip. Only used when the terminal lacks contact chip capability. - */ - @JvmField val CONTACTLESS_ONLY = of("contactless_only") + override fun hashCode(): Int = hashCode - /** The terminal has no card reading capability. */ - @JvmField val NO_CAPABILITY = of("no_capability") + override fun toString() = + "NetworkIdentifiers{authorizationIdentificationResponse=$authorizationIdentificationResponse, retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}" + } - @JvmStatic - fun of(value: String) = TerminalEntryCapability(JsonField.of(value)) - } + /** + * The processing category describes the intent behind the financial, such as whether it + * was used for bill payments or an automatic fuel dispenser. + */ + class ProcessingCategory + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** An enum containing [TerminalEntryCapability]'s known values. */ - enum class Known { - /** Unknown */ - UNKNOWN, - /** No terminal was used for this transaction. */ - TERMINAL_NOT_USED, - /** - * The terminal can only read magnetic stripes and does not have chip or - * contactless reading capability. - */ - MAGNETIC_STRIPE, - /** The terminal can only read barcodes. */ - BARCODE, - /** - * The terminal can only read cards via Optical Character Recognition. - */ - OPTICAL_CHARACTER_RECOGNITION, - /** - * The terminal supports contact chip cards and can also read the - * magnetic stripe. If contact chip is supported, this value is used - * regardless of whether contactless is also supported. - */ - CHIP_OR_CONTACTLESS, - /** - * The terminal supports contactless reads but does not support contact - * chip. Only used when the terminal lacks contact chip capability. - */ - CONTACTLESS_ONLY, - /** The terminal has no card reading capability. */ - NO_CAPABILITY, - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /** - * An enum containing [TerminalEntryCapability]'s known values, as well as - * an [_UNKNOWN] member. - * - * An instance of [TerminalEntryCapability] can contain an unknown value in - * a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** Unknown */ - UNKNOWN, - /** No terminal was used for this transaction. */ - TERMINAL_NOT_USED, - /** - * The terminal can only read magnetic stripes and does not have chip or - * contactless reading capability. - */ - MAGNETIC_STRIPE, - /** The terminal can only read barcodes. */ - BARCODE, - /** - * The terminal can only read cards via Optical Character Recognition. - */ - OPTICAL_CHARACTER_RECOGNITION, - /** - * The terminal supports contact chip cards and can also read the - * magnetic stripe. If contact chip is supported, this value is used - * regardless of whether contactless is also supported. - */ - CHIP_OR_CONTACTLESS, - /** - * The terminal supports contactless reads but does not support contact - * chip. Only used when the terminal lacks contact chip capability. - */ - CONTACTLESS_ONLY, - /** The terminal has no card reading capability. */ - NO_CAPABILITY, - /** - * An enum member indicating that [TerminalEntryCapability] was - * instantiated with an unknown value. - */ - _UNKNOWN, - } + companion object { - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - UNKNOWN -> Value.UNKNOWN - TERMINAL_NOT_USED -> Value.TERMINAL_NOT_USED - MAGNETIC_STRIPE -> Value.MAGNETIC_STRIPE - BARCODE -> Value.BARCODE - OPTICAL_CHARACTER_RECOGNITION -> Value.OPTICAL_CHARACTER_RECOGNITION - CHIP_OR_CONTACTLESS -> Value.CHIP_OR_CONTACTLESS - CONTACTLESS_ONLY -> Value.CONTACTLESS_ONLY - NO_CAPABILITY -> Value.NO_CAPABILITY - else -> Value._UNKNOWN - } + /** + * Account funding transactions are transactions used to e.g., fund an account + * or transfer funds between accounts. + */ + @JvmField val ACCOUNT_FUNDING = of("account_funding") - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - UNKNOWN -> Known.UNKNOWN - TERMINAL_NOT_USED -> Known.TERMINAL_NOT_USED - MAGNETIC_STRIPE -> Known.MAGNETIC_STRIPE - BARCODE -> Known.BARCODE - OPTICAL_CHARACTER_RECOGNITION -> Known.OPTICAL_CHARACTER_RECOGNITION - CHIP_OR_CONTACTLESS -> Known.CHIP_OR_CONTACTLESS - CONTACTLESS_ONLY -> Known.CONTACTLESS_ONLY - NO_CAPABILITY -> Known.NO_CAPABILITY - else -> - throw IncreaseInvalidDataException( - "Unknown TerminalEntryCapability: $value" - ) - } + /** + * Automatic fuel dispenser authorizations occur when a card is used at a gas + * pump, prior to the actual transaction amount being known. They are followed + * by an advice message that updates the amount of the pending transaction. + */ + @JvmField val AUTOMATIC_FUEL_DISPENSER = of("automatic_fuel_dispenser") - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + /** A transaction used to pay a bill. */ + @JvmField val BILL_PAYMENT = of("bill_payment") - private var validated: Boolean = false + /** Original credit transactions are used to send money to a cardholder. */ + @JvmField val ORIGINAL_CREDIT = of("original_credit") - fun validate(): TerminalEntryCapability = apply { - if (validated) { - return@apply - } + /** A regular purchase. */ + @JvmField val PURCHASE = of("purchase") - known() - validated = true - } + /** + * Quasi-cash transactions represent purchases of items which may be convertible + * to cash. + */ + @JvmField val QUASI_CASH = of("quasi_cash") - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * A refund card authorization, sometimes referred to as a credit voucher + * authorization, where funds are credited to the cardholder. + */ + @JvmField val REFUND = of("refund") - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + /** + * Cash disbursement transactions are used to withdraw cash from an ATM or a + * point of sale. + */ + @JvmField val CASH_DISBURSEMENT = of("cash_disbursement") - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * A balance inquiry transaction is used to check the balance of an account + * associated with a card. + */ + @JvmField val BALANCE_INQUIRY = of("balance_inquiry") - return other is TerminalEntryCapability && value == other.value - } + /** The processing category is unknown. */ + @JvmField val UNKNOWN = of("unknown") + + @JvmStatic fun of(value: String) = ProcessingCategory(JsonField.of(value)) + } + + /** An enum containing [ProcessingCategory]'s known values. */ + enum class Known { + /** + * Account funding transactions are transactions used to e.g., fund an account + * or transfer funds between accounts. + */ + ACCOUNT_FUNDING, + /** + * Automatic fuel dispenser authorizations occur when a card is used at a gas + * pump, prior to the actual transaction amount being known. They are followed + * by an advice message that updates the amount of the pending transaction. + */ + AUTOMATIC_FUEL_DISPENSER, + /** A transaction used to pay a bill. */ + BILL_PAYMENT, + /** Original credit transactions are used to send money to a cardholder. */ + ORIGINAL_CREDIT, + /** A regular purchase. */ + PURCHASE, + /** + * Quasi-cash transactions represent purchases of items which may be convertible + * to cash. + */ + QUASI_CASH, + /** + * A refund card authorization, sometimes referred to as a credit voucher + * authorization, where funds are credited to the cardholder. + */ + REFUND, + /** + * Cash disbursement transactions are used to withdraw cash from an ATM or a + * point of sale. + */ + CASH_DISBURSEMENT, + /** + * A balance inquiry transaction is used to check the balance of an account + * associated with a card. + */ + BALANCE_INQUIRY, + /** The processing category is unknown. */ + UNKNOWN, + } + + /** + * An enum containing [ProcessingCategory]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [ProcessingCategory] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** + * Account funding transactions are transactions used to e.g., fund an account + * or transfer funds between accounts. + */ + ACCOUNT_FUNDING, + /** + * Automatic fuel dispenser authorizations occur when a card is used at a gas + * pump, prior to the actual transaction amount being known. They are followed + * by an advice message that updates the amount of the pending transaction. + */ + AUTOMATIC_FUEL_DISPENSER, + /** A transaction used to pay a bill. */ + BILL_PAYMENT, + /** Original credit transactions are used to send money to a cardholder. */ + ORIGINAL_CREDIT, + /** A regular purchase. */ + PURCHASE, + /** + * Quasi-cash transactions represent purchases of items which may be convertible + * to cash. + */ + QUASI_CASH, + /** + * A refund card authorization, sometimes referred to as a credit voucher + * authorization, where funds are credited to the cardholder. + */ + REFUND, + /** + * Cash disbursement transactions are used to withdraw cash from an ATM or a + * point of sale. + */ + CASH_DISBURSEMENT, + /** + * A balance inquiry transaction is used to check the balance of an account + * associated with a card. + */ + BALANCE_INQUIRY, + /** The processing category is unknown. */ + UNKNOWN, + /** + * An enum member indicating that [ProcessingCategory] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ACCOUNT_FUNDING -> Value.ACCOUNT_FUNDING + AUTOMATIC_FUEL_DISPENSER -> Value.AUTOMATIC_FUEL_DISPENSER + BILL_PAYMENT -> Value.BILL_PAYMENT + ORIGINAL_CREDIT -> Value.ORIGINAL_CREDIT + PURCHASE -> Value.PURCHASE + QUASI_CASH -> Value.QUASI_CASH + REFUND -> Value.REFUND + CASH_DISBURSEMENT -> Value.CASH_DISBURSEMENT + BALANCE_INQUIRY -> Value.BALANCE_INQUIRY + UNKNOWN -> Value.UNKNOWN + else -> Value._UNKNOWN + } - override fun hashCode() = value.hashCode() + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + ACCOUNT_FUNDING -> Known.ACCOUNT_FUNDING + AUTOMATIC_FUEL_DISPENSER -> Known.AUTOMATIC_FUEL_DISPENSER + BILL_PAYMENT -> Known.BILL_PAYMENT + ORIGINAL_CREDIT -> Known.ORIGINAL_CREDIT + PURCHASE -> Known.PURCHASE + QUASI_CASH -> Known.QUASI_CASH + REFUND -> Known.REFUND + CASH_DISBURSEMENT -> Known.CASH_DISBURSEMENT + BALANCE_INQUIRY -> Known.BALANCE_INQUIRY + UNKNOWN -> Known.UNKNOWN + else -> + throw IncreaseInvalidDataException("Unknown ProcessingCategory: $value") + } - override fun toString() = value.toString() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + private var validated: Boolean = false - return other is Visa && - electronicCommerceIndicator == other.electronicCommerceIndicator && - pointOfServiceEntryMode == other.pointOfServiceEntryMode && - standInProcessingReason == other.standInProcessingReason && - terminalEntryCapability == other.terminalEntryCapability && - additionalProperties == other.additionalProperties + fun validate(): ProcessingCategory = apply { + if (validated) { + return@apply } - private val hashCode: Int by lazy { - Objects.hash( - electronicCommerceIndicator, - pointOfServiceEntryMode, - standInProcessingReason, - terminalEntryCapability, - additionalProperties, - ) - } + known() + validated = true + } - override fun hashCode(): Int = hashCode + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - override fun toString() = - "Visa{electronicCommerceIndicator=$electronicCommerceIndicator, pointOfServiceEntryMode=$pointOfServiceEntryMode, standInProcessingReason=$standInProcessingReason, terminalEntryCapability=$terminalEntryCapability, additionalProperties=$additionalProperties}" - } + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is NetworkDetails && - category == other.category && - pulse == other.pulse && - visa == other.visa && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(category, pulse, visa, additionalProperties) + return other is ProcessingCategory && value == other.value } - override fun hashCode(): Int = hashCode + override fun hashCode() = value.hashCode() - override fun toString() = - "NetworkDetails{category=$category, pulse=$pulse, visa=$visa, additionalProperties=$additionalProperties}" + override fun toString() = value.toString() } - /** Network-specific identifiers for a specific request or transaction. */ - class NetworkIdentifiers + class SchemeFee @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val authorizationIdentificationResponse: JsonField, - private val retrievalReferenceNumber: JsonField, - private val traceNumber: JsonField, - private val transactionId: JsonField, + private val amount: JsonField, + private val createdAt: JsonField, + private val currency: JsonField, + private val feeType: JsonField, + private val fixedComponent: JsonField, + private val variableRate: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("authorization_identification_response") + @JsonProperty("amount") @ExcludeMissing - authorizationIdentificationResponse: JsonField = JsonMissing.of(), - @JsonProperty("retrieval_reference_number") + amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") @ExcludeMissing - retrievalReferenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("trace_number") + createdAt: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing - traceNumber: JsonField = JsonMissing.of(), - @JsonProperty("transaction_id") + currency: JsonField = JsonMissing.of(), + @JsonProperty("fee_type") @ExcludeMissing - transactionId: JsonField = JsonMissing.of(), + feeType: JsonField = JsonMissing.of(), + @JsonProperty("fixed_component") + @ExcludeMissing + fixedComponent: JsonField = JsonMissing.of(), + @JsonProperty("variable_rate") + @ExcludeMissing + variableRate: JsonField = JsonMissing.of(), ) : this( - authorizationIdentificationResponse, - retrievalReferenceNumber, - traceNumber, - transactionId, + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, mutableMapOf(), ) /** - * The randomly generated 6-character Authorization Identification Response code - * sent back to the acquirer in an approved response. + * The fee amount given as a string containing a decimal number. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). */ - fun authorizationIdentificationResponse(): Optional = - authorizationIdentificationResponse.getOptional( - "authorization_identification_response" - ) + fun amount(): String = amount.getRequired("amount") /** - * A life-cycle identifier used across e.g., an authorization and a reversal. - * Expected to be unique per acquirer within a window of time. For some card - * networks the retrieval reference number includes the trace counter. + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + * created. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). */ - fun retrievalReferenceNumber(): Optional = - retrievalReferenceNumber.getOptional("retrieval_reference_number") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") /** - * A counter used to verify an individual authorization. Expected to be unique per - * acquirer within a window of time. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun currency(): Currency = currency.getRequired("currency") + + /** + * The type of fee being assessed. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun feeType(): FeeType = feeType.getRequired("fee_type") + + /** + * The fixed component of the fee, if applicable, given in major units of the fee + * amount. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun traceNumber(): Optional = traceNumber.getOptional("trace_number") + fun fixedComponent(): Optional = + fixedComponent.getOptional("fixed_component") /** - * A globally unique transaction identifier provided by the card network, used - * across multiple life-cycle requests. + * The variable rate component of the fee, if applicable, given as a decimal (e.g., + * 0.015 for 1.5%). * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun transactionId(): Optional = transactionId.getOptional("transaction_id") + fun variableRate(): Optional = variableRate.getOptional("variable_rate") /** - * Returns the raw JSON value of [authorizationIdentificationResponse]. + * Returns the raw JSON value of [amount]. * - * Unlike [authorizationIdentificationResponse], this method doesn't throw if the - * JSON field has an unexpected type. + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("authorization_identification_response") + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + + /** + * Returns the raw JSON value of [createdAt]. + * + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("created_at") @ExcludeMissing - fun _authorizationIdentificationResponse(): JsonField = - authorizationIdentificationResponse + fun _createdAt(): JsonField = createdAt /** - * Returns the raw JSON value of [retrievalReferenceNumber]. + * Returns the raw JSON value of [currency]. * - * Unlike [retrievalReferenceNumber], this method doesn't throw if the JSON field - * has an unexpected type. + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("retrieval_reference_number") + @JsonProperty("currency") @ExcludeMissing - fun _retrievalReferenceNumber(): JsonField = retrievalReferenceNumber + fun _currency(): JsonField = currency /** - * Returns the raw JSON value of [traceNumber]. + * Returns the raw JSON value of [feeType]. * - * Unlike [traceNumber], this method doesn't throw if the JSON field has an + * Unlike [feeType], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("fee_type") + @ExcludeMissing + fun _feeType(): JsonField = feeType + + /** + * Returns the raw JSON value of [fixedComponent]. + * + * Unlike [fixedComponent], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("trace_number") + @JsonProperty("fixed_component") @ExcludeMissing - fun _traceNumber(): JsonField = traceNumber + fun _fixedComponent(): JsonField = fixedComponent /** - * Returns the raw JSON value of [transactionId]. + * Returns the raw JSON value of [variableRate]. * - * Unlike [transactionId], this method doesn't throw if the JSON field has an + * Unlike [variableRate], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("transaction_id") + @JsonProperty("variable_rate") @ExcludeMissing - fun _transactionId(): JsonField = transactionId + fun _variableRate(): JsonField = variableRate @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -43609,537 +48438,1147 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NetworkIdentifiers]. + * Returns a mutable builder for constructing an instance of [SchemeFee]. * * The following fields are required: * ```java - * .authorizationIdentificationResponse() - * .retrievalReferenceNumber() - * .traceNumber() - * .transactionId() + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [NetworkIdentifiers]. */ + /** A builder for [SchemeFee]. */ class Builder internal constructor() { - private var authorizationIdentificationResponse: JsonField? = null - private var retrievalReferenceNumber: JsonField? = null - private var traceNumber: JsonField? = null - private var transactionId: JsonField? = null + private var amount: JsonField? = null + private var createdAt: JsonField? = null + private var currency: JsonField? = null + private var feeType: JsonField? = null + private var fixedComponent: JsonField? = null + private var variableRate: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(networkIdentifiers: NetworkIdentifiers) = apply { - authorizationIdentificationResponse = - networkIdentifiers.authorizationIdentificationResponse - retrievalReferenceNumber = networkIdentifiers.retrievalReferenceNumber - traceNumber = networkIdentifiers.traceNumber - transactionId = networkIdentifiers.transactionId - additionalProperties = - networkIdentifiers.additionalProperties.toMutableMap() + internal fun from(schemeFee: SchemeFee) = apply { + amount = schemeFee.amount + createdAt = schemeFee.createdAt + currency = schemeFee.currency + feeType = schemeFee.feeType + fixedComponent = schemeFee.fixedComponent + variableRate = schemeFee.variableRate + additionalProperties = schemeFee.additionalProperties.toMutableMap() } + /** The fee amount given as a string containing a decimal number. */ + fun amount(amount: String) = amount(JsonField.of(amount)) + /** - * The randomly generated 6-character Authorization Identification Response code - * sent back to the acquirer in an approved response. + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - fun authorizationIdentificationResponse( - authorizationIdentificationResponse: String? - ) = - authorizationIdentificationResponse( - JsonField.ofNullable(authorizationIdentificationResponse) - ) + fun amount(amount: JsonField) = apply { this.amount = amount } /** - * Alias for calling [Builder.authorizationIdentificationResponse] with - * `authorizationIdentificationResponse.orElse(null)`. + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee + * was created. */ - fun authorizationIdentificationResponse( - authorizationIdentificationResponse: Optional - ) = - authorizationIdentificationResponse( - authorizationIdentificationResponse.getOrNull() - ) + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) /** - * Sets [Builder.authorizationIdentificationResponse] to an arbitrary JSON - * value. + * Sets [Builder.createdAt] to an arbitrary JSON value. * - * You should usually call [Builder.authorizationIdentificationResponse] with a - * well-typed [String] value instead. This method is primarily for setting the + * You should usually call [Builder.createdAt] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the * field to an undocumented or not yet supported value. */ - fun authorizationIdentificationResponse( - authorizationIdentificationResponse: JsonField - ) = apply { - this.authorizationIdentificationResponse = - authorizationIdentificationResponse + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } /** - * A life-cycle identifier used across e.g., an authorization and a reversal. - * Expected to be unique per acquirer within a window of time. For some card - * networks the retrieval reference number includes the trace counter. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. */ - fun retrievalReferenceNumber(retrievalReferenceNumber: String?) = - retrievalReferenceNumber(JsonField.ofNullable(retrievalReferenceNumber)) + fun currency(currency: Currency) = currency(JsonField.of(currency)) /** - * Alias for calling [Builder.retrievalReferenceNumber] with - * `retrievalReferenceNumber.orElse(null)`. + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [Currency] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - fun retrievalReferenceNumber(retrievalReferenceNumber: Optional) = - retrievalReferenceNumber(retrievalReferenceNumber.getOrNull()) + fun currency(currency: JsonField) = apply { this.currency = currency } + + /** The type of fee being assessed. */ + fun feeType(feeType: FeeType) = feeType(JsonField.of(feeType)) /** - * Sets [Builder.retrievalReferenceNumber] to an arbitrary JSON value. + * Sets [Builder.feeType] to an arbitrary JSON value. * - * You should usually call [Builder.retrievalReferenceNumber] with a well-typed - * [String] value instead. This method is primarily for setting the field to an + * You should usually call [Builder.feeType] with a well-typed [FeeType] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun feeType(feeType: JsonField) = apply { this.feeType = feeType } + + /** + * The fixed component of the fee, if applicable, given in major units of the + * fee amount. + */ + fun fixedComponent(fixedComponent: String?) = + fixedComponent(JsonField.ofNullable(fixedComponent)) + + /** + * Alias for calling [Builder.fixedComponent] with + * `fixedComponent.orElse(null)`. + */ + fun fixedComponent(fixedComponent: Optional) = + fixedComponent(fixedComponent.getOrNull()) + + /** + * Sets [Builder.fixedComponent] to an arbitrary JSON value. + * + * You should usually call [Builder.fixedComponent] with a well-typed [String] + * value instead. This method is primarily for setting the field to an * undocumented or not yet supported value. */ - fun retrievalReferenceNumber(retrievalReferenceNumber: JsonField) = + fun fixedComponent(fixedComponent: JsonField) = apply { + this.fixedComponent = fixedComponent + } + + /** + * The variable rate component of the fee, if applicable, given as a decimal + * (e.g., 0.015 for 1.5%). + */ + fun variableRate(variableRate: String?) = + variableRate(JsonField.ofNullable(variableRate)) + + /** + * Alias for calling [Builder.variableRate] with `variableRate.orElse(null)`. + */ + fun variableRate(variableRate: Optional) = + variableRate(variableRate.getOrNull()) + + /** + * Sets [Builder.variableRate] to an arbitrary JSON value. + * + * You should usually call [Builder.variableRate] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun variableRate(variableRate: JsonField) = apply { + this.variableRate = variableRate + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.retrievalReferenceNumber = retrievalReferenceNumber + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [SchemeFee]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SchemeFee = + SchemeFee( + checkRequired("amount", amount), + checkRequired("createdAt", createdAt), + checkRequired("currency", currency), + checkRequired("feeType", feeType), + checkRequired("fixedComponent", fixedComponent), + checkRequired("variableRate", variableRate), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): SchemeFee = apply { + if (validated) { + return@apply + } + + amount() + createdAt() + currency().validate() + feeType().validate() + fixedComponent() + variableRate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (currency.asKnown().getOrNull()?.validity() ?: 0) + + (feeType.asKnown().getOrNull()?.validity() ?: 0) + + (if (fixedComponent.asKnown().isPresent) 1 else 0) + + (if (variableRate.asKnown().isPresent) 1 else 0) + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + */ + class Currency + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** US Dollar (USD) */ + @JvmField val USD = of("USD") + + @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) + } + + /** An enum containing [Currency]'s known values. */ + enum class Known { + /** US Dollar (USD) */ + USD + } + + /** + * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Currency] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** US Dollar (USD) */ + USD, + /** + * An enum member indicating that [Currency] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + USD -> Value.USD + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + USD -> Known.USD + else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Currency = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false } /** - * A counter used to verify an individual authorization. Expected to be unique - * per acquirer within a window of time. + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. */ - fun traceNumber(traceNumber: String?) = - traceNumber(JsonField.ofNullable(traceNumber)) + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - /** Alias for calling [Builder.traceNumber] with `traceNumber.orElse(null)`. */ - fun traceNumber(traceNumber: Optional) = - traceNumber(traceNumber.getOrNull()) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Sets [Builder.traceNumber] to an arbitrary JSON value. - * - * You should usually call [Builder.traceNumber] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun traceNumber(traceNumber: JsonField) = apply { - this.traceNumber = traceNumber + return other is Currency && value == other.value } - /** - * A globally unique transaction identifier provided by the card network, used - * across multiple life-cycle requests. - */ - fun transactionId(transactionId: String?) = - transactionId(JsonField.ofNullable(transactionId)) + override fun hashCode() = value.hashCode() - /** - * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`. - */ - fun transactionId(transactionId: Optional) = - transactionId(transactionId.getOrNull()) + override fun toString() = value.toString() + } + + /** The type of fee being assessed. */ + class FeeType + @JsonCreator + private constructor(private val value: JsonField) : Enum { /** - * Sets [Builder.transactionId] to an arbitrary JSON value. + * Returns this class instance's raw value. * - * You should usually call [Builder.transactionId] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. */ - fun transactionId(transactionId: JsonField) = apply { - this.transactionId = transactionId - } + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + companion object { - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY = + of("visa_international_service_assessment_single_currency") - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY = + of("visa_international_service_assessment_cross_currency") - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + @JvmField + val VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE = + of("visa_authorization_domestic_point_of_sale") - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + @JvmField + val VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_international_point_of_sale") - /** - * Returns an immutable instance of [NetworkIdentifiers]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .authorizationIdentificationResponse() - * .retrievalReferenceNumber() - * .traceNumber() - * .transactionId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): NetworkIdentifiers = - NetworkIdentifiers( - checkRequired( - "authorizationIdentificationResponse", - authorizationIdentificationResponse, - ), - checkRequired("retrievalReferenceNumber", retrievalReferenceNumber), - checkRequired("traceNumber", traceNumber), - checkRequired("transactionId", transactionId), - additionalProperties.toMutableMap(), - ) - } + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + @JvmField + val VISA_AUTHORIZATION_CANADA_POINT_OF_SALE = + of("visa_authorization_canada_point_of_sale") - private var validated: Boolean = false + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + @JvmField + val VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE = + of("visa_authorization_reversal_point_of_sale") - fun validate(): NetworkIdentifiers = apply { - if (validated) { - return@apply - } + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + @JvmField + val VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_reversal_international_point_of_sale") - authorizationIdentificationResponse() - retrievalReferenceNumber() - traceNumber() - transactionId() - validated = true - } + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + @JvmField + val VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE = + of("visa_authorization_address_verification_service") - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + @JvmField + val VISA_ADVANCED_AUTHORIZATION = of("visa_advanced_authorization") - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (authorizationIdentificationResponse.asKnown().isPresent) 1 else 0) + - (if (retrievalReferenceNumber.asKnown().isPresent) 1 else 0) + - (if (traceNumber.asKnown().isPresent) 1 else 0) + - (if (transactionId.asKnown().isPresent) 1 else 0) + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + @JvmField val VISA_MESSAGE_TRANSMISSION = of("visa_message_transmission") - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_DOMESTIC = + of("visa_account_verification_domestic") - return other is NetworkIdentifiers && - authorizationIdentificationResponse == - other.authorizationIdentificationResponse && - retrievalReferenceNumber == other.retrievalReferenceNumber && - traceNumber == other.traceNumber && - transactionId == other.transactionId && - additionalProperties == other.additionalProperties - } + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_INTERNATIONAL = + of("visa_account_verification_international") - private val hashCode: Int by lazy { - Objects.hash( - authorizationIdentificationResponse, - retrievalReferenceNumber, - traceNumber, - transactionId, - additionalProperties, - ) - } + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_CANADA = + of("visa_account_verification_canada") - override fun hashCode(): Int = hashCode + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + @JvmField + val VISA_CORPORATE_ACCEPTANCE_FEE = of("visa_corporate_acceptance_fee") - override fun toString() = - "NetworkIdentifiers{authorizationIdentificationResponse=$authorizationIdentificationResponse, retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}" - } + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + @JvmField + val VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE = + of("visa_consumer_debit_acceptance_fee") - /** - * The processing category describes the intent behind the financial, such as whether it - * was used for bill payments or an automatic fuel dispenser. - */ - class ProcessingCategory - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + @JvmField + val VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE = + of("visa_business_debit_acceptance_fee") - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + @JvmField + val VISA_PURCHASING_ACCEPTANCE_FEE = of("visa_purchasing_acceptance_fee") - companion object { + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + @JvmField val VISA_PURCHASE_DOMESTIC = of("visa_purchase_domestic") - /** - * Account funding transactions are transactions used to e.g., fund an account - * or transfer funds between accounts. - */ - @JvmField val ACCOUNT_FUNDING = of("account_funding") + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + @JvmField + val VISA_PURCHASE_INTERNATIONAL = of("visa_purchase_international") - /** - * Automatic fuel dispenser authorizations occur when a card is used at a gas - * pump, prior to the actual transaction amount being known. They are followed - * by an advice message that updates the amount of the pending transaction. - */ - @JvmField val AUTOMATIC_FUEL_DISPENSER = of("automatic_fuel_dispenser") + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_CREDIT_PURCHASE_TOKEN = of("visa_credit_purchase_token") - /** A transaction used to pay a bill. */ - @JvmField val BILL_PAYMENT = of("bill_payment") + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_DEBIT_PURCHASE_TOKEN = of("visa_debit_purchase_token") - /** Original credit transactions are used to send money to a cardholder. */ - @JvmField val ORIGINAL_CREDIT = of("original_credit") + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + @JvmField val VISA_CLEARING_TRANSMISSION = of("visa_clearing_transmission") - /** A regular purchase. */ - @JvmField val PURCHASE = of("purchase") + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + @JvmField val VISA_DIRECT_AUTHORIZATION = of("visa_direct_authorization") - /** - * Quasi-cash transactions represent purchases of items which may be convertible - * to cash. - */ - @JvmField val QUASI_CASH = of("quasi_cash") + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + @JvmField + val VISA_DIRECT_TRANSACTION_DOMESTIC = + of("visa_direct_transaction_domestic") - /** - * A refund card authorization, sometimes referred to as a credit voucher - * authorization, where funds are credited to the cardholder. - */ - @JvmField val REFUND = of("refund") + /** Issuer card service fee for Commercial Credit cards. */ + @JvmField + val VISA_SERVICE_COMMERCIAL_CREDIT = of("visa_service_commercial_credit") - /** - * Cash disbursement transactions are used to withdraw cash from an ATM or a - * point of sale. - */ - @JvmField val CASH_DISBURSEMENT = of("cash_disbursement") + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + @JvmField + val VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT = + of("visa_advertising_service_commercial_credit") - /** - * A balance inquiry transaction is used to check the balance of an account - * associated with a card. - */ - @JvmField val BALANCE_INQUIRY = of("balance_inquiry") + /** Issuer Community Growth Acceleration Program Fee. */ + @JvmField + val VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM = + of("visa_community_growth_acceleration_program") - /** The processing category is unknown. */ - @JvmField val UNKNOWN = of("unknown") + /** Issuer Processing Guarantee for Commercial Credit cards. */ + @JvmField + val VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT = + of("visa_processing_guarantee_commercial_credit") - @JvmStatic fun of(value: String) = ProcessingCategory(JsonField.of(value)) - } + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + @JvmField val PULSE_SWITCH_FEE = of("pulse_switch_fee") - /** An enum containing [ProcessingCategory]'s known values. */ - enum class Known { - /** - * Account funding transactions are transactions used to e.g., fund an account - * or transfer funds between accounts. - */ - ACCOUNT_FUNDING, - /** - * Automatic fuel dispenser authorizations occur when a card is used at a gas - * pump, prior to the actual transaction amount being known. They are followed - * by an advice message that updates the amount of the pending transaction. - */ - AUTOMATIC_FUEL_DISPENSER, - /** A transaction used to pay a bill. */ - BILL_PAYMENT, - /** Original credit transactions are used to send money to a cardholder. */ - ORIGINAL_CREDIT, - /** A regular purchase. */ - PURCHASE, - /** - * Quasi-cash transactions represent purchases of items which may be convertible - * to cash. - */ - QUASI_CASH, - /** - * A refund card authorization, sometimes referred to as a credit voucher - * authorization, where funds are credited to the cardholder. - */ - REFUND, - /** - * Cash disbursement transactions are used to withdraw cash from an ATM or a - * point of sale. - */ - CASH_DISBURSEMENT, - /** - * A balance inquiry transaction is used to check the balance of an account - * associated with a card. - */ - BALANCE_INQUIRY, - /** The processing category is unknown. */ - UNKNOWN, - } + @JvmStatic fun of(value: String) = FeeType(JsonField.of(value)) + } + + /** An enum containing [FeeType]'s known values. */ + enum class Known { + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + VISA_ADVANCED_AUTHORIZATION, + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + VISA_MESSAGE_TRANSMISSION, + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_DOMESTIC, + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, + } - /** - * An enum containing [ProcessingCategory]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ProcessingCategory] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** - * Account funding transactions are transactions used to e.g., fund an account - * or transfer funds between accounts. - */ - ACCOUNT_FUNDING, - /** - * Automatic fuel dispenser authorizations occur when a card is used at a gas - * pump, prior to the actual transaction amount being known. They are followed - * by an advice message that updates the amount of the pending transaction. - */ - AUTOMATIC_FUEL_DISPENSER, - /** A transaction used to pay a bill. */ - BILL_PAYMENT, - /** Original credit transactions are used to send money to a cardholder. */ - ORIGINAL_CREDIT, - /** A regular purchase. */ - PURCHASE, - /** - * Quasi-cash transactions represent purchases of items which may be convertible - * to cash. - */ - QUASI_CASH, /** - * A refund card authorization, sometimes referred to as a credit voucher - * authorization, where funds are credited to the cardholder. + * An enum containing [FeeType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [FeeType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. */ - REFUND, + enum class Value { + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + VISA_ADVANCED_AUTHORIZATION, + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + VISA_MESSAGE_TRANSMISSION, + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_DOMESTIC, + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, + /** + * An enum member indicating that [FeeType] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + /** - * Cash disbursement transactions are used to withdraw cash from an ATM or a - * point of sale. + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. */ - CASH_DISBURSEMENT, + fun value(): Value = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Value.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Value.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Value.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Value.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Value.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Value.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Value.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Value.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Value.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Value.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Value.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Value.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Value.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Value.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Value.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Value.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Value.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Value.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Value.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Value.PULSE_SWITCH_FEE + else -> Value._UNKNOWN + } + /** - * A balance inquiry transaction is used to check the balance of an account - * associated with a card. + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. */ - BALANCE_INQUIRY, - /** The processing category is unknown. */ - UNKNOWN, + fun known(): Known = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Known.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Known.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Known.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Known.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Known.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Known.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Known.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Known.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Known.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Known.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Known.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Known.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Known.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Known.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Known.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Known.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Known.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Known.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Known.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Known.PULSE_SWITCH_FEE + else -> throw IncreaseInvalidDataException("Unknown FeeType: $value") + } + /** - * An enum member indicating that [ProcessingCategory] was instantiated with an - * unknown value. + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. */ - _UNKNOWN, - } + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ACCOUNT_FUNDING -> Value.ACCOUNT_FUNDING - AUTOMATIC_FUEL_DISPENSER -> Value.AUTOMATIC_FUEL_DISPENSER - BILL_PAYMENT -> Value.BILL_PAYMENT - ORIGINAL_CREDIT -> Value.ORIGINAL_CREDIT - PURCHASE -> Value.PURCHASE - QUASI_CASH -> Value.QUASI_CASH - REFUND -> Value.REFUND - CASH_DISBURSEMENT -> Value.CASH_DISBURSEMENT - BALANCE_INQUIRY -> Value.BALANCE_INQUIRY - UNKNOWN -> Value.UNKNOWN - else -> Value._UNKNOWN - } + private var validated: Boolean = false - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - ACCOUNT_FUNDING -> Known.ACCOUNT_FUNDING - AUTOMATIC_FUEL_DISPENSER -> Known.AUTOMATIC_FUEL_DISPENSER - BILL_PAYMENT -> Known.BILL_PAYMENT - ORIGINAL_CREDIT -> Known.ORIGINAL_CREDIT - PURCHASE -> Known.PURCHASE - QUASI_CASH -> Known.QUASI_CASH - REFUND -> Known.REFUND - CASH_DISBURSEMENT -> Known.CASH_DISBURSEMENT - BALANCE_INQUIRY -> Known.BALANCE_INQUIRY - UNKNOWN -> Known.UNKNOWN - else -> - throw IncreaseInvalidDataException("Unknown ProcessingCategory: $value") - } + fun validate(): FeeType = apply { + if (validated) { + return@apply + } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") + known() + validated = true } - private var validated: Boolean = false + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - fun validate(): ProcessingCategory = apply { - if (validated) { - return@apply - } + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - known() - validated = true - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false + return other is FeeType && value == other.value } - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is ProcessingCategory && value == other.value + return other is SchemeFee && + amount == other.amount && + createdAt == other.createdAt && + currency == other.currency && + feeType == other.feeType && + fixedComponent == other.fixedComponent && + variableRate == other.variableRate && + additionalProperties == other.additionalProperties } - override fun hashCode() = value.hashCode() + private val hashCode: Int by lazy { + Objects.hash( + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, + additionalProperties, + ) + } - override fun toString() = value.toString() + override fun hashCode(): Int = hashCode + + override fun toString() = + "SchemeFee{amount=$amount, createdAt=$createdAt, currency=$currency, feeType=$feeType, fixedComponent=$fixedComponent, variableRate=$variableRate, additionalProperties=$additionalProperties}" } /** @@ -44473,86 +49912,479 @@ private constructor( additionalProperties.remove(key) } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Verification]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .cardVerificationCode() + * .cardholderAddress() + * .cardholderName() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Verification = + Verification( + checkRequired("cardVerificationCode", cardVerificationCode), + checkRequired("cardholderAddress", cardholderAddress), + checkRequired("cardholderName", cardholderName), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Verification = apply { + if (validated) { + return@apply + } + + cardVerificationCode().validate() + cardholderAddress().validate() + cardholderName().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (cardVerificationCode.asKnown().getOrNull()?.validity() ?: 0) + + (cardholderAddress.asKnown().getOrNull()?.validity() ?: 0) + + (cardholderName.asKnown().getOrNull()?.validity() ?: 0) + + /** + * Fields related to verification of the Card Verification Code, a 3-digit code on + * the back of the card. + */ + class CardVerificationCode + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val result: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("result") + @ExcludeMissing + result: JsonField = JsonMissing.of() + ) : this(result, mutableMapOf()) + + /** + * The result of verifying the Card Verification Code. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun result(): Result = result.getRequired("result") + + /** + * Returns the raw JSON value of [result]. + * + * Unlike [result], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("result") + @ExcludeMissing + fun _result(): JsonField = result + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [CardVerificationCode]. + * + * The following fields are required: + * ```java + * .result() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [CardVerificationCode]. */ + class Builder internal constructor() { + + private var result: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(cardVerificationCode: CardVerificationCode) = apply { + result = cardVerificationCode.result + additionalProperties = + cardVerificationCode.additionalProperties.toMutableMap() + } + + /** The result of verifying the Card Verification Code. */ + fun result(result: Result) = result(JsonField.of(result)) + + /** + * Sets [Builder.result] to an arbitrary JSON value. + * + * You should usually call [Builder.result] with a well-typed [Result] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun result(result: JsonField) = apply { this.result = result } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [CardVerificationCode]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .result() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CardVerificationCode = + CardVerificationCode( + checkRequired("result", result), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): CardVerificationCode = apply { + if (validated) { + return@apply + } + + result().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = (result.asKnown().getOrNull()?.validity() ?: 0) + + /** The result of verifying the Card Verification Code. */ + class Result + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** + * No card verification code was provided in the authorization request. + */ + @JvmField val NOT_CHECKED = of("not_checked") + + /** The card verification code matched the one on file. */ + @JvmField val MATCH = of("match") + + /** The card verification code did not match the one on file. */ + @JvmField val NO_MATCH = of("no_match") + + @JvmStatic fun of(value: String) = Result(JsonField.of(value)) + } + + /** An enum containing [Result]'s known values. */ + enum class Known { + /** + * No card verification code was provided in the authorization request. + */ + NOT_CHECKED, + /** The card verification code matched the one on file. */ + MATCH, + /** The card verification code did not match the one on file. */ + NO_MATCH, + } + + /** + * An enum containing [Result]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Result] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** + * No card verification code was provided in the authorization request. + */ + NOT_CHECKED, + /** The card verification code matched the one on file. */ + MATCH, + /** The card verification code did not match the one on file. */ + NO_MATCH, + /** + * An enum member indicating that [Result] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NOT_CHECKED -> Value.NOT_CHECKED + MATCH -> Value.MATCH + NO_MATCH -> Value.NO_MATCH + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + NOT_CHECKED -> Known.NOT_CHECKED + MATCH -> Known.MATCH + NO_MATCH -> Known.NO_MATCH + else -> throw IncreaseInvalidDataException("Unknown Result: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Result = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Result && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } - /** - * Returns an immutable instance of [Verification]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .cardVerificationCode() - * .cardholderAddress() - * .cardholderName() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Verification = - Verification( - checkRequired("cardVerificationCode", cardVerificationCode), - checkRequired("cardholderAddress", cardholderAddress), - checkRequired("cardholderName", cardholderName), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun validate(): Verification = apply { - if (validated) { - return@apply + return other is CardVerificationCode && + result == other.result && + additionalProperties == other.additionalProperties } - cardVerificationCode().validate() - cardholderAddress().validate() - cardholderName().ifPresent { it.validate() } - validated = true - } + private val hashCode: Int by lazy { Objects.hash(result, additionalProperties) } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + override fun hashCode(): Int = hashCode - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (cardVerificationCode.asKnown().getOrNull()?.validity() ?: 0) + - (cardholderAddress.asKnown().getOrNull()?.validity() ?: 0) + - (cardholderName.asKnown().getOrNull()?.validity() ?: 0) + override fun toString() = + "CardVerificationCode{result=$result, additionalProperties=$additionalProperties}" + } /** - * Fields related to verification of the Card Verification Code, a 3-digit code on - * the back of the card. + * Cardholder address provided in the authorization request and the address on file + * we verified it against. */ - class CardVerificationCode + class CardholderAddress @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( + private val actualLine1: JsonField, + private val actualPostalCode: JsonField, + private val providedLine1: JsonField, + private val providedPostalCode: JsonField, private val result: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( + @JsonProperty("actual_line1") + @ExcludeMissing + actualLine1: JsonField = JsonMissing.of(), + @JsonProperty("actual_postal_code") + @ExcludeMissing + actualPostalCode: JsonField = JsonMissing.of(), + @JsonProperty("provided_line1") + @ExcludeMissing + providedLine1: JsonField = JsonMissing.of(), + @JsonProperty("provided_postal_code") + @ExcludeMissing + providedPostalCode: JsonField = JsonMissing.of(), @JsonProperty("result") @ExcludeMissing - result: JsonField = JsonMissing.of() - ) : this(result, mutableMapOf()) + result: JsonField = JsonMissing.of(), + ) : this( + actualLine1, + actualPostalCode, + providedLine1, + providedPostalCode, + result, + mutableMapOf(), + ) /** - * The result of verifying the Card Verification Code. + * Line 1 of the address on file for the cardholder. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun actualLine1(): Optional = actualLine1.getOptional("actual_line1") + + /** + * The postal code of the address on file for the cardholder. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun actualPostalCode(): Optional = + actualPostalCode.getOptional("actual_postal_code") + + /** + * The cardholder address line 1 provided for verification in the authorization + * request. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun providedLine1(): Optional = + providedLine1.getOptional("provided_line1") + + /** + * The postal code provided for verification in the authorization request. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun providedPostalCode(): Optional = + providedPostalCode.getOptional("provided_postal_code") + + /** + * The address verification result returned to the card network. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * or is unexpectedly missing or null (e.g. if the server responded with an @@ -44560,6 +50392,46 @@ private constructor( */ fun result(): Result = result.getRequired("result") + /** + * Returns the raw JSON value of [actualLine1]. + * + * Unlike [actualLine1], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("actual_line1") + @ExcludeMissing + fun _actualLine1(): JsonField = actualLine1 + + /** + * Returns the raw JSON value of [actualPostalCode]. + * + * Unlike [actualPostalCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("actual_postal_code") + @ExcludeMissing + fun _actualPostalCode(): JsonField = actualPostalCode + + /** + * Returns the raw JSON value of [providedLine1]. + * + * Unlike [providedLine1], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("provided_line1") + @ExcludeMissing + fun _providedLine1(): JsonField = providedLine1 + + /** + * Returns the raw JSON value of [providedPostalCode]. + * + * Unlike [providedPostalCode], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("provided_postal_code") + @ExcludeMissing + fun _providedPostalCode(): JsonField = providedPostalCode + /** * Returns the raw JSON value of [result]. * @@ -44586,31 +50458,135 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [CardVerificationCode]. + * [CardholderAddress]. * * The following fields are required: * ```java + * .actualLine1() + * .actualPostalCode() + * .providedLine1() + * .providedPostalCode() * .result() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [CardVerificationCode]. */ + /** A builder for [CardholderAddress]. */ class Builder internal constructor() { + private var actualLine1: JsonField? = null + private var actualPostalCode: JsonField? = null + private var providedLine1: JsonField? = null + private var providedPostalCode: JsonField? = null private var result: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(cardVerificationCode: CardVerificationCode) = apply { - result = cardVerificationCode.result + internal fun from(cardholderAddress: CardholderAddress) = apply { + actualLine1 = cardholderAddress.actualLine1 + actualPostalCode = cardholderAddress.actualPostalCode + providedLine1 = cardholderAddress.providedLine1 + providedPostalCode = cardholderAddress.providedPostalCode + result = cardholderAddress.result additionalProperties = - cardVerificationCode.additionalProperties.toMutableMap() + cardholderAddress.additionalProperties.toMutableMap() } - /** The result of verifying the Card Verification Code. */ + /** Line 1 of the address on file for the cardholder. */ + fun actualLine1(actualLine1: String?) = + actualLine1(JsonField.ofNullable(actualLine1)) + + /** + * Alias for calling [Builder.actualLine1] with `actualLine1.orElse(null)`. + */ + fun actualLine1(actualLine1: Optional) = + actualLine1(actualLine1.getOrNull()) + + /** + * Sets [Builder.actualLine1] to an arbitrary JSON value. + * + * You should usually call [Builder.actualLine1] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun actualLine1(actualLine1: JsonField) = apply { + this.actualLine1 = actualLine1 + } + + /** The postal code of the address on file for the cardholder. */ + fun actualPostalCode(actualPostalCode: String?) = + actualPostalCode(JsonField.ofNullable(actualPostalCode)) + + /** + * Alias for calling [Builder.actualPostalCode] with + * `actualPostalCode.orElse(null)`. + */ + fun actualPostalCode(actualPostalCode: Optional) = + actualPostalCode(actualPostalCode.getOrNull()) + + /** + * Sets [Builder.actualPostalCode] to an arbitrary JSON value. + * + * You should usually call [Builder.actualPostalCode] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun actualPostalCode(actualPostalCode: JsonField) = apply { + this.actualPostalCode = actualPostalCode + } + + /** + * The cardholder address line 1 provided for verification in the + * authorization request. + */ + fun providedLine1(providedLine1: String?) = + providedLine1(JsonField.ofNullable(providedLine1)) + + /** + * Alias for calling [Builder.providedLine1] with + * `providedLine1.orElse(null)`. + */ + fun providedLine1(providedLine1: Optional) = + providedLine1(providedLine1.getOrNull()) + + /** + * Sets [Builder.providedLine1] to an arbitrary JSON value. + * + * You should usually call [Builder.providedLine1] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun providedLine1(providedLine1: JsonField) = apply { + this.providedLine1 = providedLine1 + } + + /** + * The postal code provided for verification in the authorization request. + */ + fun providedPostalCode(providedPostalCode: String?) = + providedPostalCode(JsonField.ofNullable(providedPostalCode)) + + /** + * Alias for calling [Builder.providedPostalCode] with + * `providedPostalCode.orElse(null)`. + */ + fun providedPostalCode(providedPostalCode: Optional) = + providedPostalCode(providedPostalCode.getOrNull()) + + /** + * Sets [Builder.providedPostalCode] to an arbitrary JSON value. + * + * You should usually call [Builder.providedPostalCode] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun providedPostalCode(providedPostalCode: JsonField) = apply { + this.providedPostalCode = providedPostalCode + } + + /** The address verification result returned to the card network. */ fun result(result: Result) = result(JsonField.of(result)) /** @@ -44645,19 +50621,27 @@ private constructor( } /** - * Returns an immutable instance of [CardVerificationCode]. + * Returns an immutable instance of [CardholderAddress]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java + * .actualLine1() + * .actualPostalCode() + * .providedLine1() + * .providedPostalCode() * .result() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): CardVerificationCode = - CardVerificationCode( + fun build(): CardholderAddress = + CardholderAddress( + checkRequired("actualLine1", actualLine1), + checkRequired("actualPostalCode", actualPostalCode), + checkRequired("providedLine1", providedLine1), + checkRequired("providedPostalCode", providedPostalCode), checkRequired("result", result), additionalProperties.toMutableMap(), ) @@ -44665,11 +50649,15 @@ private constructor( private var validated: Boolean = false - fun validate(): CardVerificationCode = apply { + fun validate(): CardholderAddress = apply { if (validated) { return@apply } + actualLine1() + actualPostalCode() + providedLine1() + providedPostalCode() result().validate() validated = true } @@ -44689,9 +50677,14 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = (result.asKnown().getOrNull()?.validity() ?: 0) + internal fun validity(): Int = + (if (actualLine1.asKnown().isPresent) 1 else 0) + + (if (actualPostalCode.asKnown().isPresent) 1 else 0) + + (if (providedLine1.asKnown().isPresent) 1 else 0) + + (if (providedPostalCode.asKnown().isPresent) 1 else 0) + + (result.asKnown().getOrNull()?.validity() ?: 0) - /** The result of verifying the Card Verification Code. */ + /** The address verification result returned to the card network. */ class Result @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -44709,30 +50702,65 @@ private constructor( companion object { + /** No address information was provided in the authorization request. */ + @JvmField val NOT_CHECKED = of("not_checked") + /** - * No card verification code was provided in the authorization request. + * Postal code matches, but the street address does not match or was not + * provided. */ - @JvmField val NOT_CHECKED = of("not_checked") + @JvmField + val POSTAL_CODE_MATCH_ADDRESS_NO_MATCH = + of("postal_code_match_address_no_match") - /** The card verification code matched the one on file. */ + /** + * Postal code does not match, but the street address matches or was not + * provided. + */ + @JvmField + val POSTAL_CODE_NO_MATCH_ADDRESS_MATCH = + of("postal_code_no_match_address_match") + + /** Postal code and street address match. */ @JvmField val MATCH = of("match") - /** The card verification code did not match the one on file. */ + /** Postal code and street address do not match. */ @JvmField val NO_MATCH = of("no_match") + /** + * Postal code matches, but the street address was not verified. + * (deprecated) + */ + @JvmField + val POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED = + of("postal_code_match_address_not_checked") + @JvmStatic fun of(value: String) = Result(JsonField.of(value)) } /** An enum containing [Result]'s known values. */ enum class Known { + /** No address information was provided in the authorization request. */ + NOT_CHECKED, /** - * No card verification code was provided in the authorization request. + * Postal code matches, but the street address does not match or was not + * provided. */ - NOT_CHECKED, - /** The card verification code matched the one on file. */ + POSTAL_CODE_MATCH_ADDRESS_NO_MATCH, + /** + * Postal code does not match, but the street address matches or was not + * provided. + */ + POSTAL_CODE_NO_MATCH_ADDRESS_MATCH, + /** Postal code and street address match. */ MATCH, - /** The card verification code did not match the one on file. */ + /** Postal code and street address do not match. */ NO_MATCH, + /** + * Postal code matches, but the street address was not verified. + * (deprecated) + */ + POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED, } /** @@ -44747,14 +50775,27 @@ private constructor( * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { + /** No address information was provided in the authorization request. */ + NOT_CHECKED, /** - * No card verification code was provided in the authorization request. + * Postal code matches, but the street address does not match or was not + * provided. */ - NOT_CHECKED, - /** The card verification code matched the one on file. */ + POSTAL_CODE_MATCH_ADDRESS_NO_MATCH, + /** + * Postal code does not match, but the street address matches or was not + * provided. + */ + POSTAL_CODE_NO_MATCH_ADDRESS_MATCH, + /** Postal code and street address match. */ MATCH, - /** The card verification code did not match the one on file. */ + /** Postal code and street address do not match. */ NO_MATCH, + /** + * Postal code matches, but the street address was not verified. + * (deprecated) + */ + POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED, /** * An enum member indicating that [Result] was instantiated with an * unknown value. @@ -44772,8 +50813,14 @@ private constructor( fun value(): Value = when (this) { NOT_CHECKED -> Value.NOT_CHECKED + POSTAL_CODE_MATCH_ADDRESS_NO_MATCH -> + Value.POSTAL_CODE_MATCH_ADDRESS_NO_MATCH + POSTAL_CODE_NO_MATCH_ADDRESS_MATCH -> + Value.POSTAL_CODE_NO_MATCH_ADDRESS_MATCH MATCH -> Value.MATCH NO_MATCH -> Value.NO_MATCH + POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED -> + Value.POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED else -> Value._UNKNOWN } @@ -44789,8 +50836,14 @@ private constructor( fun known(): Known = when (this) { NOT_CHECKED -> Known.NOT_CHECKED + POSTAL_CODE_MATCH_ADDRESS_NO_MATCH -> + Known.POSTAL_CODE_MATCH_ADDRESS_NO_MATCH + POSTAL_CODE_NO_MATCH_ADDRESS_MATCH -> + Known.POSTAL_CODE_NO_MATCH_ADDRESS_MATCH MATCH -> Known.MATCH NO_MATCH -> Known.NO_MATCH + POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED -> + Known.POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED else -> throw IncreaseInvalidDataException("Unknown Result: $value") } @@ -44854,154 +50907,116 @@ private constructor( return true } - return other is CardVerificationCode && + return other is CardholderAddress && + actualLine1 == other.actualLine1 && + actualPostalCode == other.actualPostalCode && + providedLine1 == other.providedLine1 && + providedPostalCode == other.providedPostalCode && result == other.result && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(result, additionalProperties) } + private val hashCode: Int by lazy { + Objects.hash( + actualLine1, + actualPostalCode, + providedLine1, + providedPostalCode, + result, + additionalProperties, + ) + } override fun hashCode(): Int = hashCode override fun toString() = - "CardVerificationCode{result=$result, additionalProperties=$additionalProperties}" + "CardholderAddress{actualLine1=$actualLine1, actualPostalCode=$actualPostalCode, providedLine1=$providedLine1, providedPostalCode=$providedPostalCode, result=$result, additionalProperties=$additionalProperties}" } - /** - * Cardholder address provided in the authorization request and the address on file - * we verified it against. - */ - class CardholderAddress + /** Cardholder name provided in the authorization request. */ + class CardholderName @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val actualLine1: JsonField, - private val actualPostalCode: JsonField, - private val providedLine1: JsonField, - private val providedPostalCode: JsonField, - private val result: JsonField, + private val providedFirstName: JsonField, + private val providedLastName: JsonField, + private val providedMiddleName: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("actual_line1") - @ExcludeMissing - actualLine1: JsonField = JsonMissing.of(), - @JsonProperty("actual_postal_code") - @ExcludeMissing - actualPostalCode: JsonField = JsonMissing.of(), - @JsonProperty("provided_line1") + @JsonProperty("provided_first_name") @ExcludeMissing - providedLine1: JsonField = JsonMissing.of(), - @JsonProperty("provided_postal_code") + providedFirstName: JsonField = JsonMissing.of(), + @JsonProperty("provided_last_name") @ExcludeMissing - providedPostalCode: JsonField = JsonMissing.of(), - @JsonProperty("result") + providedLastName: JsonField = JsonMissing.of(), + @JsonProperty("provided_middle_name") @ExcludeMissing - result: JsonField = JsonMissing.of(), + providedMiddleName: JsonField = JsonMissing.of(), ) : this( - actualLine1, - actualPostalCode, - providedLine1, - providedPostalCode, - result, + providedFirstName, + providedLastName, + providedMiddleName, mutableMapOf(), ) /** - * Line 1 of the address on file for the cardholder. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun actualLine1(): Optional = actualLine1.getOptional("actual_line1") - - /** - * The postal code of the address on file for the cardholder. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun actualPostalCode(): Optional = - actualPostalCode.getOptional("actual_postal_code") - - /** - * The cardholder address line 1 provided for verification in the authorization - * request. + * The first name provided for verification in the authorization request. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun providedLine1(): Optional = - providedLine1.getOptional("provided_line1") + fun providedFirstName(): Optional = + providedFirstName.getOptional("provided_first_name") /** - * The postal code provided for verification in the authorization request. + * The last name provided for verification in the authorization request. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun providedPostalCode(): Optional = - providedPostalCode.getOptional("provided_postal_code") - - /** - * The address verification result returned to the card network. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). - */ - fun result(): Result = result.getRequired("result") - - /** - * Returns the raw JSON value of [actualLine1]. - * - * Unlike [actualLine1], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("actual_line1") - @ExcludeMissing - fun _actualLine1(): JsonField = actualLine1 + fun providedLastName(): Optional = + providedLastName.getOptional("provided_last_name") /** - * Returns the raw JSON value of [actualPostalCode]. + * The middle name provided for verification in the authorization request. * - * Unlike [actualPostalCode], this method doesn't throw if the JSON field has an - * unexpected type. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ - @JsonProperty("actual_postal_code") - @ExcludeMissing - fun _actualPostalCode(): JsonField = actualPostalCode + fun providedMiddleName(): Optional = + providedMiddleName.getOptional("provided_middle_name") /** - * Returns the raw JSON value of [providedLine1]. + * Returns the raw JSON value of [providedFirstName]. * - * Unlike [providedLine1], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [providedFirstName], this method doesn't throw if the JSON field has + * an unexpected type. */ - @JsonProperty("provided_line1") + @JsonProperty("provided_first_name") @ExcludeMissing - fun _providedLine1(): JsonField = providedLine1 + fun _providedFirstName(): JsonField = providedFirstName /** - * Returns the raw JSON value of [providedPostalCode]. + * Returns the raw JSON value of [providedLastName]. * - * Unlike [providedPostalCode], this method doesn't throw if the JSON field has - * an unexpected type. + * Unlike [providedLastName], this method doesn't throw if the JSON field has an + * unexpected type. */ - @JsonProperty("provided_postal_code") + @JsonProperty("provided_last_name") @ExcludeMissing - fun _providedPostalCode(): JsonField = providedPostalCode + fun _providedLastName(): JsonField = providedLastName /** - * Returns the raw JSON value of [result]. + * Returns the raw JSON value of [providedMiddleName]. * - * Unlike [result], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [providedMiddleName], this method doesn't throw if the JSON field has + * an unexpected type. */ - @JsonProperty("result") + @JsonProperty("provided_middle_name") @ExcludeMissing - fun _result(): JsonField = result + fun _providedMiddleName(): JsonField = providedMiddleName @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -45019,1614 +51034,1896 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [CardholderAddress]. + * [CardholderName]. * * The following fields are required: * ```java - * .actualLine1() - * .actualPostalCode() - * .providedLine1() - * .providedPostalCode() - * .result() + * .providedFirstName() + * .providedLastName() + * .providedMiddleName() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [CardholderAddress]. */ + /** A builder for [CardholderName]. */ class Builder internal constructor() { - private var actualLine1: JsonField? = null - private var actualPostalCode: JsonField? = null - private var providedLine1: JsonField? = null - private var providedPostalCode: JsonField? = null - private var result: JsonField? = null + private var providedFirstName: JsonField? = null + private var providedLastName: JsonField? = null + private var providedMiddleName: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(cardholderAddress: CardholderAddress) = apply { - actualLine1 = cardholderAddress.actualLine1 - actualPostalCode = cardholderAddress.actualPostalCode - providedLine1 = cardholderAddress.providedLine1 - providedPostalCode = cardholderAddress.providedPostalCode - result = cardholderAddress.result + internal fun from(cardholderName: CardholderName) = apply { + providedFirstName = cardholderName.providedFirstName + providedLastName = cardholderName.providedLastName + providedMiddleName = cardholderName.providedMiddleName additionalProperties = - cardholderAddress.additionalProperties.toMutableMap() + cardholderName.additionalProperties.toMutableMap() } - /** Line 1 of the address on file for the cardholder. */ - fun actualLine1(actualLine1: String?) = - actualLine1(JsonField.ofNullable(actualLine1)) + /** + * The first name provided for verification in the authorization request. + */ + fun providedFirstName(providedFirstName: String?) = + providedFirstName(JsonField.ofNullable(providedFirstName)) /** - * Alias for calling [Builder.actualLine1] with `actualLine1.orElse(null)`. + * Alias for calling [Builder.providedFirstName] with + * `providedFirstName.orElse(null)`. */ - fun actualLine1(actualLine1: Optional) = - actualLine1(actualLine1.getOrNull()) + fun providedFirstName(providedFirstName: Optional) = + providedFirstName(providedFirstName.getOrNull()) /** - * Sets [Builder.actualLine1] to an arbitrary JSON value. + * Sets [Builder.providedFirstName] to an arbitrary JSON value. * - * You should usually call [Builder.actualLine1] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * You should usually call [Builder.providedFirstName] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. */ - fun actualLine1(actualLine1: JsonField) = apply { - this.actualLine1 = actualLine1 + fun providedFirstName(providedFirstName: JsonField) = apply { + this.providedFirstName = providedFirstName } - /** The postal code of the address on file for the cardholder. */ - fun actualPostalCode(actualPostalCode: String?) = - actualPostalCode(JsonField.ofNullable(actualPostalCode)) + /** The last name provided for verification in the authorization request. */ + fun providedLastName(providedLastName: String?) = + providedLastName(JsonField.ofNullable(providedLastName)) /** - * Alias for calling [Builder.actualPostalCode] with - * `actualPostalCode.orElse(null)`. + * Alias for calling [Builder.providedLastName] with + * `providedLastName.orElse(null)`. */ - fun actualPostalCode(actualPostalCode: Optional) = - actualPostalCode(actualPostalCode.getOrNull()) + fun providedLastName(providedLastName: Optional) = + providedLastName(providedLastName.getOrNull()) /** - * Sets [Builder.actualPostalCode] to an arbitrary JSON value. + * Sets [Builder.providedLastName] to an arbitrary JSON value. * - * You should usually call [Builder.actualPostalCode] with a well-typed + * You should usually call [Builder.providedLastName] with a well-typed * [String] value instead. This method is primarily for setting the field to * an undocumented or not yet supported value. */ - fun actualPostalCode(actualPostalCode: JsonField) = apply { - this.actualPostalCode = actualPostalCode + fun providedLastName(providedLastName: JsonField) = apply { + this.providedLastName = providedLastName } /** - * The cardholder address line 1 provided for verification in the - * authorization request. + * The middle name provided for verification in the authorization request. */ - fun providedLine1(providedLine1: String?) = - providedLine1(JsonField.ofNullable(providedLine1)) + fun providedMiddleName(providedMiddleName: String?) = + providedMiddleName(JsonField.ofNullable(providedMiddleName)) /** - * Alias for calling [Builder.providedLine1] with - * `providedLine1.orElse(null)`. + * Alias for calling [Builder.providedMiddleName] with + * `providedMiddleName.orElse(null)`. */ - fun providedLine1(providedLine1: Optional) = - providedLine1(providedLine1.getOrNull()) + fun providedMiddleName(providedMiddleName: Optional) = + providedMiddleName(providedMiddleName.getOrNull()) /** - * Sets [Builder.providedLine1] to an arbitrary JSON value. + * Sets [Builder.providedMiddleName] to an arbitrary JSON value. * - * You should usually call [Builder.providedLine1] with a well-typed + * You should usually call [Builder.providedMiddleName] with a well-typed * [String] value instead. This method is primarily for setting the field to * an undocumented or not yet supported value. */ - fun providedLine1(providedLine1: JsonField) = apply { - this.providedLine1 = providedLine1 + fun providedMiddleName(providedMiddleName: JsonField) = apply { + this.providedMiddleName = providedMiddleName } - /** - * The postal code provided for verification in the authorization request. - */ - fun providedPostalCode(providedPostalCode: String?) = - providedPostalCode(JsonField.ofNullable(providedPostalCode)) + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * Alias for calling [Builder.providedPostalCode] with - * `providedPostalCode.orElse(null)`. - */ - fun providedPostalCode(providedPostalCode: Optional) = - providedPostalCode(providedPostalCode.getOrNull()) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } /** - * Sets [Builder.providedPostalCode] to an arbitrary JSON value. + * Returns an immutable instance of [CardholderName]. * - * You should usually call [Builder.providedPostalCode] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .providedFirstName() + * .providedLastName() + * .providedMiddleName() + * ``` + * + * @throws IllegalStateException if any required field is unset. */ - fun providedPostalCode(providedPostalCode: JsonField) = apply { - this.providedPostalCode = providedPostalCode + fun build(): CardholderName = + CardholderName( + checkRequired("providedFirstName", providedFirstName), + checkRequired("providedLastName", providedLastName), + checkRequired("providedMiddleName", providedMiddleName), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): CardholderName = apply { + if (validated) { + return@apply + } + + providedFirstName() + providedLastName() + providedMiddleName() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (providedFirstName.asKnown().isPresent) 1 else 0) + + (if (providedLastName.asKnown().isPresent) 1 else 0) + + (if (providedMiddleName.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - /** The address verification result returned to the card network. */ - fun result(result: Result) = result(JsonField.of(result)) + return other is CardholderName && + providedFirstName == other.providedFirstName && + providedLastName == other.providedLastName && + providedMiddleName == other.providedMiddleName && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + providedFirstName, + providedLastName, + providedMiddleName, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "CardholderName{providedFirstName=$providedFirstName, providedLastName=$providedLastName, providedMiddleName=$providedMiddleName, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Verification && + cardVerificationCode == other.cardVerificationCode && + cardholderAddress == other.cardholderAddress && + cardholderName == other.cardholderName && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + cardVerificationCode, + cardholderAddress, + cardholderName, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Verification{cardVerificationCode=$cardVerificationCode, cardholderAddress=$cardholderAddress, cardholderName=$cardholderName, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is CardFinancial && + id == other.id && + actioner == other.actioner && + additionalAmounts == other.additionalAmounts && + amount == other.amount && + cardPaymentId == other.cardPaymentId && + currency == other.currency && + digitalWalletTokenId == other.digitalWalletTokenId && + direction == other.direction && + merchantAcceptorId == other.merchantAcceptorId && + merchantCategoryCode == other.merchantCategoryCode && + merchantCity == other.merchantCity && + merchantCountry == other.merchantCountry && + merchantDescriptor == other.merchantDescriptor && + merchantPostalCode == other.merchantPostalCode && + merchantState == other.merchantState && + networkDetails == other.networkDetails && + networkIdentifiers == other.networkIdentifiers && + networkRiskScore == other.networkRiskScore && + physicalCardId == other.physicalCardId && + presentmentAmount == other.presentmentAmount && + presentmentCurrency == other.presentmentCurrency && + processingCategory == other.processingCategory && + realTimeDecisionId == other.realTimeDecisionId && + schemeFees == other.schemeFees && + terminalId == other.terminalId && + transactionId == other.transactionId && + type == other.type && + verification == other.verification && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + actioner, + additionalAmounts, + amount, + cardPaymentId, + currency, + digitalWalletTokenId, + direction, + merchantAcceptorId, + merchantCategoryCode, + merchantCity, + merchantCountry, + merchantDescriptor, + merchantPostalCode, + merchantState, + networkDetails, + networkIdentifiers, + networkRiskScore, + physicalCardId, + presentmentAmount, + presentmentCurrency, + processingCategory, + realTimeDecisionId, + schemeFees, + terminalId, + transactionId, + type, + verification, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "CardFinancial{id=$id, actioner=$actioner, additionalAmounts=$additionalAmounts, amount=$amount, cardPaymentId=$cardPaymentId, currency=$currency, digitalWalletTokenId=$digitalWalletTokenId, direction=$direction, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkDetails=$networkDetails, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, physicalCardId=$physicalCardId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, processingCategory=$processingCategory, realTimeDecisionId=$realTimeDecisionId, schemeFees=$schemeFees, terminalId=$terminalId, transactionId=$transactionId, type=$type, verification=$verification, additionalProperties=$additionalProperties}" + } + + /** + * A Card Fuel Confirmation object. This field will be present in the JSON response if and + * only if `category` is equal to `card_fuel_confirmation`. Card Fuel Confirmations update + * the amount of a Card Authorization after a fuel pump transaction is completed. + */ + class CardFuelConfirmation + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val cardAuthorizationId: JsonField, + private val currency: JsonField, + private val network: JsonField, + private val networkIdentifiers: JsonField, + private val pendingTransactionId: JsonField, + private val schemeFees: JsonField>, + private val type: JsonField, + private val updatedAuthorizationAmount: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("card_authorization_id") + @ExcludeMissing + cardAuthorizationId: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("network") + @ExcludeMissing + network: JsonField = JsonMissing.of(), + @JsonProperty("network_identifiers") + @ExcludeMissing + networkIdentifiers: JsonField = JsonMissing.of(), + @JsonProperty("pending_transaction_id") + @ExcludeMissing + pendingTransactionId: JsonField = JsonMissing.of(), + @JsonProperty("scheme_fees") + @ExcludeMissing + schemeFees: JsonField> = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("updated_authorization_amount") + @ExcludeMissing + updatedAuthorizationAmount: JsonField = JsonMissing.of(), + ) : this( + id, + cardAuthorizationId, + currency, + network, + networkIdentifiers, + pendingTransactionId, + schemeFees, + type, + updatedAuthorizationAmount, + mutableMapOf(), + ) + + /** + * The Card Fuel Confirmation identifier. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun id(): String = id.getRequired("id") + + /** + * The identifier for the Card Authorization this updates. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun cardAuthorizationId(): String = + cardAuthorizationId.getRequired("card_authorization_id") + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the increment's + * currency. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun currency(): Currency = currency.getRequired("currency") + + /** + * The card network used to process this card authorization. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun network(): Network = network.getRequired("network") + + /** + * Network-specific identifiers for a specific request or transaction. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun networkIdentifiers(): NetworkIdentifiers = + networkIdentifiers.getRequired("network_identifiers") + + /** + * The identifier of the Pending Transaction associated with this Card Fuel + * Confirmation. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun pendingTransactionId(): Optional = + pendingTransactionId.getOptional("pending_transaction_id") + + /** + * The scheme fees associated with this card fuel confirmation. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun schemeFees(): List = schemeFees.getRequired("scheme_fees") + + /** + * A constant representing the object's type. For this resource it will always be + * `card_fuel_confirmation`. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun type(): Type = type.getRequired("type") + + /** + * The updated authorization amount after this fuel confirmation, in the minor unit of + * the transaction's currency. For dollars, for example, this is cents. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun updatedAuthorizationAmount(): Long = + updatedAuthorizationAmount.getRequired("updated_authorization_amount") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [cardAuthorizationId]. + * + * Unlike [cardAuthorizationId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("card_authorization_id") + @ExcludeMissing + fun _cardAuthorizationId(): JsonField = cardAuthorizationId + + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("currency") + @ExcludeMissing + fun _currency(): JsonField = currency - /** - * Sets [Builder.result] to an arbitrary JSON value. - * - * You should usually call [Builder.result] with a well-typed [Result] value - * instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun result(result: JsonField) = apply { this.result = result } + /** + * Returns the raw JSON value of [network]. + * + * Unlike [network], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("network") @ExcludeMissing fun _network(): JsonField = network - fun additionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** + * Returns the raw JSON value of [networkIdentifiers]. + * + * Unlike [networkIdentifiers], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("network_identifiers") + @ExcludeMissing + fun _networkIdentifiers(): JsonField = networkIdentifiers - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** + * Returns the raw JSON value of [pendingTransactionId]. + * + * Unlike [pendingTransactionId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("pending_transaction_id") + @ExcludeMissing + fun _pendingTransactionId(): JsonField = pendingTransactionId - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } + /** + * Returns the raw JSON value of [schemeFees]. + * + * Unlike [schemeFees], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("scheme_fees") + @ExcludeMissing + fun _schemeFees(): JsonField> = schemeFees - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** + * Returns the raw JSON value of [updatedAuthorizationAmount]. + * + * Unlike [updatedAuthorizationAmount], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("updated_authorization_amount") + @ExcludeMissing + fun _updatedAuthorizationAmount(): JsonField = updatedAuthorizationAmount - /** - * Returns an immutable instance of [CardholderAddress]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .actualLine1() - * .actualPostalCode() - * .providedLine1() - * .providedPostalCode() - * .result() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CardholderAddress = - CardholderAddress( - checkRequired("actualLine1", actualLine1), - checkRequired("actualPostalCode", actualPostalCode), - checkRequired("providedLine1", providedLine1), - checkRequired("providedPostalCode", providedPostalCode), - checkRequired("result", result), - additionalProperties.toMutableMap(), - ) - } + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - private var validated: Boolean = false + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - fun validate(): CardholderAddress = apply { - if (validated) { - return@apply - } + fun toBuilder() = Builder().from(this) - actualLine1() - actualPostalCode() - providedLine1() - providedPostalCode() - result().validate() - validated = true - } + companion object { - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * Returns a mutable builder for constructing an instance of [CardFuelConfirmation]. + * + * The following fields are required: + * ```java + * .id() + * .cardAuthorizationId() + * .currency() + * .network() + * .networkIdentifiers() + * .pendingTransactionId() + * .schemeFees() + * .type() + * .updatedAuthorizationAmount() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (actualLine1.asKnown().isPresent) 1 else 0) + - (if (actualPostalCode.asKnown().isPresent) 1 else 0) + - (if (providedLine1.asKnown().isPresent) 1 else 0) + - (if (providedPostalCode.asKnown().isPresent) 1 else 0) + - (result.asKnown().getOrNull()?.validity() ?: 0) + /** A builder for [CardFuelConfirmation]. */ + class Builder internal constructor() { - /** The address verification result returned to the card network. */ - class Result - @JsonCreator - private constructor(private val value: JsonField) : Enum { + private var id: JsonField? = null + private var cardAuthorizationId: JsonField? = null + private var currency: JsonField? = null + private var network: JsonField? = null + private var networkIdentifiers: JsonField? = null + private var pendingTransactionId: JsonField? = null + private var schemeFees: JsonField>? = null + private var type: JsonField? = null + private var updatedAuthorizationAmount: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + @JvmSynthetic + internal fun from(cardFuelConfirmation: CardFuelConfirmation) = apply { + id = cardFuelConfirmation.id + cardAuthorizationId = cardFuelConfirmation.cardAuthorizationId + currency = cardFuelConfirmation.currency + network = cardFuelConfirmation.network + networkIdentifiers = cardFuelConfirmation.networkIdentifiers + pendingTransactionId = cardFuelConfirmation.pendingTransactionId + schemeFees = cardFuelConfirmation.schemeFees.map { it.toMutableList() } + type = cardFuelConfirmation.type + updatedAuthorizationAmount = cardFuelConfirmation.updatedAuthorizationAmount + additionalProperties = cardFuelConfirmation.additionalProperties.toMutableMap() + } - companion object { + /** The Card Fuel Confirmation identifier. */ + fun id(id: String) = id(JsonField.of(id)) - /** No address information was provided in the authorization request. */ - @JvmField val NOT_CHECKED = of("not_checked") + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun id(id: JsonField) = apply { this.id = id } - /** - * Postal code matches, but the street address does not match or was not - * provided. - */ - @JvmField - val POSTAL_CODE_MATCH_ADDRESS_NO_MATCH = - of("postal_code_match_address_no_match") + /** The identifier for the Card Authorization this updates. */ + fun cardAuthorizationId(cardAuthorizationId: String) = + cardAuthorizationId(JsonField.of(cardAuthorizationId)) - /** - * Postal code does not match, but the street address matches or was not - * provided. - */ - @JvmField - val POSTAL_CODE_NO_MATCH_ADDRESS_MATCH = - of("postal_code_no_match_address_match") + /** + * Sets [Builder.cardAuthorizationId] to an arbitrary JSON value. + * + * You should usually call [Builder.cardAuthorizationId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun cardAuthorizationId(cardAuthorizationId: JsonField) = apply { + this.cardAuthorizationId = cardAuthorizationId + } - /** Postal code and street address match. */ - @JvmField val MATCH = of("match") + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the increment's + * currency. + */ + fun currency(currency: Currency) = currency(JsonField.of(currency)) - /** Postal code and street address do not match. */ - @JvmField val NO_MATCH = of("no_match") + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [Currency] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } - /** - * Postal code matches, but the street address was not verified. - * (deprecated) - */ - @JvmField - val POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED = - of("postal_code_match_address_not_checked") + /** The card network used to process this card authorization. */ + fun network(network: Network) = network(JsonField.of(network)) - @JvmStatic fun of(value: String) = Result(JsonField.of(value)) - } + /** + * Sets [Builder.network] to an arbitrary JSON value. + * + * You should usually call [Builder.network] with a well-typed [Network] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun network(network: JsonField) = apply { this.network = network } - /** An enum containing [Result]'s known values. */ - enum class Known { - /** No address information was provided in the authorization request. */ - NOT_CHECKED, - /** - * Postal code matches, but the street address does not match or was not - * provided. - */ - POSTAL_CODE_MATCH_ADDRESS_NO_MATCH, - /** - * Postal code does not match, but the street address matches or was not - * provided. - */ - POSTAL_CODE_NO_MATCH_ADDRESS_MATCH, - /** Postal code and street address match. */ - MATCH, - /** Postal code and street address do not match. */ - NO_MATCH, - /** - * Postal code matches, but the street address was not verified. - * (deprecated) - */ - POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED, - } + /** Network-specific identifiers for a specific request or transaction. */ + fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) = + networkIdentifiers(JsonField.of(networkIdentifiers)) - /** - * An enum containing [Result]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [Result] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** No address information was provided in the authorization request. */ - NOT_CHECKED, - /** - * Postal code matches, but the street address does not match or was not - * provided. - */ - POSTAL_CODE_MATCH_ADDRESS_NO_MATCH, - /** - * Postal code does not match, but the street address matches or was not - * provided. - */ - POSTAL_CODE_NO_MATCH_ADDRESS_MATCH, - /** Postal code and street address match. */ - MATCH, - /** Postal code and street address do not match. */ - NO_MATCH, - /** - * Postal code matches, but the street address was not verified. - * (deprecated) - */ - POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED, - /** - * An enum member indicating that [Result] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } + /** + * Sets [Builder.networkIdentifiers] to an arbitrary JSON value. + * + * You should usually call [Builder.networkIdentifiers] with a well-typed + * [NetworkIdentifiers] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun networkIdentifiers(networkIdentifiers: JsonField) = apply { + this.networkIdentifiers = networkIdentifiers + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - NOT_CHECKED -> Value.NOT_CHECKED - POSTAL_CODE_MATCH_ADDRESS_NO_MATCH -> - Value.POSTAL_CODE_MATCH_ADDRESS_NO_MATCH - POSTAL_CODE_NO_MATCH_ADDRESS_MATCH -> - Value.POSTAL_CODE_NO_MATCH_ADDRESS_MATCH - MATCH -> Value.MATCH - NO_MATCH -> Value.NO_MATCH - POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED -> - Value.POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED - else -> Value._UNKNOWN - } + /** + * The identifier of the Pending Transaction associated with this Card Fuel + * Confirmation. + */ + fun pendingTransactionId(pendingTransactionId: String?) = + pendingTransactionId(JsonField.ofNullable(pendingTransactionId)) - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - NOT_CHECKED -> Known.NOT_CHECKED - POSTAL_CODE_MATCH_ADDRESS_NO_MATCH -> - Known.POSTAL_CODE_MATCH_ADDRESS_NO_MATCH - POSTAL_CODE_NO_MATCH_ADDRESS_MATCH -> - Known.POSTAL_CODE_NO_MATCH_ADDRESS_MATCH - MATCH -> Known.MATCH - NO_MATCH -> Known.NO_MATCH - POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED -> - Known.POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED - else -> throw IncreaseInvalidDataException("Unknown Result: $value") - } + /** + * Alias for calling [Builder.pendingTransactionId] with + * `pendingTransactionId.orElse(null)`. + */ + fun pendingTransactionId(pendingTransactionId: Optional) = + pendingTransactionId(pendingTransactionId.getOrNull()) - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + /** + * Sets [Builder.pendingTransactionId] to an arbitrary JSON value. + * + * You should usually call [Builder.pendingTransactionId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun pendingTransactionId(pendingTransactionId: JsonField) = apply { + this.pendingTransactionId = pendingTransactionId + } - private var validated: Boolean = false + /** The scheme fees associated with this card fuel confirmation. */ + fun schemeFees(schemeFees: List) = schemeFees(JsonField.of(schemeFees)) - fun validate(): Result = apply { - if (validated) { - return@apply - } + /** + * Sets [Builder.schemeFees] to an arbitrary JSON value. + * + * You should usually call [Builder.schemeFees] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun schemeFees(schemeFees: JsonField>) = apply { + this.schemeFees = schemeFees.map { it.toMutableList() } + } - known() - validated = true + /** + * Adds a single [SchemeFee] to [schemeFees]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addSchemeFee(schemeFee: SchemeFee) = apply { + schemeFees = + (schemeFees ?: JsonField.of(mutableListOf())).also { + checkKnown("schemeFees", it).add(schemeFee) } + } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * A constant representing the object's type. For this resource it will always be + * `card_fuel_confirmation`. + */ + fun type(type: Type) = type(JsonField.of(type)) - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun type(type: JsonField) = apply { this.type = type } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * The updated authorization amount after this fuel confirmation, in the minor unit + * of the transaction's currency. For dollars, for example, this is cents. + */ + fun updatedAuthorizationAmount(updatedAuthorizationAmount: Long) = + updatedAuthorizationAmount(JsonField.of(updatedAuthorizationAmount)) - return other is Result && value == other.value - } + /** + * Sets [Builder.updatedAuthorizationAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.updatedAuthorizationAmount] with a well-typed + * [Long] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun updatedAuthorizationAmount(updatedAuthorizationAmount: JsonField) = + apply { + this.updatedAuthorizationAmount = updatedAuthorizationAmount + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - override fun hashCode() = value.hashCode() + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - override fun toString() = value.toString() + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - return other is CardholderAddress && - actualLine1 == other.actualLine1 && - actualPostalCode == other.actualPostalCode && - providedLine1 == other.providedLine1 && - providedPostalCode == other.providedPostalCode && - result == other.result && - additionalProperties == other.additionalProperties - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - private val hashCode: Int by lazy { - Objects.hash( - actualLine1, - actualPostalCode, - providedLine1, - providedPostalCode, - result, - additionalProperties, - ) - } + /** + * Returns an immutable instance of [CardFuelConfirmation]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .cardAuthorizationId() + * .currency() + * .network() + * .networkIdentifiers() + * .pendingTransactionId() + * .schemeFees() + * .type() + * .updatedAuthorizationAmount() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CardFuelConfirmation = + CardFuelConfirmation( + checkRequired("id", id), + checkRequired("cardAuthorizationId", cardAuthorizationId), + checkRequired("currency", currency), + checkRequired("network", network), + checkRequired("networkIdentifiers", networkIdentifiers), + checkRequired("pendingTransactionId", pendingTransactionId), + checkRequired("schemeFees", schemeFees).map { it.toImmutable() }, + checkRequired("type", type), + checkRequired("updatedAuthorizationAmount", updatedAuthorizationAmount), + additionalProperties.toMutableMap(), + ) + } - override fun hashCode(): Int = hashCode + private var validated: Boolean = false - override fun toString() = - "CardholderAddress{actualLine1=$actualLine1, actualPostalCode=$actualPostalCode, providedLine1=$providedLine1, providedPostalCode=$providedPostalCode, result=$result, additionalProperties=$additionalProperties}" + fun validate(): CardFuelConfirmation = apply { + if (validated) { + return@apply } - /** Cardholder name provided in the authorization request. */ - class CardholderName - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val providedFirstName: JsonField, - private val providedLastName: JsonField, - private val providedMiddleName: JsonField, - private val additionalProperties: MutableMap, - ) { + id() + cardAuthorizationId() + currency().validate() + network().validate() + networkIdentifiers().validate() + pendingTransactionId() + schemeFees().forEach { it.validate() } + type().validate() + updatedAuthorizationAmount() + validated = true + } - @JsonCreator - private constructor( - @JsonProperty("provided_first_name") - @ExcludeMissing - providedFirstName: JsonField = JsonMissing.of(), - @JsonProperty("provided_last_name") - @ExcludeMissing - providedLastName: JsonField = JsonMissing.of(), - @JsonProperty("provided_middle_name") - @ExcludeMissing - providedMiddleName: JsonField = JsonMissing.of(), - ) : this( - providedFirstName, - providedLastName, - providedMiddleName, - mutableMapOf(), - ) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * The first name provided for verification in the authorization request. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun providedFirstName(): Optional = - providedFirstName.getOptional("provided_first_name") + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (cardAuthorizationId.asKnown().isPresent) 1 else 0) + + (currency.asKnown().getOrNull()?.validity() ?: 0) + + (network.asKnown().getOrNull()?.validity() ?: 0) + + (networkIdentifiers.asKnown().getOrNull()?.validity() ?: 0) + + (if (pendingTransactionId.asKnown().isPresent) 1 else 0) + + (schemeFees.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (updatedAuthorizationAmount.asKnown().isPresent) 1 else 0) - /** - * The last name provided for verification in the authorization request. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun providedLastName(): Optional = - providedLastName.getOptional("provided_last_name") + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the increment's + * currency. + */ + class Currency @JsonCreator private constructor(private val value: JsonField) : + Enum { - /** - * The middle name provided for verification in the authorization request. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun providedMiddleName(): Optional = - providedMiddleName.getOptional("provided_middle_name") + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /** - * Returns the raw JSON value of [providedFirstName]. - * - * Unlike [providedFirstName], this method doesn't throw if the JSON field has - * an unexpected type. - */ - @JsonProperty("provided_first_name") - @ExcludeMissing - fun _providedFirstName(): JsonField = providedFirstName + companion object { - /** - * Returns the raw JSON value of [providedLastName]. - * - * Unlike [providedLastName], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("provided_last_name") - @ExcludeMissing - fun _providedLastName(): JsonField = providedLastName + /** US Dollar (USD) */ + @JvmField val USD = of("USD") + + @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) + } + + /** An enum containing [Currency]'s known values. */ + enum class Known { + /** US Dollar (USD) */ + USD + } + /** + * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Currency] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** US Dollar (USD) */ + USD, /** - * Returns the raw JSON value of [providedMiddleName]. - * - * Unlike [providedMiddleName], this method doesn't throw if the JSON field has - * an unexpected type. + * An enum member indicating that [Currency] was instantiated with an unknown + * value. */ - @JsonProperty("provided_middle_name") - @ExcludeMissing - fun _providedMiddleName(): JsonField = providedMiddleName + _UNKNOWN, + } - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + USD -> Value.USD + else -> Value._UNKNOWN } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + USD -> Known.USD + else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + } - /** - * Returns a mutable builder for constructing an instance of - * [CardholderName]. - * - * The following fields are required: - * ```java - * .providedFirstName() - * .providedLastName() - * .providedMiddleName() - * ``` - */ - @JvmStatic fun builder() = Builder() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") } - /** A builder for [CardholderName]. */ - class Builder internal constructor() { + private var validated: Boolean = false - private var providedFirstName: JsonField? = null - private var providedLastName: JsonField? = null - private var providedMiddleName: JsonField? = null - private var additionalProperties: MutableMap = - mutableMapOf() + fun validate(): Currency = apply { + if (validated) { + return@apply + } - @JvmSynthetic - internal fun from(cardholderName: CardholderName) = apply { - providedFirstName = cardholderName.providedFirstName - providedLastName = cardholderName.providedLastName - providedMiddleName = cardholderName.providedMiddleName - additionalProperties = - cardholderName.additionalProperties.toMutableMap() - } + known() + validated = true + } - /** - * The first name provided for verification in the authorization request. - */ - fun providedFirstName(providedFirstName: String?) = - providedFirstName(JsonField.ofNullable(providedFirstName)) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * Alias for calling [Builder.providedFirstName] with - * `providedFirstName.orElse(null)`. - */ - fun providedFirstName(providedFirstName: Optional) = - providedFirstName(providedFirstName.getOrNull()) + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - /** - * Sets [Builder.providedFirstName] to an arbitrary JSON value. - * - * You should usually call [Builder.providedFirstName] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun providedFirstName(providedFirstName: JsonField) = apply { - this.providedFirstName = providedFirstName - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** The last name provided for verification in the authorization request. */ - fun providedLastName(providedLastName: String?) = - providedLastName(JsonField.ofNullable(providedLastName)) + return other is Currency && value == other.value + } - /** - * Alias for calling [Builder.providedLastName] with - * `providedLastName.orElse(null)`. - */ - fun providedLastName(providedLastName: Optional) = - providedLastName(providedLastName.getOrNull()) + override fun hashCode() = value.hashCode() - /** - * Sets [Builder.providedLastName] to an arbitrary JSON value. - * - * You should usually call [Builder.providedLastName] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun providedLastName(providedLastName: JsonField) = apply { - this.providedLastName = providedLastName - } + override fun toString() = value.toString() + } - /** - * The middle name provided for verification in the authorization request. - */ - fun providedMiddleName(providedMiddleName: String?) = - providedMiddleName(JsonField.ofNullable(providedMiddleName)) + /** The card network used to process this card authorization. */ + class Network @JsonCreator private constructor(private val value: JsonField) : + Enum { - /** - * Alias for calling [Builder.providedMiddleName] with - * `providedMiddleName.orElse(null)`. - */ - fun providedMiddleName(providedMiddleName: Optional) = - providedMiddleName(providedMiddleName.getOrNull()) + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /** - * Sets [Builder.providedMiddleName] to an arbitrary JSON value. - * - * You should usually call [Builder.providedMiddleName] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun providedMiddleName(providedMiddleName: JsonField) = apply { - this.providedMiddleName = providedMiddleName - } + companion object { - fun additionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** Visa */ + @JvmField val VISA = of("visa") - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** Pulse */ + @JvmField val PULSE = of("pulse") - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } + @JvmStatic fun of(value: String) = Network(JsonField.of(value)) + } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** An enum containing [Network]'s known values. */ + enum class Known { + /** Visa */ + VISA, + /** Pulse */ + PULSE, + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** + * An enum containing [Network]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Network] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** Visa */ + VISA, + /** Pulse */ + PULSE, + /** + * An enum member indicating that [Network] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } - /** - * Returns an immutable instance of [CardholderName]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .providedFirstName() - * .providedLastName() - * .providedMiddleName() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CardholderName = - CardholderName( - checkRequired("providedFirstName", providedFirstName), - checkRequired("providedLastName", providedLastName), - checkRequired("providedMiddleName", providedMiddleName), - additionalProperties.toMutableMap(), - ) + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + VISA -> Value.VISA + PULSE -> Value.PULSE + else -> Value._UNKNOWN } - private var validated: Boolean = false - - fun validate(): CardholderName = apply { - if (validated) { - return@apply - } - - providedFirstName() - providedLastName() - providedMiddleName() - validated = true + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + VISA -> Known.VISA + PULSE -> Known.PULSE + else -> throw IncreaseInvalidDataException("Unknown Network: $value") } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (providedFirstName.asKnown().isPresent) 1 else 0) + - (if (providedLastName.asKnown().isPresent) 1 else 0) + - (if (providedMiddleName.asKnown().isPresent) 1 else 0) + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + private var validated: Boolean = false - return other is CardholderName && - providedFirstName == other.providedFirstName && - providedLastName == other.providedLastName && - providedMiddleName == other.providedMiddleName && - additionalProperties == other.additionalProperties + fun validate(): Network = apply { + if (validated) { + return@apply } - private val hashCode: Int by lazy { - Objects.hash( - providedFirstName, - providedLastName, - providedMiddleName, - additionalProperties, - ) - } + known() + validated = true + } - override fun hashCode(): Int = hashCode + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - override fun toString() = - "CardholderName{providedFirstName=$providedFirstName, providedLastName=$providedLastName, providedMiddleName=$providedMiddleName, additionalProperties=$additionalProperties}" - } + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is Verification && - cardVerificationCode == other.cardVerificationCode && - cardholderAddress == other.cardholderAddress && - cardholderName == other.cardholderName && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - cardVerificationCode, - cardholderAddress, - cardholderName, - additionalProperties, - ) + return other is Network && value == other.value } - override fun hashCode(): Int = hashCode + override fun hashCode() = value.hashCode() - override fun toString() = - "Verification{cardVerificationCode=$cardVerificationCode, cardholderAddress=$cardholderAddress, cardholderName=$cardholderName, additionalProperties=$additionalProperties}" + override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CardFinancial && - id == other.id && - actioner == other.actioner && - additionalAmounts == other.additionalAmounts && - amount == other.amount && - cardPaymentId == other.cardPaymentId && - currency == other.currency && - digitalWalletTokenId == other.digitalWalletTokenId && - direction == other.direction && - merchantAcceptorId == other.merchantAcceptorId && - merchantCategoryCode == other.merchantCategoryCode && - merchantCity == other.merchantCity && - merchantCountry == other.merchantCountry && - merchantDescriptor == other.merchantDescriptor && - merchantPostalCode == other.merchantPostalCode && - merchantState == other.merchantState && - networkDetails == other.networkDetails && - networkIdentifiers == other.networkIdentifiers && - networkRiskScore == other.networkRiskScore && - physicalCardId == other.physicalCardId && - presentmentAmount == other.presentmentAmount && - presentmentCurrency == other.presentmentCurrency && - processingCategory == other.processingCategory && - realTimeDecisionId == other.realTimeDecisionId && - terminalId == other.terminalId && - transactionId == other.transactionId && - type == other.type && - verification == other.verification && - additionalProperties == other.additionalProperties - } + /** Network-specific identifiers for a specific request or transaction. */ + class NetworkIdentifiers + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val authorizationIdentificationResponse: JsonField, + private val retrievalReferenceNumber: JsonField, + private val traceNumber: JsonField, + private val transactionId: JsonField, + private val additionalProperties: MutableMap, + ) { - private val hashCode: Int by lazy { - Objects.hash( - id, - actioner, - additionalAmounts, - amount, - cardPaymentId, - currency, - digitalWalletTokenId, - direction, - merchantAcceptorId, - merchantCategoryCode, - merchantCity, - merchantCountry, - merchantDescriptor, - merchantPostalCode, - merchantState, - networkDetails, - networkIdentifiers, - networkRiskScore, - physicalCardId, - presentmentAmount, - presentmentCurrency, - processingCategory, - realTimeDecisionId, - terminalId, + @JsonCreator + private constructor( + @JsonProperty("authorization_identification_response") + @ExcludeMissing + authorizationIdentificationResponse: JsonField = JsonMissing.of(), + @JsonProperty("retrieval_reference_number") + @ExcludeMissing + retrievalReferenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("trace_number") + @ExcludeMissing + traceNumber: JsonField = JsonMissing.of(), + @JsonProperty("transaction_id") + @ExcludeMissing + transactionId: JsonField = JsonMissing.of(), + ) : this( + authorizationIdentificationResponse, + retrievalReferenceNumber, + traceNumber, transactionId, - type, - verification, - additionalProperties, + mutableMapOf(), ) - } - override fun hashCode(): Int = hashCode + /** + * The randomly generated 6-character Authorization Identification Response code + * sent back to the acquirer in an approved response. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun authorizationIdentificationResponse(): Optional = + authorizationIdentificationResponse.getOptional( + "authorization_identification_response" + ) - override fun toString() = - "CardFinancial{id=$id, actioner=$actioner, additionalAmounts=$additionalAmounts, amount=$amount, cardPaymentId=$cardPaymentId, currency=$currency, digitalWalletTokenId=$digitalWalletTokenId, direction=$direction, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkDetails=$networkDetails, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, physicalCardId=$physicalCardId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, processingCategory=$processingCategory, realTimeDecisionId=$realTimeDecisionId, terminalId=$terminalId, transactionId=$transactionId, type=$type, verification=$verification, additionalProperties=$additionalProperties}" - } + /** + * A life-cycle identifier used across e.g., an authorization and a reversal. + * Expected to be unique per acquirer within a window of time. For some card + * networks the retrieval reference number includes the trace counter. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun retrievalReferenceNumber(): Optional = + retrievalReferenceNumber.getOptional("retrieval_reference_number") - /** - * A Card Fuel Confirmation object. This field will be present in the JSON response if and - * only if `category` is equal to `card_fuel_confirmation`. Card Fuel Confirmations update - * the amount of a Card Authorization after a fuel pump transaction is completed. - */ - class CardFuelConfirmation - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val id: JsonField, - private val cardAuthorizationId: JsonField, - private val currency: JsonField, - private val network: JsonField, - private val networkIdentifiers: JsonField, - private val pendingTransactionId: JsonField, - private val type: JsonField, - private val updatedAuthorizationAmount: JsonField, - private val additionalProperties: MutableMap, - ) { + /** + * A counter used to verify an individual authorization. Expected to be unique per + * acquirer within a window of time. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun traceNumber(): Optional = traceNumber.getOptional("trace_number") - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("card_authorization_id") - @ExcludeMissing - cardAuthorizationId: JsonField = JsonMissing.of(), - @JsonProperty("currency") + /** + * A globally unique transaction identifier provided by the card network, used + * across multiple life-cycle requests. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun transactionId(): Optional = transactionId.getOptional("transaction_id") + + /** + * Returns the raw JSON value of [authorizationIdentificationResponse]. + * + * Unlike [authorizationIdentificationResponse], this method doesn't throw if the + * JSON field has an unexpected type. + */ + @JsonProperty("authorization_identification_response") @ExcludeMissing - currency: JsonField = JsonMissing.of(), - @JsonProperty("network") + fun _authorizationIdentificationResponse(): JsonField = + authorizationIdentificationResponse + + /** + * Returns the raw JSON value of [retrievalReferenceNumber]. + * + * Unlike [retrievalReferenceNumber], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("retrieval_reference_number") @ExcludeMissing - network: JsonField = JsonMissing.of(), - @JsonProperty("network_identifiers") + fun _retrievalReferenceNumber(): JsonField = retrievalReferenceNumber + + /** + * Returns the raw JSON value of [traceNumber]. + * + * Unlike [traceNumber], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("trace_number") @ExcludeMissing - networkIdentifiers: JsonField = JsonMissing.of(), - @JsonProperty("pending_transaction_id") + fun _traceNumber(): JsonField = traceNumber + + /** + * Returns the raw JSON value of [transactionId]. + * + * Unlike [transactionId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("transaction_id") @ExcludeMissing - pendingTransactionId: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - @JsonProperty("updated_authorization_amount") + fun _transactionId(): JsonField = transactionId + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter @ExcludeMissing - updatedAuthorizationAmount: JsonField = JsonMissing.of(), - ) : this( - id, - cardAuthorizationId, - currency, - network, - networkIdentifiers, - pendingTransactionId, - type, - updatedAuthorizationAmount, - mutableMapOf(), - ) + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** - * The Card Fuel Confirmation identifier. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun id(): String = id.getRequired("id") + fun toBuilder() = Builder().from(this) - /** - * The identifier for the Card Authorization this updates. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun cardAuthorizationId(): String = - cardAuthorizationId.getRequired("card_authorization_id") + companion object { - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the increment's - * currency. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun currency(): Currency = currency.getRequired("currency") + /** + * Returns a mutable builder for constructing an instance of + * [NetworkIdentifiers]. + * + * The following fields are required: + * ```java + * .authorizationIdentificationResponse() + * .retrievalReferenceNumber() + * .traceNumber() + * .transactionId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - /** - * The card network used to process this card authorization. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun network(): Network = network.getRequired("network") + /** A builder for [NetworkIdentifiers]. */ + class Builder internal constructor() { - /** - * Network-specific identifiers for a specific request or transaction. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun networkIdentifiers(): NetworkIdentifiers = - networkIdentifiers.getRequired("network_identifiers") + private var authorizationIdentificationResponse: JsonField? = null + private var retrievalReferenceNumber: JsonField? = null + private var traceNumber: JsonField? = null + private var transactionId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** - * The identifier of the Pending Transaction associated with this Card Fuel - * Confirmation. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun pendingTransactionId(): Optional = - pendingTransactionId.getOptional("pending_transaction_id") + @JvmSynthetic + internal fun from(networkIdentifiers: NetworkIdentifiers) = apply { + authorizationIdentificationResponse = + networkIdentifiers.authorizationIdentificationResponse + retrievalReferenceNumber = networkIdentifiers.retrievalReferenceNumber + traceNumber = networkIdentifiers.traceNumber + transactionId = networkIdentifiers.transactionId + additionalProperties = + networkIdentifiers.additionalProperties.toMutableMap() + } - /** - * A constant representing the object's type. For this resource it will always be - * `card_fuel_confirmation`. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun type(): Type = type.getRequired("type") + /** + * The randomly generated 6-character Authorization Identification Response code + * sent back to the acquirer in an approved response. + */ + fun authorizationIdentificationResponse( + authorizationIdentificationResponse: String? + ) = + authorizationIdentificationResponse( + JsonField.ofNullable(authorizationIdentificationResponse) + ) - /** - * The updated authorization amount after this fuel confirmation, in the minor unit of - * the transaction's currency. For dollars, for example, this is cents. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun updatedAuthorizationAmount(): Long = - updatedAuthorizationAmount.getRequired("updated_authorization_amount") + /** + * Alias for calling [Builder.authorizationIdentificationResponse] with + * `authorizationIdentificationResponse.orElse(null)`. + */ + fun authorizationIdentificationResponse( + authorizationIdentificationResponse: Optional + ) = + authorizationIdentificationResponse( + authorizationIdentificationResponse.getOrNull() + ) - /** - * Returns the raw JSON value of [id]. - * - * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Sets [Builder.authorizationIdentificationResponse] to an arbitrary JSON + * value. + * + * You should usually call [Builder.authorizationIdentificationResponse] with a + * well-typed [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun authorizationIdentificationResponse( + authorizationIdentificationResponse: JsonField + ) = apply { + this.authorizationIdentificationResponse = + authorizationIdentificationResponse + } - /** - * Returns the raw JSON value of [cardAuthorizationId]. - * - * Unlike [cardAuthorizationId], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("card_authorization_id") - @ExcludeMissing - fun _cardAuthorizationId(): JsonField = cardAuthorizationId + /** + * A life-cycle identifier used across e.g., an authorization and a reversal. + * Expected to be unique per acquirer within a window of time. For some card + * networks the retrieval reference number includes the trace counter. + */ + fun retrievalReferenceNumber(retrievalReferenceNumber: String?) = + retrievalReferenceNumber(JsonField.ofNullable(retrievalReferenceNumber)) - /** - * Returns the raw JSON value of [currency]. - * - * Unlike [currency], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("currency") - @ExcludeMissing - fun _currency(): JsonField = currency + /** + * Alias for calling [Builder.retrievalReferenceNumber] with + * `retrievalReferenceNumber.orElse(null)`. + */ + fun retrievalReferenceNumber(retrievalReferenceNumber: Optional) = + retrievalReferenceNumber(retrievalReferenceNumber.getOrNull()) + + /** + * Sets [Builder.retrievalReferenceNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.retrievalReferenceNumber] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun retrievalReferenceNumber(retrievalReferenceNumber: JsonField) = + apply { + this.retrievalReferenceNumber = retrievalReferenceNumber + } + + /** + * A counter used to verify an individual authorization. Expected to be unique + * per acquirer within a window of time. + */ + fun traceNumber(traceNumber: String?) = + traceNumber(JsonField.ofNullable(traceNumber)) - /** - * Returns the raw JSON value of [network]. - * - * Unlike [network], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("network") @ExcludeMissing fun _network(): JsonField = network + /** Alias for calling [Builder.traceNumber] with `traceNumber.orElse(null)`. */ + fun traceNumber(traceNumber: Optional) = + traceNumber(traceNumber.getOrNull()) - /** - * Returns the raw JSON value of [networkIdentifiers]. - * - * Unlike [networkIdentifiers], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("network_identifiers") - @ExcludeMissing - fun _networkIdentifiers(): JsonField = networkIdentifiers + /** + * Sets [Builder.traceNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.traceNumber] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun traceNumber(traceNumber: JsonField) = apply { + this.traceNumber = traceNumber + } - /** - * Returns the raw JSON value of [pendingTransactionId]. - * - * Unlike [pendingTransactionId], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("pending_transaction_id") - @ExcludeMissing - fun _pendingTransactionId(): JsonField = pendingTransactionId + /** + * A globally unique transaction identifier provided by the card network, used + * across multiple life-cycle requests. + */ + fun transactionId(transactionId: String?) = + transactionId(JsonField.ofNullable(transactionId)) - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + /** + * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`. + */ + fun transactionId(transactionId: Optional) = + transactionId(transactionId.getOrNull()) - /** - * Returns the raw JSON value of [updatedAuthorizationAmount]. - * - * Unlike [updatedAuthorizationAmount], this method doesn't throw if the JSON field has - * an unexpected type. - */ - @JsonProperty("updated_authorization_amount") - @ExcludeMissing - fun _updatedAuthorizationAmount(): JsonField = updatedAuthorizationAmount + /** + * Sets [Builder.transactionId] to an arbitrary JSON value. + * + * You should usually call [Builder.transactionId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun transactionId(transactionId: JsonField) = apply { + this.transactionId = transactionId + } - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun toBuilder() = Builder().from(this) + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - companion object { + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * Returns a mutable builder for constructing an instance of [CardFuelConfirmation]. - * - * The following fields are required: - * ```java - * .id() - * .cardAuthorizationId() - * .currency() - * .network() - * .networkIdentifiers() - * .pendingTransactionId() - * .type() - * .updatedAuthorizationAmount() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** A builder for [CardFuelConfirmation]. */ - class Builder internal constructor() { + /** + * Returns an immutable instance of [NetworkIdentifiers]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .authorizationIdentificationResponse() + * .retrievalReferenceNumber() + * .traceNumber() + * .transactionId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): NetworkIdentifiers = + NetworkIdentifiers( + checkRequired( + "authorizationIdentificationResponse", + authorizationIdentificationResponse, + ), + checkRequired("retrievalReferenceNumber", retrievalReferenceNumber), + checkRequired("traceNumber", traceNumber), + checkRequired("transactionId", transactionId), + additionalProperties.toMutableMap(), + ) + } - private var id: JsonField? = null - private var cardAuthorizationId: JsonField? = null - private var currency: JsonField? = null - private var network: JsonField? = null - private var networkIdentifiers: JsonField? = null - private var pendingTransactionId: JsonField? = null - private var type: JsonField? = null - private var updatedAuthorizationAmount: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + private var validated: Boolean = false - @JvmSynthetic - internal fun from(cardFuelConfirmation: CardFuelConfirmation) = apply { - id = cardFuelConfirmation.id - cardAuthorizationId = cardFuelConfirmation.cardAuthorizationId - currency = cardFuelConfirmation.currency - network = cardFuelConfirmation.network - networkIdentifiers = cardFuelConfirmation.networkIdentifiers - pendingTransactionId = cardFuelConfirmation.pendingTransactionId - type = cardFuelConfirmation.type - updatedAuthorizationAmount = cardFuelConfirmation.updatedAuthorizationAmount - additionalProperties = cardFuelConfirmation.additionalProperties.toMutableMap() + fun validate(): NetworkIdentifiers = apply { + if (validated) { + return@apply + } + + authorizationIdentificationResponse() + retrievalReferenceNumber() + traceNumber() + transactionId() + validated = true } - /** The Card Fuel Confirmation identifier. */ - fun id(id: String) = id(JsonField.of(id)) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } /** - * Sets [Builder.id] to an arbitrary JSON value. + * Returns a score indicating how many valid values are contained in this object + * recursively. * - * You should usually call [Builder.id] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. + * Used for best match union deserialization. */ - fun id(id: JsonField) = apply { this.id = id } + @JvmSynthetic + internal fun validity(): Int = + (if (authorizationIdentificationResponse.asKnown().isPresent) 1 else 0) + + (if (retrievalReferenceNumber.asKnown().isPresent) 1 else 0) + + (if (traceNumber.asKnown().isPresent) 1 else 0) + + (if (transactionId.asKnown().isPresent) 1 else 0) - /** The identifier for the Card Authorization this updates. */ - fun cardAuthorizationId(cardAuthorizationId: String) = - cardAuthorizationId(JsonField.of(cardAuthorizationId)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Sets [Builder.cardAuthorizationId] to an arbitrary JSON value. - * - * You should usually call [Builder.cardAuthorizationId] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun cardAuthorizationId(cardAuthorizationId: JsonField) = apply { - this.cardAuthorizationId = cardAuthorizationId + return other is NetworkIdentifiers && + authorizationIdentificationResponse == + other.authorizationIdentificationResponse && + retrievalReferenceNumber == other.retrievalReferenceNumber && + traceNumber == other.traceNumber && + transactionId == other.transactionId && + additionalProperties == other.additionalProperties } - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the increment's - * currency. - */ - fun currency(currency: Currency) = currency(JsonField.of(currency)) + private val hashCode: Int by lazy { + Objects.hash( + authorizationIdentificationResponse, + retrievalReferenceNumber, + traceNumber, + transactionId, + additionalProperties, + ) + } - /** - * Sets [Builder.currency] to an arbitrary JSON value. - * - * You should usually call [Builder.currency] with a well-typed [Currency] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun currency(currency: JsonField) = apply { this.currency = currency } + override fun hashCode(): Int = hashCode - /** The card network used to process this card authorization. */ - fun network(network: Network) = network(JsonField.of(network)) + override fun toString() = + "NetworkIdentifiers{authorizationIdentificationResponse=$authorizationIdentificationResponse, retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}" + } - /** - * Sets [Builder.network] to an arbitrary JSON value. - * - * You should usually call [Builder.network] with a well-typed [Network] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun network(network: JsonField) = apply { this.network = network } + class SchemeFee + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val amount: JsonField, + private val createdAt: JsonField, + private val currency: JsonField, + private val feeType: JsonField, + private val fixedComponent: JsonField, + private val variableRate: JsonField, + private val additionalProperties: MutableMap, + ) { - /** Network-specific identifiers for a specific request or transaction. */ - fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) = - networkIdentifiers(JsonField.of(networkIdentifiers)) + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + createdAt: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("fee_type") + @ExcludeMissing + feeType: JsonField = JsonMissing.of(), + @JsonProperty("fixed_component") + @ExcludeMissing + fixedComponent: JsonField = JsonMissing.of(), + @JsonProperty("variable_rate") + @ExcludeMissing + variableRate: JsonField = JsonMissing.of(), + ) : this( + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, + mutableMapOf(), + ) /** - * Sets [Builder.networkIdentifiers] to an arbitrary JSON value. + * The fee amount given as a string containing a decimal number. * - * You should usually call [Builder.networkIdentifiers] with a well-typed - * [NetworkIdentifiers] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun networkIdentifiers(networkIdentifiers: JsonField) = apply { - this.networkIdentifiers = networkIdentifiers - } - - /** - * The identifier of the Pending Transaction associated with this Card Fuel - * Confirmation. - */ - fun pendingTransactionId(pendingTransactionId: String?) = - pendingTransactionId(JsonField.ofNullable(pendingTransactionId)) - - /** - * Alias for calling [Builder.pendingTransactionId] with - * `pendingTransactionId.orElse(null)`. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). */ - fun pendingTransactionId(pendingTransactionId: Optional) = - pendingTransactionId(pendingTransactionId.getOrNull()) + fun amount(): String = amount.getRequired("amount") /** - * Sets [Builder.pendingTransactionId] to an arbitrary JSON value. + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + * created. * - * You should usually call [Builder.pendingTransactionId] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). */ - fun pendingTransactionId(pendingTransactionId: JsonField) = apply { - this.pendingTransactionId = pendingTransactionId - } + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") /** - * A constant representing the object's type. For this resource it will always be - * `card_fuel_confirmation`. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). */ - fun type(type: Type) = type(JsonField.of(type)) + fun currency(): Currency = currency.getRequired("currency") /** - * Sets [Builder.type] to an arbitrary JSON value. + * The type of fee being assessed. * - * You should usually call [Builder.type] with a well-typed [Type] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). */ - fun type(type: JsonField) = apply { this.type = type } + fun feeType(): FeeType = feeType.getRequired("fee_type") /** - * The updated authorization amount after this fuel confirmation, in the minor unit - * of the transaction's currency. For dollars, for example, this is cents. + * The fixed component of the fee, if applicable, given in major units of the fee + * amount. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ - fun updatedAuthorizationAmount(updatedAuthorizationAmount: Long) = - updatedAuthorizationAmount(JsonField.of(updatedAuthorizationAmount)) + fun fixedComponent(): Optional = + fixedComponent.getOptional("fixed_component") /** - * Sets [Builder.updatedAuthorizationAmount] to an arbitrary JSON value. + * The variable rate component of the fee, if applicable, given as a decimal (e.g., + * 0.015 for 1.5%). * - * You should usually call [Builder.updatedAuthorizationAmount] with a well-typed - * [Long] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ - fun updatedAuthorizationAmount(updatedAuthorizationAmount: JsonField) = - apply { - this.updatedAuthorizationAmount = updatedAuthorizationAmount - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + fun variableRate(): Optional = variableRate.getOptional("variable_rate") /** - * Returns an immutable instance of [CardFuelConfirmation]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .cardAuthorizationId() - * .currency() - * .network() - * .networkIdentifiers() - * .pendingTransactionId() - * .type() - * .updatedAuthorizationAmount() - * ``` + * Returns the raw JSON value of [amount]. * - * @throws IllegalStateException if any required field is unset. + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun build(): CardFuelConfirmation = - CardFuelConfirmation( - checkRequired("id", id), - checkRequired("cardAuthorizationId", cardAuthorizationId), - checkRequired("currency", currency), - checkRequired("network", network), - checkRequired("networkIdentifiers", networkIdentifiers), - checkRequired("pendingTransactionId", pendingTransactionId), - checkRequired("type", type), - checkRequired("updatedAuthorizationAmount", updatedAuthorizationAmount), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): CardFuelConfirmation = apply { - if (validated) { - return@apply - } - - id() - cardAuthorizationId() - currency().validate() - network().validate() - networkIdentifiers().validate() - pendingTransactionId() - type().validate() - updatedAuthorizationAmount() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (id.asKnown().isPresent) 1 else 0) + - (if (cardAuthorizationId.asKnown().isPresent) 1 else 0) + - (currency.asKnown().getOrNull()?.validity() ?: 0) + - (network.asKnown().getOrNull()?.validity() ?: 0) + - (networkIdentifiers.asKnown().getOrNull()?.validity() ?: 0) + - (if (pendingTransactionId.asKnown().isPresent) 1 else 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) + - (if (updatedAuthorizationAmount.asKnown().isPresent) 1 else 0) - - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the increment's - * currency. - */ - class Currency @JsonCreator private constructor(private val value: JsonField) : - Enum { + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount /** - * Returns this class instance's raw value. + * Returns the raw JSON value of [createdAt]. * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected + * type. */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - /** US Dollar (USD) */ - @JvmField val USD = of("USD") - - @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) - } - - /** An enum containing [Currency]'s known values. */ - enum class Known { - /** US Dollar (USD) */ - USD - } + @JsonProperty("created_at") + @ExcludeMissing + fun _createdAt(): JsonField = createdAt /** - * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Currency] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** US Dollar (USD) */ - USD, - /** - * An enum member indicating that [Currency] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("currency") + @ExcludeMissing + fun _currency(): JsonField = currency /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * Returns the raw JSON value of [feeType]. * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. + * Unlike [feeType], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun value(): Value = - when (this) { - USD -> Value.USD - else -> Value._UNKNOWN - } + @JsonProperty("fee_type") + @ExcludeMissing + fun _feeType(): JsonField = feeType /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. + * Returns the raw JSON value of [fixedComponent]. * - * @throws IncreaseInvalidDataException if this class instance's value is a not a - * known member. + * Unlike [fixedComponent], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun known(): Known = - when (this) { - USD -> Known.USD - else -> throw IncreaseInvalidDataException("Unknown Currency: $value") - } + @JsonProperty("fixed_component") + @ExcludeMissing + fun _fixedComponent(): JsonField = fixedComponent /** - * Returns this class instance's primitive wire representation. + * Returns the raw JSON value of [variableRate]. * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does not have - * the expected primitive type. + * Unlike [variableRate], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + @JsonProperty("variable_rate") + @ExcludeMissing + fun _variableRate(): JsonField = variableRate - private var validated: Boolean = false + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - fun validate(): Currency = apply { - if (validated) { - return@apply - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - known() - validated = true + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [SchemeFee]. + * + * The following fields are required: + * ```java + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() + * ``` + */ + @JvmStatic fun builder() = Builder() } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** A builder for [SchemeFee]. */ + class Builder internal constructor() { - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + private var amount: JsonField? = null + private var createdAt: JsonField? = null + private var currency: JsonField? = null + private var feeType: JsonField? = null + private var fixedComponent: JsonField? = null + private var variableRate: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + @JvmSynthetic + internal fun from(schemeFee: SchemeFee) = apply { + amount = schemeFee.amount + createdAt = schemeFee.createdAt + currency = schemeFee.currency + feeType = schemeFee.feeType + fixedComponent = schemeFee.fixedComponent + variableRate = schemeFee.variableRate + additionalProperties = schemeFee.additionalProperties.toMutableMap() } - return other is Currency && value == other.value - } + /** The fee amount given as a string containing a decimal number. */ + fun amount(amount: String) = amount(JsonField.of(amount)) - override fun hashCode() = value.hashCode() + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun amount(amount: JsonField) = apply { this.amount = amount } - override fun toString() = value.toString() - } + /** + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee + * was created. + */ + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - /** The card network used to process this card authorization. */ - class Network @JsonCreator private constructor(private val value: JsonField) : - Enum { + /** + * Sets [Builder.createdAt] to an arbitrary JSON value. + * + * You should usually call [Builder.createdAt] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + */ + fun currency(currency: Currency) = currency(JsonField.of(currency)) - companion object { + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [Currency] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } - /** Visa */ - @JvmField val VISA = of("visa") + /** The type of fee being assessed. */ + fun feeType(feeType: FeeType) = feeType(JsonField.of(feeType)) - /** Pulse */ - @JvmField val PULSE = of("pulse") + /** + * Sets [Builder.feeType] to an arbitrary JSON value. + * + * You should usually call [Builder.feeType] with a well-typed [FeeType] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun feeType(feeType: JsonField) = apply { this.feeType = feeType } - @JvmStatic fun of(value: String) = Network(JsonField.of(value)) - } + /** + * The fixed component of the fee, if applicable, given in major units of the + * fee amount. + */ + fun fixedComponent(fixedComponent: String?) = + fixedComponent(JsonField.ofNullable(fixedComponent)) - /** An enum containing [Network]'s known values. */ - enum class Known { - /** Visa */ - VISA, - /** Pulse */ - PULSE, - } + /** + * Alias for calling [Builder.fixedComponent] with + * `fixedComponent.orElse(null)`. + */ + fun fixedComponent(fixedComponent: Optional) = + fixedComponent(fixedComponent.getOrNull()) - /** - * An enum containing [Network]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Network] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** Visa */ - VISA, - /** Pulse */ - PULSE, /** - * An enum member indicating that [Network] was instantiated with an unknown - * value. + * Sets [Builder.fixedComponent] to an arbitrary JSON value. + * + * You should usually call [Builder.fixedComponent] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ - _UNKNOWN, - } + fun fixedComponent(fixedComponent: JsonField) = apply { + this.fixedComponent = fixedComponent + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - VISA -> Value.VISA - PULSE -> Value.PULSE - else -> Value._UNKNOWN + /** + * The variable rate component of the fee, if applicable, given as a decimal + * (e.g., 0.015 for 1.5%). + */ + fun variableRate(variableRate: String?) = + variableRate(JsonField.ofNullable(variableRate)) + + /** + * Alias for calling [Builder.variableRate] with `variableRate.orElse(null)`. + */ + fun variableRate(variableRate: Optional) = + variableRate(variableRate.getOrNull()) + + /** + * Sets [Builder.variableRate] to an arbitrary JSON value. + * + * You should usually call [Builder.variableRate] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun variableRate(variableRate: JsonField) = apply { + this.variableRate = variableRate } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - VISA -> Known.VISA - PULSE -> Known.PULSE - else -> throw IncreaseInvalidDataException("Unknown Network: $value") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [SchemeFee]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SchemeFee = + SchemeFee( + checkRequired("amount", amount), + checkRequired("createdAt", createdAt), + checkRequired("currency", currency), + checkRequired("feeType", feeType), + checkRequired("fixedComponent", fixedComponent), + checkRequired("variableRate", variableRate), + additionalProperties.toMutableMap(), + ) + } + private var validated: Boolean = false - fun validate(): Network = apply { + fun validate(): SchemeFee = apply { if (validated) { return@apply } - known() + amount() + createdAt() + currency().validate() + feeType().validate() + fixedComponent() + variableRate() validated = true } @@ -46644,400 +52941,916 @@ private constructor( * * Used for best match union deserialization. */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (currency.asKnown().getOrNull()?.validity() ?: 0) + + (feeType.asKnown().getOrNull()?.validity() ?: 0) + + (if (fixedComponent.asKnown().isPresent) 1 else 0) + + (if (variableRate.asKnown().isPresent) 1 else 0) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + */ + class Currency + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** US Dollar (USD) */ + @JvmField val USD = of("USD") + + @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) } - return other is Network && value == other.value - } + /** An enum containing [Currency]'s known values. */ + enum class Known { + /** US Dollar (USD) */ + USD + } - override fun hashCode() = value.hashCode() + /** + * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Currency] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** US Dollar (USD) */ + USD, + /** + * An enum member indicating that [Currency] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - override fun toString() = value.toString() - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + USD -> Value.USD + else -> Value._UNKNOWN + } - /** Network-specific identifiers for a specific request or transaction. */ - class NetworkIdentifiers - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val authorizationIdentificationResponse: JsonField, - private val retrievalReferenceNumber: JsonField, - private val traceNumber: JsonField, - private val transactionId: JsonField, - private val additionalProperties: MutableMap, - ) { + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + USD -> Known.USD + else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Currency = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Currency && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + /** The type of fee being assessed. */ + class FeeType @JsonCreator - private constructor( - @JsonProperty("authorization_identification_response") - @ExcludeMissing - authorizationIdentificationResponse: JsonField = JsonMissing.of(), - @JsonProperty("retrieval_reference_number") - @ExcludeMissing - retrievalReferenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("trace_number") - @ExcludeMissing - traceNumber: JsonField = JsonMissing.of(), - @JsonProperty("transaction_id") - @ExcludeMissing - transactionId: JsonField = JsonMissing.of(), - ) : this( - authorizationIdentificationResponse, - retrievalReferenceNumber, - traceNumber, - transactionId, - mutableMapOf(), - ) + private constructor(private val value: JsonField) : Enum { - /** - * The randomly generated 6-character Authorization Identification Response code - * sent back to the acquirer in an approved response. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun authorizationIdentificationResponse(): Optional = - authorizationIdentificationResponse.getOptional( - "authorization_identification_response" - ) + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** - * A life-cycle identifier used across e.g., an authorization and a reversal. - * Expected to be unique per acquirer within a window of time. For some card - * networks the retrieval reference number includes the trace counter. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun retrievalReferenceNumber(): Optional = - retrievalReferenceNumber.getOptional("retrieval_reference_number") + companion object { + + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY = + of("visa_international_service_assessment_single_currency") + + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY = + of("visa_international_service_assessment_cross_currency") + + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + @JvmField + val VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE = + of("visa_authorization_domestic_point_of_sale") + + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + @JvmField + val VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_international_point_of_sale") + + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + @JvmField + val VISA_AUTHORIZATION_CANADA_POINT_OF_SALE = + of("visa_authorization_canada_point_of_sale") + + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + @JvmField + val VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE = + of("visa_authorization_reversal_point_of_sale") - /** - * A counter used to verify an individual authorization. Expected to be unique per - * acquirer within a window of time. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun traceNumber(): Optional = traceNumber.getOptional("trace_number") + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + @JvmField + val VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_reversal_international_point_of_sale") - /** - * A globally unique transaction identifier provided by the card network, used - * across multiple life-cycle requests. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun transactionId(): Optional = transactionId.getOptional("transaction_id") + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + @JvmField + val VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE = + of("visa_authorization_address_verification_service") - /** - * Returns the raw JSON value of [authorizationIdentificationResponse]. - * - * Unlike [authorizationIdentificationResponse], this method doesn't throw if the - * JSON field has an unexpected type. - */ - @JsonProperty("authorization_identification_response") - @ExcludeMissing - fun _authorizationIdentificationResponse(): JsonField = - authorizationIdentificationResponse + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + @JvmField + val VISA_ADVANCED_AUTHORIZATION = of("visa_advanced_authorization") - /** - * Returns the raw JSON value of [retrievalReferenceNumber]. - * - * Unlike [retrievalReferenceNumber], this method doesn't throw if the JSON field - * has an unexpected type. - */ - @JsonProperty("retrieval_reference_number") - @ExcludeMissing - fun _retrievalReferenceNumber(): JsonField = retrievalReferenceNumber + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + @JvmField val VISA_MESSAGE_TRANSMISSION = of("visa_message_transmission") - /** - * Returns the raw JSON value of [traceNumber]. - * - * Unlike [traceNumber], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("trace_number") - @ExcludeMissing - fun _traceNumber(): JsonField = traceNumber + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_DOMESTIC = + of("visa_account_verification_domestic") - /** - * Returns the raw JSON value of [transactionId]. - * - * Unlike [transactionId], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("transaction_id") - @ExcludeMissing - fun _transactionId(): JsonField = transactionId + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_INTERNATIONAL = + of("visa_account_verification_international") - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_CANADA = + of("visa_account_verification_canada") - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + @JvmField + val VISA_CORPORATE_ACCEPTANCE_FEE = of("visa_corporate_acceptance_fee") - fun toBuilder() = Builder().from(this) + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + @JvmField + val VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE = + of("visa_consumer_debit_acceptance_fee") - companion object { + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + @JvmField + val VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE = + of("visa_business_debit_acceptance_fee") - /** - * Returns a mutable builder for constructing an instance of - * [NetworkIdentifiers]. - * - * The following fields are required: - * ```java - * .authorizationIdentificationResponse() - * .retrievalReferenceNumber() - * .traceNumber() - * .transactionId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + @JvmField + val VISA_PURCHASING_ACCEPTANCE_FEE = of("visa_purchasing_acceptance_fee") - /** A builder for [NetworkIdentifiers]. */ - class Builder internal constructor() { + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + @JvmField val VISA_PURCHASE_DOMESTIC = of("visa_purchase_domestic") - private var authorizationIdentificationResponse: JsonField? = null - private var retrievalReferenceNumber: JsonField? = null - private var traceNumber: JsonField? = null - private var transactionId: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + @JvmField + val VISA_PURCHASE_INTERNATIONAL = of("visa_purchase_international") - @JvmSynthetic - internal fun from(networkIdentifiers: NetworkIdentifiers) = apply { - authorizationIdentificationResponse = - networkIdentifiers.authorizationIdentificationResponse - retrievalReferenceNumber = networkIdentifiers.retrievalReferenceNumber - traceNumber = networkIdentifiers.traceNumber - transactionId = networkIdentifiers.transactionId - additionalProperties = - networkIdentifiers.additionalProperties.toMutableMap() - } + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_CREDIT_PURCHASE_TOKEN = of("visa_credit_purchase_token") - /** - * The randomly generated 6-character Authorization Identification Response code - * sent back to the acquirer in an approved response. - */ - fun authorizationIdentificationResponse( - authorizationIdentificationResponse: String? - ) = - authorizationIdentificationResponse( - JsonField.ofNullable(authorizationIdentificationResponse) - ) + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_DEBIT_PURCHASE_TOKEN = of("visa_debit_purchase_token") - /** - * Alias for calling [Builder.authorizationIdentificationResponse] with - * `authorizationIdentificationResponse.orElse(null)`. - */ - fun authorizationIdentificationResponse( - authorizationIdentificationResponse: Optional - ) = - authorizationIdentificationResponse( - authorizationIdentificationResponse.getOrNull() - ) + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + @JvmField val VISA_CLEARING_TRANSMISSION = of("visa_clearing_transmission") - /** - * Sets [Builder.authorizationIdentificationResponse] to an arbitrary JSON - * value. - * - * You should usually call [Builder.authorizationIdentificationResponse] with a - * well-typed [String] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun authorizationIdentificationResponse( - authorizationIdentificationResponse: JsonField - ) = apply { - this.authorizationIdentificationResponse = - authorizationIdentificationResponse - } + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + @JvmField val VISA_DIRECT_AUTHORIZATION = of("visa_direct_authorization") - /** - * A life-cycle identifier used across e.g., an authorization and a reversal. - * Expected to be unique per acquirer within a window of time. For some card - * networks the retrieval reference number includes the trace counter. - */ - fun retrievalReferenceNumber(retrievalReferenceNumber: String?) = - retrievalReferenceNumber(JsonField.ofNullable(retrievalReferenceNumber)) + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + @JvmField + val VISA_DIRECT_TRANSACTION_DOMESTIC = + of("visa_direct_transaction_domestic") - /** - * Alias for calling [Builder.retrievalReferenceNumber] with - * `retrievalReferenceNumber.orElse(null)`. - */ - fun retrievalReferenceNumber(retrievalReferenceNumber: Optional) = - retrievalReferenceNumber(retrievalReferenceNumber.getOrNull()) + /** Issuer card service fee for Commercial Credit cards. */ + @JvmField + val VISA_SERVICE_COMMERCIAL_CREDIT = of("visa_service_commercial_credit") - /** - * Sets [Builder.retrievalReferenceNumber] to an arbitrary JSON value. - * - * You should usually call [Builder.retrievalReferenceNumber] with a well-typed - * [String] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun retrievalReferenceNumber(retrievalReferenceNumber: JsonField) = - apply { - this.retrievalReferenceNumber = retrievalReferenceNumber - } + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + @JvmField + val VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT = + of("visa_advertising_service_commercial_credit") - /** - * A counter used to verify an individual authorization. Expected to be unique - * per acquirer within a window of time. - */ - fun traceNumber(traceNumber: String?) = - traceNumber(JsonField.ofNullable(traceNumber)) + /** Issuer Community Growth Acceleration Program Fee. */ + @JvmField + val VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM = + of("visa_community_growth_acceleration_program") - /** Alias for calling [Builder.traceNumber] with `traceNumber.orElse(null)`. */ - fun traceNumber(traceNumber: Optional) = - traceNumber(traceNumber.getOrNull()) + /** Issuer Processing Guarantee for Commercial Credit cards. */ + @JvmField + val VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT = + of("visa_processing_guarantee_commercial_credit") + + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + @JvmField val PULSE_SWITCH_FEE = of("pulse_switch_fee") + + @JvmStatic fun of(value: String) = FeeType(JsonField.of(value)) + } + + /** An enum containing [FeeType]'s known values. */ + enum class Known { + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + VISA_ADVANCED_AUTHORIZATION, + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + VISA_MESSAGE_TRANSMISSION, + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_DOMESTIC, + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, + } /** - * Sets [Builder.traceNumber] to an arbitrary JSON value. + * An enum containing [FeeType]'s known values, as well as an [_UNKNOWN] member. * - * You should usually call [Builder.traceNumber] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * An instance of [FeeType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. */ - fun traceNumber(traceNumber: JsonField) = apply { - this.traceNumber = traceNumber + enum class Value { + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + VISA_ADVANCED_AUTHORIZATION, + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + VISA_MESSAGE_TRANSMISSION, + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_DOMESTIC, + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, + /** + * An enum member indicating that [FeeType] was instantiated with an unknown + * value. + */ + _UNKNOWN, } /** - * A globally unique transaction identifier provided by the card network, used - * across multiple life-cycle requests. + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. */ - fun transactionId(transactionId: String?) = - transactionId(JsonField.ofNullable(transactionId)) + fun value(): Value = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Value.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Value.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Value.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Value.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Value.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Value.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Value.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Value.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Value.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Value.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Value.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Value.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Value.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Value.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Value.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Value.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Value.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Value.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Value.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Value.PULSE_SWITCH_FEE + else -> Value._UNKNOWN + } /** - * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`. + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. */ - fun transactionId(transactionId: Optional) = - transactionId(transactionId.getOrNull()) + fun known(): Known = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Known.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Known.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Known.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Known.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Known.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Known.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Known.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Known.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Known.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Known.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Known.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Known.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Known.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Known.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Known.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Known.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Known.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Known.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Known.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Known.PULSE_SWITCH_FEE + else -> throw IncreaseInvalidDataException("Unknown FeeType: $value") + } /** - * Sets [Builder.transactionId] to an arbitrary JSON value. + * Returns this class instance's primitive wire representation. * - * You should usually call [Builder.transactionId] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. */ - fun transactionId(transactionId: JsonField) = apply { - this.transactionId = transactionId - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + private var validated: Boolean = false - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + fun validate(): FeeType = apply { + if (validated) { + return@apply } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + known() + validated = true } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } /** - * Returns an immutable instance of [NetworkIdentifiers]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .authorizationIdentificationResponse() - * .retrievalReferenceNumber() - * .traceNumber() - * .transactionId() - * ``` + * Returns a score indicating how many valid values are contained in this object + * recursively. * - * @throws IllegalStateException if any required field is unset. + * Used for best match union deserialization. */ - fun build(): NetworkIdentifiers = - NetworkIdentifiers( - checkRequired( - "authorizationIdentificationResponse", - authorizationIdentificationResponse, - ), - checkRequired("retrievalReferenceNumber", retrievalReferenceNumber), - checkRequired("traceNumber", traceNumber), - checkRequired("transactionId", transactionId), - additionalProperties.toMutableMap(), - ) - } + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - private var validated: Boolean = false + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun validate(): NetworkIdentifiers = apply { - if (validated) { - return@apply + return other is FeeType && value == other.value } - authorizationIdentificationResponse() - retrievalReferenceNumber() - traceNumber() - transactionId() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + override fun hashCode() = value.hashCode() - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (authorizationIdentificationResponse.asKnown().isPresent) 1 else 0) + - (if (retrievalReferenceNumber.asKnown().isPresent) 1 else 0) + - (if (traceNumber.asKnown().isPresent) 1 else 0) + - (if (transactionId.asKnown().isPresent) 1 else 0) + override fun toString() = value.toString() + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is NetworkIdentifiers && - authorizationIdentificationResponse == - other.authorizationIdentificationResponse && - retrievalReferenceNumber == other.retrievalReferenceNumber && - traceNumber == other.traceNumber && - transactionId == other.transactionId && + return other is SchemeFee && + amount == other.amount && + createdAt == other.createdAt && + currency == other.currency && + feeType == other.feeType && + fixedComponent == other.fixedComponent && + variableRate == other.variableRate && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { Objects.hash( - authorizationIdentificationResponse, - retrievalReferenceNumber, - traceNumber, - transactionId, + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, additionalProperties, ) } @@ -47045,7 +53858,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NetworkIdentifiers{authorizationIdentificationResponse=$authorizationIdentificationResponse, retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}" + "SchemeFee{amount=$amount, createdAt=$createdAt, currency=$currency, feeType=$feeType, fixedComponent=$fixedComponent, variableRate=$variableRate, additionalProperties=$additionalProperties}" } /** @@ -47188,6 +54001,7 @@ private constructor( network == other.network && networkIdentifiers == other.networkIdentifiers && pendingTransactionId == other.pendingTransactionId && + schemeFees == other.schemeFees && type == other.type && updatedAuthorizationAmount == other.updatedAuthorizationAmount && additionalProperties == other.additionalProperties @@ -47201,6 +54015,7 @@ private constructor( network, networkIdentifiers, pendingTransactionId, + schemeFees, type, updatedAuthorizationAmount, additionalProperties, @@ -47210,7 +54025,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CardFuelConfirmation{id=$id, cardAuthorizationId=$cardAuthorizationId, currency=$currency, network=$network, networkIdentifiers=$networkIdentifiers, pendingTransactionId=$pendingTransactionId, type=$type, updatedAuthorizationAmount=$updatedAuthorizationAmount, additionalProperties=$additionalProperties}" + "CardFuelConfirmation{id=$id, cardAuthorizationId=$cardAuthorizationId, currency=$currency, network=$network, networkIdentifiers=$networkIdentifiers, pendingTransactionId=$pendingTransactionId, schemeFees=$schemeFees, type=$type, updatedAuthorizationAmount=$updatedAuthorizationAmount, additionalProperties=$additionalProperties}" } /** @@ -47234,6 +54049,7 @@ private constructor( private val presentmentAmount: JsonField, private val presentmentCurrency: JsonField, private val realTimeDecisionId: JsonField, + private val schemeFees: JsonField>, private val type: JsonField, private val updatedAuthorizationAmount: JsonField, private val additionalProperties: MutableMap, @@ -47276,6 +54092,9 @@ private constructor( @JsonProperty("real_time_decision_id") @ExcludeMissing realTimeDecisionId: JsonField = JsonMissing.of(), + @JsonProperty("scheme_fees") + @ExcludeMissing + schemeFees: JsonField> = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), @JsonProperty("updated_authorization_amount") @ExcludeMissing @@ -47294,6 +54113,7 @@ private constructor( presentmentAmount, presentmentCurrency, realTimeDecisionId, + schemeFees, type, updatedAuthorizationAmount, mutableMapOf(), @@ -47429,6 +54249,15 @@ private constructor( fun realTimeDecisionId(): Optional = realTimeDecisionId.getOptional("real_time_decision_id") + /** + * The scheme fees associated with this card increment. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun schemeFees(): List = schemeFees.getRequired("scheme_fees") + /** * A constant representing the object's type. For this resource it will always be * `card_increment`. @@ -47571,6 +54400,16 @@ private constructor( @ExcludeMissing fun _realTimeDecisionId(): JsonField = realTimeDecisionId + /** + * Returns the raw JSON value of [schemeFees]. + * + * Unlike [schemeFees], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("scheme_fees") + @ExcludeMissing + fun _schemeFees(): JsonField> = schemeFees + /** * Returns the raw JSON value of [type]. * @@ -47620,6 +54459,7 @@ private constructor( * .presentmentAmount() * .presentmentCurrency() * .realTimeDecisionId() + * .schemeFees() * .type() * .updatedAuthorizationAmount() * ``` @@ -47643,6 +54483,7 @@ private constructor( private var presentmentAmount: JsonField? = null private var presentmentCurrency: JsonField? = null private var realTimeDecisionId: JsonField? = null + private var schemeFees: JsonField>? = null private var type: JsonField? = null private var updatedAuthorizationAmount: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -47662,6 +54503,7 @@ private constructor( presentmentAmount = cardIncrement.presentmentAmount presentmentCurrency = cardIncrement.presentmentCurrency realTimeDecisionId = cardIncrement.realTimeDecisionId + schemeFees = cardIncrement.schemeFees.map { it.toMutableList() } type = cardIncrement.type updatedAuthorizationAmount = cardIncrement.updatedAuthorizationAmount additionalProperties = cardIncrement.additionalProperties.toMutableMap() @@ -47903,6 +54745,32 @@ private constructor( this.realTimeDecisionId = realTimeDecisionId } + /** The scheme fees associated with this card increment. */ + fun schemeFees(schemeFees: List) = schemeFees(JsonField.of(schemeFees)) + + /** + * Sets [Builder.schemeFees] to an arbitrary JSON value. + * + * You should usually call [Builder.schemeFees] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun schemeFees(schemeFees: JsonField>) = apply { + this.schemeFees = schemeFees.map { it.toMutableList() } + } + + /** + * Adds a single [SchemeFee] to [schemeFees]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addSchemeFee(schemeFee: SchemeFee) = apply { + schemeFees = + (schemeFees ?: JsonField.of(mutableListOf())).also { + checkKnown("schemeFees", it).add(schemeFee) + } + } + /** * A constant representing the object's type. For this resource it will always be * `card_increment`. @@ -47979,6 +54847,7 @@ private constructor( * .presentmentAmount() * .presentmentCurrency() * .realTimeDecisionId() + * .schemeFees() * .type() * .updatedAuthorizationAmount() * ``` @@ -48000,6 +54869,7 @@ private constructor( checkRequired("presentmentAmount", presentmentAmount), checkRequired("presentmentCurrency", presentmentCurrency), checkRequired("realTimeDecisionId", realTimeDecisionId), + checkRequired("schemeFees", schemeFees).map { it.toImmutable() }, checkRequired("type", type), checkRequired("updatedAuthorizationAmount", updatedAuthorizationAmount), additionalProperties.toMutableMap(), @@ -48026,6 +54896,7 @@ private constructor( presentmentAmount() presentmentCurrency() realTimeDecisionId() + schemeFees().forEach { it.validate() } type().validate() updatedAuthorizationAmount() validated = true @@ -48060,6 +54931,7 @@ private constructor( (if (presentmentAmount.asKnown().isPresent) 1 else 0) + (if (presentmentCurrency.asKnown().isPresent) 1 else 0) + (if (realTimeDecisionId.asKnown().isPresent) 1 else 0) + + (schemeFees.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (type.asKnown().getOrNull()?.validity() ?: 0) + (if (updatedAuthorizationAmount.asKnown().isPresent) 1 else 0) @@ -51618,55 +58490,484 @@ private constructor( * [String] value instead. This method is primarily for setting the field to an * undocumented or not yet supported value. */ - fun retrievalReferenceNumber(retrievalReferenceNumber: JsonField) = - apply { - this.retrievalReferenceNumber = retrievalReferenceNumber - } + fun retrievalReferenceNumber(retrievalReferenceNumber: JsonField) = + apply { + this.retrievalReferenceNumber = retrievalReferenceNumber + } + + /** + * A counter used to verify an individual authorization. Expected to be unique + * per acquirer within a window of time. + */ + fun traceNumber(traceNumber: String?) = + traceNumber(JsonField.ofNullable(traceNumber)) + + /** Alias for calling [Builder.traceNumber] with `traceNumber.orElse(null)`. */ + fun traceNumber(traceNumber: Optional) = + traceNumber(traceNumber.getOrNull()) + + /** + * Sets [Builder.traceNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.traceNumber] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun traceNumber(traceNumber: JsonField) = apply { + this.traceNumber = traceNumber + } + + /** + * A globally unique transaction identifier provided by the card network, used + * across multiple life-cycle requests. + */ + fun transactionId(transactionId: String?) = + transactionId(JsonField.ofNullable(transactionId)) + + /** + * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`. + */ + fun transactionId(transactionId: Optional) = + transactionId(transactionId.getOrNull()) + + /** + * Sets [Builder.transactionId] to an arbitrary JSON value. + * + * You should usually call [Builder.transactionId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun transactionId(transactionId: JsonField) = apply { + this.transactionId = transactionId + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [NetworkIdentifiers]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .authorizationIdentificationResponse() + * .retrievalReferenceNumber() + * .traceNumber() + * .transactionId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): NetworkIdentifiers = + NetworkIdentifiers( + checkRequired( + "authorizationIdentificationResponse", + authorizationIdentificationResponse, + ), + checkRequired("retrievalReferenceNumber", retrievalReferenceNumber), + checkRequired("traceNumber", traceNumber), + checkRequired("transactionId", transactionId), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): NetworkIdentifiers = apply { + if (validated) { + return@apply + } + + authorizationIdentificationResponse() + retrievalReferenceNumber() + traceNumber() + transactionId() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (authorizationIdentificationResponse.asKnown().isPresent) 1 else 0) + + (if (retrievalReferenceNumber.asKnown().isPresent) 1 else 0) + + (if (traceNumber.asKnown().isPresent) 1 else 0) + + (if (transactionId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is NetworkIdentifiers && + authorizationIdentificationResponse == + other.authorizationIdentificationResponse && + retrievalReferenceNumber == other.retrievalReferenceNumber && + traceNumber == other.traceNumber && + transactionId == other.transactionId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + authorizationIdentificationResponse, + retrievalReferenceNumber, + traceNumber, + transactionId, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "NetworkIdentifiers{authorizationIdentificationResponse=$authorizationIdentificationResponse, retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}" + } + + class SchemeFee + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val amount: JsonField, + private val createdAt: JsonField, + private val currency: JsonField, + private val feeType: JsonField, + private val fixedComponent: JsonField, + private val variableRate: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + createdAt: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("fee_type") + @ExcludeMissing + feeType: JsonField = JsonMissing.of(), + @JsonProperty("fixed_component") + @ExcludeMissing + fixedComponent: JsonField = JsonMissing.of(), + @JsonProperty("variable_rate") + @ExcludeMissing + variableRate: JsonField = JsonMissing.of(), + ) : this( + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, + mutableMapOf(), + ) + + /** + * The fee amount given as a string containing a decimal number. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun amount(): String = amount.getRequired("amount") + + /** + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + * created. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun currency(): Currency = currency.getRequired("currency") + + /** + * The type of fee being assessed. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun feeType(): FeeType = feeType.getRequired("fee_type") + + /** + * The fixed component of the fee, if applicable, given in major units of the fee + * amount. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun fixedComponent(): Optional = + fixedComponent.getOptional("fixed_component") + + /** + * The variable rate component of the fee, if applicable, given as a decimal (e.g., + * 0.015 for 1.5%). + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun variableRate(): Optional = variableRate.getOptional("variable_rate") + + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + + /** + * Returns the raw JSON value of [createdAt]. + * + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("created_at") + @ExcludeMissing + fun _createdAt(): JsonField = createdAt + + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("currency") + @ExcludeMissing + fun _currency(): JsonField = currency + + /** + * Returns the raw JSON value of [feeType]. + * + * Unlike [feeType], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("fee_type") + @ExcludeMissing + fun _feeType(): JsonField = feeType + + /** + * Returns the raw JSON value of [fixedComponent]. + * + * Unlike [fixedComponent], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("fixed_component") + @ExcludeMissing + fun _fixedComponent(): JsonField = fixedComponent + + /** + * Returns the raw JSON value of [variableRate]. + * + * Unlike [variableRate], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("variable_rate") + @ExcludeMissing + fun _variableRate(): JsonField = variableRate + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [SchemeFee]. + * + * The following fields are required: + * ```java + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SchemeFee]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var createdAt: JsonField? = null + private var currency: JsonField? = null + private var feeType: JsonField? = null + private var fixedComponent: JsonField? = null + private var variableRate: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(schemeFee: SchemeFee) = apply { + amount = schemeFee.amount + createdAt = schemeFee.createdAt + currency = schemeFee.currency + feeType = schemeFee.feeType + fixedComponent = schemeFee.fixedComponent + variableRate = schemeFee.variableRate + additionalProperties = schemeFee.additionalProperties.toMutableMap() + } + + /** The fee amount given as a string containing a decimal number. */ + fun amount(amount: String) = amount(JsonField.of(amount)) + + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun amount(amount: JsonField) = apply { this.amount = amount } + + /** + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee + * was created. + */ + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + /** + * Sets [Builder.createdAt] to an arbitrary JSON value. + * + * You should usually call [Builder.createdAt] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt + } + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + */ + fun currency(currency: Currency) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [Currency] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } + + /** The type of fee being assessed. */ + fun feeType(feeType: FeeType) = feeType(JsonField.of(feeType)) + + /** + * Sets [Builder.feeType] to an arbitrary JSON value. + * + * You should usually call [Builder.feeType] with a well-typed [FeeType] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun feeType(feeType: JsonField) = apply { this.feeType = feeType } /** - * A counter used to verify an individual authorization. Expected to be unique - * per acquirer within a window of time. + * The fixed component of the fee, if applicable, given in major units of the + * fee amount. */ - fun traceNumber(traceNumber: String?) = - traceNumber(JsonField.ofNullable(traceNumber)) + fun fixedComponent(fixedComponent: String?) = + fixedComponent(JsonField.ofNullable(fixedComponent)) - /** Alias for calling [Builder.traceNumber] with `traceNumber.orElse(null)`. */ - fun traceNumber(traceNumber: Optional) = - traceNumber(traceNumber.getOrNull()) + /** + * Alias for calling [Builder.fixedComponent] with + * `fixedComponent.orElse(null)`. + */ + fun fixedComponent(fixedComponent: Optional) = + fixedComponent(fixedComponent.getOrNull()) /** - * Sets [Builder.traceNumber] to an arbitrary JSON value. + * Sets [Builder.fixedComponent] to an arbitrary JSON value. * - * You should usually call [Builder.traceNumber] with a well-typed [String] + * You should usually call [Builder.fixedComponent] with a well-typed [String] * value instead. This method is primarily for setting the field to an * undocumented or not yet supported value. */ - fun traceNumber(traceNumber: JsonField) = apply { - this.traceNumber = traceNumber + fun fixedComponent(fixedComponent: JsonField) = apply { + this.fixedComponent = fixedComponent } /** - * A globally unique transaction identifier provided by the card network, used - * across multiple life-cycle requests. + * The variable rate component of the fee, if applicable, given as a decimal + * (e.g., 0.015 for 1.5%). */ - fun transactionId(transactionId: String?) = - transactionId(JsonField.ofNullable(transactionId)) + fun variableRate(variableRate: String?) = + variableRate(JsonField.ofNullable(variableRate)) /** - * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`. + * Alias for calling [Builder.variableRate] with `variableRate.orElse(null)`. */ - fun transactionId(transactionId: Optional) = - transactionId(transactionId.getOrNull()) + fun variableRate(variableRate: Optional) = + variableRate(variableRate.getOrNull()) /** - * Sets [Builder.transactionId] to an arbitrary JSON value. + * Sets [Builder.variableRate] to an arbitrary JSON value. * - * You should usually call [Builder.transactionId] with a well-typed [String] + * You should usually call [Builder.variableRate] with a well-typed [String] * value instead. This method is primarily for setting the field to an * undocumented or not yet supported value. */ - fun transactionId(transactionId: JsonField) = apply { - this.transactionId = transactionId + fun variableRate(variableRate: JsonField) = apply { + this.variableRate = variableRate } fun additionalProperties(additionalProperties: Map) = apply { @@ -51692,88 +58993,974 @@ private constructor( } /** - * Returns an immutable instance of [NetworkIdentifiers]. + * Returns an immutable instance of [SchemeFee]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .authorizationIdentificationResponse() - * .retrievalReferenceNumber() - * .traceNumber() - * .transactionId() + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): NetworkIdentifiers = - NetworkIdentifiers( - checkRequired( - "authorizationIdentificationResponse", - authorizationIdentificationResponse, - ), - checkRequired("retrievalReferenceNumber", retrievalReferenceNumber), - checkRequired("traceNumber", traceNumber), - checkRequired("transactionId", transactionId), + fun build(): SchemeFee = + SchemeFee( + checkRequired("amount", amount), + checkRequired("createdAt", createdAt), + checkRequired("currency", currency), + checkRequired("feeType", feeType), + checkRequired("fixedComponent", fixedComponent), + checkRequired("variableRate", variableRate), additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): NetworkIdentifiers = apply { + fun validate(): SchemeFee = apply { if (validated) { return@apply } - authorizationIdentificationResponse() - retrievalReferenceNumber() - traceNumber() - transactionId() + amount() + createdAt() + currency().validate() + feeType().validate() + fixedComponent() + variableRate() validated = true } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (currency.asKnown().getOrNull()?.validity() ?: 0) + + (feeType.asKnown().getOrNull()?.validity() ?: 0) + + (if (fixedComponent.asKnown().isPresent) 1 else 0) + + (if (variableRate.asKnown().isPresent) 1 else 0) + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + */ + class Currency + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** US Dollar (USD) */ + @JvmField val USD = of("USD") + + @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) + } + + /** An enum containing [Currency]'s known values. */ + enum class Known { + /** US Dollar (USD) */ + USD + } + + /** + * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Currency] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** US Dollar (USD) */ + USD, + /** + * An enum member indicating that [Currency] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + USD -> Value.USD + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + USD -> Known.USD + else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Currency = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Currency && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** The type of fee being assessed. */ + class FeeType + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY = + of("visa_international_service_assessment_single_currency") + + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY = + of("visa_international_service_assessment_cross_currency") + + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + @JvmField + val VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE = + of("visa_authorization_domestic_point_of_sale") + + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + @JvmField + val VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_international_point_of_sale") + + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + @JvmField + val VISA_AUTHORIZATION_CANADA_POINT_OF_SALE = + of("visa_authorization_canada_point_of_sale") + + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + @JvmField + val VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE = + of("visa_authorization_reversal_point_of_sale") + + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + @JvmField + val VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_reversal_international_point_of_sale") + + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + @JvmField + val VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE = + of("visa_authorization_address_verification_service") + + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + @JvmField + val VISA_ADVANCED_AUTHORIZATION = of("visa_advanced_authorization") + + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + @JvmField val VISA_MESSAGE_TRANSMISSION = of("visa_message_transmission") + + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_DOMESTIC = + of("visa_account_verification_domestic") + + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_INTERNATIONAL = + of("visa_account_verification_international") + + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_CANADA = + of("visa_account_verification_canada") + + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + @JvmField + val VISA_CORPORATE_ACCEPTANCE_FEE = of("visa_corporate_acceptance_fee") + + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + @JvmField + val VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE = + of("visa_consumer_debit_acceptance_fee") + + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + @JvmField + val VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE = + of("visa_business_debit_acceptance_fee") + + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + @JvmField + val VISA_PURCHASING_ACCEPTANCE_FEE = of("visa_purchasing_acceptance_fee") + + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + @JvmField val VISA_PURCHASE_DOMESTIC = of("visa_purchase_domestic") + + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + @JvmField + val VISA_PURCHASE_INTERNATIONAL = of("visa_purchase_international") + + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_CREDIT_PURCHASE_TOKEN = of("visa_credit_purchase_token") + + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_DEBIT_PURCHASE_TOKEN = of("visa_debit_purchase_token") + + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + @JvmField val VISA_CLEARING_TRANSMISSION = of("visa_clearing_transmission") + + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + @JvmField val VISA_DIRECT_AUTHORIZATION = of("visa_direct_authorization") + + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + @JvmField + val VISA_DIRECT_TRANSACTION_DOMESTIC = + of("visa_direct_transaction_domestic") + + /** Issuer card service fee for Commercial Credit cards. */ + @JvmField + val VISA_SERVICE_COMMERCIAL_CREDIT = of("visa_service_commercial_credit") + + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + @JvmField + val VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT = + of("visa_advertising_service_commercial_credit") + + /** Issuer Community Growth Acceleration Program Fee. */ + @JvmField + val VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM = + of("visa_community_growth_acceleration_program") + + /** Issuer Processing Guarantee for Commercial Credit cards. */ + @JvmField + val VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT = + of("visa_processing_guarantee_commercial_credit") + + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + @JvmField val PULSE_SWITCH_FEE = of("pulse_switch_fee") + + @JvmStatic fun of(value: String) = FeeType(JsonField.of(value)) + } + + /** An enum containing [FeeType]'s known values. */ + enum class Known { + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + VISA_ADVANCED_AUTHORIZATION, + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + VISA_MESSAGE_TRANSMISSION, + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_DOMESTIC, + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, + } + + /** + * An enum containing [FeeType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [FeeType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + VISA_ADVANCED_AUTHORIZATION, + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + VISA_MESSAGE_TRANSMISSION, + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_DOMESTIC, + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, + /** + * An enum member indicating that [FeeType] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Value.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Value.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Value.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Value.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Value.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Value.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Value.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Value.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Value.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Value.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Value.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Value.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Value.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Value.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Value.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Value.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Value.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Value.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Value.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Value.PULSE_SWITCH_FEE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Known.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Known.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Known.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Known.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Known.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Known.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Known.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Known.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Known.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Known.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Known.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Known.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Known.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Known.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Known.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Known.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Known.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Known.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Known.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Known.PULSE_SWITCH_FEE + else -> throw IncreaseInvalidDataException("Unknown FeeType: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): FeeType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is FeeType && value == other.value } - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (authorizationIdentificationResponse.asKnown().isPresent) 1 else 0) + - (if (retrievalReferenceNumber.asKnown().isPresent) 1 else 0) + - (if (traceNumber.asKnown().isPresent) 1 else 0) + - (if (transactionId.asKnown().isPresent) 1 else 0) + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is NetworkIdentifiers && - authorizationIdentificationResponse == - other.authorizationIdentificationResponse && - retrievalReferenceNumber == other.retrievalReferenceNumber && - traceNumber == other.traceNumber && - transactionId == other.transactionId && + return other is SchemeFee && + amount == other.amount && + createdAt == other.createdAt && + currency == other.currency && + feeType == other.feeType && + fixedComponent == other.fixedComponent && + variableRate == other.variableRate && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { Objects.hash( - authorizationIdentificationResponse, - retrievalReferenceNumber, - traceNumber, - transactionId, + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, additionalProperties, ) } @@ -51781,7 +59968,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NetworkIdentifiers{authorizationIdentificationResponse=$authorizationIdentificationResponse, retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}" + "SchemeFee{amount=$amount, createdAt=$createdAt, currency=$currency, feeType=$feeType, fixedComponent=$fixedComponent, variableRate=$variableRate, additionalProperties=$additionalProperties}" } /** @@ -51931,6 +60118,7 @@ private constructor( presentmentAmount == other.presentmentAmount && presentmentCurrency == other.presentmentCurrency && realTimeDecisionId == other.realTimeDecisionId && + schemeFees == other.schemeFees && type == other.type && updatedAuthorizationAmount == other.updatedAuthorizationAmount && additionalProperties == other.additionalProperties @@ -51951,6 +60139,7 @@ private constructor( presentmentAmount, presentmentCurrency, realTimeDecisionId, + schemeFees, type, updatedAuthorizationAmount, additionalProperties, @@ -51960,7 +60149,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CardIncrement{id=$id, actioner=$actioner, additionalAmounts=$additionalAmounts, amount=$amount, cardAuthorizationId=$cardAuthorizationId, currency=$currency, network=$network, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, pendingTransactionId=$pendingTransactionId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, realTimeDecisionId=$realTimeDecisionId, type=$type, updatedAuthorizationAmount=$updatedAuthorizationAmount, additionalProperties=$additionalProperties}" + "CardIncrement{id=$id, actioner=$actioner, additionalAmounts=$additionalAmounts, amount=$amount, cardAuthorizationId=$cardAuthorizationId, currency=$currency, network=$network, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, pendingTransactionId=$pendingTransactionId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, realTimeDecisionId=$realTimeDecisionId, schemeFees=$schemeFees, type=$type, updatedAuthorizationAmount=$updatedAuthorizationAmount, additionalProperties=$additionalProperties}" } /** @@ -51989,6 +60178,7 @@ private constructor( private val presentmentAmount: JsonField, private val presentmentCurrency: JsonField, private val purchaseDetails: JsonField, + private val schemeFees: JsonField>, private val transactionId: JsonField, private val type: JsonField, private val additionalProperties: MutableMap, @@ -52043,6 +60233,9 @@ private constructor( @JsonProperty("purchase_details") @ExcludeMissing purchaseDetails: JsonField = JsonMissing.of(), + @JsonProperty("scheme_fees") + @ExcludeMissing + schemeFees: JsonField> = JsonMissing.of(), @JsonProperty("transaction_id") @ExcludeMissing transactionId: JsonField = JsonMissing.of(), @@ -52065,6 +60258,7 @@ private constructor( presentmentAmount, presentmentCurrency, purchaseDetails, + schemeFees, transactionId, type, mutableMapOf(), @@ -52229,6 +60423,15 @@ private constructor( fun purchaseDetails(): Optional = purchaseDetails.getOptional("purchase_details") + /** + * The scheme fees associated with this card refund. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun schemeFees(): List = schemeFees.getRequired("scheme_fees") + /** * The identifier of the Transaction associated with this Transaction. * @@ -52322,129 +60525,584 @@ private constructor( @ExcludeMissing fun _merchantCategoryCode(): JsonField = merchantCategoryCode - /** - * Returns the raw JSON value of [merchantCity]. - * - * Unlike [merchantCity], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("merchant_city") - @ExcludeMissing - fun _merchantCity(): JsonField = merchantCity + /** + * Returns the raw JSON value of [merchantCity]. + * + * Unlike [merchantCity], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("merchant_city") + @ExcludeMissing + fun _merchantCity(): JsonField = merchantCity + + /** + * Returns the raw JSON value of [merchantCountry]. + * + * Unlike [merchantCountry], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("merchant_country") + @ExcludeMissing + fun _merchantCountry(): JsonField = merchantCountry + + /** + * Returns the raw JSON value of [merchantName]. + * + * Unlike [merchantName], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("merchant_name") + @ExcludeMissing + fun _merchantName(): JsonField = merchantName + + /** + * Returns the raw JSON value of [merchantPostalCode]. + * + * Unlike [merchantPostalCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("merchant_postal_code") + @ExcludeMissing + fun _merchantPostalCode(): JsonField = merchantPostalCode + + /** + * Returns the raw JSON value of [merchantState]. + * + * Unlike [merchantState], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("merchant_state") + @ExcludeMissing + fun _merchantState(): JsonField = merchantState + + /** + * Returns the raw JSON value of [networkIdentifiers]. + * + * Unlike [networkIdentifiers], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("network_identifiers") + @ExcludeMissing + fun _networkIdentifiers(): JsonField = networkIdentifiers + + /** + * Returns the raw JSON value of [presentmentAmount]. + * + * Unlike [presentmentAmount], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("presentment_amount") + @ExcludeMissing + fun _presentmentAmount(): JsonField = presentmentAmount + + /** + * Returns the raw JSON value of [presentmentCurrency]. + * + * Unlike [presentmentCurrency], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("presentment_currency") + @ExcludeMissing + fun _presentmentCurrency(): JsonField = presentmentCurrency + + /** + * Returns the raw JSON value of [purchaseDetails]. + * + * Unlike [purchaseDetails], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("purchase_details") + @ExcludeMissing + fun _purchaseDetails(): JsonField = purchaseDetails + + /** + * Returns the raw JSON value of [schemeFees]. + * + * Unlike [schemeFees], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("scheme_fees") + @ExcludeMissing + fun _schemeFees(): JsonField> = schemeFees + + /** + * Returns the raw JSON value of [transactionId]. + * + * Unlike [transactionId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("transaction_id") + @ExcludeMissing + fun _transactionId(): JsonField = transactionId + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [CardRefund]. + * + * The following fields are required: + * ```java + * .id() + * .amount() + * .cardPaymentId() + * .cashback() + * .currency() + * .interchange() + * .merchantAcceptorId() + * .merchantCategoryCode() + * .merchantCity() + * .merchantCountry() + * .merchantName() + * .merchantPostalCode() + * .merchantState() + * .networkIdentifiers() + * .presentmentAmount() + * .presentmentCurrency() + * .purchaseDetails() + * .schemeFees() + * .transactionId() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [CardRefund]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var amount: JsonField? = null + private var cardPaymentId: JsonField? = null + private var cashback: JsonField? = null + private var currency: JsonField? = null + private var interchange: JsonField? = null + private var merchantAcceptorId: JsonField? = null + private var merchantCategoryCode: JsonField? = null + private var merchantCity: JsonField? = null + private var merchantCountry: JsonField? = null + private var merchantName: JsonField? = null + private var merchantPostalCode: JsonField? = null + private var merchantState: JsonField? = null + private var networkIdentifiers: JsonField? = null + private var presentmentAmount: JsonField? = null + private var presentmentCurrency: JsonField? = null + private var purchaseDetails: JsonField? = null + private var schemeFees: JsonField>? = null + private var transactionId: JsonField? = null + private var type: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(cardRefund: CardRefund) = apply { + id = cardRefund.id + amount = cardRefund.amount + cardPaymentId = cardRefund.cardPaymentId + cashback = cardRefund.cashback + currency = cardRefund.currency + interchange = cardRefund.interchange + merchantAcceptorId = cardRefund.merchantAcceptorId + merchantCategoryCode = cardRefund.merchantCategoryCode + merchantCity = cardRefund.merchantCity + merchantCountry = cardRefund.merchantCountry + merchantName = cardRefund.merchantName + merchantPostalCode = cardRefund.merchantPostalCode + merchantState = cardRefund.merchantState + networkIdentifiers = cardRefund.networkIdentifiers + presentmentAmount = cardRefund.presentmentAmount + presentmentCurrency = cardRefund.presentmentCurrency + purchaseDetails = cardRefund.purchaseDetails + schemeFees = cardRefund.schemeFees.map { it.toMutableList() } + transactionId = cardRefund.transactionId + type = cardRefund.type + additionalProperties = cardRefund.additionalProperties.toMutableMap() + } + + /** The Card Refund identifier. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** + * The amount in the minor unit of the transaction's settlement currency. For + * dollars, for example, this is cents. + */ + fun amount(amount: Long) = amount(JsonField.of(amount)) + + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun amount(amount: JsonField) = apply { this.amount = amount } + + /** The ID of the Card Payment this transaction belongs to. */ + fun cardPaymentId(cardPaymentId: String) = + cardPaymentId(JsonField.of(cardPaymentId)) + + /** + * Sets [Builder.cardPaymentId] to an arbitrary JSON value. + * + * You should usually call [Builder.cardPaymentId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun cardPaymentId(cardPaymentId: JsonField) = apply { + this.cardPaymentId = cardPaymentId + } + + /** + * Cashback debited for this transaction, if eligible. Cashback is paid out in + * aggregate, monthly. + */ + fun cashback(cashback: Cashback?) = cashback(JsonField.ofNullable(cashback)) + + /** Alias for calling [Builder.cashback] with `cashback.orElse(null)`. */ + fun cashback(cashback: Optional) = cashback(cashback.getOrNull()) + + /** + * Sets [Builder.cashback] to an arbitrary JSON value. + * + * You should usually call [Builder.cashback] with a well-typed [Cashback] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun cashback(cashback: JsonField) = apply { this.cashback = cashback } + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's + * settlement currency. + */ + fun currency(currency: Currency) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [Currency] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } + + /** Interchange assessed as a part of this transaction. */ + fun interchange(interchange: Interchange?) = + interchange(JsonField.ofNullable(interchange)) + + /** Alias for calling [Builder.interchange] with `interchange.orElse(null)`. */ + fun interchange(interchange: Optional) = + interchange(interchange.getOrNull()) + + /** + * Sets [Builder.interchange] to an arbitrary JSON value. + * + * You should usually call [Builder.interchange] with a well-typed [Interchange] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun interchange(interchange: JsonField) = apply { + this.interchange = interchange + } + + /** + * The merchant identifier (commonly abbreviated as MID) of the merchant the card is + * transacting with. + */ + fun merchantAcceptorId(merchantAcceptorId: String) = + merchantAcceptorId(JsonField.of(merchantAcceptorId)) + + /** + * Sets [Builder.merchantAcceptorId] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantAcceptorId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun merchantAcceptorId(merchantAcceptorId: JsonField) = apply { + this.merchantAcceptorId = merchantAcceptorId + } + + /** The 4-digit MCC describing the merchant's business. */ + fun merchantCategoryCode(merchantCategoryCode: String) = + merchantCategoryCode(JsonField.of(merchantCategoryCode)) + + /** + * Sets [Builder.merchantCategoryCode] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantCategoryCode] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun merchantCategoryCode(merchantCategoryCode: JsonField) = apply { + this.merchantCategoryCode = merchantCategoryCode + } + + /** The city the merchant resides in. */ + fun merchantCity(merchantCity: String) = merchantCity(JsonField.of(merchantCity)) + + /** + * Sets [Builder.merchantCity] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantCity] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun merchantCity(merchantCity: JsonField) = apply { + this.merchantCity = merchantCity + } + + /** The country the merchant resides in. */ + fun merchantCountry(merchantCountry: String) = + merchantCountry(JsonField.of(merchantCountry)) + + /** + * Sets [Builder.merchantCountry] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantCountry] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun merchantCountry(merchantCountry: JsonField) = apply { + this.merchantCountry = merchantCountry + } + + /** The name of the merchant. */ + fun merchantName(merchantName: String) = merchantName(JsonField.of(merchantName)) + + /** + * Sets [Builder.merchantName] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun merchantName(merchantName: JsonField) = apply { + this.merchantName = merchantName + } + + /** + * The merchant's postal code. For US merchants this is always a 5-digit ZIP code. + */ + fun merchantPostalCode(merchantPostalCode: String?) = + merchantPostalCode(JsonField.ofNullable(merchantPostalCode)) + + /** + * Alias for calling [Builder.merchantPostalCode] with + * `merchantPostalCode.orElse(null)`. + */ + fun merchantPostalCode(merchantPostalCode: Optional) = + merchantPostalCode(merchantPostalCode.getOrNull()) + + /** + * Sets [Builder.merchantPostalCode] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantPostalCode] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun merchantPostalCode(merchantPostalCode: JsonField) = apply { + this.merchantPostalCode = merchantPostalCode + } + + /** The state the merchant resides in. */ + fun merchantState(merchantState: String?) = + merchantState(JsonField.ofNullable(merchantState)) + + /** Alias for calling [Builder.merchantState] with `merchantState.orElse(null)`. */ + fun merchantState(merchantState: Optional) = + merchantState(merchantState.getOrNull()) + + /** + * Sets [Builder.merchantState] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantState] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun merchantState(merchantState: JsonField) = apply { + this.merchantState = merchantState + } + + /** Network-specific identifiers for this refund. */ + fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) = + networkIdentifiers(JsonField.of(networkIdentifiers)) + + /** + * Sets [Builder.networkIdentifiers] to an arbitrary JSON value. + * + * You should usually call [Builder.networkIdentifiers] with a well-typed + * [NetworkIdentifiers] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun networkIdentifiers(networkIdentifiers: JsonField) = apply { + this.networkIdentifiers = networkIdentifiers + } + + /** The amount in the minor unit of the transaction's presentment currency. */ + fun presentmentAmount(presentmentAmount: Long) = + presentmentAmount(JsonField.of(presentmentAmount)) + + /** + * Sets [Builder.presentmentAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.presentmentAmount] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun presentmentAmount(presentmentAmount: JsonField) = apply { + this.presentmentAmount = presentmentAmount + } + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's + * presentment currency. + */ + fun presentmentCurrency(presentmentCurrency: String) = + presentmentCurrency(JsonField.of(presentmentCurrency)) + + /** + * Sets [Builder.presentmentCurrency] to an arbitrary JSON value. + * + * You should usually call [Builder.presentmentCurrency] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun presentmentCurrency(presentmentCurrency: JsonField) = apply { + this.presentmentCurrency = presentmentCurrency + } + + /** + * Additional details about the card purchase, such as tax and industry-specific + * fields. + */ + fun purchaseDetails(purchaseDetails: PurchaseDetails?) = + purchaseDetails(JsonField.ofNullable(purchaseDetails)) - /** - * Returns the raw JSON value of [merchantCountry]. - * - * Unlike [merchantCountry], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("merchant_country") - @ExcludeMissing - fun _merchantCountry(): JsonField = merchantCountry + /** + * Alias for calling [Builder.purchaseDetails] with `purchaseDetails.orElse(null)`. + */ + fun purchaseDetails(purchaseDetails: Optional) = + purchaseDetails(purchaseDetails.getOrNull()) - /** - * Returns the raw JSON value of [merchantName]. - * - * Unlike [merchantName], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("merchant_name") - @ExcludeMissing - fun _merchantName(): JsonField = merchantName + /** + * Sets [Builder.purchaseDetails] to an arbitrary JSON value. + * + * You should usually call [Builder.purchaseDetails] with a well-typed + * [PurchaseDetails] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun purchaseDetails(purchaseDetails: JsonField) = apply { + this.purchaseDetails = purchaseDetails + } - /** - * Returns the raw JSON value of [merchantPostalCode]. - * - * Unlike [merchantPostalCode], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("merchant_postal_code") - @ExcludeMissing - fun _merchantPostalCode(): JsonField = merchantPostalCode + /** The scheme fees associated with this card refund. */ + fun schemeFees(schemeFees: List) = schemeFees(JsonField.of(schemeFees)) - /** - * Returns the raw JSON value of [merchantState]. - * - * Unlike [merchantState], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("merchant_state") - @ExcludeMissing - fun _merchantState(): JsonField = merchantState + /** + * Sets [Builder.schemeFees] to an arbitrary JSON value. + * + * You should usually call [Builder.schemeFees] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun schemeFees(schemeFees: JsonField>) = apply { + this.schemeFees = schemeFees.map { it.toMutableList() } + } - /** - * Returns the raw JSON value of [networkIdentifiers]. - * - * Unlike [networkIdentifiers], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("network_identifiers") - @ExcludeMissing - fun _networkIdentifiers(): JsonField = networkIdentifiers + /** + * Adds a single [SchemeFee] to [schemeFees]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addSchemeFee(schemeFee: SchemeFee) = apply { + schemeFees = + (schemeFees ?: JsonField.of(mutableListOf())).also { + checkKnown("schemeFees", it).add(schemeFee) + } + } - /** - * Returns the raw JSON value of [presentmentAmount]. - * - * Unlike [presentmentAmount], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("presentment_amount") - @ExcludeMissing - fun _presentmentAmount(): JsonField = presentmentAmount + /** The identifier of the Transaction associated with this Transaction. */ + fun transactionId(transactionId: String) = + transactionId(JsonField.of(transactionId)) - /** - * Returns the raw JSON value of [presentmentCurrency]. - * - * Unlike [presentmentCurrency], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("presentment_currency") - @ExcludeMissing - fun _presentmentCurrency(): JsonField = presentmentCurrency + /** + * Sets [Builder.transactionId] to an arbitrary JSON value. + * + * You should usually call [Builder.transactionId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun transactionId(transactionId: JsonField) = apply { + this.transactionId = transactionId + } - /** - * Returns the raw JSON value of [purchaseDetails]. - * - * Unlike [purchaseDetails], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("purchase_details") - @ExcludeMissing - fun _purchaseDetails(): JsonField = purchaseDetails + /** + * A constant representing the object's type. For this resource it will always be + * `card_refund`. + */ + fun type(type: Type) = type(JsonField.of(type)) - /** - * Returns the raw JSON value of [transactionId]. - * - * Unlike [transactionId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("transaction_id") - @ExcludeMissing - fun _transactionId(): JsonField = transactionId + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun type(type: JsonField) = apply { this.type = type } - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun toBuilder() = Builder().from(this) + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - companion object { + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } /** - * Returns a mutable builder for constructing an instance of [CardRefund]. + * Returns an immutable instance of [CardRefund]. + * + * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java @@ -52465,526 +61123,602 @@ private constructor( * .presentmentAmount() * .presentmentCurrency() * .purchaseDetails() + * .schemeFees() * .transactionId() * .type() * ``` + * + * @throws IllegalStateException if any required field is unset. */ - @JvmStatic fun builder() = Builder() + fun build(): CardRefund = + CardRefund( + checkRequired("id", id), + checkRequired("amount", amount), + checkRequired("cardPaymentId", cardPaymentId), + checkRequired("cashback", cashback), + checkRequired("currency", currency), + checkRequired("interchange", interchange), + checkRequired("merchantAcceptorId", merchantAcceptorId), + checkRequired("merchantCategoryCode", merchantCategoryCode), + checkRequired("merchantCity", merchantCity), + checkRequired("merchantCountry", merchantCountry), + checkRequired("merchantName", merchantName), + checkRequired("merchantPostalCode", merchantPostalCode), + checkRequired("merchantState", merchantState), + checkRequired("networkIdentifiers", networkIdentifiers), + checkRequired("presentmentAmount", presentmentAmount), + checkRequired("presentmentCurrency", presentmentCurrency), + checkRequired("purchaseDetails", purchaseDetails), + checkRequired("schemeFees", schemeFees).map { it.toImmutable() }, + checkRequired("transactionId", transactionId), + checkRequired("type", type), + additionalProperties.toMutableMap(), + ) } - /** A builder for [CardRefund]. */ - class Builder internal constructor() { + private var validated: Boolean = false - private var id: JsonField? = null - private var amount: JsonField? = null - private var cardPaymentId: JsonField? = null - private var cashback: JsonField? = null - private var currency: JsonField? = null - private var interchange: JsonField? = null - private var merchantAcceptorId: JsonField? = null - private var merchantCategoryCode: JsonField? = null - private var merchantCity: JsonField? = null - private var merchantCountry: JsonField? = null - private var merchantName: JsonField? = null - private var merchantPostalCode: JsonField? = null - private var merchantState: JsonField? = null - private var networkIdentifiers: JsonField? = null - private var presentmentAmount: JsonField? = null - private var presentmentCurrency: JsonField? = null - private var purchaseDetails: JsonField? = null - private var transactionId: JsonField? = null - private var type: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + fun validate(): CardRefund = apply { + if (validated) { + return@apply + } - @JvmSynthetic - internal fun from(cardRefund: CardRefund) = apply { - id = cardRefund.id - amount = cardRefund.amount - cardPaymentId = cardRefund.cardPaymentId - cashback = cardRefund.cashback - currency = cardRefund.currency - interchange = cardRefund.interchange - merchantAcceptorId = cardRefund.merchantAcceptorId - merchantCategoryCode = cardRefund.merchantCategoryCode - merchantCity = cardRefund.merchantCity - merchantCountry = cardRefund.merchantCountry - merchantName = cardRefund.merchantName - merchantPostalCode = cardRefund.merchantPostalCode - merchantState = cardRefund.merchantState - networkIdentifiers = cardRefund.networkIdentifiers - presentmentAmount = cardRefund.presentmentAmount - presentmentCurrency = cardRefund.presentmentCurrency - purchaseDetails = cardRefund.purchaseDetails - transactionId = cardRefund.transactionId - type = cardRefund.type - additionalProperties = cardRefund.additionalProperties.toMutableMap() + id() + amount() + cardPaymentId() + cashback().ifPresent { it.validate() } + currency().validate() + interchange().ifPresent { it.validate() } + merchantAcceptorId() + merchantCategoryCode() + merchantCity() + merchantCountry() + merchantName() + merchantPostalCode() + merchantState() + networkIdentifiers().validate() + presentmentAmount() + presentmentCurrency() + purchaseDetails().ifPresent { it.validate() } + schemeFees().forEach { it.validate() } + transactionId() + type().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false } - /** The Card Refund identifier. */ - fun id(id: String) = id(JsonField.of(id)) + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (amount.asKnown().isPresent) 1 else 0) + + (if (cardPaymentId.asKnown().isPresent) 1 else 0) + + (cashback.asKnown().getOrNull()?.validity() ?: 0) + + (currency.asKnown().getOrNull()?.validity() ?: 0) + + (interchange.asKnown().getOrNull()?.validity() ?: 0) + + (if (merchantAcceptorId.asKnown().isPresent) 1 else 0) + + (if (merchantCategoryCode.asKnown().isPresent) 1 else 0) + + (if (merchantCity.asKnown().isPresent) 1 else 0) + + (if (merchantCountry.asKnown().isPresent) 1 else 0) + + (if (merchantName.asKnown().isPresent) 1 else 0) + + (if (merchantPostalCode.asKnown().isPresent) 1 else 0) + + (if (merchantState.asKnown().isPresent) 1 else 0) + + (networkIdentifiers.asKnown().getOrNull()?.validity() ?: 0) + + (if (presentmentAmount.asKnown().isPresent) 1 else 0) + + (if (presentmentCurrency.asKnown().isPresent) 1 else 0) + + (purchaseDetails.asKnown().getOrNull()?.validity() ?: 0) + + (schemeFees.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (transactionId.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + /** + * Cashback debited for this transaction, if eligible. Cashback is paid out in + * aggregate, monthly. + */ + class Cashback + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) /** - * Sets [Builder.id] to an arbitrary JSON value. + * The cashback amount given as a string containing a decimal number. The amount is + * a positive number if it will be credited to you (e.g., settlements) and a + * negative number if it will be debited (e.g., refunds). * - * You should usually call [Builder.id] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). */ - fun id(id: JsonField) = apply { this.id = id } + fun amount(): String = amount.getRequired("amount") /** - * The amount in the minor unit of the transaction's settlement currency. For - * dollars, for example, this is cents. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the cashback. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). */ - fun amount(amount: Long) = amount(JsonField.of(amount)) + fun currency(): Currency = currency.getRequired("currency") /** - * Sets [Builder.amount] to an arbitrary JSON value. + * Returns the raw JSON value of [amount]. * - * You should usually call [Builder.amount] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun amount(amount: JsonField) = apply { this.amount = amount } - - /** The ID of the Card Payment this transaction belongs to. */ - fun cardPaymentId(cardPaymentId: String) = - cardPaymentId(JsonField.of(cardPaymentId)) + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount /** - * Sets [Builder.cardPaymentId] to an arbitrary JSON value. + * Returns the raw JSON value of [currency]. * - * You should usually call [Builder.cardPaymentId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun cardPaymentId(cardPaymentId: JsonField) = apply { - this.cardPaymentId = cardPaymentId + @JsonProperty("currency") + @ExcludeMissing + fun _currency(): JsonField = currency + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Cashback]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Cashback]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(cashback: Cashback) = apply { + amount = cashback.amount + currency = cashback.currency + additionalProperties = cashback.additionalProperties.toMutableMap() + } + + /** + * The cashback amount given as a string containing a decimal number. The amount + * is a positive number if it will be credited to you (e.g., settlements) and a + * negative number if it will be debited (e.g., refunds). + */ + fun amount(amount: String) = amount(JsonField.of(amount)) + + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun amount(amount: JsonField) = apply { this.amount = amount } + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the cashback. + */ + fun currency(currency: Currency) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [Currency] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Cashback]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Cashback = + Cashback( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Cashback = apply { + if (validated) { + return@apply + } + + amount() + currency().validate() + validated = true } - /** - * Cashback debited for this transaction, if eligible. Cashback is paid out in - * aggregate, monthly. - */ - fun cashback(cashback: Cashback?) = cashback(JsonField.ofNullable(cashback)) - - /** Alias for calling [Builder.cashback] with `cashback.orElse(null)`. */ - fun cashback(cashback: Optional) = cashback(cashback.getOrNull()) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } /** - * Sets [Builder.cashback] to an arbitrary JSON value. + * Returns a score indicating how many valid values are contained in this object + * recursively. * - * You should usually call [Builder.cashback] with a well-typed [Cashback] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * Used for best match union deserialization. */ - fun cashback(cashback: JsonField) = apply { this.cashback = cashback } + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (currency.asKnown().getOrNull()?.validity() ?: 0) - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's - * settlement currency. - */ - fun currency(currency: Currency) = currency(JsonField.of(currency)) + /** The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the cashback. */ + class Currency + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** - * Sets [Builder.currency] to an arbitrary JSON value. - * - * You should usually call [Builder.currency] with a well-typed [Currency] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun currency(currency: JsonField) = apply { this.currency = currency } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** Interchange assessed as a part of this transaction. */ - fun interchange(interchange: Interchange?) = - interchange(JsonField.ofNullable(interchange)) + companion object { - /** Alias for calling [Builder.interchange] with `interchange.orElse(null)`. */ - fun interchange(interchange: Optional) = - interchange(interchange.getOrNull()) + /** US Dollar (USD) */ + @JvmField val USD = of("USD") - /** - * Sets [Builder.interchange] to an arbitrary JSON value. - * - * You should usually call [Builder.interchange] with a well-typed [Interchange] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun interchange(interchange: JsonField) = apply { - this.interchange = interchange - } + @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) + } - /** - * The merchant identifier (commonly abbreviated as MID) of the merchant the card is - * transacting with. - */ - fun merchantAcceptorId(merchantAcceptorId: String) = - merchantAcceptorId(JsonField.of(merchantAcceptorId)) + /** An enum containing [Currency]'s known values. */ + enum class Known { + /** US Dollar (USD) */ + USD + } - /** - * Sets [Builder.merchantAcceptorId] to an arbitrary JSON value. - * - * You should usually call [Builder.merchantAcceptorId] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun merchantAcceptorId(merchantAcceptorId: JsonField) = apply { - this.merchantAcceptorId = merchantAcceptorId - } + /** + * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Currency] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** US Dollar (USD) */ + USD, + /** + * An enum member indicating that [Currency] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** The 4-digit MCC describing the merchant's business. */ - fun merchantCategoryCode(merchantCategoryCode: String) = - merchantCategoryCode(JsonField.of(merchantCategoryCode)) + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + USD -> Value.USD + else -> Value._UNKNOWN + } - /** - * Sets [Builder.merchantCategoryCode] to an arbitrary JSON value. - * - * You should usually call [Builder.merchantCategoryCode] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun merchantCategoryCode(merchantCategoryCode: JsonField) = apply { - this.merchantCategoryCode = merchantCategoryCode - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + USD -> Known.USD + else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + } - /** The city the merchant resides in. */ - fun merchantCity(merchantCity: String) = merchantCity(JsonField.of(merchantCity)) + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - /** - * Sets [Builder.merchantCity] to an arbitrary JSON value. - * - * You should usually call [Builder.merchantCity] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun merchantCity(merchantCity: JsonField) = apply { - this.merchantCity = merchantCity - } + private var validated: Boolean = false - /** The country the merchant resides in. */ - fun merchantCountry(merchantCountry: String) = - merchantCountry(JsonField.of(merchantCountry)) + fun validate(): Currency = apply { + if (validated) { + return@apply + } - /** - * Sets [Builder.merchantCountry] to an arbitrary JSON value. - * - * You should usually call [Builder.merchantCountry] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun merchantCountry(merchantCountry: JsonField) = apply { - this.merchantCountry = merchantCountry - } + known() + validated = true + } - /** The name of the merchant. */ - fun merchantName(merchantName: String) = merchantName(JsonField.of(merchantName)) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * Sets [Builder.merchantName] to an arbitrary JSON value. - * - * You should usually call [Builder.merchantName] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun merchantName(merchantName: JsonField) = apply { - this.merchantName = merchantName - } + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - /** - * The merchant's postal code. For US merchants this is always a 5-digit ZIP code. - */ - fun merchantPostalCode(merchantPostalCode: String?) = - merchantPostalCode(JsonField.ofNullable(merchantPostalCode)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Alias for calling [Builder.merchantPostalCode] with - * `merchantPostalCode.orElse(null)`. - */ - fun merchantPostalCode(merchantPostalCode: Optional) = - merchantPostalCode(merchantPostalCode.getOrNull()) + return other is Currency && value == other.value + } - /** - * Sets [Builder.merchantPostalCode] to an arbitrary JSON value. - * - * You should usually call [Builder.merchantPostalCode] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun merchantPostalCode(merchantPostalCode: JsonField) = apply { - this.merchantPostalCode = merchantPostalCode + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } - /** The state the merchant resides in. */ - fun merchantState(merchantState: String?) = - merchantState(JsonField.ofNullable(merchantState)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** Alias for calling [Builder.merchantState] with `merchantState.orElse(null)`. */ - fun merchantState(merchantState: Optional) = - merchantState(merchantState.getOrNull()) + return other is Cashback && + amount == other.amount && + currency == other.currency && + additionalProperties == other.additionalProperties + } - /** - * Sets [Builder.merchantState] to an arbitrary JSON value. - * - * You should usually call [Builder.merchantState] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun merchantState(merchantState: JsonField) = apply { - this.merchantState = merchantState + private val hashCode: Int by lazy { + Objects.hash(amount, currency, additionalProperties) } - /** Network-specific identifiers for this refund. */ - fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) = - networkIdentifiers(JsonField.of(networkIdentifiers)) + override fun hashCode(): Int = hashCode - /** - * Sets [Builder.networkIdentifiers] to an arbitrary JSON value. - * - * You should usually call [Builder.networkIdentifiers] with a well-typed - * [NetworkIdentifiers] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun networkIdentifiers(networkIdentifiers: JsonField) = apply { - this.networkIdentifiers = networkIdentifiers - } + override fun toString() = + "Cashback{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } - /** The amount in the minor unit of the transaction's presentment currency. */ - fun presentmentAmount(presentmentAmount: Long) = - presentmentAmount(JsonField.of(presentmentAmount)) + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's + * settlement currency. + */ + class Currency @JsonCreator private constructor(private val value: JsonField) : + Enum { /** - * Sets [Builder.presentmentAmount] to an arbitrary JSON value. + * Returns this class instance's raw value. * - * You should usually call [Builder.presentmentAmount] with a well-typed [Long] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. */ - fun presentmentAmount(presentmentAmount: JsonField) = apply { - this.presentmentAmount = presentmentAmount - } + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's - * presentment currency. - */ - fun presentmentCurrency(presentmentCurrency: String) = - presentmentCurrency(JsonField.of(presentmentCurrency)) + companion object { - /** - * Sets [Builder.presentmentCurrency] to an arbitrary JSON value. - * - * You should usually call [Builder.presentmentCurrency] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun presentmentCurrency(presentmentCurrency: JsonField) = apply { - this.presentmentCurrency = presentmentCurrency - } + /** US Dollar (USD) */ + @JvmField val USD = of("USD") - /** - * Additional details about the card purchase, such as tax and industry-specific - * fields. - */ - fun purchaseDetails(purchaseDetails: PurchaseDetails?) = - purchaseDetails(JsonField.ofNullable(purchaseDetails)) + @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) + } - /** - * Alias for calling [Builder.purchaseDetails] with `purchaseDetails.orElse(null)`. - */ - fun purchaseDetails(purchaseDetails: Optional) = - purchaseDetails(purchaseDetails.getOrNull()) + /** An enum containing [Currency]'s known values. */ + enum class Known { + /** US Dollar (USD) */ + USD + } /** - * Sets [Builder.purchaseDetails] to an arbitrary JSON value. + * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] member. * - * You should usually call [Builder.purchaseDetails] with a well-typed - * [PurchaseDetails] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. + * An instance of [Currency] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. */ - fun purchaseDetails(purchaseDetails: JsonField) = apply { - this.purchaseDetails = purchaseDetails + enum class Value { + /** US Dollar (USD) */ + USD, + /** + * An enum member indicating that [Currency] was instantiated with an unknown + * value. + */ + _UNKNOWN, } - /** The identifier of the Transaction associated with this Transaction. */ - fun transactionId(transactionId: String) = - transactionId(JsonField.of(transactionId)) - /** - * Sets [Builder.transactionId] to an arbitrary JSON value. + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. * - * You should usually call [Builder.transactionId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. */ - fun transactionId(transactionId: JsonField) = apply { - this.transactionId = transactionId - } + fun value(): Value = + when (this) { + USD -> Value.USD + else -> Value._UNKNOWN + } /** - * A constant representing the object's type. For this resource it will always be - * `card_refund`. + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not a + * known member. */ - fun type(type: Type) = type(JsonField.of(type)) + fun known(): Known = + when (this) { + USD -> Known.USD + else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + } /** - * Sets [Builder.type] to an arbitrary JSON value. + * Returns this class instance's primitive wire representation. * - * You should usually call [Builder.type] with a well-typed [Type] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not have + * the expected primitive type. */ - fun type(type: JsonField) = apply { this.type = type } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + private var validated: Boolean = false - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + fun validate(): Currency = apply { + if (validated) { + return@apply } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + known() + validated = true } - /** - * Returns an immutable instance of [CardRefund]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .amount() - * .cardPaymentId() - * .cashback() - * .currency() - * .interchange() - * .merchantAcceptorId() - * .merchantCategoryCode() - * .merchantCity() - * .merchantCountry() - * .merchantName() - * .merchantPostalCode() - * .merchantState() - * .networkIdentifiers() - * .presentmentAmount() - * .presentmentCurrency() - * .purchaseDetails() - * .transactionId() - * .type() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CardRefund = - CardRefund( - checkRequired("id", id), - checkRequired("amount", amount), - checkRequired("cardPaymentId", cardPaymentId), - checkRequired("cashback", cashback), - checkRequired("currency", currency), - checkRequired("interchange", interchange), - checkRequired("merchantAcceptorId", merchantAcceptorId), - checkRequired("merchantCategoryCode", merchantCategoryCode), - checkRequired("merchantCity", merchantCity), - checkRequired("merchantCountry", merchantCountry), - checkRequired("merchantName", merchantName), - checkRequired("merchantPostalCode", merchantPostalCode), - checkRequired("merchantState", merchantState), - checkRequired("networkIdentifiers", networkIdentifiers), - checkRequired("presentmentAmount", presentmentAmount), - checkRequired("presentmentCurrency", presentmentCurrency), - checkRequired("purchaseDetails", purchaseDetails), - checkRequired("transactionId", transactionId), - checkRequired("type", type), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - fun validate(): CardRefund = apply { - if (validated) { - return@apply - } + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - id() - amount() - cardPaymentId() - cashback().ifPresent { it.validate() } - currency().validate() - interchange().ifPresent { it.validate() } - merchantAcceptorId() - merchantCategoryCode() - merchantCity() - merchantCountry() - merchantName() - merchantPostalCode() - merchantState() - networkIdentifiers().validate() - presentmentAmount() - presentmentCurrency() - purchaseDetails().ifPresent { it.validate() } - transactionId() - type().validate() - validated = true - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false + return other is Currency && value == other.value } - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (id.asKnown().isPresent) 1 else 0) + - (if (amount.asKnown().isPresent) 1 else 0) + - (if (cardPaymentId.asKnown().isPresent) 1 else 0) + - (cashback.asKnown().getOrNull()?.validity() ?: 0) + - (currency.asKnown().getOrNull()?.validity() ?: 0) + - (interchange.asKnown().getOrNull()?.validity() ?: 0) + - (if (merchantAcceptorId.asKnown().isPresent) 1 else 0) + - (if (merchantCategoryCode.asKnown().isPresent) 1 else 0) + - (if (merchantCity.asKnown().isPresent) 1 else 0) + - (if (merchantCountry.asKnown().isPresent) 1 else 0) + - (if (merchantName.asKnown().isPresent) 1 else 0) + - (if (merchantPostalCode.asKnown().isPresent) 1 else 0) + - (if (merchantState.asKnown().isPresent) 1 else 0) + - (networkIdentifiers.asKnown().getOrNull()?.validity() ?: 0) + - (if (presentmentAmount.asKnown().isPresent) 1 else 0) + - (if (presentmentCurrency.asKnown().isPresent) 1 else 0) + - (purchaseDetails.asKnown().getOrNull()?.validity() ?: 0) + - (if (transactionId.asKnown().isPresent) 1 else 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) + override fun hashCode() = value.hashCode() - /** - * Cashback debited for this transaction, if eligible. Cashback is paid out in - * aggregate, monthly. - */ - class Cashback + override fun toString() = value.toString() + } + + /** Interchange assessed as a part of this transaction. */ + class Interchange @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val amount: JsonField, + private val code: JsonField, private val currency: JsonField, private val additionalProperties: MutableMap, ) { @@ -52994,15 +61728,19 @@ private constructor( @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), + @JsonProperty("code") + @ExcludeMissing + code: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing currency: JsonField = JsonMissing.of(), - ) : this(amount, currency, mutableMapOf()) + ) : this(amount, code, currency, mutableMapOf()) /** - * The cashback amount given as a string containing a decimal number. The amount is - * a positive number if it will be credited to you (e.g., settlements) and a - * negative number if it will be debited (e.g., refunds). + * The interchange amount given as a string containing a decimal number in major + * units (so e.g., "3.14" for $3.14). The amount is a positive number if it is + * credited to Increase (e.g., settlements) and a negative number if it is debited + * (e.g., refunds). * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or * is unexpectedly missing or null (e.g. if the server responded with an @@ -53011,7 +61749,16 @@ private constructor( fun amount(): String = amount.getRequired("amount") /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the cashback. + * The card network specific interchange code. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun code(): Optional = code.getOptional("code") + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the interchange + * reimbursement. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or * is unexpectedly missing or null (e.g. if the server responded with an @@ -53027,6 +61774,14 @@ private constructor( */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + /** + * Returns the raw JSON value of [code]. + * + * Unlike [code], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("code") @ExcludeMissing fun _code(): JsonField = code + /** * Returns the raw JSON value of [currency]. * @@ -53052,35 +61807,39 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [Cashback]. + * Returns a mutable builder for constructing an instance of [Interchange]. * * The following fields are required: * ```java * .amount() + * .code() * .currency() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [Cashback]. */ + /** A builder for [Interchange]. */ class Builder internal constructor() { private var amount: JsonField? = null + private var code: JsonField? = null private var currency: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(cashback: Cashback) = apply { - amount = cashback.amount - currency = cashback.currency - additionalProperties = cashback.additionalProperties.toMutableMap() + internal fun from(interchange: Interchange) = apply { + amount = interchange.amount + code = interchange.code + currency = interchange.currency + additionalProperties = interchange.additionalProperties.toMutableMap() } /** - * The cashback amount given as a string containing a decimal number. The amount - * is a positive number if it will be credited to you (e.g., settlements) and a - * negative number if it will be debited (e.g., refunds). + * The interchange amount given as a string containing a decimal number in major + * units (so e.g., "3.14" for $3.14). The amount is a positive number if it is + * credited to Increase (e.g., settlements) and a negative number if it is + * debited (e.g., refunds). */ fun amount(amount: String) = amount(JsonField.of(amount)) @@ -53093,8 +61852,24 @@ private constructor( */ fun amount(amount: JsonField) = apply { this.amount = amount } + /** The card network specific interchange code. */ + fun code(code: String?) = code(JsonField.ofNullable(code)) + + /** Alias for calling [Builder.code] with `code.orElse(null)`. */ + fun code(code: Optional) = code(code.getOrNull()) + /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the cashback. + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun code(code: JsonField) = apply { this.code = code } + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * interchange reimbursement. */ fun currency(currency: Currency) = currency(JsonField.of(currency)) @@ -53130,21 +61905,23 @@ private constructor( } /** - * Returns an immutable instance of [Cashback]. + * Returns an immutable instance of [Interchange]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java * .amount() + * .code() * .currency() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): Cashback = - Cashback( + fun build(): Interchange = + Interchange( checkRequired("amount", amount), + checkRequired("code", code), checkRequired("currency", currency), additionalProperties.toMutableMap(), ) @@ -53152,12 +61929,13 @@ private constructor( private var validated: Boolean = false - fun validate(): Cashback = apply { + fun validate(): Interchange = apply { if (validated) { return@apply } amount() + code() currency().validate() validated = true } @@ -53179,9 +61957,13 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (amount.asKnown().isPresent) 1 else 0) + + (if (code.asKnown().isPresent) 1 else 0) + (currency.asKnown().getOrNull()?.validity() ?: 0) - /** The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the cashback. */ + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the interchange + * reimbursement. + */ class Currency @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -53301,340 +62083,965 @@ private constructor( @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Currency && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Interchange && + amount == other.amount && + code == other.code && + currency == other.currency && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(amount, code, currency, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Interchange{amount=$amount, code=$code, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** Network-specific identifiers for this refund. */ + class NetworkIdentifiers + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val acquirerBusinessId: JsonField, + private val acquirerReferenceNumber: JsonField, + private val authorizationIdentificationResponse: JsonField, + private val transactionId: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("acquirer_business_id") + @ExcludeMissing + acquirerBusinessId: JsonField = JsonMissing.of(), + @JsonProperty("acquirer_reference_number") + @ExcludeMissing + acquirerReferenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("authorization_identification_response") + @ExcludeMissing + authorizationIdentificationResponse: JsonField = JsonMissing.of(), + @JsonProperty("transaction_id") + @ExcludeMissing + transactionId: JsonField = JsonMissing.of(), + ) : this( + acquirerBusinessId, + acquirerReferenceNumber, + authorizationIdentificationResponse, + transactionId, + mutableMapOf(), + ) + + /** + * A network assigned business ID that identifies the acquirer that processed this + * transaction. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun acquirerBusinessId(): String = + acquirerBusinessId.getRequired("acquirer_business_id") + + /** + * A globally unique identifier for this settlement. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun acquirerReferenceNumber(): String = + acquirerReferenceNumber.getRequired("acquirer_reference_number") + + /** + * The randomly generated 6-character Authorization Identification Response code + * sent back to the acquirer in an approved response. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun authorizationIdentificationResponse(): Optional = + authorizationIdentificationResponse.getOptional( + "authorization_identification_response" + ) + + /** + * A globally unique transaction identifier provided by the card network, used + * across multiple life-cycle requests. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun transactionId(): Optional = transactionId.getOptional("transaction_id") + + /** + * Returns the raw JSON value of [acquirerBusinessId]. + * + * Unlike [acquirerBusinessId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("acquirer_business_id") + @ExcludeMissing + fun _acquirerBusinessId(): JsonField = acquirerBusinessId + + /** + * Returns the raw JSON value of [acquirerReferenceNumber]. + * + * Unlike [acquirerReferenceNumber], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("acquirer_reference_number") + @ExcludeMissing + fun _acquirerReferenceNumber(): JsonField = acquirerReferenceNumber + + /** + * Returns the raw JSON value of [authorizationIdentificationResponse]. + * + * Unlike [authorizationIdentificationResponse], this method doesn't throw if the + * JSON field has an unexpected type. + */ + @JsonProperty("authorization_identification_response") + @ExcludeMissing + fun _authorizationIdentificationResponse(): JsonField = + authorizationIdentificationResponse + + /** + * Returns the raw JSON value of [transactionId]. + * + * Unlike [transactionId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("transaction_id") + @ExcludeMissing + fun _transactionId(): JsonField = transactionId + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [NetworkIdentifiers]. + * + * The following fields are required: + * ```java + * .acquirerBusinessId() + * .acquirerReferenceNumber() + * .authorizationIdentificationResponse() + * .transactionId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [NetworkIdentifiers]. */ + class Builder internal constructor() { + + private var acquirerBusinessId: JsonField? = null + private var acquirerReferenceNumber: JsonField? = null + private var authorizationIdentificationResponse: JsonField? = null + private var transactionId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(networkIdentifiers: NetworkIdentifiers) = apply { + acquirerBusinessId = networkIdentifiers.acquirerBusinessId + acquirerReferenceNumber = networkIdentifiers.acquirerReferenceNumber + authorizationIdentificationResponse = + networkIdentifiers.authorizationIdentificationResponse + transactionId = networkIdentifiers.transactionId + additionalProperties = + networkIdentifiers.additionalProperties.toMutableMap() + } + + /** + * A network assigned business ID that identifies the acquirer that processed + * this transaction. + */ + fun acquirerBusinessId(acquirerBusinessId: String) = + acquirerBusinessId(JsonField.of(acquirerBusinessId)) + + /** + * Sets [Builder.acquirerBusinessId] to an arbitrary JSON value. + * + * You should usually call [Builder.acquirerBusinessId] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun acquirerBusinessId(acquirerBusinessId: JsonField) = apply { + this.acquirerBusinessId = acquirerBusinessId + } + + /** A globally unique identifier for this settlement. */ + fun acquirerReferenceNumber(acquirerReferenceNumber: String) = + acquirerReferenceNumber(JsonField.of(acquirerReferenceNumber)) + + /** + * Sets [Builder.acquirerReferenceNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.acquirerReferenceNumber] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun acquirerReferenceNumber(acquirerReferenceNumber: JsonField) = + apply { + this.acquirerReferenceNumber = acquirerReferenceNumber + } + + /** + * The randomly generated 6-character Authorization Identification Response code + * sent back to the acquirer in an approved response. + */ + fun authorizationIdentificationResponse( + authorizationIdentificationResponse: String? + ) = + authorizationIdentificationResponse( + JsonField.ofNullable(authorizationIdentificationResponse) + ) + + /** + * Alias for calling [Builder.authorizationIdentificationResponse] with + * `authorizationIdentificationResponse.orElse(null)`. + */ + fun authorizationIdentificationResponse( + authorizationIdentificationResponse: Optional + ) = + authorizationIdentificationResponse( + authorizationIdentificationResponse.getOrNull() + ) + + /** + * Sets [Builder.authorizationIdentificationResponse] to an arbitrary JSON + * value. + * + * You should usually call [Builder.authorizationIdentificationResponse] with a + * well-typed [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun authorizationIdentificationResponse( + authorizationIdentificationResponse: JsonField + ) = apply { + this.authorizationIdentificationResponse = + authorizationIdentificationResponse + } + + /** + * A globally unique transaction identifier provided by the card network, used + * across multiple life-cycle requests. + */ + fun transactionId(transactionId: String?) = + transactionId(JsonField.ofNullable(transactionId)) + + /** + * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`. + */ + fun transactionId(transactionId: Optional) = + transactionId(transactionId.getOrNull()) + + /** + * Sets [Builder.transactionId] to an arbitrary JSON value. + * + * You should usually call [Builder.transactionId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun transactionId(transactionId: JsonField) = apply { + this.transactionId = transactionId + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [NetworkIdentifiers]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .acquirerBusinessId() + * .acquirerReferenceNumber() + * .authorizationIdentificationResponse() + * .transactionId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): NetworkIdentifiers = + NetworkIdentifiers( + checkRequired("acquirerBusinessId", acquirerBusinessId), + checkRequired("acquirerReferenceNumber", acquirerReferenceNumber), + checkRequired( + "authorizationIdentificationResponse", + authorizationIdentificationResponse, + ), + checkRequired("transactionId", transactionId), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false - return other is Currency && value == other.value + fun validate(): NetworkIdentifiers = apply { + if (validated) { + return@apply } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() + acquirerBusinessId() + acquirerReferenceNumber() + authorizationIdentificationResponse() + transactionId() + validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (acquirerBusinessId.asKnown().isPresent) 1 else 0) + + (if (acquirerReferenceNumber.asKnown().isPresent) 1 else 0) + + (if (authorizationIdentificationResponse.asKnown().isPresent) 1 else 0) + + (if (transactionId.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is Cashback && - amount == other.amount && - currency == other.currency && + return other is NetworkIdentifiers && + acquirerBusinessId == other.acquirerBusinessId && + acquirerReferenceNumber == other.acquirerReferenceNumber && + authorizationIdentificationResponse == + other.authorizationIdentificationResponse && + transactionId == other.transactionId && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(amount, currency, additionalProperties) + Objects.hash( + acquirerBusinessId, + acquirerReferenceNumber, + authorizationIdentificationResponse, + transactionId, + additionalProperties, + ) } override fun hashCode(): Int = hashCode override fun toString() = - "Cashback{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + "NetworkIdentifiers{acquirerBusinessId=$acquirerBusinessId, acquirerReferenceNumber=$acquirerReferenceNumber, authorizationIdentificationResponse=$authorizationIdentificationResponse, transactionId=$transactionId, additionalProperties=$additionalProperties}" } /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's - * settlement currency. + * Additional details about the card purchase, such as tax and industry-specific fields. */ - class Currency @JsonCreator private constructor(private val value: JsonField) : - Enum { + class PurchaseDetails + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val carRental: JsonField, + private val customerReferenceIdentifier: JsonField, + private val localTaxAmount: JsonField, + private val localTaxCurrency: JsonField, + private val lodging: JsonField, + private val nationalTaxAmount: JsonField, + private val nationalTaxCurrency: JsonField, + private val purchaseIdentifier: JsonField, + private val purchaseIdentifierFormat: JsonField, + private val travel: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("car_rental") + @ExcludeMissing + carRental: JsonField = JsonMissing.of(), + @JsonProperty("customer_reference_identifier") + @ExcludeMissing + customerReferenceIdentifier: JsonField = JsonMissing.of(), + @JsonProperty("local_tax_amount") + @ExcludeMissing + localTaxAmount: JsonField = JsonMissing.of(), + @JsonProperty("local_tax_currency") + @ExcludeMissing + localTaxCurrency: JsonField = JsonMissing.of(), + @JsonProperty("lodging") + @ExcludeMissing + lodging: JsonField = JsonMissing.of(), + @JsonProperty("national_tax_amount") + @ExcludeMissing + nationalTaxAmount: JsonField = JsonMissing.of(), + @JsonProperty("national_tax_currency") + @ExcludeMissing + nationalTaxCurrency: JsonField = JsonMissing.of(), + @JsonProperty("purchase_identifier") + @ExcludeMissing + purchaseIdentifier: JsonField = JsonMissing.of(), + @JsonProperty("purchase_identifier_format") + @ExcludeMissing + purchaseIdentifierFormat: JsonField = + JsonMissing.of(), + @JsonProperty("travel") + @ExcludeMissing + travel: JsonField = JsonMissing.of(), + ) : this( + carRental, + customerReferenceIdentifier, + localTaxAmount, + localTaxCurrency, + lodging, + nationalTaxAmount, + nationalTaxCurrency, + purchaseIdentifier, + purchaseIdentifierFormat, + travel, + mutableMapOf(), + ) /** - * Returns this class instance's raw value. + * Fields specific to car rentals. * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - /** US Dollar (USD) */ - @JvmField val USD = of("USD") - - @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) - } - - /** An enum containing [Currency]'s known values. */ - enum class Known { - /** US Dollar (USD) */ - USD - } + fun carRental(): Optional = carRental.getOptional("car_rental") /** - * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] member. + * An identifier from the merchant for the customer or consumer. * - * An instance of [Currency] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ - enum class Value { - /** US Dollar (USD) */ - USD, - /** - * An enum member indicating that [Currency] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } + fun customerReferenceIdentifier(): Optional = + customerReferenceIdentifier.getOptional("customer_reference_identifier") /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * The state or provincial tax amount in minor units. * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ - fun value(): Value = - when (this) { - USD -> Value.USD - else -> Value._UNKNOWN - } + fun localTaxAmount(): Optional = + localTaxAmount.getOptional("local_tax_amount") /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax + * assessed. * - * @throws IncreaseInvalidDataException if this class instance's value is a not a - * known member. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ - fun known(): Known = - when (this) { - USD -> Known.USD - else -> throw IncreaseInvalidDataException("Unknown Currency: $value") - } + fun localTaxCurrency(): Optional = + localTaxCurrency.getOptional("local_tax_currency") /** - * Returns this class instance's primitive wire representation. + * Fields specific to lodging. * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun lodging(): Optional = lodging.getOptional("lodging") + + /** + * The national tax amount in minor units. * - * @throws IncreaseInvalidDataException if this class instance's value does not have - * the expected primitive type. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + fun nationalTaxAmount(): Optional = + nationalTaxAmount.getOptional("national_tax_amount") - private var validated: Boolean = false + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax + * assessed. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun nationalTaxCurrency(): Optional = + nationalTaxCurrency.getOptional("national_tax_currency") - fun validate(): Currency = apply { - if (validated) { - return@apply - } + /** + * An identifier from the merchant for the purchase to the issuer and cardholder. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun purchaseIdentifier(): Optional = + purchaseIdentifier.getOptional("purchase_identifier") - known() - validated = true - } + /** + * The format of the purchase identifier. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun purchaseIdentifierFormat(): Optional = + purchaseIdentifierFormat.getOptional("purchase_identifier_format") - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * Fields specific to travel. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun travel(): Optional = travel.getOptional("travel") /** - * Returns a score indicating how many valid values are contained in this object - * recursively. + * Returns the raw JSON value of [carRental]. * - * Used for best match union deserialization. + * Unlike [carRental], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + @JsonProperty("car_rental") + @ExcludeMissing + fun _carRental(): JsonField = carRental - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Returns the raw JSON value of [customerReferenceIdentifier]. + * + * Unlike [customerReferenceIdentifier], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("customer_reference_identifier") + @ExcludeMissing + fun _customerReferenceIdentifier(): JsonField = customerReferenceIdentifier - return other is Currency && value == other.value - } + /** + * Returns the raw JSON value of [localTaxAmount]. + * + * Unlike [localTaxAmount], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("local_tax_amount") + @ExcludeMissing + fun _localTaxAmount(): JsonField = localTaxAmount - override fun hashCode() = value.hashCode() + /** + * Returns the raw JSON value of [localTaxCurrency]. + * + * Unlike [localTaxCurrency], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("local_tax_currency") + @ExcludeMissing + fun _localTaxCurrency(): JsonField = localTaxCurrency - override fun toString() = value.toString() - } + /** + * Returns the raw JSON value of [lodging]. + * + * Unlike [lodging], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("lodging") + @ExcludeMissing + fun _lodging(): JsonField = lodging - /** Interchange assessed as a part of this transaction. */ - class Interchange - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val amount: JsonField, - private val code: JsonField, - private val currency: JsonField, - private val additionalProperties: MutableMap, - ) { + /** + * Returns the raw JSON value of [nationalTaxAmount]. + * + * Unlike [nationalTaxAmount], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("national_tax_amount") + @ExcludeMissing + fun _nationalTaxAmount(): JsonField = nationalTaxAmount - @JsonCreator - private constructor( - @JsonProperty("amount") - @ExcludeMissing - amount: JsonField = JsonMissing.of(), - @JsonProperty("code") - @ExcludeMissing - code: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - currency: JsonField = JsonMissing.of(), - ) : this(amount, code, currency, mutableMapOf()) + /** + * Returns the raw JSON value of [nationalTaxCurrency]. + * + * Unlike [nationalTaxCurrency], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("national_tax_currency") + @ExcludeMissing + fun _nationalTaxCurrency(): JsonField = nationalTaxCurrency /** - * The interchange amount given as a string containing a decimal number in major - * units (so e.g., "3.14" for $3.14). The amount is a positive number if it is - * credited to Increase (e.g., settlements) and a negative number if it is debited - * (e.g., refunds). + * Returns the raw JSON value of [purchaseIdentifier]. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). + * Unlike [purchaseIdentifier], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun amount(): String = amount.getRequired("amount") + @JsonProperty("purchase_identifier") + @ExcludeMissing + fun _purchaseIdentifier(): JsonField = purchaseIdentifier /** - * The card network specific interchange code. + * Returns the raw JSON value of [purchaseIdentifierFormat]. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * Unlike [purchaseIdentifierFormat], this method doesn't throw if the JSON field + * has an unexpected type. */ - fun code(): Optional = code.getOptional("code") + @JsonProperty("purchase_identifier_format") + @ExcludeMissing + fun _purchaseIdentifierFormat(): JsonField = + purchaseIdentifierFormat /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the interchange - * reimbursement. + * Returns the raw JSON value of [travel]. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). + * Unlike [travel], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun currency(): Currency = currency.getRequired("currency") + @JsonProperty("travel") @ExcludeMissing fun _travel(): JsonField = travel + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [PurchaseDetails]. + * + * The following fields are required: + * ```java + * .carRental() + * .customerReferenceIdentifier() + * .localTaxAmount() + * .localTaxCurrency() + * .lodging() + * .nationalTaxAmount() + * .nationalTaxCurrency() + * .purchaseIdentifier() + * .purchaseIdentifierFormat() + * .travel() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [PurchaseDetails]. */ + class Builder internal constructor() { + + private var carRental: JsonField? = null + private var customerReferenceIdentifier: JsonField? = null + private var localTaxAmount: JsonField? = null + private var localTaxCurrency: JsonField? = null + private var lodging: JsonField? = null + private var nationalTaxAmount: JsonField? = null + private var nationalTaxCurrency: JsonField? = null + private var purchaseIdentifier: JsonField? = null + private var purchaseIdentifierFormat: JsonField? = + null + private var travel: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(purchaseDetails: PurchaseDetails) = apply { + carRental = purchaseDetails.carRental + customerReferenceIdentifier = purchaseDetails.customerReferenceIdentifier + localTaxAmount = purchaseDetails.localTaxAmount + localTaxCurrency = purchaseDetails.localTaxCurrency + lodging = purchaseDetails.lodging + nationalTaxAmount = purchaseDetails.nationalTaxAmount + nationalTaxCurrency = purchaseDetails.nationalTaxCurrency + purchaseIdentifier = purchaseDetails.purchaseIdentifier + purchaseIdentifierFormat = purchaseDetails.purchaseIdentifierFormat + travel = purchaseDetails.travel + additionalProperties = purchaseDetails.additionalProperties.toMutableMap() + } + + /** Fields specific to car rentals. */ + fun carRental(carRental: CarRental?) = + carRental(JsonField.ofNullable(carRental)) + + /** Alias for calling [Builder.carRental] with `carRental.orElse(null)`. */ + fun carRental(carRental: Optional) = carRental(carRental.getOrNull()) + + /** + * Sets [Builder.carRental] to an arbitrary JSON value. + * + * You should usually call [Builder.carRental] with a well-typed [CarRental] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun carRental(carRental: JsonField) = apply { + this.carRental = carRental + } + + /** An identifier from the merchant for the customer or consumer. */ + fun customerReferenceIdentifier(customerReferenceIdentifier: String?) = + customerReferenceIdentifier( + JsonField.ofNullable(customerReferenceIdentifier) + ) + + /** + * Alias for calling [Builder.customerReferenceIdentifier] with + * `customerReferenceIdentifier.orElse(null)`. + */ + fun customerReferenceIdentifier(customerReferenceIdentifier: Optional) = + customerReferenceIdentifier(customerReferenceIdentifier.getOrNull()) + + /** + * Sets [Builder.customerReferenceIdentifier] to an arbitrary JSON value. + * + * You should usually call [Builder.customerReferenceIdentifier] with a + * well-typed [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun customerReferenceIdentifier( + customerReferenceIdentifier: JsonField + ) = apply { this.customerReferenceIdentifier = customerReferenceIdentifier } + + /** The state or provincial tax amount in minor units. */ + fun localTaxAmount(localTaxAmount: Long?) = + localTaxAmount(JsonField.ofNullable(localTaxAmount)) - /** - * Returns the raw JSON value of [amount]. - * - * Unlike [amount], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + /** + * Alias for [Builder.localTaxAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun localTaxAmount(localTaxAmount: Long) = + localTaxAmount(localTaxAmount as Long?) - /** - * Returns the raw JSON value of [code]. - * - * Unlike [code], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("code") @ExcludeMissing fun _code(): JsonField = code + /** + * Alias for calling [Builder.localTaxAmount] with + * `localTaxAmount.orElse(null)`. + */ + fun localTaxAmount(localTaxAmount: Optional) = + localTaxAmount(localTaxAmount.getOrNull()) - /** - * Returns the raw JSON value of [currency]. - * - * Unlike [currency], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("currency") - @ExcludeMissing - fun _currency(): JsonField = currency + /** + * Sets [Builder.localTaxAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.localTaxAmount] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun localTaxAmount(localTaxAmount: JsonField) = apply { + this.localTaxAmount = localTaxAmount + } - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax + * assessed. + */ + fun localTaxCurrency(localTaxCurrency: String?) = + localTaxCurrency(JsonField.ofNullable(localTaxCurrency)) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** + * Alias for calling [Builder.localTaxCurrency] with + * `localTaxCurrency.orElse(null)`. + */ + fun localTaxCurrency(localTaxCurrency: Optional) = + localTaxCurrency(localTaxCurrency.getOrNull()) - fun toBuilder() = Builder().from(this) + /** + * Sets [Builder.localTaxCurrency] to an arbitrary JSON value. + * + * You should usually call [Builder.localTaxCurrency] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun localTaxCurrency(localTaxCurrency: JsonField) = apply { + this.localTaxCurrency = localTaxCurrency + } - companion object { + /** Fields specific to lodging. */ + fun lodging(lodging: Lodging?) = lodging(JsonField.ofNullable(lodging)) + + /** Alias for calling [Builder.lodging] with `lodging.orElse(null)`. */ + fun lodging(lodging: Optional) = lodging(lodging.getOrNull()) /** - * Returns a mutable builder for constructing an instance of [Interchange]. + * Sets [Builder.lodging] to an arbitrary JSON value. * - * The following fields are required: - * ```java - * .amount() - * .code() - * .currency() - * ``` + * You should usually call [Builder.lodging] with a well-typed [Lodging] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - @JvmStatic fun builder() = Builder() - } + fun lodging(lodging: JsonField) = apply { this.lodging = lodging } - /** A builder for [Interchange]. */ - class Builder internal constructor() { + /** The national tax amount in minor units. */ + fun nationalTaxAmount(nationalTaxAmount: Long?) = + nationalTaxAmount(JsonField.ofNullable(nationalTaxAmount)) - private var amount: JsonField? = null - private var code: JsonField? = null - private var currency: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** + * Alias for [Builder.nationalTaxAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun nationalTaxAmount(nationalTaxAmount: Long) = + nationalTaxAmount(nationalTaxAmount as Long?) - @JvmSynthetic - internal fun from(interchange: Interchange) = apply { - amount = interchange.amount - code = interchange.code - currency = interchange.currency - additionalProperties = interchange.additionalProperties.toMutableMap() + /** + * Alias for calling [Builder.nationalTaxAmount] with + * `nationalTaxAmount.orElse(null)`. + */ + fun nationalTaxAmount(nationalTaxAmount: Optional) = + nationalTaxAmount(nationalTaxAmount.getOrNull()) + + /** + * Sets [Builder.nationalTaxAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.nationalTaxAmount] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun nationalTaxAmount(nationalTaxAmount: JsonField) = apply { + this.nationalTaxAmount = nationalTaxAmount } /** - * The interchange amount given as a string containing a decimal number in major - * units (so e.g., "3.14" for $3.14). The amount is a positive number if it is - * credited to Increase (e.g., settlements) and a negative number if it is - * debited (e.g., refunds). + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax + * assessed. */ - fun amount(amount: String) = amount(JsonField.of(amount)) + fun nationalTaxCurrency(nationalTaxCurrency: String?) = + nationalTaxCurrency(JsonField.ofNullable(nationalTaxCurrency)) /** - * Sets [Builder.amount] to an arbitrary JSON value. + * Alias for calling [Builder.nationalTaxCurrency] with + * `nationalTaxCurrency.orElse(null)`. + */ + fun nationalTaxCurrency(nationalTaxCurrency: Optional) = + nationalTaxCurrency(nationalTaxCurrency.getOrNull()) + + /** + * Sets [Builder.nationalTaxCurrency] to an arbitrary JSON value. * - * You should usually call [Builder.amount] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * You should usually call [Builder.nationalTaxCurrency] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ - fun amount(amount: JsonField) = apply { this.amount = amount } + fun nationalTaxCurrency(nationalTaxCurrency: JsonField) = apply { + this.nationalTaxCurrency = nationalTaxCurrency + } - /** The card network specific interchange code. */ - fun code(code: String?) = code(JsonField.ofNullable(code)) + /** + * An identifier from the merchant for the purchase to the issuer and + * cardholder. + */ + fun purchaseIdentifier(purchaseIdentifier: String?) = + purchaseIdentifier(JsonField.ofNullable(purchaseIdentifier)) - /** Alias for calling [Builder.code] with `code.orElse(null)`. */ - fun code(code: Optional) = code(code.getOrNull()) + /** + * Alias for calling [Builder.purchaseIdentifier] with + * `purchaseIdentifier.orElse(null)`. + */ + fun purchaseIdentifier(purchaseIdentifier: Optional) = + purchaseIdentifier(purchaseIdentifier.getOrNull()) /** - * Sets [Builder.code] to an arbitrary JSON value. + * Sets [Builder.purchaseIdentifier] to an arbitrary JSON value. * - * You should usually call [Builder.code] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * You should usually call [Builder.purchaseIdentifier] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ - fun code(code: JsonField) = apply { this.code = code } + fun purchaseIdentifier(purchaseIdentifier: JsonField) = apply { + this.purchaseIdentifier = purchaseIdentifier + } + + /** The format of the purchase identifier. */ + fun purchaseIdentifierFormat( + purchaseIdentifierFormat: PurchaseIdentifierFormat? + ) = purchaseIdentifierFormat(JsonField.ofNullable(purchaseIdentifierFormat)) /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - * interchange reimbursement. + * Alias for calling [Builder.purchaseIdentifierFormat] with + * `purchaseIdentifierFormat.orElse(null)`. */ - fun currency(currency: Currency) = currency(JsonField.of(currency)) + fun purchaseIdentifierFormat( + purchaseIdentifierFormat: Optional + ) = purchaseIdentifierFormat(purchaseIdentifierFormat.getOrNull()) /** - * Sets [Builder.currency] to an arbitrary JSON value. + * Sets [Builder.purchaseIdentifierFormat] to an arbitrary JSON value. * - * You should usually call [Builder.currency] with a well-typed [Currency] value + * You should usually call [Builder.purchaseIdentifierFormat] with a well-typed + * [PurchaseIdentifierFormat] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ + fun purchaseIdentifierFormat( + purchaseIdentifierFormat: JsonField + ) = apply { this.purchaseIdentifierFormat = purchaseIdentifierFormat } + + /** Fields specific to travel. */ + fun travel(travel: Travel?) = travel(JsonField.ofNullable(travel)) + + /** Alias for calling [Builder.travel] with `travel.orElse(null)`. */ + fun travel(travel: Optional) = travel(travel.getOrNull()) + + /** + * Sets [Builder.travel] to an arbitrary JSON value. + * + * You should usually call [Builder.travel] with a well-typed [Travel] value * instead. This method is primarily for setting the field to an undocumented or * not yet supported value. */ - fun currency(currency: JsonField) = apply { this.currency = currency } + fun travel(travel: JsonField) = apply { this.travel = travel } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -53659,38 +63066,62 @@ private constructor( } /** - * Returns an immutable instance of [Interchange]. + * Returns an immutable instance of [PurchaseDetails]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .amount() - * .code() - * .currency() + * .carRental() + * .customerReferenceIdentifier() + * .localTaxAmount() + * .localTaxCurrency() + * .lodging() + * .nationalTaxAmount() + * .nationalTaxCurrency() + * .purchaseIdentifier() + * .purchaseIdentifierFormat() + * .travel() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): Interchange = - Interchange( - checkRequired("amount", amount), - checkRequired("code", code), - checkRequired("currency", currency), + fun build(): PurchaseDetails = + PurchaseDetails( + checkRequired("carRental", carRental), + checkRequired( + "customerReferenceIdentifier", + customerReferenceIdentifier, + ), + checkRequired("localTaxAmount", localTaxAmount), + checkRequired("localTaxCurrency", localTaxCurrency), + checkRequired("lodging", lodging), + checkRequired("nationalTaxAmount", nationalTaxAmount), + checkRequired("nationalTaxCurrency", nationalTaxCurrency), + checkRequired("purchaseIdentifier", purchaseIdentifier), + checkRequired("purchaseIdentifierFormat", purchaseIdentifierFormat), + checkRequired("travel", travel), additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): Interchange = apply { + fun validate(): PurchaseDetails = apply { if (validated) { return@apply } - amount() - code() - currency().validate() + carRental().ifPresent { it.validate() } + customerReferenceIdentifier() + localTaxAmount() + localTaxCurrency() + lodging().ifPresent { it.validate() } + nationalTaxAmount() + nationalTaxCurrency() + purchaseIdentifier() + purchaseIdentifierFormat().ifPresent { it.validate() } + travel().ifPresent { it.validate() } validated = true } @@ -53710,1496 +63141,1735 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (amount.asKnown().isPresent) 1 else 0) + - (if (code.asKnown().isPresent) 1 else 0) + - (currency.asKnown().getOrNull()?.validity() ?: 0) + (carRental.asKnown().getOrNull()?.validity() ?: 0) + + (if (customerReferenceIdentifier.asKnown().isPresent) 1 else 0) + + (if (localTaxAmount.asKnown().isPresent) 1 else 0) + + (if (localTaxCurrency.asKnown().isPresent) 1 else 0) + + (lodging.asKnown().getOrNull()?.validity() ?: 0) + + (if (nationalTaxAmount.asKnown().isPresent) 1 else 0) + + (if (nationalTaxCurrency.asKnown().isPresent) 1 else 0) + + (if (purchaseIdentifier.asKnown().isPresent) 1 else 0) + + (purchaseIdentifierFormat.asKnown().getOrNull()?.validity() ?: 0) + + (travel.asKnown().getOrNull()?.validity() ?: 0) - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the interchange - * reimbursement. - */ - class Currency - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** Fields specific to car rentals. */ + class CarRental + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val carClassCode: JsonField, + private val checkoutDate: JsonField, + private val dailyRentalRateAmount: JsonField, + private val dailyRentalRateCurrency: JsonField, + private val daysRented: JsonField, + private val extraCharges: JsonField, + private val fuelChargesAmount: JsonField, + private val fuelChargesCurrency: JsonField, + private val insuranceChargesAmount: JsonField, + private val insuranceChargesCurrency: JsonField, + private val noShowIndicator: JsonField, + private val oneWayDropOffChargesAmount: JsonField, + private val oneWayDropOffChargesCurrency: JsonField, + private val renterName: JsonField, + private val weeklyRentalRateAmount: JsonField, + private val weeklyRentalRateCurrency: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("car_class_code") + @ExcludeMissing + carClassCode: JsonField = JsonMissing.of(), + @JsonProperty("checkout_date") + @ExcludeMissing + checkoutDate: JsonField = JsonMissing.of(), + @JsonProperty("daily_rental_rate_amount") + @ExcludeMissing + dailyRentalRateAmount: JsonField = JsonMissing.of(), + @JsonProperty("daily_rental_rate_currency") + @ExcludeMissing + dailyRentalRateCurrency: JsonField = JsonMissing.of(), + @JsonProperty("days_rented") + @ExcludeMissing + daysRented: JsonField = JsonMissing.of(), + @JsonProperty("extra_charges") + @ExcludeMissing + extraCharges: JsonField = JsonMissing.of(), + @JsonProperty("fuel_charges_amount") + @ExcludeMissing + fuelChargesAmount: JsonField = JsonMissing.of(), + @JsonProperty("fuel_charges_currency") + @ExcludeMissing + fuelChargesCurrency: JsonField = JsonMissing.of(), + @JsonProperty("insurance_charges_amount") + @ExcludeMissing + insuranceChargesAmount: JsonField = JsonMissing.of(), + @JsonProperty("insurance_charges_currency") + @ExcludeMissing + insuranceChargesCurrency: JsonField = JsonMissing.of(), + @JsonProperty("no_show_indicator") + @ExcludeMissing + noShowIndicator: JsonField = JsonMissing.of(), + @JsonProperty("one_way_drop_off_charges_amount") + @ExcludeMissing + oneWayDropOffChargesAmount: JsonField = JsonMissing.of(), + @JsonProperty("one_way_drop_off_charges_currency") + @ExcludeMissing + oneWayDropOffChargesCurrency: JsonField = JsonMissing.of(), + @JsonProperty("renter_name") + @ExcludeMissing + renterName: JsonField = JsonMissing.of(), + @JsonProperty("weekly_rental_rate_amount") + @ExcludeMissing + weeklyRentalRateAmount: JsonField = JsonMissing.of(), + @JsonProperty("weekly_rental_rate_currency") + @ExcludeMissing + weeklyRentalRateCurrency: JsonField = JsonMissing.of(), + ) : this( + carClassCode, + checkoutDate, + dailyRentalRateAmount, + dailyRentalRateCurrency, + daysRented, + extraCharges, + fuelChargesAmount, + fuelChargesCurrency, + insuranceChargesAmount, + insuranceChargesCurrency, + noShowIndicator, + oneWayDropOffChargesAmount, + oneWayDropOffChargesCurrency, + renterName, + weeklyRentalRateAmount, + weeklyRentalRateCurrency, + mutableMapOf(), + ) + + /** + * Code indicating the vehicle's class. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun carClassCode(): Optional = + carClassCode.getOptional("car_class_code") + + /** + * Date the customer picked up the car or, in the case of a no-show or pre-pay + * transaction, the scheduled pick up date. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun checkoutDate(): Optional = + checkoutDate.getOptional("checkout_date") + + /** + * Daily rate being charged for the vehicle. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun dailyRentalRateAmount(): Optional = + dailyRentalRateAmount.getOptional("daily_rental_rate_amount") + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily + * rental rate. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun dailyRentalRateCurrency(): Optional = + dailyRentalRateCurrency.getOptional("daily_rental_rate_currency") + + /** + * Number of days the vehicle was rented. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun daysRented(): Optional = daysRented.getOptional("days_rented") + + /** + * Additional charges (gas, late fee, etc.) being billed. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun extraCharges(): Optional = + extraCharges.getOptional("extra_charges") + + /** + * Fuel charges for the vehicle. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun fuelChargesAmount(): Optional = + fuelChargesAmount.getOptional("fuel_charges_amount") + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fuel + * charges assessed. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun fuelChargesCurrency(): Optional = + fuelChargesCurrency.getOptional("fuel_charges_currency") + + /** + * Any insurance being charged for the vehicle. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun insuranceChargesAmount(): Optional = + insuranceChargesAmount.getOptional("insurance_charges_amount") + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the insurance + * charges assessed. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun insuranceChargesCurrency(): Optional = + insuranceChargesCurrency.getOptional("insurance_charges_currency") + + /** + * An indicator that the cardholder is being billed for a reserved vehicle that + * was not actually rented (that is, a "no-show" charge). + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun noShowIndicator(): Optional = + noShowIndicator.getOptional("no_show_indicator") + + /** + * Charges for returning the vehicle at a different location than where it was + * picked up. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun oneWayDropOffChargesAmount(): Optional = + oneWayDropOffChargesAmount.getOptional("one_way_drop_off_charges_amount") + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the one-way + * drop-off charges assessed. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun oneWayDropOffChargesCurrency(): Optional = + oneWayDropOffChargesCurrency.getOptional( + "one_way_drop_off_charges_currency" + ) /** - * Returns this class instance's raw value. + * Name of the person renting the vehicle. * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { + fun renterName(): Optional = renterName.getOptional("renter_name") - /** US Dollar (USD) */ - @JvmField val USD = of("USD") + /** + * Weekly rate being charged for the vehicle. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun weeklyRentalRateAmount(): Optional = + weeklyRentalRateAmount.getOptional("weekly_rental_rate_amount") - @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) - } + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the weekly + * rental rate. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun weeklyRentalRateCurrency(): Optional = + weeklyRentalRateCurrency.getOptional("weekly_rental_rate_currency") - /** An enum containing [Currency]'s known values. */ - enum class Known { - /** US Dollar (USD) */ - USD - } + /** + * Returns the raw JSON value of [carClassCode]. + * + * Unlike [carClassCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("car_class_code") + @ExcludeMissing + fun _carClassCode(): JsonField = carClassCode /** - * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] - * member. + * Returns the raw JSON value of [checkoutDate]. * - * An instance of [Currency] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. + * Unlike [checkoutDate], this method doesn't throw if the JSON field has an + * unexpected type. */ - enum class Value { - /** US Dollar (USD) */ - USD, - /** - * An enum member indicating that [Currency] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } + @JsonProperty("checkout_date") + @ExcludeMissing + fun _checkoutDate(): JsonField = checkoutDate /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * Returns the raw JSON value of [dailyRentalRateAmount]. * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. + * Unlike [dailyRentalRateAmount], this method doesn't throw if the JSON field + * has an unexpected type. */ - fun value(): Value = - when (this) { - USD -> Value.USD - else -> Value._UNKNOWN - } + @JsonProperty("daily_rental_rate_amount") + @ExcludeMissing + fun _dailyRentalRateAmount(): JsonField = dailyRentalRateAmount /** - * Returns an enum member corresponding to this class instance's value. + * Returns the raw JSON value of [dailyRentalRateCurrency]. * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. + * Unlike [dailyRentalRateCurrency], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("daily_rental_rate_currency") + @ExcludeMissing + fun _dailyRentalRateCurrency(): JsonField = dailyRentalRateCurrency + + /** + * Returns the raw JSON value of [daysRented]. * - * @throws IncreaseInvalidDataException if this class instance's value is a not - * a known member. + * Unlike [daysRented], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun known(): Known = - when (this) { - USD -> Known.USD - else -> throw IncreaseInvalidDataException("Unknown Currency: $value") - } + @JsonProperty("days_rented") + @ExcludeMissing + fun _daysRented(): JsonField = daysRented /** - * Returns this class instance's primitive wire representation. + * Returns the raw JSON value of [extraCharges]. * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. + * Unlike [extraCharges], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("extra_charges") + @ExcludeMissing + fun _extraCharges(): JsonField = extraCharges + + /** + * Returns the raw JSON value of [fuelChargesAmount]. * - * @throws IncreaseInvalidDataException if this class instance's value does not - * have the expected primitive type. + * Unlike [fuelChargesAmount], this method doesn't throw if the JSON field has + * an unexpected type. */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + @JsonProperty("fuel_charges_amount") + @ExcludeMissing + fun _fuelChargesAmount(): JsonField = fuelChargesAmount - private var validated: Boolean = false + /** + * Returns the raw JSON value of [fuelChargesCurrency]. + * + * Unlike [fuelChargesCurrency], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("fuel_charges_currency") + @ExcludeMissing + fun _fuelChargesCurrency(): JsonField = fuelChargesCurrency - fun validate(): Currency = apply { - if (validated) { - return@apply - } + /** + * Returns the raw JSON value of [insuranceChargesAmount]. + * + * Unlike [insuranceChargesAmount], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("insurance_charges_amount") + @ExcludeMissing + fun _insuranceChargesAmount(): JsonField = insuranceChargesAmount - known() - validated = true - } + /** + * Returns the raw JSON value of [insuranceChargesCurrency]. + * + * Unlike [insuranceChargesCurrency], this method doesn't throw if the JSON + * field has an unexpected type. + */ + @JsonProperty("insurance_charges_currency") + @ExcludeMissing + fun _insuranceChargesCurrency(): JsonField = insuranceChargesCurrency - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * Returns the raw JSON value of [noShowIndicator]. + * + * Unlike [noShowIndicator], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("no_show_indicator") + @ExcludeMissing + fun _noShowIndicator(): JsonField = noShowIndicator /** - * Returns a score indicating how many valid values are contained in this object - * recursively. + * Returns the raw JSON value of [oneWayDropOffChargesAmount]. * - * Used for best match union deserialization. + * Unlike [oneWayDropOffChargesAmount], this method doesn't throw if the JSON + * field has an unexpected type. */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + @JsonProperty("one_way_drop_off_charges_amount") + @ExcludeMissing + fun _oneWayDropOffChargesAmount(): JsonField = oneWayDropOffChargesAmount - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Returns the raw JSON value of [oneWayDropOffChargesCurrency]. + * + * Unlike [oneWayDropOffChargesCurrency], this method doesn't throw if the JSON + * field has an unexpected type. + */ + @JsonProperty("one_way_drop_off_charges_currency") + @ExcludeMissing + fun _oneWayDropOffChargesCurrency(): JsonField = + oneWayDropOffChargesCurrency - return other is Currency && value == other.value - } + /** + * Returns the raw JSON value of [renterName]. + * + * Unlike [renterName], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("renter_name") + @ExcludeMissing + fun _renterName(): JsonField = renterName - override fun hashCode() = value.hashCode() + /** + * Returns the raw JSON value of [weeklyRentalRateAmount]. + * + * Unlike [weeklyRentalRateAmount], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("weekly_rental_rate_amount") + @ExcludeMissing + fun _weeklyRentalRateAmount(): JsonField = weeklyRentalRateAmount - override fun toString() = value.toString() - } + /** + * Returns the raw JSON value of [weeklyRentalRateCurrency]. + * + * Unlike [weeklyRentalRateCurrency], this method doesn't throw if the JSON + * field has an unexpected type. + */ + @JsonProperty("weekly_rental_rate_currency") + @ExcludeMissing + fun _weeklyRentalRateCurrency(): JsonField = weeklyRentalRateCurrency - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) } - return other is Interchange && - amount == other.amount && - code == other.code && - currency == other.currency && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(amount, code, currency, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Interchange{amount=$amount, code=$code, currency=$currency, additionalProperties=$additionalProperties}" - } - - /** Network-specific identifiers for this refund. */ - class NetworkIdentifiers - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val acquirerBusinessId: JsonField, - private val acquirerReferenceNumber: JsonField, - private val authorizationIdentificationResponse: JsonField, - private val transactionId: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("acquirer_business_id") - @ExcludeMissing - acquirerBusinessId: JsonField = JsonMissing.of(), - @JsonProperty("acquirer_reference_number") - @ExcludeMissing - acquirerReferenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("authorization_identification_response") - @ExcludeMissing - authorizationIdentificationResponse: JsonField = JsonMissing.of(), - @JsonProperty("transaction_id") + @JsonAnyGetter @ExcludeMissing - transactionId: JsonField = JsonMissing.of(), - ) : this( - acquirerBusinessId, - acquirerReferenceNumber, - authorizationIdentificationResponse, - transactionId, - mutableMapOf(), - ) + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** - * A network assigned business ID that identifies the acquirer that processed this - * transaction. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). - */ - fun acquirerBusinessId(): String = - acquirerBusinessId.getRequired("acquirer_business_id") + fun toBuilder() = Builder().from(this) - /** - * A globally unique identifier for this settlement. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). - */ - fun acquirerReferenceNumber(): String = - acquirerReferenceNumber.getRequired("acquirer_reference_number") + companion object { - /** - * The randomly generated 6-character Authorization Identification Response code - * sent back to the acquirer in an approved response. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun authorizationIdentificationResponse(): Optional = - authorizationIdentificationResponse.getOptional( - "authorization_identification_response" - ) + /** + * Returns a mutable builder for constructing an instance of [CarRental]. + * + * The following fields are required: + * ```java + * .carClassCode() + * .checkoutDate() + * .dailyRentalRateAmount() + * .dailyRentalRateCurrency() + * .daysRented() + * .extraCharges() + * .fuelChargesAmount() + * .fuelChargesCurrency() + * .insuranceChargesAmount() + * .insuranceChargesCurrency() + * .noShowIndicator() + * .oneWayDropOffChargesAmount() + * .oneWayDropOffChargesCurrency() + * .renterName() + * .weeklyRentalRateAmount() + * .weeklyRentalRateCurrency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - /** - * A globally unique transaction identifier provided by the card network, used - * across multiple life-cycle requests. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun transactionId(): Optional = transactionId.getOptional("transaction_id") + /** A builder for [CarRental]. */ + class Builder internal constructor() { - /** - * Returns the raw JSON value of [acquirerBusinessId]. - * - * Unlike [acquirerBusinessId], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("acquirer_business_id") - @ExcludeMissing - fun _acquirerBusinessId(): JsonField = acquirerBusinessId + private var carClassCode: JsonField? = null + private var checkoutDate: JsonField? = null + private var dailyRentalRateAmount: JsonField? = null + private var dailyRentalRateCurrency: JsonField? = null + private var daysRented: JsonField? = null + private var extraCharges: JsonField? = null + private var fuelChargesAmount: JsonField? = null + private var fuelChargesCurrency: JsonField? = null + private var insuranceChargesAmount: JsonField? = null + private var insuranceChargesCurrency: JsonField? = null + private var noShowIndicator: JsonField? = null + private var oneWayDropOffChargesAmount: JsonField? = null + private var oneWayDropOffChargesCurrency: JsonField? = null + private var renterName: JsonField? = null + private var weeklyRentalRateAmount: JsonField? = null + private var weeklyRentalRateCurrency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() - /** - * Returns the raw JSON value of [acquirerReferenceNumber]. - * - * Unlike [acquirerReferenceNumber], this method doesn't throw if the JSON field has - * an unexpected type. - */ - @JsonProperty("acquirer_reference_number") - @ExcludeMissing - fun _acquirerReferenceNumber(): JsonField = acquirerReferenceNumber + @JvmSynthetic + internal fun from(carRental: CarRental) = apply { + carClassCode = carRental.carClassCode + checkoutDate = carRental.checkoutDate + dailyRentalRateAmount = carRental.dailyRentalRateAmount + dailyRentalRateCurrency = carRental.dailyRentalRateCurrency + daysRented = carRental.daysRented + extraCharges = carRental.extraCharges + fuelChargesAmount = carRental.fuelChargesAmount + fuelChargesCurrency = carRental.fuelChargesCurrency + insuranceChargesAmount = carRental.insuranceChargesAmount + insuranceChargesCurrency = carRental.insuranceChargesCurrency + noShowIndicator = carRental.noShowIndicator + oneWayDropOffChargesAmount = carRental.oneWayDropOffChargesAmount + oneWayDropOffChargesCurrency = carRental.oneWayDropOffChargesCurrency + renterName = carRental.renterName + weeklyRentalRateAmount = carRental.weeklyRentalRateAmount + weeklyRentalRateCurrency = carRental.weeklyRentalRateCurrency + additionalProperties = carRental.additionalProperties.toMutableMap() + } - /** - * Returns the raw JSON value of [authorizationIdentificationResponse]. - * - * Unlike [authorizationIdentificationResponse], this method doesn't throw if the - * JSON field has an unexpected type. - */ - @JsonProperty("authorization_identification_response") - @ExcludeMissing - fun _authorizationIdentificationResponse(): JsonField = - authorizationIdentificationResponse + /** Code indicating the vehicle's class. */ + fun carClassCode(carClassCode: String?) = + carClassCode(JsonField.ofNullable(carClassCode)) - /** - * Returns the raw JSON value of [transactionId]. - * - * Unlike [transactionId], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("transaction_id") - @ExcludeMissing - fun _transactionId(): JsonField = transactionId + /** + * Alias for calling [Builder.carClassCode] with + * `carClassCode.orElse(null)`. + */ + fun carClassCode(carClassCode: Optional) = + carClassCode(carClassCode.getOrNull()) - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** + * Sets [Builder.carClassCode] to an arbitrary JSON value. + * + * You should usually call [Builder.carClassCode] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun carClassCode(carClassCode: JsonField) = apply { + this.carClassCode = carClassCode + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** + * Date the customer picked up the car or, in the case of a no-show or + * pre-pay transaction, the scheduled pick up date. + */ + fun checkoutDate(checkoutDate: LocalDate?) = + checkoutDate(JsonField.ofNullable(checkoutDate)) - fun toBuilder() = Builder().from(this) + /** + * Alias for calling [Builder.checkoutDate] with + * `checkoutDate.orElse(null)`. + */ + fun checkoutDate(checkoutDate: Optional) = + checkoutDate(checkoutDate.getOrNull()) - companion object { + /** + * Sets [Builder.checkoutDate] to an arbitrary JSON value. + * + * You should usually call [Builder.checkoutDate] with a well-typed + * [LocalDate] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun checkoutDate(checkoutDate: JsonField) = apply { + this.checkoutDate = checkoutDate + } - /** - * Returns a mutable builder for constructing an instance of - * [NetworkIdentifiers]. - * - * The following fields are required: - * ```java - * .acquirerBusinessId() - * .acquirerReferenceNumber() - * .authorizationIdentificationResponse() - * .transactionId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + /** Daily rate being charged for the vehicle. */ + fun dailyRentalRateAmount(dailyRentalRateAmount: Long?) = + dailyRentalRateAmount(JsonField.ofNullable(dailyRentalRateAmount)) + + /** + * Alias for [Builder.dailyRentalRateAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun dailyRentalRateAmount(dailyRentalRateAmount: Long) = + dailyRentalRateAmount(dailyRentalRateAmount as Long?) - /** A builder for [NetworkIdentifiers]. */ - class Builder internal constructor() { + /** + * Alias for calling [Builder.dailyRentalRateAmount] with + * `dailyRentalRateAmount.orElse(null)`. + */ + fun dailyRentalRateAmount(dailyRentalRateAmount: Optional) = + dailyRentalRateAmount(dailyRentalRateAmount.getOrNull()) - private var acquirerBusinessId: JsonField? = null - private var acquirerReferenceNumber: JsonField? = null - private var authorizationIdentificationResponse: JsonField? = null - private var transactionId: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** + * Sets [Builder.dailyRentalRateAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.dailyRentalRateAmount] with a well-typed + * [Long] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun dailyRentalRateAmount(dailyRentalRateAmount: JsonField) = apply { + this.dailyRentalRateAmount = dailyRentalRateAmount + } - @JvmSynthetic - internal fun from(networkIdentifiers: NetworkIdentifiers) = apply { - acquirerBusinessId = networkIdentifiers.acquirerBusinessId - acquirerReferenceNumber = networkIdentifiers.acquirerReferenceNumber - authorizationIdentificationResponse = - networkIdentifiers.authorizationIdentificationResponse - transactionId = networkIdentifiers.transactionId - additionalProperties = - networkIdentifiers.additionalProperties.toMutableMap() - } + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily + * rental rate. + */ + fun dailyRentalRateCurrency(dailyRentalRateCurrency: String?) = + dailyRentalRateCurrency(JsonField.ofNullable(dailyRentalRateCurrency)) - /** - * A network assigned business ID that identifies the acquirer that processed - * this transaction. - */ - fun acquirerBusinessId(acquirerBusinessId: String) = - acquirerBusinessId(JsonField.of(acquirerBusinessId)) + /** + * Alias for calling [Builder.dailyRentalRateCurrency] with + * `dailyRentalRateCurrency.orElse(null)`. + */ + fun dailyRentalRateCurrency(dailyRentalRateCurrency: Optional) = + dailyRentalRateCurrency(dailyRentalRateCurrency.getOrNull()) - /** - * Sets [Builder.acquirerBusinessId] to an arbitrary JSON value. - * - * You should usually call [Builder.acquirerBusinessId] with a well-typed - * [String] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun acquirerBusinessId(acquirerBusinessId: JsonField) = apply { - this.acquirerBusinessId = acquirerBusinessId - } + /** + * Sets [Builder.dailyRentalRateCurrency] to an arbitrary JSON value. + * + * You should usually call [Builder.dailyRentalRateCurrency] with a + * well-typed [String] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ + fun dailyRentalRateCurrency(dailyRentalRateCurrency: JsonField) = + apply { + this.dailyRentalRateCurrency = dailyRentalRateCurrency + } - /** A globally unique identifier for this settlement. */ - fun acquirerReferenceNumber(acquirerReferenceNumber: String) = - acquirerReferenceNumber(JsonField.of(acquirerReferenceNumber)) + /** Number of days the vehicle was rented. */ + fun daysRented(daysRented: Long?) = + daysRented(JsonField.ofNullable(daysRented)) - /** - * Sets [Builder.acquirerReferenceNumber] to an arbitrary JSON value. - * - * You should usually call [Builder.acquirerReferenceNumber] with a well-typed - * [String] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun acquirerReferenceNumber(acquirerReferenceNumber: JsonField) = - apply { - this.acquirerReferenceNumber = acquirerReferenceNumber - } + /** + * Alias for [Builder.daysRented]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun daysRented(daysRented: Long) = daysRented(daysRented as Long?) - /** - * The randomly generated 6-character Authorization Identification Response code - * sent back to the acquirer in an approved response. - */ - fun authorizationIdentificationResponse( - authorizationIdentificationResponse: String? - ) = - authorizationIdentificationResponse( - JsonField.ofNullable(authorizationIdentificationResponse) - ) + /** + * Alias for calling [Builder.daysRented] with `daysRented.orElse(null)`. + */ + fun daysRented(daysRented: Optional) = + daysRented(daysRented.getOrNull()) - /** - * Alias for calling [Builder.authorizationIdentificationResponse] with - * `authorizationIdentificationResponse.orElse(null)`. - */ - fun authorizationIdentificationResponse( - authorizationIdentificationResponse: Optional - ) = - authorizationIdentificationResponse( - authorizationIdentificationResponse.getOrNull() - ) + /** + * Sets [Builder.daysRented] to an arbitrary JSON value. + * + * You should usually call [Builder.daysRented] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun daysRented(daysRented: JsonField) = apply { + this.daysRented = daysRented + } - /** - * Sets [Builder.authorizationIdentificationResponse] to an arbitrary JSON - * value. - * - * You should usually call [Builder.authorizationIdentificationResponse] with a - * well-typed [String] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun authorizationIdentificationResponse( - authorizationIdentificationResponse: JsonField - ) = apply { - this.authorizationIdentificationResponse = - authorizationIdentificationResponse - } + /** Additional charges (gas, late fee, etc.) being billed. */ + fun extraCharges(extraCharges: ExtraCharges?) = + extraCharges(JsonField.ofNullable(extraCharges)) - /** - * A globally unique transaction identifier provided by the card network, used - * across multiple life-cycle requests. - */ - fun transactionId(transactionId: String?) = - transactionId(JsonField.ofNullable(transactionId)) + /** + * Alias for calling [Builder.extraCharges] with + * `extraCharges.orElse(null)`. + */ + fun extraCharges(extraCharges: Optional) = + extraCharges(extraCharges.getOrNull()) - /** - * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`. - */ - fun transactionId(transactionId: Optional) = - transactionId(transactionId.getOrNull()) + /** + * Sets [Builder.extraCharges] to an arbitrary JSON value. + * + * You should usually call [Builder.extraCharges] with a well-typed + * [ExtraCharges] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun extraCharges(extraCharges: JsonField) = apply { + this.extraCharges = extraCharges + } - /** - * Sets [Builder.transactionId] to an arbitrary JSON value. - * - * You should usually call [Builder.transactionId] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun transactionId(transactionId: JsonField) = apply { - this.transactionId = transactionId - } + /** Fuel charges for the vehicle. */ + fun fuelChargesAmount(fuelChargesAmount: Long?) = + fuelChargesAmount(JsonField.ofNullable(fuelChargesAmount)) - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** + * Alias for [Builder.fuelChargesAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun fuelChargesAmount(fuelChargesAmount: Long) = + fuelChargesAmount(fuelChargesAmount as Long?) - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** + * Alias for calling [Builder.fuelChargesAmount] with + * `fuelChargesAmount.orElse(null)`. + */ + fun fuelChargesAmount(fuelChargesAmount: Optional) = + fuelChargesAmount(fuelChargesAmount.getOrNull()) - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + /** + * Sets [Builder.fuelChargesAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.fuelChargesAmount] with a well-typed + * [Long] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun fuelChargesAmount(fuelChargesAmount: JsonField) = apply { + this.fuelChargesAmount = fuelChargesAmount } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fuel + * charges assessed. + */ + fun fuelChargesCurrency(fuelChargesCurrency: String?) = + fuelChargesCurrency(JsonField.ofNullable(fuelChargesCurrency)) - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** + * Alias for calling [Builder.fuelChargesCurrency] with + * `fuelChargesCurrency.orElse(null)`. + */ + fun fuelChargesCurrency(fuelChargesCurrency: Optional) = + fuelChargesCurrency(fuelChargesCurrency.getOrNull()) - /** - * Returns an immutable instance of [NetworkIdentifiers]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .acquirerBusinessId() - * .acquirerReferenceNumber() - * .authorizationIdentificationResponse() - * .transactionId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): NetworkIdentifiers = - NetworkIdentifiers( - checkRequired("acquirerBusinessId", acquirerBusinessId), - checkRequired("acquirerReferenceNumber", acquirerReferenceNumber), - checkRequired( - "authorizationIdentificationResponse", - authorizationIdentificationResponse, - ), - checkRequired("transactionId", transactionId), - additionalProperties.toMutableMap(), - ) - } + /** + * Sets [Builder.fuelChargesCurrency] to an arbitrary JSON value. + * + * You should usually call [Builder.fuelChargesCurrency] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun fuelChargesCurrency(fuelChargesCurrency: JsonField) = apply { + this.fuelChargesCurrency = fuelChargesCurrency + } - private var validated: Boolean = false + /** Any insurance being charged for the vehicle. */ + fun insuranceChargesAmount(insuranceChargesAmount: Long?) = + insuranceChargesAmount(JsonField.ofNullable(insuranceChargesAmount)) - fun validate(): NetworkIdentifiers = apply { - if (validated) { - return@apply - } + /** + * Alias for [Builder.insuranceChargesAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun insuranceChargesAmount(insuranceChargesAmount: Long) = + insuranceChargesAmount(insuranceChargesAmount as Long?) - acquirerBusinessId() - acquirerReferenceNumber() - authorizationIdentificationResponse() - transactionId() - validated = true - } + /** + * Alias for calling [Builder.insuranceChargesAmount] with + * `insuranceChargesAmount.orElse(null)`. + */ + fun insuranceChargesAmount(insuranceChargesAmount: Optional) = + insuranceChargesAmount(insuranceChargesAmount.getOrNull()) - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * Sets [Builder.insuranceChargesAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.insuranceChargesAmount] with a + * well-typed [Long] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun insuranceChargesAmount(insuranceChargesAmount: JsonField) = + apply { + this.insuranceChargesAmount = insuranceChargesAmount + } - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (acquirerBusinessId.asKnown().isPresent) 1 else 0) + - (if (acquirerReferenceNumber.asKnown().isPresent) 1 else 0) + - (if (authorizationIdentificationResponse.asKnown().isPresent) 1 else 0) + - (if (transactionId.asKnown().isPresent) 1 else 0) + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * insurance charges assessed. + */ + fun insuranceChargesCurrency(insuranceChargesCurrency: String?) = + insuranceChargesCurrency(JsonField.ofNullable(insuranceChargesCurrency)) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Alias for calling [Builder.insuranceChargesCurrency] with + * `insuranceChargesCurrency.orElse(null)`. + */ + fun insuranceChargesCurrency(insuranceChargesCurrency: Optional) = + insuranceChargesCurrency(insuranceChargesCurrency.getOrNull()) - return other is NetworkIdentifiers && - acquirerBusinessId == other.acquirerBusinessId && - acquirerReferenceNumber == other.acquirerReferenceNumber && - authorizationIdentificationResponse == - other.authorizationIdentificationResponse && - transactionId == other.transactionId && - additionalProperties == other.additionalProperties - } + /** + * Sets [Builder.insuranceChargesCurrency] to an arbitrary JSON value. + * + * You should usually call [Builder.insuranceChargesCurrency] with a + * well-typed [String] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ + fun insuranceChargesCurrency(insuranceChargesCurrency: JsonField) = + apply { + this.insuranceChargesCurrency = insuranceChargesCurrency + } - private val hashCode: Int by lazy { - Objects.hash( - acquirerBusinessId, - acquirerReferenceNumber, - authorizationIdentificationResponse, - transactionId, - additionalProperties, - ) - } + /** + * An indicator that the cardholder is being billed for a reserved vehicle + * that was not actually rented (that is, a "no-show" charge). + */ + fun noShowIndicator(noShowIndicator: NoShowIndicator?) = + noShowIndicator(JsonField.ofNullable(noShowIndicator)) - override fun hashCode(): Int = hashCode + /** + * Alias for calling [Builder.noShowIndicator] with + * `noShowIndicator.orElse(null)`. + */ + fun noShowIndicator(noShowIndicator: Optional) = + noShowIndicator(noShowIndicator.getOrNull()) - override fun toString() = - "NetworkIdentifiers{acquirerBusinessId=$acquirerBusinessId, acquirerReferenceNumber=$acquirerReferenceNumber, authorizationIdentificationResponse=$authorizationIdentificationResponse, transactionId=$transactionId, additionalProperties=$additionalProperties}" - } + /** + * Sets [Builder.noShowIndicator] to an arbitrary JSON value. + * + * You should usually call [Builder.noShowIndicator] with a well-typed + * [NoShowIndicator] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun noShowIndicator(noShowIndicator: JsonField) = apply { + this.noShowIndicator = noShowIndicator + } - /** - * Additional details about the card purchase, such as tax and industry-specific fields. - */ - class PurchaseDetails - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val carRental: JsonField, - private val customerReferenceIdentifier: JsonField, - private val localTaxAmount: JsonField, - private val localTaxCurrency: JsonField, - private val lodging: JsonField, - private val nationalTaxAmount: JsonField, - private val nationalTaxCurrency: JsonField, - private val purchaseIdentifier: JsonField, - private val purchaseIdentifierFormat: JsonField, - private val travel: JsonField, - private val additionalProperties: MutableMap, - ) { + /** + * Charges for returning the vehicle at a different location than where it + * was picked up. + */ + fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Long?) = + oneWayDropOffChargesAmount( + JsonField.ofNullable(oneWayDropOffChargesAmount) + ) - @JsonCreator - private constructor( - @JsonProperty("car_rental") - @ExcludeMissing - carRental: JsonField = JsonMissing.of(), - @JsonProperty("customer_reference_identifier") - @ExcludeMissing - customerReferenceIdentifier: JsonField = JsonMissing.of(), - @JsonProperty("local_tax_amount") - @ExcludeMissing - localTaxAmount: JsonField = JsonMissing.of(), - @JsonProperty("local_tax_currency") - @ExcludeMissing - localTaxCurrency: JsonField = JsonMissing.of(), - @JsonProperty("lodging") - @ExcludeMissing - lodging: JsonField = JsonMissing.of(), - @JsonProperty("national_tax_amount") - @ExcludeMissing - nationalTaxAmount: JsonField = JsonMissing.of(), - @JsonProperty("national_tax_currency") - @ExcludeMissing - nationalTaxCurrency: JsonField = JsonMissing.of(), - @JsonProperty("purchase_identifier") - @ExcludeMissing - purchaseIdentifier: JsonField = JsonMissing.of(), - @JsonProperty("purchase_identifier_format") - @ExcludeMissing - purchaseIdentifierFormat: JsonField = - JsonMissing.of(), - @JsonProperty("travel") - @ExcludeMissing - travel: JsonField = JsonMissing.of(), - ) : this( - carRental, - customerReferenceIdentifier, - localTaxAmount, - localTaxCurrency, - lodging, - nationalTaxAmount, - nationalTaxCurrency, - purchaseIdentifier, - purchaseIdentifierFormat, - travel, - mutableMapOf(), - ) + /** + * Alias for [Builder.oneWayDropOffChargesAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Long) = + oneWayDropOffChargesAmount(oneWayDropOffChargesAmount as Long?) - /** - * Fields specific to car rentals. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun carRental(): Optional = carRental.getOptional("car_rental") + /** + * Alias for calling [Builder.oneWayDropOffChargesAmount] with + * `oneWayDropOffChargesAmount.orElse(null)`. + */ + fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Optional) = + oneWayDropOffChargesAmount(oneWayDropOffChargesAmount.getOrNull()) - /** - * An identifier from the merchant for the customer or consumer. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun customerReferenceIdentifier(): Optional = - customerReferenceIdentifier.getOptional("customer_reference_identifier") + /** + * Sets [Builder.oneWayDropOffChargesAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.oneWayDropOffChargesAmount] with a + * well-typed [Long] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun oneWayDropOffChargesAmount( + oneWayDropOffChargesAmount: JsonField + ) = apply { this.oneWayDropOffChargesAmount = oneWayDropOffChargesAmount } - /** - * The state or provincial tax amount in minor units. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun localTaxAmount(): Optional = - localTaxAmount.getOptional("local_tax_amount") + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * one-way drop-off charges assessed. + */ + fun oneWayDropOffChargesCurrency(oneWayDropOffChargesCurrency: String?) = + oneWayDropOffChargesCurrency( + JsonField.ofNullable(oneWayDropOffChargesCurrency) + ) - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax - * assessed. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun localTaxCurrency(): Optional = - localTaxCurrency.getOptional("local_tax_currency") + /** + * Alias for calling [Builder.oneWayDropOffChargesCurrency] with + * `oneWayDropOffChargesCurrency.orElse(null)`. + */ + fun oneWayDropOffChargesCurrency( + oneWayDropOffChargesCurrency: Optional + ) = oneWayDropOffChargesCurrency(oneWayDropOffChargesCurrency.getOrNull()) - /** - * Fields specific to lodging. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun lodging(): Optional = lodging.getOptional("lodging") + /** + * Sets [Builder.oneWayDropOffChargesCurrency] to an arbitrary JSON value. + * + * You should usually call [Builder.oneWayDropOffChargesCurrency] with a + * well-typed [String] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ + fun oneWayDropOffChargesCurrency( + oneWayDropOffChargesCurrency: JsonField + ) = apply { + this.oneWayDropOffChargesCurrency = oneWayDropOffChargesCurrency + } - /** - * The national tax amount in minor units. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun nationalTaxAmount(): Optional = - nationalTaxAmount.getOptional("national_tax_amount") + /** Name of the person renting the vehicle. */ + fun renterName(renterName: String?) = + renterName(JsonField.ofNullable(renterName)) - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax - * assessed. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun nationalTaxCurrency(): Optional = - nationalTaxCurrency.getOptional("national_tax_currency") + /** + * Alias for calling [Builder.renterName] with `renterName.orElse(null)`. + */ + fun renterName(renterName: Optional) = + renterName(renterName.getOrNull()) - /** - * An identifier from the merchant for the purchase to the issuer and cardholder. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun purchaseIdentifier(): Optional = - purchaseIdentifier.getOptional("purchase_identifier") + /** + * Sets [Builder.renterName] to an arbitrary JSON value. + * + * You should usually call [Builder.renterName] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun renterName(renterName: JsonField) = apply { + this.renterName = renterName + } - /** - * The format of the purchase identifier. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun purchaseIdentifierFormat(): Optional = - purchaseIdentifierFormat.getOptional("purchase_identifier_format") + /** Weekly rate being charged for the vehicle. */ + fun weeklyRentalRateAmount(weeklyRentalRateAmount: Long?) = + weeklyRentalRateAmount(JsonField.ofNullable(weeklyRentalRateAmount)) - /** - * Fields specific to travel. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun travel(): Optional = travel.getOptional("travel") + /** + * Alias for [Builder.weeklyRentalRateAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun weeklyRentalRateAmount(weeklyRentalRateAmount: Long) = + weeklyRentalRateAmount(weeklyRentalRateAmount as Long?) - /** - * Returns the raw JSON value of [carRental]. - * - * Unlike [carRental], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("car_rental") - @ExcludeMissing - fun _carRental(): JsonField = carRental + /** + * Alias for calling [Builder.weeklyRentalRateAmount] with + * `weeklyRentalRateAmount.orElse(null)`. + */ + fun weeklyRentalRateAmount(weeklyRentalRateAmount: Optional) = + weeklyRentalRateAmount(weeklyRentalRateAmount.getOrNull()) - /** - * Returns the raw JSON value of [customerReferenceIdentifier]. - * - * Unlike [customerReferenceIdentifier], this method doesn't throw if the JSON field - * has an unexpected type. - */ - @JsonProperty("customer_reference_identifier") - @ExcludeMissing - fun _customerReferenceIdentifier(): JsonField = customerReferenceIdentifier + /** + * Sets [Builder.weeklyRentalRateAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.weeklyRentalRateAmount] with a + * well-typed [Long] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun weeklyRentalRateAmount(weeklyRentalRateAmount: JsonField) = + apply { + this.weeklyRentalRateAmount = weeklyRentalRateAmount + } - /** - * Returns the raw JSON value of [localTaxAmount]. - * - * Unlike [localTaxAmount], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("local_tax_amount") - @ExcludeMissing - fun _localTaxAmount(): JsonField = localTaxAmount + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * weekly rental rate. + */ + fun weeklyRentalRateCurrency(weeklyRentalRateCurrency: String?) = + weeklyRentalRateCurrency(JsonField.ofNullable(weeklyRentalRateCurrency)) - /** - * Returns the raw JSON value of [localTaxCurrency]. - * - * Unlike [localTaxCurrency], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("local_tax_currency") - @ExcludeMissing - fun _localTaxCurrency(): JsonField = localTaxCurrency + /** + * Alias for calling [Builder.weeklyRentalRateCurrency] with + * `weeklyRentalRateCurrency.orElse(null)`. + */ + fun weeklyRentalRateCurrency(weeklyRentalRateCurrency: Optional) = + weeklyRentalRateCurrency(weeklyRentalRateCurrency.getOrNull()) - /** - * Returns the raw JSON value of [lodging]. - * - * Unlike [lodging], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("lodging") - @ExcludeMissing - fun _lodging(): JsonField = lodging + /** + * Sets [Builder.weeklyRentalRateCurrency] to an arbitrary JSON value. + * + * You should usually call [Builder.weeklyRentalRateCurrency] with a + * well-typed [String] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ + fun weeklyRentalRateCurrency(weeklyRentalRateCurrency: JsonField) = + apply { + this.weeklyRentalRateCurrency = weeklyRentalRateCurrency + } - /** - * Returns the raw JSON value of [nationalTaxAmount]. - * - * Unlike [nationalTaxAmount], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("national_tax_amount") - @ExcludeMissing - fun _nationalTaxAmount(): JsonField = nationalTaxAmount + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * Returns the raw JSON value of [nationalTaxCurrency]. - * - * Unlike [nationalTaxCurrency], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("national_tax_currency") - @ExcludeMissing - fun _nationalTaxCurrency(): JsonField = nationalTaxCurrency + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * Returns the raw JSON value of [purchaseIdentifier]. - * - * Unlike [purchaseIdentifier], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("purchase_identifier") - @ExcludeMissing - fun _purchaseIdentifier(): JsonField = purchaseIdentifier + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } - /** - * Returns the raw JSON value of [purchaseIdentifierFormat]. - * - * Unlike [purchaseIdentifierFormat], this method doesn't throw if the JSON field - * has an unexpected type. - */ - @JsonProperty("purchase_identifier_format") - @ExcludeMissing - fun _purchaseIdentifierFormat(): JsonField = - purchaseIdentifierFormat + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * Returns the raw JSON value of [travel]. - * - * Unlike [travel], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("travel") @ExcludeMissing fun _travel(): JsonField = travel + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** + * Returns an immutable instance of [CarRental]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .carClassCode() + * .checkoutDate() + * .dailyRentalRateAmount() + * .dailyRentalRateCurrency() + * .daysRented() + * .extraCharges() + * .fuelChargesAmount() + * .fuelChargesCurrency() + * .insuranceChargesAmount() + * .insuranceChargesCurrency() + * .noShowIndicator() + * .oneWayDropOffChargesAmount() + * .oneWayDropOffChargesCurrency() + * .renterName() + * .weeklyRentalRateAmount() + * .weeklyRentalRateCurrency() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CarRental = + CarRental( + checkRequired("carClassCode", carClassCode), + checkRequired("checkoutDate", checkoutDate), + checkRequired("dailyRentalRateAmount", dailyRentalRateAmount), + checkRequired("dailyRentalRateCurrency", dailyRentalRateCurrency), + checkRequired("daysRented", daysRented), + checkRequired("extraCharges", extraCharges), + checkRequired("fuelChargesAmount", fuelChargesAmount), + checkRequired("fuelChargesCurrency", fuelChargesCurrency), + checkRequired("insuranceChargesAmount", insuranceChargesAmount), + checkRequired("insuranceChargesCurrency", insuranceChargesCurrency), + checkRequired("noShowIndicator", noShowIndicator), + checkRequired( + "oneWayDropOffChargesAmount", + oneWayDropOffChargesAmount, + ), + checkRequired( + "oneWayDropOffChargesCurrency", + oneWayDropOffChargesCurrency, + ), + checkRequired("renterName", renterName), + checkRequired("weeklyRentalRateAmount", weeklyRentalRateAmount), + checkRequired("weeklyRentalRateCurrency", weeklyRentalRateCurrency), + additionalProperties.toMutableMap(), + ) + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + private var validated: Boolean = false - fun toBuilder() = Builder().from(this) + fun validate(): CarRental = apply { + if (validated) { + return@apply + } - companion object { + carClassCode() + checkoutDate() + dailyRentalRateAmount() + dailyRentalRateCurrency() + daysRented() + extraCharges().ifPresent { it.validate() } + fuelChargesAmount() + fuelChargesCurrency() + insuranceChargesAmount() + insuranceChargesCurrency() + noShowIndicator().ifPresent { it.validate() } + oneWayDropOffChargesAmount() + oneWayDropOffChargesCurrency() + renterName() + weeklyRentalRateAmount() + weeklyRentalRateCurrency() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } /** - * Returns a mutable builder for constructing an instance of [PurchaseDetails]. + * Returns a score indicating how many valid values are contained in this object + * recursively. * - * The following fields are required: - * ```java - * .carRental() - * .customerReferenceIdentifier() - * .localTaxAmount() - * .localTaxCurrency() - * .lodging() - * .nationalTaxAmount() - * .nationalTaxCurrency() - * .purchaseIdentifier() - * .purchaseIdentifierFormat() - * .travel() - * ``` + * Used for best match union deserialization. */ - @JvmStatic fun builder() = Builder() - } + @JvmSynthetic + internal fun validity(): Int = + (if (carClassCode.asKnown().isPresent) 1 else 0) + + (if (checkoutDate.asKnown().isPresent) 1 else 0) + + (if (dailyRentalRateAmount.asKnown().isPresent) 1 else 0) + + (if (dailyRentalRateCurrency.asKnown().isPresent) 1 else 0) + + (if (daysRented.asKnown().isPresent) 1 else 0) + + (extraCharges.asKnown().getOrNull()?.validity() ?: 0) + + (if (fuelChargesAmount.asKnown().isPresent) 1 else 0) + + (if (fuelChargesCurrency.asKnown().isPresent) 1 else 0) + + (if (insuranceChargesAmount.asKnown().isPresent) 1 else 0) + + (if (insuranceChargesCurrency.asKnown().isPresent) 1 else 0) + + (noShowIndicator.asKnown().getOrNull()?.validity() ?: 0) + + (if (oneWayDropOffChargesAmount.asKnown().isPresent) 1 else 0) + + (if (oneWayDropOffChargesCurrency.asKnown().isPresent) 1 else 0) + + (if (renterName.asKnown().isPresent) 1 else 0) + + (if (weeklyRentalRateAmount.asKnown().isPresent) 1 else 0) + + (if (weeklyRentalRateCurrency.asKnown().isPresent) 1 else 0) - /** A builder for [PurchaseDetails]. */ - class Builder internal constructor() { + /** Additional charges (gas, late fee, etc.) being billed. */ + class ExtraCharges + @JsonCreator + private constructor(private val value: JsonField) : Enum { - private var carRental: JsonField? = null - private var customerReferenceIdentifier: JsonField? = null - private var localTaxAmount: JsonField? = null - private var localTaxCurrency: JsonField? = null - private var lodging: JsonField? = null - private var nationalTaxAmount: JsonField? = null - private var nationalTaxCurrency: JsonField? = null - private var purchaseIdentifier: JsonField? = null - private var purchaseIdentifierFormat: JsonField? = - null - private var travel: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - @JvmSynthetic - internal fun from(purchaseDetails: PurchaseDetails) = apply { - carRental = purchaseDetails.carRental - customerReferenceIdentifier = purchaseDetails.customerReferenceIdentifier - localTaxAmount = purchaseDetails.localTaxAmount - localTaxCurrency = purchaseDetails.localTaxCurrency - lodging = purchaseDetails.lodging - nationalTaxAmount = purchaseDetails.nationalTaxAmount - nationalTaxCurrency = purchaseDetails.nationalTaxCurrency - purchaseIdentifier = purchaseDetails.purchaseIdentifier - purchaseIdentifierFormat = purchaseDetails.purchaseIdentifierFormat - travel = purchaseDetails.travel - additionalProperties = purchaseDetails.additionalProperties.toMutableMap() - } + companion object { - /** Fields specific to car rentals. */ - fun carRental(carRental: CarRental?) = - carRental(JsonField.ofNullable(carRental)) + /** No extra charge */ + @JvmField val NO_EXTRA_CHARGE = of("no_extra_charge") + + /** Gas */ + @JvmField val GAS = of("gas") + + /** Extra mileage */ + @JvmField val EXTRA_MILEAGE = of("extra_mileage") + + /** Late return */ + @JvmField val LATE_RETURN = of("late_return") + + /** One way service fee */ + @JvmField val ONE_WAY_SERVICE_FEE = of("one_way_service_fee") + + /** Parking violation */ + @JvmField val PARKING_VIOLATION = of("parking_violation") + + @JvmStatic fun of(value: String) = ExtraCharges(JsonField.of(value)) + } + + /** An enum containing [ExtraCharges]'s known values. */ + enum class Known { + /** No extra charge */ + NO_EXTRA_CHARGE, + /** Gas */ + GAS, + /** Extra mileage */ + EXTRA_MILEAGE, + /** Late return */ + LATE_RETURN, + /** One way service fee */ + ONE_WAY_SERVICE_FEE, + /** Parking violation */ + PARKING_VIOLATION, + } + + /** + * An enum containing [ExtraCharges]'s known values, as well as an + * [_UNKNOWN] member. + * + * An instance of [ExtraCharges] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** No extra charge */ + NO_EXTRA_CHARGE, + /** Gas */ + GAS, + /** Extra mileage */ + EXTRA_MILEAGE, + /** Late return */ + LATE_RETURN, + /** One way service fee */ + ONE_WAY_SERVICE_FEE, + /** Parking violation */ + PARKING_VIOLATION, + /** + * An enum member indicating that [ExtraCharges] was instantiated with + * an unknown value. + */ + _UNKNOWN, + } - /** Alias for calling [Builder.carRental] with `carRental.orElse(null)`. */ - fun carRental(carRental: Optional) = carRental(carRental.getOrNull()) + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NO_EXTRA_CHARGE -> Value.NO_EXTRA_CHARGE + GAS -> Value.GAS + EXTRA_MILEAGE -> Value.EXTRA_MILEAGE + LATE_RETURN -> Value.LATE_RETURN + ONE_WAY_SERVICE_FEE -> Value.ONE_WAY_SERVICE_FEE + PARKING_VIOLATION -> Value.PARKING_VIOLATION + else -> Value._UNKNOWN + } - /** - * Sets [Builder.carRental] to an arbitrary JSON value. - * - * You should usually call [Builder.carRental] with a well-typed [CarRental] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun carRental(carRental: JsonField) = apply { - this.carRental = carRental - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + NO_EXTRA_CHARGE -> Known.NO_EXTRA_CHARGE + GAS -> Known.GAS + EXTRA_MILEAGE -> Known.EXTRA_MILEAGE + LATE_RETURN -> Known.LATE_RETURN + ONE_WAY_SERVICE_FEE -> Known.ONE_WAY_SERVICE_FEE + PARKING_VIOLATION -> Known.PARKING_VIOLATION + else -> + throw IncreaseInvalidDataException( + "Unknown ExtraCharges: $value" + ) + } - /** An identifier from the merchant for the customer or consumer. */ - fun customerReferenceIdentifier(customerReferenceIdentifier: String?) = - customerReferenceIdentifier( - JsonField.ofNullable(customerReferenceIdentifier) - ) + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - /** - * Alias for calling [Builder.customerReferenceIdentifier] with - * `customerReferenceIdentifier.orElse(null)`. - */ - fun customerReferenceIdentifier(customerReferenceIdentifier: Optional) = - customerReferenceIdentifier(customerReferenceIdentifier.getOrNull()) + private var validated: Boolean = false - /** - * Sets [Builder.customerReferenceIdentifier] to an arbitrary JSON value. - * - * You should usually call [Builder.customerReferenceIdentifier] with a - * well-typed [String] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun customerReferenceIdentifier( - customerReferenceIdentifier: JsonField - ) = apply { this.customerReferenceIdentifier = customerReferenceIdentifier } + fun validate(): ExtraCharges = apply { + if (validated) { + return@apply + } - /** The state or provincial tax amount in minor units. */ - fun localTaxAmount(localTaxAmount: Long?) = - localTaxAmount(JsonField.ofNullable(localTaxAmount)) + known() + validated = true + } - /** - * Alias for [Builder.localTaxAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun localTaxAmount(localTaxAmount: Long) = - localTaxAmount(localTaxAmount as Long?) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * Alias for calling [Builder.localTaxAmount] with - * `localTaxAmount.orElse(null)`. - */ - fun localTaxAmount(localTaxAmount: Optional) = - localTaxAmount(localTaxAmount.getOrNull()) + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - /** - * Sets [Builder.localTaxAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.localTaxAmount] with a well-typed [Long] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun localTaxAmount(localTaxAmount: JsonField) = apply { - this.localTaxAmount = localTaxAmount - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax - * assessed. - */ - fun localTaxCurrency(localTaxCurrency: String?) = - localTaxCurrency(JsonField.ofNullable(localTaxCurrency)) + return other is ExtraCharges && value == other.value + } - /** - * Alias for calling [Builder.localTaxCurrency] with - * `localTaxCurrency.orElse(null)`. - */ - fun localTaxCurrency(localTaxCurrency: Optional) = - localTaxCurrency(localTaxCurrency.getOrNull()) + override fun hashCode() = value.hashCode() - /** - * Sets [Builder.localTaxCurrency] to an arbitrary JSON value. - * - * You should usually call [Builder.localTaxCurrency] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun localTaxCurrency(localTaxCurrency: JsonField) = apply { - this.localTaxCurrency = localTaxCurrency + override fun toString() = value.toString() } - /** Fields specific to lodging. */ - fun lodging(lodging: Lodging?) = lodging(JsonField.ofNullable(lodging)) - - /** Alias for calling [Builder.lodging] with `lodging.orElse(null)`. */ - fun lodging(lodging: Optional) = lodging(lodging.getOrNull()) - - /** - * Sets [Builder.lodging] to an arbitrary JSON value. - * - * You should usually call [Builder.lodging] with a well-typed [Lodging] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun lodging(lodging: JsonField) = apply { this.lodging = lodging } - - /** The national tax amount in minor units. */ - fun nationalTaxAmount(nationalTaxAmount: Long?) = - nationalTaxAmount(JsonField.ofNullable(nationalTaxAmount)) - /** - * Alias for [Builder.nationalTaxAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. + * An indicator that the cardholder is being billed for a reserved vehicle that + * was not actually rented (that is, a "no-show" charge). */ - fun nationalTaxAmount(nationalTaxAmount: Long) = - nationalTaxAmount(nationalTaxAmount as Long?) + class NoShowIndicator + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** - * Alias for calling [Builder.nationalTaxAmount] with - * `nationalTaxAmount.orElse(null)`. - */ - fun nationalTaxAmount(nationalTaxAmount: Optional) = - nationalTaxAmount(nationalTaxAmount.getOrNull()) + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** - * Sets [Builder.nationalTaxAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.nationalTaxAmount] with a well-typed [Long] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun nationalTaxAmount(nationalTaxAmount: JsonField) = apply { - this.nationalTaxAmount = nationalTaxAmount - } + companion object { - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax - * assessed. - */ - fun nationalTaxCurrency(nationalTaxCurrency: String?) = - nationalTaxCurrency(JsonField.ofNullable(nationalTaxCurrency)) + /** Not applicable */ + @JvmField val NOT_APPLICABLE = of("not_applicable") - /** - * Alias for calling [Builder.nationalTaxCurrency] with - * `nationalTaxCurrency.orElse(null)`. - */ - fun nationalTaxCurrency(nationalTaxCurrency: Optional) = - nationalTaxCurrency(nationalTaxCurrency.getOrNull()) + /** No show for specialized vehicle */ + @JvmField + val NO_SHOW_FOR_SPECIALIZED_VEHICLE = + of("no_show_for_specialized_vehicle") - /** - * Sets [Builder.nationalTaxCurrency] to an arbitrary JSON value. - * - * You should usually call [Builder.nationalTaxCurrency] with a well-typed - * [String] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun nationalTaxCurrency(nationalTaxCurrency: JsonField) = apply { - this.nationalTaxCurrency = nationalTaxCurrency - } + @JvmStatic fun of(value: String) = NoShowIndicator(JsonField.of(value)) + } - /** - * An identifier from the merchant for the purchase to the issuer and - * cardholder. - */ - fun purchaseIdentifier(purchaseIdentifier: String?) = - purchaseIdentifier(JsonField.ofNullable(purchaseIdentifier)) + /** An enum containing [NoShowIndicator]'s known values. */ + enum class Known { + /** Not applicable */ + NOT_APPLICABLE, + /** No show for specialized vehicle */ + NO_SHOW_FOR_SPECIALIZED_VEHICLE, + } - /** - * Alias for calling [Builder.purchaseIdentifier] with - * `purchaseIdentifier.orElse(null)`. - */ - fun purchaseIdentifier(purchaseIdentifier: Optional) = - purchaseIdentifier(purchaseIdentifier.getOrNull()) + /** + * An enum containing [NoShowIndicator]'s known values, as well as an + * [_UNKNOWN] member. + * + * An instance of [NoShowIndicator] can contain an unknown value in a couple + * of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** Not applicable */ + NOT_APPLICABLE, + /** No show for specialized vehicle */ + NO_SHOW_FOR_SPECIALIZED_VEHICLE, + /** + * An enum member indicating that [NoShowIndicator] was instantiated + * with an unknown value. + */ + _UNKNOWN, + } - /** - * Sets [Builder.purchaseIdentifier] to an arbitrary JSON value. - * - * You should usually call [Builder.purchaseIdentifier] with a well-typed - * [String] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun purchaseIdentifier(purchaseIdentifier: JsonField) = apply { - this.purchaseIdentifier = purchaseIdentifier - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NOT_APPLICABLE -> Value.NOT_APPLICABLE + NO_SHOW_FOR_SPECIALIZED_VEHICLE -> + Value.NO_SHOW_FOR_SPECIALIZED_VEHICLE + else -> Value._UNKNOWN + } - /** The format of the purchase identifier. */ - fun purchaseIdentifierFormat( - purchaseIdentifierFormat: PurchaseIdentifierFormat? - ) = purchaseIdentifierFormat(JsonField.ofNullable(purchaseIdentifierFormat)) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + NOT_APPLICABLE -> Known.NOT_APPLICABLE + NO_SHOW_FOR_SPECIALIZED_VEHICLE -> + Known.NO_SHOW_FOR_SPECIALIZED_VEHICLE + else -> + throw IncreaseInvalidDataException( + "Unknown NoShowIndicator: $value" + ) + } - /** - * Alias for calling [Builder.purchaseIdentifierFormat] with - * `purchaseIdentifierFormat.orElse(null)`. - */ - fun purchaseIdentifierFormat( - purchaseIdentifierFormat: Optional - ) = purchaseIdentifierFormat(purchaseIdentifierFormat.getOrNull()) + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - /** - * Sets [Builder.purchaseIdentifierFormat] to an arbitrary JSON value. - * - * You should usually call [Builder.purchaseIdentifierFormat] with a well-typed - * [PurchaseIdentifierFormat] value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. - */ - fun purchaseIdentifierFormat( - purchaseIdentifierFormat: JsonField - ) = apply { this.purchaseIdentifierFormat = purchaseIdentifierFormat } + private var validated: Boolean = false - /** Fields specific to travel. */ - fun travel(travel: Travel?) = travel(JsonField.ofNullable(travel)) + fun validate(): NoShowIndicator = apply { + if (validated) { + return@apply + } - /** Alias for calling [Builder.travel] with `travel.orElse(null)`. */ - fun travel(travel: Optional) = travel(travel.getOrNull()) + known() + validated = true + } - /** - * Sets [Builder.travel] to an arbitrary JSON value. - * - * You should usually call [Builder.travel] with a well-typed [Travel] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun travel(travel: JsonField) = apply { this.travel = travel } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + return other is NoShowIndicator && value == other.value } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + override fun hashCode() = value.hashCode() - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + override fun toString() = value.toString() } - /** - * Returns an immutable instance of [PurchaseDetails]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .carRental() - * .customerReferenceIdentifier() - * .localTaxAmount() - * .localTaxCurrency() - * .lodging() - * .nationalTaxAmount() - * .nationalTaxCurrency() - * .purchaseIdentifier() - * .purchaseIdentifierFormat() - * .travel() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): PurchaseDetails = - PurchaseDetails( - checkRequired("carRental", carRental), - checkRequired( - "customerReferenceIdentifier", - customerReferenceIdentifier, - ), - checkRequired("localTaxAmount", localTaxAmount), - checkRequired("localTaxCurrency", localTaxCurrency), - checkRequired("lodging", lodging), - checkRequired("nationalTaxAmount", nationalTaxAmount), - checkRequired("nationalTaxCurrency", nationalTaxCurrency), - checkRequired("purchaseIdentifier", purchaseIdentifier), - checkRequired("purchaseIdentifierFormat", purchaseIdentifierFormat), - checkRequired("travel", travel), - additionalProperties.toMutableMap(), - ) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - private var validated: Boolean = false + return other is CarRental && + carClassCode == other.carClassCode && + checkoutDate == other.checkoutDate && + dailyRentalRateAmount == other.dailyRentalRateAmount && + dailyRentalRateCurrency == other.dailyRentalRateCurrency && + daysRented == other.daysRented && + extraCharges == other.extraCharges && + fuelChargesAmount == other.fuelChargesAmount && + fuelChargesCurrency == other.fuelChargesCurrency && + insuranceChargesAmount == other.insuranceChargesAmount && + insuranceChargesCurrency == other.insuranceChargesCurrency && + noShowIndicator == other.noShowIndicator && + oneWayDropOffChargesAmount == other.oneWayDropOffChargesAmount && + oneWayDropOffChargesCurrency == other.oneWayDropOffChargesCurrency && + renterName == other.renterName && + weeklyRentalRateAmount == other.weeklyRentalRateAmount && + weeklyRentalRateCurrency == other.weeklyRentalRateCurrency && + additionalProperties == other.additionalProperties + } - fun validate(): PurchaseDetails = apply { - if (validated) { - return@apply + private val hashCode: Int by lazy { + Objects.hash( + carClassCode, + checkoutDate, + dailyRentalRateAmount, + dailyRentalRateCurrency, + daysRented, + extraCharges, + fuelChargesAmount, + fuelChargesCurrency, + insuranceChargesAmount, + insuranceChargesCurrency, + noShowIndicator, + oneWayDropOffChargesAmount, + oneWayDropOffChargesCurrency, + renterName, + weeklyRentalRateAmount, + weeklyRentalRateCurrency, + additionalProperties, + ) } - carRental().ifPresent { it.validate() } - customerReferenceIdentifier() - localTaxAmount() - localTaxCurrency() - lodging().ifPresent { it.validate() } - nationalTaxAmount() - nationalTaxCurrency() - purchaseIdentifier() - purchaseIdentifierFormat().ifPresent { it.validate() } - travel().ifPresent { it.validate() } - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + override fun hashCode(): Int = hashCode - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (carRental.asKnown().getOrNull()?.validity() ?: 0) + - (if (customerReferenceIdentifier.asKnown().isPresent) 1 else 0) + - (if (localTaxAmount.asKnown().isPresent) 1 else 0) + - (if (localTaxCurrency.asKnown().isPresent) 1 else 0) + - (lodging.asKnown().getOrNull()?.validity() ?: 0) + - (if (nationalTaxAmount.asKnown().isPresent) 1 else 0) + - (if (nationalTaxCurrency.asKnown().isPresent) 1 else 0) + - (if (purchaseIdentifier.asKnown().isPresent) 1 else 0) + - (purchaseIdentifierFormat.asKnown().getOrNull()?.validity() ?: 0) + - (travel.asKnown().getOrNull()?.validity() ?: 0) + override fun toString() = + "CarRental{carClassCode=$carClassCode, checkoutDate=$checkoutDate, dailyRentalRateAmount=$dailyRentalRateAmount, dailyRentalRateCurrency=$dailyRentalRateCurrency, daysRented=$daysRented, extraCharges=$extraCharges, fuelChargesAmount=$fuelChargesAmount, fuelChargesCurrency=$fuelChargesCurrency, insuranceChargesAmount=$insuranceChargesAmount, insuranceChargesCurrency=$insuranceChargesCurrency, noShowIndicator=$noShowIndicator, oneWayDropOffChargesAmount=$oneWayDropOffChargesAmount, oneWayDropOffChargesCurrency=$oneWayDropOffChargesCurrency, renterName=$renterName, weeklyRentalRateAmount=$weeklyRentalRateAmount, weeklyRentalRateCurrency=$weeklyRentalRateCurrency, additionalProperties=$additionalProperties}" + } - /** Fields specific to car rentals. */ - class CarRental + /** Fields specific to lodging. */ + class Lodging @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val carClassCode: JsonField, - private val checkoutDate: JsonField, - private val dailyRentalRateAmount: JsonField, - private val dailyRentalRateCurrency: JsonField, - private val daysRented: JsonField, + private val checkInDate: JsonField, + private val dailyRoomRateAmount: JsonField, + private val dailyRoomRateCurrency: JsonField, private val extraCharges: JsonField, - private val fuelChargesAmount: JsonField, - private val fuelChargesCurrency: JsonField, - private val insuranceChargesAmount: JsonField, - private val insuranceChargesCurrency: JsonField, + private val folioCashAdvancesAmount: JsonField, + private val folioCashAdvancesCurrency: JsonField, + private val foodBeverageChargesAmount: JsonField, + private val foodBeverageChargesCurrency: JsonField, private val noShowIndicator: JsonField, - private val oneWayDropOffChargesAmount: JsonField, - private val oneWayDropOffChargesCurrency: JsonField, - private val renterName: JsonField, - private val weeklyRentalRateAmount: JsonField, - private val weeklyRentalRateCurrency: JsonField, + private val prepaidExpensesAmount: JsonField, + private val prepaidExpensesCurrency: JsonField, + private val roomNights: JsonField, + private val totalRoomTaxAmount: JsonField, + private val totalRoomTaxCurrency: JsonField, + private val totalTaxAmount: JsonField, + private val totalTaxCurrency: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("car_class_code") - @ExcludeMissing - carClassCode: JsonField = JsonMissing.of(), - @JsonProperty("checkout_date") - @ExcludeMissing - checkoutDate: JsonField = JsonMissing.of(), - @JsonProperty("daily_rental_rate_amount") + @JsonProperty("check_in_date") @ExcludeMissing - dailyRentalRateAmount: JsonField = JsonMissing.of(), - @JsonProperty("daily_rental_rate_currency") + checkInDate: JsonField = JsonMissing.of(), + @JsonProperty("daily_room_rate_amount") @ExcludeMissing - dailyRentalRateCurrency: JsonField = JsonMissing.of(), - @JsonProperty("days_rented") + dailyRoomRateAmount: JsonField = JsonMissing.of(), + @JsonProperty("daily_room_rate_currency") @ExcludeMissing - daysRented: JsonField = JsonMissing.of(), + dailyRoomRateCurrency: JsonField = JsonMissing.of(), @JsonProperty("extra_charges") @ExcludeMissing extraCharges: JsonField = JsonMissing.of(), - @JsonProperty("fuel_charges_amount") + @JsonProperty("folio_cash_advances_amount") @ExcludeMissing - fuelChargesAmount: JsonField = JsonMissing.of(), - @JsonProperty("fuel_charges_currency") + folioCashAdvancesAmount: JsonField = JsonMissing.of(), + @JsonProperty("folio_cash_advances_currency") @ExcludeMissing - fuelChargesCurrency: JsonField = JsonMissing.of(), - @JsonProperty("insurance_charges_amount") + folioCashAdvancesCurrency: JsonField = JsonMissing.of(), + @JsonProperty("food_beverage_charges_amount") @ExcludeMissing - insuranceChargesAmount: JsonField = JsonMissing.of(), - @JsonProperty("insurance_charges_currency") + foodBeverageChargesAmount: JsonField = JsonMissing.of(), + @JsonProperty("food_beverage_charges_currency") @ExcludeMissing - insuranceChargesCurrency: JsonField = JsonMissing.of(), + foodBeverageChargesCurrency: JsonField = JsonMissing.of(), @JsonProperty("no_show_indicator") @ExcludeMissing noShowIndicator: JsonField = JsonMissing.of(), - @JsonProperty("one_way_drop_off_charges_amount") + @JsonProperty("prepaid_expenses_amount") @ExcludeMissing - oneWayDropOffChargesAmount: JsonField = JsonMissing.of(), - @JsonProperty("one_way_drop_off_charges_currency") + prepaidExpensesAmount: JsonField = JsonMissing.of(), + @JsonProperty("prepaid_expenses_currency") @ExcludeMissing - oneWayDropOffChargesCurrency: JsonField = JsonMissing.of(), - @JsonProperty("renter_name") + prepaidExpensesCurrency: JsonField = JsonMissing.of(), + @JsonProperty("room_nights") @ExcludeMissing - renterName: JsonField = JsonMissing.of(), - @JsonProperty("weekly_rental_rate_amount") + roomNights: JsonField = JsonMissing.of(), + @JsonProperty("total_room_tax_amount") @ExcludeMissing - weeklyRentalRateAmount: JsonField = JsonMissing.of(), - @JsonProperty("weekly_rental_rate_currency") + totalRoomTaxAmount: JsonField = JsonMissing.of(), + @JsonProperty("total_room_tax_currency") @ExcludeMissing - weeklyRentalRateCurrency: JsonField = JsonMissing.of(), + totalRoomTaxCurrency: JsonField = JsonMissing.of(), + @JsonProperty("total_tax_amount") + @ExcludeMissing + totalTaxAmount: JsonField = JsonMissing.of(), + @JsonProperty("total_tax_currency") + @ExcludeMissing + totalTaxCurrency: JsonField = JsonMissing.of(), ) : this( - carClassCode, - checkoutDate, - dailyRentalRateAmount, - dailyRentalRateCurrency, - daysRented, + checkInDate, + dailyRoomRateAmount, + dailyRoomRateCurrency, extraCharges, - fuelChargesAmount, - fuelChargesCurrency, - insuranceChargesAmount, - insuranceChargesCurrency, + folioCashAdvancesAmount, + folioCashAdvancesCurrency, + foodBeverageChargesAmount, + foodBeverageChargesCurrency, noShowIndicator, - oneWayDropOffChargesAmount, - oneWayDropOffChargesCurrency, - renterName, - weeklyRentalRateAmount, - weeklyRentalRateCurrency, + prepaidExpensesAmount, + prepaidExpensesCurrency, + roomNights, + totalRoomTaxAmount, + totalRoomTaxCurrency, + totalTaxAmount, + totalTaxCurrency, mutableMapOf(), ) /** - * Code indicating the vehicle's class. + * Date the customer checked in. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun carClassCode(): Optional = - carClassCode.getOptional("car_class_code") + fun checkInDate(): Optional = + checkInDate.getOptional("check_in_date") /** - * Date the customer picked up the car or, in the case of a no-show or pre-pay - * transaction, the scheduled pick up date. + * Daily rate being charged for the room. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun checkoutDate(): Optional = - checkoutDate.getOptional("checkout_date") + fun dailyRoomRateAmount(): Optional = + dailyRoomRateAmount.getOptional("daily_room_rate_amount") /** - * Daily rate being charged for the vehicle. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily + * room rate. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun dailyRentalRateAmount(): Optional = - dailyRentalRateAmount.getOptional("daily_rental_rate_amount") + fun dailyRoomRateCurrency(): Optional = + dailyRoomRateCurrency.getOptional("daily_room_rate_currency") /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily - * rental rate. + * Additional charges (phone, late check-out, etc.) being billed. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun dailyRentalRateCurrency(): Optional = - dailyRentalRateCurrency.getOptional("daily_rental_rate_currency") + fun extraCharges(): Optional = + extraCharges.getOptional("extra_charges") /** - * Number of days the vehicle was rented. + * Folio cash advances for the room. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun daysRented(): Optional = daysRented.getOptional("days_rented") + fun folioCashAdvancesAmount(): Optional = + folioCashAdvancesAmount.getOptional("folio_cash_advances_amount") /** - * Additional charges (gas, late fee, etc.) being billed. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the folio + * cash advances. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun extraCharges(): Optional = - extraCharges.getOptional("extra_charges") + fun folioCashAdvancesCurrency(): Optional = + folioCashAdvancesCurrency.getOptional("folio_cash_advances_currency") /** - * Fuel charges for the vehicle. + * Food and beverage charges for the room. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun fuelChargesAmount(): Optional = - fuelChargesAmount.getOptional("fuel_charges_amount") + fun foodBeverageChargesAmount(): Optional = + foodBeverageChargesAmount.getOptional("food_beverage_charges_amount") /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fuel - * charges assessed. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the food and + * beverage charges. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun fuelChargesCurrency(): Optional = - fuelChargesCurrency.getOptional("fuel_charges_currency") + fun foodBeverageChargesCurrency(): Optional = + foodBeverageChargesCurrency.getOptional("food_beverage_charges_currency") /** - * Any insurance being charged for the vehicle. + * Indicator that the cardholder is being billed for a reserved room that was + * not actually used. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun insuranceChargesAmount(): Optional = - insuranceChargesAmount.getOptional("insurance_charges_amount") + fun noShowIndicator(): Optional = + noShowIndicator.getOptional("no_show_indicator") /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the insurance - * charges assessed. + * Prepaid expenses being charged for the room. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun insuranceChargesCurrency(): Optional = - insuranceChargesCurrency.getOptional("insurance_charges_currency") + fun prepaidExpensesAmount(): Optional = + prepaidExpensesAmount.getOptional("prepaid_expenses_amount") /** - * An indicator that the cardholder is being billed for a reserved vehicle that - * was not actually rented (that is, a "no-show" charge). + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the prepaid + * expenses. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun noShowIndicator(): Optional = - noShowIndicator.getOptional("no_show_indicator") + fun prepaidExpensesCurrency(): Optional = + prepaidExpensesCurrency.getOptional("prepaid_expenses_currency") /** - * Charges for returning the vehicle at a different location than where it was - * picked up. + * Number of nights the room was rented. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun oneWayDropOffChargesAmount(): Optional = - oneWayDropOffChargesAmount.getOptional("one_way_drop_off_charges_amount") + fun roomNights(): Optional = roomNights.getOptional("room_nights") /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the one-way - * drop-off charges assessed. + * Total room tax being charged. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun oneWayDropOffChargesCurrency(): Optional = - oneWayDropOffChargesCurrency.getOptional( - "one_way_drop_off_charges_currency" - ) + fun totalRoomTaxAmount(): Optional = + totalRoomTaxAmount.getOptional("total_room_tax_amount") /** - * Name of the person renting the vehicle. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total + * room tax. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun renterName(): Optional = renterName.getOptional("renter_name") + fun totalRoomTaxCurrency(): Optional = + totalRoomTaxCurrency.getOptional("total_room_tax_currency") /** - * Weekly rate being charged for the vehicle. + * Total tax being charged for the room. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun weeklyRentalRateAmount(): Optional = - weeklyRentalRateAmount.getOptional("weekly_rental_rate_amount") + fun totalTaxAmount(): Optional = + totalTaxAmount.getOptional("total_tax_amount") /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the weekly - * rental rate. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total tax + * assessed. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun weeklyRentalRateCurrency(): Optional = - weeklyRentalRateCurrency.getOptional("weekly_rental_rate_currency") - - /** - * Returns the raw JSON value of [carClassCode]. - * - * Unlike [carClassCode], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("car_class_code") - @ExcludeMissing - fun _carClassCode(): JsonField = carClassCode + fun totalTaxCurrency(): Optional = + totalTaxCurrency.getOptional("total_tax_currency") /** - * Returns the raw JSON value of [checkoutDate]. + * Returns the raw JSON value of [checkInDate]. * - * Unlike [checkoutDate], this method doesn't throw if the JSON field has an + * Unlike [checkInDate], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("checkout_date") + @JsonProperty("check_in_date") @ExcludeMissing - fun _checkoutDate(): JsonField = checkoutDate + fun _checkInDate(): JsonField = checkInDate /** - * Returns the raw JSON value of [dailyRentalRateAmount]. + * Returns the raw JSON value of [dailyRoomRateAmount]. * - * Unlike [dailyRentalRateAmount], this method doesn't throw if the JSON field - * has an unexpected type. + * Unlike [dailyRoomRateAmount], this method doesn't throw if the JSON field has + * an unexpected type. */ - @JsonProperty("daily_rental_rate_amount") + @JsonProperty("daily_room_rate_amount") @ExcludeMissing - fun _dailyRentalRateAmount(): JsonField = dailyRentalRateAmount + fun _dailyRoomRateAmount(): JsonField = dailyRoomRateAmount /** - * Returns the raw JSON value of [dailyRentalRateCurrency]. + * Returns the raw JSON value of [dailyRoomRateCurrency]. * - * Unlike [dailyRentalRateCurrency], this method doesn't throw if the JSON field + * Unlike [dailyRoomRateCurrency], this method doesn't throw if the JSON field * has an unexpected type. */ - @JsonProperty("daily_rental_rate_currency") - @ExcludeMissing - fun _dailyRentalRateCurrency(): JsonField = dailyRentalRateCurrency - - /** - * Returns the raw JSON value of [daysRented]. - * - * Unlike [daysRented], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("days_rented") + @JsonProperty("daily_room_rate_currency") @ExcludeMissing - fun _daysRented(): JsonField = daysRented + fun _dailyRoomRateCurrency(): JsonField = dailyRoomRateCurrency /** * Returns the raw JSON value of [extraCharges]. @@ -55212,44 +64882,45 @@ private constructor( fun _extraCharges(): JsonField = extraCharges /** - * Returns the raw JSON value of [fuelChargesAmount]. + * Returns the raw JSON value of [folioCashAdvancesAmount]. * - * Unlike [fuelChargesAmount], this method doesn't throw if the JSON field has - * an unexpected type. + * Unlike [folioCashAdvancesAmount], this method doesn't throw if the JSON field + * has an unexpected type. */ - @JsonProperty("fuel_charges_amount") + @JsonProperty("folio_cash_advances_amount") @ExcludeMissing - fun _fuelChargesAmount(): JsonField = fuelChargesAmount + fun _folioCashAdvancesAmount(): JsonField = folioCashAdvancesAmount /** - * Returns the raw JSON value of [fuelChargesCurrency]. + * Returns the raw JSON value of [folioCashAdvancesCurrency]. * - * Unlike [fuelChargesCurrency], this method doesn't throw if the JSON field has - * an unexpected type. + * Unlike [folioCashAdvancesCurrency], this method doesn't throw if the JSON + * field has an unexpected type. */ - @JsonProperty("fuel_charges_currency") + @JsonProperty("folio_cash_advances_currency") @ExcludeMissing - fun _fuelChargesCurrency(): JsonField = fuelChargesCurrency + fun _folioCashAdvancesCurrency(): JsonField = folioCashAdvancesCurrency /** - * Returns the raw JSON value of [insuranceChargesAmount]. + * Returns the raw JSON value of [foodBeverageChargesAmount]. * - * Unlike [insuranceChargesAmount], this method doesn't throw if the JSON field - * has an unexpected type. + * Unlike [foodBeverageChargesAmount], this method doesn't throw if the JSON + * field has an unexpected type. */ - @JsonProperty("insurance_charges_amount") + @JsonProperty("food_beverage_charges_amount") @ExcludeMissing - fun _insuranceChargesAmount(): JsonField = insuranceChargesAmount + fun _foodBeverageChargesAmount(): JsonField = foodBeverageChargesAmount /** - * Returns the raw JSON value of [insuranceChargesCurrency]. + * Returns the raw JSON value of [foodBeverageChargesCurrency]. * - * Unlike [insuranceChargesCurrency], this method doesn't throw if the JSON + * Unlike [foodBeverageChargesCurrency], this method doesn't throw if the JSON * field has an unexpected type. */ - @JsonProperty("insurance_charges_currency") + @JsonProperty("food_beverage_charges_currency") @ExcludeMissing - fun _insuranceChargesCurrency(): JsonField = insuranceChargesCurrency + fun _foodBeverageChargesCurrency(): JsonField = + foodBeverageChargesCurrency /** * Returns the raw JSON value of [noShowIndicator]. @@ -55262,55 +64933,74 @@ private constructor( fun _noShowIndicator(): JsonField = noShowIndicator /** - * Returns the raw JSON value of [oneWayDropOffChargesAmount]. + * Returns the raw JSON value of [prepaidExpensesAmount]. * - * Unlike [oneWayDropOffChargesAmount], this method doesn't throw if the JSON - * field has an unexpected type. + * Unlike [prepaidExpensesAmount], this method doesn't throw if the JSON field + * has an unexpected type. */ - @JsonProperty("one_way_drop_off_charges_amount") + @JsonProperty("prepaid_expenses_amount") @ExcludeMissing - fun _oneWayDropOffChargesAmount(): JsonField = oneWayDropOffChargesAmount + fun _prepaidExpensesAmount(): JsonField = prepaidExpensesAmount /** - * Returns the raw JSON value of [oneWayDropOffChargesCurrency]. + * Returns the raw JSON value of [prepaidExpensesCurrency]. * - * Unlike [oneWayDropOffChargesCurrency], this method doesn't throw if the JSON - * field has an unexpected type. + * Unlike [prepaidExpensesCurrency], this method doesn't throw if the JSON field + * has an unexpected type. */ - @JsonProperty("one_way_drop_off_charges_currency") + @JsonProperty("prepaid_expenses_currency") @ExcludeMissing - fun _oneWayDropOffChargesCurrency(): JsonField = - oneWayDropOffChargesCurrency + fun _prepaidExpensesCurrency(): JsonField = prepaidExpensesCurrency /** - * Returns the raw JSON value of [renterName]. + * Returns the raw JSON value of [roomNights]. * - * Unlike [renterName], this method doesn't throw if the JSON field has an + * Unlike [roomNights], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("renter_name") + @JsonProperty("room_nights") @ExcludeMissing - fun _renterName(): JsonField = renterName + fun _roomNights(): JsonField = roomNights /** - * Returns the raw JSON value of [weeklyRentalRateAmount]. + * Returns the raw JSON value of [totalRoomTaxAmount]. * - * Unlike [weeklyRentalRateAmount], this method doesn't throw if the JSON field + * Unlike [totalRoomTaxAmount], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("total_room_tax_amount") + @ExcludeMissing + fun _totalRoomTaxAmount(): JsonField = totalRoomTaxAmount + + /** + * Returns the raw JSON value of [totalRoomTaxCurrency]. + * + * Unlike [totalRoomTaxCurrency], this method doesn't throw if the JSON field * has an unexpected type. */ - @JsonProperty("weekly_rental_rate_amount") + @JsonProperty("total_room_tax_currency") @ExcludeMissing - fun _weeklyRentalRateAmount(): JsonField = weeklyRentalRateAmount + fun _totalRoomTaxCurrency(): JsonField = totalRoomTaxCurrency /** - * Returns the raw JSON value of [weeklyRentalRateCurrency]. + * Returns the raw JSON value of [totalTaxAmount]. * - * Unlike [weeklyRentalRateCurrency], this method doesn't throw if the JSON - * field has an unexpected type. + * Unlike [totalTaxAmount], this method doesn't throw if the JSON field has an + * unexpected type. */ - @JsonProperty("weekly_rental_rate_currency") + @JsonProperty("total_tax_amount") @ExcludeMissing - fun _weeklyRentalRateCurrency(): JsonField = weeklyRentalRateCurrency + fun _totalTaxAmount(): JsonField = totalTaxAmount + + /** + * Returns the raw JSON value of [totalTaxCurrency]. + * + * Unlike [totalTaxCurrency], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("total_tax_currency") + @ExcludeMissing + fun _totalTaxCurrency(): JsonField = totalTaxCurrency @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -55327,206 +65017,152 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [CarRental]. + * Returns a mutable builder for constructing an instance of [Lodging]. * * The following fields are required: * ```java - * .carClassCode() - * .checkoutDate() - * .dailyRentalRateAmount() - * .dailyRentalRateCurrency() - * .daysRented() + * .checkInDate() + * .dailyRoomRateAmount() + * .dailyRoomRateCurrency() * .extraCharges() - * .fuelChargesAmount() - * .fuelChargesCurrency() - * .insuranceChargesAmount() - * .insuranceChargesCurrency() + * .folioCashAdvancesAmount() + * .folioCashAdvancesCurrency() + * .foodBeverageChargesAmount() + * .foodBeverageChargesCurrency() * .noShowIndicator() - * .oneWayDropOffChargesAmount() - * .oneWayDropOffChargesCurrency() - * .renterName() - * .weeklyRentalRateAmount() - * .weeklyRentalRateCurrency() + * .prepaidExpensesAmount() + * .prepaidExpensesCurrency() + * .roomNights() + * .totalRoomTaxAmount() + * .totalRoomTaxCurrency() + * .totalTaxAmount() + * .totalTaxCurrency() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [CarRental]. */ + /** A builder for [Lodging]. */ class Builder internal constructor() { - private var carClassCode: JsonField? = null - private var checkoutDate: JsonField? = null - private var dailyRentalRateAmount: JsonField? = null - private var dailyRentalRateCurrency: JsonField? = null - private var daysRented: JsonField? = null + private var checkInDate: JsonField? = null + private var dailyRoomRateAmount: JsonField? = null + private var dailyRoomRateCurrency: JsonField? = null private var extraCharges: JsonField? = null - private var fuelChargesAmount: JsonField? = null - private var fuelChargesCurrency: JsonField? = null - private var insuranceChargesAmount: JsonField? = null - private var insuranceChargesCurrency: JsonField? = null - private var noShowIndicator: JsonField? = null - private var oneWayDropOffChargesAmount: JsonField? = null - private var oneWayDropOffChargesCurrency: JsonField? = null - private var renterName: JsonField? = null - private var weeklyRentalRateAmount: JsonField? = null - private var weeklyRentalRateCurrency: JsonField? = null - private var additionalProperties: MutableMap = - mutableMapOf() - - @JvmSynthetic - internal fun from(carRental: CarRental) = apply { - carClassCode = carRental.carClassCode - checkoutDate = carRental.checkoutDate - dailyRentalRateAmount = carRental.dailyRentalRateAmount - dailyRentalRateCurrency = carRental.dailyRentalRateCurrency - daysRented = carRental.daysRented - extraCharges = carRental.extraCharges - fuelChargesAmount = carRental.fuelChargesAmount - fuelChargesCurrency = carRental.fuelChargesCurrency - insuranceChargesAmount = carRental.insuranceChargesAmount - insuranceChargesCurrency = carRental.insuranceChargesCurrency - noShowIndicator = carRental.noShowIndicator - oneWayDropOffChargesAmount = carRental.oneWayDropOffChargesAmount - oneWayDropOffChargesCurrency = carRental.oneWayDropOffChargesCurrency - renterName = carRental.renterName - weeklyRentalRateAmount = carRental.weeklyRentalRateAmount - weeklyRentalRateCurrency = carRental.weeklyRentalRateCurrency - additionalProperties = carRental.additionalProperties.toMutableMap() - } - - /** Code indicating the vehicle's class. */ - fun carClassCode(carClassCode: String?) = - carClassCode(JsonField.ofNullable(carClassCode)) - - /** - * Alias for calling [Builder.carClassCode] with - * `carClassCode.orElse(null)`. - */ - fun carClassCode(carClassCode: Optional) = - carClassCode(carClassCode.getOrNull()) + private var folioCashAdvancesAmount: JsonField? = null + private var folioCashAdvancesCurrency: JsonField? = null + private var foodBeverageChargesAmount: JsonField? = null + private var foodBeverageChargesCurrency: JsonField? = null + private var noShowIndicator: JsonField? = null + private var prepaidExpensesAmount: JsonField? = null + private var prepaidExpensesCurrency: JsonField? = null + private var roomNights: JsonField? = null + private var totalRoomTaxAmount: JsonField? = null + private var totalRoomTaxCurrency: JsonField? = null + private var totalTaxAmount: JsonField? = null + private var totalTaxCurrency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() - /** - * Sets [Builder.carClassCode] to an arbitrary JSON value. - * - * You should usually call [Builder.carClassCode] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun carClassCode(carClassCode: JsonField) = apply { - this.carClassCode = carClassCode + @JvmSynthetic + internal fun from(lodging: Lodging) = apply { + checkInDate = lodging.checkInDate + dailyRoomRateAmount = lodging.dailyRoomRateAmount + dailyRoomRateCurrency = lodging.dailyRoomRateCurrency + extraCharges = lodging.extraCharges + folioCashAdvancesAmount = lodging.folioCashAdvancesAmount + folioCashAdvancesCurrency = lodging.folioCashAdvancesCurrency + foodBeverageChargesAmount = lodging.foodBeverageChargesAmount + foodBeverageChargesCurrency = lodging.foodBeverageChargesCurrency + noShowIndicator = lodging.noShowIndicator + prepaidExpensesAmount = lodging.prepaidExpensesAmount + prepaidExpensesCurrency = lodging.prepaidExpensesCurrency + roomNights = lodging.roomNights + totalRoomTaxAmount = lodging.totalRoomTaxAmount + totalRoomTaxCurrency = lodging.totalRoomTaxCurrency + totalTaxAmount = lodging.totalTaxAmount + totalTaxCurrency = lodging.totalTaxCurrency + additionalProperties = lodging.additionalProperties.toMutableMap() } - /** - * Date the customer picked up the car or, in the case of a no-show or - * pre-pay transaction, the scheduled pick up date. - */ - fun checkoutDate(checkoutDate: LocalDate?) = - checkoutDate(JsonField.ofNullable(checkoutDate)) + /** Date the customer checked in. */ + fun checkInDate(checkInDate: LocalDate?) = + checkInDate(JsonField.ofNullable(checkInDate)) /** - * Alias for calling [Builder.checkoutDate] with - * `checkoutDate.orElse(null)`. + * Alias for calling [Builder.checkInDate] with `checkInDate.orElse(null)`. */ - fun checkoutDate(checkoutDate: Optional) = - checkoutDate(checkoutDate.getOrNull()) + fun checkInDate(checkInDate: Optional) = + checkInDate(checkInDate.getOrNull()) /** - * Sets [Builder.checkoutDate] to an arbitrary JSON value. + * Sets [Builder.checkInDate] to an arbitrary JSON value. * - * You should usually call [Builder.checkoutDate] with a well-typed + * You should usually call [Builder.checkInDate] with a well-typed * [LocalDate] value instead. This method is primarily for setting the field * to an undocumented or not yet supported value. */ - fun checkoutDate(checkoutDate: JsonField) = apply { - this.checkoutDate = checkoutDate + fun checkInDate(checkInDate: JsonField) = apply { + this.checkInDate = checkInDate } - /** Daily rate being charged for the vehicle. */ - fun dailyRentalRateAmount(dailyRentalRateAmount: Long?) = - dailyRentalRateAmount(JsonField.ofNullable(dailyRentalRateAmount)) + /** Daily rate being charged for the room. */ + fun dailyRoomRateAmount(dailyRoomRateAmount: Long?) = + dailyRoomRateAmount(JsonField.ofNullable(dailyRoomRateAmount)) /** - * Alias for [Builder.dailyRentalRateAmount]. + * Alias for [Builder.dailyRoomRateAmount]. * * This unboxed primitive overload exists for backwards compatibility. */ - fun dailyRentalRateAmount(dailyRentalRateAmount: Long) = - dailyRentalRateAmount(dailyRentalRateAmount as Long?) + fun dailyRoomRateAmount(dailyRoomRateAmount: Long) = + dailyRoomRateAmount(dailyRoomRateAmount as Long?) /** - * Alias for calling [Builder.dailyRentalRateAmount] with - * `dailyRentalRateAmount.orElse(null)`. + * Alias for calling [Builder.dailyRoomRateAmount] with + * `dailyRoomRateAmount.orElse(null)`. */ - fun dailyRentalRateAmount(dailyRentalRateAmount: Optional) = - dailyRentalRateAmount(dailyRentalRateAmount.getOrNull()) + fun dailyRoomRateAmount(dailyRoomRateAmount: Optional) = + dailyRoomRateAmount(dailyRoomRateAmount.getOrNull()) /** - * Sets [Builder.dailyRentalRateAmount] to an arbitrary JSON value. + * Sets [Builder.dailyRoomRateAmount] to an arbitrary JSON value. * - * You should usually call [Builder.dailyRentalRateAmount] with a well-typed + * You should usually call [Builder.dailyRoomRateAmount] with a well-typed * [Long] value instead. This method is primarily for setting the field to * an undocumented or not yet supported value. */ - fun dailyRentalRateAmount(dailyRentalRateAmount: JsonField) = apply { - this.dailyRentalRateAmount = dailyRentalRateAmount + fun dailyRoomRateAmount(dailyRoomRateAmount: JsonField) = apply { + this.dailyRoomRateAmount = dailyRoomRateAmount } /** * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily - * rental rate. + * room rate. */ - fun dailyRentalRateCurrency(dailyRentalRateCurrency: String?) = - dailyRentalRateCurrency(JsonField.ofNullable(dailyRentalRateCurrency)) + fun dailyRoomRateCurrency(dailyRoomRateCurrency: String?) = + dailyRoomRateCurrency(JsonField.ofNullable(dailyRoomRateCurrency)) /** - * Alias for calling [Builder.dailyRentalRateCurrency] with - * `dailyRentalRateCurrency.orElse(null)`. + * Alias for calling [Builder.dailyRoomRateCurrency] with + * `dailyRoomRateCurrency.orElse(null)`. */ - fun dailyRentalRateCurrency(dailyRentalRateCurrency: Optional) = - dailyRentalRateCurrency(dailyRentalRateCurrency.getOrNull()) + fun dailyRoomRateCurrency(dailyRoomRateCurrency: Optional) = + dailyRoomRateCurrency(dailyRoomRateCurrency.getOrNull()) /** - * Sets [Builder.dailyRentalRateCurrency] to an arbitrary JSON value. + * Sets [Builder.dailyRoomRateCurrency] to an arbitrary JSON value. * - * You should usually call [Builder.dailyRentalRateCurrency] with a - * well-typed [String] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. + * You should usually call [Builder.dailyRoomRateCurrency] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. */ - fun dailyRentalRateCurrency(dailyRentalRateCurrency: JsonField) = + fun dailyRoomRateCurrency(dailyRoomRateCurrency: JsonField) = apply { - this.dailyRentalRateCurrency = dailyRentalRateCurrency + this.dailyRoomRateCurrency = dailyRoomRateCurrency } - /** Number of days the vehicle was rented. */ - fun daysRented(daysRented: Long?) = - daysRented(JsonField.ofNullable(daysRented)) - - /** - * Alias for [Builder.daysRented]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun daysRented(daysRented: Long) = daysRented(daysRented as Long?) - - /** - * Alias for calling [Builder.daysRented] with `daysRented.orElse(null)`. - */ - fun daysRented(daysRented: Optional) = - daysRented(daysRented.getOrNull()) - - /** - * Sets [Builder.daysRented] to an arbitrary JSON value. - * - * You should usually call [Builder.daysRented] with a well-typed [Long] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun daysRented(daysRented: JsonField) = apply { - this.daysRented = daysRented - } - - /** Additional charges (gas, late fee, etc.) being billed. */ + /** Additional charges (phone, late check-out, etc.) being billed. */ fun extraCharges(extraCharges: ExtraCharges?) = extraCharges(JsonField.ofNullable(extraCharges)) @@ -55548,121 +65184,128 @@ private constructor( this.extraCharges = extraCharges } - /** Fuel charges for the vehicle. */ - fun fuelChargesAmount(fuelChargesAmount: Long?) = - fuelChargesAmount(JsonField.ofNullable(fuelChargesAmount)) + /** Folio cash advances for the room. */ + fun folioCashAdvancesAmount(folioCashAdvancesAmount: Long?) = + folioCashAdvancesAmount(JsonField.ofNullable(folioCashAdvancesAmount)) /** - * Alias for [Builder.fuelChargesAmount]. + * Alias for [Builder.folioCashAdvancesAmount]. * * This unboxed primitive overload exists for backwards compatibility. */ - fun fuelChargesAmount(fuelChargesAmount: Long) = - fuelChargesAmount(fuelChargesAmount as Long?) + fun folioCashAdvancesAmount(folioCashAdvancesAmount: Long) = + folioCashAdvancesAmount(folioCashAdvancesAmount as Long?) /** - * Alias for calling [Builder.fuelChargesAmount] with - * `fuelChargesAmount.orElse(null)`. + * Alias for calling [Builder.folioCashAdvancesAmount] with + * `folioCashAdvancesAmount.orElse(null)`. */ - fun fuelChargesAmount(fuelChargesAmount: Optional) = - fuelChargesAmount(fuelChargesAmount.getOrNull()) + fun folioCashAdvancesAmount(folioCashAdvancesAmount: Optional) = + folioCashAdvancesAmount(folioCashAdvancesAmount.getOrNull()) /** - * Sets [Builder.fuelChargesAmount] to an arbitrary JSON value. + * Sets [Builder.folioCashAdvancesAmount] to an arbitrary JSON value. * - * You should usually call [Builder.fuelChargesAmount] with a well-typed - * [Long] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * You should usually call [Builder.folioCashAdvancesAmount] with a + * well-typed [Long] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - fun fuelChargesAmount(fuelChargesAmount: JsonField) = apply { - this.fuelChargesAmount = fuelChargesAmount - } + fun folioCashAdvancesAmount(folioCashAdvancesAmount: JsonField) = + apply { + this.folioCashAdvancesAmount = folioCashAdvancesAmount + } /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fuel - * charges assessed. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the folio + * cash advances. */ - fun fuelChargesCurrency(fuelChargesCurrency: String?) = - fuelChargesCurrency(JsonField.ofNullable(fuelChargesCurrency)) + fun folioCashAdvancesCurrency(folioCashAdvancesCurrency: String?) = + folioCashAdvancesCurrency( + JsonField.ofNullable(folioCashAdvancesCurrency) + ) /** - * Alias for calling [Builder.fuelChargesCurrency] with - * `fuelChargesCurrency.orElse(null)`. + * Alias for calling [Builder.folioCashAdvancesCurrency] with + * `folioCashAdvancesCurrency.orElse(null)`. */ - fun fuelChargesCurrency(fuelChargesCurrency: Optional) = - fuelChargesCurrency(fuelChargesCurrency.getOrNull()) + fun folioCashAdvancesCurrency(folioCashAdvancesCurrency: Optional) = + folioCashAdvancesCurrency(folioCashAdvancesCurrency.getOrNull()) /** - * Sets [Builder.fuelChargesCurrency] to an arbitrary JSON value. + * Sets [Builder.folioCashAdvancesCurrency] to an arbitrary JSON value. * - * You should usually call [Builder.fuelChargesCurrency] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * You should usually call [Builder.folioCashAdvancesCurrency] with a + * well-typed [String] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. */ - fun fuelChargesCurrency(fuelChargesCurrency: JsonField) = apply { - this.fuelChargesCurrency = fuelChargesCurrency - } + fun folioCashAdvancesCurrency( + folioCashAdvancesCurrency: JsonField + ) = apply { this.folioCashAdvancesCurrency = folioCashAdvancesCurrency } - /** Any insurance being charged for the vehicle. */ - fun insuranceChargesAmount(insuranceChargesAmount: Long?) = - insuranceChargesAmount(JsonField.ofNullable(insuranceChargesAmount)) + /** Food and beverage charges for the room. */ + fun foodBeverageChargesAmount(foodBeverageChargesAmount: Long?) = + foodBeverageChargesAmount( + JsonField.ofNullable(foodBeverageChargesAmount) + ) /** - * Alias for [Builder.insuranceChargesAmount]. + * Alias for [Builder.foodBeverageChargesAmount]. * * This unboxed primitive overload exists for backwards compatibility. */ - fun insuranceChargesAmount(insuranceChargesAmount: Long) = - insuranceChargesAmount(insuranceChargesAmount as Long?) + fun foodBeverageChargesAmount(foodBeverageChargesAmount: Long) = + foodBeverageChargesAmount(foodBeverageChargesAmount as Long?) /** - * Alias for calling [Builder.insuranceChargesAmount] with - * `insuranceChargesAmount.orElse(null)`. + * Alias for calling [Builder.foodBeverageChargesAmount] with + * `foodBeverageChargesAmount.orElse(null)`. */ - fun insuranceChargesAmount(insuranceChargesAmount: Optional) = - insuranceChargesAmount(insuranceChargesAmount.getOrNull()) + fun foodBeverageChargesAmount(foodBeverageChargesAmount: Optional) = + foodBeverageChargesAmount(foodBeverageChargesAmount.getOrNull()) /** - * Sets [Builder.insuranceChargesAmount] to an arbitrary JSON value. + * Sets [Builder.foodBeverageChargesAmount] to an arbitrary JSON value. * - * You should usually call [Builder.insuranceChargesAmount] with a + * You should usually call [Builder.foodBeverageChargesAmount] with a * well-typed [Long] value instead. This method is primarily for setting the * field to an undocumented or not yet supported value. */ - fun insuranceChargesAmount(insuranceChargesAmount: JsonField) = + fun foodBeverageChargesAmount(foodBeverageChargesAmount: JsonField) = apply { - this.insuranceChargesAmount = insuranceChargesAmount + this.foodBeverageChargesAmount = foodBeverageChargesAmount } /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - * insurance charges assessed. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the food + * and beverage charges. */ - fun insuranceChargesCurrency(insuranceChargesCurrency: String?) = - insuranceChargesCurrency(JsonField.ofNullable(insuranceChargesCurrency)) + fun foodBeverageChargesCurrency(foodBeverageChargesCurrency: String?) = + foodBeverageChargesCurrency( + JsonField.ofNullable(foodBeverageChargesCurrency) + ) /** - * Alias for calling [Builder.insuranceChargesCurrency] with - * `insuranceChargesCurrency.orElse(null)`. + * Alias for calling [Builder.foodBeverageChargesCurrency] with + * `foodBeverageChargesCurrency.orElse(null)`. */ - fun insuranceChargesCurrency(insuranceChargesCurrency: Optional) = - insuranceChargesCurrency(insuranceChargesCurrency.getOrNull()) + fun foodBeverageChargesCurrency( + foodBeverageChargesCurrency: Optional + ) = foodBeverageChargesCurrency(foodBeverageChargesCurrency.getOrNull()) /** - * Sets [Builder.insuranceChargesCurrency] to an arbitrary JSON value. + * Sets [Builder.foodBeverageChargesCurrency] to an arbitrary JSON value. * - * You should usually call [Builder.insuranceChargesCurrency] with a + * You should usually call [Builder.foodBeverageChargesCurrency] with a * well-typed [String] value instead. This method is primarily for setting * the field to an undocumented or not yet supported value. */ - fun insuranceChargesCurrency(insuranceChargesCurrency: JsonField) = - apply { - this.insuranceChargesCurrency = insuranceChargesCurrency - } + fun foodBeverageChargesCurrency( + foodBeverageChargesCurrency: JsonField + ) = apply { this.foodBeverageChargesCurrency = foodBeverageChargesCurrency } /** - * An indicator that the cardholder is being billed for a reserved vehicle - * that was not actually rented (that is, a "no-show" charge). + * Indicator that the cardholder is being billed for a reserved room that + * was not actually used. */ fun noShowIndicator(noShowIndicator: NoShowIndicator?) = noShowIndicator(JsonField.ofNullable(noShowIndicator)) @@ -55685,148 +65328,199 @@ private constructor( this.noShowIndicator = noShowIndicator } - /** - * Charges for returning the vehicle at a different location than where it - * was picked up. - */ - fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Long?) = - oneWayDropOffChargesAmount( - JsonField.ofNullable(oneWayDropOffChargesAmount) - ) + /** Prepaid expenses being charged for the room. */ + fun prepaidExpensesAmount(prepaidExpensesAmount: Long?) = + prepaidExpensesAmount(JsonField.ofNullable(prepaidExpensesAmount)) /** - * Alias for [Builder.oneWayDropOffChargesAmount]. + * Alias for [Builder.prepaidExpensesAmount]. * * This unboxed primitive overload exists for backwards compatibility. */ - fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Long) = - oneWayDropOffChargesAmount(oneWayDropOffChargesAmount as Long?) + fun prepaidExpensesAmount(prepaidExpensesAmount: Long) = + prepaidExpensesAmount(prepaidExpensesAmount as Long?) /** - * Alias for calling [Builder.oneWayDropOffChargesAmount] with - * `oneWayDropOffChargesAmount.orElse(null)`. + * Alias for calling [Builder.prepaidExpensesAmount] with + * `prepaidExpensesAmount.orElse(null)`. */ - fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Optional) = - oneWayDropOffChargesAmount(oneWayDropOffChargesAmount.getOrNull()) + fun prepaidExpensesAmount(prepaidExpensesAmount: Optional) = + prepaidExpensesAmount(prepaidExpensesAmount.getOrNull()) /** - * Sets [Builder.oneWayDropOffChargesAmount] to an arbitrary JSON value. + * Sets [Builder.prepaidExpensesAmount] to an arbitrary JSON value. * - * You should usually call [Builder.oneWayDropOffChargesAmount] with a - * well-typed [Long] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * You should usually call [Builder.prepaidExpensesAmount] with a well-typed + * [Long] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. */ - fun oneWayDropOffChargesAmount( - oneWayDropOffChargesAmount: JsonField - ) = apply { this.oneWayDropOffChargesAmount = oneWayDropOffChargesAmount } + fun prepaidExpensesAmount(prepaidExpensesAmount: JsonField) = apply { + this.prepaidExpensesAmount = prepaidExpensesAmount + } /** * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - * one-way drop-off charges assessed. + * prepaid expenses. */ - fun oneWayDropOffChargesCurrency(oneWayDropOffChargesCurrency: String?) = - oneWayDropOffChargesCurrency( - JsonField.ofNullable(oneWayDropOffChargesCurrency) - ) + fun prepaidExpensesCurrency(prepaidExpensesCurrency: String?) = + prepaidExpensesCurrency(JsonField.ofNullable(prepaidExpensesCurrency)) /** - * Alias for calling [Builder.oneWayDropOffChargesCurrency] with - * `oneWayDropOffChargesCurrency.orElse(null)`. + * Alias for calling [Builder.prepaidExpensesCurrency] with + * `prepaidExpensesCurrency.orElse(null)`. */ - fun oneWayDropOffChargesCurrency( - oneWayDropOffChargesCurrency: Optional - ) = oneWayDropOffChargesCurrency(oneWayDropOffChargesCurrency.getOrNull()) + fun prepaidExpensesCurrency(prepaidExpensesCurrency: Optional) = + prepaidExpensesCurrency(prepaidExpensesCurrency.getOrNull()) /** - * Sets [Builder.oneWayDropOffChargesCurrency] to an arbitrary JSON value. + * Sets [Builder.prepaidExpensesCurrency] to an arbitrary JSON value. * - * You should usually call [Builder.oneWayDropOffChargesCurrency] with a + * You should usually call [Builder.prepaidExpensesCurrency] with a * well-typed [String] value instead. This method is primarily for setting * the field to an undocumented or not yet supported value. */ - fun oneWayDropOffChargesCurrency( - oneWayDropOffChargesCurrency: JsonField - ) = apply { - this.oneWayDropOffChargesCurrency = oneWayDropOffChargesCurrency - } + fun prepaidExpensesCurrency(prepaidExpensesCurrency: JsonField) = + apply { + this.prepaidExpensesCurrency = prepaidExpensesCurrency + } - /** Name of the person renting the vehicle. */ - fun renterName(renterName: String?) = - renterName(JsonField.ofNullable(renterName)) + /** Number of nights the room was rented. */ + fun roomNights(roomNights: Long?) = + roomNights(JsonField.ofNullable(roomNights)) /** - * Alias for calling [Builder.renterName] with `renterName.orElse(null)`. + * Alias for [Builder.roomNights]. + * + * This unboxed primitive overload exists for backwards compatibility. */ - fun renterName(renterName: Optional) = - renterName(renterName.getOrNull()) + fun roomNights(roomNights: Long) = roomNights(roomNights as Long?) /** - * Sets [Builder.renterName] to an arbitrary JSON value. + * Alias for calling [Builder.roomNights] with `roomNights.orElse(null)`. + */ + fun roomNights(roomNights: Optional) = + roomNights(roomNights.getOrNull()) + + /** + * Sets [Builder.roomNights] to an arbitrary JSON value. * - * You should usually call [Builder.renterName] with a well-typed [String] + * You should usually call [Builder.roomNights] with a well-typed [Long] * value instead. This method is primarily for setting the field to an * undocumented or not yet supported value. */ - fun renterName(renterName: JsonField) = apply { - this.renterName = renterName + fun roomNights(roomNights: JsonField) = apply { + this.roomNights = roomNights } - /** Weekly rate being charged for the vehicle. */ - fun weeklyRentalRateAmount(weeklyRentalRateAmount: Long?) = - weeklyRentalRateAmount(JsonField.ofNullable(weeklyRentalRateAmount)) + /** Total room tax being charged. */ + fun totalRoomTaxAmount(totalRoomTaxAmount: Long?) = + totalRoomTaxAmount(JsonField.ofNullable(totalRoomTaxAmount)) /** - * Alias for [Builder.weeklyRentalRateAmount]. + * Alias for [Builder.totalRoomTaxAmount]. * * This unboxed primitive overload exists for backwards compatibility. */ - fun weeklyRentalRateAmount(weeklyRentalRateAmount: Long) = - weeklyRentalRateAmount(weeklyRentalRateAmount as Long?) + fun totalRoomTaxAmount(totalRoomTaxAmount: Long) = + totalRoomTaxAmount(totalRoomTaxAmount as Long?) /** - * Alias for calling [Builder.weeklyRentalRateAmount] with - * `weeklyRentalRateAmount.orElse(null)`. + * Alias for calling [Builder.totalRoomTaxAmount] with + * `totalRoomTaxAmount.orElse(null)`. */ - fun weeklyRentalRateAmount(weeklyRentalRateAmount: Optional) = - weeklyRentalRateAmount(weeklyRentalRateAmount.getOrNull()) + fun totalRoomTaxAmount(totalRoomTaxAmount: Optional) = + totalRoomTaxAmount(totalRoomTaxAmount.getOrNull()) /** - * Sets [Builder.weeklyRentalRateAmount] to an arbitrary JSON value. + * Sets [Builder.totalRoomTaxAmount] to an arbitrary JSON value. * - * You should usually call [Builder.weeklyRentalRateAmount] with a - * well-typed [Long] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * You should usually call [Builder.totalRoomTaxAmount] with a well-typed + * [Long] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. */ - fun weeklyRentalRateAmount(weeklyRentalRateAmount: JsonField) = - apply { - this.weeklyRentalRateAmount = weeklyRentalRateAmount - } + fun totalRoomTaxAmount(totalRoomTaxAmount: JsonField) = apply { + this.totalRoomTaxAmount = totalRoomTaxAmount + } /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - * weekly rental rate. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total + * room tax. */ - fun weeklyRentalRateCurrency(weeklyRentalRateCurrency: String?) = - weeklyRentalRateCurrency(JsonField.ofNullable(weeklyRentalRateCurrency)) + fun totalRoomTaxCurrency(totalRoomTaxCurrency: String?) = + totalRoomTaxCurrency(JsonField.ofNullable(totalRoomTaxCurrency)) /** - * Alias for calling [Builder.weeklyRentalRateCurrency] with - * `weeklyRentalRateCurrency.orElse(null)`. + * Alias for calling [Builder.totalRoomTaxCurrency] with + * `totalRoomTaxCurrency.orElse(null)`. */ - fun weeklyRentalRateCurrency(weeklyRentalRateCurrency: Optional) = - weeklyRentalRateCurrency(weeklyRentalRateCurrency.getOrNull()) + fun totalRoomTaxCurrency(totalRoomTaxCurrency: Optional) = + totalRoomTaxCurrency(totalRoomTaxCurrency.getOrNull()) /** - * Sets [Builder.weeklyRentalRateCurrency] to an arbitrary JSON value. + * Sets [Builder.totalRoomTaxCurrency] to an arbitrary JSON value. * - * You should usually call [Builder.weeklyRentalRateCurrency] with a - * well-typed [String] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. + * You should usually call [Builder.totalRoomTaxCurrency] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. */ - fun weeklyRentalRateCurrency(weeklyRentalRateCurrency: JsonField) = - apply { - this.weeklyRentalRateCurrency = weeklyRentalRateCurrency - } + fun totalRoomTaxCurrency(totalRoomTaxCurrency: JsonField) = apply { + this.totalRoomTaxCurrency = totalRoomTaxCurrency + } + + /** Total tax being charged for the room. */ + fun totalTaxAmount(totalTaxAmount: Long?) = + totalTaxAmount(JsonField.ofNullable(totalTaxAmount)) + + /** + * Alias for [Builder.totalTaxAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun totalTaxAmount(totalTaxAmount: Long) = + totalTaxAmount(totalTaxAmount as Long?) + + /** + * Alias for calling [Builder.totalTaxAmount] with + * `totalTaxAmount.orElse(null)`. + */ + fun totalTaxAmount(totalTaxAmount: Optional) = + totalTaxAmount(totalTaxAmount.getOrNull()) + + /** + * Sets [Builder.totalTaxAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.totalTaxAmount] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun totalTaxAmount(totalTaxAmount: JsonField) = apply { + this.totalTaxAmount = totalTaxAmount + } + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total + * tax assessed. + */ + fun totalTaxCurrency(totalTaxCurrency: String?) = + totalTaxCurrency(JsonField.ofNullable(totalTaxCurrency)) + + /** + * Alias for calling [Builder.totalTaxCurrency] with + * `totalTaxCurrency.orElse(null)`. + */ + fun totalTaxCurrency(totalTaxCurrency: Optional) = + totalTaxCurrency(totalTaxCurrency.getOrNull()) + + /** + * Sets [Builder.totalTaxCurrency] to an arbitrary JSON value. + * + * You should usually call [Builder.totalTaxCurrency] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun totalTaxCurrency(totalTaxCurrency: JsonField) = apply { + this.totalTaxCurrency = totalTaxCurrency + } fun additionalProperties(additionalProperties: Map) = apply { @@ -55851,83 +65545,86 @@ private constructor( } /** - * Returns an immutable instance of [CarRental]. + * Returns an immutable instance of [Lodging]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .carClassCode() - * .checkoutDate() - * .dailyRentalRateAmount() - * .dailyRentalRateCurrency() - * .daysRented() + * .checkInDate() + * .dailyRoomRateAmount() + * .dailyRoomRateCurrency() * .extraCharges() - * .fuelChargesAmount() - * .fuelChargesCurrency() - * .insuranceChargesAmount() - * .insuranceChargesCurrency() + * .folioCashAdvancesAmount() + * .folioCashAdvancesCurrency() + * .foodBeverageChargesAmount() + * .foodBeverageChargesCurrency() * .noShowIndicator() - * .oneWayDropOffChargesAmount() - * .oneWayDropOffChargesCurrency() - * .renterName() - * .weeklyRentalRateAmount() - * .weeklyRentalRateCurrency() + * .prepaidExpensesAmount() + * .prepaidExpensesCurrency() + * .roomNights() + * .totalRoomTaxAmount() + * .totalRoomTaxCurrency() + * .totalTaxAmount() + * .totalTaxCurrency() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): CarRental = - CarRental( - checkRequired("carClassCode", carClassCode), - checkRequired("checkoutDate", checkoutDate), - checkRequired("dailyRentalRateAmount", dailyRentalRateAmount), - checkRequired("dailyRentalRateCurrency", dailyRentalRateCurrency), - checkRequired("daysRented", daysRented), + fun build(): Lodging = + Lodging( + checkRequired("checkInDate", checkInDate), + checkRequired("dailyRoomRateAmount", dailyRoomRateAmount), + checkRequired("dailyRoomRateCurrency", dailyRoomRateCurrency), checkRequired("extraCharges", extraCharges), - checkRequired("fuelChargesAmount", fuelChargesAmount), - checkRequired("fuelChargesCurrency", fuelChargesCurrency), - checkRequired("insuranceChargesAmount", insuranceChargesAmount), - checkRequired("insuranceChargesCurrency", insuranceChargesCurrency), - checkRequired("noShowIndicator", noShowIndicator), + checkRequired("folioCashAdvancesAmount", folioCashAdvancesAmount), checkRequired( - "oneWayDropOffChargesAmount", - oneWayDropOffChargesAmount, + "folioCashAdvancesCurrency", + folioCashAdvancesCurrency, ), checkRequired( - "oneWayDropOffChargesCurrency", - oneWayDropOffChargesCurrency, + "foodBeverageChargesAmount", + foodBeverageChargesAmount, ), - checkRequired("renterName", renterName), - checkRequired("weeklyRentalRateAmount", weeklyRentalRateAmount), - checkRequired("weeklyRentalRateCurrency", weeklyRentalRateCurrency), + checkRequired( + "foodBeverageChargesCurrency", + foodBeverageChargesCurrency, + ), + checkRequired("noShowIndicator", noShowIndicator), + checkRequired("prepaidExpensesAmount", prepaidExpensesAmount), + checkRequired("prepaidExpensesCurrency", prepaidExpensesCurrency), + checkRequired("roomNights", roomNights), + checkRequired("totalRoomTaxAmount", totalRoomTaxAmount), + checkRequired("totalRoomTaxCurrency", totalRoomTaxCurrency), + checkRequired("totalTaxAmount", totalTaxAmount), + checkRequired("totalTaxCurrency", totalTaxCurrency), additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): CarRental = apply { + fun validate(): Lodging = apply { if (validated) { return@apply } - carClassCode() - checkoutDate() - dailyRentalRateAmount() - dailyRentalRateCurrency() - daysRented() + checkInDate() + dailyRoomRateAmount() + dailyRoomRateCurrency() extraCharges().ifPresent { it.validate() } - fuelChargesAmount() - fuelChargesCurrency() - insuranceChargesAmount() - insuranceChargesCurrency() + folioCashAdvancesAmount() + folioCashAdvancesCurrency() + foodBeverageChargesAmount() + foodBeverageChargesCurrency() noShowIndicator().ifPresent { it.validate() } - oneWayDropOffChargesAmount() - oneWayDropOffChargesCurrency() - renterName() - weeklyRentalRateAmount() - weeklyRentalRateCurrency() + prepaidExpensesAmount() + prepaidExpensesCurrency() + roomNights() + totalRoomTaxAmount() + totalRoomTaxCurrency() + totalTaxAmount() + totalTaxCurrency() validated = true } @@ -55947,24 +65644,24 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (carClassCode.asKnown().isPresent) 1 else 0) + - (if (checkoutDate.asKnown().isPresent) 1 else 0) + - (if (dailyRentalRateAmount.asKnown().isPresent) 1 else 0) + - (if (dailyRentalRateCurrency.asKnown().isPresent) 1 else 0) + - (if (daysRented.asKnown().isPresent) 1 else 0) + + (if (checkInDate.asKnown().isPresent) 1 else 0) + + (if (dailyRoomRateAmount.asKnown().isPresent) 1 else 0) + + (if (dailyRoomRateCurrency.asKnown().isPresent) 1 else 0) + (extraCharges.asKnown().getOrNull()?.validity() ?: 0) + - (if (fuelChargesAmount.asKnown().isPresent) 1 else 0) + - (if (fuelChargesCurrency.asKnown().isPresent) 1 else 0) + - (if (insuranceChargesAmount.asKnown().isPresent) 1 else 0) + - (if (insuranceChargesCurrency.asKnown().isPresent) 1 else 0) + + (if (folioCashAdvancesAmount.asKnown().isPresent) 1 else 0) + + (if (folioCashAdvancesCurrency.asKnown().isPresent) 1 else 0) + + (if (foodBeverageChargesAmount.asKnown().isPresent) 1 else 0) + + (if (foodBeverageChargesCurrency.asKnown().isPresent) 1 else 0) + (noShowIndicator.asKnown().getOrNull()?.validity() ?: 0) + - (if (oneWayDropOffChargesAmount.asKnown().isPresent) 1 else 0) + - (if (oneWayDropOffChargesCurrency.asKnown().isPresent) 1 else 0) + - (if (renterName.asKnown().isPresent) 1 else 0) + - (if (weeklyRentalRateAmount.asKnown().isPresent) 1 else 0) + - (if (weeklyRentalRateCurrency.asKnown().isPresent) 1 else 0) + (if (prepaidExpensesAmount.asKnown().isPresent) 1 else 0) + + (if (prepaidExpensesCurrency.asKnown().isPresent) 1 else 0) + + (if (roomNights.asKnown().isPresent) 1 else 0) + + (if (totalRoomTaxAmount.asKnown().isPresent) 1 else 0) + + (if (totalRoomTaxCurrency.asKnown().isPresent) 1 else 0) + + (if (totalTaxAmount.asKnown().isPresent) 1 else 0) + + (if (totalTaxCurrency.asKnown().isPresent) 1 else 0) - /** Additional charges (gas, late fee, etc.) being billed. */ + /** Additional charges (phone, late check-out, etc.) being billed. */ class ExtraCharges @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -55985,20 +65682,23 @@ private constructor( /** No extra charge */ @JvmField val NO_EXTRA_CHARGE = of("no_extra_charge") - /** Gas */ - @JvmField val GAS = of("gas") + /** Restaurant */ + @JvmField val RESTAURANT = of("restaurant") - /** Extra mileage */ - @JvmField val EXTRA_MILEAGE = of("extra_mileage") + /** Gift shop */ + @JvmField val GIFT_SHOP = of("gift_shop") - /** Late return */ - @JvmField val LATE_RETURN = of("late_return") + /** Mini bar */ + @JvmField val MINI_BAR = of("mini_bar") - /** One way service fee */ - @JvmField val ONE_WAY_SERVICE_FEE = of("one_way_service_fee") + /** Telephone */ + @JvmField val TELEPHONE = of("telephone") - /** Parking violation */ - @JvmField val PARKING_VIOLATION = of("parking_violation") + /** Other */ + @JvmField val OTHER = of("other") + + /** Laundry */ + @JvmField val LAUNDRY = of("laundry") @JvmStatic fun of(value: String) = ExtraCharges(JsonField.of(value)) } @@ -56007,16 +65707,18 @@ private constructor( enum class Known { /** No extra charge */ NO_EXTRA_CHARGE, - /** Gas */ - GAS, - /** Extra mileage */ - EXTRA_MILEAGE, - /** Late return */ - LATE_RETURN, - /** One way service fee */ - ONE_WAY_SERVICE_FEE, - /** Parking violation */ - PARKING_VIOLATION, + /** Restaurant */ + RESTAURANT, + /** Gift shop */ + GIFT_SHOP, + /** Mini bar */ + MINI_BAR, + /** Telephone */ + TELEPHONE, + /** Other */ + OTHER, + /** Laundry */ + LAUNDRY, } /** @@ -56033,16 +65735,18 @@ private constructor( enum class Value { /** No extra charge */ NO_EXTRA_CHARGE, - /** Gas */ - GAS, - /** Extra mileage */ - EXTRA_MILEAGE, - /** Late return */ - LATE_RETURN, - /** One way service fee */ - ONE_WAY_SERVICE_FEE, - /** Parking violation */ - PARKING_VIOLATION, + /** Restaurant */ + RESTAURANT, + /** Gift shop */ + GIFT_SHOP, + /** Mini bar */ + MINI_BAR, + /** Telephone */ + TELEPHONE, + /** Other */ + OTHER, + /** Laundry */ + LAUNDRY, /** * An enum member indicating that [ExtraCharges] was instantiated with * an unknown value. @@ -56060,11 +65764,12 @@ private constructor( fun value(): Value = when (this) { NO_EXTRA_CHARGE -> Value.NO_EXTRA_CHARGE - GAS -> Value.GAS - EXTRA_MILEAGE -> Value.EXTRA_MILEAGE - LATE_RETURN -> Value.LATE_RETURN - ONE_WAY_SERVICE_FEE -> Value.ONE_WAY_SERVICE_FEE - PARKING_VIOLATION -> Value.PARKING_VIOLATION + RESTAURANT -> Value.RESTAURANT + GIFT_SHOP -> Value.GIFT_SHOP + MINI_BAR -> Value.MINI_BAR + TELEPHONE -> Value.TELEPHONE + OTHER -> Value.OTHER + LAUNDRY -> Value.LAUNDRY else -> Value._UNKNOWN } @@ -56080,11 +65785,12 @@ private constructor( fun known(): Known = when (this) { NO_EXTRA_CHARGE -> Known.NO_EXTRA_CHARGE - GAS -> Known.GAS - EXTRA_MILEAGE -> Known.EXTRA_MILEAGE - LATE_RETURN -> Known.LATE_RETURN - ONE_WAY_SERVICE_FEE -> Known.ONE_WAY_SERVICE_FEE - PARKING_VIOLATION -> Known.PARKING_VIOLATION + RESTAURANT -> Known.RESTAURANT + GIFT_SHOP -> Known.GIFT_SHOP + MINI_BAR -> Known.MINI_BAR + TELEPHONE -> Known.TELEPHONE + OTHER -> Known.OTHER + LAUNDRY -> Known.LAUNDRY else -> throw IncreaseInvalidDataException( "Unknown ExtraCharges: $value" @@ -56147,8 +65853,8 @@ private constructor( } /** - * An indicator that the cardholder is being billed for a reserved vehicle that - * was not actually rented (that is, a "no-show" charge). + * Indicator that the cardholder is being billed for a reserved room that was + * not actually used. */ class NoShowIndicator @JsonCreator @@ -56170,10 +65876,8 @@ private constructor( /** Not applicable */ @JvmField val NOT_APPLICABLE = of("not_applicable") - /** No show for specialized vehicle */ - @JvmField - val NO_SHOW_FOR_SPECIALIZED_VEHICLE = - of("no_show_for_specialized_vehicle") + /** No show */ + @JvmField val NO_SHOW = of("no_show") @JvmStatic fun of(value: String) = NoShowIndicator(JsonField.of(value)) } @@ -56182,8 +65886,8 @@ private constructor( enum class Known { /** Not applicable */ NOT_APPLICABLE, - /** No show for specialized vehicle */ - NO_SHOW_FOR_SPECIALIZED_VEHICLE, + /** No show */ + NO_SHOW, } /** @@ -56200,8 +65904,8 @@ private constructor( enum class Value { /** Not applicable */ NOT_APPLICABLE, - /** No show for specialized vehicle */ - NO_SHOW_FOR_SPECIALIZED_VEHICLE, + /** No show */ + NO_SHOW, /** * An enum member indicating that [NoShowIndicator] was instantiated * with an unknown value. @@ -56219,8 +65923,7 @@ private constructor( fun value(): Value = when (this) { NOT_APPLICABLE -> Value.NOT_APPLICABLE - NO_SHOW_FOR_SPECIALIZED_VEHICLE -> - Value.NO_SHOW_FOR_SPECIALIZED_VEHICLE + NO_SHOW -> Value.NO_SHOW else -> Value._UNKNOWN } @@ -56236,8 +65939,7 @@ private constructor( fun known(): Known = when (this) { NOT_APPLICABLE -> Known.NOT_APPLICABLE - NO_SHOW_FOR_SPECIALIZED_VEHICLE -> - Known.NO_SHOW_FOR_SPECIALIZED_VEHICLE + NO_SHOW -> Known.NO_SHOW else -> throw IncreaseInvalidDataException( "Unknown NoShowIndicator: $value" @@ -56304,44 +66006,44 @@ private constructor( return true } - return other is CarRental && - carClassCode == other.carClassCode && - checkoutDate == other.checkoutDate && - dailyRentalRateAmount == other.dailyRentalRateAmount && - dailyRentalRateCurrency == other.dailyRentalRateCurrency && - daysRented == other.daysRented && + return other is Lodging && + checkInDate == other.checkInDate && + dailyRoomRateAmount == other.dailyRoomRateAmount && + dailyRoomRateCurrency == other.dailyRoomRateCurrency && extraCharges == other.extraCharges && - fuelChargesAmount == other.fuelChargesAmount && - fuelChargesCurrency == other.fuelChargesCurrency && - insuranceChargesAmount == other.insuranceChargesAmount && - insuranceChargesCurrency == other.insuranceChargesCurrency && + folioCashAdvancesAmount == other.folioCashAdvancesAmount && + folioCashAdvancesCurrency == other.folioCashAdvancesCurrency && + foodBeverageChargesAmount == other.foodBeverageChargesAmount && + foodBeverageChargesCurrency == other.foodBeverageChargesCurrency && noShowIndicator == other.noShowIndicator && - oneWayDropOffChargesAmount == other.oneWayDropOffChargesAmount && - oneWayDropOffChargesCurrency == other.oneWayDropOffChargesCurrency && - renterName == other.renterName && - weeklyRentalRateAmount == other.weeklyRentalRateAmount && - weeklyRentalRateCurrency == other.weeklyRentalRateCurrency && + prepaidExpensesAmount == other.prepaidExpensesAmount && + prepaidExpensesCurrency == other.prepaidExpensesCurrency && + roomNights == other.roomNights && + totalRoomTaxAmount == other.totalRoomTaxAmount && + totalRoomTaxCurrency == other.totalRoomTaxCurrency && + totalTaxAmount == other.totalTaxAmount && + totalTaxCurrency == other.totalTaxCurrency && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { Objects.hash( - carClassCode, - checkoutDate, - dailyRentalRateAmount, - dailyRentalRateCurrency, - daysRented, + checkInDate, + dailyRoomRateAmount, + dailyRoomRateCurrency, extraCharges, - fuelChargesAmount, - fuelChargesCurrency, - insuranceChargesAmount, - insuranceChargesCurrency, + folioCashAdvancesAmount, + folioCashAdvancesCurrency, + foodBeverageChargesAmount, + foodBeverageChargesCurrency, noShowIndicator, - oneWayDropOffChargesAmount, - oneWayDropOffChargesCurrency, - renterName, - weeklyRentalRateAmount, - weeklyRentalRateCurrency, + prepaidExpensesAmount, + prepaidExpensesCurrency, + roomNights, + totalRoomTaxAmount, + totalRoomTaxCurrency, + totalTaxAmount, + totalTaxCurrency, additionalProperties, ) } @@ -56349,412 +66051,486 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CarRental{carClassCode=$carClassCode, checkoutDate=$checkoutDate, dailyRentalRateAmount=$dailyRentalRateAmount, dailyRentalRateCurrency=$dailyRentalRateCurrency, daysRented=$daysRented, extraCharges=$extraCharges, fuelChargesAmount=$fuelChargesAmount, fuelChargesCurrency=$fuelChargesCurrency, insuranceChargesAmount=$insuranceChargesAmount, insuranceChargesCurrency=$insuranceChargesCurrency, noShowIndicator=$noShowIndicator, oneWayDropOffChargesAmount=$oneWayDropOffChargesAmount, oneWayDropOffChargesCurrency=$oneWayDropOffChargesCurrency, renterName=$renterName, weeklyRentalRateAmount=$weeklyRentalRateAmount, weeklyRentalRateCurrency=$weeklyRentalRateCurrency, additionalProperties=$additionalProperties}" + "Lodging{checkInDate=$checkInDate, dailyRoomRateAmount=$dailyRoomRateAmount, dailyRoomRateCurrency=$dailyRoomRateCurrency, extraCharges=$extraCharges, folioCashAdvancesAmount=$folioCashAdvancesAmount, folioCashAdvancesCurrency=$folioCashAdvancesCurrency, foodBeverageChargesAmount=$foodBeverageChargesAmount, foodBeverageChargesCurrency=$foodBeverageChargesCurrency, noShowIndicator=$noShowIndicator, prepaidExpensesAmount=$prepaidExpensesAmount, prepaidExpensesCurrency=$prepaidExpensesCurrency, roomNights=$roomNights, totalRoomTaxAmount=$totalRoomTaxAmount, totalRoomTaxCurrency=$totalRoomTaxCurrency, totalTaxAmount=$totalTaxAmount, totalTaxCurrency=$totalTaxCurrency, additionalProperties=$additionalProperties}" } - /** Fields specific to lodging. */ - class Lodging + /** The format of the purchase identifier. */ + class PurchaseIdentifierFormat + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** Free text */ + @JvmField val FREE_TEXT = of("free_text") + + /** Order number */ + @JvmField val ORDER_NUMBER = of("order_number") + + /** Rental agreement number */ + @JvmField val RENTAL_AGREEMENT_NUMBER = of("rental_agreement_number") + + /** Hotel folio number */ + @JvmField val HOTEL_FOLIO_NUMBER = of("hotel_folio_number") + + /** Invoice number */ + @JvmField val INVOICE_NUMBER = of("invoice_number") + + @JvmStatic + fun of(value: String) = PurchaseIdentifierFormat(JsonField.of(value)) + } + + /** An enum containing [PurchaseIdentifierFormat]'s known values. */ + enum class Known { + /** Free text */ + FREE_TEXT, + /** Order number */ + ORDER_NUMBER, + /** Rental agreement number */ + RENTAL_AGREEMENT_NUMBER, + /** Hotel folio number */ + HOTEL_FOLIO_NUMBER, + /** Invoice number */ + INVOICE_NUMBER, + } + + /** + * An enum containing [PurchaseIdentifierFormat]'s known values, as well as an + * [_UNKNOWN] member. + * + * An instance of [PurchaseIdentifierFormat] can contain an unknown value in a + * couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** Free text */ + FREE_TEXT, + /** Order number */ + ORDER_NUMBER, + /** Rental agreement number */ + RENTAL_AGREEMENT_NUMBER, + /** Hotel folio number */ + HOTEL_FOLIO_NUMBER, + /** Invoice number */ + INVOICE_NUMBER, + /** + * An enum member indicating that [PurchaseIdentifierFormat] was + * instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + FREE_TEXT -> Value.FREE_TEXT + ORDER_NUMBER -> Value.ORDER_NUMBER + RENTAL_AGREEMENT_NUMBER -> Value.RENTAL_AGREEMENT_NUMBER + HOTEL_FOLIO_NUMBER -> Value.HOTEL_FOLIO_NUMBER + INVOICE_NUMBER -> Value.INVOICE_NUMBER + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + FREE_TEXT -> Known.FREE_TEXT + ORDER_NUMBER -> Known.ORDER_NUMBER + RENTAL_AGREEMENT_NUMBER -> Known.RENTAL_AGREEMENT_NUMBER + HOTEL_FOLIO_NUMBER -> Known.HOTEL_FOLIO_NUMBER + INVOICE_NUMBER -> Known.INVOICE_NUMBER + else -> + throw IncreaseInvalidDataException( + "Unknown PurchaseIdentifierFormat: $value" + ) + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): PurchaseIdentifierFormat = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is PurchaseIdentifierFormat && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Fields specific to travel. */ + class Travel @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val checkInDate: JsonField, - private val dailyRoomRateAmount: JsonField, - private val dailyRoomRateCurrency: JsonField, - private val extraCharges: JsonField, - private val folioCashAdvancesAmount: JsonField, - private val folioCashAdvancesCurrency: JsonField, - private val foodBeverageChargesAmount: JsonField, - private val foodBeverageChargesCurrency: JsonField, - private val noShowIndicator: JsonField, - private val prepaidExpensesAmount: JsonField, - private val prepaidExpensesCurrency: JsonField, - private val roomNights: JsonField, - private val totalRoomTaxAmount: JsonField, - private val totalRoomTaxCurrency: JsonField, - private val totalTaxAmount: JsonField, - private val totalTaxCurrency: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("check_in_date") - @ExcludeMissing - checkInDate: JsonField = JsonMissing.of(), - @JsonProperty("daily_room_rate_amount") - @ExcludeMissing - dailyRoomRateAmount: JsonField = JsonMissing.of(), - @JsonProperty("daily_room_rate_currency") - @ExcludeMissing - dailyRoomRateCurrency: JsonField = JsonMissing.of(), - @JsonProperty("extra_charges") - @ExcludeMissing - extraCharges: JsonField = JsonMissing.of(), - @JsonProperty("folio_cash_advances_amount") + private val ancillary: JsonField, + private val computerizedReservationSystem: JsonField, + private val creditReasonIndicator: JsonField, + private val departureDate: JsonField, + private val originationCityAirportCode: JsonField, + private val passengerName: JsonField, + private val restrictedTicketIndicator: JsonField, + private val ticketChangeIndicator: JsonField, + private val ticketNumber: JsonField, + private val travelAgencyCode: JsonField, + private val travelAgencyName: JsonField, + private val tripLegs: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("ancillary") @ExcludeMissing - folioCashAdvancesAmount: JsonField = JsonMissing.of(), - @JsonProperty("folio_cash_advances_currency") + ancillary: JsonField = JsonMissing.of(), + @JsonProperty("computerized_reservation_system") @ExcludeMissing - folioCashAdvancesCurrency: JsonField = JsonMissing.of(), - @JsonProperty("food_beverage_charges_amount") + computerizedReservationSystem: JsonField = JsonMissing.of(), + @JsonProperty("credit_reason_indicator") @ExcludeMissing - foodBeverageChargesAmount: JsonField = JsonMissing.of(), - @JsonProperty("food_beverage_charges_currency") + creditReasonIndicator: JsonField = JsonMissing.of(), + @JsonProperty("departure_date") @ExcludeMissing - foodBeverageChargesCurrency: JsonField = JsonMissing.of(), - @JsonProperty("no_show_indicator") + departureDate: JsonField = JsonMissing.of(), + @JsonProperty("origination_city_airport_code") @ExcludeMissing - noShowIndicator: JsonField = JsonMissing.of(), - @JsonProperty("prepaid_expenses_amount") + originationCityAirportCode: JsonField = JsonMissing.of(), + @JsonProperty("passenger_name") @ExcludeMissing - prepaidExpensesAmount: JsonField = JsonMissing.of(), - @JsonProperty("prepaid_expenses_currency") + passengerName: JsonField = JsonMissing.of(), + @JsonProperty("restricted_ticket_indicator") @ExcludeMissing - prepaidExpensesCurrency: JsonField = JsonMissing.of(), - @JsonProperty("room_nights") + restrictedTicketIndicator: JsonField = + JsonMissing.of(), + @JsonProperty("ticket_change_indicator") @ExcludeMissing - roomNights: JsonField = JsonMissing.of(), - @JsonProperty("total_room_tax_amount") + ticketChangeIndicator: JsonField = JsonMissing.of(), + @JsonProperty("ticket_number") @ExcludeMissing - totalRoomTaxAmount: JsonField = JsonMissing.of(), - @JsonProperty("total_room_tax_currency") + ticketNumber: JsonField = JsonMissing.of(), + @JsonProperty("travel_agency_code") @ExcludeMissing - totalRoomTaxCurrency: JsonField = JsonMissing.of(), - @JsonProperty("total_tax_amount") + travelAgencyCode: JsonField = JsonMissing.of(), + @JsonProperty("travel_agency_name") @ExcludeMissing - totalTaxAmount: JsonField = JsonMissing.of(), - @JsonProperty("total_tax_currency") + travelAgencyName: JsonField = JsonMissing.of(), + @JsonProperty("trip_legs") @ExcludeMissing - totalTaxCurrency: JsonField = JsonMissing.of(), + tripLegs: JsonField> = JsonMissing.of(), ) : this( - checkInDate, - dailyRoomRateAmount, - dailyRoomRateCurrency, - extraCharges, - folioCashAdvancesAmount, - folioCashAdvancesCurrency, - foodBeverageChargesAmount, - foodBeverageChargesCurrency, - noShowIndicator, - prepaidExpensesAmount, - prepaidExpensesCurrency, - roomNights, - totalRoomTaxAmount, - totalRoomTaxCurrency, - totalTaxAmount, - totalTaxCurrency, + ancillary, + computerizedReservationSystem, + creditReasonIndicator, + departureDate, + originationCityAirportCode, + passengerName, + restrictedTicketIndicator, + ticketChangeIndicator, + ticketNumber, + travelAgencyCode, + travelAgencyName, + tripLegs, mutableMapOf(), ) /** - * Date the customer checked in. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun checkInDate(): Optional = - checkInDate.getOptional("check_in_date") - - /** - * Daily rate being charged for the room. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun dailyRoomRateAmount(): Optional = - dailyRoomRateAmount.getOptional("daily_room_rate_amount") - - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily - * room rate. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun dailyRoomRateCurrency(): Optional = - dailyRoomRateCurrency.getOptional("daily_room_rate_currency") - - /** - * Additional charges (phone, late check-out, etc.) being billed. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun extraCharges(): Optional = - extraCharges.getOptional("extra_charges") - - /** - * Folio cash advances for the room. + * Ancillary purchases in addition to the airfare. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun folioCashAdvancesAmount(): Optional = - folioCashAdvancesAmount.getOptional("folio_cash_advances_amount") + fun ancillary(): Optional = ancillary.getOptional("ancillary") /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the folio - * cash advances. + * Indicates the computerized reservation system used to book the ticket. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun folioCashAdvancesCurrency(): Optional = - folioCashAdvancesCurrency.getOptional("folio_cash_advances_currency") + fun computerizedReservationSystem(): Optional = + computerizedReservationSystem.getOptional("computerized_reservation_system") /** - * Food and beverage charges for the room. + * Indicates the reason for a credit to the cardholder. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun foodBeverageChargesAmount(): Optional = - foodBeverageChargesAmount.getOptional("food_beverage_charges_amount") + fun creditReasonIndicator(): Optional = + creditReasonIndicator.getOptional("credit_reason_indicator") /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the food and - * beverage charges. + * Date of departure. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun foodBeverageChargesCurrency(): Optional = - foodBeverageChargesCurrency.getOptional("food_beverage_charges_currency") + fun departureDate(): Optional = + departureDate.getOptional("departure_date") /** - * Indicator that the cardholder is being billed for a reserved room that was - * not actually used. + * Code for the originating city or airport. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun noShowIndicator(): Optional = - noShowIndicator.getOptional("no_show_indicator") + fun originationCityAirportCode(): Optional = + originationCityAirportCode.getOptional("origination_city_airport_code") /** - * Prepaid expenses being charged for the room. + * Name of the passenger. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun prepaidExpensesAmount(): Optional = - prepaidExpensesAmount.getOptional("prepaid_expenses_amount") + fun passengerName(): Optional = + passengerName.getOptional("passenger_name") /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the prepaid - * expenses. + * Indicates whether this ticket is non-refundable. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun prepaidExpensesCurrency(): Optional = - prepaidExpensesCurrency.getOptional("prepaid_expenses_currency") + fun restrictedTicketIndicator(): Optional = + restrictedTicketIndicator.getOptional("restricted_ticket_indicator") /** - * Number of nights the room was rented. + * Indicates why a ticket was changed. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun roomNights(): Optional = roomNights.getOptional("room_nights") + fun ticketChangeIndicator(): Optional = + ticketChangeIndicator.getOptional("ticket_change_indicator") /** - * Total room tax being charged. + * Ticket number. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun totalRoomTaxAmount(): Optional = - totalRoomTaxAmount.getOptional("total_room_tax_amount") + fun ticketNumber(): Optional = ticketNumber.getOptional("ticket_number") /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total - * room tax. + * Code for the travel agency if the ticket was issued by a travel agency. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun totalRoomTaxCurrency(): Optional = - totalRoomTaxCurrency.getOptional("total_room_tax_currency") + fun travelAgencyCode(): Optional = + travelAgencyCode.getOptional("travel_agency_code") /** - * Total tax being charged for the room. + * Name of the travel agency if the ticket was issued by a travel agency. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun totalTaxAmount(): Optional = - totalTaxAmount.getOptional("total_tax_amount") + fun travelAgencyName(): Optional = + travelAgencyName.getOptional("travel_agency_name") /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total tax - * assessed. + * Fields specific to each leg of the journey. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun totalTaxCurrency(): Optional = - totalTaxCurrency.getOptional("total_tax_currency") + fun tripLegs(): Optional> = tripLegs.getOptional("trip_legs") /** - * Returns the raw JSON value of [checkInDate]. + * Returns the raw JSON value of [ancillary]. * - * Unlike [checkInDate], this method doesn't throw if the JSON field has an + * Unlike [ancillary], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("check_in_date") + @JsonProperty("ancillary") @ExcludeMissing - fun _checkInDate(): JsonField = checkInDate + fun _ancillary(): JsonField = ancillary /** - * Returns the raw JSON value of [dailyRoomRateAmount]. + * Returns the raw JSON value of [computerizedReservationSystem]. * - * Unlike [dailyRoomRateAmount], this method doesn't throw if the JSON field has - * an unexpected type. + * Unlike [computerizedReservationSystem], this method doesn't throw if the JSON + * field has an unexpected type. */ - @JsonProperty("daily_room_rate_amount") + @JsonProperty("computerized_reservation_system") @ExcludeMissing - fun _dailyRoomRateAmount(): JsonField = dailyRoomRateAmount + fun _computerizedReservationSystem(): JsonField = + computerizedReservationSystem /** - * Returns the raw JSON value of [dailyRoomRateCurrency]. + * Returns the raw JSON value of [creditReasonIndicator]. * - * Unlike [dailyRoomRateCurrency], this method doesn't throw if the JSON field + * Unlike [creditReasonIndicator], this method doesn't throw if the JSON field * has an unexpected type. */ - @JsonProperty("daily_room_rate_currency") + @JsonProperty("credit_reason_indicator") @ExcludeMissing - fun _dailyRoomRateCurrency(): JsonField = dailyRoomRateCurrency + fun _creditReasonIndicator(): JsonField = + creditReasonIndicator /** - * Returns the raw JSON value of [extraCharges]. + * Returns the raw JSON value of [departureDate]. * - * Unlike [extraCharges], this method doesn't throw if the JSON field has an + * Unlike [departureDate], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("extra_charges") - @ExcludeMissing - fun _extraCharges(): JsonField = extraCharges - - /** - * Returns the raw JSON value of [folioCashAdvancesAmount]. - * - * Unlike [folioCashAdvancesAmount], this method doesn't throw if the JSON field - * has an unexpected type. - */ - @JsonProperty("folio_cash_advances_amount") - @ExcludeMissing - fun _folioCashAdvancesAmount(): JsonField = folioCashAdvancesAmount - - /** - * Returns the raw JSON value of [folioCashAdvancesCurrency]. - * - * Unlike [folioCashAdvancesCurrency], this method doesn't throw if the JSON - * field has an unexpected type. - */ - @JsonProperty("folio_cash_advances_currency") - @ExcludeMissing - fun _folioCashAdvancesCurrency(): JsonField = folioCashAdvancesCurrency - - /** - * Returns the raw JSON value of [foodBeverageChargesAmount]. - * - * Unlike [foodBeverageChargesAmount], this method doesn't throw if the JSON - * field has an unexpected type. - */ - @JsonProperty("food_beverage_charges_amount") + @JsonProperty("departure_date") @ExcludeMissing - fun _foodBeverageChargesAmount(): JsonField = foodBeverageChargesAmount + fun _departureDate(): JsonField = departureDate /** - * Returns the raw JSON value of [foodBeverageChargesCurrency]. + * Returns the raw JSON value of [originationCityAirportCode]. * - * Unlike [foodBeverageChargesCurrency], this method doesn't throw if the JSON + * Unlike [originationCityAirportCode], this method doesn't throw if the JSON * field has an unexpected type. */ - @JsonProperty("food_beverage_charges_currency") + @JsonProperty("origination_city_airport_code") @ExcludeMissing - fun _foodBeverageChargesCurrency(): JsonField = - foodBeverageChargesCurrency + fun _originationCityAirportCode(): JsonField = + originationCityAirportCode /** - * Returns the raw JSON value of [noShowIndicator]. + * Returns the raw JSON value of [passengerName]. * - * Unlike [noShowIndicator], this method doesn't throw if the JSON field has an + * Unlike [passengerName], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("no_show_indicator") + @JsonProperty("passenger_name") @ExcludeMissing - fun _noShowIndicator(): JsonField = noShowIndicator + fun _passengerName(): JsonField = passengerName /** - * Returns the raw JSON value of [prepaidExpensesAmount]. + * Returns the raw JSON value of [restrictedTicketIndicator]. * - * Unlike [prepaidExpensesAmount], this method doesn't throw if the JSON field - * has an unexpected type. + * Unlike [restrictedTicketIndicator], this method doesn't throw if the JSON + * field has an unexpected type. */ - @JsonProperty("prepaid_expenses_amount") + @JsonProperty("restricted_ticket_indicator") @ExcludeMissing - fun _prepaidExpensesAmount(): JsonField = prepaidExpensesAmount + fun _restrictedTicketIndicator(): JsonField = + restrictedTicketIndicator /** - * Returns the raw JSON value of [prepaidExpensesCurrency]. + * Returns the raw JSON value of [ticketChangeIndicator]. * - * Unlike [prepaidExpensesCurrency], this method doesn't throw if the JSON field + * Unlike [ticketChangeIndicator], this method doesn't throw if the JSON field * has an unexpected type. */ - @JsonProperty("prepaid_expenses_currency") + @JsonProperty("ticket_change_indicator") @ExcludeMissing - fun _prepaidExpensesCurrency(): JsonField = prepaidExpensesCurrency + fun _ticketChangeIndicator(): JsonField = + ticketChangeIndicator /** - * Returns the raw JSON value of [roomNights]. + * Returns the raw JSON value of [ticketNumber]. * - * Unlike [roomNights], this method doesn't throw if the JSON field has an + * Unlike [ticketNumber], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("room_nights") - @ExcludeMissing - fun _roomNights(): JsonField = roomNights - - /** - * Returns the raw JSON value of [totalRoomTaxAmount]. - * - * Unlike [totalRoomTaxAmount], this method doesn't throw if the JSON field has - * an unexpected type. - */ - @JsonProperty("total_room_tax_amount") + @JsonProperty("ticket_number") @ExcludeMissing - fun _totalRoomTaxAmount(): JsonField = totalRoomTaxAmount + fun _ticketNumber(): JsonField = ticketNumber /** - * Returns the raw JSON value of [totalRoomTaxCurrency]. + * Returns the raw JSON value of [travelAgencyCode]. * - * Unlike [totalRoomTaxCurrency], this method doesn't throw if the JSON field - * has an unexpected type. + * Unlike [travelAgencyCode], this method doesn't throw if the JSON field has an + * unexpected type. */ - @JsonProperty("total_room_tax_currency") + @JsonProperty("travel_agency_code") @ExcludeMissing - fun _totalRoomTaxCurrency(): JsonField = totalRoomTaxCurrency + fun _travelAgencyCode(): JsonField = travelAgencyCode /** - * Returns the raw JSON value of [totalTaxAmount]. + * Returns the raw JSON value of [travelAgencyName]. * - * Unlike [totalTaxAmount], this method doesn't throw if the JSON field has an + * Unlike [travelAgencyName], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("total_tax_amount") + @JsonProperty("travel_agency_name") @ExcludeMissing - fun _totalTaxAmount(): JsonField = totalTaxAmount + fun _travelAgencyName(): JsonField = travelAgencyName /** - * Returns the raw JSON value of [totalTaxCurrency]. + * Returns the raw JSON value of [tripLegs]. * - * Unlike [totalTaxCurrency], this method doesn't throw if the JSON field has an + * Unlike [tripLegs], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("total_tax_currency") + @JsonProperty("trip_legs") @ExcludeMissing - fun _totalTaxCurrency(): JsonField = totalTaxCurrency + fun _tripLegs(): JsonField> = tripLegs @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -56771,509 +66547,355 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [Lodging]. + * Returns a mutable builder for constructing an instance of [Travel]. * * The following fields are required: * ```java - * .checkInDate() - * .dailyRoomRateAmount() - * .dailyRoomRateCurrency() - * .extraCharges() - * .folioCashAdvancesAmount() - * .folioCashAdvancesCurrency() - * .foodBeverageChargesAmount() - * .foodBeverageChargesCurrency() - * .noShowIndicator() - * .prepaidExpensesAmount() - * .prepaidExpensesCurrency() - * .roomNights() - * .totalRoomTaxAmount() - * .totalRoomTaxCurrency() - * .totalTaxAmount() - * .totalTaxCurrency() + * .ancillary() + * .computerizedReservationSystem() + * .creditReasonIndicator() + * .departureDate() + * .originationCityAirportCode() + * .passengerName() + * .restrictedTicketIndicator() + * .ticketChangeIndicator() + * .ticketNumber() + * .travelAgencyCode() + * .travelAgencyName() + * .tripLegs() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [Lodging]. */ + /** A builder for [Travel]. */ class Builder internal constructor() { - private var checkInDate: JsonField? = null - private var dailyRoomRateAmount: JsonField? = null - private var dailyRoomRateCurrency: JsonField? = null - private var extraCharges: JsonField? = null - private var folioCashAdvancesAmount: JsonField? = null - private var folioCashAdvancesCurrency: JsonField? = null - private var foodBeverageChargesAmount: JsonField? = null - private var foodBeverageChargesCurrency: JsonField? = null - private var noShowIndicator: JsonField? = null - private var prepaidExpensesAmount: JsonField? = null - private var prepaidExpensesCurrency: JsonField? = null - private var roomNights: JsonField? = null - private var totalRoomTaxAmount: JsonField? = null - private var totalRoomTaxCurrency: JsonField? = null - private var totalTaxAmount: JsonField? = null - private var totalTaxCurrency: JsonField? = null + private var ancillary: JsonField? = null + private var computerizedReservationSystem: JsonField? = null + private var creditReasonIndicator: JsonField? = null + private var departureDate: JsonField? = null + private var originationCityAirportCode: JsonField? = null + private var passengerName: JsonField? = null + private var restrictedTicketIndicator: + JsonField? = + null + private var ticketChangeIndicator: JsonField? = null + private var ticketNumber: JsonField? = null + private var travelAgencyCode: JsonField? = null + private var travelAgencyName: JsonField? = null + private var tripLegs: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(lodging: Lodging) = apply { - checkInDate = lodging.checkInDate - dailyRoomRateAmount = lodging.dailyRoomRateAmount - dailyRoomRateCurrency = lodging.dailyRoomRateCurrency - extraCharges = lodging.extraCharges - folioCashAdvancesAmount = lodging.folioCashAdvancesAmount - folioCashAdvancesCurrency = lodging.folioCashAdvancesCurrency - foodBeverageChargesAmount = lodging.foodBeverageChargesAmount - foodBeverageChargesCurrency = lodging.foodBeverageChargesCurrency - noShowIndicator = lodging.noShowIndicator - prepaidExpensesAmount = lodging.prepaidExpensesAmount - prepaidExpensesCurrency = lodging.prepaidExpensesCurrency - roomNights = lodging.roomNights - totalRoomTaxAmount = lodging.totalRoomTaxAmount - totalRoomTaxCurrency = lodging.totalRoomTaxCurrency - totalTaxAmount = lodging.totalTaxAmount - totalTaxCurrency = lodging.totalTaxCurrency - additionalProperties = lodging.additionalProperties.toMutableMap() - } - - /** Date the customer checked in. */ - fun checkInDate(checkInDate: LocalDate?) = - checkInDate(JsonField.ofNullable(checkInDate)) - - /** - * Alias for calling [Builder.checkInDate] with `checkInDate.orElse(null)`. - */ - fun checkInDate(checkInDate: Optional) = - checkInDate(checkInDate.getOrNull()) - - /** - * Sets [Builder.checkInDate] to an arbitrary JSON value. - * - * You should usually call [Builder.checkInDate] with a well-typed - * [LocalDate] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. - */ - fun checkInDate(checkInDate: JsonField) = apply { - this.checkInDate = checkInDate - } - - /** Daily rate being charged for the room. */ - fun dailyRoomRateAmount(dailyRoomRateAmount: Long?) = - dailyRoomRateAmount(JsonField.ofNullable(dailyRoomRateAmount)) - - /** - * Alias for [Builder.dailyRoomRateAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun dailyRoomRateAmount(dailyRoomRateAmount: Long) = - dailyRoomRateAmount(dailyRoomRateAmount as Long?) - - /** - * Alias for calling [Builder.dailyRoomRateAmount] with - * `dailyRoomRateAmount.orElse(null)`. - */ - fun dailyRoomRateAmount(dailyRoomRateAmount: Optional) = - dailyRoomRateAmount(dailyRoomRateAmount.getOrNull()) - - /** - * Sets [Builder.dailyRoomRateAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.dailyRoomRateAmount] with a well-typed - * [Long] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun dailyRoomRateAmount(dailyRoomRateAmount: JsonField) = apply { - this.dailyRoomRateAmount = dailyRoomRateAmount - } - - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily - * room rate. - */ - fun dailyRoomRateCurrency(dailyRoomRateCurrency: String?) = - dailyRoomRateCurrency(JsonField.ofNullable(dailyRoomRateCurrency)) - - /** - * Alias for calling [Builder.dailyRoomRateCurrency] with - * `dailyRoomRateCurrency.orElse(null)`. - */ - fun dailyRoomRateCurrency(dailyRoomRateCurrency: Optional) = - dailyRoomRateCurrency(dailyRoomRateCurrency.getOrNull()) - - /** - * Sets [Builder.dailyRoomRateCurrency] to an arbitrary JSON value. - * - * You should usually call [Builder.dailyRoomRateCurrency] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun dailyRoomRateCurrency(dailyRoomRateCurrency: JsonField) = - apply { - this.dailyRoomRateCurrency = dailyRoomRateCurrency - } + internal fun from(travel: Travel) = apply { + ancillary = travel.ancillary + computerizedReservationSystem = travel.computerizedReservationSystem + creditReasonIndicator = travel.creditReasonIndicator + departureDate = travel.departureDate + originationCityAirportCode = travel.originationCityAirportCode + passengerName = travel.passengerName + restrictedTicketIndicator = travel.restrictedTicketIndicator + ticketChangeIndicator = travel.ticketChangeIndicator + ticketNumber = travel.ticketNumber + travelAgencyCode = travel.travelAgencyCode + travelAgencyName = travel.travelAgencyName + tripLegs = travel.tripLegs.map { it.toMutableList() } + additionalProperties = travel.additionalProperties.toMutableMap() + } - /** Additional charges (phone, late check-out, etc.) being billed. */ - fun extraCharges(extraCharges: ExtraCharges?) = - extraCharges(JsonField.ofNullable(extraCharges)) + /** Ancillary purchases in addition to the airfare. */ + fun ancillary(ancillary: Ancillary?) = + ancillary(JsonField.ofNullable(ancillary)) - /** - * Alias for calling [Builder.extraCharges] with - * `extraCharges.orElse(null)`. - */ - fun extraCharges(extraCharges: Optional) = - extraCharges(extraCharges.getOrNull()) + /** Alias for calling [Builder.ancillary] with `ancillary.orElse(null)`. */ + fun ancillary(ancillary: Optional) = + ancillary(ancillary.getOrNull()) /** - * Sets [Builder.extraCharges] to an arbitrary JSON value. + * Sets [Builder.ancillary] to an arbitrary JSON value. * - * You should usually call [Builder.extraCharges] with a well-typed - * [ExtraCharges] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * You should usually call [Builder.ancillary] with a well-typed [Ancillary] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ - fun extraCharges(extraCharges: JsonField) = apply { - this.extraCharges = extraCharges + fun ancillary(ancillary: JsonField) = apply { + this.ancillary = ancillary } - /** Folio cash advances for the room. */ - fun folioCashAdvancesAmount(folioCashAdvancesAmount: Long?) = - folioCashAdvancesAmount(JsonField.ofNullable(folioCashAdvancesAmount)) - /** - * Alias for [Builder.folioCashAdvancesAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. + * Indicates the computerized reservation system used to book the ticket. */ - fun folioCashAdvancesAmount(folioCashAdvancesAmount: Long) = - folioCashAdvancesAmount(folioCashAdvancesAmount as Long?) + fun computerizedReservationSystem(computerizedReservationSystem: String?) = + computerizedReservationSystem( + JsonField.ofNullable(computerizedReservationSystem) + ) /** - * Alias for calling [Builder.folioCashAdvancesAmount] with - * `folioCashAdvancesAmount.orElse(null)`. + * Alias for calling [Builder.computerizedReservationSystem] with + * `computerizedReservationSystem.orElse(null)`. */ - fun folioCashAdvancesAmount(folioCashAdvancesAmount: Optional) = - folioCashAdvancesAmount(folioCashAdvancesAmount.getOrNull()) + fun computerizedReservationSystem( + computerizedReservationSystem: Optional + ) = computerizedReservationSystem(computerizedReservationSystem.getOrNull()) /** - * Sets [Builder.folioCashAdvancesAmount] to an arbitrary JSON value. + * Sets [Builder.computerizedReservationSystem] to an arbitrary JSON value. * - * You should usually call [Builder.folioCashAdvancesAmount] with a - * well-typed [Long] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * You should usually call [Builder.computerizedReservationSystem] with a + * well-typed [String] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. */ - fun folioCashAdvancesAmount(folioCashAdvancesAmount: JsonField) = - apply { - this.folioCashAdvancesAmount = folioCashAdvancesAmount - } + fun computerizedReservationSystem( + computerizedReservationSystem: JsonField + ) = apply { + this.computerizedReservationSystem = computerizedReservationSystem + } - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the folio - * cash advances. - */ - fun folioCashAdvancesCurrency(folioCashAdvancesCurrency: String?) = - folioCashAdvancesCurrency( - JsonField.ofNullable(folioCashAdvancesCurrency) - ) + /** Indicates the reason for a credit to the cardholder. */ + fun creditReasonIndicator(creditReasonIndicator: CreditReasonIndicator?) = + creditReasonIndicator(JsonField.ofNullable(creditReasonIndicator)) /** - * Alias for calling [Builder.folioCashAdvancesCurrency] with - * `folioCashAdvancesCurrency.orElse(null)`. + * Alias for calling [Builder.creditReasonIndicator] with + * `creditReasonIndicator.orElse(null)`. */ - fun folioCashAdvancesCurrency(folioCashAdvancesCurrency: Optional) = - folioCashAdvancesCurrency(folioCashAdvancesCurrency.getOrNull()) + fun creditReasonIndicator( + creditReasonIndicator: Optional + ) = creditReasonIndicator(creditReasonIndicator.getOrNull()) /** - * Sets [Builder.folioCashAdvancesCurrency] to an arbitrary JSON value. + * Sets [Builder.creditReasonIndicator] to an arbitrary JSON value. * - * You should usually call [Builder.folioCashAdvancesCurrency] with a - * well-typed [String] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. + * You should usually call [Builder.creditReasonIndicator] with a well-typed + * [CreditReasonIndicator] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. */ - fun folioCashAdvancesCurrency( - folioCashAdvancesCurrency: JsonField - ) = apply { this.folioCashAdvancesCurrency = folioCashAdvancesCurrency } - - /** Food and beverage charges for the room. */ - fun foodBeverageChargesAmount(foodBeverageChargesAmount: Long?) = - foodBeverageChargesAmount( - JsonField.ofNullable(foodBeverageChargesAmount) - ) + fun creditReasonIndicator( + creditReasonIndicator: JsonField + ) = apply { this.creditReasonIndicator = creditReasonIndicator } - /** - * Alias for [Builder.foodBeverageChargesAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun foodBeverageChargesAmount(foodBeverageChargesAmount: Long) = - foodBeverageChargesAmount(foodBeverageChargesAmount as Long?) + /** Date of departure. */ + fun departureDate(departureDate: LocalDate?) = + departureDate(JsonField.ofNullable(departureDate)) /** - * Alias for calling [Builder.foodBeverageChargesAmount] with - * `foodBeverageChargesAmount.orElse(null)`. + * Alias for calling [Builder.departureDate] with + * `departureDate.orElse(null)`. */ - fun foodBeverageChargesAmount(foodBeverageChargesAmount: Optional) = - foodBeverageChargesAmount(foodBeverageChargesAmount.getOrNull()) + fun departureDate(departureDate: Optional) = + departureDate(departureDate.getOrNull()) /** - * Sets [Builder.foodBeverageChargesAmount] to an arbitrary JSON value. + * Sets [Builder.departureDate] to an arbitrary JSON value. * - * You should usually call [Builder.foodBeverageChargesAmount] with a - * well-typed [Long] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * You should usually call [Builder.departureDate] with a well-typed + * [LocalDate] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. */ - fun foodBeverageChargesAmount(foodBeverageChargesAmount: JsonField) = - apply { - this.foodBeverageChargesAmount = foodBeverageChargesAmount - } + fun departureDate(departureDate: JsonField) = apply { + this.departureDate = departureDate + } - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the food - * and beverage charges. - */ - fun foodBeverageChargesCurrency(foodBeverageChargesCurrency: String?) = - foodBeverageChargesCurrency( - JsonField.ofNullable(foodBeverageChargesCurrency) + /** Code for the originating city or airport. */ + fun originationCityAirportCode(originationCityAirportCode: String?) = + originationCityAirportCode( + JsonField.ofNullable(originationCityAirportCode) ) /** - * Alias for calling [Builder.foodBeverageChargesCurrency] with - * `foodBeverageChargesCurrency.orElse(null)`. + * Alias for calling [Builder.originationCityAirportCode] with + * `originationCityAirportCode.orElse(null)`. */ - fun foodBeverageChargesCurrency( - foodBeverageChargesCurrency: Optional - ) = foodBeverageChargesCurrency(foodBeverageChargesCurrency.getOrNull()) + fun originationCityAirportCode( + originationCityAirportCode: Optional + ) = originationCityAirportCode(originationCityAirportCode.getOrNull()) /** - * Sets [Builder.foodBeverageChargesCurrency] to an arbitrary JSON value. + * Sets [Builder.originationCityAirportCode] to an arbitrary JSON value. * - * You should usually call [Builder.foodBeverageChargesCurrency] with a + * You should usually call [Builder.originationCityAirportCode] with a * well-typed [String] value instead. This method is primarily for setting * the field to an undocumented or not yet supported value. */ - fun foodBeverageChargesCurrency( - foodBeverageChargesCurrency: JsonField - ) = apply { this.foodBeverageChargesCurrency = foodBeverageChargesCurrency } + fun originationCityAirportCode( + originationCityAirportCode: JsonField + ) = apply { this.originationCityAirportCode = originationCityAirportCode } - /** - * Indicator that the cardholder is being billed for a reserved room that - * was not actually used. - */ - fun noShowIndicator(noShowIndicator: NoShowIndicator?) = - noShowIndicator(JsonField.ofNullable(noShowIndicator)) + /** Name of the passenger. */ + fun passengerName(passengerName: String?) = + passengerName(JsonField.ofNullable(passengerName)) /** - * Alias for calling [Builder.noShowIndicator] with - * `noShowIndicator.orElse(null)`. + * Alias for calling [Builder.passengerName] with + * `passengerName.orElse(null)`. */ - fun noShowIndicator(noShowIndicator: Optional) = - noShowIndicator(noShowIndicator.getOrNull()) + fun passengerName(passengerName: Optional) = + passengerName(passengerName.getOrNull()) /** - * Sets [Builder.noShowIndicator] to an arbitrary JSON value. + * Sets [Builder.passengerName] to an arbitrary JSON value. * - * You should usually call [Builder.noShowIndicator] with a well-typed - * [NoShowIndicator] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * You should usually call [Builder.passengerName] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. */ - fun noShowIndicator(noShowIndicator: JsonField) = apply { - this.noShowIndicator = noShowIndicator + fun passengerName(passengerName: JsonField) = apply { + this.passengerName = passengerName } - /** Prepaid expenses being charged for the room. */ - fun prepaidExpensesAmount(prepaidExpensesAmount: Long?) = - prepaidExpensesAmount(JsonField.ofNullable(prepaidExpensesAmount)) - - /** - * Alias for [Builder.prepaidExpensesAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun prepaidExpensesAmount(prepaidExpensesAmount: Long) = - prepaidExpensesAmount(prepaidExpensesAmount as Long?) + /** Indicates whether this ticket is non-refundable. */ + fun restrictedTicketIndicator( + restrictedTicketIndicator: RestrictedTicketIndicator? + ) = + restrictedTicketIndicator( + JsonField.ofNullable(restrictedTicketIndicator) + ) /** - * Alias for calling [Builder.prepaidExpensesAmount] with - * `prepaidExpensesAmount.orElse(null)`. + * Alias for calling [Builder.restrictedTicketIndicator] with + * `restrictedTicketIndicator.orElse(null)`. */ - fun prepaidExpensesAmount(prepaidExpensesAmount: Optional) = - prepaidExpensesAmount(prepaidExpensesAmount.getOrNull()) + fun restrictedTicketIndicator( + restrictedTicketIndicator: Optional + ) = restrictedTicketIndicator(restrictedTicketIndicator.getOrNull()) /** - * Sets [Builder.prepaidExpensesAmount] to an arbitrary JSON value. + * Sets [Builder.restrictedTicketIndicator] to an arbitrary JSON value. * - * You should usually call [Builder.prepaidExpensesAmount] with a well-typed - * [Long] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * You should usually call [Builder.restrictedTicketIndicator] with a + * well-typed [RestrictedTicketIndicator] value instead. This method is + * primarily for setting the field to an undocumented or not yet supported + * value. */ - fun prepaidExpensesAmount(prepaidExpensesAmount: JsonField) = apply { - this.prepaidExpensesAmount = prepaidExpensesAmount - } + fun restrictedTicketIndicator( + restrictedTicketIndicator: JsonField + ) = apply { this.restrictedTicketIndicator = restrictedTicketIndicator } - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - * prepaid expenses. - */ - fun prepaidExpensesCurrency(prepaidExpensesCurrency: String?) = - prepaidExpensesCurrency(JsonField.ofNullable(prepaidExpensesCurrency)) + /** Indicates why a ticket was changed. */ + fun ticketChangeIndicator(ticketChangeIndicator: TicketChangeIndicator?) = + ticketChangeIndicator(JsonField.ofNullable(ticketChangeIndicator)) /** - * Alias for calling [Builder.prepaidExpensesCurrency] with - * `prepaidExpensesCurrency.orElse(null)`. + * Alias for calling [Builder.ticketChangeIndicator] with + * `ticketChangeIndicator.orElse(null)`. */ - fun prepaidExpensesCurrency(prepaidExpensesCurrency: Optional) = - prepaidExpensesCurrency(prepaidExpensesCurrency.getOrNull()) + fun ticketChangeIndicator( + ticketChangeIndicator: Optional + ) = ticketChangeIndicator(ticketChangeIndicator.getOrNull()) /** - * Sets [Builder.prepaidExpensesCurrency] to an arbitrary JSON value. + * Sets [Builder.ticketChangeIndicator] to an arbitrary JSON value. * - * You should usually call [Builder.prepaidExpensesCurrency] with a - * well-typed [String] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. + * You should usually call [Builder.ticketChangeIndicator] with a well-typed + * [TicketChangeIndicator] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. */ - fun prepaidExpensesCurrency(prepaidExpensesCurrency: JsonField) = - apply { - this.prepaidExpensesCurrency = prepaidExpensesCurrency - } - - /** Number of nights the room was rented. */ - fun roomNights(roomNights: Long?) = - roomNights(JsonField.ofNullable(roomNights)) + fun ticketChangeIndicator( + ticketChangeIndicator: JsonField + ) = apply { this.ticketChangeIndicator = ticketChangeIndicator } - /** - * Alias for [Builder.roomNights]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun roomNights(roomNights: Long) = roomNights(roomNights as Long?) + /** Ticket number. */ + fun ticketNumber(ticketNumber: String?) = + ticketNumber(JsonField.ofNullable(ticketNumber)) /** - * Alias for calling [Builder.roomNights] with `roomNights.orElse(null)`. + * Alias for calling [Builder.ticketNumber] with + * `ticketNumber.orElse(null)`. */ - fun roomNights(roomNights: Optional) = - roomNights(roomNights.getOrNull()) + fun ticketNumber(ticketNumber: Optional) = + ticketNumber(ticketNumber.getOrNull()) /** - * Sets [Builder.roomNights] to an arbitrary JSON value. + * Sets [Builder.ticketNumber] to an arbitrary JSON value. * - * You should usually call [Builder.roomNights] with a well-typed [Long] + * You should usually call [Builder.ticketNumber] with a well-typed [String] * value instead. This method is primarily for setting the field to an * undocumented or not yet supported value. */ - fun roomNights(roomNights: JsonField) = apply { - this.roomNights = roomNights + fun ticketNumber(ticketNumber: JsonField) = apply { + this.ticketNumber = ticketNumber } - /** Total room tax being charged. */ - fun totalRoomTaxAmount(totalRoomTaxAmount: Long?) = - totalRoomTaxAmount(JsonField.ofNullable(totalRoomTaxAmount)) - /** - * Alias for [Builder.totalRoomTaxAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. + * Code for the travel agency if the ticket was issued by a travel agency. */ - fun totalRoomTaxAmount(totalRoomTaxAmount: Long) = - totalRoomTaxAmount(totalRoomTaxAmount as Long?) + fun travelAgencyCode(travelAgencyCode: String?) = + travelAgencyCode(JsonField.ofNullable(travelAgencyCode)) /** - * Alias for calling [Builder.totalRoomTaxAmount] with - * `totalRoomTaxAmount.orElse(null)`. + * Alias for calling [Builder.travelAgencyCode] with + * `travelAgencyCode.orElse(null)`. */ - fun totalRoomTaxAmount(totalRoomTaxAmount: Optional) = - totalRoomTaxAmount(totalRoomTaxAmount.getOrNull()) + fun travelAgencyCode(travelAgencyCode: Optional) = + travelAgencyCode(travelAgencyCode.getOrNull()) /** - * Sets [Builder.totalRoomTaxAmount] to an arbitrary JSON value. + * Sets [Builder.travelAgencyCode] to an arbitrary JSON value. * - * You should usually call [Builder.totalRoomTaxAmount] with a well-typed - * [Long] value instead. This method is primarily for setting the field to + * You should usually call [Builder.travelAgencyCode] with a well-typed + * [String] value instead. This method is primarily for setting the field to * an undocumented or not yet supported value. */ - fun totalRoomTaxAmount(totalRoomTaxAmount: JsonField) = apply { - this.totalRoomTaxAmount = totalRoomTaxAmount + fun travelAgencyCode(travelAgencyCode: JsonField) = apply { + this.travelAgencyCode = travelAgencyCode } /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total - * room tax. + * Name of the travel agency if the ticket was issued by a travel agency. */ - fun totalRoomTaxCurrency(totalRoomTaxCurrency: String?) = - totalRoomTaxCurrency(JsonField.ofNullable(totalRoomTaxCurrency)) + fun travelAgencyName(travelAgencyName: String?) = + travelAgencyName(JsonField.ofNullable(travelAgencyName)) /** - * Alias for calling [Builder.totalRoomTaxCurrency] with - * `totalRoomTaxCurrency.orElse(null)`. + * Alias for calling [Builder.travelAgencyName] with + * `travelAgencyName.orElse(null)`. */ - fun totalRoomTaxCurrency(totalRoomTaxCurrency: Optional) = - totalRoomTaxCurrency(totalRoomTaxCurrency.getOrNull()) + fun travelAgencyName(travelAgencyName: Optional) = + travelAgencyName(travelAgencyName.getOrNull()) /** - * Sets [Builder.totalRoomTaxCurrency] to an arbitrary JSON value. + * Sets [Builder.travelAgencyName] to an arbitrary JSON value. * - * You should usually call [Builder.totalRoomTaxCurrency] with a well-typed + * You should usually call [Builder.travelAgencyName] with a well-typed * [String] value instead. This method is primarily for setting the field to * an undocumented or not yet supported value. */ - fun totalRoomTaxCurrency(totalRoomTaxCurrency: JsonField) = apply { - this.totalRoomTaxCurrency = totalRoomTaxCurrency + fun travelAgencyName(travelAgencyName: JsonField) = apply { + this.travelAgencyName = travelAgencyName } - /** Total tax being charged for the room. */ - fun totalTaxAmount(totalTaxAmount: Long?) = - totalTaxAmount(JsonField.ofNullable(totalTaxAmount)) - - /** - * Alias for [Builder.totalTaxAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun totalTaxAmount(totalTaxAmount: Long) = - totalTaxAmount(totalTaxAmount as Long?) + /** Fields specific to each leg of the journey. */ + fun tripLegs(tripLegs: List?) = + tripLegs(JsonField.ofNullable(tripLegs)) - /** - * Alias for calling [Builder.totalTaxAmount] with - * `totalTaxAmount.orElse(null)`. - */ - fun totalTaxAmount(totalTaxAmount: Optional) = - totalTaxAmount(totalTaxAmount.getOrNull()) + /** Alias for calling [Builder.tripLegs] with `tripLegs.orElse(null)`. */ + fun tripLegs(tripLegs: Optional>) = + tripLegs(tripLegs.getOrNull()) /** - * Sets [Builder.totalTaxAmount] to an arbitrary JSON value. + * Sets [Builder.tripLegs] to an arbitrary JSON value. * - * You should usually call [Builder.totalTaxAmount] with a well-typed [Long] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * You should usually call [Builder.tripLegs] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - fun totalTaxAmount(totalTaxAmount: JsonField) = apply { - this.totalTaxAmount = totalTaxAmount + fun tripLegs(tripLegs: JsonField>) = apply { + this.tripLegs = tripLegs.map { it.toMutableList() } } /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total - * tax assessed. - */ - fun totalTaxCurrency(totalTaxCurrency: String?) = - totalTaxCurrency(JsonField.ofNullable(totalTaxCurrency)) - - /** - * Alias for calling [Builder.totalTaxCurrency] with - * `totalTaxCurrency.orElse(null)`. - */ - fun totalTaxCurrency(totalTaxCurrency: Optional) = - totalTaxCurrency(totalTaxCurrency.getOrNull()) - - /** - * Sets [Builder.totalTaxCurrency] to an arbitrary JSON value. + * Adds a single [TripLeg] to [tripLegs]. * - * You should usually call [Builder.totalTaxCurrency] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * @throws IllegalStateException if the field was previously set to a + * non-list. */ - fun totalTaxCurrency(totalTaxCurrency: JsonField) = apply { - this.totalTaxCurrency = totalTaxCurrency + fun addTripLeg(tripLeg: TripLeg) = apply { + tripLegs = + (tripLegs ?: JsonField.of(mutableListOf())).also { + checkKnown("tripLegs", it).add(tripLeg) + } } fun additionalProperties(additionalProperties: Map) = @@ -57299,86 +66921,74 @@ private constructor( } /** - * Returns an immutable instance of [Lodging]. + * Returns an immutable instance of [Travel]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .checkInDate() - * .dailyRoomRateAmount() - * .dailyRoomRateCurrency() - * .extraCharges() - * .folioCashAdvancesAmount() - * .folioCashAdvancesCurrency() - * .foodBeverageChargesAmount() - * .foodBeverageChargesCurrency() - * .noShowIndicator() - * .prepaidExpensesAmount() - * .prepaidExpensesCurrency() - * .roomNights() - * .totalRoomTaxAmount() - * .totalRoomTaxCurrency() - * .totalTaxAmount() - * .totalTaxCurrency() + * .ancillary() + * .computerizedReservationSystem() + * .creditReasonIndicator() + * .departureDate() + * .originationCityAirportCode() + * .passengerName() + * .restrictedTicketIndicator() + * .ticketChangeIndicator() + * .ticketNumber() + * .travelAgencyCode() + * .travelAgencyName() + * .tripLegs() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): Lodging = - Lodging( - checkRequired("checkInDate", checkInDate), - checkRequired("dailyRoomRateAmount", dailyRoomRateAmount), - checkRequired("dailyRoomRateCurrency", dailyRoomRateCurrency), - checkRequired("extraCharges", extraCharges), - checkRequired("folioCashAdvancesAmount", folioCashAdvancesAmount), + fun build(): Travel = + Travel( + checkRequired("ancillary", ancillary), checkRequired( - "folioCashAdvancesCurrency", - folioCashAdvancesCurrency, + "computerizedReservationSystem", + computerizedReservationSystem, ), + checkRequired("creditReasonIndicator", creditReasonIndicator), + checkRequired("departureDate", departureDate), checkRequired( - "foodBeverageChargesAmount", - foodBeverageChargesAmount, + "originationCityAirportCode", + originationCityAirportCode, ), + checkRequired("passengerName", passengerName), checkRequired( - "foodBeverageChargesCurrency", - foodBeverageChargesCurrency, + "restrictedTicketIndicator", + restrictedTicketIndicator, ), - checkRequired("noShowIndicator", noShowIndicator), - checkRequired("prepaidExpensesAmount", prepaidExpensesAmount), - checkRequired("prepaidExpensesCurrency", prepaidExpensesCurrency), - checkRequired("roomNights", roomNights), - checkRequired("totalRoomTaxAmount", totalRoomTaxAmount), - checkRequired("totalRoomTaxCurrency", totalRoomTaxCurrency), - checkRequired("totalTaxAmount", totalTaxAmount), - checkRequired("totalTaxCurrency", totalTaxCurrency), + checkRequired("ticketChangeIndicator", ticketChangeIndicator), + checkRequired("ticketNumber", ticketNumber), + checkRequired("travelAgencyCode", travelAgencyCode), + checkRequired("travelAgencyName", travelAgencyName), + checkRequired("tripLegs", tripLegs).map { it.toImmutable() }, additionalProperties.toMutableMap(), ) } - - private var validated: Boolean = false - - fun validate(): Lodging = apply { - if (validated) { - return@apply - } - - checkInDate() - dailyRoomRateAmount() - dailyRoomRateCurrency() - extraCharges().ifPresent { it.validate() } - folioCashAdvancesAmount() - folioCashAdvancesCurrency() - foodBeverageChargesAmount() - foodBeverageChargesCurrency() - noShowIndicator().ifPresent { it.validate() } - prepaidExpensesAmount() - prepaidExpensesCurrency() - roomNights() - totalRoomTaxAmount() - totalRoomTaxCurrency() - totalTaxAmount() - totalTaxCurrency() + + private var validated: Boolean = false + + fun validate(): Travel = apply { + if (validated) { + return@apply + } + + ancillary().ifPresent { it.validate() } + computerizedReservationSystem() + creditReasonIndicator().ifPresent { it.validate() } + departureDate() + originationCityAirportCode() + passengerName() + restrictedTicketIndicator().ifPresent { it.validate() } + ticketChangeIndicator().ifPresent { it.validate() } + ticketNumber() + travelAgencyCode() + travelAgencyName() + tripLegs().ifPresent { it.forEach { it.validate() } } validated = true } @@ -57398,330 +67008,421 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (checkInDate.asKnown().isPresent) 1 else 0) + - (if (dailyRoomRateAmount.asKnown().isPresent) 1 else 0) + - (if (dailyRoomRateCurrency.asKnown().isPresent) 1 else 0) + - (extraCharges.asKnown().getOrNull()?.validity() ?: 0) + - (if (folioCashAdvancesAmount.asKnown().isPresent) 1 else 0) + - (if (folioCashAdvancesCurrency.asKnown().isPresent) 1 else 0) + - (if (foodBeverageChargesAmount.asKnown().isPresent) 1 else 0) + - (if (foodBeverageChargesCurrency.asKnown().isPresent) 1 else 0) + - (noShowIndicator.asKnown().getOrNull()?.validity() ?: 0) + - (if (prepaidExpensesAmount.asKnown().isPresent) 1 else 0) + - (if (prepaidExpensesCurrency.asKnown().isPresent) 1 else 0) + - (if (roomNights.asKnown().isPresent) 1 else 0) + - (if (totalRoomTaxAmount.asKnown().isPresent) 1 else 0) + - (if (totalRoomTaxCurrency.asKnown().isPresent) 1 else 0) + - (if (totalTaxAmount.asKnown().isPresent) 1 else 0) + - (if (totalTaxCurrency.asKnown().isPresent) 1 else 0) + (ancillary.asKnown().getOrNull()?.validity() ?: 0) + + (if (computerizedReservationSystem.asKnown().isPresent) 1 else 0) + + (creditReasonIndicator.asKnown().getOrNull()?.validity() ?: 0) + + (if (departureDate.asKnown().isPresent) 1 else 0) + + (if (originationCityAirportCode.asKnown().isPresent) 1 else 0) + + (if (passengerName.asKnown().isPresent) 1 else 0) + + (restrictedTicketIndicator.asKnown().getOrNull()?.validity() ?: 0) + + (ticketChangeIndicator.asKnown().getOrNull()?.validity() ?: 0) + + (if (ticketNumber.asKnown().isPresent) 1 else 0) + + (if (travelAgencyCode.asKnown().isPresent) 1 else 0) + + (if (travelAgencyName.asKnown().isPresent) 1 else 0) + + (tripLegs.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) - /** Additional charges (phone, late check-out, etc.) being billed. */ - class ExtraCharges - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** Ancillary purchases in addition to the airfare. */ + class Ancillary + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val connectedTicketDocumentNumber: JsonField, + private val creditReasonIndicator: JsonField, + private val passengerNameOrDescription: JsonField, + private val services: JsonField>, + private val ticketDocumentNumber: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("connected_ticket_document_number") + @ExcludeMissing + connectedTicketDocumentNumber: JsonField = JsonMissing.of(), + @JsonProperty("credit_reason_indicator") + @ExcludeMissing + creditReasonIndicator: JsonField = + JsonMissing.of(), + @JsonProperty("passenger_name_or_description") + @ExcludeMissing + passengerNameOrDescription: JsonField = JsonMissing.of(), + @JsonProperty("services") + @ExcludeMissing + services: JsonField> = JsonMissing.of(), + @JsonProperty("ticket_document_number") + @ExcludeMissing + ticketDocumentNumber: JsonField = JsonMissing.of(), + ) : this( + connectedTicketDocumentNumber, + creditReasonIndicator, + passengerNameOrDescription, + services, + ticketDocumentNumber, + mutableMapOf(), + ) /** - * Returns this class instance's raw value. + * If this purchase has a connection or relationship to another purchase, + * such as a baggage fee for a passenger transport ticket, this field should + * contain the ticket document number for the other purchase. * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - /** No extra charge */ - @JvmField val NO_EXTRA_CHARGE = of("no_extra_charge") - - /** Restaurant */ - @JvmField val RESTAURANT = of("restaurant") - - /** Gift shop */ - @JvmField val GIFT_SHOP = of("gift_shop") - - /** Mini bar */ - @JvmField val MINI_BAR = of("mini_bar") - - /** Telephone */ - @JvmField val TELEPHONE = of("telephone") - - /** Other */ - @JvmField val OTHER = of("other") + fun connectedTicketDocumentNumber(): Optional = + connectedTicketDocumentNumber.getOptional( + "connected_ticket_document_number" + ) - /** Laundry */ - @JvmField val LAUNDRY = of("laundry") + /** + * Indicates the reason for a credit to the cardholder. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun creditReasonIndicator(): Optional = + creditReasonIndicator.getOptional("credit_reason_indicator") - @JvmStatic fun of(value: String) = ExtraCharges(JsonField.of(value)) - } + /** + * Name of the passenger or description of the ancillary purchase. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun passengerNameOrDescription(): Optional = + passengerNameOrDescription.getOptional("passenger_name_or_description") - /** An enum containing [ExtraCharges]'s known values. */ - enum class Known { - /** No extra charge */ - NO_EXTRA_CHARGE, - /** Restaurant */ - RESTAURANT, - /** Gift shop */ - GIFT_SHOP, - /** Mini bar */ - MINI_BAR, - /** Telephone */ - TELEPHONE, - /** Other */ - OTHER, - /** Laundry */ - LAUNDRY, - } + /** + * Additional travel charges, such as baggage fees. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded + * with an unexpected value). + */ + fun services(): List = services.getRequired("services") /** - * An enum containing [ExtraCharges]'s known values, as well as an - * [_UNKNOWN] member. + * Ticket document number. * - * An instance of [ExtraCharges] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). */ - enum class Value { - /** No extra charge */ - NO_EXTRA_CHARGE, - /** Restaurant */ - RESTAURANT, - /** Gift shop */ - GIFT_SHOP, - /** Mini bar */ - MINI_BAR, - /** Telephone */ - TELEPHONE, - /** Other */ - OTHER, - /** Laundry */ - LAUNDRY, - /** - * An enum member indicating that [ExtraCharges] was instantiated with - * an unknown value. - */ - _UNKNOWN, - } + fun ticketDocumentNumber(): Optional = + ticketDocumentNumber.getOptional("ticket_document_number") /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * Returns the raw JSON value of [connectedTicketDocumentNumber]. * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. + * Unlike [connectedTicketDocumentNumber], this method doesn't throw if the + * JSON field has an unexpected type. */ - fun value(): Value = - when (this) { - NO_EXTRA_CHARGE -> Value.NO_EXTRA_CHARGE - RESTAURANT -> Value.RESTAURANT - GIFT_SHOP -> Value.GIFT_SHOP - MINI_BAR -> Value.MINI_BAR - TELEPHONE -> Value.TELEPHONE - OTHER -> Value.OTHER - LAUNDRY -> Value.LAUNDRY - else -> Value._UNKNOWN - } + @JsonProperty("connected_ticket_document_number") + @ExcludeMissing + fun _connectedTicketDocumentNumber(): JsonField = + connectedTicketDocumentNumber /** - * Returns an enum member corresponding to this class instance's value. + * Returns the raw JSON value of [creditReasonIndicator]. * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. + * Unlike [creditReasonIndicator], this method doesn't throw if the JSON + * field has an unexpected type. + */ + @JsonProperty("credit_reason_indicator") + @ExcludeMissing + fun _creditReasonIndicator(): JsonField = + creditReasonIndicator + + /** + * Returns the raw JSON value of [passengerNameOrDescription]. * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. + * Unlike [passengerNameOrDescription], this method doesn't throw if the + * JSON field has an unexpected type. */ - fun known(): Known = - when (this) { - NO_EXTRA_CHARGE -> Known.NO_EXTRA_CHARGE - RESTAURANT -> Known.RESTAURANT - GIFT_SHOP -> Known.GIFT_SHOP - MINI_BAR -> Known.MINI_BAR - TELEPHONE -> Known.TELEPHONE - OTHER -> Known.OTHER - LAUNDRY -> Known.LAUNDRY - else -> - throw IncreaseInvalidDataException( - "Unknown ExtraCharges: $value" - ) - } + @JsonProperty("passenger_name_or_description") + @ExcludeMissing + fun _passengerNameOrDescription(): JsonField = + passengerNameOrDescription /** - * Returns this class instance's primitive wire representation. + * Returns the raw JSON value of [services]. * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. + * Unlike [services], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("services") + @ExcludeMissing + fun _services(): JsonField> = services + + /** + * Returns the raw JSON value of [ticketDocumentNumber]. * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. + * Unlike [ticketDocumentNumber], this method doesn't throw if the JSON + * field has an unexpected type. */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + @JsonProperty("ticket_document_number") + @ExcludeMissing + fun _ticketDocumentNumber(): JsonField = ticketDocumentNumber - private var validated: Boolean = false + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - fun validate(): ExtraCharges = apply { - if (validated) { - return@apply - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - known() - validated = true + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [Ancillary]. + * + * The following fields are required: + * ```java + * .connectedTicketDocumentNumber() + * .creditReasonIndicator() + * .passengerNameOrDescription() + * .services() + * .ticketDocumentNumber() + * ``` + */ + @JvmStatic fun builder() = Builder() } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** A builder for [Ancillary]. */ + class Builder internal constructor() { - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + private var connectedTicketDocumentNumber: JsonField? = null + private var creditReasonIndicator: JsonField? = + null + private var passengerNameOrDescription: JsonField? = null + private var services: JsonField>? = null + private var ticketDocumentNumber: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + @JvmSynthetic + internal fun from(ancillary: Ancillary) = apply { + connectedTicketDocumentNumber = + ancillary.connectedTicketDocumentNumber + creditReasonIndicator = ancillary.creditReasonIndicator + passengerNameOrDescription = ancillary.passengerNameOrDescription + services = ancillary.services.map { it.toMutableList() } + ticketDocumentNumber = ancillary.ticketDocumentNumber + additionalProperties = ancillary.additionalProperties.toMutableMap() } - return other is ExtraCharges && value == other.value - } + /** + * If this purchase has a connection or relationship to another + * purchase, such as a baggage fee for a passenger transport ticket, + * this field should contain the ticket document number for the other + * purchase. + */ + fun connectedTicketDocumentNumber( + connectedTicketDocumentNumber: String? + ) = + connectedTicketDocumentNumber( + JsonField.ofNullable(connectedTicketDocumentNumber) + ) - override fun hashCode() = value.hashCode() + /** + * Alias for calling [Builder.connectedTicketDocumentNumber] with + * `connectedTicketDocumentNumber.orElse(null)`. + */ + fun connectedTicketDocumentNumber( + connectedTicketDocumentNumber: Optional + ) = + connectedTicketDocumentNumber( + connectedTicketDocumentNumber.getOrNull() + ) - override fun toString() = value.toString() - } + /** + * Sets [Builder.connectedTicketDocumentNumber] to an arbitrary JSON + * value. + * + * You should usually call [Builder.connectedTicketDocumentNumber] with + * a well-typed [String] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ + fun connectedTicketDocumentNumber( + connectedTicketDocumentNumber: JsonField + ) = apply { + this.connectedTicketDocumentNumber = connectedTicketDocumentNumber + } - /** - * Indicator that the cardholder is being billed for a reserved room that was - * not actually used. - */ - class NoShowIndicator - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** Indicates the reason for a credit to the cardholder. */ + fun creditReasonIndicator( + creditReasonIndicator: CreditReasonIndicator? + ) = creditReasonIndicator(JsonField.ofNullable(creditReasonIndicator)) - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + /** + * Alias for calling [Builder.creditReasonIndicator] with + * `creditReasonIndicator.orElse(null)`. + */ + fun creditReasonIndicator( + creditReasonIndicator: Optional + ) = creditReasonIndicator(creditReasonIndicator.getOrNull()) - companion object { + /** + * Sets [Builder.creditReasonIndicator] to an arbitrary JSON value. + * + * You should usually call [Builder.creditReasonIndicator] with a + * well-typed [CreditReasonIndicator] value instead. This method is + * primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun creditReasonIndicator( + creditReasonIndicator: JsonField + ) = apply { this.creditReasonIndicator = creditReasonIndicator } - /** Not applicable */ - @JvmField val NOT_APPLICABLE = of("not_applicable") + /** Name of the passenger or description of the ancillary purchase. */ + fun passengerNameOrDescription(passengerNameOrDescription: String?) = + passengerNameOrDescription( + JsonField.ofNullable(passengerNameOrDescription) + ) - /** No show */ - @JvmField val NO_SHOW = of("no_show") + /** + * Alias for calling [Builder.passengerNameOrDescription] with + * `passengerNameOrDescription.orElse(null)`. + */ + fun passengerNameOrDescription( + passengerNameOrDescription: Optional + ) = passengerNameOrDescription(passengerNameOrDescription.getOrNull()) - @JvmStatic fun of(value: String) = NoShowIndicator(JsonField.of(value)) - } + /** + * Sets [Builder.passengerNameOrDescription] to an arbitrary JSON value. + * + * You should usually call [Builder.passengerNameOrDescription] with a + * well-typed [String] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ + fun passengerNameOrDescription( + passengerNameOrDescription: JsonField + ) = apply { + this.passengerNameOrDescription = passengerNameOrDescription + } - /** An enum containing [NoShowIndicator]'s known values. */ - enum class Known { - /** Not applicable */ - NOT_APPLICABLE, - /** No show */ - NO_SHOW, - } + /** Additional travel charges, such as baggage fees. */ + fun services(services: List) = services(JsonField.of(services)) + + /** + * Sets [Builder.services] to an arbitrary JSON value. + * + * You should usually call [Builder.services] with a well-typed + * `List` value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ + fun services(services: JsonField>) = apply { + this.services = services.map { it.toMutableList() } + } + + /** + * Adds a single [Service] to [services]. + * + * @throws IllegalStateException if the field was previously set to a + * non-list. + */ + fun addService(service: Service) = apply { + services = + (services ?: JsonField.of(mutableListOf())).also { + checkKnown("services", it).add(service) + } + } + + /** Ticket document number. */ + fun ticketDocumentNumber(ticketDocumentNumber: String?) = + ticketDocumentNumber(JsonField.ofNullable(ticketDocumentNumber)) - /** - * An enum containing [NoShowIndicator]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [NoShowIndicator] can contain an unknown value in a couple - * of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** Not applicable */ - NOT_APPLICABLE, - /** No show */ - NO_SHOW, /** - * An enum member indicating that [NoShowIndicator] was instantiated - * with an unknown value. + * Alias for calling [Builder.ticketDocumentNumber] with + * `ticketDocumentNumber.orElse(null)`. */ - _UNKNOWN, - } + fun ticketDocumentNumber(ticketDocumentNumber: Optional) = + ticketDocumentNumber(ticketDocumentNumber.getOrNull()) - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - NOT_APPLICABLE -> Value.NOT_APPLICABLE - NO_SHOW -> Value.NO_SHOW - else -> Value._UNKNOWN + /** + * Sets [Builder.ticketDocumentNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.ticketDocumentNumber] with a + * well-typed [String] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ + fun ticketDocumentNumber(ticketDocumentNumber: JsonField) = + apply { + this.ticketDocumentNumber = ticketDocumentNumber + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - NOT_APPLICABLE -> Known.NOT_APPLICABLE - NO_SHOW -> Known.NO_SHOW - else -> - throw IncreaseInvalidDataException( - "Unknown NoShowIndicator: $value" - ) + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Ancillary]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + * + * The following fields are required: + * ```java + * .connectedTicketDocumentNumber() + * .creditReasonIndicator() + * .passengerNameOrDescription() + * .services() + * .ticketDocumentNumber() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Ancillary = + Ancillary( + checkRequired( + "connectedTicketDocumentNumber", + connectedTicketDocumentNumber, + ), + checkRequired("creditReasonIndicator", creditReasonIndicator), + checkRequired( + "passengerNameOrDescription", + passengerNameOrDescription, + ), + checkRequired("services", services).map { it.toImmutable() }, + checkRequired("ticketDocumentNumber", ticketDocumentNumber), + additionalProperties.toMutableMap(), + ) + } + private var validated: Boolean = false - fun validate(): NoShowIndicator = apply { + fun validate(): Ancillary = apply { if (validated) { return@apply } - known() + connectedTicketDocumentNumber() + creditReasonIndicator().ifPresent { it.validate() } + passengerNameOrDescription() + services().forEach { it.validate() } + ticketDocumentNumber() validated = true } @@ -57740,1443 +67441,1152 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is NoShowIndicator && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Lodging && - checkInDate == other.checkInDate && - dailyRoomRateAmount == other.dailyRoomRateAmount && - dailyRoomRateCurrency == other.dailyRoomRateCurrency && - extraCharges == other.extraCharges && - folioCashAdvancesAmount == other.folioCashAdvancesAmount && - folioCashAdvancesCurrency == other.folioCashAdvancesCurrency && - foodBeverageChargesAmount == other.foodBeverageChargesAmount && - foodBeverageChargesCurrency == other.foodBeverageChargesCurrency && - noShowIndicator == other.noShowIndicator && - prepaidExpensesAmount == other.prepaidExpensesAmount && - prepaidExpensesCurrency == other.prepaidExpensesCurrency && - roomNights == other.roomNights && - totalRoomTaxAmount == other.totalRoomTaxAmount && - totalRoomTaxCurrency == other.totalRoomTaxCurrency && - totalTaxAmount == other.totalTaxAmount && - totalTaxCurrency == other.totalTaxCurrency && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - checkInDate, - dailyRoomRateAmount, - dailyRoomRateCurrency, - extraCharges, - folioCashAdvancesAmount, - folioCashAdvancesCurrency, - foodBeverageChargesAmount, - foodBeverageChargesCurrency, - noShowIndicator, - prepaidExpensesAmount, - prepaidExpensesCurrency, - roomNights, - totalRoomTaxAmount, - totalRoomTaxCurrency, - totalTaxAmount, - totalTaxCurrency, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode + internal fun validity(): Int = + (if (connectedTicketDocumentNumber.asKnown().isPresent) 1 else 0) + + (creditReasonIndicator.asKnown().getOrNull()?.validity() ?: 0) + + (if (passengerNameOrDescription.asKnown().isPresent) 1 else 0) + + (services.asKnown().getOrNull()?.sumOf { it.validity().toInt() } + ?: 0) + + (if (ticketDocumentNumber.asKnown().isPresent) 1 else 0) - override fun toString() = - "Lodging{checkInDate=$checkInDate, dailyRoomRateAmount=$dailyRoomRateAmount, dailyRoomRateCurrency=$dailyRoomRateCurrency, extraCharges=$extraCharges, folioCashAdvancesAmount=$folioCashAdvancesAmount, folioCashAdvancesCurrency=$folioCashAdvancesCurrency, foodBeverageChargesAmount=$foodBeverageChargesAmount, foodBeverageChargesCurrency=$foodBeverageChargesCurrency, noShowIndicator=$noShowIndicator, prepaidExpensesAmount=$prepaidExpensesAmount, prepaidExpensesCurrency=$prepaidExpensesCurrency, roomNights=$roomNights, totalRoomTaxAmount=$totalRoomTaxAmount, totalRoomTaxCurrency=$totalRoomTaxCurrency, totalTaxAmount=$totalTaxAmount, totalTaxCurrency=$totalTaxCurrency, additionalProperties=$additionalProperties}" - } + /** Indicates the reason for a credit to the cardholder. */ + class CreditReasonIndicator + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** The format of the purchase identifier. */ - class PurchaseIdentifierFormat - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from + * data that doesn't match any known member, and you want to know that + * value. For example, if the SDK is on an older version than the API, + * then the API may respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + companion object { - companion object { + /** No credit */ + @JvmField val NO_CREDIT = of("no_credit") - /** Free text */ - @JvmField val FREE_TEXT = of("free_text") + /** Passenger transport ancillary purchase cancellation */ + @JvmField + val PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = + of("passenger_transport_ancillary_purchase_cancellation") - /** Order number */ - @JvmField val ORDER_NUMBER = of("order_number") + /** + * Airline ticket and passenger transport ancillary purchase + * cancellation + */ + @JvmField + val AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = + of( + "airline_ticket_and_passenger_transport_ancillary_purchase_cancellation" + ) - /** Rental agreement number */ - @JvmField val RENTAL_AGREEMENT_NUMBER = of("rental_agreement_number") + /** Other */ + @JvmField val OTHER = of("other") - /** Hotel folio number */ - @JvmField val HOTEL_FOLIO_NUMBER = of("hotel_folio_number") + @JvmStatic + fun of(value: String) = CreditReasonIndicator(JsonField.of(value)) + } - /** Invoice number */ - @JvmField val INVOICE_NUMBER = of("invoice_number") + /** An enum containing [CreditReasonIndicator]'s known values. */ + enum class Known { + /** No credit */ + NO_CREDIT, + /** Passenger transport ancillary purchase cancellation */ + PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, + /** + * Airline ticket and passenger transport ancillary purchase + * cancellation + */ + AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, + /** Other */ + OTHER, + } - @JvmStatic - fun of(value: String) = PurchaseIdentifierFormat(JsonField.of(value)) - } + /** + * An enum containing [CreditReasonIndicator]'s known values, as well as + * an [_UNKNOWN] member. + * + * An instance of [CreditReasonIndicator] can contain an unknown value + * in a couple of cases: + * - It was deserialized from data that doesn't match any known member. + * For example, if the SDK is on an older version than the API, then + * the API may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** No credit */ + NO_CREDIT, + /** Passenger transport ancillary purchase cancellation */ + PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, + /** + * Airline ticket and passenger transport ancillary purchase + * cancellation + */ + AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, + /** Other */ + OTHER, + /** + * An enum member indicating that [CreditReasonIndicator] was + * instantiated with an unknown value. + */ + _UNKNOWN, + } - /** An enum containing [PurchaseIdentifierFormat]'s known values. */ - enum class Known { - /** Free text */ - FREE_TEXT, - /** Order number */ - ORDER_NUMBER, - /** Rental agreement number */ - RENTAL_AGREEMENT_NUMBER, - /** Hotel folio number */ - HOTEL_FOLIO_NUMBER, - /** Invoice number */ - INVOICE_NUMBER, - } + /** + * Returns an enum member corresponding to this class instance's value, + * or [Value._UNKNOWN] if the class was instantiated with an unknown + * value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NO_CREDIT -> Value.NO_CREDIT + PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> + Value.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION + AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> + Value + .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION + OTHER -> Value.OTHER + else -> Value._UNKNOWN + } - /** - * An enum containing [PurchaseIdentifierFormat]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [PurchaseIdentifierFormat] can contain an unknown value in a - * couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** Free text */ - FREE_TEXT, - /** Order number */ - ORDER_NUMBER, - /** Rental agreement number */ - RENTAL_AGREEMENT_NUMBER, - /** Hotel folio number */ - HOTEL_FOLIO_NUMBER, - /** Invoice number */ - INVOICE_NUMBER, - /** - * An enum member indicating that [PurchaseIdentifierFormat] was - * instantiated with an unknown value. - */ - _UNKNOWN, - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is + * always known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value + * is a not a known member. + */ + fun known(): Known = + when (this) { + NO_CREDIT -> Known.NO_CREDIT + PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> + Known.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION + AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> + Known + .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION + OTHER -> Known.OTHER + else -> + throw IncreaseInvalidDataException( + "Unknown CreditReasonIndicator: $value" + ) + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - FREE_TEXT -> Value.FREE_TEXT - ORDER_NUMBER -> Value.ORDER_NUMBER - RENTAL_AGREEMENT_NUMBER -> Value.RENTAL_AGREEMENT_NUMBER - HOTEL_FOLIO_NUMBER -> Value.HOTEL_FOLIO_NUMBER - INVOICE_NUMBER -> Value.INVOICE_NUMBER - else -> Value._UNKNOWN - } + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is + * primarily for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value + * does not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a not - * a known member. - */ - fun known(): Known = - when (this) { - FREE_TEXT -> Known.FREE_TEXT - ORDER_NUMBER -> Known.ORDER_NUMBER - RENTAL_AGREEMENT_NUMBER -> Known.RENTAL_AGREEMENT_NUMBER - HOTEL_FOLIO_NUMBER -> Known.HOTEL_FOLIO_NUMBER - INVOICE_NUMBER -> Known.INVOICE_NUMBER - else -> - throw IncreaseInvalidDataException( - "Unknown PurchaseIdentifierFormat: $value" - ) - } + private var validated: Boolean = false - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + fun validate(): CreditReasonIndicator = apply { + if (validated) { + return@apply + } - private var validated: Boolean = false + known() + validated = true + } - fun validate(): PurchaseIdentifierFormat = apply { - if (validated) { - return@apply - } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - known() - validated = true - } + /** + * Returns a score indicating how many valid values are contained in + * this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + return other is CreditReasonIndicator && value == other.value + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + override fun hashCode() = value.hashCode() - return other is PurchaseIdentifierFormat && value == other.value - } + override fun toString() = value.toString() + } - override fun hashCode() = value.hashCode() + class Service + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val category: JsonField, + private val subCategory: JsonField, + private val additionalProperties: MutableMap, + ) { - override fun toString() = value.toString() - } + @JsonCreator + private constructor( + @JsonProperty("category") + @ExcludeMissing + category: JsonField = JsonMissing.of(), + @JsonProperty("sub_category") + @ExcludeMissing + subCategory: JsonField = JsonMissing.of(), + ) : this(category, subCategory, mutableMapOf()) - /** Fields specific to travel. */ - class Travel - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val ancillary: JsonField, - private val computerizedReservationSystem: JsonField, - private val creditReasonIndicator: JsonField, - private val departureDate: JsonField, - private val originationCityAirportCode: JsonField, - private val passengerName: JsonField, - private val restrictedTicketIndicator: JsonField, - private val ticketChangeIndicator: JsonField, - private val ticketNumber: JsonField, - private val travelAgencyCode: JsonField, - private val travelAgencyName: JsonField, - private val tripLegs: JsonField>, - private val additionalProperties: MutableMap, - ) { + /** + * Category of the ancillary service. + * + * @throws IncreaseInvalidDataException if the JSON field has an + * unexpected type (e.g. if the server responded with an unexpected + * value). + */ + fun category(): Optional = category.getOptional("category") - @JsonCreator - private constructor( - @JsonProperty("ancillary") - @ExcludeMissing - ancillary: JsonField = JsonMissing.of(), - @JsonProperty("computerized_reservation_system") - @ExcludeMissing - computerizedReservationSystem: JsonField = JsonMissing.of(), - @JsonProperty("credit_reason_indicator") - @ExcludeMissing - creditReasonIndicator: JsonField = JsonMissing.of(), - @JsonProperty("departure_date") - @ExcludeMissing - departureDate: JsonField = JsonMissing.of(), - @JsonProperty("origination_city_airport_code") - @ExcludeMissing - originationCityAirportCode: JsonField = JsonMissing.of(), - @JsonProperty("passenger_name") - @ExcludeMissing - passengerName: JsonField = JsonMissing.of(), - @JsonProperty("restricted_ticket_indicator") - @ExcludeMissing - restrictedTicketIndicator: JsonField = - JsonMissing.of(), - @JsonProperty("ticket_change_indicator") - @ExcludeMissing - ticketChangeIndicator: JsonField = JsonMissing.of(), - @JsonProperty("ticket_number") - @ExcludeMissing - ticketNumber: JsonField = JsonMissing.of(), - @JsonProperty("travel_agency_code") - @ExcludeMissing - travelAgencyCode: JsonField = JsonMissing.of(), - @JsonProperty("travel_agency_name") - @ExcludeMissing - travelAgencyName: JsonField = JsonMissing.of(), - @JsonProperty("trip_legs") - @ExcludeMissing - tripLegs: JsonField> = JsonMissing.of(), - ) : this( - ancillary, - computerizedReservationSystem, - creditReasonIndicator, - departureDate, - originationCityAirportCode, - passengerName, - restrictedTicketIndicator, - ticketChangeIndicator, - ticketNumber, - travelAgencyCode, - travelAgencyName, - tripLegs, - mutableMapOf(), - ) + /** + * Sub-category of the ancillary service, free-form. + * + * @throws IncreaseInvalidDataException if the JSON field has an + * unexpected type (e.g. if the server responded with an unexpected + * value). + */ + fun subCategory(): Optional = + subCategory.getOptional("sub_category") - /** - * Ancillary purchases in addition to the airfare. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun ancillary(): Optional = ancillary.getOptional("ancillary") + /** + * Returns the raw JSON value of [category]. + * + * Unlike [category], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("category") + @ExcludeMissing + fun _category(): JsonField = category - /** - * Indicates the computerized reservation system used to book the ticket. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun computerizedReservationSystem(): Optional = - computerizedReservationSystem.getOptional("computerized_reservation_system") + /** + * Returns the raw JSON value of [subCategory]. + * + * Unlike [subCategory], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("sub_category") + @ExcludeMissing + fun _subCategory(): JsonField = subCategory - /** - * Indicates the reason for a credit to the cardholder. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun creditReasonIndicator(): Optional = - creditReasonIndicator.getOptional("credit_reason_indicator") + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - /** - * Date of departure. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun departureDate(): Optional = - departureDate.getOptional("departure_date") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** - * Code for the originating city or airport. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun originationCityAirportCode(): Optional = - originationCityAirportCode.getOptional("origination_city_airport_code") + fun toBuilder() = Builder().from(this) - /** - * Name of the passenger. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun passengerName(): Optional = - passengerName.getOptional("passenger_name") + companion object { - /** - * Indicates whether this ticket is non-refundable. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun restrictedTicketIndicator(): Optional = - restrictedTicketIndicator.getOptional("restricted_ticket_indicator") + /** + * Returns a mutable builder for constructing an instance of + * [Service]. + * + * The following fields are required: + * ```java + * .category() + * .subCategory() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - /** - * Indicates why a ticket was changed. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun ticketChangeIndicator(): Optional = - ticketChangeIndicator.getOptional("ticket_change_indicator") + /** A builder for [Service]. */ + class Builder internal constructor() { - /** - * Ticket number. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun ticketNumber(): Optional = ticketNumber.getOptional("ticket_number") + private var category: JsonField? = null + private var subCategory: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() - /** - * Code for the travel agency if the ticket was issued by a travel agency. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun travelAgencyCode(): Optional = - travelAgencyCode.getOptional("travel_agency_code") + @JvmSynthetic + internal fun from(service: Service) = apply { + category = service.category + subCategory = service.subCategory + additionalProperties = + service.additionalProperties.toMutableMap() + } - /** - * Name of the travel agency if the ticket was issued by a travel agency. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun travelAgencyName(): Optional = - travelAgencyName.getOptional("travel_agency_name") + /** Category of the ancillary service. */ + fun category(category: Category?) = + category(JsonField.ofNullable(category)) - /** - * Fields specific to each leg of the journey. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun tripLegs(): Optional> = tripLegs.getOptional("trip_legs") + /** + * Alias for calling [Builder.category] with + * `category.orElse(null)`. + */ + fun category(category: Optional) = + category(category.getOrNull()) - /** - * Returns the raw JSON value of [ancillary]. - * - * Unlike [ancillary], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("ancillary") - @ExcludeMissing - fun _ancillary(): JsonField = ancillary + /** + * Sets [Builder.category] to an arbitrary JSON value. + * + * You should usually call [Builder.category] with a well-typed + * [Category] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ + fun category(category: JsonField) = apply { + this.category = category + } - /** - * Returns the raw JSON value of [computerizedReservationSystem]. - * - * Unlike [computerizedReservationSystem], this method doesn't throw if the JSON - * field has an unexpected type. - */ - @JsonProperty("computerized_reservation_system") - @ExcludeMissing - fun _computerizedReservationSystem(): JsonField = - computerizedReservationSystem + /** Sub-category of the ancillary service, free-form. */ + fun subCategory(subCategory: String?) = + subCategory(JsonField.ofNullable(subCategory)) - /** - * Returns the raw JSON value of [creditReasonIndicator]. - * - * Unlike [creditReasonIndicator], this method doesn't throw if the JSON field - * has an unexpected type. - */ - @JsonProperty("credit_reason_indicator") - @ExcludeMissing - fun _creditReasonIndicator(): JsonField = - creditReasonIndicator + /** + * Alias for calling [Builder.subCategory] with + * `subCategory.orElse(null)`. + */ + fun subCategory(subCategory: Optional) = + subCategory(subCategory.getOrNull()) - /** - * Returns the raw JSON value of [departureDate]. - * - * Unlike [departureDate], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("departure_date") - @ExcludeMissing - fun _departureDate(): JsonField = departureDate + /** + * Sets [Builder.subCategory] to an arbitrary JSON value. + * + * You should usually call [Builder.subCategory] with a well-typed + * [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun subCategory(subCategory: JsonField) = apply { + this.subCategory = subCategory + } - /** - * Returns the raw JSON value of [originationCityAirportCode]. - * - * Unlike [originationCityAirportCode], this method doesn't throw if the JSON - * field has an unexpected type. - */ - @JsonProperty("origination_city_airport_code") - @ExcludeMissing - fun _originationCityAirportCode(): JsonField = - originationCityAirportCode + fun additionalProperties( + additionalProperties: Map + ) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * Returns the raw JSON value of [passengerName]. - * - * Unlike [passengerName], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("passenger_name") - @ExcludeMissing - fun _passengerName(): JsonField = passengerName + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * Returns the raw JSON value of [restrictedTicketIndicator]. - * - * Unlike [restrictedTicketIndicator], this method doesn't throw if the JSON - * field has an unexpected type. - */ - @JsonProperty("restricted_ticket_indicator") - @ExcludeMissing - fun _restrictedTicketIndicator(): JsonField = - restrictedTicketIndicator + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } - /** - * Returns the raw JSON value of [ticketChangeIndicator]. - * - * Unlike [ticketChangeIndicator], this method doesn't throw if the JSON field - * has an unexpected type. - */ - @JsonProperty("ticket_change_indicator") - @ExcludeMissing - fun _ticketChangeIndicator(): JsonField = - ticketChangeIndicator + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * Returns the raw JSON value of [ticketNumber]. - * - * Unlike [ticketNumber], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("ticket_number") - @ExcludeMissing - fun _ticketNumber(): JsonField = ticketNumber + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * Returns the raw JSON value of [travelAgencyCode]. - * - * Unlike [travelAgencyCode], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("travel_agency_code") - @ExcludeMissing - fun _travelAgencyCode(): JsonField = travelAgencyCode + /** + * Returns an immutable instance of [Service]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + * + * The following fields are required: + * ```java + * .category() + * .subCategory() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Service = + Service( + checkRequired("category", category), + checkRequired("subCategory", subCategory), + additionalProperties.toMutableMap(), + ) + } - /** - * Returns the raw JSON value of [travelAgencyName]. - * - * Unlike [travelAgencyName], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("travel_agency_name") - @ExcludeMissing - fun _travelAgencyName(): JsonField = travelAgencyName + private var validated: Boolean = false - /** - * Returns the raw JSON value of [tripLegs]. - * - * Unlike [tripLegs], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("trip_legs") - @ExcludeMissing - fun _tripLegs(): JsonField> = tripLegs + fun validate(): Service = apply { + if (validated) { + return@apply + } - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + category().ifPresent { it.validate() } + subCategory() + validated = true + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - fun toBuilder() = Builder().from(this) + /** + * Returns a score indicating how many valid values are contained in + * this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (category.asKnown().getOrNull()?.validity() ?: 0) + + (if (subCategory.asKnown().isPresent) 1 else 0) - companion object { + /** Category of the ancillary service. */ + class Category + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** - * Returns a mutable builder for constructing an instance of [Travel]. - * - * The following fields are required: - * ```java - * .ancillary() - * .computerizedReservationSystem() - * .creditReasonIndicator() - * .departureDate() - * .originationCityAirportCode() - * .passengerName() - * .restrictedTicketIndicator() - * .ticketChangeIndicator() - * .ticketNumber() - * .travelAgencyCode() - * .travelAgencyName() - * .tripLegs() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized + * from data that doesn't match any known member, and you want to + * know that value. For example, if the SDK is on an older version + * than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** A builder for [Travel]. */ - class Builder internal constructor() { + companion object { - private var ancillary: JsonField? = null - private var computerizedReservationSystem: JsonField? = null - private var creditReasonIndicator: JsonField? = null - private var departureDate: JsonField? = null - private var originationCityAirportCode: JsonField? = null - private var passengerName: JsonField? = null - private var restrictedTicketIndicator: - JsonField? = - null - private var ticketChangeIndicator: JsonField? = null - private var ticketNumber: JsonField? = null - private var travelAgencyCode: JsonField? = null - private var travelAgencyName: JsonField? = null - private var tripLegs: JsonField>? = null - private var additionalProperties: MutableMap = - mutableMapOf() + /** None */ + @JvmField val NONE = of("none") - @JvmSynthetic - internal fun from(travel: Travel) = apply { - ancillary = travel.ancillary - computerizedReservationSystem = travel.computerizedReservationSystem - creditReasonIndicator = travel.creditReasonIndicator - departureDate = travel.departureDate - originationCityAirportCode = travel.originationCityAirportCode - passengerName = travel.passengerName - restrictedTicketIndicator = travel.restrictedTicketIndicator - ticketChangeIndicator = travel.ticketChangeIndicator - ticketNumber = travel.ticketNumber - travelAgencyCode = travel.travelAgencyCode - travelAgencyName = travel.travelAgencyName - tripLegs = travel.tripLegs.map { it.toMutableList() } - additionalProperties = travel.additionalProperties.toMutableMap() - } + /** Bundled service */ + @JvmField val BUNDLED_SERVICE = of("bundled_service") - /** Ancillary purchases in addition to the airfare. */ - fun ancillary(ancillary: Ancillary?) = - ancillary(JsonField.ofNullable(ancillary)) + /** Baggage fee */ + @JvmField val BAGGAGE_FEE = of("baggage_fee") - /** Alias for calling [Builder.ancillary] with `ancillary.orElse(null)`. */ - fun ancillary(ancillary: Optional) = - ancillary(ancillary.getOrNull()) + /** Change fee */ + @JvmField val CHANGE_FEE = of("change_fee") - /** - * Sets [Builder.ancillary] to an arbitrary JSON value. - * - * You should usually call [Builder.ancillary] with a well-typed [Ancillary] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun ancillary(ancillary: JsonField) = apply { - this.ancillary = ancillary - } + /** Cargo */ + @JvmField val CARGO = of("cargo") - /** - * Indicates the computerized reservation system used to book the ticket. - */ - fun computerizedReservationSystem(computerizedReservationSystem: String?) = - computerizedReservationSystem( - JsonField.ofNullable(computerizedReservationSystem) - ) + /** Carbon offset */ + @JvmField val CARBON_OFFSET = of("carbon_offset") - /** - * Alias for calling [Builder.computerizedReservationSystem] with - * `computerizedReservationSystem.orElse(null)`. - */ - fun computerizedReservationSystem( - computerizedReservationSystem: Optional - ) = computerizedReservationSystem(computerizedReservationSystem.getOrNull()) + /** Frequent flyer */ + @JvmField val FREQUENT_FLYER = of("frequent_flyer") - /** - * Sets [Builder.computerizedReservationSystem] to an arbitrary JSON value. - * - * You should usually call [Builder.computerizedReservationSystem] with a - * well-typed [String] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. - */ - fun computerizedReservationSystem( - computerizedReservationSystem: JsonField - ) = apply { - this.computerizedReservationSystem = computerizedReservationSystem - } + /** Gift card */ + @JvmField val GIFT_CARD = of("gift_card") - /** Indicates the reason for a credit to the cardholder. */ - fun creditReasonIndicator(creditReasonIndicator: CreditReasonIndicator?) = - creditReasonIndicator(JsonField.ofNullable(creditReasonIndicator)) + /** Ground transport */ + @JvmField val GROUND_TRANSPORT = of("ground_transport") - /** - * Alias for calling [Builder.creditReasonIndicator] with - * `creditReasonIndicator.orElse(null)`. - */ - fun creditReasonIndicator( - creditReasonIndicator: Optional - ) = creditReasonIndicator(creditReasonIndicator.getOrNull()) + /** In-flight entertainment */ + @JvmField + val IN_FLIGHT_ENTERTAINMENT = of("in_flight_entertainment") - /** - * Sets [Builder.creditReasonIndicator] to an arbitrary JSON value. - * - * You should usually call [Builder.creditReasonIndicator] with a well-typed - * [CreditReasonIndicator] value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. - */ - fun creditReasonIndicator( - creditReasonIndicator: JsonField - ) = apply { this.creditReasonIndicator = creditReasonIndicator } + /** Lounge */ + @JvmField val LOUNGE = of("lounge") - /** Date of departure. */ - fun departureDate(departureDate: LocalDate?) = - departureDate(JsonField.ofNullable(departureDate)) + /** Medical */ + @JvmField val MEDICAL = of("medical") - /** - * Alias for calling [Builder.departureDate] with - * `departureDate.orElse(null)`. - */ - fun departureDate(departureDate: Optional) = - departureDate(departureDate.getOrNull()) + /** Meal beverage */ + @JvmField val MEAL_BEVERAGE = of("meal_beverage") - /** - * Sets [Builder.departureDate] to an arbitrary JSON value. - * - * You should usually call [Builder.departureDate] with a well-typed - * [LocalDate] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. - */ - fun departureDate(departureDate: JsonField) = apply { - this.departureDate = departureDate - } + /** Other */ + @JvmField val OTHER = of("other") - /** Code for the originating city or airport. */ - fun originationCityAirportCode(originationCityAirportCode: String?) = - originationCityAirportCode( - JsonField.ofNullable(originationCityAirportCode) - ) + /** Passenger assist fee */ + @JvmField val PASSENGER_ASSIST_FEE = of("passenger_assist_fee") - /** - * Alias for calling [Builder.originationCityAirportCode] with - * `originationCityAirportCode.orElse(null)`. - */ - fun originationCityAirportCode( - originationCityAirportCode: Optional - ) = originationCityAirportCode(originationCityAirportCode.getOrNull()) + /** Pets */ + @JvmField val PETS = of("pets") - /** - * Sets [Builder.originationCityAirportCode] to an arbitrary JSON value. - * - * You should usually call [Builder.originationCityAirportCode] with a - * well-typed [String] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. - */ - fun originationCityAirportCode( - originationCityAirportCode: JsonField - ) = apply { this.originationCityAirportCode = originationCityAirportCode } + /** Seat fees */ + @JvmField val SEAT_FEES = of("seat_fees") - /** Name of the passenger. */ - fun passengerName(passengerName: String?) = - passengerName(JsonField.ofNullable(passengerName)) + /** Standby */ + @JvmField val STANDBY = of("standby") - /** - * Alias for calling [Builder.passengerName] with - * `passengerName.orElse(null)`. - */ - fun passengerName(passengerName: Optional) = - passengerName(passengerName.getOrNull()) + /** Service fee */ + @JvmField val SERVICE_FEE = of("service_fee") - /** - * Sets [Builder.passengerName] to an arbitrary JSON value. - * - * You should usually call [Builder.passengerName] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun passengerName(passengerName: JsonField) = apply { - this.passengerName = passengerName - } + /** Store */ + @JvmField val STORE = of("store") - /** Indicates whether this ticket is non-refundable. */ - fun restrictedTicketIndicator( - restrictedTicketIndicator: RestrictedTicketIndicator? - ) = - restrictedTicketIndicator( - JsonField.ofNullable(restrictedTicketIndicator) - ) + /** Travel service */ + @JvmField val TRAVEL_SERVICE = of("travel_service") - /** - * Alias for calling [Builder.restrictedTicketIndicator] with - * `restrictedTicketIndicator.orElse(null)`. - */ - fun restrictedTicketIndicator( - restrictedTicketIndicator: Optional - ) = restrictedTicketIndicator(restrictedTicketIndicator.getOrNull()) + /** Unaccompanied travel */ + @JvmField val UNACCOMPANIED_TRAVEL = of("unaccompanied_travel") - /** - * Sets [Builder.restrictedTicketIndicator] to an arbitrary JSON value. - * - * You should usually call [Builder.restrictedTicketIndicator] with a - * well-typed [RestrictedTicketIndicator] value instead. This method is - * primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun restrictedTicketIndicator( - restrictedTicketIndicator: JsonField - ) = apply { this.restrictedTicketIndicator = restrictedTicketIndicator } + /** Upgrades */ + @JvmField val UPGRADES = of("upgrades") - /** Indicates why a ticket was changed. */ - fun ticketChangeIndicator(ticketChangeIndicator: TicketChangeIndicator?) = - ticketChangeIndicator(JsonField.ofNullable(ticketChangeIndicator)) + /** Wi-fi */ + @JvmField val WIFI = of("wifi") - /** - * Alias for calling [Builder.ticketChangeIndicator] with - * `ticketChangeIndicator.orElse(null)`. - */ - fun ticketChangeIndicator( - ticketChangeIndicator: Optional - ) = ticketChangeIndicator(ticketChangeIndicator.getOrNull()) + @JvmStatic fun of(value: String) = Category(JsonField.of(value)) + } - /** - * Sets [Builder.ticketChangeIndicator] to an arbitrary JSON value. - * - * You should usually call [Builder.ticketChangeIndicator] with a well-typed - * [TicketChangeIndicator] value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. - */ - fun ticketChangeIndicator( - ticketChangeIndicator: JsonField - ) = apply { this.ticketChangeIndicator = ticketChangeIndicator } + /** An enum containing [Category]'s known values. */ + enum class Known { + /** None */ + NONE, + /** Bundled service */ + BUNDLED_SERVICE, + /** Baggage fee */ + BAGGAGE_FEE, + /** Change fee */ + CHANGE_FEE, + /** Cargo */ + CARGO, + /** Carbon offset */ + CARBON_OFFSET, + /** Frequent flyer */ + FREQUENT_FLYER, + /** Gift card */ + GIFT_CARD, + /** Ground transport */ + GROUND_TRANSPORT, + /** In-flight entertainment */ + IN_FLIGHT_ENTERTAINMENT, + /** Lounge */ + LOUNGE, + /** Medical */ + MEDICAL, + /** Meal beverage */ + MEAL_BEVERAGE, + /** Other */ + OTHER, + /** Passenger assist fee */ + PASSENGER_ASSIST_FEE, + /** Pets */ + PETS, + /** Seat fees */ + SEAT_FEES, + /** Standby */ + STANDBY, + /** Service fee */ + SERVICE_FEE, + /** Store */ + STORE, + /** Travel service */ + TRAVEL_SERVICE, + /** Unaccompanied travel */ + UNACCOMPANIED_TRAVEL, + /** Upgrades */ + UPGRADES, + /** Wi-fi */ + WIFI, + } - /** Ticket number. */ - fun ticketNumber(ticketNumber: String?) = - ticketNumber(JsonField.ofNullable(ticketNumber)) + /** + * An enum containing [Category]'s known values, as well as an + * [_UNKNOWN] member. + * + * An instance of [Category] can contain an unknown value in a + * couple of cases: + * - It was deserialized from data that doesn't match any known + * member. For example, if the SDK is on an older version than the + * API, then the API may respond with new members that the SDK is + * unaware of. + * - It was constructed with an arbitrary value using the [of] + * method. + */ + enum class Value { + /** None */ + NONE, + /** Bundled service */ + BUNDLED_SERVICE, + /** Baggage fee */ + BAGGAGE_FEE, + /** Change fee */ + CHANGE_FEE, + /** Cargo */ + CARGO, + /** Carbon offset */ + CARBON_OFFSET, + /** Frequent flyer */ + FREQUENT_FLYER, + /** Gift card */ + GIFT_CARD, + /** Ground transport */ + GROUND_TRANSPORT, + /** In-flight entertainment */ + IN_FLIGHT_ENTERTAINMENT, + /** Lounge */ + LOUNGE, + /** Medical */ + MEDICAL, + /** Meal beverage */ + MEAL_BEVERAGE, + /** Other */ + OTHER, + /** Passenger assist fee */ + PASSENGER_ASSIST_FEE, + /** Pets */ + PETS, + /** Seat fees */ + SEAT_FEES, + /** Standby */ + STANDBY, + /** Service fee */ + SERVICE_FEE, + /** Store */ + STORE, + /** Travel service */ + TRAVEL_SERVICE, + /** Unaccompanied travel */ + UNACCOMPANIED_TRAVEL, + /** Upgrades */ + UPGRADES, + /** Wi-fi */ + WIFI, + /** + * An enum member indicating that [Category] was instantiated + * with an unknown value. + */ + _UNKNOWN, + } - /** - * Alias for calling [Builder.ticketNumber] with - * `ticketNumber.orElse(null)`. - */ - fun ticketNumber(ticketNumber: Optional) = - ticketNumber(ticketNumber.getOrNull()) + /** + * Returns an enum member corresponding to this class instance's + * value, or [Value._UNKNOWN] if the class was instantiated with an + * unknown value. + * + * Use the [known] method instead if you're certain the value is + * always known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NONE -> Value.NONE + BUNDLED_SERVICE -> Value.BUNDLED_SERVICE + BAGGAGE_FEE -> Value.BAGGAGE_FEE + CHANGE_FEE -> Value.CHANGE_FEE + CARGO -> Value.CARGO + CARBON_OFFSET -> Value.CARBON_OFFSET + FREQUENT_FLYER -> Value.FREQUENT_FLYER + GIFT_CARD -> Value.GIFT_CARD + GROUND_TRANSPORT -> Value.GROUND_TRANSPORT + IN_FLIGHT_ENTERTAINMENT -> Value.IN_FLIGHT_ENTERTAINMENT + LOUNGE -> Value.LOUNGE + MEDICAL -> Value.MEDICAL + MEAL_BEVERAGE -> Value.MEAL_BEVERAGE + OTHER -> Value.OTHER + PASSENGER_ASSIST_FEE -> Value.PASSENGER_ASSIST_FEE + PETS -> Value.PETS + SEAT_FEES -> Value.SEAT_FEES + STANDBY -> Value.STANDBY + SERVICE_FEE -> Value.SERVICE_FEE + STORE -> Value.STORE + TRAVEL_SERVICE -> Value.TRAVEL_SERVICE + UNACCOMPANIED_TRAVEL -> Value.UNACCOMPANIED_TRAVEL + UPGRADES -> Value.UPGRADES + WIFI -> Value.WIFI + else -> Value._UNKNOWN + } - /** - * Sets [Builder.ticketNumber] to an arbitrary JSON value. - * - * You should usually call [Builder.ticketNumber] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun ticketNumber(ticketNumber: JsonField) = apply { - this.ticketNumber = ticketNumber - } + /** + * Returns an enum member corresponding to this class instance's + * value. + * + * Use the [value] method instead if you're uncertain the value is + * always known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's + * value is a not a known member. + */ + fun known(): Known = + when (this) { + NONE -> Known.NONE + BUNDLED_SERVICE -> Known.BUNDLED_SERVICE + BAGGAGE_FEE -> Known.BAGGAGE_FEE + CHANGE_FEE -> Known.CHANGE_FEE + CARGO -> Known.CARGO + CARBON_OFFSET -> Known.CARBON_OFFSET + FREQUENT_FLYER -> Known.FREQUENT_FLYER + GIFT_CARD -> Known.GIFT_CARD + GROUND_TRANSPORT -> Known.GROUND_TRANSPORT + IN_FLIGHT_ENTERTAINMENT -> Known.IN_FLIGHT_ENTERTAINMENT + LOUNGE -> Known.LOUNGE + MEDICAL -> Known.MEDICAL + MEAL_BEVERAGE -> Known.MEAL_BEVERAGE + OTHER -> Known.OTHER + PASSENGER_ASSIST_FEE -> Known.PASSENGER_ASSIST_FEE + PETS -> Known.PETS + SEAT_FEES -> Known.SEAT_FEES + STANDBY -> Known.STANDBY + SERVICE_FEE -> Known.SERVICE_FEE + STORE -> Known.STORE + TRAVEL_SERVICE -> Known.TRAVEL_SERVICE + UNACCOMPANIED_TRAVEL -> Known.UNACCOMPANIED_TRAVEL + UPGRADES -> Known.UPGRADES + WIFI -> Known.WIFI + else -> + throw IncreaseInvalidDataException( + "Unknown Category: $value" + ) + } - /** - * Code for the travel agency if the ticket was issued by a travel agency. - */ - fun travelAgencyCode(travelAgencyCode: String?) = - travelAgencyCode(JsonField.ofNullable(travelAgencyCode)) + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is + * primarily for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's + * value does not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - /** - * Alias for calling [Builder.travelAgencyCode] with - * `travelAgencyCode.orElse(null)`. - */ - fun travelAgencyCode(travelAgencyCode: Optional) = - travelAgencyCode(travelAgencyCode.getOrNull()) + private var validated: Boolean = false - /** - * Sets [Builder.travelAgencyCode] to an arbitrary JSON value. - * - * You should usually call [Builder.travelAgencyCode] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun travelAgencyCode(travelAgencyCode: JsonField) = apply { - this.travelAgencyCode = travelAgencyCode - } + fun validate(): Category = apply { + if (validated) { + return@apply + } - /** - * Name of the travel agency if the ticket was issued by a travel agency. - */ - fun travelAgencyName(travelAgencyName: String?) = - travelAgencyName(JsonField.ofNullable(travelAgencyName)) + known() + validated = true + } - /** - * Alias for calling [Builder.travelAgencyName] with - * `travelAgencyName.orElse(null)`. - */ - fun travelAgencyName(travelAgencyName: Optional) = - travelAgencyName(travelAgencyName.getOrNull()) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * Sets [Builder.travelAgencyName] to an arbitrary JSON value. - * - * You should usually call [Builder.travelAgencyName] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun travelAgencyName(travelAgencyName: JsonField) = apply { - this.travelAgencyName = travelAgencyName - } + /** + * Returns a score indicating how many valid values are contained in + * this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + if (value() == Value._UNKNOWN) 0 else 1 - /** Fields specific to each leg of the journey. */ - fun tripLegs(tripLegs: List?) = - tripLegs(JsonField.ofNullable(tripLegs)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** Alias for calling [Builder.tripLegs] with `tripLegs.orElse(null)`. */ - fun tripLegs(tripLegs: Optional>) = - tripLegs(tripLegs.getOrNull()) + return other is Category && value == other.value + } - /** - * Sets [Builder.tripLegs] to an arbitrary JSON value. - * - * You should usually call [Builder.tripLegs] with a well-typed - * `List` value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun tripLegs(tripLegs: JsonField>) = apply { - this.tripLegs = tripLegs.map { it.toMutableList() } - } + override fun hashCode() = value.hashCode() - /** - * Adds a single [TripLeg] to [tripLegs]. - * - * @throws IllegalStateException if the field was previously set to a - * non-list. - */ - fun addTripLeg(tripLeg: TripLeg) = apply { - tripLegs = - (tripLegs ?: JsonField.of(mutableListOf())).also { - checkKnown("tripLegs", it).add(tripLeg) + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - } - fun additionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) + return other is Service && + category == other.category && + subCategory == other.subCategory && + additionalProperties == other.additionalProperties } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + private val hashCode: Int by lazy { + Objects.hash(category, subCategory, additionalProperties) + } - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } + override fun hashCode(): Int = hashCode - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + override fun toString() = + "Service{category=$category, subCategory=$subCategory, additionalProperties=$additionalProperties}" } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Ancillary && + connectedTicketDocumentNumber == + other.connectedTicketDocumentNumber && + creditReasonIndicator == other.creditReasonIndicator && + passengerNameOrDescription == other.passengerNameOrDescription && + services == other.services && + ticketDocumentNumber == other.ticketDocumentNumber && + additionalProperties == other.additionalProperties } - /** - * Returns an immutable instance of [Travel]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .ancillary() - * .computerizedReservationSystem() - * .creditReasonIndicator() - * .departureDate() - * .originationCityAirportCode() - * .passengerName() - * .restrictedTicketIndicator() - * .ticketChangeIndicator() - * .ticketNumber() - * .travelAgencyCode() - * .travelAgencyName() - * .tripLegs() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Travel = - Travel( - checkRequired("ancillary", ancillary), - checkRequired( - "computerizedReservationSystem", - computerizedReservationSystem, - ), - checkRequired("creditReasonIndicator", creditReasonIndicator), - checkRequired("departureDate", departureDate), - checkRequired( - "originationCityAirportCode", - originationCityAirportCode, - ), - checkRequired("passengerName", passengerName), - checkRequired( - "restrictedTicketIndicator", - restrictedTicketIndicator, - ), - checkRequired("ticketChangeIndicator", ticketChangeIndicator), - checkRequired("ticketNumber", ticketNumber), - checkRequired("travelAgencyCode", travelAgencyCode), - checkRequired("travelAgencyName", travelAgencyName), - checkRequired("tripLegs", tripLegs).map { it.toImmutable() }, - additionalProperties.toMutableMap(), + private val hashCode: Int by lazy { + Objects.hash( + connectedTicketDocumentNumber, + creditReasonIndicator, + passengerNameOrDescription, + services, + ticketDocumentNumber, + additionalProperties, ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Ancillary{connectedTicketDocumentNumber=$connectedTicketDocumentNumber, creditReasonIndicator=$creditReasonIndicator, passengerNameOrDescription=$passengerNameOrDescription, services=$services, ticketDocumentNumber=$ticketDocumentNumber, additionalProperties=$additionalProperties}" } - private var validated: Boolean = false + /** Indicates the reason for a credit to the cardholder. */ + class CreditReasonIndicator + @JsonCreator + private constructor(private val value: JsonField) : Enum { - fun validate(): Travel = apply { - if (validated) { - return@apply - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - ancillary().ifPresent { it.validate() } - computerizedReservationSystem() - creditReasonIndicator().ifPresent { it.validate() } - departureDate() - originationCityAirportCode() - passengerName() - restrictedTicketIndicator().ifPresent { it.validate() } - ticketChangeIndicator().ifPresent { it.validate() } - ticketNumber() - travelAgencyCode() - travelAgencyName() - tripLegs().ifPresent { it.forEach { it.validate() } } - validated = true - } + companion object { - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** No credit */ + @JvmField val NO_CREDIT = of("no_credit") - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (ancillary.asKnown().getOrNull()?.validity() ?: 0) + - (if (computerizedReservationSystem.asKnown().isPresent) 1 else 0) + - (creditReasonIndicator.asKnown().getOrNull()?.validity() ?: 0) + - (if (departureDate.asKnown().isPresent) 1 else 0) + - (if (originationCityAirportCode.asKnown().isPresent) 1 else 0) + - (if (passengerName.asKnown().isPresent) 1 else 0) + - (restrictedTicketIndicator.asKnown().getOrNull()?.validity() ?: 0) + - (ticketChangeIndicator.asKnown().getOrNull()?.validity() ?: 0) + - (if (ticketNumber.asKnown().isPresent) 1 else 0) + - (if (travelAgencyCode.asKnown().isPresent) 1 else 0) + - (if (travelAgencyName.asKnown().isPresent) 1 else 0) + - (tripLegs.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + /** Passenger transport ancillary purchase cancellation */ + @JvmField + val PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = + of("passenger_transport_ancillary_purchase_cancellation") - /** Ancillary purchases in addition to the airfare. */ - class Ancillary - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val connectedTicketDocumentNumber: JsonField, - private val creditReasonIndicator: JsonField, - private val passengerNameOrDescription: JsonField, - private val services: JsonField>, - private val ticketDocumentNumber: JsonField, - private val additionalProperties: MutableMap, - ) { + /** + * Airline ticket and passenger transport ancillary purchase + * cancellation + */ + @JvmField + val AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = + of( + "airline_ticket_and_passenger_transport_ancillary_purchase_cancellation" + ) - @JsonCreator - private constructor( - @JsonProperty("connected_ticket_document_number") - @ExcludeMissing - connectedTicketDocumentNumber: JsonField = JsonMissing.of(), - @JsonProperty("credit_reason_indicator") - @ExcludeMissing - creditReasonIndicator: JsonField = - JsonMissing.of(), - @JsonProperty("passenger_name_or_description") - @ExcludeMissing - passengerNameOrDescription: JsonField = JsonMissing.of(), - @JsonProperty("services") - @ExcludeMissing - services: JsonField> = JsonMissing.of(), - @JsonProperty("ticket_document_number") - @ExcludeMissing - ticketDocumentNumber: JsonField = JsonMissing.of(), - ) : this( - connectedTicketDocumentNumber, - creditReasonIndicator, - passengerNameOrDescription, - services, - ticketDocumentNumber, - mutableMapOf(), - ) + /** Airline ticket cancellation */ + @JvmField + val AIRLINE_TICKET_CANCELLATION = of("airline_ticket_cancellation") - /** - * If this purchase has a connection or relationship to another purchase, - * such as a baggage fee for a passenger transport ticket, this field should - * contain the ticket document number for the other purchase. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). - */ - fun connectedTicketDocumentNumber(): Optional = - connectedTicketDocumentNumber.getOptional( - "connected_ticket_document_number" - ) + /** Other */ + @JvmField val OTHER = of("other") - /** - * Indicates the reason for a credit to the cardholder. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). - */ - fun creditReasonIndicator(): Optional = - creditReasonIndicator.getOptional("credit_reason_indicator") + /** Partial refund of airline ticket */ + @JvmField + val PARTIAL_REFUND_OF_AIRLINE_TICKET = + of("partial_refund_of_airline_ticket") - /** - * Name of the passenger or description of the ancillary purchase. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). - */ - fun passengerNameOrDescription(): Optional = - passengerNameOrDescription.getOptional("passenger_name_or_description") + @JvmStatic + fun of(value: String) = CreditReasonIndicator(JsonField.of(value)) + } - /** - * Additional travel charges, such as baggage fees. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type or is unexpectedly missing or null (e.g. if the server responded - * with an unexpected value). - */ - fun services(): List = services.getRequired("services") + /** An enum containing [CreditReasonIndicator]'s known values. */ + enum class Known { + /** No credit */ + NO_CREDIT, + /** Passenger transport ancillary purchase cancellation */ + PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, + /** + * Airline ticket and passenger transport ancillary purchase + * cancellation + */ + AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, + /** Airline ticket cancellation */ + AIRLINE_TICKET_CANCELLATION, + /** Other */ + OTHER, + /** Partial refund of airline ticket */ + PARTIAL_REFUND_OF_AIRLINE_TICKET, + } /** - * Ticket document number. + * An enum containing [CreditReasonIndicator]'s known values, as well as an + * [_UNKNOWN] member. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). + * An instance of [CreditReasonIndicator] can contain an unknown value in a + * couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. */ - fun ticketDocumentNumber(): Optional = - ticketDocumentNumber.getOptional("ticket_document_number") + enum class Value { + /** No credit */ + NO_CREDIT, + /** Passenger transport ancillary purchase cancellation */ + PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, + /** + * Airline ticket and passenger transport ancillary purchase + * cancellation + */ + AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, + /** Airline ticket cancellation */ + AIRLINE_TICKET_CANCELLATION, + /** Other */ + OTHER, + /** Partial refund of airline ticket */ + PARTIAL_REFUND_OF_AIRLINE_TICKET, + /** + * An enum member indicating that [CreditReasonIndicator] was + * instantiated with an unknown value. + */ + _UNKNOWN, + } /** - * Returns the raw JSON value of [connectedTicketDocumentNumber]. + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. * - * Unlike [connectedTicketDocumentNumber], this method doesn't throw if the - * JSON field has an unexpected type. + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. */ - @JsonProperty("connected_ticket_document_number") - @ExcludeMissing - fun _connectedTicketDocumentNumber(): JsonField = - connectedTicketDocumentNumber + fun value(): Value = + when (this) { + NO_CREDIT -> Value.NO_CREDIT + PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> + Value.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION + AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> + Value + .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION + AIRLINE_TICKET_CANCELLATION -> Value.AIRLINE_TICKET_CANCELLATION + OTHER -> Value.OTHER + PARTIAL_REFUND_OF_AIRLINE_TICKET -> + Value.PARTIAL_REFUND_OF_AIRLINE_TICKET + else -> Value._UNKNOWN + } /** - * Returns the raw JSON value of [creditReasonIndicator]. + * Returns an enum member corresponding to this class instance's value. * - * Unlike [creditReasonIndicator], this method doesn't throw if the JSON - * field has an unexpected type. - */ - @JsonProperty("credit_reason_indicator") - @ExcludeMissing - fun _creditReasonIndicator(): JsonField = - creditReasonIndicator - - /** - * Returns the raw JSON value of [passengerNameOrDescription]. + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. * - * Unlike [passengerNameOrDescription], this method doesn't throw if the - * JSON field has an unexpected type. + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. */ - @JsonProperty("passenger_name_or_description") - @ExcludeMissing - fun _passengerNameOrDescription(): JsonField = - passengerNameOrDescription + fun known(): Known = + when (this) { + NO_CREDIT -> Known.NO_CREDIT + PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> + Known.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION + AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> + Known + .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION + AIRLINE_TICKET_CANCELLATION -> Known.AIRLINE_TICKET_CANCELLATION + OTHER -> Known.OTHER + PARTIAL_REFUND_OF_AIRLINE_TICKET -> + Known.PARTIAL_REFUND_OF_AIRLINE_TICKET + else -> + throw IncreaseInvalidDataException( + "Unknown CreditReasonIndicator: $value" + ) + } /** - * Returns the raw JSON value of [services]. + * Returns this class instance's primitive wire representation. * - * Unlike [services], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("services") - @ExcludeMissing - fun _services(): JsonField> = services - - /** - * Returns the raw JSON value of [ticketDocumentNumber]. + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. * - * Unlike [ticketDocumentNumber], this method doesn't throw if the JSON - * field has an unexpected type. + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. */ - @JsonProperty("ticket_document_number") - @ExcludeMissing - fun _ticketDocumentNumber(): JsonField = ticketDocumentNumber - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [Ancillary]. - * - * The following fields are required: - * ```java - * .connectedTicketDocumentNumber() - * .creditReasonIndicator() - * .passengerNameOrDescription() - * .services() - * .ticketDocumentNumber() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Ancillary]. */ - class Builder internal constructor() { + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - private var connectedTicketDocumentNumber: JsonField? = null - private var creditReasonIndicator: JsonField? = - null - private var passengerNameOrDescription: JsonField? = null - private var services: JsonField>? = null - private var ticketDocumentNumber: JsonField? = null - private var additionalProperties: MutableMap = - mutableMapOf() + private var validated: Boolean = false - @JvmSynthetic - internal fun from(ancillary: Ancillary) = apply { - connectedTicketDocumentNumber = - ancillary.connectedTicketDocumentNumber - creditReasonIndicator = ancillary.creditReasonIndicator - passengerNameOrDescription = ancillary.passengerNameOrDescription - services = ancillary.services.map { it.toMutableList() } - ticketDocumentNumber = ancillary.ticketDocumentNumber - additionalProperties = ancillary.additionalProperties.toMutableMap() + fun validate(): CreditReasonIndicator = apply { + if (validated) { + return@apply } - /** - * If this purchase has a connection or relationship to another - * purchase, such as a baggage fee for a passenger transport ticket, - * this field should contain the ticket document number for the other - * purchase. - */ - fun connectedTicketDocumentNumber( - connectedTicketDocumentNumber: String? - ) = - connectedTicketDocumentNumber( - JsonField.ofNullable(connectedTicketDocumentNumber) - ) - - /** - * Alias for calling [Builder.connectedTicketDocumentNumber] with - * `connectedTicketDocumentNumber.orElse(null)`. - */ - fun connectedTicketDocumentNumber( - connectedTicketDocumentNumber: Optional - ) = - connectedTicketDocumentNumber( - connectedTicketDocumentNumber.getOrNull() - ) + known() + validated = true + } - /** - * Sets [Builder.connectedTicketDocumentNumber] to an arbitrary JSON - * value. - * - * You should usually call [Builder.connectedTicketDocumentNumber] with - * a well-typed [String] value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. - */ - fun connectedTicketDocumentNumber( - connectedTicketDocumentNumber: JsonField - ) = apply { - this.connectedTicketDocumentNumber = connectedTicketDocumentNumber + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false } - /** Indicates the reason for a credit to the cardholder. */ - fun creditReasonIndicator( - creditReasonIndicator: CreditReasonIndicator? - ) = creditReasonIndicator(JsonField.ofNullable(creditReasonIndicator)) + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - /** - * Alias for calling [Builder.creditReasonIndicator] with - * `creditReasonIndicator.orElse(null)`. - */ - fun creditReasonIndicator( - creditReasonIndicator: Optional - ) = creditReasonIndicator(creditReasonIndicator.getOrNull()) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Sets [Builder.creditReasonIndicator] to an arbitrary JSON value. - * - * You should usually call [Builder.creditReasonIndicator] with a - * well-typed [CreditReasonIndicator] value instead. This method is - * primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun creditReasonIndicator( - creditReasonIndicator: JsonField - ) = apply { this.creditReasonIndicator = creditReasonIndicator } + return other is CreditReasonIndicator && value == other.value + } - /** Name of the passenger or description of the ancillary purchase. */ - fun passengerNameOrDescription(passengerNameOrDescription: String?) = - passengerNameOrDescription( - JsonField.ofNullable(passengerNameOrDescription) - ) + override fun hashCode() = value.hashCode() - /** - * Alias for calling [Builder.passengerNameOrDescription] with - * `passengerNameOrDescription.orElse(null)`. - */ - fun passengerNameOrDescription( - passengerNameOrDescription: Optional - ) = passengerNameOrDescription(passengerNameOrDescription.getOrNull()) + override fun toString() = value.toString() + } - /** - * Sets [Builder.passengerNameOrDescription] to an arbitrary JSON value. - * - * You should usually call [Builder.passengerNameOrDescription] with a - * well-typed [String] value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. - */ - fun passengerNameOrDescription( - passengerNameOrDescription: JsonField - ) = apply { - this.passengerNameOrDescription = passengerNameOrDescription - } + /** Indicates whether this ticket is non-refundable. */ + class RestrictedTicketIndicator + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** Additional travel charges, such as baggage fees. */ - fun services(services: List) = services(JsonField.of(services)) + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** - * Sets [Builder.services] to an arbitrary JSON value. - * - * You should usually call [Builder.services] with a well-typed - * `List` value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. - */ - fun services(services: JsonField>) = apply { - this.services = services.map { it.toMutableList() } - } + companion object { - /** - * Adds a single [Service] to [services]. - * - * @throws IllegalStateException if the field was previously set to a - * non-list. - */ - fun addService(service: Service) = apply { - services = - (services ?: JsonField.of(mutableListOf())).also { - checkKnown("services", it).add(service) - } - } + /** No restrictions */ + @JvmField val NO_RESTRICTIONS = of("no_restrictions") - /** Ticket document number. */ - fun ticketDocumentNumber(ticketDocumentNumber: String?) = - ticketDocumentNumber(JsonField.ofNullable(ticketDocumentNumber)) + /** Restricted non-refundable ticket */ + @JvmField + val RESTRICTED_NON_REFUNDABLE_TICKET = + of("restricted_non_refundable_ticket") - /** - * Alias for calling [Builder.ticketDocumentNumber] with - * `ticketDocumentNumber.orElse(null)`. - */ - fun ticketDocumentNumber(ticketDocumentNumber: Optional) = - ticketDocumentNumber(ticketDocumentNumber.getOrNull()) + @JvmStatic + fun of(value: String) = RestrictedTicketIndicator(JsonField.of(value)) + } + + /** An enum containing [RestrictedTicketIndicator]'s known values. */ + enum class Known { + /** No restrictions */ + NO_RESTRICTIONS, + /** Restricted non-refundable ticket */ + RESTRICTED_NON_REFUNDABLE_TICKET, + } + /** + * An enum containing [RestrictedTicketIndicator]'s known values, as well as + * an [_UNKNOWN] member. + * + * An instance of [RestrictedTicketIndicator] can contain an unknown value + * in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** No restrictions */ + NO_RESTRICTIONS, + /** Restricted non-refundable ticket */ + RESTRICTED_NON_REFUNDABLE_TICKET, /** - * Sets [Builder.ticketDocumentNumber] to an arbitrary JSON value. - * - * You should usually call [Builder.ticketDocumentNumber] with a - * well-typed [String] value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. + * An enum member indicating that [RestrictedTicketIndicator] was + * instantiated with an unknown value. */ - fun ticketDocumentNumber(ticketDocumentNumber: JsonField) = - apply { - this.ticketDocumentNumber = ticketDocumentNumber - } - - fun additionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + _UNKNOWN, + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NO_RESTRICTIONS -> Value.NO_RESTRICTIONS + RESTRICTED_NON_REFUNDABLE_TICKET -> + Value.RESTRICTED_NON_REFUNDABLE_TICKET + else -> Value._UNKNOWN } - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + NO_RESTRICTIONS -> Known.NO_RESTRICTIONS + RESTRICTED_NON_REFUNDABLE_TICKET -> + Known.RESTRICTED_NON_REFUNDABLE_TICKET + else -> + throw IncreaseInvalidDataException( + "Unknown RestrictedTicketIndicator: $value" + ) } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") } - /** - * Returns an immutable instance of [Ancillary]. - * - * Further updates to this [Builder] will not mutate the returned - * instance. - * - * The following fields are required: - * ```java - * .connectedTicketDocumentNumber() - * .creditReasonIndicator() - * .passengerNameOrDescription() - * .services() - * .ticketDocumentNumber() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Ancillary = - Ancillary( - checkRequired( - "connectedTicketDocumentNumber", - connectedTicketDocumentNumber, - ), - checkRequired("creditReasonIndicator", creditReasonIndicator), - checkRequired( - "passengerNameOrDescription", - passengerNameOrDescription, - ), - checkRequired("services", services).map { it.toImmutable() }, - checkRequired("ticketDocumentNumber", ticketDocumentNumber), - additionalProperties.toMutableMap(), - ) - } - private var validated: Boolean = false - fun validate(): Ancillary = apply { + fun validate(): RestrictedTicketIndicator = apply { if (validated) { return@apply } - connectedTicketDocumentNumber() - creditReasonIndicator().ifPresent { it.validate() } - passengerNameOrDescription() - services().forEach { it.validate() } - ticketDocumentNumber() + known() validated = true } @@ -59195,791 +68605,773 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = - (if (connectedTicketDocumentNumber.asKnown().isPresent) 1 else 0) + - (creditReasonIndicator.asKnown().getOrNull()?.validity() ?: 0) + - (if (passengerNameOrDescription.asKnown().isPresent) 1 else 0) + - (services.asKnown().getOrNull()?.sumOf { it.validity().toInt() } - ?: 0) + - (if (ticketDocumentNumber.asKnown().isPresent) 1 else 0) + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - /** Indicates the reason for a credit to the cardholder. */ - class CreditReasonIndicator - @JsonCreator - private constructor(private val value: JsonField) : Enum { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from - * data that doesn't match any known member, and you want to know that - * value. For example, if the SDK is on an older version than the API, - * then the API may respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + return other is RestrictedTicketIndicator && value == other.value + } - companion object { + override fun hashCode() = value.hashCode() - /** No credit */ - @JvmField val NO_CREDIT = of("no_credit") + override fun toString() = value.toString() + } - /** Passenger transport ancillary purchase cancellation */ - @JvmField - val PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = - of("passenger_transport_ancillary_purchase_cancellation") + /** Indicates why a ticket was changed. */ + class TicketChangeIndicator + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** - * Airline ticket and passenger transport ancillary purchase - * cancellation - */ - @JvmField - val AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = - of( - "airline_ticket_and_passenger_transport_ancillary_purchase_cancellation" - ) + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** Other */ - @JvmField val OTHER = of("other") + companion object { - @JvmStatic - fun of(value: String) = CreditReasonIndicator(JsonField.of(value)) - } + /** None */ + @JvmField val NONE = of("none") - /** An enum containing [CreditReasonIndicator]'s known values. */ - enum class Known { - /** No credit */ - NO_CREDIT, - /** Passenger transport ancillary purchase cancellation */ - PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, - /** - * Airline ticket and passenger transport ancillary purchase - * cancellation - */ - AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, - /** Other */ - OTHER, - } + /** Change to existing ticket */ + @JvmField + val CHANGE_TO_EXISTING_TICKET = of("change_to_existing_ticket") - /** - * An enum containing [CreditReasonIndicator]'s known values, as well as - * an [_UNKNOWN] member. - * - * An instance of [CreditReasonIndicator] can contain an unknown value - * in a couple of cases: - * - It was deserialized from data that doesn't match any known member. - * For example, if the SDK is on an older version than the API, then - * the API may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** No credit */ - NO_CREDIT, - /** Passenger transport ancillary purchase cancellation */ - PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, - /** - * Airline ticket and passenger transport ancillary purchase - * cancellation - */ - AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, - /** Other */ - OTHER, - /** - * An enum member indicating that [CreditReasonIndicator] was - * instantiated with an unknown value. - */ - _UNKNOWN, - } + /** New ticket */ + @JvmField val NEW_TICKET = of("new_ticket") - /** - * Returns an enum member corresponding to this class instance's value, - * or [Value._UNKNOWN] if the class was instantiated with an unknown - * value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - NO_CREDIT -> Value.NO_CREDIT - PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> - Value.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION - AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> - Value - .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION - OTHER -> Value.OTHER - else -> Value._UNKNOWN - } + @JvmStatic + fun of(value: String) = TicketChangeIndicator(JsonField.of(value)) + } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is - * always known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value - * is a not a known member. - */ - fun known(): Known = - when (this) { - NO_CREDIT -> Known.NO_CREDIT - PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> - Known.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION - AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> - Known - .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION - OTHER -> Known.OTHER - else -> - throw IncreaseInvalidDataException( - "Unknown CreditReasonIndicator: $value" - ) - } + /** An enum containing [TicketChangeIndicator]'s known values. */ + enum class Known { + /** None */ + NONE, + /** Change to existing ticket */ + CHANGE_TO_EXISTING_TICKET, + /** New ticket */ + NEW_TICKET, + } + /** + * An enum containing [TicketChangeIndicator]'s known values, as well as an + * [_UNKNOWN] member. + * + * An instance of [TicketChangeIndicator] can contain an unknown value in a + * couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** None */ + NONE, + /** Change to existing ticket */ + CHANGE_TO_EXISTING_TICKET, + /** New ticket */ + NEW_TICKET, /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is - * primarily for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value - * does not have the expected primitive type. + * An enum member indicating that [TicketChangeIndicator] was + * instantiated with an unknown value. */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + _UNKNOWN, + } - private var validated: Boolean = false + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NONE -> Value.NONE + CHANGE_TO_EXISTING_TICKET -> Value.CHANGE_TO_EXISTING_TICKET + NEW_TICKET -> Value.NEW_TICKET + else -> Value._UNKNOWN + } - fun validate(): CreditReasonIndicator = apply { - if (validated) { - return@apply - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + NONE -> Known.NONE + CHANGE_TO_EXISTING_TICKET -> Known.CHANGE_TO_EXISTING_TICKET + NEW_TICKET -> Known.NEW_TICKET + else -> + throw IncreaseInvalidDataException( + "Unknown TicketChangeIndicator: $value" + ) + } - known() - validated = true + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + private var validated: Boolean = false - /** - * Returns a score indicating how many valid values are contained in - * this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + fun validate(): TicketChangeIndicator = apply { + if (validated) { + return@apply + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + known() + validated = true + } - return other is CreditReasonIndicator && value == other.value + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false } - override fun hashCode() = value.hashCode() + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - override fun toString() = value.toString() - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - class Service - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val category: JsonField, - private val subCategory: JsonField, - private val additionalProperties: MutableMap, - ) { + return other is TicketChangeIndicator && value == other.value + } - @JsonCreator - private constructor( - @JsonProperty("category") - @ExcludeMissing - category: JsonField = JsonMissing.of(), - @JsonProperty("sub_category") - @ExcludeMissing - subCategory: JsonField = JsonMissing.of(), - ) : this(category, subCategory, mutableMapOf()) + override fun hashCode() = value.hashCode() - /** - * Category of the ancillary service. - * - * @throws IncreaseInvalidDataException if the JSON field has an - * unexpected type (e.g. if the server responded with an unexpected - * value). - */ - fun category(): Optional = category.getOptional("category") + override fun toString() = value.toString() + } - /** - * Sub-category of the ancillary service, free-form. - * - * @throws IncreaseInvalidDataException if the JSON field has an - * unexpected type (e.g. if the server responded with an unexpected - * value). - */ - fun subCategory(): Optional = - subCategory.getOptional("sub_category") + class TripLeg + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val carrierCode: JsonField, + private val destinationCityAirportCode: JsonField, + private val fareBasisCode: JsonField, + private val flightNumber: JsonField, + private val serviceClass: JsonField, + private val stopOverCode: JsonField, + private val additionalProperties: MutableMap, + ) { - /** - * Returns the raw JSON value of [category]. - * - * Unlike [category], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("category") + @JsonCreator + private constructor( + @JsonProperty("carrier_code") @ExcludeMissing - fun _category(): JsonField = category - - /** - * Returns the raw JSON value of [subCategory]. - * - * Unlike [subCategory], this method doesn't throw if the JSON field has - * an unexpected type. - */ - @JsonProperty("sub_category") + carrierCode: JsonField = JsonMissing.of(), + @JsonProperty("destination_city_airport_code") @ExcludeMissing - fun _subCategory(): JsonField = subCategory + destinationCityAirportCode: JsonField = JsonMissing.of(), + @JsonProperty("fare_basis_code") + @ExcludeMissing + fareBasisCode: JsonField = JsonMissing.of(), + @JsonProperty("flight_number") + @ExcludeMissing + flightNumber: JsonField = JsonMissing.of(), + @JsonProperty("service_class") + @ExcludeMissing + serviceClass: JsonField = JsonMissing.of(), + @JsonProperty("stop_over_code") + @ExcludeMissing + stopOverCode: JsonField = JsonMissing.of(), + ) : this( + carrierCode, + destinationCityAirportCode, + fareBasisCode, + flightNumber, + serviceClass, + stopOverCode, + mutableMapOf(), + ) - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** + * Carrier code (e.g., United Airlines, Jet Blue, etc.). + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun carrierCode(): Optional = + carrierCode.getOptional("carrier_code") - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** + * Code for the destination city or airport. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun destinationCityAirportCode(): Optional = + destinationCityAirportCode.getOptional("destination_city_airport_code") - fun toBuilder() = Builder().from(this) + /** + * Fare basis code. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun fareBasisCode(): Optional = + fareBasisCode.getOptional("fare_basis_code") - companion object { + /** + * Flight number. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun flightNumber(): Optional = + flightNumber.getOptional("flight_number") - /** - * Returns a mutable builder for constructing an instance of - * [Service]. - * - * The following fields are required: - * ```java - * .category() - * .subCategory() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + /** + * Service class (e.g., first class, business class, etc.). + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun serviceClass(): Optional = + serviceClass.getOptional("service_class") - /** A builder for [Service]. */ - class Builder internal constructor() { + /** + * Indicates whether a stopover is allowed on this ticket. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun stopOverCode(): Optional = + stopOverCode.getOptional("stop_over_code") - private var category: JsonField? = null - private var subCategory: JsonField? = null - private var additionalProperties: MutableMap = - mutableMapOf() + /** + * Returns the raw JSON value of [carrierCode]. + * + * Unlike [carrierCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("carrier_code") + @ExcludeMissing + fun _carrierCode(): JsonField = carrierCode - @JvmSynthetic - internal fun from(service: Service) = apply { - category = service.category - subCategory = service.subCategory - additionalProperties = - service.additionalProperties.toMutableMap() - } + /** + * Returns the raw JSON value of [destinationCityAirportCode]. + * + * Unlike [destinationCityAirportCode], this method doesn't throw if the + * JSON field has an unexpected type. + */ + @JsonProperty("destination_city_airport_code") + @ExcludeMissing + fun _destinationCityAirportCode(): JsonField = + destinationCityAirportCode - /** Category of the ancillary service. */ - fun category(category: Category?) = - category(JsonField.ofNullable(category)) + /** + * Returns the raw JSON value of [fareBasisCode]. + * + * Unlike [fareBasisCode], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("fare_basis_code") + @ExcludeMissing + fun _fareBasisCode(): JsonField = fareBasisCode - /** - * Alias for calling [Builder.category] with - * `category.orElse(null)`. - */ - fun category(category: Optional) = - category(category.getOrNull()) + /** + * Returns the raw JSON value of [flightNumber]. + * + * Unlike [flightNumber], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("flight_number") + @ExcludeMissing + fun _flightNumber(): JsonField = flightNumber - /** - * Sets [Builder.category] to an arbitrary JSON value. - * - * You should usually call [Builder.category] with a well-typed - * [Category] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. - */ - fun category(category: JsonField) = apply { - this.category = category - } + /** + * Returns the raw JSON value of [serviceClass]. + * + * Unlike [serviceClass], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("service_class") + @ExcludeMissing + fun _serviceClass(): JsonField = serviceClass - /** Sub-category of the ancillary service, free-form. */ - fun subCategory(subCategory: String?) = - subCategory(JsonField.ofNullable(subCategory)) + /** + * Returns the raw JSON value of [stopOverCode]. + * + * Unlike [stopOverCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("stop_over_code") + @ExcludeMissing + fun _stopOverCode(): JsonField = stopOverCode - /** - * Alias for calling [Builder.subCategory] with - * `subCategory.orElse(null)`. - */ - fun subCategory(subCategory: Optional) = - subCategory(subCategory.getOrNull()) + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - /** - * Sets [Builder.subCategory] to an arbitrary JSON value. - * - * You should usually call [Builder.subCategory] with a well-typed - * [String] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun subCategory(subCategory: JsonField) = apply { - this.subCategory = subCategory - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - fun additionalProperties( - additionalProperties: Map - ) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun toBuilder() = Builder().from(this) - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + companion object { - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } + /** + * Returns a mutable builder for constructing an instance of [TripLeg]. + * + * The following fields are required: + * ```java + * .carrierCode() + * .destinationCityAirportCode() + * .fareBasisCode() + * .flightNumber() + * .serviceClass() + * .stopOverCode() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** A builder for [TripLeg]. */ + class Builder internal constructor() { - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + private var carrierCode: JsonField? = null + private var destinationCityAirportCode: JsonField? = null + private var fareBasisCode: JsonField? = null + private var flightNumber: JsonField? = null + private var serviceClass: JsonField? = null + private var stopOverCode: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() - /** - * Returns an immutable instance of [Service]. - * - * Further updates to this [Builder] will not mutate the returned - * instance. - * - * The following fields are required: - * ```java - * .category() - * .subCategory() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Service = - Service( - checkRequired("category", category), - checkRequired("subCategory", subCategory), - additionalProperties.toMutableMap(), - ) + @JvmSynthetic + internal fun from(tripLeg: TripLeg) = apply { + carrierCode = tripLeg.carrierCode + destinationCityAirportCode = tripLeg.destinationCityAirportCode + fareBasisCode = tripLeg.fareBasisCode + flightNumber = tripLeg.flightNumber + serviceClass = tripLeg.serviceClass + stopOverCode = tripLeg.stopOverCode + additionalProperties = tripLeg.additionalProperties.toMutableMap() } - private var validated: Boolean = false + /** Carrier code (e.g., United Airlines, Jet Blue, etc.). */ + fun carrierCode(carrierCode: String?) = + carrierCode(JsonField.ofNullable(carrierCode)) - fun validate(): Service = apply { - if (validated) { - return@apply - } + /** + * Alias for calling [Builder.carrierCode] with + * `carrierCode.orElse(null)`. + */ + fun carrierCode(carrierCode: Optional) = + carrierCode(carrierCode.getOrNull()) - category().ifPresent { it.validate() } - subCategory() - validated = true + /** + * Sets [Builder.carrierCode] to an arbitrary JSON value. + * + * You should usually call [Builder.carrierCode] with a well-typed + * [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun carrierCode(carrierCode: JsonField) = apply { + this.carrierCode = carrierCode } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** Code for the destination city or airport. */ + fun destinationCityAirportCode(destinationCityAirportCode: String?) = + destinationCityAirportCode( + JsonField.ofNullable(destinationCityAirportCode) + ) + + /** + * Alias for calling [Builder.destinationCityAirportCode] with + * `destinationCityAirportCode.orElse(null)`. + */ + fun destinationCityAirportCode( + destinationCityAirportCode: Optional + ) = destinationCityAirportCode(destinationCityAirportCode.getOrNull()) /** - * Returns a score indicating how many valid values are contained in - * this object recursively. + * Sets [Builder.destinationCityAirportCode] to an arbitrary JSON value. * - * Used for best match union deserialization. + * You should usually call [Builder.destinationCityAirportCode] with a + * well-typed [String] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. */ - @JvmSynthetic - internal fun validity(): Int = - (category.asKnown().getOrNull()?.validity() ?: 0) + - (if (subCategory.asKnown().isPresent) 1 else 0) - - /** Category of the ancillary service. */ - class Category - @JsonCreator - private constructor(private val value: JsonField) : Enum { + fun destinationCityAirportCode( + destinationCityAirportCode: JsonField + ) = apply { + this.destinationCityAirportCode = destinationCityAirportCode + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized - * from data that doesn't match any known member, and you want to - * know that value. For example, if the SDK is on an older version - * than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + /** Fare basis code. */ + fun fareBasisCode(fareBasisCode: String?) = + fareBasisCode(JsonField.ofNullable(fareBasisCode)) - companion object { + /** + * Alias for calling [Builder.fareBasisCode] with + * `fareBasisCode.orElse(null)`. + */ + fun fareBasisCode(fareBasisCode: Optional) = + fareBasisCode(fareBasisCode.getOrNull()) - /** None */ - @JvmField val NONE = of("none") + /** + * Sets [Builder.fareBasisCode] to an arbitrary JSON value. + * + * You should usually call [Builder.fareBasisCode] with a well-typed + * [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun fareBasisCode(fareBasisCode: JsonField) = apply { + this.fareBasisCode = fareBasisCode + } - /** Bundled service */ - @JvmField val BUNDLED_SERVICE = of("bundled_service") + /** Flight number. */ + fun flightNumber(flightNumber: String?) = + flightNumber(JsonField.ofNullable(flightNumber)) - /** Baggage fee */ - @JvmField val BAGGAGE_FEE = of("baggage_fee") + /** + * Alias for calling [Builder.flightNumber] with + * `flightNumber.orElse(null)`. + */ + fun flightNumber(flightNumber: Optional) = + flightNumber(flightNumber.getOrNull()) - /** Change fee */ - @JvmField val CHANGE_FEE = of("change_fee") + /** + * Sets [Builder.flightNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.flightNumber] with a well-typed + * [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun flightNumber(flightNumber: JsonField) = apply { + this.flightNumber = flightNumber + } - /** Cargo */ - @JvmField val CARGO = of("cargo") + /** Service class (e.g., first class, business class, etc.). */ + fun serviceClass(serviceClass: String?) = + serviceClass(JsonField.ofNullable(serviceClass)) - /** Carbon offset */ - @JvmField val CARBON_OFFSET = of("carbon_offset") + /** + * Alias for calling [Builder.serviceClass] with + * `serviceClass.orElse(null)`. + */ + fun serviceClass(serviceClass: Optional) = + serviceClass(serviceClass.getOrNull()) - /** Frequent flyer */ - @JvmField val FREQUENT_FLYER = of("frequent_flyer") + /** + * Sets [Builder.serviceClass] to an arbitrary JSON value. + * + * You should usually call [Builder.serviceClass] with a well-typed + * [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun serviceClass(serviceClass: JsonField) = apply { + this.serviceClass = serviceClass + } - /** Gift card */ - @JvmField val GIFT_CARD = of("gift_card") + /** Indicates whether a stopover is allowed on this ticket. */ + fun stopOverCode(stopOverCode: StopOverCode?) = + stopOverCode(JsonField.ofNullable(stopOverCode)) - /** Ground transport */ - @JvmField val GROUND_TRANSPORT = of("ground_transport") + /** + * Alias for calling [Builder.stopOverCode] with + * `stopOverCode.orElse(null)`. + */ + fun stopOverCode(stopOverCode: Optional) = + stopOverCode(stopOverCode.getOrNull()) - /** In-flight entertainment */ - @JvmField - val IN_FLIGHT_ENTERTAINMENT = of("in_flight_entertainment") + /** + * Sets [Builder.stopOverCode] to an arbitrary JSON value. + * + * You should usually call [Builder.stopOverCode] with a well-typed + * [StopOverCode] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ + fun stopOverCode(stopOverCode: JsonField) = apply { + this.stopOverCode = stopOverCode + } - /** Lounge */ - @JvmField val LOUNGE = of("lounge") + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** Medical */ - @JvmField val MEDICAL = of("medical") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** Meal beverage */ - @JvmField val MEAL_BEVERAGE = of("meal_beverage") + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } - /** Other */ - @JvmField val OTHER = of("other") + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** Passenger assist fee */ - @JvmField val PASSENGER_ASSIST_FEE = of("passenger_assist_fee") + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** Pets */ - @JvmField val PETS = of("pets") + /** + * Returns an immutable instance of [TripLeg]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + * + * The following fields are required: + * ```java + * .carrierCode() + * .destinationCityAirportCode() + * .fareBasisCode() + * .flightNumber() + * .serviceClass() + * .stopOverCode() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): TripLeg = + TripLeg( + checkRequired("carrierCode", carrierCode), + checkRequired( + "destinationCityAirportCode", + destinationCityAirportCode, + ), + checkRequired("fareBasisCode", fareBasisCode), + checkRequired("flightNumber", flightNumber), + checkRequired("serviceClass", serviceClass), + checkRequired("stopOverCode", stopOverCode), + additionalProperties.toMutableMap(), + ) + } - /** Seat fees */ - @JvmField val SEAT_FEES = of("seat_fees") + private var validated: Boolean = false - /** Standby */ - @JvmField val STANDBY = of("standby") + fun validate(): TripLeg = apply { + if (validated) { + return@apply + } - /** Service fee */ - @JvmField val SERVICE_FEE = of("service_fee") + carrierCode() + destinationCityAirportCode() + fareBasisCode() + flightNumber() + serviceClass() + stopOverCode().ifPresent { it.validate() } + validated = true + } - /** Store */ - @JvmField val STORE = of("store") + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** Travel service */ - @JvmField val TRAVEL_SERVICE = of("travel_service") + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (carrierCode.asKnown().isPresent) 1 else 0) + + (if (destinationCityAirportCode.asKnown().isPresent) 1 else 0) + + (if (fareBasisCode.asKnown().isPresent) 1 else 0) + + (if (flightNumber.asKnown().isPresent) 1 else 0) + + (if (serviceClass.asKnown().isPresent) 1 else 0) + + (stopOverCode.asKnown().getOrNull()?.validity() ?: 0) - /** Unaccompanied travel */ - @JvmField val UNACCOMPANIED_TRAVEL = of("unaccompanied_travel") + /** Indicates whether a stopover is allowed on this ticket. */ + class StopOverCode + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** Upgrades */ - @JvmField val UPGRADES = of("upgrades") + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from + * data that doesn't match any known member, and you want to know that + * value. For example, if the SDK is on an older version than the API, + * then the API may respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** Wi-fi */ - @JvmField val WIFI = of("wifi") + companion object { - @JvmStatic fun of(value: String) = Category(JsonField.of(value)) - } + /** None */ + @JvmField val NONE = of("none") - /** An enum containing [Category]'s known values. */ - enum class Known { - /** None */ - NONE, - /** Bundled service */ - BUNDLED_SERVICE, - /** Baggage fee */ - BAGGAGE_FEE, - /** Change fee */ - CHANGE_FEE, - /** Cargo */ - CARGO, - /** Carbon offset */ - CARBON_OFFSET, - /** Frequent flyer */ - FREQUENT_FLYER, - /** Gift card */ - GIFT_CARD, - /** Ground transport */ - GROUND_TRANSPORT, - /** In-flight entertainment */ - IN_FLIGHT_ENTERTAINMENT, - /** Lounge */ - LOUNGE, - /** Medical */ - MEDICAL, - /** Meal beverage */ - MEAL_BEVERAGE, - /** Other */ - OTHER, - /** Passenger assist fee */ - PASSENGER_ASSIST_FEE, - /** Pets */ - PETS, - /** Seat fees */ - SEAT_FEES, - /** Standby */ - STANDBY, - /** Service fee */ - SERVICE_FEE, - /** Store */ - STORE, - /** Travel service */ - TRAVEL_SERVICE, - /** Unaccompanied travel */ - UNACCOMPANIED_TRAVEL, - /** Upgrades */ - UPGRADES, - /** Wi-fi */ - WIFI, - } + /** Stop over allowed */ + @JvmField val STOP_OVER_ALLOWED = of("stop_over_allowed") - /** - * An enum containing [Category]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [Category] can contain an unknown value in a - * couple of cases: - * - It was deserialized from data that doesn't match any known - * member. For example, if the SDK is on an older version than the - * API, then the API may respond with new members that the SDK is - * unaware of. - * - It was constructed with an arbitrary value using the [of] - * method. - */ - enum class Value { - /** None */ - NONE, - /** Bundled service */ - BUNDLED_SERVICE, - /** Baggage fee */ - BAGGAGE_FEE, - /** Change fee */ - CHANGE_FEE, - /** Cargo */ - CARGO, - /** Carbon offset */ - CARBON_OFFSET, - /** Frequent flyer */ - FREQUENT_FLYER, - /** Gift card */ - GIFT_CARD, - /** Ground transport */ - GROUND_TRANSPORT, - /** In-flight entertainment */ - IN_FLIGHT_ENTERTAINMENT, - /** Lounge */ - LOUNGE, - /** Medical */ - MEDICAL, - /** Meal beverage */ - MEAL_BEVERAGE, - /** Other */ - OTHER, - /** Passenger assist fee */ - PASSENGER_ASSIST_FEE, - /** Pets */ - PETS, - /** Seat fees */ - SEAT_FEES, - /** Standby */ - STANDBY, - /** Service fee */ - SERVICE_FEE, - /** Store */ - STORE, - /** Travel service */ - TRAVEL_SERVICE, - /** Unaccompanied travel */ - UNACCOMPANIED_TRAVEL, - /** Upgrades */ - UPGRADES, - /** Wi-fi */ - WIFI, - /** - * An enum member indicating that [Category] was instantiated - * with an unknown value. - */ - _UNKNOWN, - } + /** Stop over not allowed */ + @JvmField val STOP_OVER_NOT_ALLOWED = of("stop_over_not_allowed") - /** - * Returns an enum member corresponding to this class instance's - * value, or [Value._UNKNOWN] if the class was instantiated with an - * unknown value. - * - * Use the [known] method instead if you're certain the value is - * always known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - NONE -> Value.NONE - BUNDLED_SERVICE -> Value.BUNDLED_SERVICE - BAGGAGE_FEE -> Value.BAGGAGE_FEE - CHANGE_FEE -> Value.CHANGE_FEE - CARGO -> Value.CARGO - CARBON_OFFSET -> Value.CARBON_OFFSET - FREQUENT_FLYER -> Value.FREQUENT_FLYER - GIFT_CARD -> Value.GIFT_CARD - GROUND_TRANSPORT -> Value.GROUND_TRANSPORT - IN_FLIGHT_ENTERTAINMENT -> Value.IN_FLIGHT_ENTERTAINMENT - LOUNGE -> Value.LOUNGE - MEDICAL -> Value.MEDICAL - MEAL_BEVERAGE -> Value.MEAL_BEVERAGE - OTHER -> Value.OTHER - PASSENGER_ASSIST_FEE -> Value.PASSENGER_ASSIST_FEE - PETS -> Value.PETS - SEAT_FEES -> Value.SEAT_FEES - STANDBY -> Value.STANDBY - SERVICE_FEE -> Value.SERVICE_FEE - STORE -> Value.STORE - TRAVEL_SERVICE -> Value.TRAVEL_SERVICE - UNACCOMPANIED_TRAVEL -> Value.UNACCOMPANIED_TRAVEL - UPGRADES -> Value.UPGRADES - WIFI -> Value.WIFI - else -> Value._UNKNOWN - } + @JvmStatic fun of(value: String) = StopOverCode(JsonField.of(value)) + } - /** - * Returns an enum member corresponding to this class instance's - * value. - * - * Use the [value] method instead if you're uncertain the value is - * always known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's - * value is a not a known member. - */ - fun known(): Known = - when (this) { - NONE -> Known.NONE - BUNDLED_SERVICE -> Known.BUNDLED_SERVICE - BAGGAGE_FEE -> Known.BAGGAGE_FEE - CHANGE_FEE -> Known.CHANGE_FEE - CARGO -> Known.CARGO - CARBON_OFFSET -> Known.CARBON_OFFSET - FREQUENT_FLYER -> Known.FREQUENT_FLYER - GIFT_CARD -> Known.GIFT_CARD - GROUND_TRANSPORT -> Known.GROUND_TRANSPORT - IN_FLIGHT_ENTERTAINMENT -> Known.IN_FLIGHT_ENTERTAINMENT - LOUNGE -> Known.LOUNGE - MEDICAL -> Known.MEDICAL - MEAL_BEVERAGE -> Known.MEAL_BEVERAGE - OTHER -> Known.OTHER - PASSENGER_ASSIST_FEE -> Known.PASSENGER_ASSIST_FEE - PETS -> Known.PETS - SEAT_FEES -> Known.SEAT_FEES - STANDBY -> Known.STANDBY - SERVICE_FEE -> Known.SERVICE_FEE - STORE -> Known.STORE - TRAVEL_SERVICE -> Known.TRAVEL_SERVICE - UNACCOMPANIED_TRAVEL -> Known.UNACCOMPANIED_TRAVEL - UPGRADES -> Known.UPGRADES - WIFI -> Known.WIFI - else -> - throw IncreaseInvalidDataException( - "Unknown Category: $value" - ) - } + /** An enum containing [StopOverCode]'s known values. */ + enum class Known { + /** None */ + NONE, + /** Stop over allowed */ + STOP_OVER_ALLOWED, + /** Stop over not allowed */ + STOP_OVER_NOT_ALLOWED, + } + /** + * An enum containing [StopOverCode]'s known values, as well as an + * [_UNKNOWN] member. + * + * An instance of [StopOverCode] can contain an unknown value in a + * couple of cases: + * - It was deserialized from data that doesn't match any known member. + * For example, if the SDK is on an older version than the API, then + * the API may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** None */ + NONE, + /** Stop over allowed */ + STOP_OVER_ALLOWED, + /** Stop over not allowed */ + STOP_OVER_NOT_ALLOWED, /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is - * primarily for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's - * value does not have the expected primitive type. + * An enum member indicating that [StopOverCode] was instantiated + * with an unknown value. */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Category = apply { - if (validated) { - return@apply - } + _UNKNOWN, + } - known() - validated = true + /** + * Returns an enum member corresponding to this class instance's value, + * or [Value._UNKNOWN] if the class was instantiated with an unknown + * value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NONE -> Value.NONE + STOP_OVER_ALLOWED -> Value.STOP_OVER_ALLOWED + STOP_OVER_NOT_ALLOWED -> Value.STOP_OVER_NOT_ALLOWED + else -> Value._UNKNOWN } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is + * always known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value + * is a not a known member. + */ + fun known(): Known = + when (this) { + NONE -> Known.NONE + STOP_OVER_ALLOWED -> Known.STOP_OVER_ALLOWED + STOP_OVER_NOT_ALLOWED -> Known.STOP_OVER_NOT_ALLOWED + else -> + throw IncreaseInvalidDataException( + "Unknown StopOverCode: $value" + ) + } - /** - * Returns a score indicating how many valid values are contained in - * this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - if (value() == Value._UNKNOWN) 0 else 1 + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is + * primarily for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value + * does not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + private var validated: Boolean = false - return other is Category && value == other.value + fun validate(): StopOverCode = apply { + if (validated) { + return@apply } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() + known() + validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in + * this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is Service && - category == other.category && - subCategory == other.subCategory && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(category, subCategory, additionalProperties) + return other is StopOverCode && value == other.value } - override fun hashCode(): Int = hashCode + override fun hashCode() = value.hashCode() - override fun toString() = - "Service{category=$category, subCategory=$subCategory, additionalProperties=$additionalProperties}" + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { @@ -59987,23 +69379,24 @@ private constructor( return true } - return other is Ancillary && - connectedTicketDocumentNumber == - other.connectedTicketDocumentNumber && - creditReasonIndicator == other.creditReasonIndicator && - passengerNameOrDescription == other.passengerNameOrDescription && - services == other.services && - ticketDocumentNumber == other.ticketDocumentNumber && + return other is TripLeg && + carrierCode == other.carrierCode && + destinationCityAirportCode == other.destinationCityAirportCode && + fareBasisCode == other.fareBasisCode && + flightNumber == other.flightNumber && + serviceClass == other.serviceClass && + stopOverCode == other.stopOverCode && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { Objects.hash( - connectedTicketDocumentNumber, - creditReasonIndicator, - passengerNameOrDescription, - services, - ticketDocumentNumber, + carrierCode, + destinationCityAirportCode, + fareBasisCode, + flightNumber, + serviceClass, + stopOverCode, additionalProperties, ) } @@ -60011,1199 +69404,1375 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Ancillary{connectedTicketDocumentNumber=$connectedTicketDocumentNumber, creditReasonIndicator=$creditReasonIndicator, passengerNameOrDescription=$passengerNameOrDescription, services=$services, ticketDocumentNumber=$ticketDocumentNumber, additionalProperties=$additionalProperties}" + "TripLeg{carrierCode=$carrierCode, destinationCityAirportCode=$destinationCityAirportCode, fareBasisCode=$fareBasisCode, flightNumber=$flightNumber, serviceClass=$serviceClass, stopOverCode=$stopOverCode, additionalProperties=$additionalProperties}" } - /** Indicates the reason for a credit to the cardholder. */ - class CreditReasonIndicator - @JsonCreator - private constructor(private val value: JsonField) : Enum { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + return other is Travel && + ancillary == other.ancillary && + computerizedReservationSystem == other.computerizedReservationSystem && + creditReasonIndicator == other.creditReasonIndicator && + departureDate == other.departureDate && + originationCityAirportCode == other.originationCityAirportCode && + passengerName == other.passengerName && + restrictedTicketIndicator == other.restrictedTicketIndicator && + ticketChangeIndicator == other.ticketChangeIndicator && + ticketNumber == other.ticketNumber && + travelAgencyCode == other.travelAgencyCode && + travelAgencyName == other.travelAgencyName && + tripLegs == other.tripLegs && + additionalProperties == other.additionalProperties + } - companion object { + private val hashCode: Int by lazy { + Objects.hash( + ancillary, + computerizedReservationSystem, + creditReasonIndicator, + departureDate, + originationCityAirportCode, + passengerName, + restrictedTicketIndicator, + ticketChangeIndicator, + ticketNumber, + travelAgencyCode, + travelAgencyName, + tripLegs, + additionalProperties, + ) + } - /** No credit */ - @JvmField val NO_CREDIT = of("no_credit") + override fun hashCode(): Int = hashCode - /** Passenger transport ancillary purchase cancellation */ - @JvmField - val PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = - of("passenger_transport_ancillary_purchase_cancellation") + override fun toString() = + "Travel{ancillary=$ancillary, computerizedReservationSystem=$computerizedReservationSystem, creditReasonIndicator=$creditReasonIndicator, departureDate=$departureDate, originationCityAirportCode=$originationCityAirportCode, passengerName=$passengerName, restrictedTicketIndicator=$restrictedTicketIndicator, ticketChangeIndicator=$ticketChangeIndicator, ticketNumber=$ticketNumber, travelAgencyCode=$travelAgencyCode, travelAgencyName=$travelAgencyName, tripLegs=$tripLegs, additionalProperties=$additionalProperties}" + } - /** - * Airline ticket and passenger transport ancillary purchase - * cancellation - */ - @JvmField - val AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = - of( - "airline_ticket_and_passenger_transport_ancillary_purchase_cancellation" - ) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** Airline ticket cancellation */ - @JvmField - val AIRLINE_TICKET_CANCELLATION = of("airline_ticket_cancellation") + return other is PurchaseDetails && + carRental == other.carRental && + customerReferenceIdentifier == other.customerReferenceIdentifier && + localTaxAmount == other.localTaxAmount && + localTaxCurrency == other.localTaxCurrency && + lodging == other.lodging && + nationalTaxAmount == other.nationalTaxAmount && + nationalTaxCurrency == other.nationalTaxCurrency && + purchaseIdentifier == other.purchaseIdentifier && + purchaseIdentifierFormat == other.purchaseIdentifierFormat && + travel == other.travel && + additionalProperties == other.additionalProperties + } - /** Other */ - @JvmField val OTHER = of("other") + private val hashCode: Int by lazy { + Objects.hash( + carRental, + customerReferenceIdentifier, + localTaxAmount, + localTaxCurrency, + lodging, + nationalTaxAmount, + nationalTaxCurrency, + purchaseIdentifier, + purchaseIdentifierFormat, + travel, + additionalProperties, + ) + } - /** Partial refund of airline ticket */ - @JvmField - val PARTIAL_REFUND_OF_AIRLINE_TICKET = - of("partial_refund_of_airline_ticket") + override fun hashCode(): Int = hashCode - @JvmStatic - fun of(value: String) = CreditReasonIndicator(JsonField.of(value)) - } + override fun toString() = + "PurchaseDetails{carRental=$carRental, customerReferenceIdentifier=$customerReferenceIdentifier, localTaxAmount=$localTaxAmount, localTaxCurrency=$localTaxCurrency, lodging=$lodging, nationalTaxAmount=$nationalTaxAmount, nationalTaxCurrency=$nationalTaxCurrency, purchaseIdentifier=$purchaseIdentifier, purchaseIdentifierFormat=$purchaseIdentifierFormat, travel=$travel, additionalProperties=$additionalProperties}" + } - /** An enum containing [CreditReasonIndicator]'s known values. */ - enum class Known { - /** No credit */ - NO_CREDIT, - /** Passenger transport ancillary purchase cancellation */ - PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, - /** - * Airline ticket and passenger transport ancillary purchase - * cancellation - */ - AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, - /** Airline ticket cancellation */ - AIRLINE_TICKET_CANCELLATION, - /** Other */ - OTHER, - /** Partial refund of airline ticket */ - PARTIAL_REFUND_OF_AIRLINE_TICKET, - } + class SchemeFee + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val amount: JsonField, + private val createdAt: JsonField, + private val currency: JsonField, + private val feeType: JsonField, + private val fixedComponent: JsonField, + private val variableRate: JsonField, + private val additionalProperties: MutableMap, + ) { - /** - * An enum containing [CreditReasonIndicator]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [CreditReasonIndicator] can contain an unknown value in a - * couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** No credit */ - NO_CREDIT, - /** Passenger transport ancillary purchase cancellation */ - PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, - /** - * Airline ticket and passenger transport ancillary purchase - * cancellation - */ - AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, - /** Airline ticket cancellation */ - AIRLINE_TICKET_CANCELLATION, - /** Other */ - OTHER, - /** Partial refund of airline ticket */ - PARTIAL_REFUND_OF_AIRLINE_TICKET, - /** - * An enum member indicating that [CreditReasonIndicator] was - * instantiated with an unknown value. - */ - _UNKNOWN, - } + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + createdAt: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("fee_type") + @ExcludeMissing + feeType: JsonField = JsonMissing.of(), + @JsonProperty("fixed_component") + @ExcludeMissing + fixedComponent: JsonField = JsonMissing.of(), + @JsonProperty("variable_rate") + @ExcludeMissing + variableRate: JsonField = JsonMissing.of(), + ) : this( + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, + mutableMapOf(), + ) - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - NO_CREDIT -> Value.NO_CREDIT - PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> - Value.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION - AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> - Value - .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION - AIRLINE_TICKET_CANCELLATION -> Value.AIRLINE_TICKET_CANCELLATION - OTHER -> Value.OTHER - PARTIAL_REFUND_OF_AIRLINE_TICKET -> - Value.PARTIAL_REFUND_OF_AIRLINE_TICKET - else -> Value._UNKNOWN - } + /** + * The fee amount given as a string containing a decimal number. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun amount(): String = amount.getRequired("amount") - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - NO_CREDIT -> Known.NO_CREDIT - PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> - Known.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION - AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> - Known - .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION - AIRLINE_TICKET_CANCELLATION -> Known.AIRLINE_TICKET_CANCELLATION - OTHER -> Known.OTHER - PARTIAL_REFUND_OF_AIRLINE_TICKET -> - Known.PARTIAL_REFUND_OF_AIRLINE_TICKET - else -> - throw IncreaseInvalidDataException( - "Unknown CreditReasonIndicator: $value" - ) - } + /** + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + * created. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun currency(): Currency = currency.getRequired("currency") - private var validated: Boolean = false + /** + * The type of fee being assessed. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun feeType(): FeeType = feeType.getRequired("fee_type") - fun validate(): CreditReasonIndicator = apply { - if (validated) { - return@apply - } + /** + * The fixed component of the fee, if applicable, given in major units of the fee + * amount. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun fixedComponent(): Optional = + fixedComponent.getOptional("fixed_component") - known() - validated = true - } + /** + * The variable rate component of the fee, if applicable, given as a decimal (e.g., + * 0.015 for 1.5%). + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun variableRate(): Optional = variableRate.getOptional("variable_rate") - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + /** + * Returns the raw JSON value of [createdAt]. + * + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("created_at") + @ExcludeMissing + fun _createdAt(): JsonField = createdAt + + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("currency") + @ExcludeMissing + fun _currency(): JsonField = currency + + /** + * Returns the raw JSON value of [feeType]. + * + * Unlike [feeType], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("fee_type") + @ExcludeMissing + fun _feeType(): JsonField = feeType + + /** + * Returns the raw JSON value of [fixedComponent]. + * + * Unlike [fixedComponent], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("fixed_component") + @ExcludeMissing + fun _fixedComponent(): JsonField = fixedComponent + + /** + * Returns the raw JSON value of [variableRate]. + * + * Unlike [variableRate], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("variable_rate") + @ExcludeMissing + fun _variableRate(): JsonField = variableRate + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Returns a mutable builder for constructing an instance of [SchemeFee]. + * + * The following fields are required: + * ```java + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - return other is CreditReasonIndicator && value == other.value - } + /** A builder for [SchemeFee]. */ + class Builder internal constructor() { - override fun hashCode() = value.hashCode() + private var amount: JsonField? = null + private var createdAt: JsonField? = null + private var currency: JsonField? = null + private var feeType: JsonField? = null + private var fixedComponent: JsonField? = null + private var variableRate: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - override fun toString() = value.toString() + @JvmSynthetic + internal fun from(schemeFee: SchemeFee) = apply { + amount = schemeFee.amount + createdAt = schemeFee.createdAt + currency = schemeFee.currency + feeType = schemeFee.feeType + fixedComponent = schemeFee.fixedComponent + variableRate = schemeFee.variableRate + additionalProperties = schemeFee.additionalProperties.toMutableMap() } - /** Indicates whether this ticket is non-refundable. */ - class RestrictedTicketIndicator - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + /** The fee amount given as a string containing a decimal number. */ + fun amount(amount: String) = amount(JsonField.of(amount)) - companion object { + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun amount(amount: JsonField) = apply { this.amount = amount } - /** No restrictions */ - @JvmField val NO_RESTRICTIONS = of("no_restrictions") + /** + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee + * was created. + */ + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - /** Restricted non-refundable ticket */ - @JvmField - val RESTRICTED_NON_REFUNDABLE_TICKET = - of("restricted_non_refundable_ticket") + /** + * Sets [Builder.createdAt] to an arbitrary JSON value. + * + * You should usually call [Builder.createdAt] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt + } - @JvmStatic - fun of(value: String) = RestrictedTicketIndicator(JsonField.of(value)) - } + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + */ + fun currency(currency: Currency) = currency(JsonField.of(currency)) - /** An enum containing [RestrictedTicketIndicator]'s known values. */ - enum class Known { - /** No restrictions */ - NO_RESTRICTIONS, - /** Restricted non-refundable ticket */ - RESTRICTED_NON_REFUNDABLE_TICKET, - } + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [Currency] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } - /** - * An enum containing [RestrictedTicketIndicator]'s known values, as well as - * an [_UNKNOWN] member. - * - * An instance of [RestrictedTicketIndicator] can contain an unknown value - * in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** No restrictions */ - NO_RESTRICTIONS, - /** Restricted non-refundable ticket */ - RESTRICTED_NON_REFUNDABLE_TICKET, - /** - * An enum member indicating that [RestrictedTicketIndicator] was - * instantiated with an unknown value. - */ - _UNKNOWN, - } + /** The type of fee being assessed. */ + fun feeType(feeType: FeeType) = feeType(JsonField.of(feeType)) - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - NO_RESTRICTIONS -> Value.NO_RESTRICTIONS - RESTRICTED_NON_REFUNDABLE_TICKET -> - Value.RESTRICTED_NON_REFUNDABLE_TICKET - else -> Value._UNKNOWN - } + /** + * Sets [Builder.feeType] to an arbitrary JSON value. + * + * You should usually call [Builder.feeType] with a well-typed [FeeType] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun feeType(feeType: JsonField) = apply { this.feeType = feeType } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - NO_RESTRICTIONS -> Known.NO_RESTRICTIONS - RESTRICTED_NON_REFUNDABLE_TICKET -> - Known.RESTRICTED_NON_REFUNDABLE_TICKET - else -> - throw IncreaseInvalidDataException( - "Unknown RestrictedTicketIndicator: $value" - ) - } + /** + * The fixed component of the fee, if applicable, given in major units of the + * fee amount. + */ + fun fixedComponent(fixedComponent: String?) = + fixedComponent(JsonField.ofNullable(fixedComponent)) - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + /** + * Alias for calling [Builder.fixedComponent] with + * `fixedComponent.orElse(null)`. + */ + fun fixedComponent(fixedComponent: Optional) = + fixedComponent(fixedComponent.getOrNull()) - private var validated: Boolean = false + /** + * Sets [Builder.fixedComponent] to an arbitrary JSON value. + * + * You should usually call [Builder.fixedComponent] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun fixedComponent(fixedComponent: JsonField) = apply { + this.fixedComponent = fixedComponent + } - fun validate(): RestrictedTicketIndicator = apply { - if (validated) { - return@apply - } + /** + * The variable rate component of the fee, if applicable, given as a decimal + * (e.g., 0.015 for 1.5%). + */ + fun variableRate(variableRate: String?) = + variableRate(JsonField.ofNullable(variableRate)) - known() - validated = true - } + /** + * Alias for calling [Builder.variableRate] with `variableRate.orElse(null)`. + */ + fun variableRate(variableRate: Optional) = + variableRate(variableRate.getOrNull()) - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * Sets [Builder.variableRate] to an arbitrary JSON value. + * + * You should usually call [Builder.variableRate] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun variableRate(variableRate: JsonField) = apply { + this.variableRate = variableRate + } - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - return other is RestrictedTicketIndicator && value == other.value + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) } - override fun hashCode() = value.hashCode() + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - override fun toString() = value.toString() + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } - /** Indicates why a ticket was changed. */ - class TicketChangeIndicator - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** + * Returns an immutable instance of [SchemeFee]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SchemeFee = + SchemeFee( + checkRequired("amount", amount), + checkRequired("createdAt", createdAt), + checkRequired("currency", currency), + checkRequired("feeType", feeType), + checkRequired("fixedComponent", fixedComponent), + checkRequired("variableRate", variableRate), + additionalProperties.toMutableMap(), + ) + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + private var validated: Boolean = false - companion object { + fun validate(): SchemeFee = apply { + if (validated) { + return@apply + } - /** None */ - @JvmField val NONE = of("none") + amount() + createdAt() + currency().validate() + feeType().validate() + fixedComponent() + variableRate() + validated = true + } - /** Change to existing ticket */ - @JvmField - val CHANGE_TO_EXISTING_TICKET = of("change_to_existing_ticket") + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** New ticket */ - @JvmField val NEW_TICKET = of("new_ticket") + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (currency.asKnown().getOrNull()?.validity() ?: 0) + + (feeType.asKnown().getOrNull()?.validity() ?: 0) + + (if (fixedComponent.asKnown().isPresent) 1 else 0) + + (if (variableRate.asKnown().isPresent) 1 else 0) - @JvmStatic - fun of(value: String) = TicketChangeIndicator(JsonField.of(value)) - } + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + */ + class Currency + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** An enum containing [TicketChangeIndicator]'s known values. */ - enum class Known { - /** None */ - NONE, - /** Change to existing ticket */ - CHANGE_TO_EXISTING_TICKET, - /** New ticket */ - NEW_TICKET, - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** - * An enum containing [TicketChangeIndicator]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [TicketChangeIndicator] can contain an unknown value in a - * couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** None */ - NONE, - /** Change to existing ticket */ - CHANGE_TO_EXISTING_TICKET, - /** New ticket */ - NEW_TICKET, - /** - * An enum member indicating that [TicketChangeIndicator] was - * instantiated with an unknown value. - */ - _UNKNOWN, - } + companion object { - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - NONE -> Value.NONE - CHANGE_TO_EXISTING_TICKET -> Value.CHANGE_TO_EXISTING_TICKET - NEW_TICKET -> Value.NEW_TICKET - else -> Value._UNKNOWN - } + /** US Dollar (USD) */ + @JvmField val USD = of("USD") - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - NONE -> Known.NONE - CHANGE_TO_EXISTING_TICKET -> Known.CHANGE_TO_EXISTING_TICKET - NEW_TICKET -> Known.NEW_TICKET - else -> - throw IncreaseInvalidDataException( - "Unknown TicketChangeIndicator: $value" - ) - } + @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) + } + + /** An enum containing [Currency]'s known values. */ + enum class Known { + /** US Dollar (USD) */ + USD + } + /** + * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Currency] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** US Dollar (USD) */ + USD, /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. + * An enum member indicating that [Currency] was instantiated with an + * unknown value. */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + _UNKNOWN, + } - private var validated: Boolean = false + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + USD -> Value.USD + else -> Value._UNKNOWN + } - fun validate(): TicketChangeIndicator = apply { - if (validated) { - return@apply - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + USD -> Known.USD + else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + } - known() - validated = true + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + private var validated: Boolean = false - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + fun validate(): Currency = apply { + if (validated) { + return@apply + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + known() + validated = true + } - return other is TicketChangeIndicator && value == other.value + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() + return other is Currency && value == other.value } - class TripLeg - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val carrierCode: JsonField, - private val destinationCityAirportCode: JsonField, - private val fareBasisCode: JsonField, - private val flightNumber: JsonField, - private val serviceClass: JsonField, - private val stopOverCode: JsonField, - private val additionalProperties: MutableMap, - ) { + override fun hashCode() = value.hashCode() - @JsonCreator - private constructor( - @JsonProperty("carrier_code") - @ExcludeMissing - carrierCode: JsonField = JsonMissing.of(), - @JsonProperty("destination_city_airport_code") - @ExcludeMissing - destinationCityAirportCode: JsonField = JsonMissing.of(), - @JsonProperty("fare_basis_code") - @ExcludeMissing - fareBasisCode: JsonField = JsonMissing.of(), - @JsonProperty("flight_number") - @ExcludeMissing - flightNumber: JsonField = JsonMissing.of(), - @JsonProperty("service_class") - @ExcludeMissing - serviceClass: JsonField = JsonMissing.of(), - @JsonProperty("stop_over_code") - @ExcludeMissing - stopOverCode: JsonField = JsonMissing.of(), - ) : this( - carrierCode, - destinationCityAirportCode, - fareBasisCode, - flightNumber, - serviceClass, - stopOverCode, - mutableMapOf(), - ) + override fun toString() = value.toString() + } + + /** The type of fee being assessed. */ + class FeeType + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { /** - * Carrier code (e.g., United Airlines, Jet Blue, etc.). - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. */ - fun carrierCode(): Optional = - carrierCode.getOptional("carrier_code") + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY = + of("visa_international_service_assessment_single_currency") /** - * Code for the destination city or airport. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. */ - fun destinationCityAirportCode(): Optional = - destinationCityAirportCode.getOptional("destination_city_airport_code") + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY = + of("visa_international_service_assessment_cross_currency") /** - * Fare basis code. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. */ - fun fareBasisCode(): Optional = - fareBasisCode.getOptional("fare_basis_code") + @JvmField + val VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE = + of("visa_authorization_domestic_point_of_sale") /** - * Flight number. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. */ - fun flightNumber(): Optional = - flightNumber.getOptional("flight_number") + @JvmField + val VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_international_point_of_sale") /** - * Service class (e.g., first class, business class, etc.). - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. */ - fun serviceClass(): Optional = - serviceClass.getOptional("service_class") + @JvmField + val VISA_AUTHORIZATION_CANADA_POINT_OF_SALE = + of("visa_authorization_canada_point_of_sale") /** - * Indicates whether a stopover is allowed on this ticket. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. */ - fun stopOverCode(): Optional = - stopOverCode.getOptional("stop_over_code") + @JvmField + val VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE = + of("visa_authorization_reversal_point_of_sale") /** - * Returns the raw JSON value of [carrierCode]. - * - * Unlike [carrierCode], this method doesn't throw if the JSON field has an - * unexpected type. + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. */ - @JsonProperty("carrier_code") - @ExcludeMissing - fun _carrierCode(): JsonField = carrierCode + @JvmField + val VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_reversal_international_point_of_sale") /** - * Returns the raw JSON value of [destinationCityAirportCode]. - * - * Unlike [destinationCityAirportCode], this method doesn't throw if the - * JSON field has an unexpected type. + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. */ - @JsonProperty("destination_city_airport_code") - @ExcludeMissing - fun _destinationCityAirportCode(): JsonField = - destinationCityAirportCode + @JvmField + val VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE = + of("visa_authorization_address_verification_service") /** - * Returns the raw JSON value of [fareBasisCode]. - * - * Unlike [fareBasisCode], this method doesn't throw if the JSON field has - * an unexpected type. + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). */ - @JsonProperty("fare_basis_code") - @ExcludeMissing - fun _fareBasisCode(): JsonField = fareBasisCode + @JvmField + val VISA_ADVANCED_AUTHORIZATION = of("visa_advanced_authorization") /** - * Returns the raw JSON value of [flightNumber]. - * - * Unlike [flightNumber], this method doesn't throw if the JSON field has an - * unexpected type. + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. */ - @JsonProperty("flight_number") - @ExcludeMissing - fun _flightNumber(): JsonField = flightNumber + @JvmField val VISA_MESSAGE_TRANSMISSION = of("visa_message_transmission") /** - * Returns the raw JSON value of [serviceClass]. - * - * Unlike [serviceClass], this method doesn't throw if the JSON field has an - * unexpected type. + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. */ - @JsonProperty("service_class") - @ExcludeMissing - fun _serviceClass(): JsonField = serviceClass + @JvmField + val VISA_ACCOUNT_VERIFICATION_DOMESTIC = + of("visa_account_verification_domestic") /** - * Returns the raw JSON value of [stopOverCode]. - * - * Unlike [stopOverCode], this method doesn't throw if the JSON field has an - * unexpected type. + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. */ - @JsonProperty("stop_over_code") - @ExcludeMissing - fun _stopOverCode(): JsonField = stopOverCode - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [TripLeg]. - * - * The following fields are required: - * ```java - * .carrierCode() - * .destinationCityAirportCode() - * .fareBasisCode() - * .flightNumber() - * .serviceClass() - * .stopOverCode() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [TripLeg]. */ - class Builder internal constructor() { - - private var carrierCode: JsonField? = null - private var destinationCityAirportCode: JsonField? = null - private var fareBasisCode: JsonField? = null - private var flightNumber: JsonField? = null - private var serviceClass: JsonField? = null - private var stopOverCode: JsonField? = null - private var additionalProperties: MutableMap = - mutableMapOf() - - @JvmSynthetic - internal fun from(tripLeg: TripLeg) = apply { - carrierCode = tripLeg.carrierCode - destinationCityAirportCode = tripLeg.destinationCityAirportCode - fareBasisCode = tripLeg.fareBasisCode - flightNumber = tripLeg.flightNumber - serviceClass = tripLeg.serviceClass - stopOverCode = tripLeg.stopOverCode - additionalProperties = tripLeg.additionalProperties.toMutableMap() - } - - /** Carrier code (e.g., United Airlines, Jet Blue, etc.). */ - fun carrierCode(carrierCode: String?) = - carrierCode(JsonField.ofNullable(carrierCode)) - - /** - * Alias for calling [Builder.carrierCode] with - * `carrierCode.orElse(null)`. - */ - fun carrierCode(carrierCode: Optional) = - carrierCode(carrierCode.getOrNull()) - - /** - * Sets [Builder.carrierCode] to an arbitrary JSON value. - * - * You should usually call [Builder.carrierCode] with a well-typed - * [String] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun carrierCode(carrierCode: JsonField) = apply { - this.carrierCode = carrierCode - } - - /** Code for the destination city or airport. */ - fun destinationCityAirportCode(destinationCityAirportCode: String?) = - destinationCityAirportCode( - JsonField.ofNullable(destinationCityAirportCode) - ) - - /** - * Alias for calling [Builder.destinationCityAirportCode] with - * `destinationCityAirportCode.orElse(null)`. - */ - fun destinationCityAirportCode( - destinationCityAirportCode: Optional - ) = destinationCityAirportCode(destinationCityAirportCode.getOrNull()) - - /** - * Sets [Builder.destinationCityAirportCode] to an arbitrary JSON value. - * - * You should usually call [Builder.destinationCityAirportCode] with a - * well-typed [String] value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. - */ - fun destinationCityAirportCode( - destinationCityAirportCode: JsonField - ) = apply { - this.destinationCityAirportCode = destinationCityAirportCode - } - - /** Fare basis code. */ - fun fareBasisCode(fareBasisCode: String?) = - fareBasisCode(JsonField.ofNullable(fareBasisCode)) - - /** - * Alias for calling [Builder.fareBasisCode] with - * `fareBasisCode.orElse(null)`. - */ - fun fareBasisCode(fareBasisCode: Optional) = - fareBasisCode(fareBasisCode.getOrNull()) - - /** - * Sets [Builder.fareBasisCode] to an arbitrary JSON value. - * - * You should usually call [Builder.fareBasisCode] with a well-typed - * [String] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun fareBasisCode(fareBasisCode: JsonField) = apply { - this.fareBasisCode = fareBasisCode - } - - /** Flight number. */ - fun flightNumber(flightNumber: String?) = - flightNumber(JsonField.ofNullable(flightNumber)) - - /** - * Alias for calling [Builder.flightNumber] with - * `flightNumber.orElse(null)`. - */ - fun flightNumber(flightNumber: Optional) = - flightNumber(flightNumber.getOrNull()) - - /** - * Sets [Builder.flightNumber] to an arbitrary JSON value. - * - * You should usually call [Builder.flightNumber] with a well-typed - * [String] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun flightNumber(flightNumber: JsonField) = apply { - this.flightNumber = flightNumber - } - - /** Service class (e.g., first class, business class, etc.). */ - fun serviceClass(serviceClass: String?) = - serviceClass(JsonField.ofNullable(serviceClass)) - - /** - * Alias for calling [Builder.serviceClass] with - * `serviceClass.orElse(null)`. - */ - fun serviceClass(serviceClass: Optional) = - serviceClass(serviceClass.getOrNull()) - - /** - * Sets [Builder.serviceClass] to an arbitrary JSON value. - * - * You should usually call [Builder.serviceClass] with a well-typed - * [String] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun serviceClass(serviceClass: JsonField) = apply { - this.serviceClass = serviceClass - } - - /** Indicates whether a stopover is allowed on this ticket. */ - fun stopOverCode(stopOverCode: StopOverCode?) = - stopOverCode(JsonField.ofNullable(stopOverCode)) - - /** - * Alias for calling [Builder.stopOverCode] with - * `stopOverCode.orElse(null)`. - */ - fun stopOverCode(stopOverCode: Optional) = - stopOverCode(stopOverCode.getOrNull()) - - /** - * Sets [Builder.stopOverCode] to an arbitrary JSON value. - * - * You should usually call [Builder.stopOverCode] with a well-typed - * [StopOverCode] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. - */ - fun stopOverCode(stopOverCode: JsonField) = apply { - this.stopOverCode = stopOverCode - } - - fun additionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [TripLeg]. - * - * Further updates to this [Builder] will not mutate the returned - * instance. - * - * The following fields are required: - * ```java - * .carrierCode() - * .destinationCityAirportCode() - * .fareBasisCode() - * .flightNumber() - * .serviceClass() - * .stopOverCode() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): TripLeg = - TripLeg( - checkRequired("carrierCode", carrierCode), - checkRequired( - "destinationCityAirportCode", - destinationCityAirportCode, - ), - checkRequired("fareBasisCode", fareBasisCode), - checkRequired("flightNumber", flightNumber), - checkRequired("serviceClass", serviceClass), - checkRequired("stopOverCode", stopOverCode), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): TripLeg = apply { - if (validated) { - return@apply - } - - carrierCode() - destinationCityAirportCode() - fareBasisCode() - flightNumber() - serviceClass() - stopOverCode().ifPresent { it.validate() } - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + @JvmField + val VISA_ACCOUNT_VERIFICATION_INTERNATIONAL = + of("visa_account_verification_international") /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. */ - @JvmSynthetic - internal fun validity(): Int = - (if (carrierCode.asKnown().isPresent) 1 else 0) + - (if (destinationCityAirportCode.asKnown().isPresent) 1 else 0) + - (if (fareBasisCode.asKnown().isPresent) 1 else 0) + - (if (flightNumber.asKnown().isPresent) 1 else 0) + - (if (serviceClass.asKnown().isPresent) 1 else 0) + - (stopOverCode.asKnown().getOrNull()?.validity() ?: 0) - - /** Indicates whether a stopover is allowed on this ticket. */ - class StopOverCode - @JsonCreator - private constructor(private val value: JsonField) : Enum { + @JvmField + val VISA_ACCOUNT_VERIFICATION_CANADA = + of("visa_account_verification_canada") - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from - * data that doesn't match any known member, and you want to know that - * value. For example, if the SDK is on an older version than the API, - * then the API may respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + @JvmField + val VISA_CORPORATE_ACCEPTANCE_FEE = of("visa_corporate_acceptance_fee") - companion object { + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + @JvmField + val VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE = + of("visa_consumer_debit_acceptance_fee") - /** None */ - @JvmField val NONE = of("none") + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + @JvmField + val VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE = + of("visa_business_debit_acceptance_fee") - /** Stop over allowed */ - @JvmField val STOP_OVER_ALLOWED = of("stop_over_allowed") + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + @JvmField + val VISA_PURCHASING_ACCEPTANCE_FEE = of("visa_purchasing_acceptance_fee") - /** Stop over not allowed */ - @JvmField val STOP_OVER_NOT_ALLOWED = of("stop_over_not_allowed") + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + @JvmField val VISA_PURCHASE_DOMESTIC = of("visa_purchase_domestic") - @JvmStatic fun of(value: String) = StopOverCode(JsonField.of(value)) - } + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + @JvmField + val VISA_PURCHASE_INTERNATIONAL = of("visa_purchase_international") - /** An enum containing [StopOverCode]'s known values. */ - enum class Known { - /** None */ - NONE, - /** Stop over allowed */ - STOP_OVER_ALLOWED, - /** Stop over not allowed */ - STOP_OVER_NOT_ALLOWED, - } + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_CREDIT_PURCHASE_TOKEN = of("visa_credit_purchase_token") - /** - * An enum containing [StopOverCode]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [StopOverCode] can contain an unknown value in a - * couple of cases: - * - It was deserialized from data that doesn't match any known member. - * For example, if the SDK is on an older version than the API, then - * the API may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** None */ - NONE, - /** Stop over allowed */ - STOP_OVER_ALLOWED, - /** Stop over not allowed */ - STOP_OVER_NOT_ALLOWED, - /** - * An enum member indicating that [StopOverCode] was instantiated - * with an unknown value. - */ - _UNKNOWN, - } + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_DEBIT_PURCHASE_TOKEN = of("visa_debit_purchase_token") - /** - * Returns an enum member corresponding to this class instance's value, - * or [Value._UNKNOWN] if the class was instantiated with an unknown - * value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - NONE -> Value.NONE - STOP_OVER_ALLOWED -> Value.STOP_OVER_ALLOWED - STOP_OVER_NOT_ALLOWED -> Value.STOP_OVER_NOT_ALLOWED - else -> Value._UNKNOWN - } + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + @JvmField val VISA_CLEARING_TRANSMISSION = of("visa_clearing_transmission") - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is - * always known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value - * is a not a known member. - */ - fun known(): Known = - when (this) { - NONE -> Known.NONE - STOP_OVER_ALLOWED -> Known.STOP_OVER_ALLOWED - STOP_OVER_NOT_ALLOWED -> Known.STOP_OVER_NOT_ALLOWED - else -> - throw IncreaseInvalidDataException( - "Unknown StopOverCode: $value" - ) - } + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + @JvmField val VISA_DIRECT_AUTHORIZATION = of("visa_direct_authorization") - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is - * primarily for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value - * does not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + @JvmField + val VISA_DIRECT_TRANSACTION_DOMESTIC = + of("visa_direct_transaction_domestic") - private var validated: Boolean = false + /** Issuer card service fee for Commercial Credit cards. */ + @JvmField + val VISA_SERVICE_COMMERCIAL_CREDIT = of("visa_service_commercial_credit") - fun validate(): StopOverCode = apply { - if (validated) { - return@apply - } + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + @JvmField + val VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT = + of("visa_advertising_service_commercial_credit") - known() - validated = true - } + /** Issuer Community Growth Acceleration Program Fee. */ + @JvmField + val VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM = + of("visa_community_growth_acceleration_program") - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** Issuer Processing Guarantee for Commercial Credit cards. */ + @JvmField + val VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT = + of("visa_processing_guarantee_commercial_credit") - /** - * Returns a score indicating how many valid values are contained in - * this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + @JvmField val PULSE_SWITCH_FEE = of("pulse_switch_fee") - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + @JvmStatic fun of(value: String) = FeeType(JsonField.of(value)) + } - return other is StopOverCode && value == other.value - } + /** An enum containing [FeeType]'s known values. */ + enum class Known { + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + VISA_ADVANCED_AUTHORIZATION, + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + VISA_MESSAGE_TRANSMISSION, + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_DOMESTIC, + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, + } - override fun hashCode() = value.hashCode() + /** + * An enum containing [FeeType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [FeeType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + VISA_ADVANCED_AUTHORIZATION, + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + VISA_MESSAGE_TRANSMISSION, + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_DOMESTIC, + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, + /** + * An enum member indicating that [FeeType] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } - override fun toString() = value.toString() + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Value.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Value.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Value.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Value.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Value.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Value.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Value.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Value.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Value.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Value.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Value.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Value.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Value.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Value.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Value.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Value.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Value.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Value.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Value.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Value.PULSE_SWITCH_FEE + else -> Value._UNKNOWN } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is TripLeg && - carrierCode == other.carrierCode && - destinationCityAirportCode == other.destinationCityAirportCode && - fareBasisCode == other.fareBasisCode && - flightNumber == other.flightNumber && - serviceClass == other.serviceClass && - stopOverCode == other.stopOverCode && - additionalProperties == other.additionalProperties + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Known.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Known.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Known.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Known.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Known.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Known.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Known.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Known.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Known.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Known.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Known.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Known.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Known.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Known.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Known.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Known.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Known.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Known.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Known.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Known.PULSE_SWITCH_FEE + else -> throw IncreaseInvalidDataException("Unknown FeeType: $value") } - private val hashCode: Int by lazy { - Objects.hash( - carrierCode, - destinationCityAirportCode, - fareBasisCode, - flightNumber, - serviceClass, - stopOverCode, - additionalProperties, - ) + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") } - override fun hashCode(): Int = hashCode + private var validated: Boolean = false - override fun toString() = - "TripLeg{carrierCode=$carrierCode, destinationCityAirportCode=$destinationCityAirportCode, fareBasisCode=$fareBasisCode, flightNumber=$flightNumber, serviceClass=$serviceClass, stopOverCode=$stopOverCode, additionalProperties=$additionalProperties}" + fun validate(): FeeType = apply { + if (validated) { + return@apply + } + + known() + validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is Travel && - ancillary == other.ancillary && - computerizedReservationSystem == other.computerizedReservationSystem && - creditReasonIndicator == other.creditReasonIndicator && - departureDate == other.departureDate && - originationCityAirportCode == other.originationCityAirportCode && - passengerName == other.passengerName && - restrictedTicketIndicator == other.restrictedTicketIndicator && - ticketChangeIndicator == other.ticketChangeIndicator && - ticketNumber == other.ticketNumber && - travelAgencyCode == other.travelAgencyCode && - travelAgencyName == other.travelAgencyName && - tripLegs == other.tripLegs && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - ancillary, - computerizedReservationSystem, - creditReasonIndicator, - departureDate, - originationCityAirportCode, - passengerName, - restrictedTicketIndicator, - ticketChangeIndicator, - ticketNumber, - travelAgencyCode, - travelAgencyName, - tripLegs, - additionalProperties, - ) + return other is FeeType && value == other.value } - override fun hashCode(): Int = hashCode + override fun hashCode() = value.hashCode() - override fun toString() = - "Travel{ancillary=$ancillary, computerizedReservationSystem=$computerizedReservationSystem, creditReasonIndicator=$creditReasonIndicator, departureDate=$departureDate, originationCityAirportCode=$originationCityAirportCode, passengerName=$passengerName, restrictedTicketIndicator=$restrictedTicketIndicator, ticketChangeIndicator=$ticketChangeIndicator, ticketNumber=$ticketNumber, travelAgencyCode=$travelAgencyCode, travelAgencyName=$travelAgencyName, tripLegs=$tripLegs, additionalProperties=$additionalProperties}" + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { @@ -61211,32 +70780,24 @@ private constructor( return true } - return other is PurchaseDetails && - carRental == other.carRental && - customerReferenceIdentifier == other.customerReferenceIdentifier && - localTaxAmount == other.localTaxAmount && - localTaxCurrency == other.localTaxCurrency && - lodging == other.lodging && - nationalTaxAmount == other.nationalTaxAmount && - nationalTaxCurrency == other.nationalTaxCurrency && - purchaseIdentifier == other.purchaseIdentifier && - purchaseIdentifierFormat == other.purchaseIdentifierFormat && - travel == other.travel && + return other is SchemeFee && + amount == other.amount && + createdAt == other.createdAt && + currency == other.currency && + feeType == other.feeType && + fixedComponent == other.fixedComponent && + variableRate == other.variableRate && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { Objects.hash( - carRental, - customerReferenceIdentifier, - localTaxAmount, - localTaxCurrency, - lodging, - nationalTaxAmount, - nationalTaxCurrency, - purchaseIdentifier, - purchaseIdentifierFormat, - travel, + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, additionalProperties, ) } @@ -61244,7 +70805,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PurchaseDetails{carRental=$carRental, customerReferenceIdentifier=$customerReferenceIdentifier, localTaxAmount=$localTaxAmount, localTaxCurrency=$localTaxCurrency, lodging=$lodging, nationalTaxAmount=$nationalTaxAmount, nationalTaxCurrency=$nationalTaxCurrency, purchaseIdentifier=$purchaseIdentifier, purchaseIdentifierFormat=$purchaseIdentifierFormat, travel=$travel, additionalProperties=$additionalProperties}" + "SchemeFee{amount=$amount, createdAt=$createdAt, currency=$currency, feeType=$feeType, fixedComponent=$fixedComponent, variableRate=$variableRate, additionalProperties=$additionalProperties}" } /** @@ -61398,6 +70959,7 @@ private constructor( presentmentAmount == other.presentmentAmount && presentmentCurrency == other.presentmentCurrency && purchaseDetails == other.purchaseDetails && + schemeFees == other.schemeFees && transactionId == other.transactionId && type == other.type && additionalProperties == other.additionalProperties @@ -61422,6 +70984,7 @@ private constructor( presentmentAmount, presentmentCurrency, purchaseDetails, + schemeFees, transactionId, type, additionalProperties, @@ -61431,7 +70994,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CardRefund{id=$id, amount=$amount, cardPaymentId=$cardPaymentId, cashback=$cashback, currency=$currency, interchange=$interchange, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantName=$merchantName, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkIdentifiers=$networkIdentifiers, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, purchaseDetails=$purchaseDetails, transactionId=$transactionId, type=$type, additionalProperties=$additionalProperties}" + "CardRefund{id=$id, amount=$amount, cardPaymentId=$cardPaymentId, cashback=$cashback, currency=$currency, interchange=$interchange, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantName=$merchantName, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkIdentifiers=$networkIdentifiers, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, purchaseDetails=$purchaseDetails, schemeFees=$schemeFees, transactionId=$transactionId, type=$type, additionalProperties=$additionalProperties}" } /** @@ -61459,6 +71022,7 @@ private constructor( private val reversalAmount: JsonField, private val reversalPresentmentAmount: JsonField, private val reversalReason: JsonField, + private val schemeFees: JsonField>, private val terminalId: JsonField, private val type: JsonField, private val updatedAuthorizationAmount: JsonField, @@ -61517,6 +71081,9 @@ private constructor( @JsonProperty("reversal_reason") @ExcludeMissing reversalReason: JsonField = JsonMissing.of(), + @JsonProperty("scheme_fees") + @ExcludeMissing + schemeFees: JsonField> = JsonMissing.of(), @JsonProperty("terminal_id") @ExcludeMissing terminalId: JsonField = JsonMissing.of(), @@ -61545,6 +71112,7 @@ private constructor( reversalAmount, reversalPresentmentAmount, reversalReason, + schemeFees, terminalId, type, updatedAuthorizationAmount, @@ -61716,6 +71284,15 @@ private constructor( fun reversalReason(): Optional = reversalReason.getOptional("reversal_reason") + /** + * The scheme fees associated with this card reversal. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun schemeFees(): List = schemeFees.getRequired("scheme_fees") + /** * The terminal identifier (commonly abbreviated as TID) of the terminal the card is * transacting with. @@ -61923,6 +71500,16 @@ private constructor( @ExcludeMissing fun _reversalReason(): JsonField = reversalReason + /** + * Returns the raw JSON value of [schemeFees]. + * + * Unlike [schemeFees], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("scheme_fees") + @ExcludeMissing + fun _schemeFees(): JsonField> = schemeFees + /** * Returns the raw JSON value of [terminalId]. * @@ -61997,6 +71584,7 @@ private constructor( * .reversalAmount() * .reversalPresentmentAmount() * .reversalReason() + * .schemeFees() * .terminalId() * .type() * .updatedAuthorizationAmount() @@ -62026,6 +71614,7 @@ private constructor( private var reversalAmount: JsonField? = null private var reversalPresentmentAmount: JsonField? = null private var reversalReason: JsonField? = null + private var schemeFees: JsonField>? = null private var terminalId: JsonField? = null private var type: JsonField? = null private var updatedAuthorizationAmount: JsonField? = null @@ -62051,6 +71640,7 @@ private constructor( reversalAmount = cardReversal.reversalAmount reversalPresentmentAmount = cardReversal.reversalPresentmentAmount reversalReason = cardReversal.reversalReason + schemeFees = cardReversal.schemeFees.map { it.toMutableList() } terminalId = cardReversal.terminalId type = cardReversal.type updatedAuthorizationAmount = cardReversal.updatedAuthorizationAmount @@ -62360,6 +71950,32 @@ private constructor( this.reversalReason = reversalReason } + /** The scheme fees associated with this card reversal. */ + fun schemeFees(schemeFees: List) = schemeFees(JsonField.of(schemeFees)) + + /** + * Sets [Builder.schemeFees] to an arbitrary JSON value. + * + * You should usually call [Builder.schemeFees] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun schemeFees(schemeFees: JsonField>) = apply { + this.schemeFees = schemeFees.map { it.toMutableList() } + } + + /** + * Adds a single [SchemeFee] to [schemeFees]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addSchemeFee(schemeFee: SchemeFee) = apply { + schemeFees = + (schemeFees ?: JsonField.of(mutableListOf())).also { + checkKnown("schemeFees", it).add(schemeFee) + } + } + /** * The terminal identifier (commonly abbreviated as TID) of the terminal the card is * transacting with. @@ -62485,6 +72101,7 @@ private constructor( * .reversalAmount() * .reversalPresentmentAmount() * .reversalReason() + * .schemeFees() * .terminalId() * .type() * .updatedAuthorizationAmount() @@ -62512,6 +72129,7 @@ private constructor( checkRequired("reversalAmount", reversalAmount), checkRequired("reversalPresentmentAmount", reversalPresentmentAmount), checkRequired("reversalReason", reversalReason), + checkRequired("schemeFees", schemeFees).map { it.toImmutable() }, checkRequired("terminalId", terminalId), checkRequired("type", type), checkRequired("updatedAuthorizationAmount", updatedAuthorizationAmount), @@ -62547,6 +72165,7 @@ private constructor( reversalAmount() reversalPresentmentAmount() reversalReason().ifPresent { it.validate() } + schemeFees().forEach { it.validate() } terminalId() type().validate() updatedAuthorizationAmount() @@ -62587,6 +72206,7 @@ private constructor( (if (reversalAmount.asKnown().isPresent) 1 else 0) + (if (reversalPresentmentAmount.asKnown().isPresent) 1 else 0) + (reversalReason.asKnown().getOrNull()?.validity() ?: 0) + + (schemeFees.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (terminalId.asKnown().isPresent) 1 else 0) + (type.asKnown().getOrNull()?.validity() ?: 0) + (if (updatedAuthorizationAmount.asKnown().isPresent) 1 else 0) + @@ -62633,10 +72253,146 @@ private constructor( * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - /** US Dollar (USD) */ - USD, + /** US Dollar (USD) */ + USD, + /** + * An enum member indicating that [Currency] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + USD -> Value.USD + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + USD -> Known.USD + else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Currency = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Currency && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** The card network used to process this card authorization. */ + class Network @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + /** Visa */ + @JvmField val VISA = of("visa") + + /** Pulse */ + @JvmField val PULSE = of("pulse") + + @JvmStatic fun of(value: String) = Network(JsonField.of(value)) + } + + /** An enum containing [Network]'s known values. */ + enum class Known { + /** Visa */ + VISA, + /** Pulse */ + PULSE, + } + + /** + * An enum containing [Network]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Network] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** Visa */ + VISA, + /** Pulse */ + PULSE, /** - * An enum member indicating that [Currency] was instantiated with an unknown + * An enum member indicating that [Network] was instantiated with an unknown * value. */ _UNKNOWN, @@ -62651,7 +72407,8 @@ private constructor( */ fun value(): Value = when (this) { - USD -> Value.USD + VISA -> Value.VISA + PULSE -> Value.PULSE else -> Value._UNKNOWN } @@ -62666,8 +72423,9 @@ private constructor( */ fun known(): Known = when (this) { - USD -> Known.USD - else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + VISA -> Known.VISA + PULSE -> Known.PULSE + else -> throw IncreaseInvalidDataException("Unknown Network: $value") } /** @@ -62686,7 +72444,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Currency = apply { + fun validate(): Network = apply { if (validated) { return@apply } @@ -62716,7 +72474,7 @@ private constructor( return true } - return other is Currency && value == other.value + return other is Network && value == other.value } override fun hashCode() = value.hashCode() @@ -62724,9 +72482,399 @@ private constructor( override fun toString() = value.toString() } - /** The card network used to process this card authorization. */ - class Network @JsonCreator private constructor(private val value: JsonField) : - Enum { + /** Network-specific identifiers for a specific request or transaction. */ + class NetworkIdentifiers + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val authorizationIdentificationResponse: JsonField, + private val retrievalReferenceNumber: JsonField, + private val traceNumber: JsonField, + private val transactionId: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("authorization_identification_response") + @ExcludeMissing + authorizationIdentificationResponse: JsonField = JsonMissing.of(), + @JsonProperty("retrieval_reference_number") + @ExcludeMissing + retrievalReferenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("trace_number") + @ExcludeMissing + traceNumber: JsonField = JsonMissing.of(), + @JsonProperty("transaction_id") + @ExcludeMissing + transactionId: JsonField = JsonMissing.of(), + ) : this( + authorizationIdentificationResponse, + retrievalReferenceNumber, + traceNumber, + transactionId, + mutableMapOf(), + ) + + /** + * The randomly generated 6-character Authorization Identification Response code + * sent back to the acquirer in an approved response. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun authorizationIdentificationResponse(): Optional = + authorizationIdentificationResponse.getOptional( + "authorization_identification_response" + ) + + /** + * A life-cycle identifier used across e.g., an authorization and a reversal. + * Expected to be unique per acquirer within a window of time. For some card + * networks the retrieval reference number includes the trace counter. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun retrievalReferenceNumber(): Optional = + retrievalReferenceNumber.getOptional("retrieval_reference_number") + + /** + * A counter used to verify an individual authorization. Expected to be unique per + * acquirer within a window of time. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun traceNumber(): Optional = traceNumber.getOptional("trace_number") + + /** + * A globally unique transaction identifier provided by the card network, used + * across multiple life-cycle requests. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun transactionId(): Optional = transactionId.getOptional("transaction_id") + + /** + * Returns the raw JSON value of [authorizationIdentificationResponse]. + * + * Unlike [authorizationIdentificationResponse], this method doesn't throw if the + * JSON field has an unexpected type. + */ + @JsonProperty("authorization_identification_response") + @ExcludeMissing + fun _authorizationIdentificationResponse(): JsonField = + authorizationIdentificationResponse + + /** + * Returns the raw JSON value of [retrievalReferenceNumber]. + * + * Unlike [retrievalReferenceNumber], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("retrieval_reference_number") + @ExcludeMissing + fun _retrievalReferenceNumber(): JsonField = retrievalReferenceNumber + + /** + * Returns the raw JSON value of [traceNumber]. + * + * Unlike [traceNumber], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("trace_number") + @ExcludeMissing + fun _traceNumber(): JsonField = traceNumber + + /** + * Returns the raw JSON value of [transactionId]. + * + * Unlike [transactionId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("transaction_id") + @ExcludeMissing + fun _transactionId(): JsonField = transactionId + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [NetworkIdentifiers]. + * + * The following fields are required: + * ```java + * .authorizationIdentificationResponse() + * .retrievalReferenceNumber() + * .traceNumber() + * .transactionId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [NetworkIdentifiers]. */ + class Builder internal constructor() { + + private var authorizationIdentificationResponse: JsonField? = null + private var retrievalReferenceNumber: JsonField? = null + private var traceNumber: JsonField? = null + private var transactionId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(networkIdentifiers: NetworkIdentifiers) = apply { + authorizationIdentificationResponse = + networkIdentifiers.authorizationIdentificationResponse + retrievalReferenceNumber = networkIdentifiers.retrievalReferenceNumber + traceNumber = networkIdentifiers.traceNumber + transactionId = networkIdentifiers.transactionId + additionalProperties = + networkIdentifiers.additionalProperties.toMutableMap() + } + + /** + * The randomly generated 6-character Authorization Identification Response code + * sent back to the acquirer in an approved response. + */ + fun authorizationIdentificationResponse( + authorizationIdentificationResponse: String? + ) = + authorizationIdentificationResponse( + JsonField.ofNullable(authorizationIdentificationResponse) + ) + + /** + * Alias for calling [Builder.authorizationIdentificationResponse] with + * `authorizationIdentificationResponse.orElse(null)`. + */ + fun authorizationIdentificationResponse( + authorizationIdentificationResponse: Optional + ) = + authorizationIdentificationResponse( + authorizationIdentificationResponse.getOrNull() + ) + + /** + * Sets [Builder.authorizationIdentificationResponse] to an arbitrary JSON + * value. + * + * You should usually call [Builder.authorizationIdentificationResponse] with a + * well-typed [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun authorizationIdentificationResponse( + authorizationIdentificationResponse: JsonField + ) = apply { + this.authorizationIdentificationResponse = + authorizationIdentificationResponse + } + + /** + * A life-cycle identifier used across e.g., an authorization and a reversal. + * Expected to be unique per acquirer within a window of time. For some card + * networks the retrieval reference number includes the trace counter. + */ + fun retrievalReferenceNumber(retrievalReferenceNumber: String?) = + retrievalReferenceNumber(JsonField.ofNullable(retrievalReferenceNumber)) + + /** + * Alias for calling [Builder.retrievalReferenceNumber] with + * `retrievalReferenceNumber.orElse(null)`. + */ + fun retrievalReferenceNumber(retrievalReferenceNumber: Optional) = + retrievalReferenceNumber(retrievalReferenceNumber.getOrNull()) + + /** + * Sets [Builder.retrievalReferenceNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.retrievalReferenceNumber] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun retrievalReferenceNumber(retrievalReferenceNumber: JsonField) = + apply { + this.retrievalReferenceNumber = retrievalReferenceNumber + } + + /** + * A counter used to verify an individual authorization. Expected to be unique + * per acquirer within a window of time. + */ + fun traceNumber(traceNumber: String?) = + traceNumber(JsonField.ofNullable(traceNumber)) + + /** Alias for calling [Builder.traceNumber] with `traceNumber.orElse(null)`. */ + fun traceNumber(traceNumber: Optional) = + traceNumber(traceNumber.getOrNull()) + + /** + * Sets [Builder.traceNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.traceNumber] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun traceNumber(traceNumber: JsonField) = apply { + this.traceNumber = traceNumber + } + + /** + * A globally unique transaction identifier provided by the card network, used + * across multiple life-cycle requests. + */ + fun transactionId(transactionId: String?) = + transactionId(JsonField.ofNullable(transactionId)) + + /** + * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`. + */ + fun transactionId(transactionId: Optional) = + transactionId(transactionId.getOrNull()) + + /** + * Sets [Builder.transactionId] to an arbitrary JSON value. + * + * You should usually call [Builder.transactionId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun transactionId(transactionId: JsonField) = apply { + this.transactionId = transactionId + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [NetworkIdentifiers]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .authorizationIdentificationResponse() + * .retrievalReferenceNumber() + * .traceNumber() + * .transactionId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): NetworkIdentifiers = + NetworkIdentifiers( + checkRequired( + "authorizationIdentificationResponse", + authorizationIdentificationResponse, + ), + checkRequired("retrievalReferenceNumber", retrievalReferenceNumber), + checkRequired("traceNumber", traceNumber), + checkRequired("transactionId", transactionId), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): NetworkIdentifiers = apply { + if (validated) { + return@apply + } + + authorizationIdentificationResponse() + retrievalReferenceNumber() + traceNumber() + transactionId() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (authorizationIdentificationResponse.asKnown().isPresent) 1 else 0) + + (if (retrievalReferenceNumber.asKnown().isPresent) 1 else 0) + + (if (traceNumber.asKnown().isPresent) 1 else 0) + + (if (transactionId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is NetworkIdentifiers && + authorizationIdentificationResponse == + other.authorizationIdentificationResponse && + retrievalReferenceNumber == other.retrievalReferenceNumber && + traceNumber == other.traceNumber && + transactionId == other.transactionId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + authorizationIdentificationResponse, + retrievalReferenceNumber, + traceNumber, + transactionId, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "NetworkIdentifiers{authorizationIdentificationResponse=$authorizationIdentificationResponse, retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}" + } + + /** Why this reversal was initiated. */ + class ReversalReason + @JsonCreator + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -62740,40 +72888,57 @@ private constructor( companion object { - /** Visa */ - @JvmField val VISA = of("visa") + /** The Card Reversal was initiated at the customer's request. */ + @JvmField val REVERSED_BY_CUSTOMER = of("reversed_by_customer") - /** Pulse */ - @JvmField val PULSE = of("pulse") + /** The Card Reversal was initiated by the network or acquirer. */ + @JvmField + val REVERSED_BY_NETWORK_OR_ACQUIRER = of("reversed_by_network_or_acquirer") - @JvmStatic fun of(value: String) = Network(JsonField.of(value)) + /** The Card Reversal was initiated by the point of sale device. */ + @JvmField val REVERSED_BY_POINT_OF_SALE = of("reversed_by_point_of_sale") + + /** The Card Reversal was a partial reversal, for any reason. */ + @JvmField val PARTIAL_REVERSAL = of("partial_reversal") + + @JvmStatic fun of(value: String) = ReversalReason(JsonField.of(value)) } - /** An enum containing [Network]'s known values. */ + /** An enum containing [ReversalReason]'s known values. */ enum class Known { - /** Visa */ - VISA, - /** Pulse */ - PULSE, + /** The Card Reversal was initiated at the customer's request. */ + REVERSED_BY_CUSTOMER, + /** The Card Reversal was initiated by the network or acquirer. */ + REVERSED_BY_NETWORK_OR_ACQUIRER, + /** The Card Reversal was initiated by the point of sale device. */ + REVERSED_BY_POINT_OF_SALE, + /** The Card Reversal was a partial reversal, for any reason. */ + PARTIAL_REVERSAL, } /** - * An enum containing [Network]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [ReversalReason]'s known values, as well as an [_UNKNOWN] + * member. * - * An instance of [Network] can contain an unknown value in a couple of cases: + * An instance of [ReversalReason] can contain an unknown value in a couple of + * cases: * - It was deserialized from data that doesn't match any known member. For example, * if the SDK is on an older version than the API, then the API may respond with * new members that the SDK is unaware of. * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - /** Visa */ - VISA, - /** Pulse */ - PULSE, + /** The Card Reversal was initiated at the customer's request. */ + REVERSED_BY_CUSTOMER, + /** The Card Reversal was initiated by the network or acquirer. */ + REVERSED_BY_NETWORK_OR_ACQUIRER, + /** The Card Reversal was initiated by the point of sale device. */ + REVERSED_BY_POINT_OF_SALE, + /** The Card Reversal was a partial reversal, for any reason. */ + PARTIAL_REVERSAL, /** - * An enum member indicating that [Network] was instantiated with an unknown - * value. + * An enum member indicating that [ReversalReason] was instantiated with an + * unknown value. */ _UNKNOWN, } @@ -62787,8 +72952,10 @@ private constructor( */ fun value(): Value = when (this) { - VISA -> Value.VISA - PULSE -> Value.PULSE + REVERSED_BY_CUSTOMER -> Value.REVERSED_BY_CUSTOMER + REVERSED_BY_NETWORK_OR_ACQUIRER -> Value.REVERSED_BY_NETWORK_OR_ACQUIRER + REVERSED_BY_POINT_OF_SALE -> Value.REVERSED_BY_POINT_OF_SALE + PARTIAL_REVERSAL -> Value.PARTIAL_REVERSAL else -> Value._UNKNOWN } @@ -62803,9 +72970,11 @@ private constructor( */ fun known(): Known = when (this) { - VISA -> Known.VISA - PULSE -> Known.PULSE - else -> throw IncreaseInvalidDataException("Unknown Network: $value") + REVERSED_BY_CUSTOMER -> Known.REVERSED_BY_CUSTOMER + REVERSED_BY_NETWORK_OR_ACQUIRER -> Known.REVERSED_BY_NETWORK_OR_ACQUIRER + REVERSED_BY_POINT_OF_SALE -> Known.REVERSED_BY_POINT_OF_SALE + PARTIAL_REVERSAL -> Known.PARTIAL_REVERSAL + else -> throw IncreaseInvalidDataException("Unknown ReversalReason: $value") } /** @@ -62824,7 +72993,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Network = apply { + fun validate(): ReversalReason = apply { if (validated) { return@apply } @@ -62854,7 +73023,7 @@ private constructor( return true } - return other is Network && value == other.value + return other is ReversalReason && value == other.value } override fun hashCode() = value.hashCode() @@ -62862,120 +73031,162 @@ private constructor( override fun toString() = value.toString() } - /** Network-specific identifiers for a specific request or transaction. */ - class NetworkIdentifiers + class SchemeFee @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val authorizationIdentificationResponse: JsonField, - private val retrievalReferenceNumber: JsonField, - private val traceNumber: JsonField, - private val transactionId: JsonField, + private val amount: JsonField, + private val createdAt: JsonField, + private val currency: JsonField, + private val feeType: JsonField, + private val fixedComponent: JsonField, + private val variableRate: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("authorization_identification_response") + @JsonProperty("amount") @ExcludeMissing - authorizationIdentificationResponse: JsonField = JsonMissing.of(), - @JsonProperty("retrieval_reference_number") + amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") @ExcludeMissing - retrievalReferenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("trace_number") + createdAt: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing - traceNumber: JsonField = JsonMissing.of(), - @JsonProperty("transaction_id") + currency: JsonField = JsonMissing.of(), + @JsonProperty("fee_type") + @ExcludeMissing + feeType: JsonField = JsonMissing.of(), + @JsonProperty("fixed_component") + @ExcludeMissing + fixedComponent: JsonField = JsonMissing.of(), + @JsonProperty("variable_rate") @ExcludeMissing - transactionId: JsonField = JsonMissing.of(), + variableRate: JsonField = JsonMissing.of(), ) : this( - authorizationIdentificationResponse, - retrievalReferenceNumber, - traceNumber, - transactionId, + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, mutableMapOf(), ) /** - * The randomly generated 6-character Authorization Identification Response code - * sent back to the acquirer in an approved response. + * The fee amount given as a string containing a decimal number. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). */ - fun authorizationIdentificationResponse(): Optional = - authorizationIdentificationResponse.getOptional( - "authorization_identification_response" - ) + fun amount(): String = amount.getRequired("amount") /** - * A life-cycle identifier used across e.g., an authorization and a reversal. - * Expected to be unique per acquirer within a window of time. For some card - * networks the retrieval reference number includes the trace counter. + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + * created. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). */ - fun retrievalReferenceNumber(): Optional = - retrievalReferenceNumber.getOptional("retrieval_reference_number") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") /** - * A counter used to verify an individual authorization. Expected to be unique per - * acquirer within a window of time. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun currency(): Currency = currency.getRequired("currency") + + /** + * The type of fee being assessed. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun feeType(): FeeType = feeType.getRequired("fee_type") + + /** + * The fixed component of the fee, if applicable, given in major units of the fee + * amount. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun traceNumber(): Optional = traceNumber.getOptional("trace_number") + fun fixedComponent(): Optional = + fixedComponent.getOptional("fixed_component") /** - * A globally unique transaction identifier provided by the card network, used - * across multiple life-cycle requests. + * The variable rate component of the fee, if applicable, given as a decimal (e.g., + * 0.015 for 1.5%). * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun transactionId(): Optional = transactionId.getOptional("transaction_id") + fun variableRate(): Optional = variableRate.getOptional("variable_rate") /** - * Returns the raw JSON value of [authorizationIdentificationResponse]. + * Returns the raw JSON value of [amount]. * - * Unlike [authorizationIdentificationResponse], this method doesn't throw if the - * JSON field has an unexpected type. + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("authorization_identification_response") + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + + /** + * Returns the raw JSON value of [createdAt]. + * + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("created_at") @ExcludeMissing - fun _authorizationIdentificationResponse(): JsonField = - authorizationIdentificationResponse + fun _createdAt(): JsonField = createdAt /** - * Returns the raw JSON value of [retrievalReferenceNumber]. + * Returns the raw JSON value of [currency]. * - * Unlike [retrievalReferenceNumber], this method doesn't throw if the JSON field - * has an unexpected type. + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("retrieval_reference_number") + @JsonProperty("currency") @ExcludeMissing - fun _retrievalReferenceNumber(): JsonField = retrievalReferenceNumber + fun _currency(): JsonField = currency /** - * Returns the raw JSON value of [traceNumber]. + * Returns the raw JSON value of [feeType]. * - * Unlike [traceNumber], this method doesn't throw if the JSON field has an + * Unlike [feeType], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("fee_type") + @ExcludeMissing + fun _feeType(): JsonField = feeType + + /** + * Returns the raw JSON value of [fixedComponent]. + * + * Unlike [fixedComponent], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("trace_number") + @JsonProperty("fixed_component") @ExcludeMissing - fun _traceNumber(): JsonField = traceNumber + fun _fixedComponent(): JsonField = fixedComponent /** - * Returns the raw JSON value of [transactionId]. + * Returns the raw JSON value of [variableRate]. * - * Unlike [transactionId], this method doesn't throw if the JSON field has an + * Unlike [variableRate], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("transaction_id") + @JsonProperty("variable_rate") @ExcludeMissing - fun _transactionId(): JsonField = transactionId + fun _variableRate(): JsonField = variableRate @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -62992,255 +73203,1139 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NetworkIdentifiers]. + * Returns a mutable builder for constructing an instance of [SchemeFee]. * * The following fields are required: * ```java - * .authorizationIdentificationResponse() - * .retrievalReferenceNumber() - * .traceNumber() - * .transactionId() + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [NetworkIdentifiers]. */ + /** A builder for [SchemeFee]. */ class Builder internal constructor() { - private var authorizationIdentificationResponse: JsonField? = null - private var retrievalReferenceNumber: JsonField? = null - private var traceNumber: JsonField? = null - private var transactionId: JsonField? = null + private var amount: JsonField? = null + private var createdAt: JsonField? = null + private var currency: JsonField? = null + private var feeType: JsonField? = null + private var fixedComponent: JsonField? = null + private var variableRate: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(networkIdentifiers: NetworkIdentifiers) = apply { - authorizationIdentificationResponse = - networkIdentifiers.authorizationIdentificationResponse - retrievalReferenceNumber = networkIdentifiers.retrievalReferenceNumber - traceNumber = networkIdentifiers.traceNumber - transactionId = networkIdentifiers.transactionId - additionalProperties = - networkIdentifiers.additionalProperties.toMutableMap() + internal fun from(schemeFee: SchemeFee) = apply { + amount = schemeFee.amount + createdAt = schemeFee.createdAt + currency = schemeFee.currency + feeType = schemeFee.feeType + fixedComponent = schemeFee.fixedComponent + variableRate = schemeFee.variableRate + additionalProperties = schemeFee.additionalProperties.toMutableMap() } + /** The fee amount given as a string containing a decimal number. */ + fun amount(amount: String) = amount(JsonField.of(amount)) + /** - * The randomly generated 6-character Authorization Identification Response code - * sent back to the acquirer in an approved response. + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - fun authorizationIdentificationResponse( - authorizationIdentificationResponse: String? - ) = - authorizationIdentificationResponse( - JsonField.ofNullable(authorizationIdentificationResponse) - ) + fun amount(amount: JsonField) = apply { this.amount = amount } /** - * Alias for calling [Builder.authorizationIdentificationResponse] with - * `authorizationIdentificationResponse.orElse(null)`. + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee + * was created. */ - fun authorizationIdentificationResponse( - authorizationIdentificationResponse: Optional - ) = - authorizationIdentificationResponse( - authorizationIdentificationResponse.getOrNull() + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + /** + * Sets [Builder.createdAt] to an arbitrary JSON value. + * + * You should usually call [Builder.createdAt] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt + } + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + */ + fun currency(currency: Currency) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [Currency] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } + + /** The type of fee being assessed. */ + fun feeType(feeType: FeeType) = feeType(JsonField.of(feeType)) + + /** + * Sets [Builder.feeType] to an arbitrary JSON value. + * + * You should usually call [Builder.feeType] with a well-typed [FeeType] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun feeType(feeType: JsonField) = apply { this.feeType = feeType } + + /** + * The fixed component of the fee, if applicable, given in major units of the + * fee amount. + */ + fun fixedComponent(fixedComponent: String?) = + fixedComponent(JsonField.ofNullable(fixedComponent)) + + /** + * Alias for calling [Builder.fixedComponent] with + * `fixedComponent.orElse(null)`. + */ + fun fixedComponent(fixedComponent: Optional) = + fixedComponent(fixedComponent.getOrNull()) + + /** + * Sets [Builder.fixedComponent] to an arbitrary JSON value. + * + * You should usually call [Builder.fixedComponent] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun fixedComponent(fixedComponent: JsonField) = apply { + this.fixedComponent = fixedComponent + } + + /** + * The variable rate component of the fee, if applicable, given as a decimal + * (e.g., 0.015 for 1.5%). + */ + fun variableRate(variableRate: String?) = + variableRate(JsonField.ofNullable(variableRate)) + + /** + * Alias for calling [Builder.variableRate] with `variableRate.orElse(null)`. + */ + fun variableRate(variableRate: Optional) = + variableRate(variableRate.getOrNull()) + + /** + * Sets [Builder.variableRate] to an arbitrary JSON value. + * + * You should usually call [Builder.variableRate] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun variableRate(variableRate: JsonField) = apply { + this.variableRate = variableRate + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [SchemeFee]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SchemeFee = + SchemeFee( + checkRequired("amount", amount), + checkRequired("createdAt", createdAt), + checkRequired("currency", currency), + checkRequired("feeType", feeType), + checkRequired("fixedComponent", fixedComponent), + checkRequired("variableRate", variableRate), + additionalProperties.toMutableMap(), ) + } + + private var validated: Boolean = false + + fun validate(): SchemeFee = apply { + if (validated) { + return@apply + } + + amount() + createdAt() + currency().validate() + feeType().validate() + fixedComponent() + variableRate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (currency.asKnown().getOrNull()?.validity() ?: 0) + + (feeType.asKnown().getOrNull()?.validity() ?: 0) + + (if (fixedComponent.asKnown().isPresent) 1 else 0) + + (if (variableRate.asKnown().isPresent) 1 else 0) + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + */ + class Currency + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** US Dollar (USD) */ + @JvmField val USD = of("USD") + + @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) + } + + /** An enum containing [Currency]'s known values. */ + enum class Known { + /** US Dollar (USD) */ + USD + } + + /** + * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Currency] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** US Dollar (USD) */ + USD, + /** + * An enum member indicating that [Currency] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + USD -> Value.USD + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + USD -> Known.USD + else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Currency = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Currency && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** The type of fee being assessed. */ + class FeeType + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY = + of("visa_international_service_assessment_single_currency") + + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY = + of("visa_international_service_assessment_cross_currency") + + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + @JvmField + val VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE = + of("visa_authorization_domestic_point_of_sale") + + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + @JvmField + val VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_international_point_of_sale") + + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + @JvmField + val VISA_AUTHORIZATION_CANADA_POINT_OF_SALE = + of("visa_authorization_canada_point_of_sale") + + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + @JvmField + val VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE = + of("visa_authorization_reversal_point_of_sale") + + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + @JvmField + val VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_reversal_international_point_of_sale") + + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + @JvmField + val VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE = + of("visa_authorization_address_verification_service") + + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + @JvmField + val VISA_ADVANCED_AUTHORIZATION = of("visa_advanced_authorization") + + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + @JvmField val VISA_MESSAGE_TRANSMISSION = of("visa_message_transmission") + + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_DOMESTIC = + of("visa_account_verification_domestic") + + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_INTERNATIONAL = + of("visa_account_verification_international") + + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_CANADA = + of("visa_account_verification_canada") + + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + @JvmField + val VISA_CORPORATE_ACCEPTANCE_FEE = of("visa_corporate_acceptance_fee") + + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + @JvmField + val VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE = + of("visa_consumer_debit_acceptance_fee") + + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + @JvmField + val VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE = + of("visa_business_debit_acceptance_fee") + + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + @JvmField + val VISA_PURCHASING_ACCEPTANCE_FEE = of("visa_purchasing_acceptance_fee") + + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + @JvmField val VISA_PURCHASE_DOMESTIC = of("visa_purchase_domestic") + + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + @JvmField + val VISA_PURCHASE_INTERNATIONAL = of("visa_purchase_international") + + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_CREDIT_PURCHASE_TOKEN = of("visa_credit_purchase_token") + + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_DEBIT_PURCHASE_TOKEN = of("visa_debit_purchase_token") + + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + @JvmField val VISA_CLEARING_TRANSMISSION = of("visa_clearing_transmission") + + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + @JvmField val VISA_DIRECT_AUTHORIZATION = of("visa_direct_authorization") + + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + @JvmField + val VISA_DIRECT_TRANSACTION_DOMESTIC = + of("visa_direct_transaction_domestic") - /** - * Sets [Builder.authorizationIdentificationResponse] to an arbitrary JSON - * value. - * - * You should usually call [Builder.authorizationIdentificationResponse] with a - * well-typed [String] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun authorizationIdentificationResponse( - authorizationIdentificationResponse: JsonField - ) = apply { - this.authorizationIdentificationResponse = - authorizationIdentificationResponse - } + /** Issuer card service fee for Commercial Credit cards. */ + @JvmField + val VISA_SERVICE_COMMERCIAL_CREDIT = of("visa_service_commercial_credit") - /** - * A life-cycle identifier used across e.g., an authorization and a reversal. - * Expected to be unique per acquirer within a window of time. For some card - * networks the retrieval reference number includes the trace counter. - */ - fun retrievalReferenceNumber(retrievalReferenceNumber: String?) = - retrievalReferenceNumber(JsonField.ofNullable(retrievalReferenceNumber)) + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + @JvmField + val VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT = + of("visa_advertising_service_commercial_credit") - /** - * Alias for calling [Builder.retrievalReferenceNumber] with - * `retrievalReferenceNumber.orElse(null)`. - */ - fun retrievalReferenceNumber(retrievalReferenceNumber: Optional) = - retrievalReferenceNumber(retrievalReferenceNumber.getOrNull()) + /** Issuer Community Growth Acceleration Program Fee. */ + @JvmField + val VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM = + of("visa_community_growth_acceleration_program") - /** - * Sets [Builder.retrievalReferenceNumber] to an arbitrary JSON value. - * - * You should usually call [Builder.retrievalReferenceNumber] with a well-typed - * [String] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun retrievalReferenceNumber(retrievalReferenceNumber: JsonField) = - apply { - this.retrievalReferenceNumber = retrievalReferenceNumber - } + /** Issuer Processing Guarantee for Commercial Credit cards. */ + @JvmField + val VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT = + of("visa_processing_guarantee_commercial_credit") - /** - * A counter used to verify an individual authorization. Expected to be unique - * per acquirer within a window of time. - */ - fun traceNumber(traceNumber: String?) = - traceNumber(JsonField.ofNullable(traceNumber)) + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + @JvmField val PULSE_SWITCH_FEE = of("pulse_switch_fee") - /** Alias for calling [Builder.traceNumber] with `traceNumber.orElse(null)`. */ - fun traceNumber(traceNumber: Optional) = - traceNumber(traceNumber.getOrNull()) + @JvmStatic fun of(value: String) = FeeType(JsonField.of(value)) + } + + /** An enum containing [FeeType]'s known values. */ + enum class Known { + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + VISA_ADVANCED_AUTHORIZATION, + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + VISA_MESSAGE_TRANSMISSION, + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_DOMESTIC, + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, + } /** - * Sets [Builder.traceNumber] to an arbitrary JSON value. + * An enum containing [FeeType]'s known values, as well as an [_UNKNOWN] member. * - * You should usually call [Builder.traceNumber] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * An instance of [FeeType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. */ - fun traceNumber(traceNumber: JsonField) = apply { - this.traceNumber = traceNumber + enum class Value { + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + VISA_ADVANCED_AUTHORIZATION, + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + VISA_MESSAGE_TRANSMISSION, + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_DOMESTIC, + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, + /** + * An enum member indicating that [FeeType] was instantiated with an unknown + * value. + */ + _UNKNOWN, } /** - * A globally unique transaction identifier provided by the card network, used - * across multiple life-cycle requests. + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. */ - fun transactionId(transactionId: String?) = - transactionId(JsonField.ofNullable(transactionId)) + fun value(): Value = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Value.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Value.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Value.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Value.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Value.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Value.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Value.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Value.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Value.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Value.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Value.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Value.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Value.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Value.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Value.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Value.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Value.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Value.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Value.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Value.PULSE_SWITCH_FEE + else -> Value._UNKNOWN + } /** - * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`. + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. */ - fun transactionId(transactionId: Optional) = - transactionId(transactionId.getOrNull()) + fun known(): Known = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Known.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Known.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Known.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Known.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Known.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Known.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Known.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Known.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Known.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Known.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Known.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Known.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Known.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Known.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Known.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Known.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Known.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Known.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Known.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Known.PULSE_SWITCH_FEE + else -> throw IncreaseInvalidDataException("Unknown FeeType: $value") + } /** - * Sets [Builder.transactionId] to an arbitrary JSON value. + * Returns this class instance's primitive wire representation. * - * You should usually call [Builder.transactionId] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. */ - fun transactionId(transactionId: JsonField) = apply { - this.transactionId = transactionId - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + private var validated: Boolean = false - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + fun validate(): FeeType = apply { + if (validated) { + return@apply } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + known() + validated = true } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } /** - * Returns an immutable instance of [NetworkIdentifiers]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .authorizationIdentificationResponse() - * .retrievalReferenceNumber() - * .traceNumber() - * .transactionId() - * ``` + * Returns a score indicating how many valid values are contained in this object + * recursively. * - * @throws IllegalStateException if any required field is unset. + * Used for best match union deserialization. */ - fun build(): NetworkIdentifiers = - NetworkIdentifiers( - checkRequired( - "authorizationIdentificationResponse", - authorizationIdentificationResponse, - ), - checkRequired("retrievalReferenceNumber", retrievalReferenceNumber), - checkRequired("traceNumber", traceNumber), - checkRequired("transactionId", transactionId), - additionalProperties.toMutableMap(), - ) - } + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - private var validated: Boolean = false + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun validate(): NetworkIdentifiers = apply { - if (validated) { - return@apply + return other is FeeType && value == other.value } - authorizationIdentificationResponse() - retrievalReferenceNumber() - traceNumber() - transactionId() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + override fun hashCode() = value.hashCode() - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (authorizationIdentificationResponse.asKnown().isPresent) 1 else 0) + - (if (retrievalReferenceNumber.asKnown().isPresent) 1 else 0) + - (if (traceNumber.asKnown().isPresent) 1 else 0) + - (if (transactionId.asKnown().isPresent) 1 else 0) + override fun toString() = value.toString() + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is NetworkIdentifiers && - authorizationIdentificationResponse == - other.authorizationIdentificationResponse && - retrievalReferenceNumber == other.retrievalReferenceNumber && - traceNumber == other.traceNumber && - transactionId == other.transactionId && + return other is SchemeFee && + amount == other.amount && + createdAt == other.createdAt && + currency == other.currency && + feeType == other.feeType && + fixedComponent == other.fixedComponent && + variableRate == other.variableRate && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { Objects.hash( - authorizationIdentificationResponse, - retrievalReferenceNumber, - traceNumber, - transactionId, + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, additionalProperties, ) } @@ -63248,167 +74343,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NetworkIdentifiers{authorizationIdentificationResponse=$authorizationIdentificationResponse, retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}" - } - - /** Why this reversal was initiated. */ - class ReversalReason - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - /** The Card Reversal was initiated at the customer's request. */ - @JvmField val REVERSED_BY_CUSTOMER = of("reversed_by_customer") - - /** The Card Reversal was initiated by the network or acquirer. */ - @JvmField - val REVERSED_BY_NETWORK_OR_ACQUIRER = of("reversed_by_network_or_acquirer") - - /** The Card Reversal was initiated by the point of sale device. */ - @JvmField val REVERSED_BY_POINT_OF_SALE = of("reversed_by_point_of_sale") - - /** The Card Reversal was a partial reversal, for any reason. */ - @JvmField val PARTIAL_REVERSAL = of("partial_reversal") - - @JvmStatic fun of(value: String) = ReversalReason(JsonField.of(value)) - } - - /** An enum containing [ReversalReason]'s known values. */ - enum class Known { - /** The Card Reversal was initiated at the customer's request. */ - REVERSED_BY_CUSTOMER, - /** The Card Reversal was initiated by the network or acquirer. */ - REVERSED_BY_NETWORK_OR_ACQUIRER, - /** The Card Reversal was initiated by the point of sale device. */ - REVERSED_BY_POINT_OF_SALE, - /** The Card Reversal was a partial reversal, for any reason. */ - PARTIAL_REVERSAL, - } - - /** - * An enum containing [ReversalReason]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ReversalReason] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** The Card Reversal was initiated at the customer's request. */ - REVERSED_BY_CUSTOMER, - /** The Card Reversal was initiated by the network or acquirer. */ - REVERSED_BY_NETWORK_OR_ACQUIRER, - /** The Card Reversal was initiated by the point of sale device. */ - REVERSED_BY_POINT_OF_SALE, - /** The Card Reversal was a partial reversal, for any reason. */ - PARTIAL_REVERSAL, - /** - * An enum member indicating that [ReversalReason] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - REVERSED_BY_CUSTOMER -> Value.REVERSED_BY_CUSTOMER - REVERSED_BY_NETWORK_OR_ACQUIRER -> Value.REVERSED_BY_NETWORK_OR_ACQUIRER - REVERSED_BY_POINT_OF_SALE -> Value.REVERSED_BY_POINT_OF_SALE - PARTIAL_REVERSAL -> Value.PARTIAL_REVERSAL - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - REVERSED_BY_CUSTOMER -> Known.REVERSED_BY_CUSTOMER - REVERSED_BY_NETWORK_OR_ACQUIRER -> Known.REVERSED_BY_NETWORK_OR_ACQUIRER - REVERSED_BY_POINT_OF_SALE -> Known.REVERSED_BY_POINT_OF_SALE - PARTIAL_REVERSAL -> Known.PARTIAL_REVERSAL - else -> throw IncreaseInvalidDataException("Unknown ReversalReason: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): ReversalReason = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ReversalReason && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() + "SchemeFee{amount=$amount, createdAt=$createdAt, currency=$currency, feeType=$feeType, fixedComponent=$fixedComponent, variableRate=$variableRate, additionalProperties=$additionalProperties}" } /** @@ -63562,6 +74497,7 @@ private constructor( reversalAmount == other.reversalAmount && reversalPresentmentAmount == other.reversalPresentmentAmount && reversalReason == other.reversalReason && + schemeFees == other.schemeFees && terminalId == other.terminalId && type == other.type && updatedAuthorizationAmount == other.updatedAuthorizationAmount && @@ -63589,6 +74525,7 @@ private constructor( reversalAmount, reversalPresentmentAmount, reversalReason, + schemeFees, terminalId, type, updatedAuthorizationAmount, @@ -63600,7 +74537,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CardReversal{id=$id, cardAuthorizationId=$cardAuthorizationId, currency=$currency, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, network=$network, networkIdentifiers=$networkIdentifiers, pendingTransactionId=$pendingTransactionId, presentmentCurrency=$presentmentCurrency, reversalAmount=$reversalAmount, reversalPresentmentAmount=$reversalPresentmentAmount, reversalReason=$reversalReason, terminalId=$terminalId, type=$type, updatedAuthorizationAmount=$updatedAuthorizationAmount, updatedAuthorizationPresentmentAmount=$updatedAuthorizationPresentmentAmount, additionalProperties=$additionalProperties}" + "CardReversal{id=$id, cardAuthorizationId=$cardAuthorizationId, currency=$currency, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, network=$network, networkIdentifiers=$networkIdentifiers, pendingTransactionId=$pendingTransactionId, presentmentCurrency=$presentmentCurrency, reversalAmount=$reversalAmount, reversalPresentmentAmount=$reversalPresentmentAmount, reversalReason=$reversalReason, schemeFees=$schemeFees, terminalId=$terminalId, type=$type, updatedAuthorizationAmount=$updatedAuthorizationAmount, updatedAuthorizationPresentmentAmount=$updatedAuthorizationPresentmentAmount, additionalProperties=$additionalProperties}" } /** @@ -63632,6 +74569,7 @@ private constructor( private val presentmentAmount: JsonField, private val presentmentCurrency: JsonField, private val purchaseDetails: JsonField, + private val schemeFees: JsonField>, private val surcharge: JsonField, private val transactionId: JsonField, private val type: JsonField, @@ -63696,6 +74634,9 @@ private constructor( @JsonProperty("purchase_details") @ExcludeMissing purchaseDetails: JsonField = JsonMissing.of(), + @JsonProperty("scheme_fees") + @ExcludeMissing + schemeFees: JsonField> = JsonMissing.of(), @JsonProperty("surcharge") @ExcludeMissing surcharge: JsonField = JsonMissing.of(), @@ -63724,6 +74665,7 @@ private constructor( presentmentAmount, presentmentCurrency, purchaseDetails, + schemeFees, surcharge, transactionId, type, @@ -63916,6 +74858,15 @@ private constructor( fun purchaseDetails(): Optional = purchaseDetails.getOptional("purchase_details") + /** + * The scheme fees associated with this card settlement. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun schemeFees(): List = schemeFees.getRequired("scheme_fees") + /** * Surcharge amount details, if applicable. The amount is positive if the surcharge is * added to the overall transaction amount (surcharge), and negative if the surcharge is @@ -64136,6 +75087,16 @@ private constructor( @ExcludeMissing fun _purchaseDetails(): JsonField = purchaseDetails + /** + * Returns the raw JSON value of [schemeFees]. + * + * Unlike [schemeFees], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("scheme_fees") + @ExcludeMissing + fun _schemeFees(): JsonField> = schemeFees + /** * Returns the raw JSON value of [surcharge]. * @@ -64202,6 +75163,7 @@ private constructor( * .presentmentAmount() * .presentmentCurrency() * .purchaseDetails() + * .schemeFees() * .surcharge() * .transactionId() * .type() @@ -64233,6 +75195,7 @@ private constructor( private var presentmentAmount: JsonField? = null private var presentmentCurrency: JsonField? = null private var purchaseDetails: JsonField? = null + private var schemeFees: JsonField>? = null private var surcharge: JsonField? = null private var transactionId: JsonField? = null private var type: JsonField? = null @@ -64260,6 +75223,7 @@ private constructor( presentmentAmount = cardSettlement.presentmentAmount presentmentCurrency = cardSettlement.presentmentCurrency purchaseDetails = cardSettlement.purchaseDetails + schemeFees = cardSettlement.schemeFees.map { it.toMutableList() } surcharge = cardSettlement.surcharge transactionId = cardSettlement.transactionId type = cardSettlement.type @@ -64610,6 +75574,32 @@ private constructor( this.purchaseDetails = purchaseDetails } + /** The scheme fees associated with this card settlement. */ + fun schemeFees(schemeFees: List) = schemeFees(JsonField.of(schemeFees)) + + /** + * Sets [Builder.schemeFees] to an arbitrary JSON value. + * + * You should usually call [Builder.schemeFees] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun schemeFees(schemeFees: JsonField>) = apply { + this.schemeFees = schemeFees.map { it.toMutableList() } + } + + /** + * Adds a single [SchemeFee] to [schemeFees]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addSchemeFee(schemeFee: SchemeFee) = apply { + schemeFees = + (schemeFees ?: JsonField.of(mutableListOf())).also { + checkKnown("schemeFees", it).add(schemeFee) + } + } + /** * Surcharge amount details, if applicable. The amount is positive if the surcharge * is added to the overall transaction amount (surcharge), and negative if the @@ -64710,6 +75700,7 @@ private constructor( * .presentmentAmount() * .presentmentCurrency() * .purchaseDetails() + * .schemeFees() * .surcharge() * .transactionId() * .type() @@ -64739,6 +75730,7 @@ private constructor( checkRequired("presentmentAmount", presentmentAmount), checkRequired("presentmentCurrency", presentmentCurrency), checkRequired("purchaseDetails", purchaseDetails), + checkRequired("schemeFees", schemeFees).map { it.toImmutable() }, checkRequired("surcharge", surcharge), checkRequired("transactionId", transactionId), checkRequired("type", type), @@ -64773,6 +75765,7 @@ private constructor( presentmentAmount() presentmentCurrency() purchaseDetails().ifPresent { it.validate() } + schemeFees().forEach { it.validate() } surcharge().ifPresent { it.validate() } transactionId() type().validate() @@ -64815,6 +75808,7 @@ private constructor( (if (presentmentAmount.asKnown().isPresent) 1 else 0) + (if (presentmentCurrency.asKnown().isPresent) 1 else 0) + (purchaseDetails.asKnown().getOrNull()?.validity() ?: 0) + + (schemeFees.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (surcharge.asKnown().getOrNull()?.validity() ?: 0) + (if (transactionId.asKnown().isPresent) 1 else 0) + (type.asKnown().getOrNull()?.validity() ?: 0) @@ -71885,291 +82879,1047 @@ private constructor( ) } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is - * primarily for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's - * value does not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is + * primarily for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's + * value does not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Category = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in + * this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Category && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Service && + category == other.category && + subCategory == other.subCategory && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(category, subCategory, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Service{category=$category, subCategory=$subCategory, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Ancillary && + connectedTicketDocumentNumber == + other.connectedTicketDocumentNumber && + creditReasonIndicator == other.creditReasonIndicator && + passengerNameOrDescription == other.passengerNameOrDescription && + services == other.services && + ticketDocumentNumber == other.ticketDocumentNumber && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + connectedTicketDocumentNumber, + creditReasonIndicator, + passengerNameOrDescription, + services, + ticketDocumentNumber, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Ancillary{connectedTicketDocumentNumber=$connectedTicketDocumentNumber, creditReasonIndicator=$creditReasonIndicator, passengerNameOrDescription=$passengerNameOrDescription, services=$services, ticketDocumentNumber=$ticketDocumentNumber, additionalProperties=$additionalProperties}" + } + + /** Indicates the reason for a credit to the cardholder. */ + class CreditReasonIndicator + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** No credit */ + @JvmField val NO_CREDIT = of("no_credit") + + /** Passenger transport ancillary purchase cancellation */ + @JvmField + val PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = + of("passenger_transport_ancillary_purchase_cancellation") + + /** + * Airline ticket and passenger transport ancillary purchase + * cancellation + */ + @JvmField + val AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = + of( + "airline_ticket_and_passenger_transport_ancillary_purchase_cancellation" + ) + + /** Airline ticket cancellation */ + @JvmField + val AIRLINE_TICKET_CANCELLATION = of("airline_ticket_cancellation") + + /** Other */ + @JvmField val OTHER = of("other") + + /** Partial refund of airline ticket */ + @JvmField + val PARTIAL_REFUND_OF_AIRLINE_TICKET = + of("partial_refund_of_airline_ticket") + + @JvmStatic + fun of(value: String) = CreditReasonIndicator(JsonField.of(value)) + } + + /** An enum containing [CreditReasonIndicator]'s known values. */ + enum class Known { + /** No credit */ + NO_CREDIT, + /** Passenger transport ancillary purchase cancellation */ + PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, + /** + * Airline ticket and passenger transport ancillary purchase + * cancellation + */ + AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, + /** Airline ticket cancellation */ + AIRLINE_TICKET_CANCELLATION, + /** Other */ + OTHER, + /** Partial refund of airline ticket */ + PARTIAL_REFUND_OF_AIRLINE_TICKET, + } + + /** + * An enum containing [CreditReasonIndicator]'s known values, as well as an + * [_UNKNOWN] member. + * + * An instance of [CreditReasonIndicator] can contain an unknown value in a + * couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** No credit */ + NO_CREDIT, + /** Passenger transport ancillary purchase cancellation */ + PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, + /** + * Airline ticket and passenger transport ancillary purchase + * cancellation + */ + AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, + /** Airline ticket cancellation */ + AIRLINE_TICKET_CANCELLATION, + /** Other */ + OTHER, + /** Partial refund of airline ticket */ + PARTIAL_REFUND_OF_AIRLINE_TICKET, + /** + * An enum member indicating that [CreditReasonIndicator] was + * instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NO_CREDIT -> Value.NO_CREDIT + PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> + Value.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION + AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> + Value + .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION + AIRLINE_TICKET_CANCELLATION -> Value.AIRLINE_TICKET_CANCELLATION + OTHER -> Value.OTHER + PARTIAL_REFUND_OF_AIRLINE_TICKET -> + Value.PARTIAL_REFUND_OF_AIRLINE_TICKET + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + NO_CREDIT -> Known.NO_CREDIT + PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> + Known.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION + AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> + Known + .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION + AIRLINE_TICKET_CANCELLATION -> Known.AIRLINE_TICKET_CANCELLATION + OTHER -> Known.OTHER + PARTIAL_REFUND_OF_AIRLINE_TICKET -> + Known.PARTIAL_REFUND_OF_AIRLINE_TICKET + else -> + throw IncreaseInvalidDataException( + "Unknown CreditReasonIndicator: $value" + ) + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): CreditReasonIndicator = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is CreditReasonIndicator && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Indicates whether this ticket is non-refundable. */ + class RestrictedTicketIndicator + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** No restrictions */ + @JvmField val NO_RESTRICTIONS = of("no_restrictions") + + /** Restricted non-refundable ticket */ + @JvmField + val RESTRICTED_NON_REFUNDABLE_TICKET = + of("restricted_non_refundable_ticket") + + @JvmStatic + fun of(value: String) = RestrictedTicketIndicator(JsonField.of(value)) + } + + /** An enum containing [RestrictedTicketIndicator]'s known values. */ + enum class Known { + /** No restrictions */ + NO_RESTRICTIONS, + /** Restricted non-refundable ticket */ + RESTRICTED_NON_REFUNDABLE_TICKET, + } + + /** + * An enum containing [RestrictedTicketIndicator]'s known values, as well as + * an [_UNKNOWN] member. + * + * An instance of [RestrictedTicketIndicator] can contain an unknown value + * in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** No restrictions */ + NO_RESTRICTIONS, + /** Restricted non-refundable ticket */ + RESTRICTED_NON_REFUNDABLE_TICKET, + /** + * An enum member indicating that [RestrictedTicketIndicator] was + * instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NO_RESTRICTIONS -> Value.NO_RESTRICTIONS + RESTRICTED_NON_REFUNDABLE_TICKET -> + Value.RESTRICTED_NON_REFUNDABLE_TICKET + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + NO_RESTRICTIONS -> Known.NO_RESTRICTIONS + RESTRICTED_NON_REFUNDABLE_TICKET -> + Known.RESTRICTED_NON_REFUNDABLE_TICKET + else -> + throw IncreaseInvalidDataException( + "Unknown RestrictedTicketIndicator: $value" + ) + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false - private var validated: Boolean = false + fun validate(): RestrictedTicketIndicator = apply { + if (validated) { + return@apply + } - fun validate(): Category = apply { - if (validated) { - return@apply - } + known() + validated = true + } - known() - validated = true - } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - /** - * Returns a score indicating how many valid values are contained in - * this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + return other is RestrictedTicketIndicator && value == other.value + } - return other is Category && value == other.value - } + override fun hashCode() = value.hashCode() - override fun hashCode() = value.hashCode() + override fun toString() = value.toString() + } - override fun toString() = value.toString() - } + /** Indicates why a ticket was changed. */ + class TicketChangeIndicator + @JsonCreator + private constructor(private val value: JsonField) : Enum { - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - return other is Service && - category == other.category && - subCategory == other.subCategory && - additionalProperties == other.additionalProperties + companion object { + + /** None */ + @JvmField val NONE = of("none") + + /** Change to existing ticket */ + @JvmField + val CHANGE_TO_EXISTING_TICKET = of("change_to_existing_ticket") + + /** New ticket */ + @JvmField val NEW_TICKET = of("new_ticket") + + @JvmStatic + fun of(value: String) = TicketChangeIndicator(JsonField.of(value)) + } + + /** An enum containing [TicketChangeIndicator]'s known values. */ + enum class Known { + /** None */ + NONE, + /** Change to existing ticket */ + CHANGE_TO_EXISTING_TICKET, + /** New ticket */ + NEW_TICKET, + } + + /** + * An enum containing [TicketChangeIndicator]'s known values, as well as an + * [_UNKNOWN] member. + * + * An instance of [TicketChangeIndicator] can contain an unknown value in a + * couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** None */ + NONE, + /** Change to existing ticket */ + CHANGE_TO_EXISTING_TICKET, + /** New ticket */ + NEW_TICKET, + /** + * An enum member indicating that [TicketChangeIndicator] was + * instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NONE -> Value.NONE + CHANGE_TO_EXISTING_TICKET -> Value.CHANGE_TO_EXISTING_TICKET + NEW_TICKET -> Value.NEW_TICKET + else -> Value._UNKNOWN } - private val hashCode: Int by lazy { - Objects.hash(category, subCategory, additionalProperties) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + NONE -> Known.NONE + CHANGE_TO_EXISTING_TICKET -> Known.CHANGE_TO_EXISTING_TICKET + NEW_TICKET -> Known.NEW_TICKET + else -> + throw IncreaseInvalidDataException( + "Unknown TicketChangeIndicator: $value" + ) } - override fun hashCode(): Int = hashCode + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - override fun toString() = - "Service{category=$category, subCategory=$subCategory, additionalProperties=$additionalProperties}" + private var validated: Boolean = false + + fun validate(): TicketChangeIndicator = apply { + if (validated) { + return@apply + } + + known() + validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is Ancillary && - connectedTicketDocumentNumber == - other.connectedTicketDocumentNumber && - creditReasonIndicator == other.creditReasonIndicator && - passengerNameOrDescription == other.passengerNameOrDescription && - services == other.services && - ticketDocumentNumber == other.ticketDocumentNumber && - additionalProperties == other.additionalProperties + return other is TicketChangeIndicator && value == other.value } - private val hashCode: Int by lazy { - Objects.hash( - connectedTicketDocumentNumber, - creditReasonIndicator, - passengerNameOrDescription, - services, - ticketDocumentNumber, - additionalProperties, - ) + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class TripLeg + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val carrierCode: JsonField, + private val destinationCityAirportCode: JsonField, + private val fareBasisCode: JsonField, + private val flightNumber: JsonField, + private val serviceClass: JsonField, + private val stopOverCode: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("carrier_code") + @ExcludeMissing + carrierCode: JsonField = JsonMissing.of(), + @JsonProperty("destination_city_airport_code") + @ExcludeMissing + destinationCityAirportCode: JsonField = JsonMissing.of(), + @JsonProperty("fare_basis_code") + @ExcludeMissing + fareBasisCode: JsonField = JsonMissing.of(), + @JsonProperty("flight_number") + @ExcludeMissing + flightNumber: JsonField = JsonMissing.of(), + @JsonProperty("service_class") + @ExcludeMissing + serviceClass: JsonField = JsonMissing.of(), + @JsonProperty("stop_over_code") + @ExcludeMissing + stopOverCode: JsonField = JsonMissing.of(), + ) : this( + carrierCode, + destinationCityAirportCode, + fareBasisCode, + flightNumber, + serviceClass, + stopOverCode, + mutableMapOf(), + ) + + /** + * Carrier code (e.g., United Airlines, Jet Blue, etc.). + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun carrierCode(): Optional = + carrierCode.getOptional("carrier_code") + + /** + * Code for the destination city or airport. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun destinationCityAirportCode(): Optional = + destinationCityAirportCode.getOptional("destination_city_airport_code") + + /** + * Fare basis code. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun fareBasisCode(): Optional = + fareBasisCode.getOptional("fare_basis_code") + + /** + * Flight number. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun flightNumber(): Optional = + flightNumber.getOptional("flight_number") + + /** + * Service class (e.g., first class, business class, etc.). + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun serviceClass(): Optional = + serviceClass.getOptional("service_class") + + /** + * Indicates whether a stopover is allowed on this ticket. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun stopOverCode(): Optional = + stopOverCode.getOptional("stop_over_code") + + /** + * Returns the raw JSON value of [carrierCode]. + * + * Unlike [carrierCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("carrier_code") + @ExcludeMissing + fun _carrierCode(): JsonField = carrierCode + + /** + * Returns the raw JSON value of [destinationCityAirportCode]. + * + * Unlike [destinationCityAirportCode], this method doesn't throw if the + * JSON field has an unexpected type. + */ + @JsonProperty("destination_city_airport_code") + @ExcludeMissing + fun _destinationCityAirportCode(): JsonField = + destinationCityAirportCode + + /** + * Returns the raw JSON value of [fareBasisCode]. + * + * Unlike [fareBasisCode], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("fare_basis_code") + @ExcludeMissing + fun _fareBasisCode(): JsonField = fareBasisCode + + /** + * Returns the raw JSON value of [flightNumber]. + * + * Unlike [flightNumber], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("flight_number") + @ExcludeMissing + fun _flightNumber(): JsonField = flightNumber + + /** + * Returns the raw JSON value of [serviceClass]. + * + * Unlike [serviceClass], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("service_class") + @ExcludeMissing + fun _serviceClass(): JsonField = serviceClass + + /** + * Returns the raw JSON value of [stopOverCode]. + * + * Unlike [stopOverCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("stop_over_code") + @ExcludeMissing + fun _stopOverCode(): JsonField = stopOverCode + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) } - override fun hashCode(): Int = hashCode + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - override fun toString() = - "Ancillary{connectedTicketDocumentNumber=$connectedTicketDocumentNumber, creditReasonIndicator=$creditReasonIndicator, passengerNameOrDescription=$passengerNameOrDescription, services=$services, ticketDocumentNumber=$ticketDocumentNumber, additionalProperties=$additionalProperties}" - } + fun toBuilder() = Builder().from(this) - /** Indicates the reason for a credit to the cardholder. */ - class CreditReasonIndicator - @JsonCreator - private constructor(private val value: JsonField) : Enum { + companion object { + + /** + * Returns a mutable builder for constructing an instance of [TripLeg]. + * + * The following fields are required: + * ```java + * .carrierCode() + * .destinationCityAirportCode() + * .fareBasisCode() + * .flightNumber() + * .serviceClass() + * .stopOverCode() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TripLeg]. */ + class Builder internal constructor() { + + private var carrierCode: JsonField? = null + private var destinationCityAirportCode: JsonField? = null + private var fareBasisCode: JsonField? = null + private var flightNumber: JsonField? = null + private var serviceClass: JsonField? = null + private var stopOverCode: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(tripLeg: TripLeg) = apply { + carrierCode = tripLeg.carrierCode + destinationCityAirportCode = tripLeg.destinationCityAirportCode + fareBasisCode = tripLeg.fareBasisCode + flightNumber = tripLeg.flightNumber + serviceClass = tripLeg.serviceClass + stopOverCode = tripLeg.stopOverCode + additionalProperties = tripLeg.additionalProperties.toMutableMap() + } + + /** Carrier code (e.g., United Airlines, Jet Blue, etc.). */ + fun carrierCode(carrierCode: String?) = + carrierCode(JsonField.ofNullable(carrierCode)) + + /** + * Alias for calling [Builder.carrierCode] with + * `carrierCode.orElse(null)`. + */ + fun carrierCode(carrierCode: Optional) = + carrierCode(carrierCode.getOrNull()) + + /** + * Sets [Builder.carrierCode] to an arbitrary JSON value. + * + * You should usually call [Builder.carrierCode] with a well-typed + * [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun carrierCode(carrierCode: JsonField) = apply { + this.carrierCode = carrierCode + } + + /** Code for the destination city or airport. */ + fun destinationCityAirportCode(destinationCityAirportCode: String?) = + destinationCityAirportCode( + JsonField.ofNullable(destinationCityAirportCode) + ) + + /** + * Alias for calling [Builder.destinationCityAirportCode] with + * `destinationCityAirportCode.orElse(null)`. + */ + fun destinationCityAirportCode( + destinationCityAirportCode: Optional + ) = destinationCityAirportCode(destinationCityAirportCode.getOrNull()) + + /** + * Sets [Builder.destinationCityAirportCode] to an arbitrary JSON value. + * + * You should usually call [Builder.destinationCityAirportCode] with a + * well-typed [String] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ + fun destinationCityAirportCode( + destinationCityAirportCode: JsonField + ) = apply { + this.destinationCityAirportCode = destinationCityAirportCode + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + /** Fare basis code. */ + fun fareBasisCode(fareBasisCode: String?) = + fareBasisCode(JsonField.ofNullable(fareBasisCode)) - companion object { + /** + * Alias for calling [Builder.fareBasisCode] with + * `fareBasisCode.orElse(null)`. + */ + fun fareBasisCode(fareBasisCode: Optional) = + fareBasisCode(fareBasisCode.getOrNull()) - /** No credit */ - @JvmField val NO_CREDIT = of("no_credit") + /** + * Sets [Builder.fareBasisCode] to an arbitrary JSON value. + * + * You should usually call [Builder.fareBasisCode] with a well-typed + * [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun fareBasisCode(fareBasisCode: JsonField) = apply { + this.fareBasisCode = fareBasisCode + } - /** Passenger transport ancillary purchase cancellation */ - @JvmField - val PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = - of("passenger_transport_ancillary_purchase_cancellation") + /** Flight number. */ + fun flightNumber(flightNumber: String?) = + flightNumber(JsonField.ofNullable(flightNumber)) /** - * Airline ticket and passenger transport ancillary purchase - * cancellation + * Alias for calling [Builder.flightNumber] with + * `flightNumber.orElse(null)`. */ - @JvmField - val AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = - of( - "airline_ticket_and_passenger_transport_ancillary_purchase_cancellation" - ) - - /** Airline ticket cancellation */ - @JvmField - val AIRLINE_TICKET_CANCELLATION = of("airline_ticket_cancellation") + fun flightNumber(flightNumber: Optional) = + flightNumber(flightNumber.getOrNull()) - /** Other */ - @JvmField val OTHER = of("other") + /** + * Sets [Builder.flightNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.flightNumber] with a well-typed + * [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun flightNumber(flightNumber: JsonField) = apply { + this.flightNumber = flightNumber + } - /** Partial refund of airline ticket */ - @JvmField - val PARTIAL_REFUND_OF_AIRLINE_TICKET = - of("partial_refund_of_airline_ticket") + /** Service class (e.g., first class, business class, etc.). */ + fun serviceClass(serviceClass: String?) = + serviceClass(JsonField.ofNullable(serviceClass)) - @JvmStatic - fun of(value: String) = CreditReasonIndicator(JsonField.of(value)) - } + /** + * Alias for calling [Builder.serviceClass] with + * `serviceClass.orElse(null)`. + */ + fun serviceClass(serviceClass: Optional) = + serviceClass(serviceClass.getOrNull()) - /** An enum containing [CreditReasonIndicator]'s known values. */ - enum class Known { - /** No credit */ - NO_CREDIT, - /** Passenger transport ancillary purchase cancellation */ - PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, /** - * Airline ticket and passenger transport ancillary purchase - * cancellation + * Sets [Builder.serviceClass] to an arbitrary JSON value. + * + * You should usually call [Builder.serviceClass] with a well-typed + * [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, - /** Airline ticket cancellation */ - AIRLINE_TICKET_CANCELLATION, - /** Other */ - OTHER, - /** Partial refund of airline ticket */ - PARTIAL_REFUND_OF_AIRLINE_TICKET, - } + fun serviceClass(serviceClass: JsonField) = apply { + this.serviceClass = serviceClass + } + + /** Indicates whether a stopover is allowed on this ticket. */ + fun stopOverCode(stopOverCode: StopOverCode?) = + stopOverCode(JsonField.ofNullable(stopOverCode)) - /** - * An enum containing [CreditReasonIndicator]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [CreditReasonIndicator] can contain an unknown value in a - * couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** No credit */ - NO_CREDIT, - /** Passenger transport ancillary purchase cancellation */ - PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, /** - * Airline ticket and passenger transport ancillary purchase - * cancellation + * Alias for calling [Builder.stopOverCode] with + * `stopOverCode.orElse(null)`. */ - AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, - /** Airline ticket cancellation */ - AIRLINE_TICKET_CANCELLATION, - /** Other */ - OTHER, - /** Partial refund of airline ticket */ - PARTIAL_REFUND_OF_AIRLINE_TICKET, + fun stopOverCode(stopOverCode: Optional) = + stopOverCode(stopOverCode.getOrNull()) + /** - * An enum member indicating that [CreditReasonIndicator] was - * instantiated with an unknown value. + * Sets [Builder.stopOverCode] to an arbitrary JSON value. + * + * You should usually call [Builder.stopOverCode] with a well-typed + * [StopOverCode] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. */ - _UNKNOWN, - } + fun stopOverCode(stopOverCode: JsonField) = apply { + this.stopOverCode = stopOverCode + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - NO_CREDIT -> Value.NO_CREDIT - PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> - Value.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION - AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> - Value - .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION - AIRLINE_TICKET_CANCELLATION -> Value.AIRLINE_TICKET_CANCELLATION - OTHER -> Value.OTHER - PARTIAL_REFUND_OF_AIRLINE_TICKET -> - Value.PARTIAL_REFUND_OF_AIRLINE_TICKET - else -> Value._UNKNOWN + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - NO_CREDIT -> Known.NO_CREDIT - PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> - Known.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION - AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> - Known - .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION - AIRLINE_TICKET_CANCELLATION -> Known.AIRLINE_TICKET_CANCELLATION - OTHER -> Known.OTHER - PARTIAL_REFUND_OF_AIRLINE_TICKET -> - Known.PARTIAL_REFUND_OF_AIRLINE_TICKET - else -> - throw IncreaseInvalidDataException( - "Unknown CreditReasonIndicator: $value" - ) + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [TripLeg]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + * + * The following fields are required: + * ```java + * .carrierCode() + * .destinationCityAirportCode() + * .fareBasisCode() + * .flightNumber() + * .serviceClass() + * .stopOverCode() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): TripLeg = + TripLeg( + checkRequired("carrierCode", carrierCode), + checkRequired( + "destinationCityAirportCode", + destinationCityAirportCode, + ), + checkRequired("fareBasisCode", fareBasisCode), + checkRequired("flightNumber", flightNumber), + checkRequired("serviceClass", serviceClass), + checkRequired("stopOverCode", stopOverCode), + additionalProperties.toMutableMap(), + ) + } + private var validated: Boolean = false - fun validate(): CreditReasonIndicator = apply { + fun validate(): TripLeg = apply { if (validated) { return@apply } - known() + carrierCode() + destinationCityAirportCode() + fareBasisCode() + flightNumber() + serviceClass() + stopOverCode().ifPresent { it.validate() } validated = true } @@ -72188,1002 +83938,1569 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + internal fun validity(): Int = + (if (carrierCode.asKnown().isPresent) 1 else 0) + + (if (destinationCityAirportCode.asKnown().isPresent) 1 else 0) + + (if (fareBasisCode.asKnown().isPresent) 1 else 0) + + (if (flightNumber.asKnown().isPresent) 1 else 0) + + (if (serviceClass.asKnown().isPresent) 1 else 0) + + (stopOverCode.asKnown().getOrNull()?.validity() ?: 0) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** Indicates whether a stopover is allowed on this ticket. */ + class StopOverCode + @JsonCreator + private constructor(private val value: JsonField) : Enum { - return other is CreditReasonIndicator && value == other.value - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from + * data that doesn't match any known member, and you want to know that + * value. For example, if the SDK is on an older version than the API, + * then the API may respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - override fun hashCode() = value.hashCode() + companion object { - override fun toString() = value.toString() - } + /** None */ + @JvmField val NONE = of("none") - /** Indicates whether this ticket is non-refundable. */ - class RestrictedTicketIndicator - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** Stop over allowed */ + @JvmField val STOP_OVER_ALLOWED = of("stop_over_allowed") - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + /** Stop over not allowed */ + @JvmField val STOP_OVER_NOT_ALLOWED = of("stop_over_not_allowed") - companion object { + @JvmStatic fun of(value: String) = StopOverCode(JsonField.of(value)) + } - /** No restrictions */ - @JvmField val NO_RESTRICTIONS = of("no_restrictions") + /** An enum containing [StopOverCode]'s known values. */ + enum class Known { + /** None */ + NONE, + /** Stop over allowed */ + STOP_OVER_ALLOWED, + /** Stop over not allowed */ + STOP_OVER_NOT_ALLOWED, + } - /** Restricted non-refundable ticket */ - @JvmField - val RESTRICTED_NON_REFUNDABLE_TICKET = - of("restricted_non_refundable_ticket") + /** + * An enum containing [StopOverCode]'s known values, as well as an + * [_UNKNOWN] member. + * + * An instance of [StopOverCode] can contain an unknown value in a + * couple of cases: + * - It was deserialized from data that doesn't match any known member. + * For example, if the SDK is on an older version than the API, then + * the API may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** None */ + NONE, + /** Stop over allowed */ + STOP_OVER_ALLOWED, + /** Stop over not allowed */ + STOP_OVER_NOT_ALLOWED, + /** + * An enum member indicating that [StopOverCode] was instantiated + * with an unknown value. + */ + _UNKNOWN, + } - @JvmStatic - fun of(value: String) = RestrictedTicketIndicator(JsonField.of(value)) - } + /** + * Returns an enum member corresponding to this class instance's value, + * or [Value._UNKNOWN] if the class was instantiated with an unknown + * value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NONE -> Value.NONE + STOP_OVER_ALLOWED -> Value.STOP_OVER_ALLOWED + STOP_OVER_NOT_ALLOWED -> Value.STOP_OVER_NOT_ALLOWED + else -> Value._UNKNOWN + } - /** An enum containing [RestrictedTicketIndicator]'s known values. */ - enum class Known { - /** No restrictions */ - NO_RESTRICTIONS, - /** Restricted non-refundable ticket */ - RESTRICTED_NON_REFUNDABLE_TICKET, - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is + * always known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value + * is a not a known member. + */ + fun known(): Known = + when (this) { + NONE -> Known.NONE + STOP_OVER_ALLOWED -> Known.STOP_OVER_ALLOWED + STOP_OVER_NOT_ALLOWED -> Known.STOP_OVER_NOT_ALLOWED + else -> + throw IncreaseInvalidDataException( + "Unknown StopOverCode: $value" + ) + } - /** - * An enum containing [RestrictedTicketIndicator]'s known values, as well as - * an [_UNKNOWN] member. - * - * An instance of [RestrictedTicketIndicator] can contain an unknown value - * in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** No restrictions */ - NO_RESTRICTIONS, - /** Restricted non-refundable ticket */ - RESTRICTED_NON_REFUNDABLE_TICKET, /** - * An enum member indicating that [RestrictedTicketIndicator] was - * instantiated with an unknown value. + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is + * primarily for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value + * does not have the expected primitive type. */ - _UNKNOWN, - } + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - NO_RESTRICTIONS -> Value.NO_RESTRICTIONS - RESTRICTED_NON_REFUNDABLE_TICKET -> - Value.RESTRICTED_NON_REFUNDABLE_TICKET - else -> Value._UNKNOWN - } + private var validated: Boolean = false - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - NO_RESTRICTIONS -> Known.NO_RESTRICTIONS - RESTRICTED_NON_REFUNDABLE_TICKET -> - Known.RESTRICTED_NON_REFUNDABLE_TICKET - else -> - throw IncreaseInvalidDataException( - "Unknown RestrictedTicketIndicator: $value" - ) - } + fun validate(): StopOverCode = apply { + if (validated) { + return@apply + } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") + known() + validated = true } - private var validated: Boolean = false + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - fun validate(): RestrictedTicketIndicator = apply { - if (validated) { - return@apply - } + /** + * Returns a score indicating how many valid values are contained in + * this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - known() - validated = true - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false + return other is StopOverCode && value == other.value } - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is RestrictedTicketIndicator && value == other.value + return other is TripLeg && + carrierCode == other.carrierCode && + destinationCityAirportCode == other.destinationCityAirportCode && + fareBasisCode == other.fareBasisCode && + flightNumber == other.flightNumber && + serviceClass == other.serviceClass && + stopOverCode == other.stopOverCode && + additionalProperties == other.additionalProperties } - override fun hashCode() = value.hashCode() + private val hashCode: Int by lazy { + Objects.hash( + carrierCode, + destinationCityAirportCode, + fareBasisCode, + flightNumber, + serviceClass, + stopOverCode, + additionalProperties, + ) + } - override fun toString() = value.toString() + override fun hashCode(): Int = hashCode + + override fun toString() = + "TripLeg{carrierCode=$carrierCode, destinationCityAirportCode=$destinationCityAirportCode, fareBasisCode=$fareBasisCode, flightNumber=$flightNumber, serviceClass=$serviceClass, stopOverCode=$stopOverCode, additionalProperties=$additionalProperties}" } - /** Indicates why a ticket was changed. */ - class TicketChangeIndicator - @JsonCreator - private constructor(private val value: JsonField) : Enum { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + return other is Travel && + ancillary == other.ancillary && + computerizedReservationSystem == other.computerizedReservationSystem && + creditReasonIndicator == other.creditReasonIndicator && + departureDate == other.departureDate && + originationCityAirportCode == other.originationCityAirportCode && + passengerName == other.passengerName && + restrictedTicketIndicator == other.restrictedTicketIndicator && + ticketChangeIndicator == other.ticketChangeIndicator && + ticketNumber == other.ticketNumber && + travelAgencyCode == other.travelAgencyCode && + travelAgencyName == other.travelAgencyName && + tripLegs == other.tripLegs && + additionalProperties == other.additionalProperties + } - companion object { + private val hashCode: Int by lazy { + Objects.hash( + ancillary, + computerizedReservationSystem, + creditReasonIndicator, + departureDate, + originationCityAirportCode, + passengerName, + restrictedTicketIndicator, + ticketChangeIndicator, + ticketNumber, + travelAgencyCode, + travelAgencyName, + tripLegs, + additionalProperties, + ) + } - /** None */ - @JvmField val NONE = of("none") + override fun hashCode(): Int = hashCode - /** Change to existing ticket */ - @JvmField - val CHANGE_TO_EXISTING_TICKET = of("change_to_existing_ticket") + override fun toString() = + "Travel{ancillary=$ancillary, computerizedReservationSystem=$computerizedReservationSystem, creditReasonIndicator=$creditReasonIndicator, departureDate=$departureDate, originationCityAirportCode=$originationCityAirportCode, passengerName=$passengerName, restrictedTicketIndicator=$restrictedTicketIndicator, ticketChangeIndicator=$ticketChangeIndicator, ticketNumber=$ticketNumber, travelAgencyCode=$travelAgencyCode, travelAgencyName=$travelAgencyName, tripLegs=$tripLegs, additionalProperties=$additionalProperties}" + } - /** New ticket */ - @JvmField val NEW_TICKET = of("new_ticket") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmStatic - fun of(value: String) = TicketChangeIndicator(JsonField.of(value)) - } + return other is PurchaseDetails && + carRental == other.carRental && + customerReferenceIdentifier == other.customerReferenceIdentifier && + localTaxAmount == other.localTaxAmount && + localTaxCurrency == other.localTaxCurrency && + lodging == other.lodging && + nationalTaxAmount == other.nationalTaxAmount && + nationalTaxCurrency == other.nationalTaxCurrency && + purchaseIdentifier == other.purchaseIdentifier && + purchaseIdentifierFormat == other.purchaseIdentifierFormat && + travel == other.travel && + additionalProperties == other.additionalProperties + } - /** An enum containing [TicketChangeIndicator]'s known values. */ - enum class Known { - /** None */ - NONE, - /** Change to existing ticket */ - CHANGE_TO_EXISTING_TICKET, - /** New ticket */ - NEW_TICKET, - } + private val hashCode: Int by lazy { + Objects.hash( + carRental, + customerReferenceIdentifier, + localTaxAmount, + localTaxCurrency, + lodging, + nationalTaxAmount, + nationalTaxCurrency, + purchaseIdentifier, + purchaseIdentifierFormat, + travel, + additionalProperties, + ) + } - /** - * An enum containing [TicketChangeIndicator]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [TicketChangeIndicator] can contain an unknown value in a - * couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** None */ - NONE, - /** Change to existing ticket */ - CHANGE_TO_EXISTING_TICKET, - /** New ticket */ - NEW_TICKET, - /** - * An enum member indicating that [TicketChangeIndicator] was - * instantiated with an unknown value. - */ - _UNKNOWN, - } + override fun hashCode(): Int = hashCode - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - NONE -> Value.NONE - CHANGE_TO_EXISTING_TICKET -> Value.CHANGE_TO_EXISTING_TICKET - NEW_TICKET -> Value.NEW_TICKET - else -> Value._UNKNOWN - } + override fun toString() = + "PurchaseDetails{carRental=$carRental, customerReferenceIdentifier=$customerReferenceIdentifier, localTaxAmount=$localTaxAmount, localTaxCurrency=$localTaxCurrency, lodging=$lodging, nationalTaxAmount=$nationalTaxAmount, nationalTaxCurrency=$nationalTaxCurrency, purchaseIdentifier=$purchaseIdentifier, purchaseIdentifierFormat=$purchaseIdentifierFormat, travel=$travel, additionalProperties=$additionalProperties}" + } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - NONE -> Known.NONE - CHANGE_TO_EXISTING_TICKET -> Known.CHANGE_TO_EXISTING_TICKET - NEW_TICKET -> Known.NEW_TICKET - else -> - throw IncreaseInvalidDataException( - "Unknown TicketChangeIndicator: $value" - ) - } + class SchemeFee + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val amount: JsonField, + private val createdAt: JsonField, + private val currency: JsonField, + private val feeType: JsonField, + private val fixedComponent: JsonField, + private val variableRate: JsonField, + private val additionalProperties: MutableMap, + ) { - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + createdAt: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("fee_type") + @ExcludeMissing + feeType: JsonField = JsonMissing.of(), + @JsonProperty("fixed_component") + @ExcludeMissing + fixedComponent: JsonField = JsonMissing.of(), + @JsonProperty("variable_rate") + @ExcludeMissing + variableRate: JsonField = JsonMissing.of(), + ) : this( + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, + mutableMapOf(), + ) - private var validated: Boolean = false + /** + * The fee amount given as a string containing a decimal number. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun amount(): String = amount.getRequired("amount") - fun validate(): TicketChangeIndicator = apply { - if (validated) { - return@apply - } + /** + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + * created. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - known() - validated = true - } + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun currency(): Currency = currency.getRequired("currency") - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * The type of fee being assessed. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun feeType(): FeeType = feeType.getRequired("fee_type") - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + /** + * The fixed component of the fee, if applicable, given in major units of the fee + * amount. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun fixedComponent(): Optional = + fixedComponent.getOptional("fixed_component") - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * The variable rate component of the fee, if applicable, given as a decimal (e.g., + * 0.015 for 1.5%). + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun variableRate(): Optional = variableRate.getOptional("variable_rate") - return other is TicketChangeIndicator && value == other.value - } + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - override fun hashCode() = value.hashCode() + /** + * Returns the raw JSON value of [createdAt]. + * + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("created_at") + @ExcludeMissing + fun _createdAt(): JsonField = createdAt - override fun toString() = value.toString() + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("currency") + @ExcludeMissing + fun _currency(): JsonField = currency + + /** + * Returns the raw JSON value of [feeType]. + * + * Unlike [feeType], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("fee_type") + @ExcludeMissing + fun _feeType(): JsonField = feeType + + /** + * Returns the raw JSON value of [fixedComponent]. + * + * Unlike [fixedComponent], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("fixed_component") + @ExcludeMissing + fun _fixedComponent(): JsonField = fixedComponent + + /** + * Returns the raw JSON value of [variableRate]. + * + * Unlike [variableRate], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("variable_rate") + @ExcludeMissing + fun _variableRate(): JsonField = variableRate + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [SchemeFee]. + * + * The following fields are required: + * ```java + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SchemeFee]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var createdAt: JsonField? = null + private var currency: JsonField? = null + private var feeType: JsonField? = null + private var fixedComponent: JsonField? = null + private var variableRate: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(schemeFee: SchemeFee) = apply { + amount = schemeFee.amount + createdAt = schemeFee.createdAt + currency = schemeFee.currency + feeType = schemeFee.feeType + fixedComponent = schemeFee.fixedComponent + variableRate = schemeFee.variableRate + additionalProperties = schemeFee.additionalProperties.toMutableMap() } - class TripLeg - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val carrierCode: JsonField, - private val destinationCityAirportCode: JsonField, - private val fareBasisCode: JsonField, - private val flightNumber: JsonField, - private val serviceClass: JsonField, - private val stopOverCode: JsonField, - private val additionalProperties: MutableMap, - ) { + /** The fee amount given as a string containing a decimal number. */ + fun amount(amount: String) = amount(JsonField.of(amount)) - @JsonCreator - private constructor( - @JsonProperty("carrier_code") - @ExcludeMissing - carrierCode: JsonField = JsonMissing.of(), - @JsonProperty("destination_city_airport_code") - @ExcludeMissing - destinationCityAirportCode: JsonField = JsonMissing.of(), - @JsonProperty("fare_basis_code") - @ExcludeMissing - fareBasisCode: JsonField = JsonMissing.of(), - @JsonProperty("flight_number") - @ExcludeMissing - flightNumber: JsonField = JsonMissing.of(), - @JsonProperty("service_class") - @ExcludeMissing - serviceClass: JsonField = JsonMissing.of(), - @JsonProperty("stop_over_code") - @ExcludeMissing - stopOverCode: JsonField = JsonMissing.of(), - ) : this( - carrierCode, - destinationCityAirportCode, - fareBasisCode, - flightNumber, - serviceClass, - stopOverCode, - mutableMapOf(), - ) + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun amount(amount: JsonField) = apply { this.amount = amount } - /** - * Carrier code (e.g., United Airlines, Jet Blue, etc.). - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). - */ - fun carrierCode(): Optional = - carrierCode.getOptional("carrier_code") + /** + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee + * was created. + */ + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - /** - * Code for the destination city or airport. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). - */ - fun destinationCityAirportCode(): Optional = - destinationCityAirportCode.getOptional("destination_city_airport_code") + /** + * Sets [Builder.createdAt] to an arbitrary JSON value. + * + * You should usually call [Builder.createdAt] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt + } - /** - * Fare basis code. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). - */ - fun fareBasisCode(): Optional = - fareBasisCode.getOptional("fare_basis_code") + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + */ + fun currency(currency: Currency) = currency(JsonField.of(currency)) - /** - * Flight number. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). - */ - fun flightNumber(): Optional = - flightNumber.getOptional("flight_number") + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [Currency] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } + + /** The type of fee being assessed. */ + fun feeType(feeType: FeeType) = feeType(JsonField.of(feeType)) + + /** + * Sets [Builder.feeType] to an arbitrary JSON value. + * + * You should usually call [Builder.feeType] with a well-typed [FeeType] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun feeType(feeType: JsonField) = apply { this.feeType = feeType } - /** - * Service class (e.g., first class, business class, etc.). - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). - */ - fun serviceClass(): Optional = - serviceClass.getOptional("service_class") + /** + * The fixed component of the fee, if applicable, given in major units of the + * fee amount. + */ + fun fixedComponent(fixedComponent: String?) = + fixedComponent(JsonField.ofNullable(fixedComponent)) - /** - * Indicates whether a stopover is allowed on this ticket. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). - */ - fun stopOverCode(): Optional = - stopOverCode.getOptional("stop_over_code") + /** + * Alias for calling [Builder.fixedComponent] with + * `fixedComponent.orElse(null)`. + */ + fun fixedComponent(fixedComponent: Optional) = + fixedComponent(fixedComponent.getOrNull()) - /** - * Returns the raw JSON value of [carrierCode]. - * - * Unlike [carrierCode], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("carrier_code") - @ExcludeMissing - fun _carrierCode(): JsonField = carrierCode + /** + * Sets [Builder.fixedComponent] to an arbitrary JSON value. + * + * You should usually call [Builder.fixedComponent] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun fixedComponent(fixedComponent: JsonField) = apply { + this.fixedComponent = fixedComponent + } - /** - * Returns the raw JSON value of [destinationCityAirportCode]. - * - * Unlike [destinationCityAirportCode], this method doesn't throw if the - * JSON field has an unexpected type. - */ - @JsonProperty("destination_city_airport_code") - @ExcludeMissing - fun _destinationCityAirportCode(): JsonField = - destinationCityAirportCode + /** + * The variable rate component of the fee, if applicable, given as a decimal + * (e.g., 0.015 for 1.5%). + */ + fun variableRate(variableRate: String?) = + variableRate(JsonField.ofNullable(variableRate)) - /** - * Returns the raw JSON value of [fareBasisCode]. - * - * Unlike [fareBasisCode], this method doesn't throw if the JSON field has - * an unexpected type. - */ - @JsonProperty("fare_basis_code") - @ExcludeMissing - fun _fareBasisCode(): JsonField = fareBasisCode + /** + * Alias for calling [Builder.variableRate] with `variableRate.orElse(null)`. + */ + fun variableRate(variableRate: Optional) = + variableRate(variableRate.getOrNull()) - /** - * Returns the raw JSON value of [flightNumber]. - * - * Unlike [flightNumber], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("flight_number") - @ExcludeMissing - fun _flightNumber(): JsonField = flightNumber + /** + * Sets [Builder.variableRate] to an arbitrary JSON value. + * + * You should usually call [Builder.variableRate] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun variableRate(variableRate: JsonField) = apply { + this.variableRate = variableRate + } - /** - * Returns the raw JSON value of [serviceClass]. - * - * Unlike [serviceClass], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("service_class") - @ExcludeMissing - fun _serviceClass(): JsonField = serviceClass + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * Returns the raw JSON value of [stopOverCode]. - * - * Unlike [stopOverCode], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("stop_over_code") - @ExcludeMissing - fun _stopOverCode(): JsonField = stopOverCode + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun toBuilder() = Builder().from(this) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - companion object { + /** + * Returns an immutable instance of [SchemeFee]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SchemeFee = + SchemeFee( + checkRequired("amount", amount), + checkRequired("createdAt", createdAt), + checkRequired("currency", currency), + checkRequired("feeType", feeType), + checkRequired("fixedComponent", fixedComponent), + checkRequired("variableRate", variableRate), + additionalProperties.toMutableMap(), + ) + } - /** - * Returns a mutable builder for constructing an instance of [TripLeg]. - * - * The following fields are required: - * ```java - * .carrierCode() - * .destinationCityAirportCode() - * .fareBasisCode() - * .flightNumber() - * .serviceClass() - * .stopOverCode() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + private var validated: Boolean = false - /** A builder for [TripLeg]. */ - class Builder internal constructor() { + fun validate(): SchemeFee = apply { + if (validated) { + return@apply + } - private var carrierCode: JsonField? = null - private var destinationCityAirportCode: JsonField? = null - private var fareBasisCode: JsonField? = null - private var flightNumber: JsonField? = null - private var serviceClass: JsonField? = null - private var stopOverCode: JsonField? = null - private var additionalProperties: MutableMap = - mutableMapOf() + amount() + createdAt() + currency().validate() + feeType().validate() + fixedComponent() + variableRate() + validated = true + } - @JvmSynthetic - internal fun from(tripLeg: TripLeg) = apply { - carrierCode = tripLeg.carrierCode - destinationCityAirportCode = tripLeg.destinationCityAirportCode - fareBasisCode = tripLeg.fareBasisCode - flightNumber = tripLeg.flightNumber - serviceClass = tripLeg.serviceClass - stopOverCode = tripLeg.stopOverCode - additionalProperties = tripLeg.additionalProperties.toMutableMap() - } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** Carrier code (e.g., United Airlines, Jet Blue, etc.). */ - fun carrierCode(carrierCode: String?) = - carrierCode(JsonField.ofNullable(carrierCode)) + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (currency.asKnown().getOrNull()?.validity() ?: 0) + + (feeType.asKnown().getOrNull()?.validity() ?: 0) + + (if (fixedComponent.asKnown().isPresent) 1 else 0) + + (if (variableRate.asKnown().isPresent) 1 else 0) - /** - * Alias for calling [Builder.carrierCode] with - * `carrierCode.orElse(null)`. - */ - fun carrierCode(carrierCode: Optional) = - carrierCode(carrierCode.getOrNull()) + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + */ + class Currency + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** - * Sets [Builder.carrierCode] to an arbitrary JSON value. - * - * You should usually call [Builder.carrierCode] with a well-typed - * [String] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun carrierCode(carrierCode: JsonField) = apply { - this.carrierCode = carrierCode - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** Code for the destination city or airport. */ - fun destinationCityAirportCode(destinationCityAirportCode: String?) = - destinationCityAirportCode( - JsonField.ofNullable(destinationCityAirportCode) - ) + companion object { - /** - * Alias for calling [Builder.destinationCityAirportCode] with - * `destinationCityAirportCode.orElse(null)`. - */ - fun destinationCityAirportCode( - destinationCityAirportCode: Optional - ) = destinationCityAirportCode(destinationCityAirportCode.getOrNull()) + /** US Dollar (USD) */ + @JvmField val USD = of("USD") - /** - * Sets [Builder.destinationCityAirportCode] to an arbitrary JSON value. - * - * You should usually call [Builder.destinationCityAirportCode] with a - * well-typed [String] value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. - */ - fun destinationCityAirportCode( - destinationCityAirportCode: JsonField - ) = apply { - this.destinationCityAirportCode = destinationCityAirportCode - } + @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) + } - /** Fare basis code. */ - fun fareBasisCode(fareBasisCode: String?) = - fareBasisCode(JsonField.ofNullable(fareBasisCode)) + /** An enum containing [Currency]'s known values. */ + enum class Known { + /** US Dollar (USD) */ + USD + } - /** - * Alias for calling [Builder.fareBasisCode] with - * `fareBasisCode.orElse(null)`. - */ - fun fareBasisCode(fareBasisCode: Optional) = - fareBasisCode(fareBasisCode.getOrNull()) + /** + * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Currency] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** US Dollar (USD) */ + USD, + /** + * An enum member indicating that [Currency] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** - * Sets [Builder.fareBasisCode] to an arbitrary JSON value. - * - * You should usually call [Builder.fareBasisCode] with a well-typed - * [String] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun fareBasisCode(fareBasisCode: JsonField) = apply { - this.fareBasisCode = fareBasisCode - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + USD -> Value.USD + else -> Value._UNKNOWN + } - /** Flight number. */ - fun flightNumber(flightNumber: String?) = - flightNumber(JsonField.ofNullable(flightNumber)) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + USD -> Known.USD + else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + } - /** - * Alias for calling [Builder.flightNumber] with - * `flightNumber.orElse(null)`. - */ - fun flightNumber(flightNumber: Optional) = - flightNumber(flightNumber.getOrNull()) + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - /** - * Sets [Builder.flightNumber] to an arbitrary JSON value. - * - * You should usually call [Builder.flightNumber] with a well-typed - * [String] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun flightNumber(flightNumber: JsonField) = apply { - this.flightNumber = flightNumber - } + private var validated: Boolean = false - /** Service class (e.g., first class, business class, etc.). */ - fun serviceClass(serviceClass: String?) = - serviceClass(JsonField.ofNullable(serviceClass)) + fun validate(): Currency = apply { + if (validated) { + return@apply + } - /** - * Alias for calling [Builder.serviceClass] with - * `serviceClass.orElse(null)`. - */ - fun serviceClass(serviceClass: Optional) = - serviceClass(serviceClass.getOrNull()) + known() + validated = true + } - /** - * Sets [Builder.serviceClass] to an arbitrary JSON value. - * - * You should usually call [Builder.serviceClass] with a well-typed - * [String] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun serviceClass(serviceClass: JsonField) = apply { - this.serviceClass = serviceClass - } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** Indicates whether a stopover is allowed on this ticket. */ - fun stopOverCode(stopOverCode: StopOverCode?) = - stopOverCode(JsonField.ofNullable(stopOverCode)) + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - /** - * Alias for calling [Builder.stopOverCode] with - * `stopOverCode.orElse(null)`. - */ - fun stopOverCode(stopOverCode: Optional) = - stopOverCode(stopOverCode.getOrNull()) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Sets [Builder.stopOverCode] to an arbitrary JSON value. - * - * You should usually call [Builder.stopOverCode] with a well-typed - * [StopOverCode] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. - */ - fun stopOverCode(stopOverCode: JsonField) = apply { - this.stopOverCode = stopOverCode - } + return other is Currency && value == other.value + } - fun additionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun hashCode() = value.hashCode() - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + override fun toString() = value.toString() + } - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } + /** The type of fee being assessed. */ + class FeeType + @JsonCreator + private constructor(private val value: JsonField) : Enum { - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + companion object { - /** - * Returns an immutable instance of [TripLeg]. - * - * Further updates to this [Builder] will not mutate the returned - * instance. - * - * The following fields are required: - * ```java - * .carrierCode() - * .destinationCityAirportCode() - * .fareBasisCode() - * .flightNumber() - * .serviceClass() - * .stopOverCode() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): TripLeg = - TripLeg( - checkRequired("carrierCode", carrierCode), - checkRequired( - "destinationCityAirportCode", - destinationCityAirportCode, - ), - checkRequired("fareBasisCode", fareBasisCode), - checkRequired("flightNumber", flightNumber), - checkRequired("serviceClass", serviceClass), - checkRequired("stopOverCode", stopOverCode), - additionalProperties.toMutableMap(), - ) - } + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY = + of("visa_international_service_assessment_single_currency") + + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY = + of("visa_international_service_assessment_cross_currency") + + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + @JvmField + val VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE = + of("visa_authorization_domestic_point_of_sale") + + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + @JvmField + val VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_international_point_of_sale") + + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + @JvmField + val VISA_AUTHORIZATION_CANADA_POINT_OF_SALE = + of("visa_authorization_canada_point_of_sale") - private var validated: Boolean = false + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + @JvmField + val VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE = + of("visa_authorization_reversal_point_of_sale") - fun validate(): TripLeg = apply { - if (validated) { - return@apply - } + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + @JvmField + val VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_reversal_international_point_of_sale") - carrierCode() - destinationCityAirportCode() - fareBasisCode() - flightNumber() - serviceClass() - stopOverCode().ifPresent { it.validate() } - validated = true - } + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + @JvmField + val VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE = + of("visa_authorization_address_verification_service") - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + @JvmField + val VISA_ADVANCED_AUTHORIZATION = of("visa_advanced_authorization") /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. */ - @JvmSynthetic - internal fun validity(): Int = - (if (carrierCode.asKnown().isPresent) 1 else 0) + - (if (destinationCityAirportCode.asKnown().isPresent) 1 else 0) + - (if (fareBasisCode.asKnown().isPresent) 1 else 0) + - (if (flightNumber.asKnown().isPresent) 1 else 0) + - (if (serviceClass.asKnown().isPresent) 1 else 0) + - (stopOverCode.asKnown().getOrNull()?.validity() ?: 0) + @JvmField val VISA_MESSAGE_TRANSMISSION = of("visa_message_transmission") - /** Indicates whether a stopover is allowed on this ticket. */ - class StopOverCode - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_DOMESTIC = + of("visa_account_verification_domestic") - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from - * data that doesn't match any known member, and you want to know that - * value. For example, if the SDK is on an older version than the API, - * then the API may respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_INTERNATIONAL = + of("visa_account_verification_international") - companion object { + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_CANADA = + of("visa_account_verification_canada") - /** None */ - @JvmField val NONE = of("none") + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + @JvmField + val VISA_CORPORATE_ACCEPTANCE_FEE = of("visa_corporate_acceptance_fee") - /** Stop over allowed */ - @JvmField val STOP_OVER_ALLOWED = of("stop_over_allowed") + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + @JvmField + val VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE = + of("visa_consumer_debit_acceptance_fee") - /** Stop over not allowed */ - @JvmField val STOP_OVER_NOT_ALLOWED = of("stop_over_not_allowed") + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + @JvmField + val VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE = + of("visa_business_debit_acceptance_fee") - @JvmStatic fun of(value: String) = StopOverCode(JsonField.of(value)) - } + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + @JvmField + val VISA_PURCHASING_ACCEPTANCE_FEE = of("visa_purchasing_acceptance_fee") - /** An enum containing [StopOverCode]'s known values. */ - enum class Known { - /** None */ - NONE, - /** Stop over allowed */ - STOP_OVER_ALLOWED, - /** Stop over not allowed */ - STOP_OVER_NOT_ALLOWED, - } + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + @JvmField val VISA_PURCHASE_DOMESTIC = of("visa_purchase_domestic") - /** - * An enum containing [StopOverCode]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [StopOverCode] can contain an unknown value in a - * couple of cases: - * - It was deserialized from data that doesn't match any known member. - * For example, if the SDK is on an older version than the API, then - * the API may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** None */ - NONE, - /** Stop over allowed */ - STOP_OVER_ALLOWED, - /** Stop over not allowed */ - STOP_OVER_NOT_ALLOWED, - /** - * An enum member indicating that [StopOverCode] was instantiated - * with an unknown value. - */ - _UNKNOWN, - } + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + @JvmField + val VISA_PURCHASE_INTERNATIONAL = of("visa_purchase_international") - /** - * Returns an enum member corresponding to this class instance's value, - * or [Value._UNKNOWN] if the class was instantiated with an unknown - * value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - NONE -> Value.NONE - STOP_OVER_ALLOWED -> Value.STOP_OVER_ALLOWED - STOP_OVER_NOT_ALLOWED -> Value.STOP_OVER_NOT_ALLOWED - else -> Value._UNKNOWN - } + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_CREDIT_PURCHASE_TOKEN = of("visa_credit_purchase_token") - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is - * always known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value - * is a not a known member. - */ - fun known(): Known = - when (this) { - NONE -> Known.NONE - STOP_OVER_ALLOWED -> Known.STOP_OVER_ALLOWED - STOP_OVER_NOT_ALLOWED -> Known.STOP_OVER_NOT_ALLOWED - else -> - throw IncreaseInvalidDataException( - "Unknown StopOverCode: $value" - ) - } + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_DEBIT_PURCHASE_TOKEN = of("visa_debit_purchase_token") - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is - * primarily for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value - * does not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + @JvmField val VISA_CLEARING_TRANSMISSION = of("visa_clearing_transmission") - private var validated: Boolean = false + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + @JvmField val VISA_DIRECT_AUTHORIZATION = of("visa_direct_authorization") - fun validate(): StopOverCode = apply { - if (validated) { - return@apply - } + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + @JvmField + val VISA_DIRECT_TRANSACTION_DOMESTIC = + of("visa_direct_transaction_domestic") - known() - validated = true - } + /** Issuer card service fee for Commercial Credit cards. */ + @JvmField + val VISA_SERVICE_COMMERCIAL_CREDIT = of("visa_service_commercial_credit") - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + @JvmField + val VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT = + of("visa_advertising_service_commercial_credit") - /** - * Returns a score indicating how many valid values are contained in - * this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + /** Issuer Community Growth Acceleration Program Fee. */ + @JvmField + val VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM = + of("visa_community_growth_acceleration_program") - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** Issuer Processing Guarantee for Commercial Credit cards. */ + @JvmField + val VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT = + of("visa_processing_guarantee_commercial_credit") - return other is StopOverCode && value == other.value - } + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + @JvmField val PULSE_SWITCH_FEE = of("pulse_switch_fee") - override fun hashCode() = value.hashCode() + @JvmStatic fun of(value: String) = FeeType(JsonField.of(value)) + } - override fun toString() = value.toString() - } + /** An enum containing [FeeType]'s known values. */ + enum class Known { + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + VISA_ADVANCED_AUTHORIZATION, + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + VISA_MESSAGE_TRANSMISSION, + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_DOMESTIC, + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * An enum containing [FeeType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [FeeType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + VISA_ADVANCED_AUTHORIZATION, + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + VISA_MESSAGE_TRANSMISSION, + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_DOMESTIC, + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, + /** + * An enum member indicating that [FeeType] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } - return other is TripLeg && - carrierCode == other.carrierCode && - destinationCityAirportCode == other.destinationCityAirportCode && - fareBasisCode == other.fareBasisCode && - flightNumber == other.flightNumber && - serviceClass == other.serviceClass && - stopOverCode == other.stopOverCode && - additionalProperties == other.additionalProperties + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Value.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Value.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Value.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Value.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Value.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Value.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Value.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Value.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Value.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Value.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Value.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Value.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Value.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Value.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Value.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Value.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Value.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Value.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Value.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Value.PULSE_SWITCH_FEE + else -> Value._UNKNOWN } - private val hashCode: Int by lazy { - Objects.hash( - carrierCode, - destinationCityAirportCode, - fareBasisCode, - flightNumber, - serviceClass, - stopOverCode, - additionalProperties, - ) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Known.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Known.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Known.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Known.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Known.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Known.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Known.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Known.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Known.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Known.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Known.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Known.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Known.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Known.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Known.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Known.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Known.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Known.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Known.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Known.PULSE_SWITCH_FEE + else -> throw IncreaseInvalidDataException("Unknown FeeType: $value") } - override fun hashCode(): Int = hashCode + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - override fun toString() = - "TripLeg{carrierCode=$carrierCode, destinationCityAirportCode=$destinationCityAirportCode, fareBasisCode=$fareBasisCode, flightNumber=$flightNumber, serviceClass=$serviceClass, stopOverCode=$stopOverCode, additionalProperties=$additionalProperties}" + private var validated: Boolean = false + + fun validate(): FeeType = apply { + if (validated) { + return@apply + } + + known() + validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is Travel && - ancillary == other.ancillary && - computerizedReservationSystem == other.computerizedReservationSystem && - creditReasonIndicator == other.creditReasonIndicator && - departureDate == other.departureDate && - originationCityAirportCode == other.originationCityAirportCode && - passengerName == other.passengerName && - restrictedTicketIndicator == other.restrictedTicketIndicator && - ticketChangeIndicator == other.ticketChangeIndicator && - ticketNumber == other.ticketNumber && - travelAgencyCode == other.travelAgencyCode && - travelAgencyName == other.travelAgencyName && - tripLegs == other.tripLegs && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - ancillary, - computerizedReservationSystem, - creditReasonIndicator, - departureDate, - originationCityAirportCode, - passengerName, - restrictedTicketIndicator, - ticketChangeIndicator, - ticketNumber, - travelAgencyCode, - travelAgencyName, - tripLegs, - additionalProperties, - ) + return other is FeeType && value == other.value } - override fun hashCode(): Int = hashCode + override fun hashCode() = value.hashCode() - override fun toString() = - "Travel{ancillary=$ancillary, computerizedReservationSystem=$computerizedReservationSystem, creditReasonIndicator=$creditReasonIndicator, departureDate=$departureDate, originationCityAirportCode=$originationCityAirportCode, passengerName=$passengerName, restrictedTicketIndicator=$restrictedTicketIndicator, ticketChangeIndicator=$ticketChangeIndicator, ticketNumber=$ticketNumber, travelAgencyCode=$travelAgencyCode, travelAgencyName=$travelAgencyName, tripLegs=$tripLegs, additionalProperties=$additionalProperties}" + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { @@ -73191,32 +85508,24 @@ private constructor( return true } - return other is PurchaseDetails && - carRental == other.carRental && - customerReferenceIdentifier == other.customerReferenceIdentifier && - localTaxAmount == other.localTaxAmount && - localTaxCurrency == other.localTaxCurrency && - lodging == other.lodging && - nationalTaxAmount == other.nationalTaxAmount && - nationalTaxCurrency == other.nationalTaxCurrency && - purchaseIdentifier == other.purchaseIdentifier && - purchaseIdentifierFormat == other.purchaseIdentifierFormat && - travel == other.travel && + return other is SchemeFee && + amount == other.amount && + createdAt == other.createdAt && + currency == other.currency && + feeType == other.feeType && + fixedComponent == other.fixedComponent && + variableRate == other.variableRate && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { Objects.hash( - carRental, - customerReferenceIdentifier, - localTaxAmount, - localTaxCurrency, - lodging, - nationalTaxAmount, - nationalTaxCurrency, - purchaseIdentifier, - purchaseIdentifierFormat, - travel, + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, additionalProperties, ) } @@ -73224,7 +85533,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PurchaseDetails{carRental=$carRental, customerReferenceIdentifier=$customerReferenceIdentifier, localTaxAmount=$localTaxAmount, localTaxCurrency=$localTaxCurrency, lodging=$lodging, nationalTaxAmount=$nationalTaxAmount, nationalTaxCurrency=$nationalTaxCurrency, purchaseIdentifier=$purchaseIdentifier, purchaseIdentifierFormat=$purchaseIdentifierFormat, travel=$travel, additionalProperties=$additionalProperties}" + "SchemeFee{amount=$amount, createdAt=$createdAt, currency=$currency, feeType=$feeType, fixedComponent=$fixedComponent, variableRate=$variableRate, additionalProperties=$additionalProperties}" } /** @@ -73608,6 +85917,7 @@ private constructor( presentmentAmount == other.presentmentAmount && presentmentCurrency == other.presentmentCurrency && purchaseDetails == other.purchaseDetails && + schemeFees == other.schemeFees && surcharge == other.surcharge && transactionId == other.transactionId && type == other.type && @@ -73636,6 +85946,7 @@ private constructor( presentmentAmount, presentmentCurrency, purchaseDetails, + schemeFees, surcharge, transactionId, type, @@ -73646,7 +85957,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CardSettlement{id=$id, amount=$amount, cardAuthorization=$cardAuthorization, cardPaymentId=$cardPaymentId, cashback=$cashback, currency=$currency, interchange=$interchange, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantName=$merchantName, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, network=$network, networkIdentifiers=$networkIdentifiers, pendingTransactionId=$pendingTransactionId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, purchaseDetails=$purchaseDetails, surcharge=$surcharge, transactionId=$transactionId, type=$type, additionalProperties=$additionalProperties}" + "CardSettlement{id=$id, amount=$amount, cardAuthorization=$cardAuthorization, cardPaymentId=$cardPaymentId, cashback=$cashback, currency=$currency, interchange=$interchange, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantName=$merchantName, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, network=$network, networkIdentifiers=$networkIdentifiers, pendingTransactionId=$pendingTransactionId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, purchaseDetails=$purchaseDetails, schemeFees=$schemeFees, surcharge=$surcharge, transactionId=$transactionId, type=$type, additionalProperties=$additionalProperties}" } /** @@ -73676,6 +85987,7 @@ private constructor( private val networkRiskScore: JsonField, private val physicalCardId: JsonField, private val realTimeDecisionId: JsonField, + private val schemeFees: JsonField>, private val terminalId: JsonField, private val type: JsonField, private val verification: JsonField, @@ -73736,6 +86048,9 @@ private constructor( @JsonProperty("real_time_decision_id") @ExcludeMissing realTimeDecisionId: JsonField = JsonMissing.of(), + @JsonProperty("scheme_fees") + @ExcludeMissing + schemeFees: JsonField> = JsonMissing.of(), @JsonProperty("terminal_id") @ExcludeMissing terminalId: JsonField = JsonMissing.of(), @@ -73762,6 +86077,7 @@ private constructor( networkRiskScore, physicalCardId, realTimeDecisionId, + schemeFees, terminalId, type, verification, @@ -73942,6 +86258,15 @@ private constructor( fun realTimeDecisionId(): Optional = realTimeDecisionId.getOptional("real_time_decision_id") + /** + * The scheme fees associated with this card validation. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun schemeFees(): List = schemeFees.getRequired("scheme_fees") + /** * The terminal identifier (commonly abbreviated as TID) of the terminal the card is * transacting with. @@ -74147,6 +86472,16 @@ private constructor( @ExcludeMissing fun _realTimeDecisionId(): JsonField = realTimeDecisionId + /** + * Returns the raw JSON value of [schemeFees]. + * + * Unlike [schemeFees], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("scheme_fees") + @ExcludeMissing + fun _schemeFees(): JsonField> = schemeFees + /** * Returns the raw JSON value of [terminalId]. * @@ -74211,6 +86546,7 @@ private constructor( * .networkRiskScore() * .physicalCardId() * .realTimeDecisionId() + * .schemeFees() * .terminalId() * .type() * .verification() @@ -74240,6 +86576,7 @@ private constructor( private var networkRiskScore: JsonField? = null private var physicalCardId: JsonField? = null private var realTimeDecisionId: JsonField? = null + private var schemeFees: JsonField>? = null private var terminalId: JsonField? = null private var type: JsonField? = null private var verification: JsonField? = null @@ -74265,6 +86602,7 @@ private constructor( networkRiskScore = cardValidation.networkRiskScore physicalCardId = cardValidation.physicalCardId realTimeDecisionId = cardValidation.realTimeDecisionId + schemeFees = cardValidation.schemeFees.map { it.toMutableList() } terminalId = cardValidation.terminalId type = cardValidation.type verification = cardValidation.verification @@ -74614,6 +86952,32 @@ private constructor( this.realTimeDecisionId = realTimeDecisionId } + /** The scheme fees associated with this card validation. */ + fun schemeFees(schemeFees: List) = schemeFees(JsonField.of(schemeFees)) + + /** + * Sets [Builder.schemeFees] to an arbitrary JSON value. + * + * You should usually call [Builder.schemeFees] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun schemeFees(schemeFees: JsonField>) = apply { + this.schemeFees = schemeFees.map { it.toMutableList() } + } + + /** + * Adds a single [SchemeFee] to [schemeFees]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addSchemeFee(schemeFee: SchemeFee) = apply { + schemeFees = + (schemeFees ?: JsonField.of(mutableListOf())).also { + checkKnown("schemeFees", it).add(schemeFee) + } + } + /** * The terminal identifier (commonly abbreviated as TID) of the terminal the card is * transacting with. @@ -74711,6 +87075,7 @@ private constructor( * .networkRiskScore() * .physicalCardId() * .realTimeDecisionId() + * .schemeFees() * .terminalId() * .type() * .verification() @@ -74738,6 +87103,7 @@ private constructor( checkRequired("networkRiskScore", networkRiskScore), checkRequired("physicalCardId", physicalCardId), checkRequired("realTimeDecisionId", realTimeDecisionId), + checkRequired("schemeFees", schemeFees).map { it.toImmutable() }, checkRequired("terminalId", terminalId), checkRequired("type", type), checkRequired("verification", verification), @@ -74770,6 +87136,7 @@ private constructor( networkRiskScore() physicalCardId() realTimeDecisionId() + schemeFees().forEach { it.validate() } terminalId() type().validate() verification().validate() @@ -74810,6 +87177,7 @@ private constructor( (if (networkRiskScore.asKnown().isPresent) 1 else 0) + (if (physicalCardId.asKnown().isPresent) 1 else 0) + (if (realTimeDecisionId.asKnown().isPresent) 1 else 0) + + (schemeFees.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (terminalId.asKnown().isPresent) 1 else 0) + (type.asKnown().getOrNull()?.validity() ?: 0) + (verification.asKnown().getOrNull()?.validity() ?: 0) @@ -78217,141 +90585,641 @@ private constructor( return@apply } - category().validate() - pulse().ifPresent { it.validate() } - visa().ifPresent { it.validate() } - validated = true - } + category().validate() + pulse().ifPresent { it.validate() } + visa().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (category.asKnown().getOrNull()?.validity() ?: 0) + + (pulse.asKnown().getOrNull()?.validity() ?: 0) + + (visa.asKnown().getOrNull()?.validity() ?: 0) + + /** The payment network used to process this card authorization. */ + class Category + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** Visa */ + @JvmField val VISA = of("visa") + + /** Pulse */ + @JvmField val PULSE = of("pulse") + + @JvmStatic fun of(value: String) = Category(JsonField.of(value)) + } + + /** An enum containing [Category]'s known values. */ + enum class Known { + /** Visa */ + VISA, + /** Pulse */ + PULSE, + } + + /** + * An enum containing [Category]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Category] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** Visa */ + VISA, + /** Pulse */ + PULSE, + /** + * An enum member indicating that [Category] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + VISA -> Value.VISA + PULSE -> Value.PULSE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + VISA -> Known.VISA + PULSE -> Known.PULSE + else -> throw IncreaseInvalidDataException("Unknown Category: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Category = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Category && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Fields specific to the `pulse` network. */ + class Pulse + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val additionalProperties: MutableMap + ) { + + @JsonCreator private constructor() : this(mutableMapOf()) + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Pulse]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Pulse]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(pulse: Pulse) = apply { + additionalProperties = pulse.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Pulse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Pulse = Pulse(additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Pulse = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = 0 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Pulse && additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "Pulse{additionalProperties=$additionalProperties}" + } + + /** Fields specific to the `visa` network. */ + class Visa + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val electronicCommerceIndicator: JsonField, + private val pointOfServiceEntryMode: JsonField, + private val standInProcessingReason: JsonField, + private val terminalEntryCapability: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("electronic_commerce_indicator") + @ExcludeMissing + electronicCommerceIndicator: JsonField = + JsonMissing.of(), + @JsonProperty("point_of_service_entry_mode") + @ExcludeMissing + pointOfServiceEntryMode: JsonField = + JsonMissing.of(), + @JsonProperty("stand_in_processing_reason") + @ExcludeMissing + standInProcessingReason: JsonField = + JsonMissing.of(), + @JsonProperty("terminal_entry_capability") + @ExcludeMissing + terminalEntryCapability: JsonField = + JsonMissing.of(), + ) : this( + electronicCommerceIndicator, + pointOfServiceEntryMode, + standInProcessingReason, + terminalEntryCapability, + mutableMapOf(), + ) + + /** + * For electronic commerce transactions, this identifies the level of security + * used in obtaining the customer's payment credential. For mail or telephone + * order transactions, identifies the type of mail or telephone order. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun electronicCommerceIndicator(): Optional = + electronicCommerceIndicator.getOptional("electronic_commerce_indicator") + + /** + * The method used to enter the cardholder's primary account number and card + * expiration date. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun pointOfServiceEntryMode(): Optional = + pointOfServiceEntryMode.getOptional("point_of_service_entry_mode") + + /** + * Only present when `actioner: network`. Describes why a card authorization was + * approved or declined by Visa through stand-in processing. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun standInProcessingReason(): Optional = + standInProcessingReason.getOptional("stand_in_processing_reason") + + /** + * The capability of the terminal being used to read the card. Shows whether a + * terminal can e.g., accept chip cards or if it only supports magnetic stripe + * reads. This reflects the highest capability of the terminal — for example, a + * terminal that supports both chip and magnetic stripe will be identified as + * chip-capable. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun terminalEntryCapability(): Optional = + terminalEntryCapability.getOptional("terminal_entry_capability") + + /** + * Returns the raw JSON value of [electronicCommerceIndicator]. + * + * Unlike [electronicCommerceIndicator], this method doesn't throw if the JSON + * field has an unexpected type. + */ + @JsonProperty("electronic_commerce_indicator") + @ExcludeMissing + fun _electronicCommerceIndicator(): JsonField = + electronicCommerceIndicator + + /** + * Returns the raw JSON value of [pointOfServiceEntryMode]. + * + * Unlike [pointOfServiceEntryMode], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("point_of_service_entry_mode") + @ExcludeMissing + fun _pointOfServiceEntryMode(): JsonField = + pointOfServiceEntryMode + + /** + * Returns the raw JSON value of [standInProcessingReason]. + * + * Unlike [standInProcessingReason], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("stand_in_processing_reason") + @ExcludeMissing + fun _standInProcessingReason(): JsonField = + standInProcessingReason + + /** + * Returns the raw JSON value of [terminalEntryCapability]. + * + * Unlike [terminalEntryCapability], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("terminal_entry_capability") + @ExcludeMissing + fun _terminalEntryCapability(): JsonField = + terminalEntryCapability + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Visa]. + * + * The following fields are required: + * ```java + * .electronicCommerceIndicator() + * .pointOfServiceEntryMode() + * .standInProcessingReason() + * .terminalEntryCapability() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Visa]. */ + class Builder internal constructor() { + + private var electronicCommerceIndicator: + JsonField? = + null + private var pointOfServiceEntryMode: JsonField? = + null + private var standInProcessingReason: JsonField? = + null + private var terminalEntryCapability: JsonField? = + null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(visa: Visa) = apply { + electronicCommerceIndicator = visa.electronicCommerceIndicator + pointOfServiceEntryMode = visa.pointOfServiceEntryMode + standInProcessingReason = visa.standInProcessingReason + terminalEntryCapability = visa.terminalEntryCapability + additionalProperties = visa.additionalProperties.toMutableMap() + } + + /** + * For electronic commerce transactions, this identifies the level of + * security used in obtaining the customer's payment credential. For mail or + * telephone order transactions, identifies the type of mail or telephone + * order. + */ + fun electronicCommerceIndicator( + electronicCommerceIndicator: ElectronicCommerceIndicator? + ) = + electronicCommerceIndicator( + JsonField.ofNullable(electronicCommerceIndicator) + ) + + /** + * Alias for calling [Builder.electronicCommerceIndicator] with + * `electronicCommerceIndicator.orElse(null)`. + */ + fun electronicCommerceIndicator( + electronicCommerceIndicator: Optional + ) = electronicCommerceIndicator(electronicCommerceIndicator.getOrNull()) - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * Sets [Builder.electronicCommerceIndicator] to an arbitrary JSON value. + * + * You should usually call [Builder.electronicCommerceIndicator] with a + * well-typed [ElectronicCommerceIndicator] value instead. This method is + * primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun electronicCommerceIndicator( + electronicCommerceIndicator: JsonField + ) = apply { this.electronicCommerceIndicator = electronicCommerceIndicator } - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (category.asKnown().getOrNull()?.validity() ?: 0) + - (pulse.asKnown().getOrNull()?.validity() ?: 0) + - (visa.asKnown().getOrNull()?.validity() ?: 0) + /** + * The method used to enter the cardholder's primary account number and card + * expiration date. + */ + fun pointOfServiceEntryMode( + pointOfServiceEntryMode: PointOfServiceEntryMode? + ) = pointOfServiceEntryMode(JsonField.ofNullable(pointOfServiceEntryMode)) - /** The payment network used to process this card authorization. */ - class Category - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** + * Alias for calling [Builder.pointOfServiceEntryMode] with + * `pointOfServiceEntryMode.orElse(null)`. + */ + fun pointOfServiceEntryMode( + pointOfServiceEntryMode: Optional + ) = pointOfServiceEntryMode(pointOfServiceEntryMode.getOrNull()) - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + /** + * Sets [Builder.pointOfServiceEntryMode] to an arbitrary JSON value. + * + * You should usually call [Builder.pointOfServiceEntryMode] with a + * well-typed [PointOfServiceEntryMode] value instead. This method is + * primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun pointOfServiceEntryMode( + pointOfServiceEntryMode: JsonField + ) = apply { this.pointOfServiceEntryMode = pointOfServiceEntryMode } - companion object { + /** + * Only present when `actioner: network`. Describes why a card authorization + * was approved or declined by Visa through stand-in processing. + */ + fun standInProcessingReason( + standInProcessingReason: StandInProcessingReason? + ) = standInProcessingReason(JsonField.ofNullable(standInProcessingReason)) - /** Visa */ - @JvmField val VISA = of("visa") + /** + * Alias for calling [Builder.standInProcessingReason] with + * `standInProcessingReason.orElse(null)`. + */ + fun standInProcessingReason( + standInProcessingReason: Optional + ) = standInProcessingReason(standInProcessingReason.getOrNull()) - /** Pulse */ - @JvmField val PULSE = of("pulse") + /** + * Sets [Builder.standInProcessingReason] to an arbitrary JSON value. + * + * You should usually call [Builder.standInProcessingReason] with a + * well-typed [StandInProcessingReason] value instead. This method is + * primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun standInProcessingReason( + standInProcessingReason: JsonField + ) = apply { this.standInProcessingReason = standInProcessingReason } - @JvmStatic fun of(value: String) = Category(JsonField.of(value)) - } + /** + * The capability of the terminal being used to read the card. Shows whether + * a terminal can e.g., accept chip cards or if it only supports magnetic + * stripe reads. This reflects the highest capability of the terminal — for + * example, a terminal that supports both chip and magnetic stripe will be + * identified as chip-capable. + */ + fun terminalEntryCapability( + terminalEntryCapability: TerminalEntryCapability? + ) = terminalEntryCapability(JsonField.ofNullable(terminalEntryCapability)) - /** An enum containing [Category]'s known values. */ - enum class Known { - /** Visa */ - VISA, - /** Pulse */ - PULSE, - } + /** + * Alias for calling [Builder.terminalEntryCapability] with + * `terminalEntryCapability.orElse(null)`. + */ + fun terminalEntryCapability( + terminalEntryCapability: Optional + ) = terminalEntryCapability(terminalEntryCapability.getOrNull()) - /** - * An enum containing [Category]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [Category] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** Visa */ - VISA, - /** Pulse */ - PULSE, /** - * An enum member indicating that [Category] was instantiated with an - * unknown value. + * Sets [Builder.terminalEntryCapability] to an arbitrary JSON value. + * + * You should usually call [Builder.terminalEntryCapability] with a + * well-typed [TerminalEntryCapability] value instead. This method is + * primarily for setting the field to an undocumented or not yet supported + * value. */ - _UNKNOWN, - } + fun terminalEntryCapability( + terminalEntryCapability: JsonField + ) = apply { this.terminalEntryCapability = terminalEntryCapability } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - VISA -> Value.VISA - PULSE -> Value.PULSE - else -> Value._UNKNOWN + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a not - * a known member. - */ - fun known(): Known = - when (this) { - VISA -> Known.VISA - PULSE -> Known.PULSE - else -> throw IncreaseInvalidDataException("Unknown Category: $value") + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [Visa]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .electronicCommerceIndicator() + * .pointOfServiceEntryMode() + * .standInProcessingReason() + * .terminalEntryCapability() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Visa = + Visa( + checkRequired( + "electronicCommerceIndicator", + electronicCommerceIndicator, + ), + checkRequired("pointOfServiceEntryMode", pointOfServiceEntryMode), + checkRequired("standInProcessingReason", standInProcessingReason), + checkRequired("terminalEntryCapability", terminalEntryCapability), + additionalProperties.toMutableMap(), + ) + } + private var validated: Boolean = false - fun validate(): Category = apply { + fun validate(): Visa = apply { if (validated) { return@apply } - known() + electronicCommerceIndicator().ifPresent { it.validate() } + pointOfServiceEntryMode().ifPresent { it.validate() } + standInProcessingReason().ifPresent { it.validate() } + terminalEntryCapability().ifPresent { it.validate() } validated = true } @@ -78370,518 +91238,846 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + internal fun validity(): Int = + (electronicCommerceIndicator.asKnown().getOrNull()?.validity() ?: 0) + + (pointOfServiceEntryMode.asKnown().getOrNull()?.validity() ?: 0) + + (standInProcessingReason.asKnown().getOrNull()?.validity() ?: 0) + + (terminalEntryCapability.asKnown().getOrNull()?.validity() ?: 0) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * For electronic commerce transactions, this identifies the level of security + * used in obtaining the customer's payment credential. For mail or telephone + * order transactions, identifies the type of mail or telephone order. + */ + class ElectronicCommerceIndicator + @JsonCreator + private constructor(private val value: JsonField) : Enum { - return other is Category && value == other.value - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - override fun hashCode() = value.hashCode() + companion object { - override fun toString() = value.toString() - } + /** + * Single transaction of a mail/phone order: Use to indicate that the + * transaction is a mail/phone order purchase, not a recurring + * transaction or installment payment. For domestic transactions in the + * US region, this value may also indicate one bill payment transaction + * in the card-present or card-absent environments. + */ + @JvmField val MAIL_PHONE_ORDER = of("mail_phone_order") - /** Fields specific to the `pulse` network. */ - class Pulse - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val additionalProperties: MutableMap - ) { + /** + * Recurring transaction: Payment indicator used to indicate a recurring + * transaction that originates from an acquirer in the US region. + */ + @JvmField val RECURRING = of("recurring") - @JsonCreator private constructor() : this(mutableMapOf()) + /** + * Installment payment: Payment indicator used to indicate one purchase + * of goods or services that is billed to the account in multiple + * charges over a period of time agreed upon by the cardholder and + * merchant from transactions that originate from an acquirer in the US + * region. + */ + @JvmField val INSTALLMENT = of("installment") - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** + * Unknown classification: other mail order: Use to indicate that the + * type of mail/telephone order is unknown. + */ + @JvmField val UNKNOWN_MAIL_PHONE_ORDER = of("unknown_mail_phone_order") - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** + * Secure electronic commerce transaction: Use to indicate that the + * electronic commerce transaction has been authenticated using e.g., + * 3-D Secure + */ + @JvmField + val SECURE_ELECTRONIC_COMMERCE = of("secure_electronic_commerce") - fun toBuilder() = Builder().from(this) + /** + * Non-authenticated security transaction at a 3-D Secure-capable + * merchant, and merchant attempted to authenticate the cardholder using + * 3-D Secure: Use to identify an electronic commerce transaction where + * the merchant attempted to authenticate the cardholder using 3-D + * Secure, but was unable to complete the authentication because the + * issuer or cardholder does not participate in the 3-D Secure program. + */ + @JvmField + val NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT = + of("non_authenticated_security_transaction_at_3ds_capable_merchant") - companion object { + /** + * Non-authenticated security transaction: Use to identify an electronic + * commerce transaction that uses data encryption for security however, + * cardholder authentication is not performed using 3-D Secure. + */ + @JvmField + val NON_AUTHENTICATED_SECURITY_TRANSACTION = + of("non_authenticated_security_transaction") - /** Returns a mutable builder for constructing an instance of [Pulse]. */ - @JvmStatic fun builder() = Builder() - } + /** + * Non-secure transaction: Use to identify an electronic commerce + * transaction that has no data protection. + */ + @JvmField val NON_SECURE_TRANSACTION = of("non_secure_transaction") - /** A builder for [Pulse]. */ - class Builder internal constructor() { + @JvmStatic + fun of(value: String) = ElectronicCommerceIndicator(JsonField.of(value)) + } - private var additionalProperties: MutableMap = - mutableMapOf() + /** An enum containing [ElectronicCommerceIndicator]'s known values. */ + enum class Known { + /** + * Single transaction of a mail/phone order: Use to indicate that the + * transaction is a mail/phone order purchase, not a recurring + * transaction or installment payment. For domestic transactions in the + * US region, this value may also indicate one bill payment transaction + * in the card-present or card-absent environments. + */ + MAIL_PHONE_ORDER, + /** + * Recurring transaction: Payment indicator used to indicate a recurring + * transaction that originates from an acquirer in the US region. + */ + RECURRING, + /** + * Installment payment: Payment indicator used to indicate one purchase + * of goods or services that is billed to the account in multiple + * charges over a period of time agreed upon by the cardholder and + * merchant from transactions that originate from an acquirer in the US + * region. + */ + INSTALLMENT, + /** + * Unknown classification: other mail order: Use to indicate that the + * type of mail/telephone order is unknown. + */ + UNKNOWN_MAIL_PHONE_ORDER, + /** + * Secure electronic commerce transaction: Use to indicate that the + * electronic commerce transaction has been authenticated using e.g., + * 3-D Secure + */ + SECURE_ELECTRONIC_COMMERCE, + /** + * Non-authenticated security transaction at a 3-D Secure-capable + * merchant, and merchant attempted to authenticate the cardholder using + * 3-D Secure: Use to identify an electronic commerce transaction where + * the merchant attempted to authenticate the cardholder using 3-D + * Secure, but was unable to complete the authentication because the + * issuer or cardholder does not participate in the 3-D Secure program. + */ + NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT, + /** + * Non-authenticated security transaction: Use to identify an electronic + * commerce transaction that uses data encryption for security however, + * cardholder authentication is not performed using 3-D Secure. + */ + NON_AUTHENTICATED_SECURITY_TRANSACTION, + /** + * Non-secure transaction: Use to identify an electronic commerce + * transaction that has no data protection. + */ + NON_SECURE_TRANSACTION, + } + + /** + * An enum containing [ElectronicCommerceIndicator]'s known values, as well + * as an [_UNKNOWN] member. + * + * An instance of [ElectronicCommerceIndicator] can contain an unknown value + * in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** + * Single transaction of a mail/phone order: Use to indicate that the + * transaction is a mail/phone order purchase, not a recurring + * transaction or installment payment. For domestic transactions in the + * US region, this value may also indicate one bill payment transaction + * in the card-present or card-absent environments. + */ + MAIL_PHONE_ORDER, + /** + * Recurring transaction: Payment indicator used to indicate a recurring + * transaction that originates from an acquirer in the US region. + */ + RECURRING, + /** + * Installment payment: Payment indicator used to indicate one purchase + * of goods or services that is billed to the account in multiple + * charges over a period of time agreed upon by the cardholder and + * merchant from transactions that originate from an acquirer in the US + * region. + */ + INSTALLMENT, + /** + * Unknown classification: other mail order: Use to indicate that the + * type of mail/telephone order is unknown. + */ + UNKNOWN_MAIL_PHONE_ORDER, + /** + * Secure electronic commerce transaction: Use to indicate that the + * electronic commerce transaction has been authenticated using e.g., + * 3-D Secure + */ + SECURE_ELECTRONIC_COMMERCE, + /** + * Non-authenticated security transaction at a 3-D Secure-capable + * merchant, and merchant attempted to authenticate the cardholder using + * 3-D Secure: Use to identify an electronic commerce transaction where + * the merchant attempted to authenticate the cardholder using 3-D + * Secure, but was unable to complete the authentication because the + * issuer or cardholder does not participate in the 3-D Secure program. + */ + NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT, + /** + * Non-authenticated security transaction: Use to identify an electronic + * commerce transaction that uses data encryption for security however, + * cardholder authentication is not performed using 3-D Secure. + */ + NON_AUTHENTICATED_SECURITY_TRANSACTION, + /** + * Non-secure transaction: Use to identify an electronic commerce + * transaction that has no data protection. + */ + NON_SECURE_TRANSACTION, + /** + * An enum member indicating that [ElectronicCommerceIndicator] was + * instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + MAIL_PHONE_ORDER -> Value.MAIL_PHONE_ORDER + RECURRING -> Value.RECURRING + INSTALLMENT -> Value.INSTALLMENT + UNKNOWN_MAIL_PHONE_ORDER -> Value.UNKNOWN_MAIL_PHONE_ORDER + SECURE_ELECTRONIC_COMMERCE -> Value.SECURE_ELECTRONIC_COMMERCE + NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT -> + Value + .NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT + NON_AUTHENTICATED_SECURITY_TRANSACTION -> + Value.NON_AUTHENTICATED_SECURITY_TRANSACTION + NON_SECURE_TRANSACTION -> Value.NON_SECURE_TRANSACTION + else -> Value._UNKNOWN + } - @JvmSynthetic - internal fun from(pulse: Pulse) = apply { - additionalProperties = pulse.additionalProperties.toMutableMap() - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + MAIL_PHONE_ORDER -> Known.MAIL_PHONE_ORDER + RECURRING -> Known.RECURRING + INSTALLMENT -> Known.INSTALLMENT + UNKNOWN_MAIL_PHONE_ORDER -> Known.UNKNOWN_MAIL_PHONE_ORDER + SECURE_ELECTRONIC_COMMERCE -> Known.SECURE_ELECTRONIC_COMMERCE + NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT -> + Known + .NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT + NON_AUTHENTICATED_SECURITY_TRANSACTION -> + Known.NON_AUTHENTICATED_SECURITY_TRANSACTION + NON_SECURE_TRANSACTION -> Known.NON_SECURE_TRANSACTION + else -> + throw IncreaseInvalidDataException( + "Unknown ElectronicCommerceIndicator: $value" + ) + } - fun additionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + private var validated: Boolean = false - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun validate(): ElectronicCommerceIndicator = apply { + if (validated) { + return@apply + } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + known() + validated = true } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } /** - * Returns an immutable instance of [Pulse]. + * Returns a score indicating how many valid values are contained in this + * object recursively. * - * Further updates to this [Builder] will not mutate the returned instance. + * Used for best match union deserialization. */ - fun build(): Pulse = Pulse(additionalProperties.toMutableMap()) - } + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - private var validated: Boolean = false + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun validate(): Pulse = apply { - if (validated) { - return@apply + return other is ElectronicCommerceIndicator && value == other.value } - validated = true - } + override fun hashCode() = value.hashCode() - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + override fun toString() = value.toString() + } /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. + * The method used to enter the cardholder's primary account number and card + * expiration date. */ - @JvmSynthetic internal fun validity(): Int = 0 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Pulse && additionalProperties == other.additionalProperties - } + class PointOfServiceEntryMode + @JsonCreator + private constructor(private val value: JsonField) : Enum { - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - override fun hashCode(): Int = hashCode + companion object { - override fun toString() = "Pulse{additionalProperties=$additionalProperties}" - } + /** Unknown */ + @JvmField val UNKNOWN = of("unknown") - /** Fields specific to the `visa` network. */ - class Visa - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val electronicCommerceIndicator: JsonField, - private val pointOfServiceEntryMode: JsonField, - private val standInProcessingReason: JsonField, - private val terminalEntryCapability: JsonField, - private val additionalProperties: MutableMap, - ) { + /** Manual key entry */ + @JvmField val MANUAL = of("manual") - @JsonCreator - private constructor( - @JsonProperty("electronic_commerce_indicator") - @ExcludeMissing - electronicCommerceIndicator: JsonField = - JsonMissing.of(), - @JsonProperty("point_of_service_entry_mode") - @ExcludeMissing - pointOfServiceEntryMode: JsonField = - JsonMissing.of(), - @JsonProperty("stand_in_processing_reason") - @ExcludeMissing - standInProcessingReason: JsonField = - JsonMissing.of(), - @JsonProperty("terminal_entry_capability") - @ExcludeMissing - terminalEntryCapability: JsonField = - JsonMissing.of(), - ) : this( - electronicCommerceIndicator, - pointOfServiceEntryMode, - standInProcessingReason, - terminalEntryCapability, - mutableMapOf(), - ) + /** Magnetic stripe read, without card verification value */ + @JvmField val MAGNETIC_STRIPE_NO_CVV = of("magnetic_stripe_no_cvv") - /** - * For electronic commerce transactions, this identifies the level of security - * used in obtaining the customer's payment credential. For mail or telephone - * order transactions, identifies the type of mail or telephone order. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun electronicCommerceIndicator(): Optional = - electronicCommerceIndicator.getOptional("electronic_commerce_indicator") + /** Optical code */ + @JvmField val OPTICAL_CODE = of("optical_code") - /** - * The method used to enter the cardholder's primary account number and card - * expiration date. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun pointOfServiceEntryMode(): Optional = - pointOfServiceEntryMode.getOptional("point_of_service_entry_mode") + /** Contact chip card */ + @JvmField val INTEGRATED_CIRCUIT_CARD = of("integrated_circuit_card") - /** - * Only present when `actioner: network`. Describes why a card authorization was - * approved or declined by Visa through stand-in processing. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun standInProcessingReason(): Optional = - standInProcessingReason.getOptional("stand_in_processing_reason") + /** Contactless read of chip card */ + @JvmField val CONTACTLESS = of("contactless") - /** - * The capability of the terminal being used to read the card. Shows whether a - * terminal can e.g., accept chip cards or if it only supports magnetic stripe - * reads. This reflects the highest capability of the terminal — for example, a - * terminal that supports both chip and magnetic stripe will be identified as - * chip-capable. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun terminalEntryCapability(): Optional = - terminalEntryCapability.getOptional("terminal_entry_capability") + /** + * Transaction initiated using a credential that has previously been + * stored on file + */ + @JvmField val CREDENTIAL_ON_FILE = of("credential_on_file") - /** - * Returns the raw JSON value of [electronicCommerceIndicator]. - * - * Unlike [electronicCommerceIndicator], this method doesn't throw if the JSON - * field has an unexpected type. - */ - @JsonProperty("electronic_commerce_indicator") - @ExcludeMissing - fun _electronicCommerceIndicator(): JsonField = - electronicCommerceIndicator + /** Magnetic stripe read */ + @JvmField val MAGNETIC_STRIPE = of("magnetic_stripe") - /** - * Returns the raw JSON value of [pointOfServiceEntryMode]. - * - * Unlike [pointOfServiceEntryMode], this method doesn't throw if the JSON field - * has an unexpected type. - */ - @JsonProperty("point_of_service_entry_mode") - @ExcludeMissing - fun _pointOfServiceEntryMode(): JsonField = - pointOfServiceEntryMode + /** Contactless read of magnetic stripe data */ + @JvmField + val CONTACTLESS_MAGNETIC_STRIPE = of("contactless_magnetic_stripe") - /** - * Returns the raw JSON value of [standInProcessingReason]. - * - * Unlike [standInProcessingReason], this method doesn't throw if the JSON field - * has an unexpected type. - */ - @JsonProperty("stand_in_processing_reason") - @ExcludeMissing - fun _standInProcessingReason(): JsonField = - standInProcessingReason + /** Contact chip card, without card verification value */ + @JvmField + val INTEGRATED_CIRCUIT_CARD_NO_CVV = + of("integrated_circuit_card_no_cvv") - /** - * Returns the raw JSON value of [terminalEntryCapability]. - * - * Unlike [terminalEntryCapability], this method doesn't throw if the JSON field - * has an unexpected type. - */ - @JsonProperty("terminal_entry_capability") - @ExcludeMissing - fun _terminalEntryCapability(): JsonField = - terminalEntryCapability + @JvmStatic + fun of(value: String) = PointOfServiceEntryMode(JsonField.of(value)) + } - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** An enum containing [PointOfServiceEntryMode]'s known values. */ + enum class Known { + /** Unknown */ + UNKNOWN, + /** Manual key entry */ + MANUAL, + /** Magnetic stripe read, without card verification value */ + MAGNETIC_STRIPE_NO_CVV, + /** Optical code */ + OPTICAL_CODE, + /** Contact chip card */ + INTEGRATED_CIRCUIT_CARD, + /** Contactless read of chip card */ + CONTACTLESS, + /** + * Transaction initiated using a credential that has previously been + * stored on file + */ + CREDENTIAL_ON_FILE, + /** Magnetic stripe read */ + MAGNETIC_STRIPE, + /** Contactless read of magnetic stripe data */ + CONTACTLESS_MAGNETIC_STRIPE, + /** Contact chip card, without card verification value */ + INTEGRATED_CIRCUIT_CARD_NO_CVV, + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** + * An enum containing [PointOfServiceEntryMode]'s known values, as well as + * an [_UNKNOWN] member. + * + * An instance of [PointOfServiceEntryMode] can contain an unknown value in + * a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** Unknown */ + UNKNOWN, + /** Manual key entry */ + MANUAL, + /** Magnetic stripe read, without card verification value */ + MAGNETIC_STRIPE_NO_CVV, + /** Optical code */ + OPTICAL_CODE, + /** Contact chip card */ + INTEGRATED_CIRCUIT_CARD, + /** Contactless read of chip card */ + CONTACTLESS, + /** + * Transaction initiated using a credential that has previously been + * stored on file + */ + CREDENTIAL_ON_FILE, + /** Magnetic stripe read */ + MAGNETIC_STRIPE, + /** Contactless read of magnetic stripe data */ + CONTACTLESS_MAGNETIC_STRIPE, + /** Contact chip card, without card verification value */ + INTEGRATED_CIRCUIT_CARD_NO_CVV, + /** + * An enum member indicating that [PointOfServiceEntryMode] was + * instantiated with an unknown value. + */ + _UNKNOWN, + } - fun toBuilder() = Builder().from(this) + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + UNKNOWN -> Value.UNKNOWN + MANUAL -> Value.MANUAL + MAGNETIC_STRIPE_NO_CVV -> Value.MAGNETIC_STRIPE_NO_CVV + OPTICAL_CODE -> Value.OPTICAL_CODE + INTEGRATED_CIRCUIT_CARD -> Value.INTEGRATED_CIRCUIT_CARD + CONTACTLESS -> Value.CONTACTLESS + CREDENTIAL_ON_FILE -> Value.CREDENTIAL_ON_FILE + MAGNETIC_STRIPE -> Value.MAGNETIC_STRIPE + CONTACTLESS_MAGNETIC_STRIPE -> Value.CONTACTLESS_MAGNETIC_STRIPE + INTEGRATED_CIRCUIT_CARD_NO_CVV -> + Value.INTEGRATED_CIRCUIT_CARD_NO_CVV + else -> Value._UNKNOWN + } - companion object { + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + UNKNOWN -> Known.UNKNOWN + MANUAL -> Known.MANUAL + MAGNETIC_STRIPE_NO_CVV -> Known.MAGNETIC_STRIPE_NO_CVV + OPTICAL_CODE -> Known.OPTICAL_CODE + INTEGRATED_CIRCUIT_CARD -> Known.INTEGRATED_CIRCUIT_CARD + CONTACTLESS -> Known.CONTACTLESS + CREDENTIAL_ON_FILE -> Known.CREDENTIAL_ON_FILE + MAGNETIC_STRIPE -> Known.MAGNETIC_STRIPE + CONTACTLESS_MAGNETIC_STRIPE -> Known.CONTACTLESS_MAGNETIC_STRIPE + INTEGRATED_CIRCUIT_CARD_NO_CVV -> + Known.INTEGRATED_CIRCUIT_CARD_NO_CVV + else -> + throw IncreaseInvalidDataException( + "Unknown PointOfServiceEntryMode: $value" + ) + } /** - * Returns a mutable builder for constructing an instance of [Visa]. + * Returns this class instance's primitive wire representation. * - * The following fields are required: - * ```java - * .electronicCommerceIndicator() - * .pointOfServiceEntryMode() - * .standInProcessingReason() - * .terminalEntryCapability() - * ``` + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. */ - @JvmStatic fun builder() = Builder() - } + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - /** A builder for [Visa]. */ - class Builder internal constructor() { + private var validated: Boolean = false - private var electronicCommerceIndicator: - JsonField? = - null - private var pointOfServiceEntryMode: JsonField? = - null - private var standInProcessingReason: JsonField? = - null - private var terminalEntryCapability: JsonField? = - null - private var additionalProperties: MutableMap = - mutableMapOf() + fun validate(): PointOfServiceEntryMode = apply { + if (validated) { + return@apply + } - @JvmSynthetic - internal fun from(visa: Visa) = apply { - electronicCommerceIndicator = visa.electronicCommerceIndicator - pointOfServiceEntryMode = visa.pointOfServiceEntryMode - standInProcessingReason = visa.standInProcessingReason - terminalEntryCapability = visa.terminalEntryCapability - additionalProperties = visa.additionalProperties.toMutableMap() + known() + validated = true } - /** - * For electronic commerce transactions, this identifies the level of - * security used in obtaining the customer's payment credential. For mail or - * telephone order transactions, identifies the type of mail or telephone - * order. - */ - fun electronicCommerceIndicator( - electronicCommerceIndicator: ElectronicCommerceIndicator? - ) = - electronicCommerceIndicator( - JsonField.ofNullable(electronicCommerceIndicator) - ) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } /** - * Alias for calling [Builder.electronicCommerceIndicator] with - * `electronicCommerceIndicator.orElse(null)`. + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. */ - fun electronicCommerceIndicator( - electronicCommerceIndicator: Optional - ) = electronicCommerceIndicator(electronicCommerceIndicator.getOrNull()) + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is PointOfServiceEntryMode && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * Only present when `actioner: network`. Describes why a card authorization was + * approved or declined by Visa through stand-in processing. + */ + class StandInProcessingReason + @JsonCreator + private constructor(private val value: JsonField) : Enum { /** - * Sets [Builder.electronicCommerceIndicator] to an arbitrary JSON value. + * Returns this class instance's raw value. * - * You should usually call [Builder.electronicCommerceIndicator] with a - * well-typed [ElectronicCommerceIndicator] value instead. This method is - * primarily for setting the field to an undocumented or not yet supported - * value. + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. */ - fun electronicCommerceIndicator( - electronicCommerceIndicator: JsonField - ) = apply { this.electronicCommerceIndicator = electronicCommerceIndicator } + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** - * The method used to enter the cardholder's primary account number and card - * expiration date. - */ - fun pointOfServiceEntryMode( - pointOfServiceEntryMode: PointOfServiceEntryMode? - ) = pointOfServiceEntryMode(JsonField.ofNullable(pointOfServiceEntryMode)) + companion object { - /** - * Alias for calling [Builder.pointOfServiceEntryMode] with - * `pointOfServiceEntryMode.orElse(null)`. - */ - fun pointOfServiceEntryMode( - pointOfServiceEntryMode: Optional - ) = pointOfServiceEntryMode(pointOfServiceEntryMode.getOrNull()) + /** Increase failed to process the authorization in a timely manner. */ + @JvmField val ISSUER_ERROR = of("issuer_error") - /** - * Sets [Builder.pointOfServiceEntryMode] to an arbitrary JSON value. - * - * You should usually call [Builder.pointOfServiceEntryMode] with a - * well-typed [PointOfServiceEntryMode] value instead. This method is - * primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun pointOfServiceEntryMode( - pointOfServiceEntryMode: JsonField - ) = apply { this.pointOfServiceEntryMode = pointOfServiceEntryMode } + /** The physical card read had an invalid CVV or dCVV. */ + @JvmField val INVALID_PHYSICAL_CARD = of("invalid_physical_card") - /** - * Only present when `actioner: network`. Describes why a card authorization - * was approved or declined by Visa through stand-in processing. - */ - fun standInProcessingReason( - standInProcessingReason: StandInProcessingReason? - ) = standInProcessingReason(JsonField.ofNullable(standInProcessingReason)) + /** + * The card's authorization request cryptogram was invalid. The + * cryptogram can be from a physical card or a Digital Wallet Token + * purchase. + */ + @JvmField val INVALID_CRYPTOGRAM = of("invalid_cryptogram") - /** - * Alias for calling [Builder.standInProcessingReason] with - * `standInProcessingReason.orElse(null)`. - */ - fun standInProcessingReason( - standInProcessingReason: Optional - ) = standInProcessingReason(standInProcessingReason.getOrNull()) + /** The 3DS cardholder authentication verification value was invalid. */ + @JvmField + val INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE = + of("invalid_cardholder_authentication_verification_value") + + /** + * An internal Visa error occurred. Visa uses this reason code for + * certain expected occurrences as well, such as Application Transaction + * Counter (ATC) replays. + */ + @JvmField val INTERNAL_VISA_ERROR = of("internal_visa_error") + + /** + * The merchant has enabled Visa's Transaction Advisory Service and + * requires further authentication to perform the transaction. In + * practice this is often utilized at fuel pumps to tell the cardholder + * to see the cashier. + */ + @JvmField + val MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED = + of("merchant_transaction_advisory_service_authentication_required") + + /** + * The transaction was blocked by Visa's Payment Fraud Disruption + * service due to fraudulent Acquirer behavior, such as card testing. + */ + @JvmField + val PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK = + of("payment_fraud_disruption_acquirer_block") + + /** An unspecific reason for stand-in processing. */ + @JvmField val OTHER = of("other") + + @JvmStatic + fun of(value: String) = StandInProcessingReason(JsonField.of(value)) + } + + /** An enum containing [StandInProcessingReason]'s known values. */ + enum class Known { + /** Increase failed to process the authorization in a timely manner. */ + ISSUER_ERROR, + /** The physical card read had an invalid CVV or dCVV. */ + INVALID_PHYSICAL_CARD, + /** + * The card's authorization request cryptogram was invalid. The + * cryptogram can be from a physical card or a Digital Wallet Token + * purchase. + */ + INVALID_CRYPTOGRAM, + /** The 3DS cardholder authentication verification value was invalid. */ + INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE, + /** + * An internal Visa error occurred. Visa uses this reason code for + * certain expected occurrences as well, such as Application Transaction + * Counter (ATC) replays. + */ + INTERNAL_VISA_ERROR, + /** + * The merchant has enabled Visa's Transaction Advisory Service and + * requires further authentication to perform the transaction. In + * practice this is often utilized at fuel pumps to tell the cardholder + * to see the cashier. + */ + MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED, + /** + * The transaction was blocked by Visa's Payment Fraud Disruption + * service due to fraudulent Acquirer behavior, such as card testing. + */ + PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK, + /** An unspecific reason for stand-in processing. */ + OTHER, + } /** - * Sets [Builder.standInProcessingReason] to an arbitrary JSON value. + * An enum containing [StandInProcessingReason]'s known values, as well as + * an [_UNKNOWN] member. * - * You should usually call [Builder.standInProcessingReason] with a - * well-typed [StandInProcessingReason] value instead. This method is - * primarily for setting the field to an undocumented or not yet supported - * value. + * An instance of [StandInProcessingReason] can contain an unknown value in + * a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. */ - fun standInProcessingReason( - standInProcessingReason: JsonField - ) = apply { this.standInProcessingReason = standInProcessingReason } + enum class Value { + /** Increase failed to process the authorization in a timely manner. */ + ISSUER_ERROR, + /** The physical card read had an invalid CVV or dCVV. */ + INVALID_PHYSICAL_CARD, + /** + * The card's authorization request cryptogram was invalid. The + * cryptogram can be from a physical card or a Digital Wallet Token + * purchase. + */ + INVALID_CRYPTOGRAM, + /** The 3DS cardholder authentication verification value was invalid. */ + INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE, + /** + * An internal Visa error occurred. Visa uses this reason code for + * certain expected occurrences as well, such as Application Transaction + * Counter (ATC) replays. + */ + INTERNAL_VISA_ERROR, + /** + * The merchant has enabled Visa's Transaction Advisory Service and + * requires further authentication to perform the transaction. In + * practice this is often utilized at fuel pumps to tell the cardholder + * to see the cashier. + */ + MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED, + /** + * The transaction was blocked by Visa's Payment Fraud Disruption + * service due to fraudulent Acquirer behavior, such as card testing. + */ + PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK, + /** An unspecific reason for stand-in processing. */ + OTHER, + /** + * An enum member indicating that [StandInProcessingReason] was + * instantiated with an unknown value. + */ + _UNKNOWN, + } /** - * The capability of the terminal being used to read the card. Shows whether - * a terminal can e.g., accept chip cards or if it only supports magnetic - * stripe reads. This reflects the highest capability of the terminal — for - * example, a terminal that supports both chip and magnetic stripe will be - * identified as chip-capable. + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. */ - fun terminalEntryCapability( - terminalEntryCapability: TerminalEntryCapability? - ) = terminalEntryCapability(JsonField.ofNullable(terminalEntryCapability)) + fun value(): Value = + when (this) { + ISSUER_ERROR -> Value.ISSUER_ERROR + INVALID_PHYSICAL_CARD -> Value.INVALID_PHYSICAL_CARD + INVALID_CRYPTOGRAM -> Value.INVALID_CRYPTOGRAM + INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE -> + Value.INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE + INTERNAL_VISA_ERROR -> Value.INTERNAL_VISA_ERROR + MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED -> + Value + .MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED + PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK -> + Value.PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK + OTHER -> Value.OTHER + else -> Value._UNKNOWN + } /** - * Alias for calling [Builder.terminalEntryCapability] with - * `terminalEntryCapability.orElse(null)`. + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. */ - fun terminalEntryCapability( - terminalEntryCapability: Optional - ) = terminalEntryCapability(terminalEntryCapability.getOrNull()) + fun known(): Known = + when (this) { + ISSUER_ERROR -> Known.ISSUER_ERROR + INVALID_PHYSICAL_CARD -> Known.INVALID_PHYSICAL_CARD + INVALID_CRYPTOGRAM -> Known.INVALID_CRYPTOGRAM + INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE -> + Known.INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE + INTERNAL_VISA_ERROR -> Known.INTERNAL_VISA_ERROR + MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED -> + Known + .MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED + PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK -> + Known.PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK + OTHER -> Known.OTHER + else -> + throw IncreaseInvalidDataException( + "Unknown StandInProcessingReason: $value" + ) + } /** - * Sets [Builder.terminalEntryCapability] to an arbitrary JSON value. + * Returns this class instance's primitive wire representation. * - * You should usually call [Builder.terminalEntryCapability] with a - * well-typed [TerminalEntryCapability] value instead. This method is - * primarily for setting the field to an undocumented or not yet supported - * value. + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. */ - fun terminalEntryCapability( - terminalEntryCapability: JsonField - ) = apply { this.terminalEntryCapability = terminalEntryCapability } - - fun additionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + private var validated: Boolean = false - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun validate(): StandInProcessingReason = apply { + if (validated) { + return@apply + } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + known() + validated = true } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } /** - * Returns an immutable instance of [Visa]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .electronicCommerceIndicator() - * .pointOfServiceEntryMode() - * .standInProcessingReason() - * .terminalEntryCapability() - * ``` + * Returns a score indicating how many valid values are contained in this + * object recursively. * - * @throws IllegalStateException if any required field is unset. + * Used for best match union deserialization. */ - fun build(): Visa = - Visa( - checkRequired( - "electronicCommerceIndicator", - electronicCommerceIndicator, - ), - checkRequired("pointOfServiceEntryMode", pointOfServiceEntryMode), - checkRequired("standInProcessingReason", standInProcessingReason), - checkRequired("terminalEntryCapability", terminalEntryCapability), - additionalProperties.toMutableMap(), - ) - } + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - private var validated: Boolean = false + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun validate(): Visa = apply { - if (validated) { - return@apply + return other is StandInProcessingReason && value == other.value } - electronicCommerceIndicator().ifPresent { it.validate() } - pointOfServiceEntryMode().ifPresent { it.validate() } - standInProcessingReason().ifPresent { it.validate() } - terminalEntryCapability().ifPresent { it.validate() } - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + override fun hashCode() = value.hashCode() - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (electronicCommerceIndicator.asKnown().getOrNull()?.validity() ?: 0) + - (pointOfServiceEntryMode.asKnown().getOrNull()?.validity() ?: 0) + - (standInProcessingReason.asKnown().getOrNull()?.validity() ?: 0) + - (terminalEntryCapability.asKnown().getOrNull()?.validity() ?: 0) + override fun toString() = value.toString() + } /** - * For electronic commerce transactions, this identifies the level of security - * used in obtaining the customer's payment credential. For mail or telephone - * order transactions, identifies the type of mail or telephone order. + * The capability of the terminal being used to read the card. Shows whether a + * terminal can e.g., accept chip cards or if it only supports magnetic stripe + * reads. This reflects the highest capability of the terminal — for example, a + * terminal that supports both chip and magnetic stripe will be identified as + * chip-capable. */ - class ElectronicCommerceIndicator + class TerminalEntryCapability @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -78898,197 +92094,121 @@ private constructor( companion object { - /** - * Single transaction of a mail/phone order: Use to indicate that the - * transaction is a mail/phone order purchase, not a recurring - * transaction or installment payment. For domestic transactions in the - * US region, this value may also indicate one bill payment transaction - * in the card-present or card-absent environments. - */ - @JvmField val MAIL_PHONE_ORDER = of("mail_phone_order") + /** Unknown */ + @JvmField val UNKNOWN = of("unknown") - /** - * Recurring transaction: Payment indicator used to indicate a recurring - * transaction that originates from an acquirer in the US region. - */ - @JvmField val RECURRING = of("recurring") + /** No terminal was used for this transaction. */ + @JvmField val TERMINAL_NOT_USED = of("terminal_not_used") /** - * Installment payment: Payment indicator used to indicate one purchase - * of goods or services that is billed to the account in multiple - * charges over a period of time agreed upon by the cardholder and - * merchant from transactions that originate from an acquirer in the US - * region. + * The terminal can only read magnetic stripes and does not have chip or + * contactless reading capability. */ - @JvmField val INSTALLMENT = of("installment") + @JvmField val MAGNETIC_STRIPE = of("magnetic_stripe") - /** - * Unknown classification: other mail order: Use to indicate that the - * type of mail/telephone order is unknown. - */ - @JvmField val UNKNOWN_MAIL_PHONE_ORDER = of("unknown_mail_phone_order") + /** The terminal can only read barcodes. */ + @JvmField val BARCODE = of("barcode") /** - * Secure electronic commerce transaction: Use to indicate that the - * electronic commerce transaction has been authenticated using e.g., - * 3-D Secure + * The terminal can only read cards via Optical Character Recognition. */ @JvmField - val SECURE_ELECTRONIC_COMMERCE = of("secure_electronic_commerce") + val OPTICAL_CHARACTER_RECOGNITION = of("optical_character_recognition") /** - * Non-authenticated security transaction at a 3-D Secure-capable - * merchant, and merchant attempted to authenticate the cardholder using - * 3-D Secure: Use to identify an electronic commerce transaction where - * the merchant attempted to authenticate the cardholder using 3-D - * Secure, but was unable to complete the authentication because the - * issuer or cardholder does not participate in the 3-D Secure program. + * The terminal supports contact chip cards and can also read the + * magnetic stripe. If contact chip is supported, this value is used + * regardless of whether contactless is also supported. */ - @JvmField - val NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT = - of("non_authenticated_security_transaction_at_3ds_capable_merchant") + @JvmField val CHIP_OR_CONTACTLESS = of("chip_or_contactless") /** - * Non-authenticated security transaction: Use to identify an electronic - * commerce transaction that uses data encryption for security however, - * cardholder authentication is not performed using 3-D Secure. + * The terminal supports contactless reads but does not support contact + * chip. Only used when the terminal lacks contact chip capability. */ - @JvmField - val NON_AUTHENTICATED_SECURITY_TRANSACTION = - of("non_authenticated_security_transaction") + @JvmField val CONTACTLESS_ONLY = of("contactless_only") - /** - * Non-secure transaction: Use to identify an electronic commerce - * transaction that has no data protection. - */ - @JvmField val NON_SECURE_TRANSACTION = of("non_secure_transaction") + /** The terminal has no card reading capability. */ + @JvmField val NO_CAPABILITY = of("no_capability") @JvmStatic - fun of(value: String) = ElectronicCommerceIndicator(JsonField.of(value)) + fun of(value: String) = TerminalEntryCapability(JsonField.of(value)) } - /** An enum containing [ElectronicCommerceIndicator]'s known values. */ + /** An enum containing [TerminalEntryCapability]'s known values. */ enum class Known { + /** Unknown */ + UNKNOWN, + /** No terminal was used for this transaction. */ + TERMINAL_NOT_USED, /** - * Single transaction of a mail/phone order: Use to indicate that the - * transaction is a mail/phone order purchase, not a recurring - * transaction or installment payment. For domestic transactions in the - * US region, this value may also indicate one bill payment transaction - * in the card-present or card-absent environments. - */ - MAIL_PHONE_ORDER, - /** - * Recurring transaction: Payment indicator used to indicate a recurring - * transaction that originates from an acquirer in the US region. - */ - RECURRING, - /** - * Installment payment: Payment indicator used to indicate one purchase - * of goods or services that is billed to the account in multiple - * charges over a period of time agreed upon by the cardholder and - * merchant from transactions that originate from an acquirer in the US - * region. - */ - INSTALLMENT, - /** - * Unknown classification: other mail order: Use to indicate that the - * type of mail/telephone order is unknown. - */ - UNKNOWN_MAIL_PHONE_ORDER, - /** - * Secure electronic commerce transaction: Use to indicate that the - * electronic commerce transaction has been authenticated using e.g., - * 3-D Secure + * The terminal can only read magnetic stripes and does not have chip or + * contactless reading capability. */ - SECURE_ELECTRONIC_COMMERCE, + MAGNETIC_STRIPE, + /** The terminal can only read barcodes. */ + BARCODE, /** - * Non-authenticated security transaction at a 3-D Secure-capable - * merchant, and merchant attempted to authenticate the cardholder using - * 3-D Secure: Use to identify an electronic commerce transaction where - * the merchant attempted to authenticate the cardholder using 3-D - * Secure, but was unable to complete the authentication because the - * issuer or cardholder does not participate in the 3-D Secure program. + * The terminal can only read cards via Optical Character Recognition. */ - NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT, + OPTICAL_CHARACTER_RECOGNITION, /** - * Non-authenticated security transaction: Use to identify an electronic - * commerce transaction that uses data encryption for security however, - * cardholder authentication is not performed using 3-D Secure. + * The terminal supports contact chip cards and can also read the + * magnetic stripe. If contact chip is supported, this value is used + * regardless of whether contactless is also supported. */ - NON_AUTHENTICATED_SECURITY_TRANSACTION, + CHIP_OR_CONTACTLESS, /** - * Non-secure transaction: Use to identify an electronic commerce - * transaction that has no data protection. + * The terminal supports contactless reads but does not support contact + * chip. Only used when the terminal lacks contact chip capability. */ - NON_SECURE_TRANSACTION, + CONTACTLESS_ONLY, + /** The terminal has no card reading capability. */ + NO_CAPABILITY, } /** - * An enum containing [ElectronicCommerceIndicator]'s known values, as well - * as an [_UNKNOWN] member. + * An enum containing [TerminalEntryCapability]'s known values, as well as + * an [_UNKNOWN] member. * - * An instance of [ElectronicCommerceIndicator] can contain an unknown value - * in a couple of cases: + * An instance of [TerminalEntryCapability] can contain an unknown value in + * a couple of cases: * - It was deserialized from data that doesn't match any known member. For * example, if the SDK is on an older version than the API, then the API * may respond with new members that the SDK is unaware of. * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { + /** Unknown */ + UNKNOWN, + /** No terminal was used for this transaction. */ + TERMINAL_NOT_USED, /** - * Single transaction of a mail/phone order: Use to indicate that the - * transaction is a mail/phone order purchase, not a recurring - * transaction or installment payment. For domestic transactions in the - * US region, this value may also indicate one bill payment transaction - * in the card-present or card-absent environments. - */ - MAIL_PHONE_ORDER, - /** - * Recurring transaction: Payment indicator used to indicate a recurring - * transaction that originates from an acquirer in the US region. - */ - RECURRING, - /** - * Installment payment: Payment indicator used to indicate one purchase - * of goods or services that is billed to the account in multiple - * charges over a period of time agreed upon by the cardholder and - * merchant from transactions that originate from an acquirer in the US - * region. - */ - INSTALLMENT, - /** - * Unknown classification: other mail order: Use to indicate that the - * type of mail/telephone order is unknown. - */ - UNKNOWN_MAIL_PHONE_ORDER, - /** - * Secure electronic commerce transaction: Use to indicate that the - * electronic commerce transaction has been authenticated using e.g., - * 3-D Secure + * The terminal can only read magnetic stripes and does not have chip or + * contactless reading capability. */ - SECURE_ELECTRONIC_COMMERCE, + MAGNETIC_STRIPE, + /** The terminal can only read barcodes. */ + BARCODE, /** - * Non-authenticated security transaction at a 3-D Secure-capable - * merchant, and merchant attempted to authenticate the cardholder using - * 3-D Secure: Use to identify an electronic commerce transaction where - * the merchant attempted to authenticate the cardholder using 3-D - * Secure, but was unable to complete the authentication because the - * issuer or cardholder does not participate in the 3-D Secure program. + * The terminal can only read cards via Optical Character Recognition. */ - NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT, + OPTICAL_CHARACTER_RECOGNITION, /** - * Non-authenticated security transaction: Use to identify an electronic - * commerce transaction that uses data encryption for security however, - * cardholder authentication is not performed using 3-D Secure. + * The terminal supports contact chip cards and can also read the + * magnetic stripe. If contact chip is supported, this value is used + * regardless of whether contactless is also supported. */ - NON_AUTHENTICATED_SECURITY_TRANSACTION, + CHIP_OR_CONTACTLESS, /** - * Non-secure transaction: Use to identify an electronic commerce - * transaction that has no data protection. + * The terminal supports contactless reads but does not support contact + * chip. Only used when the terminal lacks contact chip capability. */ - NON_SECURE_TRANSACTION, + CONTACTLESS_ONLY, + /** The terminal has no card reading capability. */ + NO_CAPABILITY, /** - * An enum member indicating that [ElectronicCommerceIndicator] was + * An enum member indicating that [TerminalEntryCapability] was * instantiated with an unknown value. */ _UNKNOWN, @@ -79103,17 +92223,14 @@ private constructor( */ fun value(): Value = when (this) { - MAIL_PHONE_ORDER -> Value.MAIL_PHONE_ORDER - RECURRING -> Value.RECURRING - INSTALLMENT -> Value.INSTALLMENT - UNKNOWN_MAIL_PHONE_ORDER -> Value.UNKNOWN_MAIL_PHONE_ORDER - SECURE_ELECTRONIC_COMMERCE -> Value.SECURE_ELECTRONIC_COMMERCE - NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT -> - Value - .NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT - NON_AUTHENTICATED_SECURITY_TRANSACTION -> - Value.NON_AUTHENTICATED_SECURITY_TRANSACTION - NON_SECURE_TRANSACTION -> Value.NON_SECURE_TRANSACTION + UNKNOWN -> Value.UNKNOWN + TERMINAL_NOT_USED -> Value.TERMINAL_NOT_USED + MAGNETIC_STRIPE -> Value.MAGNETIC_STRIPE + BARCODE -> Value.BARCODE + OPTICAL_CHARACTER_RECOGNITION -> Value.OPTICAL_CHARACTER_RECOGNITION + CHIP_OR_CONTACTLESS -> Value.CHIP_OR_CONTACTLESS + CONTACTLESS_ONLY -> Value.CONTACTLESS_ONLY + NO_CAPABILITY -> Value.NO_CAPABILITY else -> Value._UNKNOWN } @@ -79128,20 +92245,17 @@ private constructor( */ fun known(): Known = when (this) { - MAIL_PHONE_ORDER -> Known.MAIL_PHONE_ORDER - RECURRING -> Known.RECURRING - INSTALLMENT -> Known.INSTALLMENT - UNKNOWN_MAIL_PHONE_ORDER -> Known.UNKNOWN_MAIL_PHONE_ORDER - SECURE_ELECTRONIC_COMMERCE -> Known.SECURE_ELECTRONIC_COMMERCE - NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT -> - Known - .NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT - NON_AUTHENTICATED_SECURITY_TRANSACTION -> - Known.NON_AUTHENTICATED_SECURITY_TRANSACTION - NON_SECURE_TRANSACTION -> Known.NON_SECURE_TRANSACTION + UNKNOWN -> Known.UNKNOWN + TERMINAL_NOT_USED -> Known.TERMINAL_NOT_USED + MAGNETIC_STRIPE -> Known.MAGNETIC_STRIPE + BARCODE -> Known.BARCODE + OPTICAL_CHARACTER_RECOGNITION -> Known.OPTICAL_CHARACTER_RECOGNITION + CHIP_OR_CONTACTLESS -> Known.CHIP_OR_CONTACTLESS + CONTACTLESS_ONLY -> Known.CONTACTLESS_ONLY + NO_CAPABILITY -> Known.NO_CAPABILITY else -> throw IncreaseInvalidDataException( - "Unknown ElectronicCommerceIndicator: $value" + "Unknown TerminalEntryCapability: $value" ) } @@ -79161,7 +92275,7 @@ private constructor( private var validated: Boolean = false - fun validate(): ElectronicCommerceIndicator = apply { + fun validate(): TerminalEntryCapability = apply { if (validated) { return@apply } @@ -79192,7 +92306,7 @@ private constructor( return true } - return other is ElectronicCommerceIndicator && value == other.value + return other is TerminalEntryCapability && value == other.value } override fun hashCode() = value.hashCode() @@ -79200,1182 +92314,1751 @@ private constructor( override fun toString() = value.toString() } - /** - * The method used to enter the cardholder's primary account number and card - * expiration date. - */ - class PointOfServiceEntryMode - @JsonCreator - private constructor(private val value: JsonField) : Enum { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + return other is Visa && + electronicCommerceIndicator == other.electronicCommerceIndicator && + pointOfServiceEntryMode == other.pointOfServiceEntryMode && + standInProcessingReason == other.standInProcessingReason && + terminalEntryCapability == other.terminalEntryCapability && + additionalProperties == other.additionalProperties + } - companion object { + private val hashCode: Int by lazy { + Objects.hash( + electronicCommerceIndicator, + pointOfServiceEntryMode, + standInProcessingReason, + terminalEntryCapability, + additionalProperties, + ) + } - /** Unknown */ - @JvmField val UNKNOWN = of("unknown") + override fun hashCode(): Int = hashCode - /** Manual key entry */ - @JvmField val MANUAL = of("manual") + override fun toString() = + "Visa{electronicCommerceIndicator=$electronicCommerceIndicator, pointOfServiceEntryMode=$pointOfServiceEntryMode, standInProcessingReason=$standInProcessingReason, terminalEntryCapability=$terminalEntryCapability, additionalProperties=$additionalProperties}" + } - /** Magnetic stripe read, without card verification value */ - @JvmField val MAGNETIC_STRIPE_NO_CVV = of("magnetic_stripe_no_cvv") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** Optical code */ - @JvmField val OPTICAL_CODE = of("optical_code") + return other is NetworkDetails && + category == other.category && + pulse == other.pulse && + visa == other.visa && + additionalProperties == other.additionalProperties + } - /** Contact chip card */ - @JvmField val INTEGRATED_CIRCUIT_CARD = of("integrated_circuit_card") + private val hashCode: Int by lazy { + Objects.hash(category, pulse, visa, additionalProperties) + } - /** Contactless read of chip card */ - @JvmField val CONTACTLESS = of("contactless") + override fun hashCode(): Int = hashCode - /** - * Transaction initiated using a credential that has previously been - * stored on file - */ - @JvmField val CREDENTIAL_ON_FILE = of("credential_on_file") + override fun toString() = + "NetworkDetails{category=$category, pulse=$pulse, visa=$visa, additionalProperties=$additionalProperties}" + } - /** Magnetic stripe read */ - @JvmField val MAGNETIC_STRIPE = of("magnetic_stripe") + /** Network-specific identifiers for a specific request or transaction. */ + class NetworkIdentifiers + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val authorizationIdentificationResponse: JsonField, + private val retrievalReferenceNumber: JsonField, + private val traceNumber: JsonField, + private val transactionId: JsonField, + private val additionalProperties: MutableMap, + ) { - /** Contactless read of magnetic stripe data */ - @JvmField - val CONTACTLESS_MAGNETIC_STRIPE = of("contactless_magnetic_stripe") + @JsonCreator + private constructor( + @JsonProperty("authorization_identification_response") + @ExcludeMissing + authorizationIdentificationResponse: JsonField = JsonMissing.of(), + @JsonProperty("retrieval_reference_number") + @ExcludeMissing + retrievalReferenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("trace_number") + @ExcludeMissing + traceNumber: JsonField = JsonMissing.of(), + @JsonProperty("transaction_id") + @ExcludeMissing + transactionId: JsonField = JsonMissing.of(), + ) : this( + authorizationIdentificationResponse, + retrievalReferenceNumber, + traceNumber, + transactionId, + mutableMapOf(), + ) - /** Contact chip card, without card verification value */ - @JvmField - val INTEGRATED_CIRCUIT_CARD_NO_CVV = - of("integrated_circuit_card_no_cvv") + /** + * The randomly generated 6-character Authorization Identification Response code + * sent back to the acquirer in an approved response. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun authorizationIdentificationResponse(): Optional = + authorizationIdentificationResponse.getOptional( + "authorization_identification_response" + ) - @JvmStatic - fun of(value: String) = PointOfServiceEntryMode(JsonField.of(value)) - } + /** + * A life-cycle identifier used across e.g., an authorization and a reversal. + * Expected to be unique per acquirer within a window of time. For some card + * networks the retrieval reference number includes the trace counter. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun retrievalReferenceNumber(): Optional = + retrievalReferenceNumber.getOptional("retrieval_reference_number") - /** An enum containing [PointOfServiceEntryMode]'s known values. */ - enum class Known { - /** Unknown */ - UNKNOWN, - /** Manual key entry */ - MANUAL, - /** Magnetic stripe read, without card verification value */ - MAGNETIC_STRIPE_NO_CVV, - /** Optical code */ - OPTICAL_CODE, - /** Contact chip card */ - INTEGRATED_CIRCUIT_CARD, - /** Contactless read of chip card */ - CONTACTLESS, - /** - * Transaction initiated using a credential that has previously been - * stored on file - */ - CREDENTIAL_ON_FILE, - /** Magnetic stripe read */ - MAGNETIC_STRIPE, - /** Contactless read of magnetic stripe data */ - CONTACTLESS_MAGNETIC_STRIPE, - /** Contact chip card, without card verification value */ - INTEGRATED_CIRCUIT_CARD_NO_CVV, - } + /** + * A counter used to verify an individual authorization. Expected to be unique per + * acquirer within a window of time. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun traceNumber(): Optional = traceNumber.getOptional("trace_number") - /** - * An enum containing [PointOfServiceEntryMode]'s known values, as well as - * an [_UNKNOWN] member. - * - * An instance of [PointOfServiceEntryMode] can contain an unknown value in - * a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** Unknown */ - UNKNOWN, - /** Manual key entry */ - MANUAL, - /** Magnetic stripe read, without card verification value */ - MAGNETIC_STRIPE_NO_CVV, - /** Optical code */ - OPTICAL_CODE, - /** Contact chip card */ - INTEGRATED_CIRCUIT_CARD, - /** Contactless read of chip card */ - CONTACTLESS, - /** - * Transaction initiated using a credential that has previously been - * stored on file - */ - CREDENTIAL_ON_FILE, - /** Magnetic stripe read */ - MAGNETIC_STRIPE, - /** Contactless read of magnetic stripe data */ - CONTACTLESS_MAGNETIC_STRIPE, - /** Contact chip card, without card verification value */ - INTEGRATED_CIRCUIT_CARD_NO_CVV, - /** - * An enum member indicating that [PointOfServiceEntryMode] was - * instantiated with an unknown value. - */ - _UNKNOWN, - } + /** + * A globally unique transaction identifier provided by the card network, used + * across multiple life-cycle requests. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun transactionId(): Optional = transactionId.getOptional("transaction_id") - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - UNKNOWN -> Value.UNKNOWN - MANUAL -> Value.MANUAL - MAGNETIC_STRIPE_NO_CVV -> Value.MAGNETIC_STRIPE_NO_CVV - OPTICAL_CODE -> Value.OPTICAL_CODE - INTEGRATED_CIRCUIT_CARD -> Value.INTEGRATED_CIRCUIT_CARD - CONTACTLESS -> Value.CONTACTLESS - CREDENTIAL_ON_FILE -> Value.CREDENTIAL_ON_FILE - MAGNETIC_STRIPE -> Value.MAGNETIC_STRIPE - CONTACTLESS_MAGNETIC_STRIPE -> Value.CONTACTLESS_MAGNETIC_STRIPE - INTEGRATED_CIRCUIT_CARD_NO_CVV -> - Value.INTEGRATED_CIRCUIT_CARD_NO_CVV - else -> Value._UNKNOWN - } + /** + * Returns the raw JSON value of [authorizationIdentificationResponse]. + * + * Unlike [authorizationIdentificationResponse], this method doesn't throw if the + * JSON field has an unexpected type. + */ + @JsonProperty("authorization_identification_response") + @ExcludeMissing + fun _authorizationIdentificationResponse(): JsonField = + authorizationIdentificationResponse + + /** + * Returns the raw JSON value of [retrievalReferenceNumber]. + * + * Unlike [retrievalReferenceNumber], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("retrieval_reference_number") + @ExcludeMissing + fun _retrievalReferenceNumber(): JsonField = retrievalReferenceNumber + + /** + * Returns the raw JSON value of [traceNumber]. + * + * Unlike [traceNumber], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("trace_number") + @ExcludeMissing + fun _traceNumber(): JsonField = traceNumber + + /** + * Returns the raw JSON value of [transactionId]. + * + * Unlike [transactionId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("transaction_id") + @ExcludeMissing + fun _transactionId(): JsonField = transactionId + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [NetworkIdentifiers]. + * + * The following fields are required: + * ```java + * .authorizationIdentificationResponse() + * .retrievalReferenceNumber() + * .traceNumber() + * .transactionId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [NetworkIdentifiers]. */ + class Builder internal constructor() { + + private var authorizationIdentificationResponse: JsonField? = null + private var retrievalReferenceNumber: JsonField? = null + private var traceNumber: JsonField? = null + private var transactionId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(networkIdentifiers: NetworkIdentifiers) = apply { + authorizationIdentificationResponse = + networkIdentifiers.authorizationIdentificationResponse + retrievalReferenceNumber = networkIdentifiers.retrievalReferenceNumber + traceNumber = networkIdentifiers.traceNumber + transactionId = networkIdentifiers.transactionId + additionalProperties = + networkIdentifiers.additionalProperties.toMutableMap() + } + + /** + * The randomly generated 6-character Authorization Identification Response code + * sent back to the acquirer in an approved response. + */ + fun authorizationIdentificationResponse( + authorizationIdentificationResponse: String? + ) = + authorizationIdentificationResponse( + JsonField.ofNullable(authorizationIdentificationResponse) + ) + + /** + * Alias for calling [Builder.authorizationIdentificationResponse] with + * `authorizationIdentificationResponse.orElse(null)`. + */ + fun authorizationIdentificationResponse( + authorizationIdentificationResponse: Optional + ) = + authorizationIdentificationResponse( + authorizationIdentificationResponse.getOrNull() + ) + + /** + * Sets [Builder.authorizationIdentificationResponse] to an arbitrary JSON + * value. + * + * You should usually call [Builder.authorizationIdentificationResponse] with a + * well-typed [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun authorizationIdentificationResponse( + authorizationIdentificationResponse: JsonField + ) = apply { + this.authorizationIdentificationResponse = + authorizationIdentificationResponse + } + + /** + * A life-cycle identifier used across e.g., an authorization and a reversal. + * Expected to be unique per acquirer within a window of time. For some card + * networks the retrieval reference number includes the trace counter. + */ + fun retrievalReferenceNumber(retrievalReferenceNumber: String?) = + retrievalReferenceNumber(JsonField.ofNullable(retrievalReferenceNumber)) + + /** + * Alias for calling [Builder.retrievalReferenceNumber] with + * `retrievalReferenceNumber.orElse(null)`. + */ + fun retrievalReferenceNumber(retrievalReferenceNumber: Optional) = + retrievalReferenceNumber(retrievalReferenceNumber.getOrNull()) - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - UNKNOWN -> Known.UNKNOWN - MANUAL -> Known.MANUAL - MAGNETIC_STRIPE_NO_CVV -> Known.MAGNETIC_STRIPE_NO_CVV - OPTICAL_CODE -> Known.OPTICAL_CODE - INTEGRATED_CIRCUIT_CARD -> Known.INTEGRATED_CIRCUIT_CARD - CONTACTLESS -> Known.CONTACTLESS - CREDENTIAL_ON_FILE -> Known.CREDENTIAL_ON_FILE - MAGNETIC_STRIPE -> Known.MAGNETIC_STRIPE - CONTACTLESS_MAGNETIC_STRIPE -> Known.CONTACTLESS_MAGNETIC_STRIPE - INTEGRATED_CIRCUIT_CARD_NO_CVV -> - Known.INTEGRATED_CIRCUIT_CARD_NO_CVV - else -> - throw IncreaseInvalidDataException( - "Unknown PointOfServiceEntryMode: $value" - ) - } + /** + * Sets [Builder.retrievalReferenceNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.retrievalReferenceNumber] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun retrievalReferenceNumber(retrievalReferenceNumber: JsonField) = + apply { + this.retrievalReferenceNumber = retrievalReferenceNumber + } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + /** + * A counter used to verify an individual authorization. Expected to be unique + * per acquirer within a window of time. + */ + fun traceNumber(traceNumber: String?) = + traceNumber(JsonField.ofNullable(traceNumber)) - private var validated: Boolean = false + /** Alias for calling [Builder.traceNumber] with `traceNumber.orElse(null)`. */ + fun traceNumber(traceNumber: Optional) = + traceNumber(traceNumber.getOrNull()) - fun validate(): PointOfServiceEntryMode = apply { - if (validated) { - return@apply - } + /** + * Sets [Builder.traceNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.traceNumber] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun traceNumber(traceNumber: JsonField) = apply { + this.traceNumber = traceNumber + } - known() - validated = true - } + /** + * A globally unique transaction identifier provided by the card network, used + * across multiple life-cycle requests. + */ + fun transactionId(transactionId: String?) = + transactionId(JsonField.ofNullable(transactionId)) - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`. + */ + fun transactionId(transactionId: Optional) = + transactionId(transactionId.getOrNull()) - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + /** + * Sets [Builder.transactionId] to an arbitrary JSON value. + * + * You should usually call [Builder.transactionId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun transactionId(transactionId: JsonField) = apply { + this.transactionId = transactionId + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - return other is PointOfServiceEntryMode && value == other.value + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) } - override fun hashCode() = value.hashCode() + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - override fun toString() = value.toString() + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } /** - * Only present when `actioner: network`. Describes why a card authorization was - * approved or declined by Visa through stand-in processing. + * Returns an immutable instance of [NetworkIdentifiers]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .authorizationIdentificationResponse() + * .retrievalReferenceNumber() + * .traceNumber() + * .transactionId() + * ``` + * + * @throws IllegalStateException if any required field is unset. */ - class StandInProcessingReason - @JsonCreator - private constructor(private val value: JsonField) : Enum { + fun build(): NetworkIdentifiers = + NetworkIdentifiers( + checkRequired( + "authorizationIdentificationResponse", + authorizationIdentificationResponse, + ), + checkRequired("retrievalReferenceNumber", retrievalReferenceNumber), + checkRequired("traceNumber", traceNumber), + checkRequired("transactionId", transactionId), + additionalProperties.toMutableMap(), + ) + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + private var validated: Boolean = false - companion object { + fun validate(): NetworkIdentifiers = apply { + if (validated) { + return@apply + } - /** Increase failed to process the authorization in a timely manner. */ - @JvmField val ISSUER_ERROR = of("issuer_error") + authorizationIdentificationResponse() + retrievalReferenceNumber() + traceNumber() + transactionId() + validated = true + } - /** The physical card read had an invalid CVV or dCVV. */ - @JvmField val INVALID_PHYSICAL_CARD = of("invalid_physical_card") + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * The card's authorization request cryptogram was invalid. The - * cryptogram can be from a physical card or a Digital Wallet Token - * purchase. - */ - @JvmField val INVALID_CRYPTOGRAM = of("invalid_cryptogram") + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (authorizationIdentificationResponse.asKnown().isPresent) 1 else 0) + + (if (retrievalReferenceNumber.asKnown().isPresent) 1 else 0) + + (if (traceNumber.asKnown().isPresent) 1 else 0) + + (if (transactionId.asKnown().isPresent) 1 else 0) - /** The 3DS cardholder authentication verification value was invalid. */ - @JvmField - val INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE = - of("invalid_cardholder_authentication_verification_value") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * An internal Visa error occurred. Visa uses this reason code for - * certain expected occurrences as well, such as Application Transaction - * Counter (ATC) replays. - */ - @JvmField val INTERNAL_VISA_ERROR = of("internal_visa_error") + return other is NetworkIdentifiers && + authorizationIdentificationResponse == + other.authorizationIdentificationResponse && + retrievalReferenceNumber == other.retrievalReferenceNumber && + traceNumber == other.traceNumber && + transactionId == other.transactionId && + additionalProperties == other.additionalProperties + } - /** - * The merchant has enabled Visa's Transaction Advisory Service and - * requires further authentication to perform the transaction. In - * practice this is often utilized at fuel pumps to tell the cardholder - * to see the cashier. - */ - @JvmField - val MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED = - of("merchant_transaction_advisory_service_authentication_required") + private val hashCode: Int by lazy { + Objects.hash( + authorizationIdentificationResponse, + retrievalReferenceNumber, + traceNumber, + transactionId, + additionalProperties, + ) + } - /** - * The transaction was blocked by Visa's Payment Fraud Disruption - * service due to fraudulent Acquirer behavior, such as card testing. - */ - @JvmField - val PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK = - of("payment_fraud_disruption_acquirer_block") + override fun hashCode(): Int = hashCode - /** An unspecific reason for stand-in processing. */ - @JvmField val OTHER = of("other") + override fun toString() = + "NetworkIdentifiers{authorizationIdentificationResponse=$authorizationIdentificationResponse, retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}" + } - @JvmStatic - fun of(value: String) = StandInProcessingReason(JsonField.of(value)) - } + class SchemeFee + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val amount: JsonField, + private val createdAt: JsonField, + private val currency: JsonField, + private val feeType: JsonField, + private val fixedComponent: JsonField, + private val variableRate: JsonField, + private val additionalProperties: MutableMap, + ) { - /** An enum containing [StandInProcessingReason]'s known values. */ - enum class Known { - /** Increase failed to process the authorization in a timely manner. */ - ISSUER_ERROR, - /** The physical card read had an invalid CVV or dCVV. */ - INVALID_PHYSICAL_CARD, - /** - * The card's authorization request cryptogram was invalid. The - * cryptogram can be from a physical card or a Digital Wallet Token - * purchase. - */ - INVALID_CRYPTOGRAM, - /** The 3DS cardholder authentication verification value was invalid. */ - INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE, - /** - * An internal Visa error occurred. Visa uses this reason code for - * certain expected occurrences as well, such as Application Transaction - * Counter (ATC) replays. - */ - INTERNAL_VISA_ERROR, - /** - * The merchant has enabled Visa's Transaction Advisory Service and - * requires further authentication to perform the transaction. In - * practice this is often utilized at fuel pumps to tell the cardholder - * to see the cashier. - */ - MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED, - /** - * The transaction was blocked by Visa's Payment Fraud Disruption - * service due to fraudulent Acquirer behavior, such as card testing. - */ - PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK, - /** An unspecific reason for stand-in processing. */ - OTHER, - } + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + createdAt: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("fee_type") + @ExcludeMissing + feeType: JsonField = JsonMissing.of(), + @JsonProperty("fixed_component") + @ExcludeMissing + fixedComponent: JsonField = JsonMissing.of(), + @JsonProperty("variable_rate") + @ExcludeMissing + variableRate: JsonField = JsonMissing.of(), + ) : this( + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, + mutableMapOf(), + ) - /** - * An enum containing [StandInProcessingReason]'s known values, as well as - * an [_UNKNOWN] member. - * - * An instance of [StandInProcessingReason] can contain an unknown value in - * a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** Increase failed to process the authorization in a timely manner. */ - ISSUER_ERROR, - /** The physical card read had an invalid CVV or dCVV. */ - INVALID_PHYSICAL_CARD, - /** - * The card's authorization request cryptogram was invalid. The - * cryptogram can be from a physical card or a Digital Wallet Token - * purchase. - */ - INVALID_CRYPTOGRAM, - /** The 3DS cardholder authentication verification value was invalid. */ - INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE, - /** - * An internal Visa error occurred. Visa uses this reason code for - * certain expected occurrences as well, such as Application Transaction - * Counter (ATC) replays. - */ - INTERNAL_VISA_ERROR, - /** - * The merchant has enabled Visa's Transaction Advisory Service and - * requires further authentication to perform the transaction. In - * practice this is often utilized at fuel pumps to tell the cardholder - * to see the cashier. - */ - MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED, - /** - * The transaction was blocked by Visa's Payment Fraud Disruption - * service due to fraudulent Acquirer behavior, such as card testing. - */ - PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK, - /** An unspecific reason for stand-in processing. */ - OTHER, - /** - * An enum member indicating that [StandInProcessingReason] was - * instantiated with an unknown value. - */ - _UNKNOWN, - } + /** + * The fee amount given as a string containing a decimal number. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun amount(): String = amount.getRequired("amount") - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ISSUER_ERROR -> Value.ISSUER_ERROR - INVALID_PHYSICAL_CARD -> Value.INVALID_PHYSICAL_CARD - INVALID_CRYPTOGRAM -> Value.INVALID_CRYPTOGRAM - INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE -> - Value.INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE - INTERNAL_VISA_ERROR -> Value.INTERNAL_VISA_ERROR - MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED -> - Value - .MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED - PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK -> - Value.PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK - OTHER -> Value.OTHER - else -> Value._UNKNOWN - } + /** + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + * created. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - ISSUER_ERROR -> Known.ISSUER_ERROR - INVALID_PHYSICAL_CARD -> Known.INVALID_PHYSICAL_CARD - INVALID_CRYPTOGRAM -> Known.INVALID_CRYPTOGRAM - INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE -> - Known.INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE - INTERNAL_VISA_ERROR -> Known.INTERNAL_VISA_ERROR - MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED -> - Known - .MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED - PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK -> - Known.PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK - OTHER -> Known.OTHER - else -> - throw IncreaseInvalidDataException( - "Unknown StandInProcessingReason: $value" - ) - } + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun currency(): Currency = currency.getRequired("currency") + + /** + * The type of fee being assessed. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun feeType(): FeeType = feeType.getRequired("fee_type") + + /** + * The fixed component of the fee, if applicable, given in major units of the fee + * amount. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun fixedComponent(): Optional = + fixedComponent.getOptional("fixed_component") + + /** + * The variable rate component of the fee, if applicable, given as a decimal (e.g., + * 0.015 for 1.5%). + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun variableRate(): Optional = variableRate.getOptional("variable_rate") + + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + + /** + * Returns the raw JSON value of [createdAt]. + * + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("created_at") + @ExcludeMissing + fun _createdAt(): JsonField = createdAt + + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("currency") + @ExcludeMissing + fun _currency(): JsonField = currency + + /** + * Returns the raw JSON value of [feeType]. + * + * Unlike [feeType], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("fee_type") + @ExcludeMissing + fun _feeType(): JsonField = feeType - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + /** + * Returns the raw JSON value of [fixedComponent]. + * + * Unlike [fixedComponent], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("fixed_component") + @ExcludeMissing + fun _fixedComponent(): JsonField = fixedComponent - private var validated: Boolean = false + /** + * Returns the raw JSON value of [variableRate]. + * + * Unlike [variableRate], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("variable_rate") + @ExcludeMissing + fun _variableRate(): JsonField = variableRate - fun validate(): StandInProcessingReason = apply { - if (validated) { - return@apply - } + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - known() - validated = true - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + fun toBuilder() = Builder().from(this) - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + companion object { - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Returns a mutable builder for constructing an instance of [SchemeFee]. + * + * The following fields are required: + * ```java + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - return other is StandInProcessingReason && value == other.value - } + /** A builder for [SchemeFee]. */ + class Builder internal constructor() { - override fun hashCode() = value.hashCode() + private var amount: JsonField? = null + private var createdAt: JsonField? = null + private var currency: JsonField? = null + private var feeType: JsonField? = null + private var fixedComponent: JsonField? = null + private var variableRate: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - override fun toString() = value.toString() + @JvmSynthetic + internal fun from(schemeFee: SchemeFee) = apply { + amount = schemeFee.amount + createdAt = schemeFee.createdAt + currency = schemeFee.currency + feeType = schemeFee.feeType + fixedComponent = schemeFee.fixedComponent + variableRate = schemeFee.variableRate + additionalProperties = schemeFee.additionalProperties.toMutableMap() } + /** The fee amount given as a string containing a decimal number. */ + fun amount(amount: String) = amount(JsonField.of(amount)) + /** - * The capability of the terminal being used to read the card. Shows whether a - * terminal can e.g., accept chip cards or if it only supports magnetic stripe - * reads. This reflects the highest capability of the terminal — for example, a - * terminal that supports both chip and magnetic stripe will be identified as - * chip-capable. + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - class TerminalEntryCapability - @JsonCreator - private constructor(private val value: JsonField) : Enum { + fun amount(amount: JsonField) = apply { this.amount = amount } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + /** + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee + * was created. + */ + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - companion object { + /** + * Sets [Builder.createdAt] to an arbitrary JSON value. + * + * You should usually call [Builder.createdAt] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt + } - /** Unknown */ - @JvmField val UNKNOWN = of("unknown") + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + */ + fun currency(currency: Currency) = currency(JsonField.of(currency)) - /** No terminal was used for this transaction. */ - @JvmField val TERMINAL_NOT_USED = of("terminal_not_used") + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [Currency] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } - /** - * The terminal can only read magnetic stripes and does not have chip or - * contactless reading capability. - */ - @JvmField val MAGNETIC_STRIPE = of("magnetic_stripe") + /** The type of fee being assessed. */ + fun feeType(feeType: FeeType) = feeType(JsonField.of(feeType)) - /** The terminal can only read barcodes. */ - @JvmField val BARCODE = of("barcode") + /** + * Sets [Builder.feeType] to an arbitrary JSON value. + * + * You should usually call [Builder.feeType] with a well-typed [FeeType] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun feeType(feeType: JsonField) = apply { this.feeType = feeType } - /** - * The terminal can only read cards via Optical Character Recognition. - */ - @JvmField - val OPTICAL_CHARACTER_RECOGNITION = of("optical_character_recognition") + /** + * The fixed component of the fee, if applicable, given in major units of the + * fee amount. + */ + fun fixedComponent(fixedComponent: String?) = + fixedComponent(JsonField.ofNullable(fixedComponent)) - /** - * The terminal supports contact chip cards and can also read the - * magnetic stripe. If contact chip is supported, this value is used - * regardless of whether contactless is also supported. - */ - @JvmField val CHIP_OR_CONTACTLESS = of("chip_or_contactless") + /** + * Alias for calling [Builder.fixedComponent] with + * `fixedComponent.orElse(null)`. + */ + fun fixedComponent(fixedComponent: Optional) = + fixedComponent(fixedComponent.getOrNull()) - /** - * The terminal supports contactless reads but does not support contact - * chip. Only used when the terminal lacks contact chip capability. - */ - @JvmField val CONTACTLESS_ONLY = of("contactless_only") + /** + * Sets [Builder.fixedComponent] to an arbitrary JSON value. + * + * You should usually call [Builder.fixedComponent] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun fixedComponent(fixedComponent: JsonField) = apply { + this.fixedComponent = fixedComponent + } - /** The terminal has no card reading capability. */ - @JvmField val NO_CAPABILITY = of("no_capability") + /** + * The variable rate component of the fee, if applicable, given as a decimal + * (e.g., 0.015 for 1.5%). + */ + fun variableRate(variableRate: String?) = + variableRate(JsonField.ofNullable(variableRate)) - @JvmStatic - fun of(value: String) = TerminalEntryCapability(JsonField.of(value)) - } + /** + * Alias for calling [Builder.variableRate] with `variableRate.orElse(null)`. + */ + fun variableRate(variableRate: Optional) = + variableRate(variableRate.getOrNull()) - /** An enum containing [TerminalEntryCapability]'s known values. */ - enum class Known { - /** Unknown */ - UNKNOWN, - /** No terminal was used for this transaction. */ - TERMINAL_NOT_USED, - /** - * The terminal can only read magnetic stripes and does not have chip or - * contactless reading capability. - */ - MAGNETIC_STRIPE, - /** The terminal can only read barcodes. */ - BARCODE, - /** - * The terminal can only read cards via Optical Character Recognition. - */ - OPTICAL_CHARACTER_RECOGNITION, - /** - * The terminal supports contact chip cards and can also read the - * magnetic stripe. If contact chip is supported, this value is used - * regardless of whether contactless is also supported. - */ - CHIP_OR_CONTACTLESS, - /** - * The terminal supports contactless reads but does not support contact - * chip. Only used when the terminal lacks contact chip capability. - */ - CONTACTLESS_ONLY, - /** The terminal has no card reading capability. */ - NO_CAPABILITY, - } + /** + * Sets [Builder.variableRate] to an arbitrary JSON value. + * + * You should usually call [Builder.variableRate] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun variableRate(variableRate: JsonField) = apply { + this.variableRate = variableRate + } - /** - * An enum containing [TerminalEntryCapability]'s known values, as well as - * an [_UNKNOWN] member. - * - * An instance of [TerminalEntryCapability] can contain an unknown value in - * a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** Unknown */ - UNKNOWN, - /** No terminal was used for this transaction. */ - TERMINAL_NOT_USED, - /** - * The terminal can only read magnetic stripes and does not have chip or - * contactless reading capability. - */ - MAGNETIC_STRIPE, - /** The terminal can only read barcodes. */ - BARCODE, - /** - * The terminal can only read cards via Optical Character Recognition. - */ - OPTICAL_CHARACTER_RECOGNITION, - /** - * The terminal supports contact chip cards and can also read the - * magnetic stripe. If contact chip is supported, this value is used - * regardless of whether contactless is also supported. - */ - CHIP_OR_CONTACTLESS, - /** - * The terminal supports contactless reads but does not support contact - * chip. Only used when the terminal lacks contact chip capability. - */ - CONTACTLESS_ONLY, - /** The terminal has no card reading capability. */ - NO_CAPABILITY, - /** - * An enum member indicating that [TerminalEntryCapability] was - * instantiated with an unknown value. - */ - _UNKNOWN, + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - UNKNOWN -> Value.UNKNOWN - TERMINAL_NOT_USED -> Value.TERMINAL_NOT_USED - MAGNETIC_STRIPE -> Value.MAGNETIC_STRIPE - BARCODE -> Value.BARCODE - OPTICAL_CHARACTER_RECOGNITION -> Value.OPTICAL_CHARACTER_RECOGNITION - CHIP_OR_CONTACTLESS -> Value.CHIP_OR_CONTACTLESS - CONTACTLESS_ONLY -> Value.CONTACTLESS_ONLY - NO_CAPABILITY -> Value.NO_CAPABILITY - else -> Value._UNKNOWN - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - UNKNOWN -> Known.UNKNOWN - TERMINAL_NOT_USED -> Known.TERMINAL_NOT_USED - MAGNETIC_STRIPE -> Known.MAGNETIC_STRIPE - BARCODE -> Known.BARCODE - OPTICAL_CHARACTER_RECOGNITION -> Known.OPTICAL_CHARACTER_RECOGNITION - CHIP_OR_CONTACTLESS -> Known.CHIP_OR_CONTACTLESS - CONTACTLESS_ONLY -> Known.CONTACTLESS_ONLY - NO_CAPABILITY -> Known.NO_CAPABILITY - else -> - throw IncreaseInvalidDataException( - "Unknown TerminalEntryCapability: $value" - ) - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [SchemeFee]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SchemeFee = + SchemeFee( + checkRequired("amount", amount), + checkRequired("createdAt", createdAt), + checkRequired("currency", currency), + checkRequired("feeType", feeType), + checkRequired("fixedComponent", fixedComponent), + checkRequired("variableRate", variableRate), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): SchemeFee = apply { + if (validated) { + return@apply + } + + amount() + createdAt() + currency().validate() + feeType().validate() + fixedComponent() + variableRate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (currency.asKnown().getOrNull()?.validity() ?: 0) + + (feeType.asKnown().getOrNull()?.validity() ?: 0) + + (if (fixedComponent.asKnown().isPresent) 1 else 0) + + (if (variableRate.asKnown().isPresent) 1 else 0) + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + */ + class Currency + @JsonCreator + private constructor(private val value: JsonField) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** US Dollar (USD) */ + @JvmField val USD = of("USD") + + @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) + } + + /** An enum containing [Currency]'s known values. */ + enum class Known { + /** US Dollar (USD) */ + USD + } + + /** + * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Currency] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** US Dollar (USD) */ + USD, /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. + * An enum member indicating that [Currency] was instantiated with an + * unknown value. */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + _UNKNOWN, + } - private var validated: Boolean = false + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + USD -> Value.USD + else -> Value._UNKNOWN + } - fun validate(): TerminalEntryCapability = apply { - if (validated) { - return@apply - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + USD -> Known.USD + else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + } - known() - validated = true + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + private var validated: Boolean = false - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + fun validate(): Currency = apply { + if (validated) { + return@apply + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + known() + validated = true + } - return other is TerminalEntryCapability && value == other.value + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is Visa && - electronicCommerceIndicator == other.electronicCommerceIndicator && - pointOfServiceEntryMode == other.pointOfServiceEntryMode && - standInProcessingReason == other.standInProcessingReason && - terminalEntryCapability == other.terminalEntryCapability && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - electronicCommerceIndicator, - pointOfServiceEntryMode, - standInProcessingReason, - terminalEntryCapability, - additionalProperties, - ) + return other is Currency && value == other.value } - override fun hashCode(): Int = hashCode + override fun hashCode() = value.hashCode() - override fun toString() = - "Visa{electronicCommerceIndicator=$electronicCommerceIndicator, pointOfServiceEntryMode=$pointOfServiceEntryMode, standInProcessingReason=$standInProcessingReason, terminalEntryCapability=$terminalEntryCapability, additionalProperties=$additionalProperties}" + override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** The type of fee being assessed. */ + class FeeType + @JsonCreator + private constructor(private val value: JsonField) : Enum { - return other is NetworkDetails && - category == other.category && - pulse == other.pulse && - visa == other.visa && - additionalProperties == other.additionalProperties - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - private val hashCode: Int by lazy { - Objects.hash(category, pulse, visa, additionalProperties) - } + companion object { - override fun hashCode(): Int = hashCode + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY = + of("visa_international_service_assessment_single_currency") - override fun toString() = - "NetworkDetails{category=$category, pulse=$pulse, visa=$visa, additionalProperties=$additionalProperties}" - } + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY = + of("visa_international_service_assessment_cross_currency") - /** Network-specific identifiers for a specific request or transaction. */ - class NetworkIdentifiers - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val authorizationIdentificationResponse: JsonField, - private val retrievalReferenceNumber: JsonField, - private val traceNumber: JsonField, - private val transactionId: JsonField, - private val additionalProperties: MutableMap, - ) { + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + @JvmField + val VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE = + of("visa_authorization_domestic_point_of_sale") - @JsonCreator - private constructor( - @JsonProperty("authorization_identification_response") - @ExcludeMissing - authorizationIdentificationResponse: JsonField = JsonMissing.of(), - @JsonProperty("retrieval_reference_number") - @ExcludeMissing - retrievalReferenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("trace_number") - @ExcludeMissing - traceNumber: JsonField = JsonMissing.of(), - @JsonProperty("transaction_id") - @ExcludeMissing - transactionId: JsonField = JsonMissing.of(), - ) : this( - authorizationIdentificationResponse, - retrievalReferenceNumber, - traceNumber, - transactionId, - mutableMapOf(), - ) + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + @JvmField + val VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_international_point_of_sale") - /** - * The randomly generated 6-character Authorization Identification Response code - * sent back to the acquirer in an approved response. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun authorizationIdentificationResponse(): Optional = - authorizationIdentificationResponse.getOptional( - "authorization_identification_response" - ) + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + @JvmField + val VISA_AUTHORIZATION_CANADA_POINT_OF_SALE = + of("visa_authorization_canada_point_of_sale") - /** - * A life-cycle identifier used across e.g., an authorization and a reversal. - * Expected to be unique per acquirer within a window of time. For some card - * networks the retrieval reference number includes the trace counter. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun retrievalReferenceNumber(): Optional = - retrievalReferenceNumber.getOptional("retrieval_reference_number") + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + @JvmField + val VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE = + of("visa_authorization_reversal_point_of_sale") - /** - * A counter used to verify an individual authorization. Expected to be unique per - * acquirer within a window of time. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun traceNumber(): Optional = traceNumber.getOptional("trace_number") + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + @JvmField + val VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_reversal_international_point_of_sale") - /** - * A globally unique transaction identifier provided by the card network, used - * across multiple life-cycle requests. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun transactionId(): Optional = transactionId.getOptional("transaction_id") + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + @JvmField + val VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE = + of("visa_authorization_address_verification_service") - /** - * Returns the raw JSON value of [authorizationIdentificationResponse]. - * - * Unlike [authorizationIdentificationResponse], this method doesn't throw if the - * JSON field has an unexpected type. - */ - @JsonProperty("authorization_identification_response") - @ExcludeMissing - fun _authorizationIdentificationResponse(): JsonField = - authorizationIdentificationResponse + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + @JvmField + val VISA_ADVANCED_AUTHORIZATION = of("visa_advanced_authorization") - /** - * Returns the raw JSON value of [retrievalReferenceNumber]. - * - * Unlike [retrievalReferenceNumber], this method doesn't throw if the JSON field - * has an unexpected type. - */ - @JsonProperty("retrieval_reference_number") - @ExcludeMissing - fun _retrievalReferenceNumber(): JsonField = retrievalReferenceNumber + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + @JvmField val VISA_MESSAGE_TRANSMISSION = of("visa_message_transmission") - /** - * Returns the raw JSON value of [traceNumber]. - * - * Unlike [traceNumber], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("trace_number") - @ExcludeMissing - fun _traceNumber(): JsonField = traceNumber + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_DOMESTIC = + of("visa_account_verification_domestic") - /** - * Returns the raw JSON value of [transactionId]. - * - * Unlike [transactionId], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("transaction_id") - @ExcludeMissing - fun _transactionId(): JsonField = transactionId + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_INTERNATIONAL = + of("visa_account_verification_international") - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_CANADA = + of("visa_account_verification_canada") - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + @JvmField + val VISA_CORPORATE_ACCEPTANCE_FEE = of("visa_corporate_acceptance_fee") - fun toBuilder() = Builder().from(this) + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + @JvmField + val VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE = + of("visa_consumer_debit_acceptance_fee") - companion object { + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + @JvmField + val VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE = + of("visa_business_debit_acceptance_fee") - /** - * Returns a mutable builder for constructing an instance of - * [NetworkIdentifiers]. - * - * The following fields are required: - * ```java - * .authorizationIdentificationResponse() - * .retrievalReferenceNumber() - * .traceNumber() - * .transactionId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + @JvmField + val VISA_PURCHASING_ACCEPTANCE_FEE = of("visa_purchasing_acceptance_fee") - /** A builder for [NetworkIdentifiers]. */ - class Builder internal constructor() { + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + @JvmField val VISA_PURCHASE_DOMESTIC = of("visa_purchase_domestic") - private var authorizationIdentificationResponse: JsonField? = null - private var retrievalReferenceNumber: JsonField? = null - private var traceNumber: JsonField? = null - private var transactionId: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + @JvmField + val VISA_PURCHASE_INTERNATIONAL = of("visa_purchase_international") - @JvmSynthetic - internal fun from(networkIdentifiers: NetworkIdentifiers) = apply { - authorizationIdentificationResponse = - networkIdentifiers.authorizationIdentificationResponse - retrievalReferenceNumber = networkIdentifiers.retrievalReferenceNumber - traceNumber = networkIdentifiers.traceNumber - transactionId = networkIdentifiers.transactionId - additionalProperties = - networkIdentifiers.additionalProperties.toMutableMap() - } + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_CREDIT_PURCHASE_TOKEN = of("visa_credit_purchase_token") - /** - * The randomly generated 6-character Authorization Identification Response code - * sent back to the acquirer in an approved response. - */ - fun authorizationIdentificationResponse( - authorizationIdentificationResponse: String? - ) = - authorizationIdentificationResponse( - JsonField.ofNullable(authorizationIdentificationResponse) - ) + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_DEBIT_PURCHASE_TOKEN = of("visa_debit_purchase_token") - /** - * Alias for calling [Builder.authorizationIdentificationResponse] with - * `authorizationIdentificationResponse.orElse(null)`. - */ - fun authorizationIdentificationResponse( - authorizationIdentificationResponse: Optional - ) = - authorizationIdentificationResponse( - authorizationIdentificationResponse.getOrNull() - ) + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + @JvmField val VISA_CLEARING_TRANSMISSION = of("visa_clearing_transmission") - /** - * Sets [Builder.authorizationIdentificationResponse] to an arbitrary JSON - * value. - * - * You should usually call [Builder.authorizationIdentificationResponse] with a - * well-typed [String] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun authorizationIdentificationResponse( - authorizationIdentificationResponse: JsonField - ) = apply { - this.authorizationIdentificationResponse = - authorizationIdentificationResponse - } + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + @JvmField val VISA_DIRECT_AUTHORIZATION = of("visa_direct_authorization") - /** - * A life-cycle identifier used across e.g., an authorization and a reversal. - * Expected to be unique per acquirer within a window of time. For some card - * networks the retrieval reference number includes the trace counter. - */ - fun retrievalReferenceNumber(retrievalReferenceNumber: String?) = - retrievalReferenceNumber(JsonField.ofNullable(retrievalReferenceNumber)) + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + @JvmField + val VISA_DIRECT_TRANSACTION_DOMESTIC = + of("visa_direct_transaction_domestic") - /** - * Alias for calling [Builder.retrievalReferenceNumber] with - * `retrievalReferenceNumber.orElse(null)`. - */ - fun retrievalReferenceNumber(retrievalReferenceNumber: Optional) = - retrievalReferenceNumber(retrievalReferenceNumber.getOrNull()) + /** Issuer card service fee for Commercial Credit cards. */ + @JvmField + val VISA_SERVICE_COMMERCIAL_CREDIT = of("visa_service_commercial_credit") - /** - * Sets [Builder.retrievalReferenceNumber] to an arbitrary JSON value. - * - * You should usually call [Builder.retrievalReferenceNumber] with a well-typed - * [String] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun retrievalReferenceNumber(retrievalReferenceNumber: JsonField) = - apply { - this.retrievalReferenceNumber = retrievalReferenceNumber - } + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + @JvmField + val VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT = + of("visa_advertising_service_commercial_credit") - /** - * A counter used to verify an individual authorization. Expected to be unique - * per acquirer within a window of time. - */ - fun traceNumber(traceNumber: String?) = - traceNumber(JsonField.ofNullable(traceNumber)) + /** Issuer Community Growth Acceleration Program Fee. */ + @JvmField + val VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM = + of("visa_community_growth_acceleration_program") - /** Alias for calling [Builder.traceNumber] with `traceNumber.orElse(null)`. */ - fun traceNumber(traceNumber: Optional) = - traceNumber(traceNumber.getOrNull()) + /** Issuer Processing Guarantee for Commercial Credit cards. */ + @JvmField + val VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT = + of("visa_processing_guarantee_commercial_credit") - /** - * Sets [Builder.traceNumber] to an arbitrary JSON value. - * - * You should usually call [Builder.traceNumber] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun traceNumber(traceNumber: JsonField) = apply { - this.traceNumber = traceNumber + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + @JvmField val PULSE_SWITCH_FEE = of("pulse_switch_fee") + + @JvmStatic fun of(value: String) = FeeType(JsonField.of(value)) + } + + /** An enum containing [FeeType]'s known values. */ + enum class Known { + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + VISA_ADVANCED_AUTHORIZATION, + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + VISA_MESSAGE_TRANSMISSION, + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_DOMESTIC, + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, } /** - * A globally unique transaction identifier provided by the card network, used - * across multiple life-cycle requests. + * An enum containing [FeeType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [FeeType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. */ - fun transactionId(transactionId: String?) = - transactionId(JsonField.ofNullable(transactionId)) + enum class Value { + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + VISA_ADVANCED_AUTHORIZATION, + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + VISA_MESSAGE_TRANSMISSION, + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_DOMESTIC, + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, + /** + * An enum member indicating that [FeeType] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } /** - * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`. + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. */ - fun transactionId(transactionId: Optional) = - transactionId(transactionId.getOrNull()) + fun value(): Value = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Value.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Value.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Value.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Value.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Value.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Value.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Value.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Value.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Value.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Value.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Value.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Value.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Value.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Value.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Value.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Value.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Value.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Value.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Value.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Value.PULSE_SWITCH_FEE + else -> Value._UNKNOWN + } /** - * Sets [Builder.transactionId] to an arbitrary JSON value. + * Returns an enum member corresponding to this class instance's value. * - * You should usually call [Builder.transactionId] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. */ - fun transactionId(transactionId: JsonField) = apply { - this.transactionId = transactionId - } + fun known(): Known = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Known.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Known.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Known.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Known.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Known.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Known.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Known.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Known.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Known.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Known.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Known.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Known.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Known.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Known.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Known.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Known.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Known.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Known.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Known.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Known.PULSE_SWITCH_FEE + else -> throw IncreaseInvalidDataException("Unknown FeeType: $value") + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + private var validated: Boolean = false - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + fun validate(): FeeType = apply { + if (validated) { + return@apply } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + known() + validated = true } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } /** - * Returns an immutable instance of [NetworkIdentifiers]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .authorizationIdentificationResponse() - * .retrievalReferenceNumber() - * .traceNumber() - * .transactionId() - * ``` + * Returns a score indicating how many valid values are contained in this object + * recursively. * - * @throws IllegalStateException if any required field is unset. + * Used for best match union deserialization. */ - fun build(): NetworkIdentifiers = - NetworkIdentifiers( - checkRequired( - "authorizationIdentificationResponse", - authorizationIdentificationResponse, - ), - checkRequired("retrievalReferenceNumber", retrievalReferenceNumber), - checkRequired("traceNumber", traceNumber), - checkRequired("transactionId", transactionId), - additionalProperties.toMutableMap(), - ) - } + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - private var validated: Boolean = false + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun validate(): NetworkIdentifiers = apply { - if (validated) { - return@apply + return other is FeeType && value == other.value } - authorizationIdentificationResponse() - retrievalReferenceNumber() - traceNumber() - transactionId() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + override fun hashCode() = value.hashCode() - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (authorizationIdentificationResponse.asKnown().isPresent) 1 else 0) + - (if (retrievalReferenceNumber.asKnown().isPresent) 1 else 0) + - (if (traceNumber.asKnown().isPresent) 1 else 0) + - (if (transactionId.asKnown().isPresent) 1 else 0) + override fun toString() = value.toString() + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is NetworkIdentifiers && - authorizationIdentificationResponse == - other.authorizationIdentificationResponse && - retrievalReferenceNumber == other.retrievalReferenceNumber && - traceNumber == other.traceNumber && - transactionId == other.transactionId && + return other is SchemeFee && + amount == other.amount && + createdAt == other.createdAt && + currency == other.currency && + feeType == other.feeType && + fixedComponent == other.fixedComponent && + variableRate == other.variableRate && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { Objects.hash( - authorizationIdentificationResponse, - retrievalReferenceNumber, - traceNumber, - transactionId, + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, additionalProperties, ) } @@ -80383,7 +94066,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "NetworkIdentifiers{authorizationIdentificationResponse=$authorizationIdentificationResponse, retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}" + "SchemeFee{amount=$amount, createdAt=$createdAt, currency=$currency, feeType=$feeType, fixedComponent=$fixedComponent, variableRate=$variableRate, additionalProperties=$additionalProperties}" } /** @@ -80781,415 +94464,22 @@ private constructor( * Fields related to verification of the Card Verification Code, a 3-digit code on * the back of the card. */ - class CardVerificationCode - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val result: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("result") - @ExcludeMissing - result: JsonField = JsonMissing.of() - ) : this(result, mutableMapOf()) - - /** - * The result of verifying the Card Verification Code. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). - */ - fun result(): Result = result.getRequired("result") - - /** - * Returns the raw JSON value of [result]. - * - * Unlike [result], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("result") - @ExcludeMissing - fun _result(): JsonField = result - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [CardVerificationCode]. - * - * The following fields are required: - * ```java - * .result() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CardVerificationCode]. */ - class Builder internal constructor() { - - private var result: JsonField? = null - private var additionalProperties: MutableMap = - mutableMapOf() - - @JvmSynthetic - internal fun from(cardVerificationCode: CardVerificationCode) = apply { - result = cardVerificationCode.result - additionalProperties = - cardVerificationCode.additionalProperties.toMutableMap() - } - - /** The result of verifying the Card Verification Code. */ - fun result(result: Result) = result(JsonField.of(result)) - - /** - * Sets [Builder.result] to an arbitrary JSON value. - * - * You should usually call [Builder.result] with a well-typed [Result] value - * instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun result(result: JsonField) = apply { this.result = result } - - fun additionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [CardVerificationCode]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .result() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CardVerificationCode = - CardVerificationCode( - checkRequired("result", result), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): CardVerificationCode = apply { - if (validated) { - return@apply - } - - result().validate() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = (result.asKnown().getOrNull()?.validity() ?: 0) - - /** The result of verifying the Card Verification Code. */ - class Result - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - /** - * No card verification code was provided in the authorization request. - */ - @JvmField val NOT_CHECKED = of("not_checked") - - /** The card verification code matched the one on file. */ - @JvmField val MATCH = of("match") - - /** The card verification code did not match the one on file. */ - @JvmField val NO_MATCH = of("no_match") - - @JvmStatic fun of(value: String) = Result(JsonField.of(value)) - } - - /** An enum containing [Result]'s known values. */ - enum class Known { - /** - * No card verification code was provided in the authorization request. - */ - NOT_CHECKED, - /** The card verification code matched the one on file. */ - MATCH, - /** The card verification code did not match the one on file. */ - NO_MATCH, - } - - /** - * An enum containing [Result]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [Result] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** - * No card verification code was provided in the authorization request. - */ - NOT_CHECKED, - /** The card verification code matched the one on file. */ - MATCH, - /** The card verification code did not match the one on file. */ - NO_MATCH, - /** - * An enum member indicating that [Result] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - NOT_CHECKED -> Value.NOT_CHECKED - MATCH -> Value.MATCH - NO_MATCH -> Value.NO_MATCH - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - NOT_CHECKED -> Known.NOT_CHECKED - MATCH -> Known.MATCH - NO_MATCH -> Known.NO_MATCH - else -> throw IncreaseInvalidDataException("Unknown Result: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Result = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Result && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CardVerificationCode && - result == other.result && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(result, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "CardVerificationCode{result=$result, additionalProperties=$additionalProperties}" - } - - /** - * Cardholder address provided in the authorization request and the address on file - * we verified it against. - */ - class CardholderAddress - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val actualLine1: JsonField, - private val actualPostalCode: JsonField, - private val providedLine1: JsonField, - private val providedPostalCode: JsonField, - private val result: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("actual_line1") - @ExcludeMissing - actualLine1: JsonField = JsonMissing.of(), - @JsonProperty("actual_postal_code") - @ExcludeMissing - actualPostalCode: JsonField = JsonMissing.of(), - @JsonProperty("provided_line1") - @ExcludeMissing - providedLine1: JsonField = JsonMissing.of(), - @JsonProperty("provided_postal_code") - @ExcludeMissing - providedPostalCode: JsonField = JsonMissing.of(), - @JsonProperty("result") - @ExcludeMissing - result: JsonField = JsonMissing.of(), - ) : this( - actualLine1, - actualPostalCode, - providedLine1, - providedPostalCode, - result, - mutableMapOf(), - ) - - /** - * Line 1 of the address on file for the cardholder. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun actualLine1(): Optional = actualLine1.getOptional("actual_line1") - - /** - * The postal code of the address on file for the cardholder. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun actualPostalCode(): Optional = - actualPostalCode.getOptional("actual_postal_code") - - /** - * The cardholder address line 1 provided for verification in the authorization - * request. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun providedLine1(): Optional = - providedLine1.getOptional("provided_line1") + class CardVerificationCode + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val result: JsonField, + private val additionalProperties: MutableMap, + ) { - /** - * The postal code provided for verification in the authorization request. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun providedPostalCode(): Optional = - providedPostalCode.getOptional("provided_postal_code") + @JsonCreator + private constructor( + @JsonProperty("result") + @ExcludeMissing + result: JsonField = JsonMissing.of() + ) : this(result, mutableMapOf()) /** - * The address verification result returned to the card network. + * The result of verifying the Card Verification Code. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * or is unexpectedly missing or null (e.g. if the server responded with an @@ -81197,46 +94487,6 @@ private constructor( */ fun result(): Result = result.getRequired("result") - /** - * Returns the raw JSON value of [actualLine1]. - * - * Unlike [actualLine1], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("actual_line1") - @ExcludeMissing - fun _actualLine1(): JsonField = actualLine1 - - /** - * Returns the raw JSON value of [actualPostalCode]. - * - * Unlike [actualPostalCode], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("actual_postal_code") - @ExcludeMissing - fun _actualPostalCode(): JsonField = actualPostalCode - - /** - * Returns the raw JSON value of [providedLine1]. - * - * Unlike [providedLine1], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("provided_line1") - @ExcludeMissing - fun _providedLine1(): JsonField = providedLine1 - - /** - * Returns the raw JSON value of [providedPostalCode]. - * - * Unlike [providedPostalCode], this method doesn't throw if the JSON field has - * an unexpected type. - */ - @JsonProperty("provided_postal_code") - @ExcludeMissing - fun _providedPostalCode(): JsonField = providedPostalCode - /** * Returns the raw JSON value of [result]. * @@ -81263,135 +94513,31 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [CardholderAddress]. + * [CardVerificationCode]. * * The following fields are required: * ```java - * .actualLine1() - * .actualPostalCode() - * .providedLine1() - * .providedPostalCode() * .result() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [CardholderAddress]. */ + /** A builder for [CardVerificationCode]. */ class Builder internal constructor() { - private var actualLine1: JsonField? = null - private var actualPostalCode: JsonField? = null - private var providedLine1: JsonField? = null - private var providedPostalCode: JsonField? = null private var result: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(cardholderAddress: CardholderAddress) = apply { - actualLine1 = cardholderAddress.actualLine1 - actualPostalCode = cardholderAddress.actualPostalCode - providedLine1 = cardholderAddress.providedLine1 - providedPostalCode = cardholderAddress.providedPostalCode - result = cardholderAddress.result + internal fun from(cardVerificationCode: CardVerificationCode) = apply { + result = cardVerificationCode.result additionalProperties = - cardholderAddress.additionalProperties.toMutableMap() - } - - /** Line 1 of the address on file for the cardholder. */ - fun actualLine1(actualLine1: String?) = - actualLine1(JsonField.ofNullable(actualLine1)) - - /** - * Alias for calling [Builder.actualLine1] with `actualLine1.orElse(null)`. - */ - fun actualLine1(actualLine1: Optional) = - actualLine1(actualLine1.getOrNull()) - - /** - * Sets [Builder.actualLine1] to an arbitrary JSON value. - * - * You should usually call [Builder.actualLine1] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun actualLine1(actualLine1: JsonField) = apply { - this.actualLine1 = actualLine1 - } - - /** The postal code of the address on file for the cardholder. */ - fun actualPostalCode(actualPostalCode: String?) = - actualPostalCode(JsonField.ofNullable(actualPostalCode)) - - /** - * Alias for calling [Builder.actualPostalCode] with - * `actualPostalCode.orElse(null)`. - */ - fun actualPostalCode(actualPostalCode: Optional) = - actualPostalCode(actualPostalCode.getOrNull()) - - /** - * Sets [Builder.actualPostalCode] to an arbitrary JSON value. - * - * You should usually call [Builder.actualPostalCode] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun actualPostalCode(actualPostalCode: JsonField) = apply { - this.actualPostalCode = actualPostalCode - } - - /** - * The cardholder address line 1 provided for verification in the - * authorization request. - */ - fun providedLine1(providedLine1: String?) = - providedLine1(JsonField.ofNullable(providedLine1)) - - /** - * Alias for calling [Builder.providedLine1] with - * `providedLine1.orElse(null)`. - */ - fun providedLine1(providedLine1: Optional) = - providedLine1(providedLine1.getOrNull()) - - /** - * Sets [Builder.providedLine1] to an arbitrary JSON value. - * - * You should usually call [Builder.providedLine1] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun providedLine1(providedLine1: JsonField) = apply { - this.providedLine1 = providedLine1 - } - - /** - * The postal code provided for verification in the authorization request. - */ - fun providedPostalCode(providedPostalCode: String?) = - providedPostalCode(JsonField.ofNullable(providedPostalCode)) - - /** - * Alias for calling [Builder.providedPostalCode] with - * `providedPostalCode.orElse(null)`. - */ - fun providedPostalCode(providedPostalCode: Optional) = - providedPostalCode(providedPostalCode.getOrNull()) - - /** - * Sets [Builder.providedPostalCode] to an arbitrary JSON value. - * - * You should usually call [Builder.providedPostalCode] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun providedPostalCode(providedPostalCode: JsonField) = apply { - this.providedPostalCode = providedPostalCode + cardVerificationCode.additionalProperties.toMutableMap() } - /** The address verification result returned to the card network. */ + /** The result of verifying the Card Verification Code. */ fun result(result: Result) = result(JsonField.of(result)) /** @@ -81426,27 +94572,19 @@ private constructor( } /** - * Returns an immutable instance of [CardholderAddress]. + * Returns an immutable instance of [CardVerificationCode]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .actualLine1() - * .actualPostalCode() - * .providedLine1() - * .providedPostalCode() * .result() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): CardholderAddress = - CardholderAddress( - checkRequired("actualLine1", actualLine1), - checkRequired("actualPostalCode", actualPostalCode), - checkRequired("providedLine1", providedLine1), - checkRequired("providedPostalCode", providedPostalCode), + fun build(): CardVerificationCode = + CardVerificationCode( checkRequired("result", result), additionalProperties.toMutableMap(), ) @@ -81454,15 +94592,11 @@ private constructor( private var validated: Boolean = false - fun validate(): CardholderAddress = apply { + fun validate(): CardVerificationCode = apply { if (validated) { return@apply } - actualLine1() - actualPostalCode() - providedLine1() - providedPostalCode() result().validate() validated = true } @@ -81482,14 +94616,9 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = - (if (actualLine1.asKnown().isPresent) 1 else 0) + - (if (actualPostalCode.asKnown().isPresent) 1 else 0) + - (if (providedLine1.asKnown().isPresent) 1 else 0) + - (if (providedPostalCode.asKnown().isPresent) 1 else 0) + - (result.asKnown().getOrNull()?.validity() ?: 0) + internal fun validity(): Int = (result.asKnown().getOrNull()?.validity() ?: 0) - /** The address verification result returned to the card network. */ + /** The result of verifying the Card Verification Code. */ class Result @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -81507,65 +94636,30 @@ private constructor( companion object { - /** No address information was provided in the authorization request. */ - @JvmField val NOT_CHECKED = of("not_checked") - - /** - * Postal code matches, but the street address does not match or was not - * provided. - */ - @JvmField - val POSTAL_CODE_MATCH_ADDRESS_NO_MATCH = - of("postal_code_match_address_no_match") - /** - * Postal code does not match, but the street address matches or was not - * provided. + * No card verification code was provided in the authorization request. */ - @JvmField - val POSTAL_CODE_NO_MATCH_ADDRESS_MATCH = - of("postal_code_no_match_address_match") + @JvmField val NOT_CHECKED = of("not_checked") - /** Postal code and street address match. */ + /** The card verification code matched the one on file. */ @JvmField val MATCH = of("match") - /** Postal code and street address do not match. */ + /** The card verification code did not match the one on file. */ @JvmField val NO_MATCH = of("no_match") - /** - * Postal code matches, but the street address was not verified. - * (deprecated) - */ - @JvmField - val POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED = - of("postal_code_match_address_not_checked") - @JvmStatic fun of(value: String) = Result(JsonField.of(value)) } /** An enum containing [Result]'s known values. */ enum class Known { - /** No address information was provided in the authorization request. */ - NOT_CHECKED, - /** - * Postal code matches, but the street address does not match or was not - * provided. - */ - POSTAL_CODE_MATCH_ADDRESS_NO_MATCH, /** - * Postal code does not match, but the street address matches or was not - * provided. + * No card verification code was provided in the authorization request. */ - POSTAL_CODE_NO_MATCH_ADDRESS_MATCH, - /** Postal code and street address match. */ + NOT_CHECKED, + /** The card verification code matched the one on file. */ MATCH, - /** Postal code and street address do not match. */ + /** The card verification code did not match the one on file. */ NO_MATCH, - /** - * Postal code matches, but the street address was not verified. - * (deprecated) - */ - POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED, } /** @@ -81580,27 +94674,14 @@ private constructor( * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - /** No address information was provided in the authorization request. */ - NOT_CHECKED, - /** - * Postal code matches, but the street address does not match or was not - * provided. - */ - POSTAL_CODE_MATCH_ADDRESS_NO_MATCH, /** - * Postal code does not match, but the street address matches or was not - * provided. + * No card verification code was provided in the authorization request. */ - POSTAL_CODE_NO_MATCH_ADDRESS_MATCH, - /** Postal code and street address match. */ + NOT_CHECKED, + /** The card verification code matched the one on file. */ MATCH, - /** Postal code and street address do not match. */ + /** The card verification code did not match the one on file. */ NO_MATCH, - /** - * Postal code matches, but the street address was not verified. - * (deprecated) - */ - POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED, /** * An enum member indicating that [Result] was instantiated with an * unknown value. @@ -81618,14 +94699,8 @@ private constructor( fun value(): Value = when (this) { NOT_CHECKED -> Value.NOT_CHECKED - POSTAL_CODE_MATCH_ADDRESS_NO_MATCH -> - Value.POSTAL_CODE_MATCH_ADDRESS_NO_MATCH - POSTAL_CODE_NO_MATCH_ADDRESS_MATCH -> - Value.POSTAL_CODE_NO_MATCH_ADDRESS_MATCH MATCH -> Value.MATCH NO_MATCH -> Value.NO_MATCH - POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED -> - Value.POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED else -> Value._UNKNOWN } @@ -81641,14 +94716,8 @@ private constructor( fun known(): Known = when (this) { NOT_CHECKED -> Known.NOT_CHECKED - POSTAL_CODE_MATCH_ADDRESS_NO_MATCH -> - Known.POSTAL_CODE_MATCH_ADDRESS_NO_MATCH - POSTAL_CODE_NO_MATCH_ADDRESS_MATCH -> - Known.POSTAL_CODE_NO_MATCH_ADDRESS_MATCH MATCH -> Known.MATCH NO_MATCH -> Known.NO_MATCH - POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED -> - Known.POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED else -> throw IncreaseInvalidDataException("Unknown Result: $value") } @@ -81712,116 +94781,154 @@ private constructor( return true } - return other is CardholderAddress && - actualLine1 == other.actualLine1 && - actualPostalCode == other.actualPostalCode && - providedLine1 == other.providedLine1 && - providedPostalCode == other.providedPostalCode && + return other is CardVerificationCode && result == other.result && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { - Objects.hash( - actualLine1, - actualPostalCode, - providedLine1, - providedPostalCode, - result, - additionalProperties, - ) - } + private val hashCode: Int by lazy { Objects.hash(result, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "CardholderAddress{actualLine1=$actualLine1, actualPostalCode=$actualPostalCode, providedLine1=$providedLine1, providedPostalCode=$providedPostalCode, result=$result, additionalProperties=$additionalProperties}" + "CardVerificationCode{result=$result, additionalProperties=$additionalProperties}" } - /** Cardholder name provided in the authorization request. */ - class CardholderName + /** + * Cardholder address provided in the authorization request and the address on file + * we verified it against. + */ + class CardholderAddress @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val providedFirstName: JsonField, - private val providedLastName: JsonField, - private val providedMiddleName: JsonField, + private val actualLine1: JsonField, + private val actualPostalCode: JsonField, + private val providedLine1: JsonField, + private val providedPostalCode: JsonField, + private val result: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("provided_first_name") + @JsonProperty("actual_line1") @ExcludeMissing - providedFirstName: JsonField = JsonMissing.of(), - @JsonProperty("provided_last_name") + actualLine1: JsonField = JsonMissing.of(), + @JsonProperty("actual_postal_code") @ExcludeMissing - providedLastName: JsonField = JsonMissing.of(), - @JsonProperty("provided_middle_name") + actualPostalCode: JsonField = JsonMissing.of(), + @JsonProperty("provided_line1") @ExcludeMissing - providedMiddleName: JsonField = JsonMissing.of(), + providedLine1: JsonField = JsonMissing.of(), + @JsonProperty("provided_postal_code") + @ExcludeMissing + providedPostalCode: JsonField = JsonMissing.of(), + @JsonProperty("result") + @ExcludeMissing + result: JsonField = JsonMissing.of(), ) : this( - providedFirstName, - providedLastName, - providedMiddleName, + actualLine1, + actualPostalCode, + providedLine1, + providedPostalCode, + result, mutableMapOf(), ) /** - * The first name provided for verification in the authorization request. + * Line 1 of the address on file for the cardholder. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun providedFirstName(): Optional = - providedFirstName.getOptional("provided_first_name") + fun actualLine1(): Optional = actualLine1.getOptional("actual_line1") /** - * The last name provided for verification in the authorization request. + * The postal code of the address on file for the cardholder. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun providedLastName(): Optional = - providedLastName.getOptional("provided_last_name") + fun actualPostalCode(): Optional = + actualPostalCode.getOptional("actual_postal_code") /** - * The middle name provided for verification in the authorization request. + * The cardholder address line 1 provided for verification in the authorization + * request. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun providedMiddleName(): Optional = - providedMiddleName.getOptional("provided_middle_name") + fun providedLine1(): Optional = + providedLine1.getOptional("provided_line1") /** - * Returns the raw JSON value of [providedFirstName]. + * The postal code provided for verification in the authorization request. * - * Unlike [providedFirstName], this method doesn't throw if the JSON field has - * an unexpected type. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ - @JsonProperty("provided_first_name") + fun providedPostalCode(): Optional = + providedPostalCode.getOptional("provided_postal_code") + + /** + * The address verification result returned to the card network. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun result(): Result = result.getRequired("result") + + /** + * Returns the raw JSON value of [actualLine1]. + * + * Unlike [actualLine1], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("actual_line1") @ExcludeMissing - fun _providedFirstName(): JsonField = providedFirstName + fun _actualLine1(): JsonField = actualLine1 /** - * Returns the raw JSON value of [providedLastName]. + * Returns the raw JSON value of [actualPostalCode]. * - * Unlike [providedLastName], this method doesn't throw if the JSON field has an + * Unlike [actualPostalCode], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("provided_last_name") + @JsonProperty("actual_postal_code") @ExcludeMissing - fun _providedLastName(): JsonField = providedLastName + fun _actualPostalCode(): JsonField = actualPostalCode /** - * Returns the raw JSON value of [providedMiddleName]. + * Returns the raw JSON value of [providedLine1]. * - * Unlike [providedMiddleName], this method doesn't throw if the JSON field has + * Unlike [providedLine1], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("provided_line1") + @ExcludeMissing + fun _providedLine1(): JsonField = providedLine1 + + /** + * Returns the raw JSON value of [providedPostalCode]. + * + * Unlike [providedPostalCode], this method doesn't throw if the JSON field has * an unexpected type. */ - @JsonProperty("provided_middle_name") + @JsonProperty("provided_postal_code") @ExcludeMissing - fun _providedMiddleName(): JsonField = providedMiddleName + fun _providedPostalCode(): JsonField = providedPostalCode + + /** + * Returns the raw JSON value of [result]. + * + * Unlike [result], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("result") + @ExcludeMissing + fun _result(): JsonField = result @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -81839,106 +94946,146 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [CardholderName]. + * [CardholderAddress]. * * The following fields are required: * ```java - * .providedFirstName() - * .providedLastName() - * .providedMiddleName() + * .actualLine1() + * .actualPostalCode() + * .providedLine1() + * .providedPostalCode() + * .result() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [CardholderName]. */ + /** A builder for [CardholderAddress]. */ class Builder internal constructor() { - private var providedFirstName: JsonField? = null - private var providedLastName: JsonField? = null - private var providedMiddleName: JsonField? = null + private var actualLine1: JsonField? = null + private var actualPostalCode: JsonField? = null + private var providedLine1: JsonField? = null + private var providedPostalCode: JsonField? = null + private var result: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(cardholderName: CardholderName) = apply { - providedFirstName = cardholderName.providedFirstName - providedLastName = cardholderName.providedLastName - providedMiddleName = cardholderName.providedMiddleName + internal fun from(cardholderAddress: CardholderAddress) = apply { + actualLine1 = cardholderAddress.actualLine1 + actualPostalCode = cardholderAddress.actualPostalCode + providedLine1 = cardholderAddress.providedLine1 + providedPostalCode = cardholderAddress.providedPostalCode + result = cardholderAddress.result additionalProperties = - cardholderName.additionalProperties.toMutableMap() + cardholderAddress.additionalProperties.toMutableMap() } + /** Line 1 of the address on file for the cardholder. */ + fun actualLine1(actualLine1: String?) = + actualLine1(JsonField.ofNullable(actualLine1)) + /** - * The first name provided for verification in the authorization request. + * Alias for calling [Builder.actualLine1] with `actualLine1.orElse(null)`. */ - fun providedFirstName(providedFirstName: String?) = - providedFirstName(JsonField.ofNullable(providedFirstName)) + fun actualLine1(actualLine1: Optional) = + actualLine1(actualLine1.getOrNull()) /** - * Alias for calling [Builder.providedFirstName] with - * `providedFirstName.orElse(null)`. + * Sets [Builder.actualLine1] to an arbitrary JSON value. + * + * You should usually call [Builder.actualLine1] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ - fun providedFirstName(providedFirstName: Optional) = - providedFirstName(providedFirstName.getOrNull()) + fun actualLine1(actualLine1: JsonField) = apply { + this.actualLine1 = actualLine1 + } + + /** The postal code of the address on file for the cardholder. */ + fun actualPostalCode(actualPostalCode: String?) = + actualPostalCode(JsonField.ofNullable(actualPostalCode)) /** - * Sets [Builder.providedFirstName] to an arbitrary JSON value. + * Alias for calling [Builder.actualPostalCode] with + * `actualPostalCode.orElse(null)`. + */ + fun actualPostalCode(actualPostalCode: Optional) = + actualPostalCode(actualPostalCode.getOrNull()) + + /** + * Sets [Builder.actualPostalCode] to an arbitrary JSON value. * - * You should usually call [Builder.providedFirstName] with a well-typed + * You should usually call [Builder.actualPostalCode] with a well-typed * [String] value instead. This method is primarily for setting the field to * an undocumented or not yet supported value. */ - fun providedFirstName(providedFirstName: JsonField) = apply { - this.providedFirstName = providedFirstName + fun actualPostalCode(actualPostalCode: JsonField) = apply { + this.actualPostalCode = actualPostalCode } - /** The last name provided for verification in the authorization request. */ - fun providedLastName(providedLastName: String?) = - providedLastName(JsonField.ofNullable(providedLastName)) + /** + * The cardholder address line 1 provided for verification in the + * authorization request. + */ + fun providedLine1(providedLine1: String?) = + providedLine1(JsonField.ofNullable(providedLine1)) /** - * Alias for calling [Builder.providedLastName] with - * `providedLastName.orElse(null)`. + * Alias for calling [Builder.providedLine1] with + * `providedLine1.orElse(null)`. */ - fun providedLastName(providedLastName: Optional) = - providedLastName(providedLastName.getOrNull()) + fun providedLine1(providedLine1: Optional) = + providedLine1(providedLine1.getOrNull()) /** - * Sets [Builder.providedLastName] to an arbitrary JSON value. + * Sets [Builder.providedLine1] to an arbitrary JSON value. * - * You should usually call [Builder.providedLastName] with a well-typed + * You should usually call [Builder.providedLine1] with a well-typed * [String] value instead. This method is primarily for setting the field to * an undocumented or not yet supported value. */ - fun providedLastName(providedLastName: JsonField) = apply { - this.providedLastName = providedLastName + fun providedLine1(providedLine1: JsonField) = apply { + this.providedLine1 = providedLine1 } /** - * The middle name provided for verification in the authorization request. + * The postal code provided for verification in the authorization request. */ - fun providedMiddleName(providedMiddleName: String?) = - providedMiddleName(JsonField.ofNullable(providedMiddleName)) + fun providedPostalCode(providedPostalCode: String?) = + providedPostalCode(JsonField.ofNullable(providedPostalCode)) /** - * Alias for calling [Builder.providedMiddleName] with - * `providedMiddleName.orElse(null)`. + * Alias for calling [Builder.providedPostalCode] with + * `providedPostalCode.orElse(null)`. */ - fun providedMiddleName(providedMiddleName: Optional) = - providedMiddleName(providedMiddleName.getOrNull()) + fun providedPostalCode(providedPostalCode: Optional) = + providedPostalCode(providedPostalCode.getOrNull()) /** - * Sets [Builder.providedMiddleName] to an arbitrary JSON value. + * Sets [Builder.providedPostalCode] to an arbitrary JSON value. * - * You should usually call [Builder.providedMiddleName] with a well-typed + * You should usually call [Builder.providedPostalCode] with a well-typed * [String] value instead. This method is primarily for setting the field to * an undocumented or not yet supported value. */ - fun providedMiddleName(providedMiddleName: JsonField) = apply { - this.providedMiddleName = providedMiddleName + fun providedPostalCode(providedPostalCode: JsonField) = apply { + this.providedPostalCode = providedPostalCode } + /** The address verification result returned to the card network. */ + fun result(result: Result) = result(JsonField.of(result)) + + /** + * Sets [Builder.result] to an arbitrary JSON value. + * + * You should usually call [Builder.result] with a well-typed [Result] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun result(result: JsonField) = apply { this.result = result } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -81962,38 +95109,44 @@ private constructor( } /** - * Returns an immutable instance of [CardholderName]. + * Returns an immutable instance of [CardholderAddress]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .providedFirstName() - * .providedLastName() - * .providedMiddleName() + * .actualLine1() + * .actualPostalCode() + * .providedLine1() + * .providedPostalCode() + * .result() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): CardholderName = - CardholderName( - checkRequired("providedFirstName", providedFirstName), - checkRequired("providedLastName", providedLastName), - checkRequired("providedMiddleName", providedMiddleName), + fun build(): CardholderAddress = + CardholderAddress( + checkRequired("actualLine1", actualLine1), + checkRequired("actualPostalCode", actualPostalCode), + checkRequired("providedLine1", providedLine1), + checkRequired("providedPostalCode", providedPostalCode), + checkRequired("result", result), additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): CardholderName = apply { + fun validate(): CardholderAddress = apply { if (validated) { return@apply } - providedFirstName() - providedLastName() - providedMiddleName() + actualLine1() + actualPostalCode() + providedLine1() + providedPostalCode() + result().validate() validated = true } @@ -82013,1467 +95166,734 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (providedFirstName.asKnown().isPresent) 1 else 0) + - (if (providedLastName.asKnown().isPresent) 1 else 0) + - (if (providedMiddleName.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CardholderName && - providedFirstName == other.providedFirstName && - providedLastName == other.providedLastName && - providedMiddleName == other.providedMiddleName && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - providedFirstName, - providedLastName, - providedMiddleName, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "CardholderName{providedFirstName=$providedFirstName, providedLastName=$providedLastName, providedMiddleName=$providedMiddleName, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Verification && - cardVerificationCode == other.cardVerificationCode && - cardholderAddress == other.cardholderAddress && - cardholderName == other.cardholderName && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - cardVerificationCode, - cardholderAddress, - cardholderName, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Verification{cardVerificationCode=$cardVerificationCode, cardholderAddress=$cardholderAddress, cardholderName=$cardholderName, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CardValidation && - id == other.id && - actioner == other.actioner && - additionalAmounts == other.additionalAmounts && - cardPaymentId == other.cardPaymentId && - currency == other.currency && - digitalWalletTokenId == other.digitalWalletTokenId && - merchantAcceptorId == other.merchantAcceptorId && - merchantCategoryCode == other.merchantCategoryCode && - merchantCity == other.merchantCity && - merchantCountry == other.merchantCountry && - merchantDescriptor == other.merchantDescriptor && - merchantPostalCode == other.merchantPostalCode && - merchantState == other.merchantState && - networkDetails == other.networkDetails && - networkIdentifiers == other.networkIdentifiers && - networkRiskScore == other.networkRiskScore && - physicalCardId == other.physicalCardId && - realTimeDecisionId == other.realTimeDecisionId && - terminalId == other.terminalId && - type == other.type && - verification == other.verification && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - id, - actioner, - additionalAmounts, - cardPaymentId, - currency, - digitalWalletTokenId, - merchantAcceptorId, - merchantCategoryCode, - merchantCity, - merchantCountry, - merchantDescriptor, - merchantPostalCode, - merchantState, - networkDetails, - networkIdentifiers, - networkRiskScore, - physicalCardId, - realTimeDecisionId, - terminalId, - type, - verification, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "CardValidation{id=$id, actioner=$actioner, additionalAmounts=$additionalAmounts, cardPaymentId=$cardPaymentId, currency=$currency, digitalWalletTokenId=$digitalWalletTokenId, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkDetails=$networkDetails, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, physicalCardId=$physicalCardId, realTimeDecisionId=$realTimeDecisionId, terminalId=$terminalId, type=$type, verification=$verification, additionalProperties=$additionalProperties}" - } - - /** - * If the category of this Transaction source is equal to `other`, this field will contain - * an empty object, otherwise it will contain null. - */ - class Other - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor(private val additionalProperties: MutableMap) { - - @JsonCreator private constructor() : this(mutableMapOf()) - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [Other]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Other]. */ - class Builder internal constructor() { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(other: Other) = apply { - additionalProperties = other.additionalProperties.toMutableMap() - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Other]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): Other = Other(additionalProperties.toMutableMap()) - } - - private var validated: Boolean = false - - fun validate(): Other = apply { - if (validated) { - return@apply - } - - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = 0 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Other && additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = "Other{additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Element && - category == other.category && - createdAt == other.createdAt && - cardAuthentication == other.cardAuthentication && - cardAuthorization == other.cardAuthorization && - cardAuthorizationExpiration == other.cardAuthorizationExpiration && - cardBalanceInquiry == other.cardBalanceInquiry && - cardDecline == other.cardDecline && - cardFinancial == other.cardFinancial && - cardFuelConfirmation == other.cardFuelConfirmation && - cardIncrement == other.cardIncrement && - cardRefund == other.cardRefund && - cardReversal == other.cardReversal && - cardSettlement == other.cardSettlement && - cardValidation == other.cardValidation && - this.other == other.other && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - category, - createdAt, - cardAuthentication, - cardAuthorization, - cardAuthorizationExpiration, - cardBalanceInquiry, - cardDecline, - cardFinancial, - cardFuelConfirmation, - cardIncrement, - cardRefund, - cardReversal, - cardSettlement, - cardValidation, - other, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Element{category=$category, createdAt=$createdAt, cardAuthentication=$cardAuthentication, cardAuthorization=$cardAuthorization, cardAuthorizationExpiration=$cardAuthorizationExpiration, cardBalanceInquiry=$cardBalanceInquiry, cardDecline=$cardDecline, cardFinancial=$cardFinancial, cardFuelConfirmation=$cardFuelConfirmation, cardIncrement=$cardIncrement, cardRefund=$cardRefund, cardReversal=$cardReversal, cardSettlement=$cardSettlement, cardValidation=$cardValidation, other=$other, additionalProperties=$additionalProperties}" - } - - class SchemeFee - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val amount: JsonField, - private val createdAt: JsonField, - private val currency: JsonField, - private val feeType: JsonField, - private val fixedComponent: JsonField, - private val variableRate: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - @JsonProperty("created_at") - @ExcludeMissing - createdAt: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - currency: JsonField = JsonMissing.of(), - @JsonProperty("fee_type") - @ExcludeMissing - feeType: JsonField = JsonMissing.of(), - @JsonProperty("fixed_component") - @ExcludeMissing - fixedComponent: JsonField = JsonMissing.of(), - @JsonProperty("variable_rate") - @ExcludeMissing - variableRate: JsonField = JsonMissing.of(), - ) : this(amount, createdAt, currency, feeType, fixedComponent, variableRate, mutableMapOf()) - - /** - * The fee amount given as a string containing a decimal number. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun amount(): String = amount.getRequired("amount") - - /** - * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was created. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee reimbursement. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun currency(): Currency = currency.getRequired("currency") - - /** - * The type of fee being assessed. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun feeType(): FeeType = feeType.getRequired("fee_type") - - /** - * The fixed component of the fee, if applicable, given in major units of the fee amount. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun fixedComponent(): Optional = fixedComponent.getOptional("fixed_component") - - /** - * The variable rate component of the fee, if applicable, given as a decimal (e.g., 0.015 - * for 1.5%). - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun variableRate(): Optional = variableRate.getOptional("variable_rate") - - /** - * Returns the raw JSON value of [amount]. - * - * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - - /** - * Returns the raw JSON value of [createdAt]. - * - * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("created_at") - @ExcludeMissing - fun _createdAt(): JsonField = createdAt - - /** - * Returns the raw JSON value of [currency]. - * - * Unlike [currency], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** - * Returns the raw JSON value of [feeType]. - * - * Unlike [feeType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("fee_type") @ExcludeMissing fun _feeType(): JsonField = feeType - - /** - * Returns the raw JSON value of [fixedComponent]. - * - * Unlike [fixedComponent], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("fixed_component") - @ExcludeMissing - fun _fixedComponent(): JsonField = fixedComponent + (if (actualLine1.asKnown().isPresent) 1 else 0) + + (if (actualPostalCode.asKnown().isPresent) 1 else 0) + + (if (providedLine1.asKnown().isPresent) 1 else 0) + + (if (providedPostalCode.asKnown().isPresent) 1 else 0) + + (result.asKnown().getOrNull()?.validity() ?: 0) - /** - * Returns the raw JSON value of [variableRate]. - * - * Unlike [variableRate], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("variable_rate") - @ExcludeMissing - fun _variableRate(): JsonField = variableRate + /** The address verification result returned to the card network. */ + class Result + @JsonCreator + private constructor(private val value: JsonField) : Enum { - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + companion object { - fun toBuilder() = Builder().from(this) + /** No address information was provided in the authorization request. */ + @JvmField val NOT_CHECKED = of("not_checked") - companion object { + /** + * Postal code matches, but the street address does not match or was not + * provided. + */ + @JvmField + val POSTAL_CODE_MATCH_ADDRESS_NO_MATCH = + of("postal_code_match_address_no_match") - /** - * Returns a mutable builder for constructing an instance of [SchemeFee]. - * - * The following fields are required: - * ```java - * .amount() - * .createdAt() - * .currency() - * .feeType() - * .fixedComponent() - * .variableRate() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + /** + * Postal code does not match, but the street address matches or was not + * provided. + */ + @JvmField + val POSTAL_CODE_NO_MATCH_ADDRESS_MATCH = + of("postal_code_no_match_address_match") - /** A builder for [SchemeFee]. */ - class Builder internal constructor() { + /** Postal code and street address match. */ + @JvmField val MATCH = of("match") - private var amount: JsonField? = null - private var createdAt: JsonField? = null - private var currency: JsonField? = null - private var feeType: JsonField? = null - private var fixedComponent: JsonField? = null - private var variableRate: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** Postal code and street address do not match. */ + @JvmField val NO_MATCH = of("no_match") - @JvmSynthetic - internal fun from(schemeFee: SchemeFee) = apply { - amount = schemeFee.amount - createdAt = schemeFee.createdAt - currency = schemeFee.currency - feeType = schemeFee.feeType - fixedComponent = schemeFee.fixedComponent - variableRate = schemeFee.variableRate - additionalProperties = schemeFee.additionalProperties.toMutableMap() - } + /** + * Postal code matches, but the street address was not verified. + * (deprecated) + */ + @JvmField + val POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED = + of("postal_code_match_address_not_checked") - /** The fee amount given as a string containing a decimal number. */ - fun amount(amount: String) = amount(JsonField.of(amount)) + @JvmStatic fun of(value: String) = Result(JsonField.of(value)) + } - /** - * Sets [Builder.amount] to an arbitrary JSON value. - * - * You should usually call [Builder.amount] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } + /** An enum containing [Result]'s known values. */ + enum class Known { + /** No address information was provided in the authorization request. */ + NOT_CHECKED, + /** + * Postal code matches, but the street address does not match or was not + * provided. + */ + POSTAL_CODE_MATCH_ADDRESS_NO_MATCH, + /** + * Postal code does not match, but the street address matches or was not + * provided. + */ + POSTAL_CODE_NO_MATCH_ADDRESS_MATCH, + /** Postal code and street address match. */ + MATCH, + /** Postal code and street address do not match. */ + NO_MATCH, + /** + * Postal code matches, but the street address was not verified. + * (deprecated) + */ + POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED, + } - /** - * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was - * created. - */ - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + /** + * An enum containing [Result]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Result] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** No address information was provided in the authorization request. */ + NOT_CHECKED, + /** + * Postal code matches, but the street address does not match or was not + * provided. + */ + POSTAL_CODE_MATCH_ADDRESS_NO_MATCH, + /** + * Postal code does not match, but the street address matches or was not + * provided. + */ + POSTAL_CODE_NO_MATCH_ADDRESS_MATCH, + /** Postal code and street address match. */ + MATCH, + /** Postal code and street address do not match. */ + NO_MATCH, + /** + * Postal code matches, but the street address was not verified. + * (deprecated) + */ + POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED, + /** + * An enum member indicating that [Result] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** - * Sets [Builder.createdAt] to an arbitrary JSON value. - * - * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NOT_CHECKED -> Value.NOT_CHECKED + POSTAL_CODE_MATCH_ADDRESS_NO_MATCH -> + Value.POSTAL_CODE_MATCH_ADDRESS_NO_MATCH + POSTAL_CODE_NO_MATCH_ADDRESS_MATCH -> + Value.POSTAL_CODE_NO_MATCH_ADDRESS_MATCH + MATCH -> Value.MATCH + NO_MATCH -> Value.NO_MATCH + POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED -> + Value.POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED + else -> Value._UNKNOWN + } - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee - * reimbursement. - */ - fun currency(currency: Currency) = currency(JsonField.of(currency)) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + NOT_CHECKED -> Known.NOT_CHECKED + POSTAL_CODE_MATCH_ADDRESS_NO_MATCH -> + Known.POSTAL_CODE_MATCH_ADDRESS_NO_MATCH + POSTAL_CODE_NO_MATCH_ADDRESS_MATCH -> + Known.POSTAL_CODE_NO_MATCH_ADDRESS_MATCH + MATCH -> Known.MATCH + NO_MATCH -> Known.NO_MATCH + POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED -> + Known.POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED + else -> throw IncreaseInvalidDataException("Unknown Result: $value") + } - /** - * Sets [Builder.currency] to an arbitrary JSON value. - * - * You should usually call [Builder.currency] with a well-typed [Currency] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun currency(currency: JsonField) = apply { this.currency = currency } + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - /** The type of fee being assessed. */ - fun feeType(feeType: FeeType) = feeType(JsonField.of(feeType)) + private var validated: Boolean = false - /** - * Sets [Builder.feeType] to an arbitrary JSON value. - * - * You should usually call [Builder.feeType] with a well-typed [FeeType] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun feeType(feeType: JsonField) = apply { this.feeType = feeType } + fun validate(): Result = apply { + if (validated) { + return@apply + } - /** - * The fixed component of the fee, if applicable, given in major units of the fee - * amount. - */ - fun fixedComponent(fixedComponent: String?) = - fixedComponent(JsonField.ofNullable(fixedComponent)) + known() + validated = true + } - /** Alias for calling [Builder.fixedComponent] with `fixedComponent.orElse(null)`. */ - fun fixedComponent(fixedComponent: Optional) = - fixedComponent(fixedComponent.getOrNull()) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * Sets [Builder.fixedComponent] to an arbitrary JSON value. - * - * You should usually call [Builder.fixedComponent] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun fixedComponent(fixedComponent: JsonField) = apply { - this.fixedComponent = fixedComponent - } + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - /** - * The variable rate component of the fee, if applicable, given as a decimal (e.g., - * 0.015 for 1.5%). - */ - fun variableRate(variableRate: String?) = - variableRate(JsonField.ofNullable(variableRate)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** Alias for calling [Builder.variableRate] with `variableRate.orElse(null)`. */ - fun variableRate(variableRate: Optional) = - variableRate(variableRate.getOrNull()) + return other is Result && value == other.value + } - /** - * Sets [Builder.variableRate] to an arbitrary JSON value. - * - * You should usually call [Builder.variableRate] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun variableRate(variableRate: JsonField) = apply { - this.variableRate = variableRate - } + override fun hashCode() = value.hashCode() - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun toString() = value.toString() + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + return other is CardholderAddress && + actualLine1 == other.actualLine1 && + actualPostalCode == other.actualPostalCode && + providedLine1 == other.providedLine1 && + providedPostalCode == other.providedPostalCode && + result == other.result && + additionalProperties == other.additionalProperties + } - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + private val hashCode: Int by lazy { + Objects.hash( + actualLine1, + actualPostalCode, + providedLine1, + providedPostalCode, + result, + additionalProperties, + ) + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + override fun hashCode(): Int = hashCode - /** - * Returns an immutable instance of [SchemeFee]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .amount() - * .createdAt() - * .currency() - * .feeType() - * .fixedComponent() - * .variableRate() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): SchemeFee = - SchemeFee( - checkRequired("amount", amount), - checkRequired("createdAt", createdAt), - checkRequired("currency", currency), - checkRequired("feeType", feeType), - checkRequired("fixedComponent", fixedComponent), - checkRequired("variableRate", variableRate), - additionalProperties.toMutableMap(), - ) - } + override fun toString() = + "CardholderAddress{actualLine1=$actualLine1, actualPostalCode=$actualPostalCode, providedLine1=$providedLine1, providedPostalCode=$providedPostalCode, result=$result, additionalProperties=$additionalProperties}" + } - private var validated: Boolean = false + /** Cardholder name provided in the authorization request. */ + class CardholderName + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val providedFirstName: JsonField, + private val providedLastName: JsonField, + private val providedMiddleName: JsonField, + private val additionalProperties: MutableMap, + ) { - fun validate(): SchemeFee = apply { - if (validated) { - return@apply - } + @JsonCreator + private constructor( + @JsonProperty("provided_first_name") + @ExcludeMissing + providedFirstName: JsonField = JsonMissing.of(), + @JsonProperty("provided_last_name") + @ExcludeMissing + providedLastName: JsonField = JsonMissing.of(), + @JsonProperty("provided_middle_name") + @ExcludeMissing + providedMiddleName: JsonField = JsonMissing.of(), + ) : this( + providedFirstName, + providedLastName, + providedMiddleName, + mutableMapOf(), + ) - amount() - createdAt() - currency().validate() - feeType().validate() - fixedComponent() - variableRate() - validated = true - } + /** + * The first name provided for verification in the authorization request. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun providedFirstName(): Optional = + providedFirstName.getOptional("provided_first_name") - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * The last name provided for verification in the authorization request. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun providedLastName(): Optional = + providedLastName.getOptional("provided_last_name") - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (amount.asKnown().isPresent) 1 else 0) + - (if (createdAt.asKnown().isPresent) 1 else 0) + - (currency.asKnown().getOrNull()?.validity() ?: 0) + - (feeType.asKnown().getOrNull()?.validity() ?: 0) + - (if (fixedComponent.asKnown().isPresent) 1 else 0) + - (if (variableRate.asKnown().isPresent) 1 else 0) + /** + * The middle name provided for verification in the authorization request. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun providedMiddleName(): Optional = + providedMiddleName.getOptional("provided_middle_name") - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee reimbursement. - */ - class Currency @JsonCreator private constructor(private val value: JsonField) : - Enum { + /** + * Returns the raw JSON value of [providedFirstName]. + * + * Unlike [providedFirstName], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("provided_first_name") + @ExcludeMissing + fun _providedFirstName(): JsonField = providedFirstName - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + /** + * Returns the raw JSON value of [providedLastName]. + * + * Unlike [providedLastName], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("provided_last_name") + @ExcludeMissing + fun _providedLastName(): JsonField = providedLastName - companion object { + /** + * Returns the raw JSON value of [providedMiddleName]. + * + * Unlike [providedMiddleName], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("provided_middle_name") + @ExcludeMissing + fun _providedMiddleName(): JsonField = providedMiddleName - /** US Dollar (USD) */ - @JvmField val USD = of("USD") + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** An enum containing [Currency]'s known values. */ - enum class Known { - /** US Dollar (USD) */ - USD - } + fun toBuilder() = Builder().from(this) - /** - * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Currency] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** US Dollar (USD) */ - USD, - /** - * An enum member indicating that [Currency] was instantiated with an unknown value. - */ - _UNKNOWN, - } + companion object { - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USD -> Value.USD - else -> Value._UNKNOWN - } + /** + * Returns a mutable builder for constructing an instance of + * [CardholderName]. + * + * The following fields are required: + * ```java + * .providedFirstName() + * .providedLastName() + * .providedMiddleName() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - USD -> Known.USD - else -> throw IncreaseInvalidDataException("Unknown Currency: $value") - } + /** A builder for [CardholderName]. */ + class Builder internal constructor() { - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + private var providedFirstName: JsonField? = null + private var providedLastName: JsonField? = null + private var providedMiddleName: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() - private var validated: Boolean = false + @JvmSynthetic + internal fun from(cardholderName: CardholderName) = apply { + providedFirstName = cardholderName.providedFirstName + providedLastName = cardholderName.providedLastName + providedMiddleName = cardholderName.providedMiddleName + additionalProperties = + cardholderName.additionalProperties.toMutableMap() + } - fun validate(): Currency = apply { - if (validated) { - return@apply - } + /** + * The first name provided for verification in the authorization request. + */ + fun providedFirstName(providedFirstName: String?) = + providedFirstName(JsonField.ofNullable(providedFirstName)) - known() - validated = true - } + /** + * Alias for calling [Builder.providedFirstName] with + * `providedFirstName.orElse(null)`. + */ + fun providedFirstName(providedFirstName: Optional) = + providedFirstName(providedFirstName.getOrNull()) - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * Sets [Builder.providedFirstName] to an arbitrary JSON value. + * + * You should usually call [Builder.providedFirstName] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun providedFirstName(providedFirstName: JsonField) = apply { + this.providedFirstName = providedFirstName + } - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + /** The last name provided for verification in the authorization request. */ + fun providedLastName(providedLastName: String?) = + providedLastName(JsonField.ofNullable(providedLastName)) + + /** + * Alias for calling [Builder.providedLastName] with + * `providedLastName.orElse(null)`. + */ + fun providedLastName(providedLastName: Optional) = + providedLastName(providedLastName.getOrNull()) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Sets [Builder.providedLastName] to an arbitrary JSON value. + * + * You should usually call [Builder.providedLastName] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun providedLastName(providedLastName: JsonField) = apply { + this.providedLastName = providedLastName + } - return other is Currency && value == other.value - } + /** + * The middle name provided for verification in the authorization request. + */ + fun providedMiddleName(providedMiddleName: String?) = + providedMiddleName(JsonField.ofNullable(providedMiddleName)) - override fun hashCode() = value.hashCode() + /** + * Alias for calling [Builder.providedMiddleName] with + * `providedMiddleName.orElse(null)`. + */ + fun providedMiddleName(providedMiddleName: Optional) = + providedMiddleName(providedMiddleName.getOrNull()) - override fun toString() = value.toString() - } + /** + * Sets [Builder.providedMiddleName] to an arbitrary JSON value. + * + * You should usually call [Builder.providedMiddleName] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun providedMiddleName(providedMiddleName: JsonField) = apply { + this.providedMiddleName = providedMiddleName + } - /** The type of fee being assessed. */ - class FeeType @JsonCreator private constructor(private val value: JsonField) : - Enum { + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - companion object { + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } - /** - * International Service Assessment (ISA) single-currency is a fee assessed by the - * card network for cross-border transactions presented and settled in the same - * currency. - */ - @JvmField - val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY = - of("visa_international_service_assessment_single_currency") + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * International Service Assessment (ISA) cross-currency is a fee assessed by the - * card network for cross-border transactions presented and settled in different - * currencies. - */ - @JvmField - val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY = - of("visa_international_service_assessment_cross_currency") + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * Activity and charges for Visa Settlement System processing for POS - * (Point-Of-Sale) authorization transactions. Authorization is the process of - * approving or declining the transaction amount specified. The fee is assessed to - * the Issuer. - */ - @JvmField - val VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE = - of("visa_authorization_domestic_point_of_sale") + /** + * Returns an immutable instance of [CardholderName]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .providedFirstName() + * .providedLastName() + * .providedMiddleName() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CardholderName = + CardholderName( + checkRequired("providedFirstName", providedFirstName), + checkRequired("providedLastName", providedLastName), + checkRequired("providedMiddleName", providedMiddleName), + additionalProperties.toMutableMap(), + ) + } - /** - * Activity and charges for Visa Settlement System processing for POS - * (Point-Of-Sale) International authorization transactions. Authorization is the - * process of approving or declining the transaction amount specified. The fee is - * assessed to the Issuer. - */ - @JvmField - val VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE = - of("visa_authorization_international_point_of_sale") + private var validated: Boolean = false - /** - * Activity and charges for Visa Settlement System processing for Canada Region POS - * (Point-of-Sale) authorization transactions. Authorization is the process of - * approving or declining the transaction amount specified. - */ - @JvmField - val VISA_AUTHORIZATION_CANADA_POINT_OF_SALE = - of("visa_authorization_canada_point_of_sale") + fun validate(): CardholderName = apply { + if (validated) { + return@apply + } - /** - * Activity only for Visa Settlement System authorization processing of POS - * (Point-Of-Sale) reversal transactions. Authorization reversal represents a VSS - * message that undoes the complete or partial actions of a previous authorization - * request. - */ - @JvmField - val VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE = - of("visa_authorization_reversal_point_of_sale") + providedFirstName() + providedLastName() + providedMiddleName() + validated = true + } - /** - * Activity only for Visa Settlement System authorization processing of POS - * (Point-Of-Sale) International reversal transactions. Authorization reversal - * represents a VSS message that undoes the complete or partial actions of a - * previous authorization request. - */ - @JvmField - val VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE = - of("visa_authorization_reversal_international_point_of_sale") + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * A per Address Verification Service (AVS) result fee. Applies to all usable AVS - * result codes. - */ - @JvmField - val VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE = - of("visa_authorization_address_verification_service") + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (providedFirstName.asKnown().isPresent) 1 else 0) + + (if (providedLastName.asKnown().isPresent) 1 else 0) + + (if (providedMiddleName.asKnown().isPresent) 1 else 0) - /** - * Advanced Authorization is a fraud detection tool that monitors and risk evaluates - * 100 percent of US VisaNet authorizations in real-time. Activity related to - * Purchase (includes Signature Authenticated Visa and PIN Authenticated Visa Debit - * (PAVD) transactions). - */ - @JvmField val VISA_ADVANCED_AUTHORIZATION = of("visa_advanced_authorization") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Issuer Transactions Visa represents a charge based on total actual monthly - * processing (Visa transactions only) through a VisaNet Access Point (VAP). Charges - * are assessed to the processor for each VisaNet Access Point. - */ - @JvmField val VISA_MESSAGE_TRANSMISSION = of("visa_message_transmission") + return other is CardholderName && + providedFirstName == other.providedFirstName && + providedLastName == other.providedLastName && + providedMiddleName == other.providedMiddleName && + additionalProperties == other.additionalProperties + } - /** - * Activity, per inquiry, related to the domestic Issuer for Account Number - * Verification. - */ - @JvmField - val VISA_ACCOUNT_VERIFICATION_DOMESTIC = of("visa_account_verification_domestic") + private val hashCode: Int by lazy { + Objects.hash( + providedFirstName, + providedLastName, + providedMiddleName, + additionalProperties, + ) + } - /** - * Activity, per inquiry, related to the international Issuer for Account Number - * Verification. - */ - @JvmField - val VISA_ACCOUNT_VERIFICATION_INTERNATIONAL = - of("visa_account_verification_international") + override fun hashCode(): Int = hashCode - /** - * Activity, per inquiry, related to the US-Canada Issuer for Account Number - * Verification. - */ - @JvmField - val VISA_ACCOUNT_VERIFICATION_CANADA = of("visa_account_verification_canada") + override fun toString() = + "CardholderName{providedFirstName=$providedFirstName, providedLastName=$providedLastName, providedMiddleName=$providedMiddleName, additionalProperties=$additionalProperties}" + } - /** - * The Corporate Acceptance Fee is charged to issuers and is based on the monthly - * sales volume on Commercial and Government Debit, Prepaid, Credit, Charge, or - * Deferred Debit card transactions. - */ - @JvmField val VISA_CORPORATE_ACCEPTANCE_FEE = of("visa_corporate_acceptance_fee") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * The Consumer Debit Acceptance Fee is charged to issuers and is based on the - * monthly sales volume of Consumer Debit or Prepaid card transactions. The cashback - * portion of a Debit and Prepaid card transaction is excluded from the sales volume - * calculation. - */ - @JvmField - val VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE = of("visa_consumer_debit_acceptance_fee") + return other is Verification && + cardVerificationCode == other.cardVerificationCode && + cardholderAddress == other.cardholderAddress && + cardholderName == other.cardholderName && + additionalProperties == other.additionalProperties + } - /** - * The Business Acceptance Fee is charged to issuers and is based on the monthly - * sales volume on Business Debit, Prepaid, Credit, Charge, or Deferred Debit card - * transactions. The cashback portion is included in the sales volume calculation - * with the exception of a Debit and Prepaid card transactions. - */ - @JvmField - val VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE = of("visa_business_debit_acceptance_fee") + private val hashCode: Int by lazy { + Objects.hash( + cardVerificationCode, + cardholderAddress, + cardholderName, + additionalProperties, + ) + } - /** - * The Purchasing Card Acceptance Fee is charged to issuers and is based on the - * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, Charge, - * or Deferred Debit card transactions. - */ - @JvmField val VISA_PURCHASING_ACCEPTANCE_FEE = of("visa_purchasing_acceptance_fee") + override fun hashCode(): Int = hashCode - /** - * Activity and fees for the processing of a sales draft original for a purchase - * transaction. - */ - @JvmField val VISA_PURCHASE_DOMESTIC = of("visa_purchase_domestic") + override fun toString() = + "Verification{cardVerificationCode=$cardVerificationCode, cardholderAddress=$cardholderAddress, cardholderName=$cardholderName, additionalProperties=$additionalProperties}" + } - /** - * Activity and fees for the processing of an international sales draft original for - * a purchase transaction. - */ - @JvmField val VISA_PURCHASE_INTERNATIONAL = of("visa_purchase_international") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Apple Pay Credit Product Token Purchase Original Transactions. This fee is billed - * by Visa on behalf of Apple Inc. for Apple Pay transactions. - */ - @JvmField val VISA_CREDIT_PURCHASE_TOKEN = of("visa_credit_purchase_token") + return other is CardValidation && + id == other.id && + actioner == other.actioner && + additionalAmounts == other.additionalAmounts && + cardPaymentId == other.cardPaymentId && + currency == other.currency && + digitalWalletTokenId == other.digitalWalletTokenId && + merchantAcceptorId == other.merchantAcceptorId && + merchantCategoryCode == other.merchantCategoryCode && + merchantCity == other.merchantCity && + merchantCountry == other.merchantCountry && + merchantDescriptor == other.merchantDescriptor && + merchantPostalCode == other.merchantPostalCode && + merchantState == other.merchantState && + networkDetails == other.networkDetails && + networkIdentifiers == other.networkIdentifiers && + networkRiskScore == other.networkRiskScore && + physicalCardId == other.physicalCardId && + realTimeDecisionId == other.realTimeDecisionId && + schemeFees == other.schemeFees && + terminalId == other.terminalId && + type == other.type && + verification == other.verification && + additionalProperties == other.additionalProperties + } - /** - * Apple Pay Debit Product Token Purchase Original Transactions. This fee is billed - * by Visa on behalf of Apple Inc. for Apple Pay transactions. - */ - @JvmField val VISA_DEBIT_PURCHASE_TOKEN = of("visa_debit_purchase_token") + private val hashCode: Int by lazy { + Objects.hash( + id, + actioner, + additionalAmounts, + cardPaymentId, + currency, + digitalWalletTokenId, + merchantAcceptorId, + merchantCategoryCode, + merchantCity, + merchantCountry, + merchantDescriptor, + merchantPostalCode, + merchantState, + networkDetails, + networkIdentifiers, + networkRiskScore, + physicalCardId, + realTimeDecisionId, + schemeFees, + terminalId, + type, + verification, + additionalProperties, + ) + } - /** A per transaction fee assessed for Base II financial draft - Issuer. */ - @JvmField val VISA_CLEARING_TRANSMISSION = of("visa_clearing_transmission") + override fun hashCode(): Int = hashCode - /** - * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined Financial - * OCT/AFT 0200 transactions. - */ - @JvmField val VISA_DIRECT_AUTHORIZATION = of("visa_direct_authorization") + override fun toString() = + "CardValidation{id=$id, actioner=$actioner, additionalAmounts=$additionalAmounts, cardPaymentId=$cardPaymentId, currency=$currency, digitalWalletTokenId=$digitalWalletTokenId, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkDetails=$networkDetails, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, physicalCardId=$physicalCardId, realTimeDecisionId=$realTimeDecisionId, schemeFees=$schemeFees, terminalId=$terminalId, type=$type, verification=$verification, additionalProperties=$additionalProperties}" + } - /** - * Data processing charge for Visa Direct OCTs for all business application - * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II - * transactions. - */ - @JvmField - val VISA_DIRECT_TRANSACTION_DOMESTIC = of("visa_direct_transaction_domestic") + /** + * If the category of this Transaction source is equal to `other`, this field will contain + * an empty object, otherwise it will contain null. + */ + class Other + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor(private val additionalProperties: MutableMap) { - /** Issuer card service fee for Commercial Credit cards. */ - @JvmField val VISA_SERVICE_COMMERCIAL_CREDIT = of("visa_service_commercial_credit") + @JsonCreator private constructor() : this(mutableMapOf()) - /** Issuer Advertising Service Fee for Commercial Credit cards. */ - @JvmField - val VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT = - of("visa_advertising_service_commercial_credit") + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - /** Issuer Community Growth Acceleration Program Fee. */ - @JvmField - val VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM = - of("visa_community_growth_acceleration_program") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** Issuer Processing Guarantee for Commercial Credit cards. */ - @JvmField - val VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT = - of("visa_processing_guarantee_commercial_credit") + fun toBuilder() = Builder().from(this) - /** - * Pulse Switch Fee is a fee charged by the Pulse network for processing - * transactions on its network. - */ - @JvmField val PULSE_SWITCH_FEE = of("pulse_switch_fee") + companion object { - @JvmStatic fun of(value: String) = FeeType(JsonField.of(value)) + /** Returns a mutable builder for constructing an instance of [Other]. */ + @JvmStatic fun builder() = Builder() } - /** An enum containing [FeeType]'s known values. */ - enum class Known { - /** - * International Service Assessment (ISA) single-currency is a fee assessed by the - * card network for cross-border transactions presented and settled in the same - * currency. - */ - VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, - /** - * International Service Assessment (ISA) cross-currency is a fee assessed by the - * card network for cross-border transactions presented and settled in different - * currencies. - */ - VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, - /** - * Activity and charges for Visa Settlement System processing for POS - * (Point-Of-Sale) authorization transactions. Authorization is the process of - * approving or declining the transaction amount specified. The fee is assessed to - * the Issuer. - */ - VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, - /** - * Activity and charges for Visa Settlement System processing for POS - * (Point-Of-Sale) International authorization transactions. Authorization is the - * process of approving or declining the transaction amount specified. The fee is - * assessed to the Issuer. - */ - VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, - /** - * Activity and charges for Visa Settlement System processing for Canada Region POS - * (Point-of-Sale) authorization transactions. Authorization is the process of - * approving or declining the transaction amount specified. - */ - VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, - /** - * Activity only for Visa Settlement System authorization processing of POS - * (Point-Of-Sale) reversal transactions. Authorization reversal represents a VSS - * message that undoes the complete or partial actions of a previous authorization - * request. - */ - VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, - /** - * Activity only for Visa Settlement System authorization processing of POS - * (Point-Of-Sale) International reversal transactions. Authorization reversal - * represents a VSS message that undoes the complete or partial actions of a - * previous authorization request. - */ - VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, - /** - * A per Address Verification Service (AVS) result fee. Applies to all usable AVS - * result codes. - */ - VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, - /** - * Advanced Authorization is a fraud detection tool that monitors and risk evaluates - * 100 percent of US VisaNet authorizations in real-time. Activity related to - * Purchase (includes Signature Authenticated Visa and PIN Authenticated Visa Debit - * (PAVD) transactions). - */ - VISA_ADVANCED_AUTHORIZATION, - /** - * Issuer Transactions Visa represents a charge based on total actual monthly - * processing (Visa transactions only) through a VisaNet Access Point (VAP). Charges - * are assessed to the processor for each VisaNet Access Point. - */ - VISA_MESSAGE_TRANSMISSION, - /** - * Activity, per inquiry, related to the domestic Issuer for Account Number - * Verification. - */ - VISA_ACCOUNT_VERIFICATION_DOMESTIC, - /** - * Activity, per inquiry, related to the international Issuer for Account Number - * Verification. - */ - VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, - /** - * Activity, per inquiry, related to the US-Canada Issuer for Account Number - * Verification. - */ - VISA_ACCOUNT_VERIFICATION_CANADA, - /** - * The Corporate Acceptance Fee is charged to issuers and is based on the monthly - * sales volume on Commercial and Government Debit, Prepaid, Credit, Charge, or - * Deferred Debit card transactions. - */ - VISA_CORPORATE_ACCEPTANCE_FEE, - /** - * The Consumer Debit Acceptance Fee is charged to issuers and is based on the - * monthly sales volume of Consumer Debit or Prepaid card transactions. The cashback - * portion of a Debit and Prepaid card transaction is excluded from the sales volume - * calculation. - */ - VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, - /** - * The Business Acceptance Fee is charged to issuers and is based on the monthly - * sales volume on Business Debit, Prepaid, Credit, Charge, or Deferred Debit card - * transactions. The cashback portion is included in the sales volume calculation - * with the exception of a Debit and Prepaid card transactions. - */ - VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, - /** - * The Purchasing Card Acceptance Fee is charged to issuers and is based on the - * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, Charge, - * or Deferred Debit card transactions. - */ - VISA_PURCHASING_ACCEPTANCE_FEE, - /** - * Activity and fees for the processing of a sales draft original for a purchase - * transaction. - */ - VISA_PURCHASE_DOMESTIC, - /** - * Activity and fees for the processing of an international sales draft original for - * a purchase transaction. - */ - VISA_PURCHASE_INTERNATIONAL, - /** - * Apple Pay Credit Product Token Purchase Original Transactions. This fee is billed - * by Visa on behalf of Apple Inc. for Apple Pay transactions. - */ - VISA_CREDIT_PURCHASE_TOKEN, - /** - * Apple Pay Debit Product Token Purchase Original Transactions. This fee is billed - * by Visa on behalf of Apple Inc. for Apple Pay transactions. - */ - VISA_DEBIT_PURCHASE_TOKEN, - /** A per transaction fee assessed for Base II financial draft - Issuer. */ - VISA_CLEARING_TRANSMISSION, - /** - * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined Financial - * OCT/AFT 0200 transactions. - */ - VISA_DIRECT_AUTHORIZATION, - /** - * Data processing charge for Visa Direct OCTs for all business application - * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II - * transactions. - */ - VISA_DIRECT_TRANSACTION_DOMESTIC, - /** Issuer card service fee for Commercial Credit cards. */ - VISA_SERVICE_COMMERCIAL_CREDIT, - /** Issuer Advertising Service Fee for Commercial Credit cards. */ - VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, - /** Issuer Community Growth Acceleration Program Fee. */ - VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, - /** Issuer Processing Guarantee for Commercial Credit cards. */ - VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, - /** - * Pulse Switch Fee is a fee charged by the Pulse network for processing - * transactions on its network. - */ - PULSE_SWITCH_FEE, - } + /** A builder for [Other]. */ + class Builder internal constructor() { - /** - * An enum containing [FeeType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [FeeType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** - * International Service Assessment (ISA) single-currency is a fee assessed by the - * card network for cross-border transactions presented and settled in the same - * currency. - */ - VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, - /** - * International Service Assessment (ISA) cross-currency is a fee assessed by the - * card network for cross-border transactions presented and settled in different - * currencies. - */ - VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, - /** - * Activity and charges for Visa Settlement System processing for POS - * (Point-Of-Sale) authorization transactions. Authorization is the process of - * approving or declining the transaction amount specified. The fee is assessed to - * the Issuer. - */ - VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, - /** - * Activity and charges for Visa Settlement System processing for POS - * (Point-Of-Sale) International authorization transactions. Authorization is the - * process of approving or declining the transaction amount specified. The fee is - * assessed to the Issuer. - */ - VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, - /** - * Activity and charges for Visa Settlement System processing for Canada Region POS - * (Point-of-Sale) authorization transactions. Authorization is the process of - * approving or declining the transaction amount specified. - */ - VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, - /** - * Activity only for Visa Settlement System authorization processing of POS - * (Point-Of-Sale) reversal transactions. Authorization reversal represents a VSS - * message that undoes the complete or partial actions of a previous authorization - * request. - */ - VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, - /** - * Activity only for Visa Settlement System authorization processing of POS - * (Point-Of-Sale) International reversal transactions. Authorization reversal - * represents a VSS message that undoes the complete or partial actions of a - * previous authorization request. - */ - VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, - /** - * A per Address Verification Service (AVS) result fee. Applies to all usable AVS - * result codes. - */ - VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, - /** - * Advanced Authorization is a fraud detection tool that monitors and risk evaluates - * 100 percent of US VisaNet authorizations in real-time. Activity related to - * Purchase (includes Signature Authenticated Visa and PIN Authenticated Visa Debit - * (PAVD) transactions). - */ - VISA_ADVANCED_AUTHORIZATION, - /** - * Issuer Transactions Visa represents a charge based on total actual monthly - * processing (Visa transactions only) through a VisaNet Access Point (VAP). Charges - * are assessed to the processor for each VisaNet Access Point. - */ - VISA_MESSAGE_TRANSMISSION, - /** - * Activity, per inquiry, related to the domestic Issuer for Account Number - * Verification. - */ - VISA_ACCOUNT_VERIFICATION_DOMESTIC, - /** - * Activity, per inquiry, related to the international Issuer for Account Number - * Verification. - */ - VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, - /** - * Activity, per inquiry, related to the US-Canada Issuer for Account Number - * Verification. - */ - VISA_ACCOUNT_VERIFICATION_CANADA, - /** - * The Corporate Acceptance Fee is charged to issuers and is based on the monthly - * sales volume on Commercial and Government Debit, Prepaid, Credit, Charge, or - * Deferred Debit card transactions. - */ - VISA_CORPORATE_ACCEPTANCE_FEE, - /** - * The Consumer Debit Acceptance Fee is charged to issuers and is based on the - * monthly sales volume of Consumer Debit or Prepaid card transactions. The cashback - * portion of a Debit and Prepaid card transaction is excluded from the sales volume - * calculation. - */ - VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, - /** - * The Business Acceptance Fee is charged to issuers and is based on the monthly - * sales volume on Business Debit, Prepaid, Credit, Charge, or Deferred Debit card - * transactions. The cashback portion is included in the sales volume calculation - * with the exception of a Debit and Prepaid card transactions. - */ - VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, - /** - * The Purchasing Card Acceptance Fee is charged to issuers and is based on the - * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, Charge, - * or Deferred Debit card transactions. - */ - VISA_PURCHASING_ACCEPTANCE_FEE, - /** - * Activity and fees for the processing of a sales draft original for a purchase - * transaction. - */ - VISA_PURCHASE_DOMESTIC, - /** - * Activity and fees for the processing of an international sales draft original for - * a purchase transaction. - */ - VISA_PURCHASE_INTERNATIONAL, - /** - * Apple Pay Credit Product Token Purchase Original Transactions. This fee is billed - * by Visa on behalf of Apple Inc. for Apple Pay transactions. - */ - VISA_CREDIT_PURCHASE_TOKEN, - /** - * Apple Pay Debit Product Token Purchase Original Transactions. This fee is billed - * by Visa on behalf of Apple Inc. for Apple Pay transactions. - */ - VISA_DEBIT_PURCHASE_TOKEN, - /** A per transaction fee assessed for Base II financial draft - Issuer. */ - VISA_CLEARING_TRANSMISSION, - /** - * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined Financial - * OCT/AFT 0200 transactions. - */ - VISA_DIRECT_AUTHORIZATION, - /** - * Data processing charge for Visa Direct OCTs for all business application - * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II - * transactions. - */ - VISA_DIRECT_TRANSACTION_DOMESTIC, - /** Issuer card service fee for Commercial Credit cards. */ - VISA_SERVICE_COMMERCIAL_CREDIT, - /** Issuer Advertising Service Fee for Commercial Credit cards. */ - VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, - /** Issuer Community Growth Acceleration Program Fee. */ - VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, - /** Issuer Processing Guarantee for Commercial Credit cards. */ - VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, - /** - * Pulse Switch Fee is a fee charged by the Pulse network for processing - * transactions on its network. - */ - PULSE_SWITCH_FEE, - /** - * An enum member indicating that [FeeType] was instantiated with an unknown value. - */ - _UNKNOWN, - } + private var additionalProperties: MutableMap = mutableMapOf() - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> - Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY - VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> - Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY - VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> - Value.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE - VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> - Value.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE - VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> - Value.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE - VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> - Value.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE - VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> - Value.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE - VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> - Value.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE - VISA_ADVANCED_AUTHORIZATION -> Value.VISA_ADVANCED_AUTHORIZATION - VISA_MESSAGE_TRANSMISSION -> Value.VISA_MESSAGE_TRANSMISSION - VISA_ACCOUNT_VERIFICATION_DOMESTIC -> Value.VISA_ACCOUNT_VERIFICATION_DOMESTIC - VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> - Value.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL - VISA_ACCOUNT_VERIFICATION_CANADA -> Value.VISA_ACCOUNT_VERIFICATION_CANADA - VISA_CORPORATE_ACCEPTANCE_FEE -> Value.VISA_CORPORATE_ACCEPTANCE_FEE - VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> Value.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE - VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> Value.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE - VISA_PURCHASING_ACCEPTANCE_FEE -> Value.VISA_PURCHASING_ACCEPTANCE_FEE - VISA_PURCHASE_DOMESTIC -> Value.VISA_PURCHASE_DOMESTIC - VISA_PURCHASE_INTERNATIONAL -> Value.VISA_PURCHASE_INTERNATIONAL - VISA_CREDIT_PURCHASE_TOKEN -> Value.VISA_CREDIT_PURCHASE_TOKEN - VISA_DEBIT_PURCHASE_TOKEN -> Value.VISA_DEBIT_PURCHASE_TOKEN - VISA_CLEARING_TRANSMISSION -> Value.VISA_CLEARING_TRANSMISSION - VISA_DIRECT_AUTHORIZATION -> Value.VISA_DIRECT_AUTHORIZATION - VISA_DIRECT_TRANSACTION_DOMESTIC -> Value.VISA_DIRECT_TRANSACTION_DOMESTIC - VISA_SERVICE_COMMERCIAL_CREDIT -> Value.VISA_SERVICE_COMMERCIAL_CREDIT - VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> - Value.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT - VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> - Value.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM - VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> - Value.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT - PULSE_SWITCH_FEE -> Value.PULSE_SWITCH_FEE - else -> Value._UNKNOWN + @JvmSynthetic + internal fun from(other: Other) = apply { + additionalProperties = other.additionalProperties.toMutableMap() } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> - Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY - VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> - Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY - VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> - Known.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE - VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> - Known.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE - VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> - Known.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE - VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> - Known.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE - VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> - Known.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE - VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> - Known.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE - VISA_ADVANCED_AUTHORIZATION -> Known.VISA_ADVANCED_AUTHORIZATION - VISA_MESSAGE_TRANSMISSION -> Known.VISA_MESSAGE_TRANSMISSION - VISA_ACCOUNT_VERIFICATION_DOMESTIC -> Known.VISA_ACCOUNT_VERIFICATION_DOMESTIC - VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> - Known.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL - VISA_ACCOUNT_VERIFICATION_CANADA -> Known.VISA_ACCOUNT_VERIFICATION_CANADA - VISA_CORPORATE_ACCEPTANCE_FEE -> Known.VISA_CORPORATE_ACCEPTANCE_FEE - VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> Known.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE - VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> Known.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE - VISA_PURCHASING_ACCEPTANCE_FEE -> Known.VISA_PURCHASING_ACCEPTANCE_FEE - VISA_PURCHASE_DOMESTIC -> Known.VISA_PURCHASE_DOMESTIC - VISA_PURCHASE_INTERNATIONAL -> Known.VISA_PURCHASE_INTERNATIONAL - VISA_CREDIT_PURCHASE_TOKEN -> Known.VISA_CREDIT_PURCHASE_TOKEN - VISA_DEBIT_PURCHASE_TOKEN -> Known.VISA_DEBIT_PURCHASE_TOKEN - VISA_CLEARING_TRANSMISSION -> Known.VISA_CLEARING_TRANSMISSION - VISA_DIRECT_AUTHORIZATION -> Known.VISA_DIRECT_AUTHORIZATION - VISA_DIRECT_TRANSACTION_DOMESTIC -> Known.VISA_DIRECT_TRANSACTION_DOMESTIC - VISA_SERVICE_COMMERCIAL_CREDIT -> Known.VISA_SERVICE_COMMERCIAL_CREDIT - VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> - Known.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT - VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> - Known.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM - VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> - Known.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT - PULSE_SWITCH_FEE -> Known.PULSE_SWITCH_FEE - else -> throw IncreaseInvalidDataException("Unknown FeeType: $value") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Other]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Other = Other(additionalProperties.toMutableMap()) + } + private var validated: Boolean = false - fun validate(): FeeType = apply { + fun validate(): Other = apply { if (validated) { return@apply } - known() validated = true } @@ -83491,19 +95911,21 @@ private constructor( * * Used for best match union deserialization. */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + @JvmSynthetic internal fun validity(): Int = 0 override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is FeeType && value == other.value + return other is Other && additionalProperties == other.additionalProperties } - override fun hashCode() = value.hashCode() + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - override fun toString() = value.toString() + override fun hashCode(): Int = hashCode + + override fun toString() = "Other{additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -83511,24 +95933,42 @@ private constructor( return true } - return other is SchemeFee && - amount == other.amount && + return other is Element && + category == other.category && createdAt == other.createdAt && - currency == other.currency && - feeType == other.feeType && - fixedComponent == other.fixedComponent && - variableRate == other.variableRate && + cardAuthentication == other.cardAuthentication && + cardAuthorization == other.cardAuthorization && + cardAuthorizationExpiration == other.cardAuthorizationExpiration && + cardBalanceInquiry == other.cardBalanceInquiry && + cardDecline == other.cardDecline && + cardFinancial == other.cardFinancial && + cardFuelConfirmation == other.cardFuelConfirmation && + cardIncrement == other.cardIncrement && + cardRefund == other.cardRefund && + cardReversal == other.cardReversal && + cardSettlement == other.cardSettlement && + cardValidation == other.cardValidation && + this.other == other.other && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { Objects.hash( - amount, + category, createdAt, - currency, - feeType, - fixedComponent, - variableRate, + cardAuthentication, + cardAuthorization, + cardAuthorizationExpiration, + cardBalanceInquiry, + cardDecline, + cardFinancial, + cardFuelConfirmation, + cardIncrement, + cardRefund, + cardReversal, + cardSettlement, + cardValidation, + other, additionalProperties, ) } @@ -83536,7 +95976,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "SchemeFee{amount=$amount, createdAt=$createdAt, currency=$currency, feeType=$feeType, fixedComponent=$fixedComponent, variableRate=$variableRate, additionalProperties=$additionalProperties}" + "Element{category=$category, createdAt=$createdAt, cardAuthentication=$cardAuthentication, cardAuthorization=$cardAuthorization, cardAuthorizationExpiration=$cardAuthorizationExpiration, cardBalanceInquiry=$cardBalanceInquiry, cardDecline=$cardDecline, cardFinancial=$cardFinancial, cardFuelConfirmation=$cardFuelConfirmation, cardIncrement=$cardIncrement, cardRefund=$cardRefund, cardReversal=$cardReversal, cardSettlement=$cardSettlement, cardValidation=$cardValidation, other=$other, additionalProperties=$additionalProperties}" } /** The summarized state of this card payment. */ @@ -84163,7 +96603,6 @@ private constructor( digitalWalletTokenId == other.digitalWalletTokenId && elements == other.elements && physicalCardId == other.physicalCardId && - schemeFees == other.schemeFees && state == other.state && type == other.type && additionalProperties == other.additionalProperties @@ -84178,7 +96617,6 @@ private constructor( digitalWalletTokenId, elements, physicalCardId, - schemeFees, state, type, additionalProperties, @@ -84188,5 +96626,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CardPayment{id=$id, accountId=$accountId, cardId=$cardId, createdAt=$createdAt, digitalWalletTokenId=$digitalWalletTokenId, elements=$elements, physicalCardId=$physicalCardId, schemeFees=$schemeFees, state=$state, type=$type, additionalProperties=$additionalProperties}" + "CardPayment{id=$id, accountId=$accountId, cardId=$cardId, createdAt=$createdAt, digitalWalletTokenId=$digitalWalletTokenId, elements=$elements, physicalCardId=$physicalCardId, state=$state, type=$type, additionalProperties=$additionalProperties}" } diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/declinedtransactions/DeclinedTransaction.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/declinedtransactions/DeclinedTransaction.kt index 03214e6af..aac3f9bf3 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/declinedtransactions/DeclinedTransaction.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/declinedtransactions/DeclinedTransaction.kt @@ -11,7 +11,9 @@ import com.increase.api.core.ExcludeMissing import com.increase.api.core.JsonField import com.increase.api.core.JsonMissing import com.increase.api.core.JsonValue +import com.increase.api.core.checkKnown import com.increase.api.core.checkRequired +import com.increase.api.core.toImmutable import com.increase.api.errors.IncreaseInvalidDataException import java.time.OffsetDateTime import java.util.Collections @@ -2843,6 +2845,7 @@ private constructor( private val realTimeDecisionId: JsonField, private val realTimeDecisionReason: JsonField, private val reason: JsonField, + private val schemeFees: JsonField>, private val terminalId: JsonField, private val verification: JsonField, private val additionalProperties: MutableMap, @@ -2927,6 +2930,9 @@ private constructor( @JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(), + @JsonProperty("scheme_fees") + @ExcludeMissing + schemeFees: JsonField> = JsonMissing.of(), @JsonProperty("terminal_id") @ExcludeMissing terminalId: JsonField = JsonMissing.of(), @@ -2961,6 +2967,7 @@ private constructor( realTimeDecisionId, realTimeDecisionReason, reason, + schemeFees, terminalId, verification, mutableMapOf(), @@ -3229,6 +3236,15 @@ private constructor( */ fun reason(): Reason = reason.getRequired("reason") + /** + * The scheme fees associated with this card decline. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun schemeFees(): List = schemeFees.getRequired("scheme_fees") + /** * The terminal identifier (commonly abbreviated as TID) of the terminal the card is * transacting with. @@ -3510,6 +3526,16 @@ private constructor( */ @JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason + /** + * Returns the raw JSON value of [schemeFees]. + * + * Unlike [schemeFees], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("scheme_fees") + @ExcludeMissing + fun _schemeFees(): JsonField> = schemeFees + /** * Returns the raw JSON value of [terminalId]. * @@ -3576,6 +3602,7 @@ private constructor( * .realTimeDecisionId() * .realTimeDecisionReason() * .reason() + * .schemeFees() * .terminalId() * .verification() * ``` @@ -3613,6 +3640,7 @@ private constructor( private var realTimeDecisionId: JsonField? = null private var realTimeDecisionReason: JsonField? = null private var reason: JsonField? = null + private var schemeFees: JsonField>? = null private var terminalId: JsonField? = null private var verification: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -3646,6 +3674,7 @@ private constructor( realTimeDecisionId = cardDecline.realTimeDecisionId realTimeDecisionReason = cardDecline.realTimeDecisionReason reason = cardDecline.reason + schemeFees = cardDecline.schemeFees.map { it.toMutableList() } terminalId = cardDecline.terminalId verification = cardDecline.verification additionalProperties = cardDecline.additionalProperties.toMutableMap() @@ -4159,6 +4188,32 @@ private constructor( */ fun reason(reason: JsonField) = apply { this.reason = reason } + /** The scheme fees associated with this card decline. */ + fun schemeFees(schemeFees: List) = schemeFees(JsonField.of(schemeFees)) + + /** + * Sets [Builder.schemeFees] to an arbitrary JSON value. + * + * You should usually call [Builder.schemeFees] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun schemeFees(schemeFees: JsonField>) = apply { + this.schemeFees = schemeFees.map { it.toMutableList() } + } + + /** + * Adds a single [SchemeFee] to [schemeFees]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addSchemeFee(schemeFee: SchemeFee) = apply { + schemeFees = + (schemeFees ?: JsonField.of(mutableListOf())).also { + checkKnown("schemeFees", it).add(schemeFee) + } + } + /** * The terminal identifier (commonly abbreviated as TID) of the terminal the card is * transacting with. @@ -4250,6 +4305,7 @@ private constructor( * .realTimeDecisionId() * .realTimeDecisionReason() * .reason() + * .schemeFees() * .terminalId() * .verification() * ``` @@ -4288,6 +4344,7 @@ private constructor( checkRequired("realTimeDecisionId", realTimeDecisionId), checkRequired("realTimeDecisionReason", realTimeDecisionReason), checkRequired("reason", reason), + checkRequired("schemeFees", schemeFees).map { it.toImmutable() }, checkRequired("terminalId", terminalId), checkRequired("verification", verification), additionalProperties.toMutableMap(), @@ -4328,6 +4385,7 @@ private constructor( realTimeDecisionId() realTimeDecisionReason().ifPresent { it.validate() } reason().validate() + schemeFees().forEach { it.validate() } terminalId() verification().validate() validated = true @@ -4376,6 +4434,7 @@ private constructor( (if (realTimeDecisionId.asKnown().isPresent) 1 else 0) + (realTimeDecisionReason.asKnown().getOrNull()?.validity() ?: 0) + (reason.asKnown().getOrNull()?.validity() ?: 0) + + (schemeFees.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (terminalId.asKnown().isPresent) 1 else 0) + (verification.asKnown().getOrNull()?.validity() ?: 0) @@ -10965,6 +11024,1321 @@ private constructor( override fun toString() = value.toString() } + class SchemeFee + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val amount: JsonField, + private val createdAt: JsonField, + private val currency: JsonField, + private val feeType: JsonField, + private val fixedComponent: JsonField, + private val variableRate: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + createdAt: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("fee_type") + @ExcludeMissing + feeType: JsonField = JsonMissing.of(), + @JsonProperty("fixed_component") + @ExcludeMissing + fixedComponent: JsonField = JsonMissing.of(), + @JsonProperty("variable_rate") + @ExcludeMissing + variableRate: JsonField = JsonMissing.of(), + ) : this( + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, + mutableMapOf(), + ) + + /** + * The fee amount given as a string containing a decimal number. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun amount(): String = amount.getRequired("amount") + + /** + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + * created. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun currency(): Currency = currency.getRequired("currency") + + /** + * The type of fee being assessed. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun feeType(): FeeType = feeType.getRequired("fee_type") + + /** + * The fixed component of the fee, if applicable, given in major units of the fee + * amount. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun fixedComponent(): Optional = + fixedComponent.getOptional("fixed_component") + + /** + * The variable rate component of the fee, if applicable, given as a decimal (e.g., + * 0.015 for 1.5%). + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun variableRate(): Optional = variableRate.getOptional("variable_rate") + + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + + /** + * Returns the raw JSON value of [createdAt]. + * + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("created_at") + @ExcludeMissing + fun _createdAt(): JsonField = createdAt + + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("currency") + @ExcludeMissing + fun _currency(): JsonField = currency + + /** + * Returns the raw JSON value of [feeType]. + * + * Unlike [feeType], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("fee_type") + @ExcludeMissing + fun _feeType(): JsonField = feeType + + /** + * Returns the raw JSON value of [fixedComponent]. + * + * Unlike [fixedComponent], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("fixed_component") + @ExcludeMissing + fun _fixedComponent(): JsonField = fixedComponent + + /** + * Returns the raw JSON value of [variableRate]. + * + * Unlike [variableRate], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("variable_rate") + @ExcludeMissing + fun _variableRate(): JsonField = variableRate + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [SchemeFee]. + * + * The following fields are required: + * ```java + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SchemeFee]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var createdAt: JsonField? = null + private var currency: JsonField? = null + private var feeType: JsonField? = null + private var fixedComponent: JsonField? = null + private var variableRate: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(schemeFee: SchemeFee) = apply { + amount = schemeFee.amount + createdAt = schemeFee.createdAt + currency = schemeFee.currency + feeType = schemeFee.feeType + fixedComponent = schemeFee.fixedComponent + variableRate = schemeFee.variableRate + additionalProperties = schemeFee.additionalProperties.toMutableMap() + } + + /** The fee amount given as a string containing a decimal number. */ + fun amount(amount: String) = amount(JsonField.of(amount)) + + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun amount(amount: JsonField) = apply { this.amount = amount } + + /** + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee + * was created. + */ + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + /** + * Sets [Builder.createdAt] to an arbitrary JSON value. + * + * You should usually call [Builder.createdAt] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt + } + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + */ + fun currency(currency: Currency) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [Currency] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } + + /** The type of fee being assessed. */ + fun feeType(feeType: FeeType) = feeType(JsonField.of(feeType)) + + /** + * Sets [Builder.feeType] to an arbitrary JSON value. + * + * You should usually call [Builder.feeType] with a well-typed [FeeType] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun feeType(feeType: JsonField) = apply { this.feeType = feeType } + + /** + * The fixed component of the fee, if applicable, given in major units of the + * fee amount. + */ + fun fixedComponent(fixedComponent: String?) = + fixedComponent(JsonField.ofNullable(fixedComponent)) + + /** + * Alias for calling [Builder.fixedComponent] with + * `fixedComponent.orElse(null)`. + */ + fun fixedComponent(fixedComponent: Optional) = + fixedComponent(fixedComponent.getOrNull()) + + /** + * Sets [Builder.fixedComponent] to an arbitrary JSON value. + * + * You should usually call [Builder.fixedComponent] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun fixedComponent(fixedComponent: JsonField) = apply { + this.fixedComponent = fixedComponent + } + + /** + * The variable rate component of the fee, if applicable, given as a decimal + * (e.g., 0.015 for 1.5%). + */ + fun variableRate(variableRate: String?) = + variableRate(JsonField.ofNullable(variableRate)) + + /** + * Alias for calling [Builder.variableRate] with `variableRate.orElse(null)`. + */ + fun variableRate(variableRate: Optional) = + variableRate(variableRate.getOrNull()) + + /** + * Sets [Builder.variableRate] to an arbitrary JSON value. + * + * You should usually call [Builder.variableRate] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun variableRate(variableRate: JsonField) = apply { + this.variableRate = variableRate + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [SchemeFee]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SchemeFee = + SchemeFee( + checkRequired("amount", amount), + checkRequired("createdAt", createdAt), + checkRequired("currency", currency), + checkRequired("feeType", feeType), + checkRequired("fixedComponent", fixedComponent), + checkRequired("variableRate", variableRate), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): SchemeFee = apply { + if (validated) { + return@apply + } + + amount() + createdAt() + currency().validate() + feeType().validate() + fixedComponent() + variableRate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (currency.asKnown().getOrNull()?.validity() ?: 0) + + (feeType.asKnown().getOrNull()?.validity() ?: 0) + + (if (fixedComponent.asKnown().isPresent) 1 else 0) + + (if (variableRate.asKnown().isPresent) 1 else 0) + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + */ + class Currency + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** US Dollar (USD) */ + @JvmField val USD = of("USD") + + @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) + } + + /** An enum containing [Currency]'s known values. */ + enum class Known { + /** US Dollar (USD) */ + USD + } + + /** + * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Currency] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** US Dollar (USD) */ + USD, + /** + * An enum member indicating that [Currency] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + USD -> Value.USD + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + USD -> Known.USD + else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Currency = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Currency && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** The type of fee being assessed. */ + class FeeType + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY = + of("visa_international_service_assessment_single_currency") + + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY = + of("visa_international_service_assessment_cross_currency") + + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + @JvmField + val VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE = + of("visa_authorization_domestic_point_of_sale") + + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + @JvmField + val VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_international_point_of_sale") + + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + @JvmField + val VISA_AUTHORIZATION_CANADA_POINT_OF_SALE = + of("visa_authorization_canada_point_of_sale") + + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + @JvmField + val VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE = + of("visa_authorization_reversal_point_of_sale") + + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + @JvmField + val VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_reversal_international_point_of_sale") + + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + @JvmField + val VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE = + of("visa_authorization_address_verification_service") + + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + @JvmField + val VISA_ADVANCED_AUTHORIZATION = of("visa_advanced_authorization") + + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + @JvmField val VISA_MESSAGE_TRANSMISSION = of("visa_message_transmission") + + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_DOMESTIC = + of("visa_account_verification_domestic") + + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_INTERNATIONAL = + of("visa_account_verification_international") + + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_CANADA = + of("visa_account_verification_canada") + + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + @JvmField + val VISA_CORPORATE_ACCEPTANCE_FEE = of("visa_corporate_acceptance_fee") + + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + @JvmField + val VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE = + of("visa_consumer_debit_acceptance_fee") + + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + @JvmField + val VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE = + of("visa_business_debit_acceptance_fee") + + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + @JvmField + val VISA_PURCHASING_ACCEPTANCE_FEE = of("visa_purchasing_acceptance_fee") + + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + @JvmField val VISA_PURCHASE_DOMESTIC = of("visa_purchase_domestic") + + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + @JvmField + val VISA_PURCHASE_INTERNATIONAL = of("visa_purchase_international") + + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_CREDIT_PURCHASE_TOKEN = of("visa_credit_purchase_token") + + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_DEBIT_PURCHASE_TOKEN = of("visa_debit_purchase_token") + + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + @JvmField val VISA_CLEARING_TRANSMISSION = of("visa_clearing_transmission") + + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + @JvmField val VISA_DIRECT_AUTHORIZATION = of("visa_direct_authorization") + + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + @JvmField + val VISA_DIRECT_TRANSACTION_DOMESTIC = + of("visa_direct_transaction_domestic") + + /** Issuer card service fee for Commercial Credit cards. */ + @JvmField + val VISA_SERVICE_COMMERCIAL_CREDIT = of("visa_service_commercial_credit") + + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + @JvmField + val VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT = + of("visa_advertising_service_commercial_credit") + + /** Issuer Community Growth Acceleration Program Fee. */ + @JvmField + val VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM = + of("visa_community_growth_acceleration_program") + + /** Issuer Processing Guarantee for Commercial Credit cards. */ + @JvmField + val VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT = + of("visa_processing_guarantee_commercial_credit") + + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + @JvmField val PULSE_SWITCH_FEE = of("pulse_switch_fee") + + @JvmStatic fun of(value: String) = FeeType(JsonField.of(value)) + } + + /** An enum containing [FeeType]'s known values. */ + enum class Known { + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + VISA_ADVANCED_AUTHORIZATION, + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + VISA_MESSAGE_TRANSMISSION, + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_DOMESTIC, + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, + } + + /** + * An enum containing [FeeType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [FeeType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + VISA_ADVANCED_AUTHORIZATION, + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + VISA_MESSAGE_TRANSMISSION, + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_DOMESTIC, + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, + /** + * An enum member indicating that [FeeType] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Value.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Value.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Value.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Value.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Value.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Value.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Value.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Value.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Value.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Value.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Value.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Value.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Value.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Value.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Value.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Value.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Value.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Value.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Value.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Value.PULSE_SWITCH_FEE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Known.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Known.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Known.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Known.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Known.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Known.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Known.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Known.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Known.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Known.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Known.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Known.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Known.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Known.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Known.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Known.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Known.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Known.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Known.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Known.PULSE_SWITCH_FEE + else -> throw IncreaseInvalidDataException("Unknown FeeType: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): FeeType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is FeeType && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SchemeFee && + amount == other.amount && + createdAt == other.createdAt && + currency == other.currency && + feeType == other.feeType && + fixedComponent == other.fixedComponent && + variableRate == other.variableRate && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "SchemeFee{amount=$amount, createdAt=$createdAt, currency=$currency, feeType=$feeType, fixedComponent=$fixedComponent, variableRate=$variableRate, additionalProperties=$additionalProperties}" + } + /** Fields related to verification of cardholder-provided values. */ class Verification @JsonCreator(mode = JsonCreator.Mode.DISABLED) @@ -12555,6 +13929,7 @@ private constructor( realTimeDecisionId == other.realTimeDecisionId && realTimeDecisionReason == other.realTimeDecisionReason && reason == other.reason && + schemeFees == other.schemeFees && terminalId == other.terminalId && verification == other.verification && additionalProperties == other.additionalProperties @@ -12589,6 +13964,7 @@ private constructor( realTimeDecisionId, realTimeDecisionReason, reason, + schemeFees, terminalId, verification, additionalProperties, @@ -12598,7 +13974,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CardDecline{id=$id, actioner=$actioner, additionalAmounts=$additionalAmounts, amount=$amount, cardPaymentId=$cardPaymentId, currency=$currency, declinedTransactionId=$declinedTransactionId, digitalWalletTokenId=$digitalWalletTokenId, direction=$direction, incrementedCardAuthorizationId=$incrementedCardAuthorizationId, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkDetails=$networkDetails, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, physicalCardId=$physicalCardId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, processingCategory=$processingCategory, realTimeDecisionId=$realTimeDecisionId, realTimeDecisionReason=$realTimeDecisionReason, reason=$reason, terminalId=$terminalId, verification=$verification, additionalProperties=$additionalProperties}" + "CardDecline{id=$id, actioner=$actioner, additionalAmounts=$additionalAmounts, amount=$amount, cardPaymentId=$cardPaymentId, currency=$currency, declinedTransactionId=$declinedTransactionId, digitalWalletTokenId=$digitalWalletTokenId, direction=$direction, incrementedCardAuthorizationId=$incrementedCardAuthorizationId, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkDetails=$networkDetails, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, physicalCardId=$physicalCardId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, processingCategory=$processingCategory, realTimeDecisionId=$realTimeDecisionId, realTimeDecisionReason=$realTimeDecisionReason, reason=$reason, schemeFees=$schemeFees, terminalId=$terminalId, verification=$verification, additionalProperties=$additionalProperties}" } /** diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/pendingtransactions/PendingTransaction.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/pendingtransactions/PendingTransaction.kt index 16931dc8d..bf0621dbf 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/pendingtransactions/PendingTransaction.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/pendingtransactions/PendingTransaction.kt @@ -11,6 +11,7 @@ import com.increase.api.core.ExcludeMissing import com.increase.api.core.JsonField import com.increase.api.core.JsonMissing import com.increase.api.core.JsonValue +import com.increase.api.core.checkKnown import com.increase.api.core.checkRequired import com.increase.api.core.toImmutable import com.increase.api.errors.IncreaseInvalidDataException @@ -3596,6 +3597,7 @@ private constructor( private val presentmentCurrency: JsonField, private val processingCategory: JsonField, private val realTimeDecisionId: JsonField, + private val schemeFees: JsonField>, private val terminalId: JsonField, private val type: JsonField, private val verification: JsonField, @@ -3675,6 +3677,9 @@ private constructor( @JsonProperty("real_time_decision_id") @ExcludeMissing realTimeDecisionId: JsonField = JsonMissing.of(), + @JsonProperty("scheme_fees") + @ExcludeMissing + schemeFees: JsonField> = JsonMissing.of(), @JsonProperty("terminal_id") @ExcludeMissing terminalId: JsonField = JsonMissing.of(), @@ -3708,6 +3713,7 @@ private constructor( presentmentCurrency, processingCategory, realTimeDecisionId, + schemeFees, terminalId, type, verification, @@ -3958,6 +3964,15 @@ private constructor( fun realTimeDecisionId(): Optional = realTimeDecisionId.getOptional("real_time_decision_id") + /** + * The scheme fees associated with this card authorization. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun schemeFees(): List = schemeFees.getRequired("scheme_fees") + /** * The terminal identifier (commonly abbreviated as TID) of the terminal the card is * transacting with. @@ -4230,6 +4245,16 @@ private constructor( @ExcludeMissing fun _realTimeDecisionId(): JsonField = realTimeDecisionId + /** + * Returns the raw JSON value of [schemeFees]. + * + * Unlike [schemeFees], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("scheme_fees") + @ExcludeMissing + fun _schemeFees(): JsonField> = schemeFees + /** * Returns the raw JSON value of [terminalId]. * @@ -4301,6 +4326,7 @@ private constructor( * .presentmentCurrency() * .processingCategory() * .realTimeDecisionId() + * .schemeFees() * .terminalId() * .type() * .verification() @@ -4337,6 +4363,7 @@ private constructor( private var presentmentCurrency: JsonField? = null private var processingCategory: JsonField? = null private var realTimeDecisionId: JsonField? = null + private var schemeFees: JsonField>? = null private var terminalId: JsonField? = null private var type: JsonField? = null private var verification: JsonField? = null @@ -4369,6 +4396,7 @@ private constructor( presentmentCurrency = cardAuthorization.presentmentCurrency processingCategory = cardAuthorization.processingCategory realTimeDecisionId = cardAuthorization.realTimeDecisionId + schemeFees = cardAuthorization.schemeFees.map { it.toMutableList() } terminalId = cardAuthorization.terminalId type = cardAuthorization.type verification = cardAuthorization.verification @@ -4842,6 +4870,32 @@ private constructor( this.realTimeDecisionId = realTimeDecisionId } + /** The scheme fees associated with this card authorization. */ + fun schemeFees(schemeFees: List) = schemeFees(JsonField.of(schemeFees)) + + /** + * Sets [Builder.schemeFees] to an arbitrary JSON value. + * + * You should usually call [Builder.schemeFees] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun schemeFees(schemeFees: JsonField>) = apply { + this.schemeFees = schemeFees.map { it.toMutableList() } + } + + /** + * Adds a single [SchemeFee] to [schemeFees]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addSchemeFee(schemeFee: SchemeFee) = apply { + schemeFees = + (schemeFees ?: JsonField.of(mutableListOf())).also { + checkKnown("schemeFees", it).add(schemeFee) + } + } + /** * The terminal identifier (commonly abbreviated as TID) of the terminal the card is * transacting with. @@ -4946,6 +5000,7 @@ private constructor( * .presentmentCurrency() * .processingCategory() * .realTimeDecisionId() + * .schemeFees() * .terminalId() * .type() * .verification() @@ -4980,6 +5035,7 @@ private constructor( checkRequired("presentmentCurrency", presentmentCurrency), checkRequired("processingCategory", processingCategory), checkRequired("realTimeDecisionId", realTimeDecisionId), + checkRequired("schemeFees", schemeFees).map { it.toImmutable() }, checkRequired("terminalId", terminalId), checkRequired("type", type), checkRequired("verification", verification), @@ -5019,6 +5075,7 @@ private constructor( presentmentCurrency() processingCategory().validate() realTimeDecisionId() + schemeFees().forEach { it.validate() } terminalId() type().validate() verification().validate() @@ -5066,6 +5123,7 @@ private constructor( (if (presentmentCurrency.asKnown().isPresent) 1 else 0) + (processingCategory.asKnown().getOrNull()?.validity() ?: 0) + (if (realTimeDecisionId.asKnown().isPresent) 1 else 0) + + (schemeFees.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (terminalId.asKnown().isPresent) 1 else 0) + (type.asKnown().getOrNull()?.validity() ?: 0) + (verification.asKnown().getOrNull()?.validity() ?: 0) @@ -11066,6 +11124,1321 @@ private constructor( override fun toString() = value.toString() } + class SchemeFee + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val amount: JsonField, + private val createdAt: JsonField, + private val currency: JsonField, + private val feeType: JsonField, + private val fixedComponent: JsonField, + private val variableRate: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + createdAt: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("fee_type") + @ExcludeMissing + feeType: JsonField = JsonMissing.of(), + @JsonProperty("fixed_component") + @ExcludeMissing + fixedComponent: JsonField = JsonMissing.of(), + @JsonProperty("variable_rate") + @ExcludeMissing + variableRate: JsonField = JsonMissing.of(), + ) : this( + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, + mutableMapOf(), + ) + + /** + * The fee amount given as a string containing a decimal number. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun amount(): String = amount.getRequired("amount") + + /** + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + * created. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun currency(): Currency = currency.getRequired("currency") + + /** + * The type of fee being assessed. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun feeType(): FeeType = feeType.getRequired("fee_type") + + /** + * The fixed component of the fee, if applicable, given in major units of the fee + * amount. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun fixedComponent(): Optional = + fixedComponent.getOptional("fixed_component") + + /** + * The variable rate component of the fee, if applicable, given as a decimal (e.g., + * 0.015 for 1.5%). + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun variableRate(): Optional = variableRate.getOptional("variable_rate") + + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + + /** + * Returns the raw JSON value of [createdAt]. + * + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("created_at") + @ExcludeMissing + fun _createdAt(): JsonField = createdAt + + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("currency") + @ExcludeMissing + fun _currency(): JsonField = currency + + /** + * Returns the raw JSON value of [feeType]. + * + * Unlike [feeType], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("fee_type") + @ExcludeMissing + fun _feeType(): JsonField = feeType + + /** + * Returns the raw JSON value of [fixedComponent]. + * + * Unlike [fixedComponent], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("fixed_component") + @ExcludeMissing + fun _fixedComponent(): JsonField = fixedComponent + + /** + * Returns the raw JSON value of [variableRate]. + * + * Unlike [variableRate], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("variable_rate") + @ExcludeMissing + fun _variableRate(): JsonField = variableRate + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [SchemeFee]. + * + * The following fields are required: + * ```java + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SchemeFee]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var createdAt: JsonField? = null + private var currency: JsonField? = null + private var feeType: JsonField? = null + private var fixedComponent: JsonField? = null + private var variableRate: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(schemeFee: SchemeFee) = apply { + amount = schemeFee.amount + createdAt = schemeFee.createdAt + currency = schemeFee.currency + feeType = schemeFee.feeType + fixedComponent = schemeFee.fixedComponent + variableRate = schemeFee.variableRate + additionalProperties = schemeFee.additionalProperties.toMutableMap() + } + + /** The fee amount given as a string containing a decimal number. */ + fun amount(amount: String) = amount(JsonField.of(amount)) + + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun amount(amount: JsonField) = apply { this.amount = amount } + + /** + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee + * was created. + */ + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + /** + * Sets [Builder.createdAt] to an arbitrary JSON value. + * + * You should usually call [Builder.createdAt] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt + } + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + */ + fun currency(currency: Currency) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [Currency] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } + + /** The type of fee being assessed. */ + fun feeType(feeType: FeeType) = feeType(JsonField.of(feeType)) + + /** + * Sets [Builder.feeType] to an arbitrary JSON value. + * + * You should usually call [Builder.feeType] with a well-typed [FeeType] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun feeType(feeType: JsonField) = apply { this.feeType = feeType } + + /** + * The fixed component of the fee, if applicable, given in major units of the + * fee amount. + */ + fun fixedComponent(fixedComponent: String?) = + fixedComponent(JsonField.ofNullable(fixedComponent)) + + /** + * Alias for calling [Builder.fixedComponent] with + * `fixedComponent.orElse(null)`. + */ + fun fixedComponent(fixedComponent: Optional) = + fixedComponent(fixedComponent.getOrNull()) + + /** + * Sets [Builder.fixedComponent] to an arbitrary JSON value. + * + * You should usually call [Builder.fixedComponent] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun fixedComponent(fixedComponent: JsonField) = apply { + this.fixedComponent = fixedComponent + } + + /** + * The variable rate component of the fee, if applicable, given as a decimal + * (e.g., 0.015 for 1.5%). + */ + fun variableRate(variableRate: String?) = + variableRate(JsonField.ofNullable(variableRate)) + + /** + * Alias for calling [Builder.variableRate] with `variableRate.orElse(null)`. + */ + fun variableRate(variableRate: Optional) = + variableRate(variableRate.getOrNull()) + + /** + * Sets [Builder.variableRate] to an arbitrary JSON value. + * + * You should usually call [Builder.variableRate] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun variableRate(variableRate: JsonField) = apply { + this.variableRate = variableRate + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [SchemeFee]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SchemeFee = + SchemeFee( + checkRequired("amount", amount), + checkRequired("createdAt", createdAt), + checkRequired("currency", currency), + checkRequired("feeType", feeType), + checkRequired("fixedComponent", fixedComponent), + checkRequired("variableRate", variableRate), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): SchemeFee = apply { + if (validated) { + return@apply + } + + amount() + createdAt() + currency().validate() + feeType().validate() + fixedComponent() + variableRate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (currency.asKnown().getOrNull()?.validity() ?: 0) + + (feeType.asKnown().getOrNull()?.validity() ?: 0) + + (if (fixedComponent.asKnown().isPresent) 1 else 0) + + (if (variableRate.asKnown().isPresent) 1 else 0) + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + */ + class Currency + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** US Dollar (USD) */ + @JvmField val USD = of("USD") + + @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) + } + + /** An enum containing [Currency]'s known values. */ + enum class Known { + /** US Dollar (USD) */ + USD + } + + /** + * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Currency] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** US Dollar (USD) */ + USD, + /** + * An enum member indicating that [Currency] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + USD -> Value.USD + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + USD -> Known.USD + else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Currency = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Currency && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** The type of fee being assessed. */ + class FeeType + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY = + of("visa_international_service_assessment_single_currency") + + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY = + of("visa_international_service_assessment_cross_currency") + + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + @JvmField + val VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE = + of("visa_authorization_domestic_point_of_sale") + + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + @JvmField + val VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_international_point_of_sale") + + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + @JvmField + val VISA_AUTHORIZATION_CANADA_POINT_OF_SALE = + of("visa_authorization_canada_point_of_sale") + + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + @JvmField + val VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE = + of("visa_authorization_reversal_point_of_sale") + + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + @JvmField + val VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_reversal_international_point_of_sale") + + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + @JvmField + val VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE = + of("visa_authorization_address_verification_service") + + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + @JvmField + val VISA_ADVANCED_AUTHORIZATION = of("visa_advanced_authorization") + + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + @JvmField val VISA_MESSAGE_TRANSMISSION = of("visa_message_transmission") + + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_DOMESTIC = + of("visa_account_verification_domestic") + + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_INTERNATIONAL = + of("visa_account_verification_international") + + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_CANADA = + of("visa_account_verification_canada") + + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + @JvmField + val VISA_CORPORATE_ACCEPTANCE_FEE = of("visa_corporate_acceptance_fee") + + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + @JvmField + val VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE = + of("visa_consumer_debit_acceptance_fee") + + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + @JvmField + val VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE = + of("visa_business_debit_acceptance_fee") + + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + @JvmField + val VISA_PURCHASING_ACCEPTANCE_FEE = of("visa_purchasing_acceptance_fee") + + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + @JvmField val VISA_PURCHASE_DOMESTIC = of("visa_purchase_domestic") + + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + @JvmField + val VISA_PURCHASE_INTERNATIONAL = of("visa_purchase_international") + + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_CREDIT_PURCHASE_TOKEN = of("visa_credit_purchase_token") + + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_DEBIT_PURCHASE_TOKEN = of("visa_debit_purchase_token") + + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + @JvmField val VISA_CLEARING_TRANSMISSION = of("visa_clearing_transmission") + + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + @JvmField val VISA_DIRECT_AUTHORIZATION = of("visa_direct_authorization") + + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + @JvmField + val VISA_DIRECT_TRANSACTION_DOMESTIC = + of("visa_direct_transaction_domestic") + + /** Issuer card service fee for Commercial Credit cards. */ + @JvmField + val VISA_SERVICE_COMMERCIAL_CREDIT = of("visa_service_commercial_credit") + + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + @JvmField + val VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT = + of("visa_advertising_service_commercial_credit") + + /** Issuer Community Growth Acceleration Program Fee. */ + @JvmField + val VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM = + of("visa_community_growth_acceleration_program") + + /** Issuer Processing Guarantee for Commercial Credit cards. */ + @JvmField + val VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT = + of("visa_processing_guarantee_commercial_credit") + + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + @JvmField val PULSE_SWITCH_FEE = of("pulse_switch_fee") + + @JvmStatic fun of(value: String) = FeeType(JsonField.of(value)) + } + + /** An enum containing [FeeType]'s known values. */ + enum class Known { + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + VISA_ADVANCED_AUTHORIZATION, + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + VISA_MESSAGE_TRANSMISSION, + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_DOMESTIC, + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, + } + + /** + * An enum containing [FeeType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [FeeType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + VISA_ADVANCED_AUTHORIZATION, + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + VISA_MESSAGE_TRANSMISSION, + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_DOMESTIC, + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, + /** + * An enum member indicating that [FeeType] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Value.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Value.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Value.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Value.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Value.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Value.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Value.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Value.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Value.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Value.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Value.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Value.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Value.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Value.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Value.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Value.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Value.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Value.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Value.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Value.PULSE_SWITCH_FEE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Known.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Known.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Known.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Known.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Known.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Known.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Known.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Known.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Known.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Known.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Known.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Known.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Known.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Known.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Known.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Known.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Known.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Known.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Known.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Known.PULSE_SWITCH_FEE + else -> throw IncreaseInvalidDataException("Unknown FeeType: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): FeeType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is FeeType && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SchemeFee && + amount == other.amount && + createdAt == other.createdAt && + currency == other.currency && + feeType == other.feeType && + fixedComponent == other.fixedComponent && + variableRate == other.variableRate && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "SchemeFee{amount=$amount, createdAt=$createdAt, currency=$currency, feeType=$feeType, fixedComponent=$fixedComponent, variableRate=$variableRate, additionalProperties=$additionalProperties}" + } + /** * A constant representing the object's type. For this resource it will always be * `card_authorization`. @@ -12782,6 +14155,7 @@ private constructor( presentmentCurrency == other.presentmentCurrency && processingCategory == other.processingCategory && realTimeDecisionId == other.realTimeDecisionId && + schemeFees == other.schemeFees && terminalId == other.terminalId && type == other.type && verification == other.verification && @@ -12815,6 +14189,7 @@ private constructor( presentmentCurrency, processingCategory, realTimeDecisionId, + schemeFees, terminalId, type, verification, @@ -12825,7 +14200,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CardAuthorization{id=$id, actioner=$actioner, additionalAmounts=$additionalAmounts, amount=$amount, cardPaymentId=$cardPaymentId, currency=$currency, digitalWalletTokenId=$digitalWalletTokenId, direction=$direction, expiresAt=$expiresAt, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkDetails=$networkDetails, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, pendingTransactionId=$pendingTransactionId, physicalCardId=$physicalCardId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, processingCategory=$processingCategory, realTimeDecisionId=$realTimeDecisionId, terminalId=$terminalId, type=$type, verification=$verification, additionalProperties=$additionalProperties}" + "CardAuthorization{id=$id, actioner=$actioner, additionalAmounts=$additionalAmounts, amount=$amount, cardPaymentId=$cardPaymentId, currency=$currency, digitalWalletTokenId=$digitalWalletTokenId, direction=$direction, expiresAt=$expiresAt, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkDetails=$networkDetails, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, pendingTransactionId=$pendingTransactionId, physicalCardId=$physicalCardId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, processingCategory=$processingCategory, realTimeDecisionId=$realTimeDecisionId, schemeFees=$schemeFees, terminalId=$terminalId, type=$type, verification=$verification, additionalProperties=$additionalProperties}" } /** diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/transactions/Transaction.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/transactions/Transaction.kt index 3304e2a55..b59d2a840 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/transactions/Transaction.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/transactions/Transaction.kt @@ -8973,6 +8973,7 @@ private constructor( private val presentmentCurrency: JsonField, private val processingCategory: JsonField, private val realTimeDecisionId: JsonField, + private val schemeFees: JsonField>, private val terminalId: JsonField, private val transactionId: JsonField, private val type: JsonField, @@ -9047,6 +9048,9 @@ private constructor( @JsonProperty("real_time_decision_id") @ExcludeMissing realTimeDecisionId: JsonField = JsonMissing.of(), + @JsonProperty("scheme_fees") + @ExcludeMissing + schemeFees: JsonField> = JsonMissing.of(), @JsonProperty("terminal_id") @ExcludeMissing terminalId: JsonField = JsonMissing.of(), @@ -9081,6 +9085,7 @@ private constructor( presentmentCurrency, processingCategory, realTimeDecisionId, + schemeFees, terminalId, transactionId, type, @@ -9313,6 +9318,15 @@ private constructor( fun realTimeDecisionId(): Optional = realTimeDecisionId.getOptional("real_time_decision_id") + /** + * The scheme fees associated with this card financial. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun schemeFees(): List = schemeFees.getRequired("scheme_fees") + /** * The terminal identifier (commonly abbreviated as TID) of the terminal the card is * transacting with. @@ -9574,6 +9588,16 @@ private constructor( @ExcludeMissing fun _realTimeDecisionId(): JsonField = realTimeDecisionId + /** + * Returns the raw JSON value of [schemeFees]. + * + * Unlike [schemeFees], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("scheme_fees") + @ExcludeMissing + fun _schemeFees(): JsonField> = schemeFees + /** * Returns the raw JSON value of [terminalId]. * @@ -9653,6 +9677,7 @@ private constructor( * .presentmentCurrency() * .processingCategory() * .realTimeDecisionId() + * .schemeFees() * .terminalId() * .transactionId() * .type() @@ -9688,6 +9713,7 @@ private constructor( private var presentmentCurrency: JsonField? = null private var processingCategory: JsonField? = null private var realTimeDecisionId: JsonField? = null + private var schemeFees: JsonField>? = null private var terminalId: JsonField? = null private var transactionId: JsonField? = null private var type: JsonField? = null @@ -9719,6 +9745,7 @@ private constructor( presentmentCurrency = cardFinancial.presentmentCurrency processingCategory = cardFinancial.processingCategory realTimeDecisionId = cardFinancial.realTimeDecisionId + schemeFees = cardFinancial.schemeFees.map { it.toMutableList() } terminalId = cardFinancial.terminalId transactionId = cardFinancial.transactionId type = cardFinancial.type @@ -10154,6 +10181,32 @@ private constructor( this.realTimeDecisionId = realTimeDecisionId } + /** The scheme fees associated with this card financial. */ + fun schemeFees(schemeFees: List) = schemeFees(JsonField.of(schemeFees)) + + /** + * Sets [Builder.schemeFees] to an arbitrary JSON value. + * + * You should usually call [Builder.schemeFees] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun schemeFees(schemeFees: JsonField>) = apply { + this.schemeFees = schemeFees.map { it.toMutableList() } + } + + /** + * Adds a single [SchemeFee] to [schemeFees]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addSchemeFee(schemeFee: SchemeFee) = apply { + schemeFees = + (schemeFees ?: JsonField.of(mutableListOf())).also { + checkKnown("schemeFees", it).add(schemeFee) + } + } + /** * The terminal identifier (commonly abbreviated as TID) of the terminal the card is * transacting with. @@ -10271,6 +10324,7 @@ private constructor( * .presentmentCurrency() * .processingCategory() * .realTimeDecisionId() + * .schemeFees() * .terminalId() * .transactionId() * .type() @@ -10304,6 +10358,7 @@ private constructor( checkRequired("presentmentCurrency", presentmentCurrency), checkRequired("processingCategory", processingCategory), checkRequired("realTimeDecisionId", realTimeDecisionId), + checkRequired("schemeFees", schemeFees).map { it.toImmutable() }, checkRequired("terminalId", terminalId), checkRequired("transactionId", transactionId), checkRequired("type", type), @@ -10342,6 +10397,7 @@ private constructor( presentmentCurrency() processingCategory().validate() realTimeDecisionId() + schemeFees().forEach { it.validate() } terminalId() transactionId() type().validate() @@ -10388,6 +10444,7 @@ private constructor( (if (presentmentCurrency.asKnown().isPresent) 1 else 0) + (processingCategory.asKnown().getOrNull()?.validity() ?: 0) + (if (realTimeDecisionId.asKnown().isPresent) 1 else 0) + + (schemeFees.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (terminalId.asKnown().isPresent) 1 else 0) + (if (transactionId.asKnown().isPresent) 1 else 0) + (type.asKnown().getOrNull()?.validity() ?: 0) + @@ -16389,217 +16446,162 @@ private constructor( override fun toString() = value.toString() } - /** - * A constant representing the object's type. For this resource it will always be - * `card_financial`. - */ - class Type @JsonCreator private constructor(private val value: JsonField) : - Enum { + class SchemeFee + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val amount: JsonField, + private val createdAt: JsonField, + private val currency: JsonField, + private val feeType: JsonField, + private val fixedComponent: JsonField, + private val variableRate: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + createdAt: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("fee_type") + @ExcludeMissing + feeType: JsonField = JsonMissing.of(), + @JsonProperty("fixed_component") + @ExcludeMissing + fixedComponent: JsonField = JsonMissing.of(), + @JsonProperty("variable_rate") + @ExcludeMissing + variableRate: JsonField = JsonMissing.of(), + ) : this( + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, + mutableMapOf(), + ) /** - * Returns this class instance's raw value. + * The fee amount given as a string containing a decimal number. * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CARD_FINANCIAL = of("card_financial") - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - /** An enum containing [Type]'s known values. */ - enum class Known { - CARD_FINANCIAL - } + fun amount(): String = amount.getRequired("amount") /** - * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + * created. * - * An instance of [Type] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). */ - enum class Value { - CARD_FINANCIAL, - /** - * An enum member indicating that [Type] was instantiated with an unknown value. - */ - _UNKNOWN, - } + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). */ - fun value(): Value = - when (this) { - CARD_FINANCIAL -> Value.CARD_FINANCIAL - else -> Value._UNKNOWN - } + fun currency(): Currency = currency.getRequired("currency") /** - * Returns an enum member corresponding to this class instance's value. + * The type of fee being assessed. * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a not a - * known member. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). */ - fun known(): Known = - when (this) { - CARD_FINANCIAL -> Known.CARD_FINANCIAL - else -> throw IncreaseInvalidDataException("Unknown Type: $value") - } + fun feeType(): FeeType = feeType.getRequired("fee_type") /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. + * The fixed component of the fee, if applicable, given in major units of the fee + * amount. * - * @throws IncreaseInvalidDataException if this class instance's value does not have - * the expected primitive type. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Type = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + fun fixedComponent(): Optional = + fixedComponent.getOptional("fixed_component") /** - * Returns a score indicating how many valid values are contained in this object - * recursively. + * The variable rate component of the fee, if applicable, given as a decimal (e.g., + * 0.015 for 1.5%). * - * Used for best match union deserialization. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Type && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** Fields related to verification of cardholder-provided values. */ - class Verification - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val cardVerificationCode: JsonField, - private val cardholderAddress: JsonField, - private val cardholderName: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("card_verification_code") - @ExcludeMissing - cardVerificationCode: JsonField = JsonMissing.of(), - @JsonProperty("cardholder_address") - @ExcludeMissing - cardholderAddress: JsonField = JsonMissing.of(), - @JsonProperty("cardholder_name") - @ExcludeMissing - cardholderName: JsonField = JsonMissing.of(), - ) : this(cardVerificationCode, cardholderAddress, cardholderName, mutableMapOf()) + fun variableRate(): Optional = variableRate.getOptional("variable_rate") /** - * Fields related to verification of the Card Verification Code, a 3-digit code on - * the back of the card. + * Returns the raw JSON value of [amount]. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun cardVerificationCode(): CardVerificationCode = - cardVerificationCode.getRequired("card_verification_code") + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount /** - * Cardholder address provided in the authorization request and the address on file - * we verified it against. + * Returns the raw JSON value of [createdAt]. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun cardholderAddress(): CardholderAddress = - cardholderAddress.getRequired("cardholder_address") + @JsonProperty("created_at") + @ExcludeMissing + fun _createdAt(): JsonField = createdAt /** - * Cardholder name provided in the authorization request. + * Returns the raw JSON value of [currency]. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun cardholderName(): Optional = - cardholderName.getOptional("cardholder_name") + @JsonProperty("currency") + @ExcludeMissing + fun _currency(): JsonField = currency /** - * Returns the raw JSON value of [cardVerificationCode]. + * Returns the raw JSON value of [feeType]. * - * Unlike [cardVerificationCode], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [feeType], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("card_verification_code") + @JsonProperty("fee_type") @ExcludeMissing - fun _cardVerificationCode(): JsonField = cardVerificationCode + fun _feeType(): JsonField = feeType /** - * Returns the raw JSON value of [cardholderAddress]. + * Returns the raw JSON value of [fixedComponent]. * - * Unlike [cardholderAddress], this method doesn't throw if the JSON field has an + * Unlike [fixedComponent], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("cardholder_address") + @JsonProperty("fixed_component") @ExcludeMissing - fun _cardholderAddress(): JsonField = cardholderAddress + fun _fixedComponent(): JsonField = fixedComponent /** - * Returns the raw JSON value of [cardholderName]. + * Returns the raw JSON value of [variableRate]. * - * Unlike [cardholderName], this method doesn't throw if the JSON field has an + * Unlike [variableRate], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("cardholder_name") + @JsonProperty("variable_rate") @ExcludeMissing - fun _cardholderName(): JsonField = cardholderName + fun _variableRate(): JsonField = variableRate @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -16616,90 +16618,146 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [Verification]. + * Returns a mutable builder for constructing an instance of [SchemeFee]. * * The following fields are required: * ```java - * .cardVerificationCode() - * .cardholderAddress() - * .cardholderName() + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [Verification]. */ + /** A builder for [SchemeFee]. */ class Builder internal constructor() { - private var cardVerificationCode: JsonField? = null - private var cardholderAddress: JsonField? = null - private var cardholderName: JsonField? = null + private var amount: JsonField? = null + private var createdAt: JsonField? = null + private var currency: JsonField? = null + private var feeType: JsonField? = null + private var fixedComponent: JsonField? = null + private var variableRate: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(verification: Verification) = apply { - cardVerificationCode = verification.cardVerificationCode - cardholderAddress = verification.cardholderAddress - cardholderName = verification.cardholderName - additionalProperties = verification.additionalProperties.toMutableMap() + internal fun from(schemeFee: SchemeFee) = apply { + amount = schemeFee.amount + createdAt = schemeFee.createdAt + currency = schemeFee.currency + feeType = schemeFee.feeType + fixedComponent = schemeFee.fixedComponent + variableRate = schemeFee.variableRate + additionalProperties = schemeFee.additionalProperties.toMutableMap() } + /** The fee amount given as a string containing a decimal number. */ + fun amount(amount: String) = amount(JsonField.of(amount)) + /** - * Fields related to verification of the Card Verification Code, a 3-digit code - * on the back of the card. + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - fun cardVerificationCode(cardVerificationCode: CardVerificationCode) = - cardVerificationCode(JsonField.of(cardVerificationCode)) + fun amount(amount: JsonField) = apply { this.amount = amount } /** - * Sets [Builder.cardVerificationCode] to an arbitrary JSON value. + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee + * was created. + */ + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + /** + * Sets [Builder.createdAt] to an arbitrary JSON value. * - * You should usually call [Builder.cardVerificationCode] with a well-typed - * [CardVerificationCode] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. + * You should usually call [Builder.createdAt] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - fun cardVerificationCode( - cardVerificationCode: JsonField - ) = apply { this.cardVerificationCode = cardVerificationCode } + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt + } /** - * Cardholder address provided in the authorization request and the address on - * file we verified it against. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. */ - fun cardholderAddress(cardholderAddress: CardholderAddress) = - cardholderAddress(JsonField.of(cardholderAddress)) + fun currency(currency: Currency) = currency(JsonField.of(currency)) /** - * Sets [Builder.cardholderAddress] to an arbitrary JSON value. + * Sets [Builder.currency] to an arbitrary JSON value. * - * You should usually call [Builder.cardholderAddress] with a well-typed - * [CardholderAddress] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * You should usually call [Builder.currency] with a well-typed [Currency] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - fun cardholderAddress(cardholderAddress: JsonField) = apply { - this.cardholderAddress = cardholderAddress + fun currency(currency: JsonField) = apply { this.currency = currency } + + /** The type of fee being assessed. */ + fun feeType(feeType: FeeType) = feeType(JsonField.of(feeType)) + + /** + * Sets [Builder.feeType] to an arbitrary JSON value. + * + * You should usually call [Builder.feeType] with a well-typed [FeeType] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun feeType(feeType: JsonField) = apply { this.feeType = feeType } + + /** + * The fixed component of the fee, if applicable, given in major units of the + * fee amount. + */ + fun fixedComponent(fixedComponent: String?) = + fixedComponent(JsonField.ofNullable(fixedComponent)) + + /** + * Alias for calling [Builder.fixedComponent] with + * `fixedComponent.orElse(null)`. + */ + fun fixedComponent(fixedComponent: Optional) = + fixedComponent(fixedComponent.getOrNull()) + + /** + * Sets [Builder.fixedComponent] to an arbitrary JSON value. + * + * You should usually call [Builder.fixedComponent] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun fixedComponent(fixedComponent: JsonField) = apply { + this.fixedComponent = fixedComponent } - /** Cardholder name provided in the authorization request. */ - fun cardholderName(cardholderName: CardholderName?) = - cardholderName(JsonField.ofNullable(cardholderName)) + /** + * The variable rate component of the fee, if applicable, given as a decimal + * (e.g., 0.015 for 1.5%). + */ + fun variableRate(variableRate: String?) = + variableRate(JsonField.ofNullable(variableRate)) /** - * Alias for calling [Builder.cardholderName] with - * `cardholderName.orElse(null)`. + * Alias for calling [Builder.variableRate] with `variableRate.orElse(null)`. */ - fun cardholderName(cardholderName: Optional) = - cardholderName(cardholderName.getOrNull()) + fun variableRate(variableRate: Optional) = + variableRate(variableRate.getOrNull()) /** - * Sets [Builder.cardholderName] to an arbitrary JSON value. + * Sets [Builder.variableRate] to an arbitrary JSON value. * - * You should usually call [Builder.cardholderName] with a well-typed - * [CardholderName] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * You should usually call [Builder.variableRate] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ - fun cardholderName(cardholderName: JsonField) = apply { - this.cardholderName = cardholderName + fun variableRate(variableRate: JsonField) = apply { + this.variableRate = variableRate } fun additionalProperties(additionalProperties: Map) = apply { @@ -16725,38 +16783,47 @@ private constructor( } /** - * Returns an immutable instance of [Verification]. + * Returns an immutable instance of [SchemeFee]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .cardVerificationCode() - * .cardholderAddress() - * .cardholderName() + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): Verification = - Verification( - checkRequired("cardVerificationCode", cardVerificationCode), - checkRequired("cardholderAddress", cardholderAddress), - checkRequired("cardholderName", cardholderName), + fun build(): SchemeFee = + SchemeFee( + checkRequired("amount", amount), + checkRequired("createdAt", createdAt), + checkRequired("currency", currency), + checkRequired("feeType", feeType), + checkRequired("fixedComponent", fixedComponent), + checkRequired("variableRate", variableRate), additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): Verification = apply { + fun validate(): SchemeFee = apply { if (validated) { return@apply } - cardVerificationCode().validate() - cardholderAddress().validate() - cardholderName().ifPresent { it.validate() } + amount() + createdAt() + currency().validate() + feeType().validate() + fixedComponent() + variableRate() validated = true } @@ -16776,148 +16843,116 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (cardVerificationCode.asKnown().getOrNull()?.validity() ?: 0) + - (cardholderAddress.asKnown().getOrNull()?.validity() ?: 0) + - (cardholderName.asKnown().getOrNull()?.validity() ?: 0) + (if (amount.asKnown().isPresent) 1 else 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (currency.asKnown().getOrNull()?.validity() ?: 0) + + (feeType.asKnown().getOrNull()?.validity() ?: 0) + + (if (fixedComponent.asKnown().isPresent) 1 else 0) + + (if (variableRate.asKnown().isPresent) 1 else 0) /** - * Fields related to verification of the Card Verification Code, a 3-digit code on - * the back of the card. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. */ - class CardVerificationCode - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val result: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("result") - @ExcludeMissing - result: JsonField = JsonMissing.of() - ) : this(result, mutableMapOf()) - - /** - * The result of verifying the Card Verification Code. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). - */ - fun result(): Result = result.getRequired("result") + class Currency + @JsonCreator + private constructor(private val value: JsonField) : Enum { /** - * Returns the raw JSON value of [result]. + * Returns this class instance's raw value. * - * Unlike [result], this method doesn't throw if the JSON field has an - * unexpected type. + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. */ - @JsonProperty("result") - @ExcludeMissing - fun _result(): JsonField = result + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + companion object { - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** US Dollar (USD) */ + @JvmField val USD = of("USD") - fun toBuilder() = Builder().from(this) + @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) + } - companion object { + /** An enum containing [Currency]'s known values. */ + enum class Known { + /** US Dollar (USD) */ + USD + } + /** + * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Currency] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** US Dollar (USD) */ + USD, /** - * Returns a mutable builder for constructing an instance of - * [CardVerificationCode]. - * - * The following fields are required: - * ```java - * .result() - * ``` + * An enum member indicating that [Currency] was instantiated with an + * unknown value. */ - @JvmStatic fun builder() = Builder() + _UNKNOWN, } - /** A builder for [CardVerificationCode]. */ - class Builder internal constructor() { + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + USD -> Value.USD + else -> Value._UNKNOWN + } - private var result: JsonField? = null - private var additionalProperties: MutableMap = - mutableMapOf() + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + USD -> Known.USD + else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + } - @JvmSynthetic - internal fun from(cardVerificationCode: CardVerificationCode) = apply { - result = cardVerificationCode.result - additionalProperties = - cardVerificationCode.additionalProperties.toMutableMap() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") } - /** The result of verifying the Card Verification Code. */ - fun result(result: Result) = result(JsonField.of(result)) + private var validated: Boolean = false - /** - * Sets [Builder.result] to an arbitrary JSON value. - * - * You should usually call [Builder.result] with a well-typed [Result] value - * instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun result(result: JsonField) = apply { this.result = result } + fun validate(): Currency = apply { + if (validated) { + return@apply + } - fun additionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [CardVerificationCode]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .result() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CardVerificationCode = - CardVerificationCode( - checkRequired("result", result), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): CardVerificationCode = apply { - if (validated) { - return@apply - } - - result().validate() + known() validated = true } @@ -16936,537 +16971,730 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = (result.asKnown().getOrNull()?.validity() ?: 0) + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - /** The result of verifying the Card Verification Code. */ - class Result - @JsonCreator - private constructor(private val value: JsonField) : Enum { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + return other is Currency && value == other.value + } - companion object { + override fun hashCode() = value.hashCode() - /** - * No card verification code was provided in the authorization request. - */ - @JvmField val NOT_CHECKED = of("not_checked") + override fun toString() = value.toString() + } - /** The card verification code matched the one on file. */ - @JvmField val MATCH = of("match") + /** The type of fee being assessed. */ + class FeeType + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** The card verification code did not match the one on file. */ - @JvmField val NO_MATCH = of("no_match") + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - @JvmStatic fun of(value: String) = Result(JsonField.of(value)) - } + companion object { - /** An enum containing [Result]'s known values. */ - enum class Known { - /** - * No card verification code was provided in the authorization request. - */ - NOT_CHECKED, - /** The card verification code matched the one on file. */ - MATCH, - /** The card verification code did not match the one on file. */ - NO_MATCH, - } + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY = + of("visa_international_service_assessment_single_currency") /** - * An enum containing [Result]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [Result] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. */ - enum class Value { - /** - * No card verification code was provided in the authorization request. - */ - NOT_CHECKED, - /** The card verification code matched the one on file. */ - MATCH, - /** The card verification code did not match the one on file. */ - NO_MATCH, - /** - * An enum member indicating that [Result] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY = + of("visa_international_service_assessment_cross_currency") /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. */ - fun value(): Value = - when (this) { - NOT_CHECKED -> Value.NOT_CHECKED - MATCH -> Value.MATCH - NO_MATCH -> Value.NO_MATCH - else -> Value._UNKNOWN - } + @JvmField + val VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE = + of("visa_authorization_domestic_point_of_sale") /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. */ - fun known(): Known = - when (this) { - NOT_CHECKED -> Known.NOT_CHECKED - MATCH -> Known.MATCH - NO_MATCH -> Known.NO_MATCH - else -> throw IncreaseInvalidDataException("Unknown Result: $value") - } + @JvmField + val VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_international_point_of_sale") /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + @JvmField + val VISA_AUTHORIZATION_CANADA_POINT_OF_SALE = + of("visa_authorization_canada_point_of_sale") - private var validated: Boolean = false + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + @JvmField + val VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE = + of("visa_authorization_reversal_point_of_sale") - fun validate(): Result = apply { - if (validated) { - return@apply - } + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + @JvmField + val VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_reversal_international_point_of_sale") - known() - validated = true - } + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + @JvmField + val VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE = + of("visa_authorization_address_verification_service") - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + @JvmField + val VISA_ADVANCED_AUTHORIZATION = of("visa_advanced_authorization") /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + @JvmField val VISA_MESSAGE_TRANSMISSION = of("visa_message_transmission") - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_DOMESTIC = + of("visa_account_verification_domestic") - return other is Result && value == other.value - } + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_INTERNATIONAL = + of("visa_account_verification_international") - override fun hashCode() = value.hashCode() + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_CANADA = + of("visa_account_verification_canada") - override fun toString() = value.toString() - } + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + @JvmField + val VISA_CORPORATE_ACCEPTANCE_FEE = of("visa_corporate_acceptance_fee") - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + @JvmField + val VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE = + of("visa_consumer_debit_acceptance_fee") - return other is CardVerificationCode && - result == other.result && - additionalProperties == other.additionalProperties - } + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + @JvmField + val VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE = + of("visa_business_debit_acceptance_fee") - private val hashCode: Int by lazy { Objects.hash(result, additionalProperties) } + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + @JvmField + val VISA_PURCHASING_ACCEPTANCE_FEE = of("visa_purchasing_acceptance_fee") - override fun hashCode(): Int = hashCode + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + @JvmField val VISA_PURCHASE_DOMESTIC = of("visa_purchase_domestic") - override fun toString() = - "CardVerificationCode{result=$result, additionalProperties=$additionalProperties}" - } + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + @JvmField + val VISA_PURCHASE_INTERNATIONAL = of("visa_purchase_international") - /** - * Cardholder address provided in the authorization request and the address on file - * we verified it against. - */ - class CardholderAddress - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val actualLine1: JsonField, - private val actualPostalCode: JsonField, - private val providedLine1: JsonField, - private val providedPostalCode: JsonField, - private val result: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("actual_line1") - @ExcludeMissing - actualLine1: JsonField = JsonMissing.of(), - @JsonProperty("actual_postal_code") - @ExcludeMissing - actualPostalCode: JsonField = JsonMissing.of(), - @JsonProperty("provided_line1") - @ExcludeMissing - providedLine1: JsonField = JsonMissing.of(), - @JsonProperty("provided_postal_code") - @ExcludeMissing - providedPostalCode: JsonField = JsonMissing.of(), - @JsonProperty("result") - @ExcludeMissing - result: JsonField = JsonMissing.of(), - ) : this( - actualLine1, - actualPostalCode, - providedLine1, - providedPostalCode, - result, - mutableMapOf(), - ) - - /** - * Line 1 of the address on file for the cardholder. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun actualLine1(): Optional = actualLine1.getOptional("actual_line1") + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_CREDIT_PURCHASE_TOKEN = of("visa_credit_purchase_token") - /** - * The postal code of the address on file for the cardholder. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun actualPostalCode(): Optional = - actualPostalCode.getOptional("actual_postal_code") + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_DEBIT_PURCHASE_TOKEN = of("visa_debit_purchase_token") - /** - * The cardholder address line 1 provided for verification in the authorization - * request. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun providedLine1(): Optional = - providedLine1.getOptional("provided_line1") + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + @JvmField val VISA_CLEARING_TRANSMISSION = of("visa_clearing_transmission") - /** - * The postal code provided for verification in the authorization request. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun providedPostalCode(): Optional = - providedPostalCode.getOptional("provided_postal_code") + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + @JvmField val VISA_DIRECT_AUTHORIZATION = of("visa_direct_authorization") - /** - * The address verification result returned to the card network. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). - */ - fun result(): Result = result.getRequired("result") + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + @JvmField + val VISA_DIRECT_TRANSACTION_DOMESTIC = + of("visa_direct_transaction_domestic") - /** - * Returns the raw JSON value of [actualLine1]. - * - * Unlike [actualLine1], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("actual_line1") - @ExcludeMissing - fun _actualLine1(): JsonField = actualLine1 + /** Issuer card service fee for Commercial Credit cards. */ + @JvmField + val VISA_SERVICE_COMMERCIAL_CREDIT = of("visa_service_commercial_credit") - /** - * Returns the raw JSON value of [actualPostalCode]. - * - * Unlike [actualPostalCode], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("actual_postal_code") - @ExcludeMissing - fun _actualPostalCode(): JsonField = actualPostalCode + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + @JvmField + val VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT = + of("visa_advertising_service_commercial_credit") - /** - * Returns the raw JSON value of [providedLine1]. - * - * Unlike [providedLine1], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("provided_line1") - @ExcludeMissing - fun _providedLine1(): JsonField = providedLine1 + /** Issuer Community Growth Acceleration Program Fee. */ + @JvmField + val VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM = + of("visa_community_growth_acceleration_program") - /** - * Returns the raw JSON value of [providedPostalCode]. - * - * Unlike [providedPostalCode], this method doesn't throw if the JSON field has - * an unexpected type. - */ - @JsonProperty("provided_postal_code") - @ExcludeMissing - fun _providedPostalCode(): JsonField = providedPostalCode + /** Issuer Processing Guarantee for Commercial Credit cards. */ + @JvmField + val VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT = + of("visa_processing_guarantee_commercial_credit") - /** - * Returns the raw JSON value of [result]. - * - * Unlike [result], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("result") - @ExcludeMissing - fun _result(): JsonField = result + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + @JvmField val PULSE_SWITCH_FEE = of("pulse_switch_fee") - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) + @JvmStatic fun of(value: String) = FeeType(JsonField.of(value)) } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - + /** An enum containing [FeeType]'s known values. */ + enum class Known { /** - * Returns a mutable builder for constructing an instance of - * [CardholderAddress]. - * - * The following fields are required: - * ```java - * .actualLine1() - * .actualPostalCode() - * .providedLine1() - * .providedPostalCode() - * .result() - * ``` + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CardholderAddress]. */ - class Builder internal constructor() { - - private var actualLine1: JsonField? = null - private var actualPostalCode: JsonField? = null - private var providedLine1: JsonField? = null - private var providedPostalCode: JsonField? = null - private var result: JsonField? = null - private var additionalProperties: MutableMap = - mutableMapOf() - - @JvmSynthetic - internal fun from(cardholderAddress: CardholderAddress) = apply { - actualLine1 = cardholderAddress.actualLine1 - actualPostalCode = cardholderAddress.actualPostalCode - providedLine1 = cardholderAddress.providedLine1 - providedPostalCode = cardholderAddress.providedPostalCode - result = cardholderAddress.result - additionalProperties = - cardholderAddress.additionalProperties.toMutableMap() - } - - /** Line 1 of the address on file for the cardholder. */ - fun actualLine1(actualLine1: String?) = - actualLine1(JsonField.ofNullable(actualLine1)) - + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, /** - * Alias for calling [Builder.actualLine1] with `actualLine1.orElse(null)`. + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. */ - fun actualLine1(actualLine1: Optional) = - actualLine1(actualLine1.getOrNull()) - + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, /** - * Sets [Builder.actualLine1] to an arbitrary JSON value. - * - * You should usually call [Builder.actualLine1] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. */ - fun actualLine1(actualLine1: JsonField) = apply { - this.actualLine1 = actualLine1 - } - - /** The postal code of the address on file for the cardholder. */ - fun actualPostalCode(actualPostalCode: String?) = - actualPostalCode(JsonField.ofNullable(actualPostalCode)) - + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, /** - * Alias for calling [Builder.actualPostalCode] with - * `actualPostalCode.orElse(null)`. + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. */ - fun actualPostalCode(actualPostalCode: Optional) = - actualPostalCode(actualPostalCode.getOrNull()) - + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, /** - * Sets [Builder.actualPostalCode] to an arbitrary JSON value. - * - * You should usually call [Builder.actualPostalCode] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. */ - fun actualPostalCode(actualPostalCode: JsonField) = apply { - this.actualPostalCode = actualPostalCode - } - + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, /** - * The cardholder address line 1 provided for verification in the + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous * authorization request. */ - fun providedLine1(providedLine1: String?) = - providedLine1(JsonField.ofNullable(providedLine1)) - + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, /** - * Alias for calling [Builder.providedLine1] with - * `providedLine1.orElse(null)`. + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. */ - fun providedLine1(providedLine1: Optional) = - providedLine1(providedLine1.getOrNull()) - + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, /** - * Sets [Builder.providedLine1] to an arbitrary JSON value. - * - * You should usually call [Builder.providedLine1] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. */ - fun providedLine1(providedLine1: JsonField) = apply { - this.providedLine1 = providedLine1 - } - + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, /** - * The postal code provided for verification in the authorization request. + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). */ - fun providedPostalCode(providedPostalCode: String?) = - providedPostalCode(JsonField.ofNullable(providedPostalCode)) - + VISA_ADVANCED_AUTHORIZATION, /** - * Alias for calling [Builder.providedPostalCode] with - * `providedPostalCode.orElse(null)`. + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. */ - fun providedPostalCode(providedPostalCode: Optional) = - providedPostalCode(providedPostalCode.getOrNull()) - + VISA_MESSAGE_TRANSMISSION, /** - * Sets [Builder.providedPostalCode] to an arbitrary JSON value. - * - * You should usually call [Builder.providedPostalCode] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. */ - fun providedPostalCode(providedPostalCode: JsonField) = apply { - this.providedPostalCode = providedPostalCode - } - - /** The address verification result returned to the card network. */ - fun result(result: Result) = result(JsonField.of(result)) - + VISA_ACCOUNT_VERIFICATION_DOMESTIC, /** - * Sets [Builder.result] to an arbitrary JSON value. - * - * You should usually call [Builder.result] with a well-typed [Result] value - * instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. */ - fun result(result: JsonField) = apply { this.result = result } + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, + } - fun additionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** + * An enum containing [FeeType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [FeeType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + VISA_ADVANCED_AUTHORIZATION, + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + VISA_MESSAGE_TRANSMISSION, + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_DOMESTIC, + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, + /** + * An enum member indicating that [FeeType] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Value.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Value.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Value.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Value.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Value.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Value.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Value.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Value.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Value.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Value.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Value.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Value.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Value.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Value.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Value.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Value.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Value.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Value.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Value.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Value.PULSE_SWITCH_FEE + else -> Value._UNKNOWN } - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Known.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Known.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Known.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Known.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Known.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Known.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Known.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Known.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Known.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Known.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Known.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Known.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Known.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Known.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Known.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Known.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Known.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Known.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Known.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Known.PULSE_SWITCH_FEE + else -> throw IncreaseInvalidDataException("Unknown FeeType: $value") } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") } - /** - * Returns an immutable instance of [CardholderAddress]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .actualLine1() - * .actualPostalCode() - * .providedLine1() - * .providedPostalCode() - * .result() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CardholderAddress = - CardholderAddress( - checkRequired("actualLine1", actualLine1), - checkRequired("actualPostalCode", actualPostalCode), - checkRequired("providedLine1", providedLine1), - checkRequired("providedPostalCode", providedPostalCode), - checkRequired("result", result), - additionalProperties.toMutableMap(), - ) - } - private var validated: Boolean = false - fun validate(): CardholderAddress = apply { + fun validate(): FeeType = apply { if (validated) { return@apply } - actualLine1() - actualPostalCode() - providedLine1() - providedPostalCode() - result().validate() + known() validated = true } @@ -17485,350 +17713,485 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = - (if (actualLine1.asKnown().isPresent) 1 else 0) + - (if (actualPostalCode.asKnown().isPresent) 1 else 0) + - (if (providedLine1.asKnown().isPresent) 1 else 0) + - (if (providedPostalCode.asKnown().isPresent) 1 else 0) + - (result.asKnown().getOrNull()?.validity() ?: 0) + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - /** The address verification result returned to the card network. */ - class Result - @JsonCreator - private constructor(private val value: JsonField) : Enum { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + return other is FeeType && value == other.value + } - companion object { + override fun hashCode() = value.hashCode() - /** No address information was provided in the authorization request. */ - @JvmField val NOT_CHECKED = of("not_checked") + override fun toString() = value.toString() + } - /** - * Postal code matches, but the street address does not match or was not - * provided. - */ - @JvmField - val POSTAL_CODE_MATCH_ADDRESS_NO_MATCH = - of("postal_code_match_address_no_match") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Postal code does not match, but the street address matches or was not - * provided. - */ - @JvmField - val POSTAL_CODE_NO_MATCH_ADDRESS_MATCH = - of("postal_code_no_match_address_match") + return other is SchemeFee && + amount == other.amount && + createdAt == other.createdAt && + currency == other.currency && + feeType == other.feeType && + fixedComponent == other.fixedComponent && + variableRate == other.variableRate && + additionalProperties == other.additionalProperties + } - /** Postal code and street address match. */ - @JvmField val MATCH = of("match") + private val hashCode: Int by lazy { + Objects.hash( + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, + additionalProperties, + ) + } - /** Postal code and street address do not match. */ - @JvmField val NO_MATCH = of("no_match") + override fun hashCode(): Int = hashCode - /** - * Postal code matches, but the street address was not verified. - * (deprecated) - */ - @JvmField - val POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED = - of("postal_code_match_address_not_checked") + override fun toString() = + "SchemeFee{amount=$amount, createdAt=$createdAt, currency=$currency, feeType=$feeType, fixedComponent=$fixedComponent, variableRate=$variableRate, additionalProperties=$additionalProperties}" + } - @JvmStatic fun of(value: String) = Result(JsonField.of(value)) - } - - /** An enum containing [Result]'s known values. */ - enum class Known { - /** No address information was provided in the authorization request. */ - NOT_CHECKED, - /** - * Postal code matches, but the street address does not match or was not - * provided. - */ - POSTAL_CODE_MATCH_ADDRESS_NO_MATCH, - /** - * Postal code does not match, but the street address matches or was not - * provided. - */ - POSTAL_CODE_NO_MATCH_ADDRESS_MATCH, - /** Postal code and street address match. */ - MATCH, - /** Postal code and street address do not match. */ - NO_MATCH, - /** - * Postal code matches, but the street address was not verified. - * (deprecated) - */ - POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED, - } - - /** - * An enum containing [Result]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [Result] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** No address information was provided in the authorization request. */ - NOT_CHECKED, - /** - * Postal code matches, but the street address does not match or was not - * provided. - */ - POSTAL_CODE_MATCH_ADDRESS_NO_MATCH, - /** - * Postal code does not match, but the street address matches or was not - * provided. - */ - POSTAL_CODE_NO_MATCH_ADDRESS_MATCH, - /** Postal code and street address match. */ - MATCH, - /** Postal code and street address do not match. */ - NO_MATCH, - /** - * Postal code matches, but the street address was not verified. - * (deprecated) - */ - POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED, - /** - * An enum member indicating that [Result] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - NOT_CHECKED -> Value.NOT_CHECKED - POSTAL_CODE_MATCH_ADDRESS_NO_MATCH -> - Value.POSTAL_CODE_MATCH_ADDRESS_NO_MATCH - POSTAL_CODE_NO_MATCH_ADDRESS_MATCH -> - Value.POSTAL_CODE_NO_MATCH_ADDRESS_MATCH - MATCH -> Value.MATCH - NO_MATCH -> Value.NO_MATCH - POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED -> - Value.POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED - else -> Value._UNKNOWN - } + /** + * A constant representing the object's type. For this resource it will always be + * `card_financial`. + */ + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - NOT_CHECKED -> Known.NOT_CHECKED - POSTAL_CODE_MATCH_ADDRESS_NO_MATCH -> - Known.POSTAL_CODE_MATCH_ADDRESS_NO_MATCH - POSTAL_CODE_NO_MATCH_ADDRESS_MATCH -> - Known.POSTAL_CODE_NO_MATCH_ADDRESS_MATCH - MATCH -> Known.MATCH - NO_MATCH -> Known.NO_MATCH - POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED -> - Known.POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED - else -> throw IncreaseInvalidDataException("Unknown Result: $value") - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + companion object { - private var validated: Boolean = false + @JvmField val CARD_FINANCIAL = of("card_financial") - fun validate(): Result = apply { - if (validated) { - return@apply - } + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } - known() - validated = true - } + /** An enum containing [Type]'s known values. */ + enum class Known { + CARD_FINANCIAL + } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + CARD_FINANCIAL, + /** + * An enum member indicating that [Type] was instantiated with an unknown value. + */ + _UNKNOWN, + } - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + CARD_FINANCIAL -> Value.CARD_FINANCIAL + else -> Value._UNKNOWN + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + CARD_FINANCIAL -> Known.CARD_FINANCIAL + else -> throw IncreaseInvalidDataException("Unknown Type: $value") + } - return other is Result && value == other.value - } + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - override fun hashCode() = value.hashCode() + private var validated: Boolean = false - override fun toString() = value.toString() + fun validate(): Type = apply { + if (validated) { + return@apply } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + known() + validated = true + } - return other is CardholderAddress && - actualLine1 == other.actualLine1 && - actualPostalCode == other.actualPostalCode && - providedLine1 == other.providedLine1 && - providedPostalCode == other.providedPostalCode && - result == other.result && - additionalProperties == other.additionalProperties + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false } - private val hashCode: Int by lazy { - Objects.hash( - actualLine1, - actualPostalCode, - providedLine1, - providedPostalCode, - result, - additionalProperties, - ) - } + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - override fun hashCode(): Int = hashCode + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - override fun toString() = - "CardholderAddress{actualLine1=$actualLine1, actualPostalCode=$actualPostalCode, providedLine1=$providedLine1, providedPostalCode=$providedPostalCode, result=$result, additionalProperties=$additionalProperties}" + return other is Type && value == other.value } - /** Cardholder name provided in the authorization request. */ - class CardholderName - @JsonCreator(mode = JsonCreator.Mode.DISABLED) + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Fields related to verification of cardholder-provided values. */ + class Verification + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val cardVerificationCode: JsonField, + private val cardholderAddress: JsonField, + private val cardholderName: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator private constructor( - private val providedFirstName: JsonField, - private val providedLastName: JsonField, - private val providedMiddleName: JsonField, - private val additionalProperties: MutableMap, - ) { + @JsonProperty("card_verification_code") + @ExcludeMissing + cardVerificationCode: JsonField = JsonMissing.of(), + @JsonProperty("cardholder_address") + @ExcludeMissing + cardholderAddress: JsonField = JsonMissing.of(), + @JsonProperty("cardholder_name") + @ExcludeMissing + cardholderName: JsonField = JsonMissing.of(), + ) : this(cardVerificationCode, cardholderAddress, cardholderName, mutableMapOf()) - @JsonCreator - private constructor( - @JsonProperty("provided_first_name") - @ExcludeMissing - providedFirstName: JsonField = JsonMissing.of(), - @JsonProperty("provided_last_name") - @ExcludeMissing - providedLastName: JsonField = JsonMissing.of(), - @JsonProperty("provided_middle_name") - @ExcludeMissing - providedMiddleName: JsonField = JsonMissing.of(), - ) : this( - providedFirstName, - providedLastName, - providedMiddleName, - mutableMapOf(), - ) + /** + * Fields related to verification of the Card Verification Code, a 3-digit code on + * the back of the card. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun cardVerificationCode(): CardVerificationCode = + cardVerificationCode.getRequired("card_verification_code") + + /** + * Cardholder address provided in the authorization request and the address on file + * we verified it against. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun cardholderAddress(): CardholderAddress = + cardholderAddress.getRequired("cardholder_address") + + /** + * Cardholder name provided in the authorization request. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun cardholderName(): Optional = + cardholderName.getOptional("cardholder_name") + + /** + * Returns the raw JSON value of [cardVerificationCode]. + * + * Unlike [cardVerificationCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("card_verification_code") + @ExcludeMissing + fun _cardVerificationCode(): JsonField = cardVerificationCode + + /** + * Returns the raw JSON value of [cardholderAddress]. + * + * Unlike [cardholderAddress], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("cardholder_address") + @ExcludeMissing + fun _cardholderAddress(): JsonField = cardholderAddress + + /** + * Returns the raw JSON value of [cardholderName]. + * + * Unlike [cardholderName], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("cardholder_name") + @ExcludeMissing + fun _cardholderName(): JsonField = cardholderName + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { /** - * The first name provided for verification in the authorization request. + * Returns a mutable builder for constructing an instance of [Verification]. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * The following fields are required: + * ```java + * .cardVerificationCode() + * .cardholderAddress() + * .cardholderName() + * ``` */ - fun providedFirstName(): Optional = - providedFirstName.getOptional("provided_first_name") + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Verification]. */ + class Builder internal constructor() { + + private var cardVerificationCode: JsonField? = null + private var cardholderAddress: JsonField? = null + private var cardholderName: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(verification: Verification) = apply { + cardVerificationCode = verification.cardVerificationCode + cardholderAddress = verification.cardholderAddress + cardholderName = verification.cardholderName + additionalProperties = verification.additionalProperties.toMutableMap() + } /** - * The last name provided for verification in the authorization request. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * Fields related to verification of the Card Verification Code, a 3-digit code + * on the back of the card. */ - fun providedLastName(): Optional = - providedLastName.getOptional("provided_last_name") + fun cardVerificationCode(cardVerificationCode: CardVerificationCode) = + cardVerificationCode(JsonField.of(cardVerificationCode)) /** - * The middle name provided for verification in the authorization request. + * Sets [Builder.cardVerificationCode] to an arbitrary JSON value. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * You should usually call [Builder.cardVerificationCode] with a well-typed + * [CardVerificationCode] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. */ - fun providedMiddleName(): Optional = - providedMiddleName.getOptional("provided_middle_name") + fun cardVerificationCode( + cardVerificationCode: JsonField + ) = apply { this.cardVerificationCode = cardVerificationCode } /** - * Returns the raw JSON value of [providedFirstName]. - * - * Unlike [providedFirstName], this method doesn't throw if the JSON field has - * an unexpected type. + * Cardholder address provided in the authorization request and the address on + * file we verified it against. */ - @JsonProperty("provided_first_name") - @ExcludeMissing - fun _providedFirstName(): JsonField = providedFirstName + fun cardholderAddress(cardholderAddress: CardholderAddress) = + cardholderAddress(JsonField.of(cardholderAddress)) /** - * Returns the raw JSON value of [providedLastName]. + * Sets [Builder.cardholderAddress] to an arbitrary JSON value. * - * Unlike [providedLastName], this method doesn't throw if the JSON field has an - * unexpected type. + * You should usually call [Builder.cardholderAddress] with a well-typed + * [CardholderAddress] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - @JsonProperty("provided_last_name") - @ExcludeMissing - fun _providedLastName(): JsonField = providedLastName + fun cardholderAddress(cardholderAddress: JsonField) = apply { + this.cardholderAddress = cardholderAddress + } + + /** Cardholder name provided in the authorization request. */ + fun cardholderName(cardholderName: CardholderName?) = + cardholderName(JsonField.ofNullable(cardholderName)) /** - * Returns the raw JSON value of [providedMiddleName]. + * Alias for calling [Builder.cardholderName] with + * `cardholderName.orElse(null)`. + */ + fun cardholderName(cardholderName: Optional) = + cardholderName(cardholderName.getOrNull()) + + /** + * Sets [Builder.cardholderName] to an arbitrary JSON value. * - * Unlike [providedMiddleName], this method doesn't throw if the JSON field has - * an unexpected type. + * You should usually call [Builder.cardholderName] with a well-typed + * [CardholderName] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - @JsonProperty("provided_middle_name") - @ExcludeMissing - fun _providedMiddleName(): JsonField = providedMiddleName + fun cardholderName(cardholderName: JsonField) = apply { + this.cardholderName = cardholderName + } - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Verification]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .cardVerificationCode() + * .cardholderAddress() + * .cardholderName() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Verification = + Verification( + checkRequired("cardVerificationCode", cardVerificationCode), + checkRequired("cardholderAddress", cardholderAddress), + checkRequired("cardholderName", cardholderName), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Verification = apply { + if (validated) { + return@apply + } + + cardVerificationCode().validate() + cardholderAddress().validate() + cardholderName().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (cardVerificationCode.asKnown().getOrNull()?.validity() ?: 0) + + (cardholderAddress.asKnown().getOrNull()?.validity() ?: 0) + + (cardholderName.asKnown().getOrNull()?.validity() ?: 0) + + /** + * Fields related to verification of the Card Verification Code, a 3-digit code on + * the back of the card. + */ + class CardVerificationCode + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val result: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("result") + @ExcludeMissing + result: JsonField = JsonMissing.of() + ) : this(result, mutableMapOf()) + + /** + * The result of verifying the Card Verification Code. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun result(): Result = result.getRequired("result") + + /** + * Returns the raw JSON value of [result]. + * + * Unlike [result], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("result") + @ExcludeMissing + fun _result(): JsonField = result + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) } @JsonAnyGetter @@ -17842,105 +18205,41 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [CardholderName]. + * [CardVerificationCode]. * * The following fields are required: * ```java - * .providedFirstName() - * .providedLastName() - * .providedMiddleName() + * .result() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [CardholderName]. */ + /** A builder for [CardVerificationCode]. */ class Builder internal constructor() { - private var providedFirstName: JsonField? = null - private var providedLastName: JsonField? = null - private var providedMiddleName: JsonField? = null + private var result: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(cardholderName: CardholderName) = apply { - providedFirstName = cardholderName.providedFirstName - providedLastName = cardholderName.providedLastName - providedMiddleName = cardholderName.providedMiddleName + internal fun from(cardVerificationCode: CardVerificationCode) = apply { + result = cardVerificationCode.result additionalProperties = - cardholderName.additionalProperties.toMutableMap() - } - - /** - * The first name provided for verification in the authorization request. - */ - fun providedFirstName(providedFirstName: String?) = - providedFirstName(JsonField.ofNullable(providedFirstName)) - - /** - * Alias for calling [Builder.providedFirstName] with - * `providedFirstName.orElse(null)`. - */ - fun providedFirstName(providedFirstName: Optional) = - providedFirstName(providedFirstName.getOrNull()) - - /** - * Sets [Builder.providedFirstName] to an arbitrary JSON value. - * - * You should usually call [Builder.providedFirstName] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun providedFirstName(providedFirstName: JsonField) = apply { - this.providedFirstName = providedFirstName - } - - /** The last name provided for verification in the authorization request. */ - fun providedLastName(providedLastName: String?) = - providedLastName(JsonField.ofNullable(providedLastName)) - - /** - * Alias for calling [Builder.providedLastName] with - * `providedLastName.orElse(null)`. - */ - fun providedLastName(providedLastName: Optional) = - providedLastName(providedLastName.getOrNull()) - - /** - * Sets [Builder.providedLastName] to an arbitrary JSON value. - * - * You should usually call [Builder.providedLastName] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun providedLastName(providedLastName: JsonField) = apply { - this.providedLastName = providedLastName + cardVerificationCode.additionalProperties.toMutableMap() } - /** - * The middle name provided for verification in the authorization request. - */ - fun providedMiddleName(providedMiddleName: String?) = - providedMiddleName(JsonField.ofNullable(providedMiddleName)) - - /** - * Alias for calling [Builder.providedMiddleName] with - * `providedMiddleName.orElse(null)`. - */ - fun providedMiddleName(providedMiddleName: Optional) = - providedMiddleName(providedMiddleName.getOrNull()) + /** The result of verifying the Card Verification Code. */ + fun result(result: Result) = result(JsonField.of(result)) /** - * Sets [Builder.providedMiddleName] to an arbitrary JSON value. + * Sets [Builder.result] to an arbitrary JSON value. * - * You should usually call [Builder.providedMiddleName] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * You should usually call [Builder.result] with a well-typed [Result] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ - fun providedMiddleName(providedMiddleName: JsonField) = apply { - this.providedMiddleName = providedMiddleName - } + fun result(result: JsonField) = apply { this.result = result } fun additionalProperties(additionalProperties: Map) = apply { @@ -17965,38 +18264,32 @@ private constructor( } /** - * Returns an immutable instance of [CardholderName]. + * Returns an immutable instance of [CardVerificationCode]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .providedFirstName() - * .providedLastName() - * .providedMiddleName() + * .result() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): CardholderName = - CardholderName( - checkRequired("providedFirstName", providedFirstName), - checkRequired("providedLastName", providedLastName), - checkRequired("providedMiddleName", providedMiddleName), + fun build(): CardVerificationCode = + CardVerificationCode( + checkRequired("result", result), additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): CardholderName = apply { + fun validate(): CardVerificationCode = apply { if (validated) { return@apply } - providedFirstName() - providedLastName() - providedMiddleName() + result().validate() validated = true } @@ -18015,2536 +18308,2649 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = - (if (providedFirstName.asKnown().isPresent) 1 else 0) + - (if (providedLastName.asKnown().isPresent) 1 else 0) + - (if (providedMiddleName.asKnown().isPresent) 1 else 0) + internal fun validity(): Int = (result.asKnown().getOrNull()?.validity() ?: 0) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** The result of verifying the Card Verification Code. */ + class Result + @JsonCreator + private constructor(private val value: JsonField) : Enum { - return other is CardholderName && - providedFirstName == other.providedFirstName && - providedLastName == other.providedLastName && - providedMiddleName == other.providedMiddleName && - additionalProperties == other.additionalProperties - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - private val hashCode: Int by lazy { - Objects.hash( - providedFirstName, - providedLastName, - providedMiddleName, - additionalProperties, - ) - } + companion object { - override fun hashCode(): Int = hashCode + /** + * No card verification code was provided in the authorization request. + */ + @JvmField val NOT_CHECKED = of("not_checked") - override fun toString() = - "CardholderName{providedFirstName=$providedFirstName, providedLastName=$providedLastName, providedMiddleName=$providedMiddleName, additionalProperties=$additionalProperties}" - } + /** The card verification code matched the one on file. */ + @JvmField val MATCH = of("match") - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** The card verification code did not match the one on file. */ + @JvmField val NO_MATCH = of("no_match") - return other is Verification && - cardVerificationCode == other.cardVerificationCode && - cardholderAddress == other.cardholderAddress && - cardholderName == other.cardholderName && - additionalProperties == other.additionalProperties - } + @JvmStatic fun of(value: String) = Result(JsonField.of(value)) + } - private val hashCode: Int by lazy { - Objects.hash( - cardVerificationCode, - cardholderAddress, - cardholderName, - additionalProperties, - ) - } + /** An enum containing [Result]'s known values. */ + enum class Known { + /** + * No card verification code was provided in the authorization request. + */ + NOT_CHECKED, + /** The card verification code matched the one on file. */ + MATCH, + /** The card verification code did not match the one on file. */ + NO_MATCH, + } - override fun hashCode(): Int = hashCode + /** + * An enum containing [Result]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Result] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** + * No card verification code was provided in the authorization request. + */ + NOT_CHECKED, + /** The card verification code matched the one on file. */ + MATCH, + /** The card verification code did not match the one on file. */ + NO_MATCH, + /** + * An enum member indicating that [Result] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - override fun toString() = - "Verification{cardVerificationCode=$cardVerificationCode, cardholderAddress=$cardholderAddress, cardholderName=$cardholderName, additionalProperties=$additionalProperties}" - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NOT_CHECKED -> Value.NOT_CHECKED + MATCH -> Value.MATCH + NO_MATCH -> Value.NO_MATCH + else -> Value._UNKNOWN + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + NOT_CHECKED -> Known.NOT_CHECKED + MATCH -> Known.MATCH + NO_MATCH -> Known.NO_MATCH + else -> throw IncreaseInvalidDataException("Unknown Result: $value") + } - return other is CardFinancial && - id == other.id && - actioner == other.actioner && - additionalAmounts == other.additionalAmounts && - amount == other.amount && - cardPaymentId == other.cardPaymentId && - currency == other.currency && - digitalWalletTokenId == other.digitalWalletTokenId && - direction == other.direction && - merchantAcceptorId == other.merchantAcceptorId && - merchantCategoryCode == other.merchantCategoryCode && - merchantCity == other.merchantCity && - merchantCountry == other.merchantCountry && - merchantDescriptor == other.merchantDescriptor && - merchantPostalCode == other.merchantPostalCode && - merchantState == other.merchantState && - networkDetails == other.networkDetails && - networkIdentifiers == other.networkIdentifiers && - networkRiskScore == other.networkRiskScore && - physicalCardId == other.physicalCardId && - presentmentAmount == other.presentmentAmount && - presentmentCurrency == other.presentmentCurrency && - processingCategory == other.processingCategory && - realTimeDecisionId == other.realTimeDecisionId && - terminalId == other.terminalId && - transactionId == other.transactionId && - type == other.type && - verification == other.verification && - additionalProperties == other.additionalProperties - } + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - private val hashCode: Int by lazy { - Objects.hash( - id, - actioner, - additionalAmounts, - amount, - cardPaymentId, - currency, - digitalWalletTokenId, - direction, - merchantAcceptorId, - merchantCategoryCode, - merchantCity, - merchantCountry, - merchantDescriptor, - merchantPostalCode, - merchantState, - networkDetails, - networkIdentifiers, - networkRiskScore, - physicalCardId, - presentmentAmount, - presentmentCurrency, - processingCategory, - realTimeDecisionId, - terminalId, - transactionId, - type, - verification, - additionalProperties, - ) - } + private var validated: Boolean = false - override fun hashCode(): Int = hashCode + fun validate(): Result = apply { + if (validated) { + return@apply + } - override fun toString() = - "CardFinancial{id=$id, actioner=$actioner, additionalAmounts=$additionalAmounts, amount=$amount, cardPaymentId=$cardPaymentId, currency=$currency, digitalWalletTokenId=$digitalWalletTokenId, direction=$direction, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkDetails=$networkDetails, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, physicalCardId=$physicalCardId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, processingCategory=$processingCategory, realTimeDecisionId=$realTimeDecisionId, terminalId=$terminalId, transactionId=$transactionId, type=$type, verification=$verification, additionalProperties=$additionalProperties}" - } + known() + validated = true + } - /** - * A Card Push Transfer Acceptance object. This field will be present in the JSON response - * if and only if `category` is equal to `card_push_transfer_acceptance`. A Card Push - * Transfer Acceptance is created when an Outbound Card Push Transfer sent from Increase is - * accepted by the receiving bank. - */ - class CardPushTransferAcceptance - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val settlementAmount: JsonField, - private val transferId: JsonField, - private val additionalProperties: MutableMap, - ) { + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - @JsonCreator - private constructor( - @JsonProperty("settlement_amount") - @ExcludeMissing - settlementAmount: JsonField = JsonMissing.of(), - @JsonProperty("transfer_id") - @ExcludeMissing - transferId: JsonField = JsonMissing.of(), - ) : this(settlementAmount, transferId, mutableMapOf()) + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - /** - * The transfer amount in USD cents. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun settlementAmount(): Long = settlementAmount.getRequired("settlement_amount") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * The identifier of the Card Push Transfer that led to this Transaction. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun transferId(): String = transferId.getRequired("transfer_id") + return other is Result && value == other.value + } - /** - * Returns the raw JSON value of [settlementAmount]. - * - * Unlike [settlementAmount], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("settlement_amount") - @ExcludeMissing - fun _settlementAmount(): JsonField = settlementAmount + override fun hashCode() = value.hashCode() - /** - * Returns the raw JSON value of [transferId]. - * - * Unlike [transferId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("transfer_id") - @ExcludeMissing - fun _transferId(): JsonField = transferId + override fun toString() = value.toString() + } - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + return other is CardVerificationCode && + result == other.result && + additionalProperties == other.additionalProperties + } - fun toBuilder() = Builder().from(this) + private val hashCode: Int by lazy { Objects.hash(result, additionalProperties) } - companion object { + override fun hashCode(): Int = hashCode + + override fun toString() = + "CardVerificationCode{result=$result, additionalProperties=$additionalProperties}" + } /** - * Returns a mutable builder for constructing an instance of - * [CardPushTransferAcceptance]. - * - * The following fields are required: - * ```java - * .settlementAmount() - * .transferId() - * ``` + * Cardholder address provided in the authorization request and the address on file + * we verified it against. */ - @JvmStatic fun builder() = Builder() - } + class CardholderAddress + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val actualLine1: JsonField, + private val actualPostalCode: JsonField, + private val providedLine1: JsonField, + private val providedPostalCode: JsonField, + private val result: JsonField, + private val additionalProperties: MutableMap, + ) { - /** A builder for [CardPushTransferAcceptance]. */ - class Builder internal constructor() { + @JsonCreator + private constructor( + @JsonProperty("actual_line1") + @ExcludeMissing + actualLine1: JsonField = JsonMissing.of(), + @JsonProperty("actual_postal_code") + @ExcludeMissing + actualPostalCode: JsonField = JsonMissing.of(), + @JsonProperty("provided_line1") + @ExcludeMissing + providedLine1: JsonField = JsonMissing.of(), + @JsonProperty("provided_postal_code") + @ExcludeMissing + providedPostalCode: JsonField = JsonMissing.of(), + @JsonProperty("result") + @ExcludeMissing + result: JsonField = JsonMissing.of(), + ) : this( + actualLine1, + actualPostalCode, + providedLine1, + providedPostalCode, + result, + mutableMapOf(), + ) - private var settlementAmount: JsonField? = null - private var transferId: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** + * Line 1 of the address on file for the cardholder. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun actualLine1(): Optional = actualLine1.getOptional("actual_line1") - @JvmSynthetic - internal fun from(cardPushTransferAcceptance: CardPushTransferAcceptance) = apply { - settlementAmount = cardPushTransferAcceptance.settlementAmount - transferId = cardPushTransferAcceptance.transferId - additionalProperties = - cardPushTransferAcceptance.additionalProperties.toMutableMap() - } + /** + * The postal code of the address on file for the cardholder. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun actualPostalCode(): Optional = + actualPostalCode.getOptional("actual_postal_code") - /** The transfer amount in USD cents. */ - fun settlementAmount(settlementAmount: Long) = - settlementAmount(JsonField.of(settlementAmount)) + /** + * The cardholder address line 1 provided for verification in the authorization + * request. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun providedLine1(): Optional = + providedLine1.getOptional("provided_line1") - /** - * Sets [Builder.settlementAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.settlementAmount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun settlementAmount(settlementAmount: JsonField) = apply { - this.settlementAmount = settlementAmount - } + /** + * The postal code provided for verification in the authorization request. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun providedPostalCode(): Optional = + providedPostalCode.getOptional("provided_postal_code") - /** The identifier of the Card Push Transfer that led to this Transaction. */ - fun transferId(transferId: String) = transferId(JsonField.of(transferId)) + /** + * The address verification result returned to the card network. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun result(): Result = result.getRequired("result") - /** - * Sets [Builder.transferId] to an arbitrary JSON value. - * - * You should usually call [Builder.transferId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun transferId(transferId: JsonField) = apply { - this.transferId = transferId - } + /** + * Returns the raw JSON value of [actualLine1]. + * + * Unlike [actualLine1], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("actual_line1") + @ExcludeMissing + fun _actualLine1(): JsonField = actualLine1 - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** + * Returns the raw JSON value of [actualPostalCode]. + * + * Unlike [actualPostalCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("actual_postal_code") + @ExcludeMissing + fun _actualPostalCode(): JsonField = actualPostalCode - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** + * Returns the raw JSON value of [providedLine1]. + * + * Unlike [providedLine1], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("provided_line1") + @ExcludeMissing + fun _providedLine1(): JsonField = providedLine1 - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + /** + * Returns the raw JSON value of [providedPostalCode]. + * + * Unlike [providedPostalCode], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("provided_postal_code") + @ExcludeMissing + fun _providedPostalCode(): JsonField = providedPostalCode + + /** + * Returns the raw JSON value of [result]. + * + * Unlike [result], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("result") + @ExcludeMissing + fun _result(): JsonField = result + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + fun toBuilder() = Builder().from(this) - /** - * Returns an immutable instance of [CardPushTransferAcceptance]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .settlementAmount() - * .transferId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CardPushTransferAcceptance = - CardPushTransferAcceptance( - checkRequired("settlementAmount", settlementAmount), - checkRequired("transferId", transferId), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false + companion object { - fun validate(): CardPushTransferAcceptance = apply { - if (validated) { - return@apply - } + /** + * Returns a mutable builder for constructing an instance of + * [CardholderAddress]. + * + * The following fields are required: + * ```java + * .actualLine1() + * .actualPostalCode() + * .providedLine1() + * .providedPostalCode() + * .result() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - settlementAmount() - transferId() - validated = true - } + /** A builder for [CardholderAddress]. */ + class Builder internal constructor() { - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + private var actualLine1: JsonField? = null + private var actualPostalCode: JsonField? = null + private var providedLine1: JsonField? = null + private var providedPostalCode: JsonField? = null + private var result: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (settlementAmount.asKnown().isPresent) 1 else 0) + - (if (transferId.asKnown().isPresent) 1 else 0) + @JvmSynthetic + internal fun from(cardholderAddress: CardholderAddress) = apply { + actualLine1 = cardholderAddress.actualLine1 + actualPostalCode = cardholderAddress.actualPostalCode + providedLine1 = cardholderAddress.providedLine1 + providedPostalCode = cardholderAddress.providedPostalCode + result = cardholderAddress.result + additionalProperties = + cardholderAddress.additionalProperties.toMutableMap() + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** Line 1 of the address on file for the cardholder. */ + fun actualLine1(actualLine1: String?) = + actualLine1(JsonField.ofNullable(actualLine1)) - return other is CardPushTransferAcceptance && - settlementAmount == other.settlementAmount && - transferId == other.transferId && - additionalProperties == other.additionalProperties - } + /** + * Alias for calling [Builder.actualLine1] with `actualLine1.orElse(null)`. + */ + fun actualLine1(actualLine1: Optional) = + actualLine1(actualLine1.getOrNull()) - private val hashCode: Int by lazy { - Objects.hash(settlementAmount, transferId, additionalProperties) - } + /** + * Sets [Builder.actualLine1] to an arbitrary JSON value. + * + * You should usually call [Builder.actualLine1] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun actualLine1(actualLine1: JsonField) = apply { + this.actualLine1 = actualLine1 + } - override fun hashCode(): Int = hashCode + /** The postal code of the address on file for the cardholder. */ + fun actualPostalCode(actualPostalCode: String?) = + actualPostalCode(JsonField.ofNullable(actualPostalCode)) - override fun toString() = - "CardPushTransferAcceptance{settlementAmount=$settlementAmount, transferId=$transferId, additionalProperties=$additionalProperties}" - } + /** + * Alias for calling [Builder.actualPostalCode] with + * `actualPostalCode.orElse(null)`. + */ + fun actualPostalCode(actualPostalCode: Optional) = + actualPostalCode(actualPostalCode.getOrNull()) - /** - * A Card Refund object. This field will be present in the JSON response if and only if - * `category` is equal to `card_refund`. Card Refunds move money back to the cardholder. - * While they are usually connected to a Card Settlement, an acquirer can also refund money - * directly to a card without relation to a transaction. - */ - class CardRefund - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val id: JsonField, - private val amount: JsonField, - private val cardPaymentId: JsonField, - private val cashback: JsonField, - private val currency: JsonField, - private val interchange: JsonField, - private val merchantAcceptorId: JsonField, - private val merchantCategoryCode: JsonField, - private val merchantCity: JsonField, - private val merchantCountry: JsonField, - private val merchantName: JsonField, - private val merchantPostalCode: JsonField, - private val merchantState: JsonField, - private val networkIdentifiers: JsonField, - private val presentmentAmount: JsonField, - private val presentmentCurrency: JsonField, - private val purchaseDetails: JsonField, - private val transactionId: JsonField, - private val type: JsonField, - private val additionalProperties: MutableMap, - ) { + /** + * Sets [Builder.actualPostalCode] to an arbitrary JSON value. + * + * You should usually call [Builder.actualPostalCode] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun actualPostalCode(actualPostalCode: JsonField) = apply { + this.actualPostalCode = actualPostalCode + } - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - @JsonProperty("card_payment_id") - @ExcludeMissing - cardPaymentId: JsonField = JsonMissing.of(), - @JsonProperty("cashback") - @ExcludeMissing - cashback: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - currency: JsonField = JsonMissing.of(), - @JsonProperty("interchange") - @ExcludeMissing - interchange: JsonField = JsonMissing.of(), - @JsonProperty("merchant_acceptor_id") - @ExcludeMissing - merchantAcceptorId: JsonField = JsonMissing.of(), - @JsonProperty("merchant_category_code") - @ExcludeMissing - merchantCategoryCode: JsonField = JsonMissing.of(), - @JsonProperty("merchant_city") - @ExcludeMissing - merchantCity: JsonField = JsonMissing.of(), - @JsonProperty("merchant_country") - @ExcludeMissing - merchantCountry: JsonField = JsonMissing.of(), - @JsonProperty("merchant_name") - @ExcludeMissing - merchantName: JsonField = JsonMissing.of(), - @JsonProperty("merchant_postal_code") - @ExcludeMissing - merchantPostalCode: JsonField = JsonMissing.of(), - @JsonProperty("merchant_state") - @ExcludeMissing - merchantState: JsonField = JsonMissing.of(), - @JsonProperty("network_identifiers") - @ExcludeMissing - networkIdentifiers: JsonField = JsonMissing.of(), - @JsonProperty("presentment_amount") - @ExcludeMissing - presentmentAmount: JsonField = JsonMissing.of(), - @JsonProperty("presentment_currency") - @ExcludeMissing - presentmentCurrency: JsonField = JsonMissing.of(), - @JsonProperty("purchase_details") - @ExcludeMissing - purchaseDetails: JsonField = JsonMissing.of(), - @JsonProperty("transaction_id") - @ExcludeMissing - transactionId: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - ) : this( - id, - amount, - cardPaymentId, - cashback, - currency, - interchange, - merchantAcceptorId, - merchantCategoryCode, - merchantCity, - merchantCountry, - merchantName, - merchantPostalCode, - merchantState, - networkIdentifiers, - presentmentAmount, - presentmentCurrency, - purchaseDetails, - transactionId, - type, - mutableMapOf(), - ) + /** + * The cardholder address line 1 provided for verification in the + * authorization request. + */ + fun providedLine1(providedLine1: String?) = + providedLine1(JsonField.ofNullable(providedLine1)) - /** - * The Card Refund identifier. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun id(): String = id.getRequired("id") + /** + * Alias for calling [Builder.providedLine1] with + * `providedLine1.orElse(null)`. + */ + fun providedLine1(providedLine1: Optional) = + providedLine1(providedLine1.getOrNull()) - /** - * The amount in the minor unit of the transaction's settlement currency. For dollars, - * for example, this is cents. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun amount(): Long = amount.getRequired("amount") + /** + * Sets [Builder.providedLine1] to an arbitrary JSON value. + * + * You should usually call [Builder.providedLine1] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun providedLine1(providedLine1: JsonField) = apply { + this.providedLine1 = providedLine1 + } - /** - * The ID of the Card Payment this transaction belongs to. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun cardPaymentId(): String = cardPaymentId.getRequired("card_payment_id") + /** + * The postal code provided for verification in the authorization request. + */ + fun providedPostalCode(providedPostalCode: String?) = + providedPostalCode(JsonField.ofNullable(providedPostalCode)) - /** - * Cashback debited for this transaction, if eligible. Cashback is paid out in - * aggregate, monthly. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun cashback(): Optional = cashback.getOptional("cashback") + /** + * Alias for calling [Builder.providedPostalCode] with + * `providedPostalCode.orElse(null)`. + */ + fun providedPostalCode(providedPostalCode: Optional) = + providedPostalCode(providedPostalCode.getOrNull()) - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's - * settlement currency. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun currency(): Currency = currency.getRequired("currency") + /** + * Sets [Builder.providedPostalCode] to an arbitrary JSON value. + * + * You should usually call [Builder.providedPostalCode] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun providedPostalCode(providedPostalCode: JsonField) = apply { + this.providedPostalCode = providedPostalCode + } - /** - * Interchange assessed as a part of this transaction. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun interchange(): Optional = interchange.getOptional("interchange") + /** The address verification result returned to the card network. */ + fun result(result: Result) = result(JsonField.of(result)) - /** - * The merchant identifier (commonly abbreviated as MID) of the merchant the card is - * transacting with. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun merchantAcceptorId(): String = - merchantAcceptorId.getRequired("merchant_acceptor_id") + /** + * Sets [Builder.result] to an arbitrary JSON value. + * + * You should usually call [Builder.result] with a well-typed [Result] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun result(result: JsonField) = apply { this.result = result } - /** - * The 4-digit MCC describing the merchant's business. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun merchantCategoryCode(): String = - merchantCategoryCode.getRequired("merchant_category_code") + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * The city the merchant resides in. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun merchantCity(): String = merchantCity.getRequired("merchant_city") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * The country the merchant resides in. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun merchantCountry(): String = merchantCountry.getRequired("merchant_country") + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } - /** - * The name of the merchant. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun merchantName(): String = merchantName.getRequired("merchant_name") + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * The merchant's postal code. For US merchants this is always a 5-digit ZIP code. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun merchantPostalCode(): Optional = - merchantPostalCode.getOptional("merchant_postal_code") + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * The state the merchant resides in. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun merchantState(): Optional = merchantState.getOptional("merchant_state") + /** + * Returns an immutable instance of [CardholderAddress]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .actualLine1() + * .actualPostalCode() + * .providedLine1() + * .providedPostalCode() + * .result() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CardholderAddress = + CardholderAddress( + checkRequired("actualLine1", actualLine1), + checkRequired("actualPostalCode", actualPostalCode), + checkRequired("providedLine1", providedLine1), + checkRequired("providedPostalCode", providedPostalCode), + checkRequired("result", result), + additionalProperties.toMutableMap(), + ) + } - /** - * Network-specific identifiers for this refund. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun networkIdentifiers(): NetworkIdentifiers = - networkIdentifiers.getRequired("network_identifiers") + private var validated: Boolean = false - /** - * The amount in the minor unit of the transaction's presentment currency. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun presentmentAmount(): Long = presentmentAmount.getRequired("presentment_amount") + fun validate(): CardholderAddress = apply { + if (validated) { + return@apply + } - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's - * presentment currency. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun presentmentCurrency(): String = - presentmentCurrency.getRequired("presentment_currency") + actualLine1() + actualPostalCode() + providedLine1() + providedPostalCode() + result().validate() + validated = true + } - /** - * Additional details about the card purchase, such as tax and industry-specific fields. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun purchaseDetails(): Optional = - purchaseDetails.getOptional("purchase_details") + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * The identifier of the Transaction associated with this Transaction. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun transactionId(): String = transactionId.getRequired("transaction_id") + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (actualLine1.asKnown().isPresent) 1 else 0) + + (if (actualPostalCode.asKnown().isPresent) 1 else 0) + + (if (providedLine1.asKnown().isPresent) 1 else 0) + + (if (providedPostalCode.asKnown().isPresent) 1 else 0) + + (result.asKnown().getOrNull()?.validity() ?: 0) - /** - * A constant representing the object's type. For this resource it will always be - * `card_refund`. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun type(): Type = type.getRequired("type") - - /** - * Returns the raw JSON value of [id]. - * - * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - - /** - * Returns the raw JSON value of [amount]. - * - * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + /** The address verification result returned to the card network. */ + class Result + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** - * Returns the raw JSON value of [cardPaymentId]. - * - * Unlike [cardPaymentId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("card_payment_id") - @ExcludeMissing - fun _cardPaymentId(): JsonField = cardPaymentId + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** - * Returns the raw JSON value of [cashback]. - * - * Unlike [cashback], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("cashback") - @ExcludeMissing - fun _cashback(): JsonField = cashback + companion object { - /** - * Returns the raw JSON value of [currency]. - * - * Unlike [currency], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("currency") - @ExcludeMissing - fun _currency(): JsonField = currency + /** No address information was provided in the authorization request. */ + @JvmField val NOT_CHECKED = of("not_checked") - /** - * Returns the raw JSON value of [interchange]. - * - * Unlike [interchange], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("interchange") - @ExcludeMissing - fun _interchange(): JsonField = interchange + /** + * Postal code matches, but the street address does not match or was not + * provided. + */ + @JvmField + val POSTAL_CODE_MATCH_ADDRESS_NO_MATCH = + of("postal_code_match_address_no_match") - /** - * Returns the raw JSON value of [merchantAcceptorId]. - * - * Unlike [merchantAcceptorId], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("merchant_acceptor_id") - @ExcludeMissing - fun _merchantAcceptorId(): JsonField = merchantAcceptorId + /** + * Postal code does not match, but the street address matches or was not + * provided. + */ + @JvmField + val POSTAL_CODE_NO_MATCH_ADDRESS_MATCH = + of("postal_code_no_match_address_match") - /** - * Returns the raw JSON value of [merchantCategoryCode]. - * - * Unlike [merchantCategoryCode], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("merchant_category_code") - @ExcludeMissing - fun _merchantCategoryCode(): JsonField = merchantCategoryCode + /** Postal code and street address match. */ + @JvmField val MATCH = of("match") - /** - * Returns the raw JSON value of [merchantCity]. - * - * Unlike [merchantCity], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("merchant_city") - @ExcludeMissing - fun _merchantCity(): JsonField = merchantCity + /** Postal code and street address do not match. */ + @JvmField val NO_MATCH = of("no_match") - /** - * Returns the raw JSON value of [merchantCountry]. - * - * Unlike [merchantCountry], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("merchant_country") - @ExcludeMissing - fun _merchantCountry(): JsonField = merchantCountry + /** + * Postal code matches, but the street address was not verified. + * (deprecated) + */ + @JvmField + val POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED = + of("postal_code_match_address_not_checked") - /** - * Returns the raw JSON value of [merchantName]. - * - * Unlike [merchantName], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("merchant_name") - @ExcludeMissing - fun _merchantName(): JsonField = merchantName + @JvmStatic fun of(value: String) = Result(JsonField.of(value)) + } - /** - * Returns the raw JSON value of [merchantPostalCode]. - * - * Unlike [merchantPostalCode], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("merchant_postal_code") - @ExcludeMissing - fun _merchantPostalCode(): JsonField = merchantPostalCode + /** An enum containing [Result]'s known values. */ + enum class Known { + /** No address information was provided in the authorization request. */ + NOT_CHECKED, + /** + * Postal code matches, but the street address does not match or was not + * provided. + */ + POSTAL_CODE_MATCH_ADDRESS_NO_MATCH, + /** + * Postal code does not match, but the street address matches or was not + * provided. + */ + POSTAL_CODE_NO_MATCH_ADDRESS_MATCH, + /** Postal code and street address match. */ + MATCH, + /** Postal code and street address do not match. */ + NO_MATCH, + /** + * Postal code matches, but the street address was not verified. + * (deprecated) + */ + POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED, + } - /** - * Returns the raw JSON value of [merchantState]. - * - * Unlike [merchantState], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("merchant_state") - @ExcludeMissing - fun _merchantState(): JsonField = merchantState + /** + * An enum containing [Result]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Result] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** No address information was provided in the authorization request. */ + NOT_CHECKED, + /** + * Postal code matches, but the street address does not match or was not + * provided. + */ + POSTAL_CODE_MATCH_ADDRESS_NO_MATCH, + /** + * Postal code does not match, but the street address matches or was not + * provided. + */ + POSTAL_CODE_NO_MATCH_ADDRESS_MATCH, + /** Postal code and street address match. */ + MATCH, + /** Postal code and street address do not match. */ + NO_MATCH, + /** + * Postal code matches, but the street address was not verified. + * (deprecated) + */ + POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED, + /** + * An enum member indicating that [Result] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** - * Returns the raw JSON value of [networkIdentifiers]. - * - * Unlike [networkIdentifiers], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("network_identifiers") - @ExcludeMissing - fun _networkIdentifiers(): JsonField = networkIdentifiers + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NOT_CHECKED -> Value.NOT_CHECKED + POSTAL_CODE_MATCH_ADDRESS_NO_MATCH -> + Value.POSTAL_CODE_MATCH_ADDRESS_NO_MATCH + POSTAL_CODE_NO_MATCH_ADDRESS_MATCH -> + Value.POSTAL_CODE_NO_MATCH_ADDRESS_MATCH + MATCH -> Value.MATCH + NO_MATCH -> Value.NO_MATCH + POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED -> + Value.POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED + else -> Value._UNKNOWN + } - /** - * Returns the raw JSON value of [presentmentAmount]. - * - * Unlike [presentmentAmount], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("presentment_amount") - @ExcludeMissing - fun _presentmentAmount(): JsonField = presentmentAmount - - /** - * Returns the raw JSON value of [presentmentCurrency]. - * - * Unlike [presentmentCurrency], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("presentment_currency") - @ExcludeMissing - fun _presentmentCurrency(): JsonField = presentmentCurrency - - /** - * Returns the raw JSON value of [purchaseDetails]. - * - * Unlike [purchaseDetails], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("purchase_details") - @ExcludeMissing - fun _purchaseDetails(): JsonField = purchaseDetails - - /** - * Returns the raw JSON value of [transactionId]. - * - * Unlike [transactionId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("transaction_id") - @ExcludeMissing - fun _transactionId(): JsonField = transactionId + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + NOT_CHECKED -> Known.NOT_CHECKED + POSTAL_CODE_MATCH_ADDRESS_NO_MATCH -> + Known.POSTAL_CODE_MATCH_ADDRESS_NO_MATCH + POSTAL_CODE_NO_MATCH_ADDRESS_MATCH -> + Known.POSTAL_CODE_NO_MATCH_ADDRESS_MATCH + MATCH -> Known.MATCH + NO_MATCH -> Known.NO_MATCH + POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED -> + Known.POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED + else -> throw IncreaseInvalidDataException("Unknown Result: $value") + } - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + private var validated: Boolean = false - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + fun validate(): Result = apply { + if (validated) { + return@apply + } - fun toBuilder() = Builder().from(this) + known() + validated = true + } - companion object { + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * Returns a mutable builder for constructing an instance of [CardRefund]. - * - * The following fields are required: - * ```java - * .id() - * .amount() - * .cardPaymentId() - * .cashback() - * .currency() - * .interchange() - * .merchantAcceptorId() - * .merchantCategoryCode() - * .merchantCity() - * .merchantCountry() - * .merchantName() - * .merchantPostalCode() - * .merchantState() - * .networkIdentifiers() - * .presentmentAmount() - * .presentmentCurrency() - * .purchaseDetails() - * .transactionId() - * .type() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - /** A builder for [CardRefund]. */ - class Builder internal constructor() { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - private var id: JsonField? = null - private var amount: JsonField? = null - private var cardPaymentId: JsonField? = null - private var cashback: JsonField? = null - private var currency: JsonField? = null - private var interchange: JsonField? = null - private var merchantAcceptorId: JsonField? = null - private var merchantCategoryCode: JsonField? = null - private var merchantCity: JsonField? = null - private var merchantCountry: JsonField? = null - private var merchantName: JsonField? = null - private var merchantPostalCode: JsonField? = null - private var merchantState: JsonField? = null - private var networkIdentifiers: JsonField? = null - private var presentmentAmount: JsonField? = null - private var presentmentCurrency: JsonField? = null - private var purchaseDetails: JsonField? = null - private var transactionId: JsonField? = null - private var type: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + return other is Result && value == other.value + } - @JvmSynthetic - internal fun from(cardRefund: CardRefund) = apply { - id = cardRefund.id - amount = cardRefund.amount - cardPaymentId = cardRefund.cardPaymentId - cashback = cardRefund.cashback - currency = cardRefund.currency - interchange = cardRefund.interchange - merchantAcceptorId = cardRefund.merchantAcceptorId - merchantCategoryCode = cardRefund.merchantCategoryCode - merchantCity = cardRefund.merchantCity - merchantCountry = cardRefund.merchantCountry - merchantName = cardRefund.merchantName - merchantPostalCode = cardRefund.merchantPostalCode - merchantState = cardRefund.merchantState - networkIdentifiers = cardRefund.networkIdentifiers - presentmentAmount = cardRefund.presentmentAmount - presentmentCurrency = cardRefund.presentmentCurrency - purchaseDetails = cardRefund.purchaseDetails - transactionId = cardRefund.transactionId - type = cardRefund.type - additionalProperties = cardRefund.additionalProperties.toMutableMap() - } + override fun hashCode() = value.hashCode() - /** The Card Refund identifier. */ - fun id(id: String) = id(JsonField.of(id)) + override fun toString() = value.toString() + } - /** - * Sets [Builder.id] to an arbitrary JSON value. - * - * You should usually call [Builder.id] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun id(id: JsonField) = apply { this.id = id } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * The amount in the minor unit of the transaction's settlement currency. For - * dollars, for example, this is cents. - */ - fun amount(amount: Long) = amount(JsonField.of(amount)) + return other is CardholderAddress && + actualLine1 == other.actualLine1 && + actualPostalCode == other.actualPostalCode && + providedLine1 == other.providedLine1 && + providedPostalCode == other.providedPostalCode && + result == other.result && + additionalProperties == other.additionalProperties + } - /** - * Sets [Builder.amount] to an arbitrary JSON value. - * - * You should usually call [Builder.amount] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } + private val hashCode: Int by lazy { + Objects.hash( + actualLine1, + actualPostalCode, + providedLine1, + providedPostalCode, + result, + additionalProperties, + ) + } - /** The ID of the Card Payment this transaction belongs to. */ - fun cardPaymentId(cardPaymentId: String) = - cardPaymentId(JsonField.of(cardPaymentId)) + override fun hashCode(): Int = hashCode - /** - * Sets [Builder.cardPaymentId] to an arbitrary JSON value. - * - * You should usually call [Builder.cardPaymentId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun cardPaymentId(cardPaymentId: JsonField) = apply { - this.cardPaymentId = cardPaymentId + override fun toString() = + "CardholderAddress{actualLine1=$actualLine1, actualPostalCode=$actualPostalCode, providedLine1=$providedLine1, providedPostalCode=$providedPostalCode, result=$result, additionalProperties=$additionalProperties}" } - /** - * Cashback debited for this transaction, if eligible. Cashback is paid out in - * aggregate, monthly. - */ - fun cashback(cashback: Cashback?) = cashback(JsonField.ofNullable(cashback)) + /** Cardholder name provided in the authorization request. */ + class CardholderName + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val providedFirstName: JsonField, + private val providedLastName: JsonField, + private val providedMiddleName: JsonField, + private val additionalProperties: MutableMap, + ) { - /** Alias for calling [Builder.cashback] with `cashback.orElse(null)`. */ - fun cashback(cashback: Optional) = cashback(cashback.getOrNull()) + @JsonCreator + private constructor( + @JsonProperty("provided_first_name") + @ExcludeMissing + providedFirstName: JsonField = JsonMissing.of(), + @JsonProperty("provided_last_name") + @ExcludeMissing + providedLastName: JsonField = JsonMissing.of(), + @JsonProperty("provided_middle_name") + @ExcludeMissing + providedMiddleName: JsonField = JsonMissing.of(), + ) : this( + providedFirstName, + providedLastName, + providedMiddleName, + mutableMapOf(), + ) - /** - * Sets [Builder.cashback] to an arbitrary JSON value. - * - * You should usually call [Builder.cashback] with a well-typed [Cashback] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun cashback(cashback: JsonField) = apply { this.cashback = cashback } + /** + * The first name provided for verification in the authorization request. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun providedFirstName(): Optional = + providedFirstName.getOptional("provided_first_name") - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's - * settlement currency. - */ - fun currency(currency: Currency) = currency(JsonField.of(currency)) + /** + * The last name provided for verification in the authorization request. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun providedLastName(): Optional = + providedLastName.getOptional("provided_last_name") - /** - * Sets [Builder.currency] to an arbitrary JSON value. - * - * You should usually call [Builder.currency] with a well-typed [Currency] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun currency(currency: JsonField) = apply { this.currency = currency } + /** + * The middle name provided for verification in the authorization request. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun providedMiddleName(): Optional = + providedMiddleName.getOptional("provided_middle_name") - /** Interchange assessed as a part of this transaction. */ - fun interchange(interchange: Interchange?) = - interchange(JsonField.ofNullable(interchange)) + /** + * Returns the raw JSON value of [providedFirstName]. + * + * Unlike [providedFirstName], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("provided_first_name") + @ExcludeMissing + fun _providedFirstName(): JsonField = providedFirstName - /** Alias for calling [Builder.interchange] with `interchange.orElse(null)`. */ - fun interchange(interchange: Optional) = - interchange(interchange.getOrNull()) + /** + * Returns the raw JSON value of [providedLastName]. + * + * Unlike [providedLastName], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("provided_last_name") + @ExcludeMissing + fun _providedLastName(): JsonField = providedLastName - /** - * Sets [Builder.interchange] to an arbitrary JSON value. - * - * You should usually call [Builder.interchange] with a well-typed [Interchange] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun interchange(interchange: JsonField) = apply { - this.interchange = interchange - } + /** + * Returns the raw JSON value of [providedMiddleName]. + * + * Unlike [providedMiddleName], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("provided_middle_name") + @ExcludeMissing + fun _providedMiddleName(): JsonField = providedMiddleName - /** - * The merchant identifier (commonly abbreviated as MID) of the merchant the card is - * transacting with. - */ - fun merchantAcceptorId(merchantAcceptorId: String) = - merchantAcceptorId(JsonField.of(merchantAcceptorId)) + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - /** - * Sets [Builder.merchantAcceptorId] to an arbitrary JSON value. - * - * You should usually call [Builder.merchantAcceptorId] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun merchantAcceptorId(merchantAcceptorId: JsonField) = apply { - this.merchantAcceptorId = merchantAcceptorId - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** The 4-digit MCC describing the merchant's business. */ - fun merchantCategoryCode(merchantCategoryCode: String) = - merchantCategoryCode(JsonField.of(merchantCategoryCode)) + fun toBuilder() = Builder().from(this) - /** - * Sets [Builder.merchantCategoryCode] to an arbitrary JSON value. - * - * You should usually call [Builder.merchantCategoryCode] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun merchantCategoryCode(merchantCategoryCode: JsonField) = apply { - this.merchantCategoryCode = merchantCategoryCode - } + companion object { - /** The city the merchant resides in. */ - fun merchantCity(merchantCity: String) = merchantCity(JsonField.of(merchantCity)) + /** + * Returns a mutable builder for constructing an instance of + * [CardholderName]. + * + * The following fields are required: + * ```java + * .providedFirstName() + * .providedLastName() + * .providedMiddleName() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - /** - * Sets [Builder.merchantCity] to an arbitrary JSON value. - * - * You should usually call [Builder.merchantCity] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun merchantCity(merchantCity: JsonField) = apply { - this.merchantCity = merchantCity - } + /** A builder for [CardholderName]. */ + class Builder internal constructor() { - /** The country the merchant resides in. */ - fun merchantCountry(merchantCountry: String) = - merchantCountry(JsonField.of(merchantCountry)) + private var providedFirstName: JsonField? = null + private var providedLastName: JsonField? = null + private var providedMiddleName: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() - /** - * Sets [Builder.merchantCountry] to an arbitrary JSON value. - * - * You should usually call [Builder.merchantCountry] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun merchantCountry(merchantCountry: JsonField) = apply { - this.merchantCountry = merchantCountry - } + @JvmSynthetic + internal fun from(cardholderName: CardholderName) = apply { + providedFirstName = cardholderName.providedFirstName + providedLastName = cardholderName.providedLastName + providedMiddleName = cardholderName.providedMiddleName + additionalProperties = + cardholderName.additionalProperties.toMutableMap() + } - /** The name of the merchant. */ - fun merchantName(merchantName: String) = merchantName(JsonField.of(merchantName)) + /** + * The first name provided for verification in the authorization request. + */ + fun providedFirstName(providedFirstName: String?) = + providedFirstName(JsonField.ofNullable(providedFirstName)) - /** - * Sets [Builder.merchantName] to an arbitrary JSON value. - * - * You should usually call [Builder.merchantName] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun merchantName(merchantName: JsonField) = apply { - this.merchantName = merchantName - } + /** + * Alias for calling [Builder.providedFirstName] with + * `providedFirstName.orElse(null)`. + */ + fun providedFirstName(providedFirstName: Optional) = + providedFirstName(providedFirstName.getOrNull()) - /** - * The merchant's postal code. For US merchants this is always a 5-digit ZIP code. - */ - fun merchantPostalCode(merchantPostalCode: String?) = - merchantPostalCode(JsonField.ofNullable(merchantPostalCode)) + /** + * Sets [Builder.providedFirstName] to an arbitrary JSON value. + * + * You should usually call [Builder.providedFirstName] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun providedFirstName(providedFirstName: JsonField) = apply { + this.providedFirstName = providedFirstName + } - /** - * Alias for calling [Builder.merchantPostalCode] with - * `merchantPostalCode.orElse(null)`. - */ - fun merchantPostalCode(merchantPostalCode: Optional) = - merchantPostalCode(merchantPostalCode.getOrNull()) + /** The last name provided for verification in the authorization request. */ + fun providedLastName(providedLastName: String?) = + providedLastName(JsonField.ofNullable(providedLastName)) - /** - * Sets [Builder.merchantPostalCode] to an arbitrary JSON value. - * - * You should usually call [Builder.merchantPostalCode] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun merchantPostalCode(merchantPostalCode: JsonField) = apply { - this.merchantPostalCode = merchantPostalCode - } - - /** The state the merchant resides in. */ - fun merchantState(merchantState: String?) = - merchantState(JsonField.ofNullable(merchantState)) + /** + * Alias for calling [Builder.providedLastName] with + * `providedLastName.orElse(null)`. + */ + fun providedLastName(providedLastName: Optional) = + providedLastName(providedLastName.getOrNull()) - /** Alias for calling [Builder.merchantState] with `merchantState.orElse(null)`. */ - fun merchantState(merchantState: Optional) = - merchantState(merchantState.getOrNull()) + /** + * Sets [Builder.providedLastName] to an arbitrary JSON value. + * + * You should usually call [Builder.providedLastName] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun providedLastName(providedLastName: JsonField) = apply { + this.providedLastName = providedLastName + } - /** - * Sets [Builder.merchantState] to an arbitrary JSON value. - * - * You should usually call [Builder.merchantState] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun merchantState(merchantState: JsonField) = apply { - this.merchantState = merchantState - } + /** + * The middle name provided for verification in the authorization request. + */ + fun providedMiddleName(providedMiddleName: String?) = + providedMiddleName(JsonField.ofNullable(providedMiddleName)) - /** Network-specific identifiers for this refund. */ - fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) = - networkIdentifiers(JsonField.of(networkIdentifiers)) + /** + * Alias for calling [Builder.providedMiddleName] with + * `providedMiddleName.orElse(null)`. + */ + fun providedMiddleName(providedMiddleName: Optional) = + providedMiddleName(providedMiddleName.getOrNull()) - /** - * Sets [Builder.networkIdentifiers] to an arbitrary JSON value. - * - * You should usually call [Builder.networkIdentifiers] with a well-typed - * [NetworkIdentifiers] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun networkIdentifiers(networkIdentifiers: JsonField) = apply { - this.networkIdentifiers = networkIdentifiers - } + /** + * Sets [Builder.providedMiddleName] to an arbitrary JSON value. + * + * You should usually call [Builder.providedMiddleName] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun providedMiddleName(providedMiddleName: JsonField) = apply { + this.providedMiddleName = providedMiddleName + } - /** The amount in the minor unit of the transaction's presentment currency. */ - fun presentmentAmount(presentmentAmount: Long) = - presentmentAmount(JsonField.of(presentmentAmount)) + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * Sets [Builder.presentmentAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.presentmentAmount] with a well-typed [Long] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun presentmentAmount(presentmentAmount: JsonField) = apply { - this.presentmentAmount = presentmentAmount - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's - * presentment currency. - */ - fun presentmentCurrency(presentmentCurrency: String) = - presentmentCurrency(JsonField.of(presentmentCurrency)) + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } - /** - * Sets [Builder.presentmentCurrency] to an arbitrary JSON value. - * - * You should usually call [Builder.presentmentCurrency] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun presentmentCurrency(presentmentCurrency: JsonField) = apply { - this.presentmentCurrency = presentmentCurrency - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * Additional details about the card purchase, such as tax and industry-specific - * fields. - */ - fun purchaseDetails(purchaseDetails: PurchaseDetails?) = - purchaseDetails(JsonField.ofNullable(purchaseDetails)) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * Alias for calling [Builder.purchaseDetails] with `purchaseDetails.orElse(null)`. - */ - fun purchaseDetails(purchaseDetails: Optional) = - purchaseDetails(purchaseDetails.getOrNull()) + /** + * Returns an immutable instance of [CardholderName]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .providedFirstName() + * .providedLastName() + * .providedMiddleName() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CardholderName = + CardholderName( + checkRequired("providedFirstName", providedFirstName), + checkRequired("providedLastName", providedLastName), + checkRequired("providedMiddleName", providedMiddleName), + additionalProperties.toMutableMap(), + ) + } - /** - * Sets [Builder.purchaseDetails] to an arbitrary JSON value. - * - * You should usually call [Builder.purchaseDetails] with a well-typed - * [PurchaseDetails] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. - */ - fun purchaseDetails(purchaseDetails: JsonField) = apply { - this.purchaseDetails = purchaseDetails - } + private var validated: Boolean = false - /** The identifier of the Transaction associated with this Transaction. */ - fun transactionId(transactionId: String) = - transactionId(JsonField.of(transactionId)) + fun validate(): CardholderName = apply { + if (validated) { + return@apply + } - /** - * Sets [Builder.transactionId] to an arbitrary JSON value. - * - * You should usually call [Builder.transactionId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun transactionId(transactionId: JsonField) = apply { - this.transactionId = transactionId - } + providedFirstName() + providedLastName() + providedMiddleName() + validated = true + } - /** - * A constant representing the object's type. For this resource it will always be - * `card_refund`. - */ - fun type(type: Type) = type(JsonField.of(type)) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * Sets [Builder.type] to an arbitrary JSON value. - * - * You should usually call [Builder.type] with a well-typed [Type] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun type(type: JsonField) = apply { this.type = type } + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (providedFirstName.asKnown().isPresent) 1 else 0) + + (if (providedLastName.asKnown().isPresent) 1 else 0) + + (if (providedMiddleName.asKnown().isPresent) 1 else 0) - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + return other is CardholderName && + providedFirstName == other.providedFirstName && + providedLastName == other.providedLastName && + providedMiddleName == other.providedMiddleName && + additionalProperties == other.additionalProperties + } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + private val hashCode: Int by lazy { + Objects.hash( + providedFirstName, + providedLastName, + providedMiddleName, + additionalProperties, + ) } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + override fun hashCode(): Int = hashCode - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + override fun toString() = + "CardholderName{providedFirstName=$providedFirstName, providedLastName=$providedLastName, providedMiddleName=$providedMiddleName, additionalProperties=$additionalProperties}" } - /** - * Returns an immutable instance of [CardRefund]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .amount() - * .cardPaymentId() - * .cashback() - * .currency() - * .interchange() - * .merchantAcceptorId() - * .merchantCategoryCode() - * .merchantCity() - * .merchantCountry() - * .merchantName() - * .merchantPostalCode() - * .merchantState() - * .networkIdentifiers() - * .presentmentAmount() - * .presentmentCurrency() - * .purchaseDetails() - * .transactionId() - * .type() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CardRefund = - CardRefund( - checkRequired("id", id), - checkRequired("amount", amount), - checkRequired("cardPaymentId", cardPaymentId), - checkRequired("cashback", cashback), - checkRequired("currency", currency), - checkRequired("interchange", interchange), - checkRequired("merchantAcceptorId", merchantAcceptorId), - checkRequired("merchantCategoryCode", merchantCategoryCode), - checkRequired("merchantCity", merchantCity), - checkRequired("merchantCountry", merchantCountry), - checkRequired("merchantName", merchantName), - checkRequired("merchantPostalCode", merchantPostalCode), - checkRequired("merchantState", merchantState), - checkRequired("networkIdentifiers", networkIdentifiers), - checkRequired("presentmentAmount", presentmentAmount), - checkRequired("presentmentCurrency", presentmentCurrency), - checkRequired("purchaseDetails", purchaseDetails), - checkRequired("transactionId", transactionId), - checkRequired("type", type), - additionalProperties.toMutableMap(), - ) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - private var validated: Boolean = false + return other is Verification && + cardVerificationCode == other.cardVerificationCode && + cardholderAddress == other.cardholderAddress && + cardholderName == other.cardholderName && + additionalProperties == other.additionalProperties + } - fun validate(): CardRefund = apply { - if (validated) { - return@apply + private val hashCode: Int by lazy { + Objects.hash( + cardVerificationCode, + cardholderAddress, + cardholderName, + additionalProperties, + ) } - id() - amount() - cardPaymentId() - cashback().ifPresent { it.validate() } - currency().validate() - interchange().ifPresent { it.validate() } - merchantAcceptorId() - merchantCategoryCode() - merchantCity() - merchantCountry() - merchantName() - merchantPostalCode() - merchantState() - networkIdentifiers().validate() - presentmentAmount() - presentmentCurrency() - purchaseDetails().ifPresent { it.validate() } - transactionId() - type().validate() - validated = true + override fun hashCode(): Int = hashCode + + override fun toString() = + "Verification{cardVerificationCode=$cardVerificationCode, cardholderAddress=$cardholderAddress, cardholderName=$cardholderName, additionalProperties=$additionalProperties}" } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } + return other is CardFinancial && + id == other.id && + actioner == other.actioner && + additionalAmounts == other.additionalAmounts && + amount == other.amount && + cardPaymentId == other.cardPaymentId && + currency == other.currency && + digitalWalletTokenId == other.digitalWalletTokenId && + direction == other.direction && + merchantAcceptorId == other.merchantAcceptorId && + merchantCategoryCode == other.merchantCategoryCode && + merchantCity == other.merchantCity && + merchantCountry == other.merchantCountry && + merchantDescriptor == other.merchantDescriptor && + merchantPostalCode == other.merchantPostalCode && + merchantState == other.merchantState && + networkDetails == other.networkDetails && + networkIdentifiers == other.networkIdentifiers && + networkRiskScore == other.networkRiskScore && + physicalCardId == other.physicalCardId && + presentmentAmount == other.presentmentAmount && + presentmentCurrency == other.presentmentCurrency && + processingCategory == other.processingCategory && + realTimeDecisionId == other.realTimeDecisionId && + schemeFees == other.schemeFees && + terminalId == other.terminalId && + transactionId == other.transactionId && + type == other.type && + verification == other.verification && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + actioner, + additionalAmounts, + amount, + cardPaymentId, + currency, + digitalWalletTokenId, + direction, + merchantAcceptorId, + merchantCategoryCode, + merchantCity, + merchantCountry, + merchantDescriptor, + merchantPostalCode, + merchantState, + networkDetails, + networkIdentifiers, + networkRiskScore, + physicalCardId, + presentmentAmount, + presentmentCurrency, + processingCategory, + realTimeDecisionId, + schemeFees, + terminalId, + transactionId, + type, + verification, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "CardFinancial{id=$id, actioner=$actioner, additionalAmounts=$additionalAmounts, amount=$amount, cardPaymentId=$cardPaymentId, currency=$currency, digitalWalletTokenId=$digitalWalletTokenId, direction=$direction, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkDetails=$networkDetails, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, physicalCardId=$physicalCardId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, processingCategory=$processingCategory, realTimeDecisionId=$realTimeDecisionId, schemeFees=$schemeFees, terminalId=$terminalId, transactionId=$transactionId, type=$type, verification=$verification, additionalProperties=$additionalProperties}" + } + + /** + * A Card Push Transfer Acceptance object. This field will be present in the JSON response + * if and only if `category` is equal to `card_push_transfer_acceptance`. A Card Push + * Transfer Acceptance is created when an Outbound Card Push Transfer sent from Increase is + * accepted by the receiving bank. + */ + class CardPushTransferAcceptance + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val settlementAmount: JsonField, + private val transferId: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("settlement_amount") + @ExcludeMissing + settlementAmount: JsonField = JsonMissing.of(), + @JsonProperty("transfer_id") + @ExcludeMissing + transferId: JsonField = JsonMissing.of(), + ) : this(settlementAmount, transferId, mutableMapOf()) + /** - * Returns a score indicating how many valid values are contained in this object - * recursively. + * The transfer amount in USD cents. * - * Used for best match union deserialization. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). */ - @JvmSynthetic - internal fun validity(): Int = - (if (id.asKnown().isPresent) 1 else 0) + - (if (amount.asKnown().isPresent) 1 else 0) + - (if (cardPaymentId.asKnown().isPresent) 1 else 0) + - (cashback.asKnown().getOrNull()?.validity() ?: 0) + - (currency.asKnown().getOrNull()?.validity() ?: 0) + - (interchange.asKnown().getOrNull()?.validity() ?: 0) + - (if (merchantAcceptorId.asKnown().isPresent) 1 else 0) + - (if (merchantCategoryCode.asKnown().isPresent) 1 else 0) + - (if (merchantCity.asKnown().isPresent) 1 else 0) + - (if (merchantCountry.asKnown().isPresent) 1 else 0) + - (if (merchantName.asKnown().isPresent) 1 else 0) + - (if (merchantPostalCode.asKnown().isPresent) 1 else 0) + - (if (merchantState.asKnown().isPresent) 1 else 0) + - (networkIdentifiers.asKnown().getOrNull()?.validity() ?: 0) + - (if (presentmentAmount.asKnown().isPresent) 1 else 0) + - (if (presentmentCurrency.asKnown().isPresent) 1 else 0) + - (purchaseDetails.asKnown().getOrNull()?.validity() ?: 0) + - (if (transactionId.asKnown().isPresent) 1 else 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) + fun settlementAmount(): Long = settlementAmount.getRequired("settlement_amount") /** - * Cashback debited for this transaction, if eligible. Cashback is paid out in - * aggregate, monthly. + * The identifier of the Card Push Transfer that led to this Transaction. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). */ - class Cashback - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val amount: JsonField, - private val currency: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("amount") - @ExcludeMissing - amount: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - currency: JsonField = JsonMissing.of(), - ) : this(amount, currency, mutableMapOf()) + fun transferId(): String = transferId.getRequired("transfer_id") - /** - * The cashback amount given as a string containing a decimal number. The amount is - * a positive number if it will be credited to you (e.g., settlements) and a - * negative number if it will be debited (e.g., refunds). - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). - */ - fun amount(): String = amount.getRequired("amount") + /** + * Returns the raw JSON value of [settlementAmount]. + * + * Unlike [settlementAmount], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("settlement_amount") + @ExcludeMissing + fun _settlementAmount(): JsonField = settlementAmount + + /** + * Returns the raw JSON value of [transferId]. + * + * Unlike [transferId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("transfer_id") + @ExcludeMissing + fun _transferId(): JsonField = transferId + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the cashback. + * Returns a mutable builder for constructing an instance of + * [CardPushTransferAcceptance]. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). + * The following fields are required: + * ```java + * .settlementAmount() + * .transferId() + * ``` */ - fun currency(): Currency = currency.getRequired("currency") + @JvmStatic fun builder() = Builder() + } + + /** A builder for [CardPushTransferAcceptance]. */ + class Builder internal constructor() { + + private var settlementAmount: JsonField? = null + private var transferId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(cardPushTransferAcceptance: CardPushTransferAcceptance) = apply { + settlementAmount = cardPushTransferAcceptance.settlementAmount + transferId = cardPushTransferAcceptance.transferId + additionalProperties = + cardPushTransferAcceptance.additionalProperties.toMutableMap() + } + + /** The transfer amount in USD cents. */ + fun settlementAmount(settlementAmount: Long) = + settlementAmount(JsonField.of(settlementAmount)) /** - * Returns the raw JSON value of [amount]. + * Sets [Builder.settlementAmount] to an arbitrary JSON value. * - * Unlike [amount], this method doesn't throw if the JSON field has an unexpected - * type. + * You should usually call [Builder.settlementAmount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + fun settlementAmount(settlementAmount: JsonField) = apply { + this.settlementAmount = settlementAmount + } + + /** The identifier of the Card Push Transfer that led to this Transaction. */ + fun transferId(transferId: String) = transferId(JsonField.of(transferId)) /** - * Returns the raw JSON value of [currency]. + * Sets [Builder.transferId] to an arbitrary JSON value. * - * Unlike [currency], this method doesn't throw if the JSON field has an unexpected - * type. + * You should usually call [Builder.transferId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - @JsonProperty("currency") - @ExcludeMissing - fun _currency(): JsonField = currency - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) + fun transferId(transferId: JsonField) = apply { + this.transferId = transferId } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun toBuilder() = Builder().from(this) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - companion object { + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** - * Returns a mutable builder for constructing an instance of [Cashback]. - * - * The following fields are required: - * ```java - * .amount() - * .currency() - * ``` - */ - @JvmStatic fun builder() = Builder() + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) } - /** A builder for [Cashback]. */ - class Builder internal constructor() { + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - private var amount: JsonField? = null - private var currency: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** + * Returns an immutable instance of [CardPushTransferAcceptance]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .settlementAmount() + * .transferId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CardPushTransferAcceptance = + CardPushTransferAcceptance( + checkRequired("settlementAmount", settlementAmount), + checkRequired("transferId", transferId), + additionalProperties.toMutableMap(), + ) + } - @JvmSynthetic - internal fun from(cashback: Cashback) = apply { - amount = cashback.amount - currency = cashback.currency - additionalProperties = cashback.additionalProperties.toMutableMap() - } + private var validated: Boolean = false - /** - * The cashback amount given as a string containing a decimal number. The amount - * is a positive number if it will be credited to you (e.g., settlements) and a - * negative number if it will be debited (e.g., refunds). - */ - fun amount(amount: String) = amount(JsonField.of(amount)) + fun validate(): CardPushTransferAcceptance = apply { + if (validated) { + return@apply + } - /** - * Sets [Builder.amount] to an arbitrary JSON value. - * - * You should usually call [Builder.amount] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } + settlementAmount() + transferId() + validated = true + } - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the cashback. - */ - fun currency(currency: Currency) = currency(JsonField.of(currency)) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * Sets [Builder.currency] to an arbitrary JSON value. - * - * You should usually call [Builder.currency] with a well-typed [Currency] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun currency(currency: JsonField) = apply { this.currency = currency } + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (settlementAmount.asKnown().isPresent) 1 else 0) + + (if (transferId.asKnown().isPresent) 1 else 0) - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + return other is CardPushTransferAcceptance && + settlementAmount == other.settlementAmount && + transferId == other.transferId && + additionalProperties == other.additionalProperties + } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + private val hashCode: Int by lazy { + Objects.hash(settlementAmount, transferId, additionalProperties) + } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + override fun hashCode(): Int = hashCode - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + override fun toString() = + "CardPushTransferAcceptance{settlementAmount=$settlementAmount, transferId=$transferId, additionalProperties=$additionalProperties}" + } - /** - * Returns an immutable instance of [Cashback]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .amount() - * .currency() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Cashback = - Cashback( - checkRequired("amount", amount), - checkRequired("currency", currency), - additionalProperties.toMutableMap(), - ) - } + /** + * A Card Refund object. This field will be present in the JSON response if and only if + * `category` is equal to `card_refund`. Card Refunds move money back to the cardholder. + * While they are usually connected to a Card Settlement, an acquirer can also refund money + * directly to a card without relation to a transaction. + */ + class CardRefund + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val amount: JsonField, + private val cardPaymentId: JsonField, + private val cashback: JsonField, + private val currency: JsonField, + private val interchange: JsonField, + private val merchantAcceptorId: JsonField, + private val merchantCategoryCode: JsonField, + private val merchantCity: JsonField, + private val merchantCountry: JsonField, + private val merchantName: JsonField, + private val merchantPostalCode: JsonField, + private val merchantState: JsonField, + private val networkIdentifiers: JsonField, + private val presentmentAmount: JsonField, + private val presentmentCurrency: JsonField, + private val purchaseDetails: JsonField, + private val schemeFees: JsonField>, + private val transactionId: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, + ) { - private var validated: Boolean = false + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), + @JsonProperty("card_payment_id") + @ExcludeMissing + cardPaymentId: JsonField = JsonMissing.of(), + @JsonProperty("cashback") + @ExcludeMissing + cashback: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("interchange") + @ExcludeMissing + interchange: JsonField = JsonMissing.of(), + @JsonProperty("merchant_acceptor_id") + @ExcludeMissing + merchantAcceptorId: JsonField = JsonMissing.of(), + @JsonProperty("merchant_category_code") + @ExcludeMissing + merchantCategoryCode: JsonField = JsonMissing.of(), + @JsonProperty("merchant_city") + @ExcludeMissing + merchantCity: JsonField = JsonMissing.of(), + @JsonProperty("merchant_country") + @ExcludeMissing + merchantCountry: JsonField = JsonMissing.of(), + @JsonProperty("merchant_name") + @ExcludeMissing + merchantName: JsonField = JsonMissing.of(), + @JsonProperty("merchant_postal_code") + @ExcludeMissing + merchantPostalCode: JsonField = JsonMissing.of(), + @JsonProperty("merchant_state") + @ExcludeMissing + merchantState: JsonField = JsonMissing.of(), + @JsonProperty("network_identifiers") + @ExcludeMissing + networkIdentifiers: JsonField = JsonMissing.of(), + @JsonProperty("presentment_amount") + @ExcludeMissing + presentmentAmount: JsonField = JsonMissing.of(), + @JsonProperty("presentment_currency") + @ExcludeMissing + presentmentCurrency: JsonField = JsonMissing.of(), + @JsonProperty("purchase_details") + @ExcludeMissing + purchaseDetails: JsonField = JsonMissing.of(), + @JsonProperty("scheme_fees") + @ExcludeMissing + schemeFees: JsonField> = JsonMissing.of(), + @JsonProperty("transaction_id") + @ExcludeMissing + transactionId: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this( + id, + amount, + cardPaymentId, + cashback, + currency, + interchange, + merchantAcceptorId, + merchantCategoryCode, + merchantCity, + merchantCountry, + merchantName, + merchantPostalCode, + merchantState, + networkIdentifiers, + presentmentAmount, + presentmentCurrency, + purchaseDetails, + schemeFees, + transactionId, + type, + mutableMapOf(), + ) - fun validate(): Cashback = apply { - if (validated) { - return@apply - } + /** + * The Card Refund identifier. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun id(): String = id.getRequired("id") - amount() - currency().validate() - validated = true - } + /** + * The amount in the minor unit of the transaction's settlement currency. For dollars, + * for example, this is cents. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun amount(): Long = amount.getRequired("amount") - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * The ID of the Card Payment this transaction belongs to. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun cardPaymentId(): String = cardPaymentId.getRequired("card_payment_id") - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (amount.asKnown().isPresent) 1 else 0) + - (currency.asKnown().getOrNull()?.validity() ?: 0) + /** + * Cashback debited for this transaction, if eligible. Cashback is paid out in + * aggregate, monthly. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun cashback(): Optional = cashback.getOptional("cashback") - /** The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the cashback. */ - class Currency - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's + * settlement currency. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun currency(): Currency = currency.getRequired("currency") - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + /** + * Interchange assessed as a part of this transaction. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun interchange(): Optional = interchange.getOptional("interchange") - companion object { + /** + * The merchant identifier (commonly abbreviated as MID) of the merchant the card is + * transacting with. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun merchantAcceptorId(): String = + merchantAcceptorId.getRequired("merchant_acceptor_id") - /** US Dollar (USD) */ - @JvmField val USD = of("USD") + /** + * The 4-digit MCC describing the merchant's business. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun merchantCategoryCode(): String = + merchantCategoryCode.getRequired("merchant_category_code") - @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) - } + /** + * The city the merchant resides in. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun merchantCity(): String = merchantCity.getRequired("merchant_city") - /** An enum containing [Currency]'s known values. */ - enum class Known { - /** US Dollar (USD) */ - USD - } + /** + * The country the merchant resides in. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun merchantCountry(): String = merchantCountry.getRequired("merchant_country") - /** - * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [Currency] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** US Dollar (USD) */ - USD, - /** - * An enum member indicating that [Currency] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USD -> Value.USD - else -> Value._UNKNOWN - } + /** + * The name of the merchant. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun merchantName(): String = merchantName.getRequired("merchant_name") - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a not - * a known member. - */ - fun known(): Known = - when (this) { - USD -> Known.USD - else -> throw IncreaseInvalidDataException("Unknown Currency: $value") - } + /** + * The merchant's postal code. For US merchants this is always a 5-digit ZIP code. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun merchantPostalCode(): Optional = + merchantPostalCode.getOptional("merchant_postal_code") - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + /** + * The state the merchant resides in. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun merchantState(): Optional = merchantState.getOptional("merchant_state") - private var validated: Boolean = false + /** + * Network-specific identifiers for this refund. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun networkIdentifiers(): NetworkIdentifiers = + networkIdentifiers.getRequired("network_identifiers") - fun validate(): Currency = apply { - if (validated) { - return@apply - } + /** + * The amount in the minor unit of the transaction's presentment currency. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun presentmentAmount(): Long = presentmentAmount.getRequired("presentment_amount") - known() - validated = true - } + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's + * presentment currency. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun presentmentCurrency(): String = + presentmentCurrency.getRequired("presentment_currency") - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * Additional details about the card purchase, such as tax and industry-specific fields. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun purchaseDetails(): Optional = + purchaseDetails.getOptional("purchase_details") - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + /** + * The scheme fees associated with this card refund. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun schemeFees(): List = schemeFees.getRequired("scheme_fees") - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * The identifier of the Transaction associated with this Transaction. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun transactionId(): String = transactionId.getRequired("transaction_id") - return other is Currency && value == other.value - } + /** + * A constant representing the object's type. For this resource it will always be + * `card_refund`. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun type(): Type = type.getRequired("type") - override fun hashCode() = value.hashCode() + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - override fun toString() = value.toString() - } + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Returns the raw JSON value of [cardPaymentId]. + * + * Unlike [cardPaymentId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("card_payment_id") + @ExcludeMissing + fun _cardPaymentId(): JsonField = cardPaymentId - return other is Cashback && - amount == other.amount && - currency == other.currency && - additionalProperties == other.additionalProperties - } + /** + * Returns the raw JSON value of [cashback]. + * + * Unlike [cashback], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("cashback") + @ExcludeMissing + fun _cashback(): JsonField = cashback - private val hashCode: Int by lazy { - Objects.hash(amount, currency, additionalProperties) - } + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("currency") + @ExcludeMissing + fun _currency(): JsonField = currency - override fun hashCode(): Int = hashCode + /** + * Returns the raw JSON value of [interchange]. + * + * Unlike [interchange], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("interchange") + @ExcludeMissing + fun _interchange(): JsonField = interchange - override fun toString() = - "Cashback{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" - } + /** + * Returns the raw JSON value of [merchantAcceptorId]. + * + * Unlike [merchantAcceptorId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("merchant_acceptor_id") + @ExcludeMissing + fun _merchantAcceptorId(): JsonField = merchantAcceptorId /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's - * settlement currency. + * Returns the raw JSON value of [merchantCategoryCode]. + * + * Unlike [merchantCategoryCode], this method doesn't throw if the JSON field has an + * unexpected type. */ - class Currency @JsonCreator private constructor(private val value: JsonField) : - Enum { + @JsonProperty("merchant_category_code") + @ExcludeMissing + fun _merchantCategoryCode(): JsonField = merchantCategoryCode - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - /** US Dollar (USD) */ - @JvmField val USD = of("USD") - - @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) - } - - /** An enum containing [Currency]'s known values. */ - enum class Known { - /** US Dollar (USD) */ - USD - } - - /** - * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Currency] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** US Dollar (USD) */ - USD, - /** - * An enum member indicating that [Currency] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } + /** + * Returns the raw JSON value of [merchantCity]. + * + * Unlike [merchantCity], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("merchant_city") + @ExcludeMissing + fun _merchantCity(): JsonField = merchantCity - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USD -> Value.USD - else -> Value._UNKNOWN - } + /** + * Returns the raw JSON value of [merchantCountry]. + * + * Unlike [merchantCountry], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("merchant_country") + @ExcludeMissing + fun _merchantCountry(): JsonField = merchantCountry - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - USD -> Known.USD - else -> throw IncreaseInvalidDataException("Unknown Currency: $value") - } + /** + * Returns the raw JSON value of [merchantName]. + * + * Unlike [merchantName], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("merchant_name") + @ExcludeMissing + fun _merchantName(): JsonField = merchantName - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + /** + * Returns the raw JSON value of [merchantPostalCode]. + * + * Unlike [merchantPostalCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("merchant_postal_code") + @ExcludeMissing + fun _merchantPostalCode(): JsonField = merchantPostalCode - private var validated: Boolean = false + /** + * Returns the raw JSON value of [merchantState]. + * + * Unlike [merchantState], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("merchant_state") + @ExcludeMissing + fun _merchantState(): JsonField = merchantState - fun validate(): Currency = apply { - if (validated) { - return@apply - } + /** + * Returns the raw JSON value of [networkIdentifiers]. + * + * Unlike [networkIdentifiers], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("network_identifiers") + @ExcludeMissing + fun _networkIdentifiers(): JsonField = networkIdentifiers - known() - validated = true - } + /** + * Returns the raw JSON value of [presentmentAmount]. + * + * Unlike [presentmentAmount], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("presentment_amount") + @ExcludeMissing + fun _presentmentAmount(): JsonField = presentmentAmount - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * Returns the raw JSON value of [presentmentCurrency]. + * + * Unlike [presentmentCurrency], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("presentment_currency") + @ExcludeMissing + fun _presentmentCurrency(): JsonField = presentmentCurrency - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + /** + * Returns the raw JSON value of [purchaseDetails]. + * + * Unlike [purchaseDetails], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("purchase_details") + @ExcludeMissing + fun _purchaseDetails(): JsonField = purchaseDetails - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Returns the raw JSON value of [schemeFees]. + * + * Unlike [schemeFees], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("scheme_fees") + @ExcludeMissing + fun _schemeFees(): JsonField> = schemeFees - return other is Currency && value == other.value - } + /** + * Returns the raw JSON value of [transactionId]. + * + * Unlike [transactionId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("transaction_id") + @ExcludeMissing + fun _transactionId(): JsonField = transactionId - override fun hashCode() = value.hashCode() + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - override fun toString() = value.toString() + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) } - /** Interchange assessed as a part of this transaction. */ - class Interchange - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val amount: JsonField, - private val code: JsonField, - private val currency: JsonField, - private val additionalProperties: MutableMap, - ) { + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - @JsonCreator - private constructor( - @JsonProperty("amount") - @ExcludeMissing - amount: JsonField = JsonMissing.of(), - @JsonProperty("code") - @ExcludeMissing - code: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - currency: JsonField = JsonMissing.of(), - ) : this(amount, code, currency, mutableMapOf()) + fun toBuilder() = Builder().from(this) - /** - * The interchange amount given as a string containing a decimal number in major - * units (so e.g., "3.14" for $3.14). The amount is a positive number if it is - * credited to Increase (e.g., settlements) and a negative number if it is debited - * (e.g., refunds). - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). - */ - fun amount(): String = amount.getRequired("amount") + companion object { /** - * The card network specific interchange code. + * Returns a mutable builder for constructing an instance of [CardRefund]. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * The following fields are required: + * ```java + * .id() + * .amount() + * .cardPaymentId() + * .cashback() + * .currency() + * .interchange() + * .merchantAcceptorId() + * .merchantCategoryCode() + * .merchantCity() + * .merchantCountry() + * .merchantName() + * .merchantPostalCode() + * .merchantState() + * .networkIdentifiers() + * .presentmentAmount() + * .presentmentCurrency() + * .purchaseDetails() + * .schemeFees() + * .transactionId() + * .type() + * ``` */ - fun code(): Optional = code.getOptional("code") + @JvmStatic fun builder() = Builder() + } + + /** A builder for [CardRefund]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var amount: JsonField? = null + private var cardPaymentId: JsonField? = null + private var cashback: JsonField? = null + private var currency: JsonField? = null + private var interchange: JsonField? = null + private var merchantAcceptorId: JsonField? = null + private var merchantCategoryCode: JsonField? = null + private var merchantCity: JsonField? = null + private var merchantCountry: JsonField? = null + private var merchantName: JsonField? = null + private var merchantPostalCode: JsonField? = null + private var merchantState: JsonField? = null + private var networkIdentifiers: JsonField? = null + private var presentmentAmount: JsonField? = null + private var presentmentCurrency: JsonField? = null + private var purchaseDetails: JsonField? = null + private var schemeFees: JsonField>? = null + private var transactionId: JsonField? = null + private var type: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(cardRefund: CardRefund) = apply { + id = cardRefund.id + amount = cardRefund.amount + cardPaymentId = cardRefund.cardPaymentId + cashback = cardRefund.cashback + currency = cardRefund.currency + interchange = cardRefund.interchange + merchantAcceptorId = cardRefund.merchantAcceptorId + merchantCategoryCode = cardRefund.merchantCategoryCode + merchantCity = cardRefund.merchantCity + merchantCountry = cardRefund.merchantCountry + merchantName = cardRefund.merchantName + merchantPostalCode = cardRefund.merchantPostalCode + merchantState = cardRefund.merchantState + networkIdentifiers = cardRefund.networkIdentifiers + presentmentAmount = cardRefund.presentmentAmount + presentmentCurrency = cardRefund.presentmentCurrency + purchaseDetails = cardRefund.purchaseDetails + schemeFees = cardRefund.schemeFees.map { it.toMutableList() } + transactionId = cardRefund.transactionId + type = cardRefund.type + additionalProperties = cardRefund.additionalProperties.toMutableMap() + } + + /** The Card Refund identifier. */ + fun id(id: String) = id(JsonField.of(id)) /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the interchange - * reimbursement. + * Sets [Builder.id] to an arbitrary JSON value. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun currency(): Currency = currency.getRequired("currency") + fun id(id: JsonField) = apply { this.id = id } /** - * Returns the raw JSON value of [amount]. - * - * Unlike [amount], this method doesn't throw if the JSON field has an unexpected - * type. + * The amount in the minor unit of the transaction's settlement currency. For + * dollars, for example, this is cents. */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + fun amount(amount: Long) = amount(JsonField.of(amount)) /** - * Returns the raw JSON value of [code]. + * Sets [Builder.amount] to an arbitrary JSON value. * - * Unlike [code], this method doesn't throw if the JSON field has an unexpected - * type. + * You should usually call [Builder.amount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - @JsonProperty("code") @ExcludeMissing fun _code(): JsonField = code + fun amount(amount: JsonField) = apply { this.amount = amount } + + /** The ID of the Card Payment this transaction belongs to. */ + fun cardPaymentId(cardPaymentId: String) = + cardPaymentId(JsonField.of(cardPaymentId)) /** - * Returns the raw JSON value of [currency]. + * Sets [Builder.cardPaymentId] to an arbitrary JSON value. * - * Unlike [currency], this method doesn't throw if the JSON field has an unexpected - * type. + * You should usually call [Builder.cardPaymentId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - @JsonProperty("currency") - @ExcludeMissing - fun _currency(): JsonField = currency - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) + fun cardPaymentId(cardPaymentId: JsonField) = apply { + this.cardPaymentId = cardPaymentId } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** + * Cashback debited for this transaction, if eligible. Cashback is paid out in + * aggregate, monthly. + */ + fun cashback(cashback: Cashback?) = cashback(JsonField.ofNullable(cashback)) - fun toBuilder() = Builder().from(this) + /** Alias for calling [Builder.cashback] with `cashback.orElse(null)`. */ + fun cashback(cashback: Optional) = cashback(cashback.getOrNull()) - companion object { + /** + * Sets [Builder.cashback] to an arbitrary JSON value. + * + * You should usually call [Builder.cashback] with a well-typed [Cashback] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun cashback(cashback: JsonField) = apply { this.cashback = cashback } - /** - * Returns a mutable builder for constructing an instance of [Interchange]. - * - * The following fields are required: - * ```java - * .amount() - * .code() - * .currency() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's + * settlement currency. + */ + fun currency(currency: Currency) = currency(JsonField.of(currency)) - /** A builder for [Interchange]. */ - class Builder internal constructor() { + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [Currency] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } - private var amount: JsonField? = null - private var code: JsonField? = null - private var currency: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** Interchange assessed as a part of this transaction. */ + fun interchange(interchange: Interchange?) = + interchange(JsonField.ofNullable(interchange)) - @JvmSynthetic - internal fun from(interchange: Interchange) = apply { - amount = interchange.amount - code = interchange.code - currency = interchange.currency - additionalProperties = interchange.additionalProperties.toMutableMap() - } + /** Alias for calling [Builder.interchange] with `interchange.orElse(null)`. */ + fun interchange(interchange: Optional) = + interchange(interchange.getOrNull()) - /** - * The interchange amount given as a string containing a decimal number in major - * units (so e.g., "3.14" for $3.14). The amount is a positive number if it is - * credited to Increase (e.g., settlements) and a negative number if it is - * debited (e.g., refunds). - */ - fun amount(amount: String) = amount(JsonField.of(amount)) + /** + * Sets [Builder.interchange] to an arbitrary JSON value. + * + * You should usually call [Builder.interchange] with a well-typed [Interchange] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun interchange(interchange: JsonField) = apply { + this.interchange = interchange + } - /** - * Sets [Builder.amount] to an arbitrary JSON value. - * - * You should usually call [Builder.amount] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } + /** + * The merchant identifier (commonly abbreviated as MID) of the merchant the card is + * transacting with. + */ + fun merchantAcceptorId(merchantAcceptorId: String) = + merchantAcceptorId(JsonField.of(merchantAcceptorId)) - /** The card network specific interchange code. */ - fun code(code: String?) = code(JsonField.ofNullable(code)) + /** + * Sets [Builder.merchantAcceptorId] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantAcceptorId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun merchantAcceptorId(merchantAcceptorId: JsonField) = apply { + this.merchantAcceptorId = merchantAcceptorId + } - /** Alias for calling [Builder.code] with `code.orElse(null)`. */ - fun code(code: Optional) = code(code.getOrNull()) + /** The 4-digit MCC describing the merchant's business. */ + fun merchantCategoryCode(merchantCategoryCode: String) = + merchantCategoryCode(JsonField.of(merchantCategoryCode)) - /** - * Sets [Builder.code] to an arbitrary JSON value. - * - * You should usually call [Builder.code] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun code(code: JsonField) = apply { this.code = code } + /** + * Sets [Builder.merchantCategoryCode] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantCategoryCode] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun merchantCategoryCode(merchantCategoryCode: JsonField) = apply { + this.merchantCategoryCode = merchantCategoryCode + } - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - * interchange reimbursement. - */ - fun currency(currency: Currency) = currency(JsonField.of(currency)) + /** The city the merchant resides in. */ + fun merchantCity(merchantCity: String) = merchantCity(JsonField.of(merchantCity)) - /** - * Sets [Builder.currency] to an arbitrary JSON value. - * - * You should usually call [Builder.currency] with a well-typed [Currency] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun currency(currency: JsonField) = apply { this.currency = currency } + /** + * Sets [Builder.merchantCity] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantCity] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun merchantCity(merchantCity: JsonField) = apply { + this.merchantCity = merchantCity + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** The country the merchant resides in. */ + fun merchantCountry(merchantCountry: String) = + merchantCountry(JsonField.of(merchantCountry)) - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** + * Sets [Builder.merchantCountry] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantCountry] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun merchantCountry(merchantCountry: JsonField) = apply { + this.merchantCountry = merchantCountry + } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + /** The name of the merchant. */ + fun merchantName(merchantName: String) = merchantName(JsonField.of(merchantName)) - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** + * Sets [Builder.merchantName] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun merchantName(merchantName: JsonField) = apply { + this.merchantName = merchantName + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** + * The merchant's postal code. For US merchants this is always a 5-digit ZIP code. + */ + fun merchantPostalCode(merchantPostalCode: String?) = + merchantPostalCode(JsonField.ofNullable(merchantPostalCode)) - /** - * Returns an immutable instance of [Interchange]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .amount() - * .code() - * .currency() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Interchange = - Interchange( - checkRequired("amount", amount), - checkRequired("code", code), - checkRequired("currency", currency), - additionalProperties.toMutableMap(), - ) + /** + * Alias for calling [Builder.merchantPostalCode] with + * `merchantPostalCode.orElse(null)`. + */ + fun merchantPostalCode(merchantPostalCode: Optional) = + merchantPostalCode(merchantPostalCode.getOrNull()) + + /** + * Sets [Builder.merchantPostalCode] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantPostalCode] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun merchantPostalCode(merchantPostalCode: JsonField) = apply { + this.merchantPostalCode = merchantPostalCode } - private var validated: Boolean = false + /** The state the merchant resides in. */ + fun merchantState(merchantState: String?) = + merchantState(JsonField.ofNullable(merchantState)) - fun validate(): Interchange = apply { - if (validated) { - return@apply - } + /** Alias for calling [Builder.merchantState] with `merchantState.orElse(null)`. */ + fun merchantState(merchantState: Optional) = + merchantState(merchantState.getOrNull()) - amount() - code() - currency().validate() - validated = true + /** + * Sets [Builder.merchantState] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantState] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun merchantState(merchantState: JsonField) = apply { + this.merchantState = merchantState } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** Network-specific identifiers for this refund. */ + fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) = + networkIdentifiers(JsonField.of(networkIdentifiers)) /** - * Returns a score indicating how many valid values are contained in this object - * recursively. + * Sets [Builder.networkIdentifiers] to an arbitrary JSON value. * - * Used for best match union deserialization. + * You should usually call [Builder.networkIdentifiers] with a well-typed + * [NetworkIdentifiers] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - @JvmSynthetic - internal fun validity(): Int = - (if (amount.asKnown().isPresent) 1 else 0) + - (if (code.asKnown().isPresent) 1 else 0) + - (currency.asKnown().getOrNull()?.validity() ?: 0) + fun networkIdentifiers(networkIdentifiers: JsonField) = apply { + this.networkIdentifiers = networkIdentifiers + } + + /** The amount in the minor unit of the transaction's presentment currency. */ + fun presentmentAmount(presentmentAmount: Long) = + presentmentAmount(JsonField.of(presentmentAmount)) /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the interchange - * reimbursement. + * Sets [Builder.presentmentAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.presentmentAmount] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. */ - class Currency - @JsonCreator - private constructor(private val value: JsonField) : Enum { + fun presentmentAmount(presentmentAmount: JsonField) = apply { + this.presentmentAmount = presentmentAmount + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's + * presentment currency. + */ + fun presentmentCurrency(presentmentCurrency: String) = + presentmentCurrency(JsonField.of(presentmentCurrency)) - companion object { + /** + * Sets [Builder.presentmentCurrency] to an arbitrary JSON value. + * + * You should usually call [Builder.presentmentCurrency] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun presentmentCurrency(presentmentCurrency: JsonField) = apply { + this.presentmentCurrency = presentmentCurrency + } - /** US Dollar (USD) */ - @JvmField val USD = of("USD") + /** + * Additional details about the card purchase, such as tax and industry-specific + * fields. + */ + fun purchaseDetails(purchaseDetails: PurchaseDetails?) = + purchaseDetails(JsonField.ofNullable(purchaseDetails)) - @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) - } + /** + * Alias for calling [Builder.purchaseDetails] with `purchaseDetails.orElse(null)`. + */ + fun purchaseDetails(purchaseDetails: Optional) = + purchaseDetails(purchaseDetails.getOrNull()) - /** An enum containing [Currency]'s known values. */ - enum class Known { - /** US Dollar (USD) */ - USD - } + /** + * Sets [Builder.purchaseDetails] to an arbitrary JSON value. + * + * You should usually call [Builder.purchaseDetails] with a well-typed + * [PurchaseDetails] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun purchaseDetails(purchaseDetails: JsonField) = apply { + this.purchaseDetails = purchaseDetails + } - /** - * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [Currency] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** US Dollar (USD) */ - USD, - /** - * An enum member indicating that [Currency] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - USD -> Value.USD - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a not - * a known member. - */ - fun known(): Known = - when (this) { - USD -> Known.USD - else -> throw IncreaseInvalidDataException("Unknown Currency: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Currency = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Currency && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Interchange && - amount == other.amount && - code == other.code && - currency == other.currency && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(amount, code, currency, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Interchange{amount=$amount, code=$code, currency=$currency, additionalProperties=$additionalProperties}" - } - - /** Network-specific identifiers for this refund. */ - class NetworkIdentifiers - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val acquirerBusinessId: JsonField, - private val acquirerReferenceNumber: JsonField, - private val authorizationIdentificationResponse: JsonField, - private val transactionId: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("acquirer_business_id") - @ExcludeMissing - acquirerBusinessId: JsonField = JsonMissing.of(), - @JsonProperty("acquirer_reference_number") - @ExcludeMissing - acquirerReferenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("authorization_identification_response") - @ExcludeMissing - authorizationIdentificationResponse: JsonField = JsonMissing.of(), - @JsonProperty("transaction_id") - @ExcludeMissing - transactionId: JsonField = JsonMissing.of(), - ) : this( - acquirerBusinessId, - acquirerReferenceNumber, - authorizationIdentificationResponse, - transactionId, - mutableMapOf(), - ) - - /** - * A network assigned business ID that identifies the acquirer that processed this - * transaction. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). - */ - fun acquirerBusinessId(): String = - acquirerBusinessId.getRequired("acquirer_business_id") + /** The scheme fees associated with this card refund. */ + fun schemeFees(schemeFees: List) = schemeFees(JsonField.of(schemeFees)) /** - * A globally unique identifier for this settlement. + * Sets [Builder.schemeFees] to an arbitrary JSON value. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). + * You should usually call [Builder.schemeFees] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. */ - fun acquirerReferenceNumber(): String = - acquirerReferenceNumber.getRequired("acquirer_reference_number") + fun schemeFees(schemeFees: JsonField>) = apply { + this.schemeFees = schemeFees.map { it.toMutableList() } + } /** - * The randomly generated 6-character Authorization Identification Response code - * sent back to the acquirer in an approved response. + * Adds a single [SchemeFee] to [schemeFees]. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * @throws IllegalStateException if the field was previously set to a non-list. */ - fun authorizationIdentificationResponse(): Optional = - authorizationIdentificationResponse.getOptional( - "authorization_identification_response" - ) + fun addSchemeFee(schemeFee: SchemeFee) = apply { + schemeFees = + (schemeFees ?: JsonField.of(mutableListOf())).also { + checkKnown("schemeFees", it).add(schemeFee) + } + } - /** - * A globally unique transaction identifier provided by the card network, used - * across multiple life-cycle requests. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun transactionId(): Optional = transactionId.getOptional("transaction_id") + /** The identifier of the Transaction associated with this Transaction. */ + fun transactionId(transactionId: String) = + transactionId(JsonField.of(transactionId)) /** - * Returns the raw JSON value of [acquirerBusinessId]. + * Sets [Builder.transactionId] to an arbitrary JSON value. * - * Unlike [acquirerBusinessId], this method doesn't throw if the JSON field has an - * unexpected type. + * You should usually call [Builder.transactionId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - @JsonProperty("acquirer_business_id") - @ExcludeMissing - fun _acquirerBusinessId(): JsonField = acquirerBusinessId + fun transactionId(transactionId: JsonField) = apply { + this.transactionId = transactionId + } /** - * Returns the raw JSON value of [acquirerReferenceNumber]. - * - * Unlike [acquirerReferenceNumber], this method doesn't throw if the JSON field has - * an unexpected type. + * A constant representing the object's type. For this resource it will always be + * `card_refund`. */ - @JsonProperty("acquirer_reference_number") - @ExcludeMissing - fun _acquirerReferenceNumber(): JsonField = acquirerReferenceNumber + fun type(type: Type) = type(JsonField.of(type)) /** - * Returns the raw JSON value of [authorizationIdentificationResponse]. + * Sets [Builder.type] to an arbitrary JSON value. * - * Unlike [authorizationIdentificationResponse], this method doesn't throw if the - * JSON field has an unexpected type. + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - @JsonProperty("authorization_identification_response") - @ExcludeMissing - fun _authorizationIdentificationResponse(): JsonField = - authorizationIdentificationResponse + fun type(type: JsonField) = apply { this.type = type } - /** - * Returns the raw JSON value of [transactionId]. - * - * Unlike [transactionId], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("transaction_id") - @ExcludeMissing - fun _transactionId(): JsonField = transactionId + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { + fun putAdditionalProperty(key: String, value: JsonValue) = apply { additionalProperties.put(key, value) } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - companion object { + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * Returns a mutable builder for constructing an instance of - * [NetworkIdentifiers]. - * - * The following fields are required: - * ```java - * .acquirerBusinessId() - * .acquirerReferenceNumber() - * .authorizationIdentificationResponse() - * .transactionId() - * ``` - */ - @JvmStatic fun builder() = Builder() + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } - /** A builder for [NetworkIdentifiers]. */ - class Builder internal constructor() { + /** + * Returns an immutable instance of [CardRefund]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .amount() + * .cardPaymentId() + * .cashback() + * .currency() + * .interchange() + * .merchantAcceptorId() + * .merchantCategoryCode() + * .merchantCity() + * .merchantCountry() + * .merchantName() + * .merchantPostalCode() + * .merchantState() + * .networkIdentifiers() + * .presentmentAmount() + * .presentmentCurrency() + * .purchaseDetails() + * .schemeFees() + * .transactionId() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CardRefund = + CardRefund( + checkRequired("id", id), + checkRequired("amount", amount), + checkRequired("cardPaymentId", cardPaymentId), + checkRequired("cashback", cashback), + checkRequired("currency", currency), + checkRequired("interchange", interchange), + checkRequired("merchantAcceptorId", merchantAcceptorId), + checkRequired("merchantCategoryCode", merchantCategoryCode), + checkRequired("merchantCity", merchantCity), + checkRequired("merchantCountry", merchantCountry), + checkRequired("merchantName", merchantName), + checkRequired("merchantPostalCode", merchantPostalCode), + checkRequired("merchantState", merchantState), + checkRequired("networkIdentifiers", networkIdentifiers), + checkRequired("presentmentAmount", presentmentAmount), + checkRequired("presentmentCurrency", presentmentCurrency), + checkRequired("purchaseDetails", purchaseDetails), + checkRequired("schemeFees", schemeFees).map { it.toImmutable() }, + checkRequired("transactionId", transactionId), + checkRequired("type", type), + additionalProperties.toMutableMap(), + ) + } - private var acquirerBusinessId: JsonField? = null - private var acquirerReferenceNumber: JsonField? = null - private var authorizationIdentificationResponse: JsonField? = null - private var transactionId: JsonField? = null + private var validated: Boolean = false + + fun validate(): CardRefund = apply { + if (validated) { + return@apply + } + + id() + amount() + cardPaymentId() + cashback().ifPresent { it.validate() } + currency().validate() + interchange().ifPresent { it.validate() } + merchantAcceptorId() + merchantCategoryCode() + merchantCity() + merchantCountry() + merchantName() + merchantPostalCode() + merchantState() + networkIdentifiers().validate() + presentmentAmount() + presentmentCurrency() + purchaseDetails().ifPresent { it.validate() } + schemeFees().forEach { it.validate() } + transactionId() + type().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (amount.asKnown().isPresent) 1 else 0) + + (if (cardPaymentId.asKnown().isPresent) 1 else 0) + + (cashback.asKnown().getOrNull()?.validity() ?: 0) + + (currency.asKnown().getOrNull()?.validity() ?: 0) + + (interchange.asKnown().getOrNull()?.validity() ?: 0) + + (if (merchantAcceptorId.asKnown().isPresent) 1 else 0) + + (if (merchantCategoryCode.asKnown().isPresent) 1 else 0) + + (if (merchantCity.asKnown().isPresent) 1 else 0) + + (if (merchantCountry.asKnown().isPresent) 1 else 0) + + (if (merchantName.asKnown().isPresent) 1 else 0) + + (if (merchantPostalCode.asKnown().isPresent) 1 else 0) + + (if (merchantState.asKnown().isPresent) 1 else 0) + + (networkIdentifiers.asKnown().getOrNull()?.validity() ?: 0) + + (if (presentmentAmount.asKnown().isPresent) 1 else 0) + + (if (presentmentCurrency.asKnown().isPresent) 1 else 0) + + (purchaseDetails.asKnown().getOrNull()?.validity() ?: 0) + + (schemeFees.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (transactionId.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + /** + * Cashback debited for this transaction, if eligible. Cashback is paid out in + * aggregate, monthly. + */ + class Cashback + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) + + /** + * The cashback amount given as a string containing a decimal number. The amount is + * a positive number if it will be credited to you (e.g., settlements) and a + * negative number if it will be debited (e.g., refunds). + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun amount(): String = amount.getRequired("amount") + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the cashback. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun currency(): Currency = currency.getRequired("currency") + + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("currency") + @ExcludeMissing + fun _currency(): JsonField = currency + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Cashback]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Cashback]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(networkIdentifiers: NetworkIdentifiers) = apply { - acquirerBusinessId = networkIdentifiers.acquirerBusinessId - acquirerReferenceNumber = networkIdentifiers.acquirerReferenceNumber - authorizationIdentificationResponse = - networkIdentifiers.authorizationIdentificationResponse - transactionId = networkIdentifiers.transactionId - additionalProperties = - networkIdentifiers.additionalProperties.toMutableMap() + internal fun from(cashback: Cashback) = apply { + amount = cashback.amount + currency = cashback.currency + additionalProperties = cashback.additionalProperties.toMutableMap() } /** - * A network assigned business ID that identifies the acquirer that processed - * this transaction. + * The cashback amount given as a string containing a decimal number. The amount + * is a positive number if it will be credited to you (e.g., settlements) and a + * negative number if it will be debited (e.g., refunds). */ - fun acquirerBusinessId(acquirerBusinessId: String) = - acquirerBusinessId(JsonField.of(acquirerBusinessId)) + fun amount(amount: String) = amount(JsonField.of(amount)) /** - * Sets [Builder.acquirerBusinessId] to an arbitrary JSON value. + * Sets [Builder.amount] to an arbitrary JSON value. * - * You should usually call [Builder.acquirerBusinessId] with a well-typed - * [String] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * You should usually call [Builder.amount] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - fun acquirerBusinessId(acquirerBusinessId: JsonField) = apply { - this.acquirerBusinessId = acquirerBusinessId - } + fun amount(amount: JsonField) = apply { this.amount = amount } - /** A globally unique identifier for this settlement. */ - fun acquirerReferenceNumber(acquirerReferenceNumber: String) = - acquirerReferenceNumber(JsonField.of(acquirerReferenceNumber)) + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the cashback. + */ + fun currency(currency: Currency) = currency(JsonField.of(currency)) /** - * Sets [Builder.acquirerReferenceNumber] to an arbitrary JSON value. + * Sets [Builder.currency] to an arbitrary JSON value. * - * You should usually call [Builder.acquirerReferenceNumber] with a well-typed - * [String] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun acquirerReferenceNumber(acquirerReferenceNumber: JsonField) = - apply { - this.acquirerReferenceNumber = acquirerReferenceNumber - } - - /** - * The randomly generated 6-character Authorization Identification Response code - * sent back to the acquirer in an approved response. - */ - fun authorizationIdentificationResponse( - authorizationIdentificationResponse: String? - ) = - authorizationIdentificationResponse( - JsonField.ofNullable(authorizationIdentificationResponse) - ) - - /** - * Alias for calling [Builder.authorizationIdentificationResponse] with - * `authorizationIdentificationResponse.orElse(null)`. - */ - fun authorizationIdentificationResponse( - authorizationIdentificationResponse: Optional - ) = - authorizationIdentificationResponse( - authorizationIdentificationResponse.getOrNull() - ) - - /** - * Sets [Builder.authorizationIdentificationResponse] to an arbitrary JSON - * value. - * - * You should usually call [Builder.authorizationIdentificationResponse] with a - * well-typed [String] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun authorizationIdentificationResponse( - authorizationIdentificationResponse: JsonField - ) = apply { - this.authorizationIdentificationResponse = - authorizationIdentificationResponse - } - - /** - * A globally unique transaction identifier provided by the card network, used - * across multiple life-cycle requests. - */ - fun transactionId(transactionId: String?) = - transactionId(JsonField.ofNullable(transactionId)) - - /** - * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`. - */ - fun transactionId(transactionId: Optional) = - transactionId(transactionId.getOrNull()) - - /** - * Sets [Builder.transactionId] to an arbitrary JSON value. - * - * You should usually call [Builder.transactionId] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * You should usually call [Builder.currency] with a well-typed [Currency] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - fun transactionId(transactionId: JsonField) = apply { - this.transactionId = transactionId - } + fun currency(currency: JsonField) = apply { this.currency = currency } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -20569,44 +20975,35 @@ private constructor( } /** - * Returns an immutable instance of [NetworkIdentifiers]. + * Returns an immutable instance of [Cashback]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .acquirerBusinessId() - * .acquirerReferenceNumber() - * .authorizationIdentificationResponse() - * .transactionId() + * .amount() + * .currency() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): NetworkIdentifiers = - NetworkIdentifiers( - checkRequired("acquirerBusinessId", acquirerBusinessId), - checkRequired("acquirerReferenceNumber", acquirerReferenceNumber), - checkRequired( - "authorizationIdentificationResponse", - authorizationIdentificationResponse, - ), - checkRequired("transactionId", transactionId), + fun build(): Cashback = + Cashback( + checkRequired("amount", amount), + checkRequired("currency", currency), additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): NetworkIdentifiers = apply { + fun validate(): Cashback = apply { if (validated) { return@apply } - acquirerBusinessId() - acquirerReferenceNumber() - authorizationIdentificationResponse() - transactionId() + amount() + currency().validate() validated = true } @@ -20626,294 +21023,373 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (acquirerBusinessId.asKnown().isPresent) 1 else 0) + - (if (acquirerReferenceNumber.asKnown().isPresent) 1 else 0) + - (if (authorizationIdentificationResponse.asKnown().isPresent) 1 else 0) + - (if (transactionId.asKnown().isPresent) 1 else 0) + (if (amount.asKnown().isPresent) 1 else 0) + + (currency.asKnown().getOrNull()?.validity() ?: 0) + + /** The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the cashback. */ + class Currency + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** US Dollar (USD) */ + @JvmField val USD = of("USD") + + @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) + } + + /** An enum containing [Currency]'s known values. */ + enum class Known { + /** US Dollar (USD) */ + USD + } + + /** + * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Currency] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** US Dollar (USD) */ + USD, + /** + * An enum member indicating that [Currency] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + USD -> Value.USD + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + USD -> Known.USD + else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Currency = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Currency && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is NetworkIdentifiers && - acquirerBusinessId == other.acquirerBusinessId && - acquirerReferenceNumber == other.acquirerReferenceNumber && - authorizationIdentificationResponse == - other.authorizationIdentificationResponse && - transactionId == other.transactionId && + return other is Cashback && + amount == other.amount && + currency == other.currency && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash( - acquirerBusinessId, - acquirerReferenceNumber, - authorizationIdentificationResponse, - transactionId, - additionalProperties, - ) + Objects.hash(amount, currency, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "NetworkIdentifiers{acquirerBusinessId=$acquirerBusinessId, acquirerReferenceNumber=$acquirerReferenceNumber, authorizationIdentificationResponse=$authorizationIdentificationResponse, transactionId=$transactionId, additionalProperties=$additionalProperties}" + "Cashback{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" } /** - * Additional details about the card purchase, such as tax and industry-specific fields. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's + * settlement currency. */ - class PurchaseDetails - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val carRental: JsonField, - private val customerReferenceIdentifier: JsonField, - private val localTaxAmount: JsonField, - private val localTaxCurrency: JsonField, - private val lodging: JsonField, - private val nationalTaxAmount: JsonField, - private val nationalTaxCurrency: JsonField, - private val purchaseIdentifier: JsonField, - private val purchaseIdentifierFormat: JsonField, - private val travel: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("car_rental") - @ExcludeMissing - carRental: JsonField = JsonMissing.of(), - @JsonProperty("customer_reference_identifier") - @ExcludeMissing - customerReferenceIdentifier: JsonField = JsonMissing.of(), - @JsonProperty("local_tax_amount") - @ExcludeMissing - localTaxAmount: JsonField = JsonMissing.of(), - @JsonProperty("local_tax_currency") - @ExcludeMissing - localTaxCurrency: JsonField = JsonMissing.of(), - @JsonProperty("lodging") - @ExcludeMissing - lodging: JsonField = JsonMissing.of(), - @JsonProperty("national_tax_amount") - @ExcludeMissing - nationalTaxAmount: JsonField = JsonMissing.of(), - @JsonProperty("national_tax_currency") - @ExcludeMissing - nationalTaxCurrency: JsonField = JsonMissing.of(), - @JsonProperty("purchase_identifier") - @ExcludeMissing - purchaseIdentifier: JsonField = JsonMissing.of(), - @JsonProperty("purchase_identifier_format") - @ExcludeMissing - purchaseIdentifierFormat: JsonField = - JsonMissing.of(), - @JsonProperty("travel") - @ExcludeMissing - travel: JsonField = JsonMissing.of(), - ) : this( - carRental, - customerReferenceIdentifier, - localTaxAmount, - localTaxCurrency, - lodging, - nationalTaxAmount, - nationalTaxCurrency, - purchaseIdentifier, - purchaseIdentifierFormat, - travel, - mutableMapOf(), - ) + class Currency @JsonCreator private constructor(private val value: JsonField) : + Enum { /** - * Fields specific to car rentals. + * Returns this class instance's raw value. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. */ - fun carRental(): Optional = carRental.getOptional("car_rental") + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + /** US Dollar (USD) */ + @JvmField val USD = of("USD") + + @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) + } + + /** An enum containing [Currency]'s known values. */ + enum class Known { + /** US Dollar (USD) */ + USD + } /** - * An identifier from the merchant for the customer or consumer. + * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] member. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * An instance of [Currency] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. */ - fun customerReferenceIdentifier(): Optional = - customerReferenceIdentifier.getOptional("customer_reference_identifier") + enum class Value { + /** US Dollar (USD) */ + USD, + /** + * An enum member indicating that [Currency] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } /** - * The state or provincial tax amount in minor units. + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. */ - fun localTaxAmount(): Optional = - localTaxAmount.getOptional("local_tax_amount") + fun value(): Value = + when (this) { + USD -> Value.USD + else -> Value._UNKNOWN + } /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax - * assessed. + * Returns an enum member corresponding to this class instance's value. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not a + * known member. */ - fun localTaxCurrency(): Optional = - localTaxCurrency.getOptional("local_tax_currency") + fun known(): Known = + when (this) { + USD -> Known.USD + else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + } /** - * Fields specific to lodging. + * Returns this class instance's primitive wire representation. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not have + * the expected primitive type. */ - fun lodging(): Optional = lodging.getOptional("lodging") + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Currency = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } /** - * The national tax amount in minor units. + * Returns a score indicating how many valid values are contained in this object + * recursively. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * Used for best match union deserialization. */ - fun nationalTaxAmount(): Optional = - nationalTaxAmount.getOptional("national_tax_amount") + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Currency && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Interchange assessed as a part of this transaction. */ + class Interchange + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val amount: JsonField, + private val code: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("code") + @ExcludeMissing + code: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, code, currency, mutableMapOf()) /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax - * assessed. + * The interchange amount given as a string containing a decimal number in major + * units (so e.g., "3.14" for $3.14). The amount is a positive number if it is + * credited to Increase (e.g., settlements) and a negative number if it is debited + * (e.g., refunds). * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). */ - fun nationalTaxCurrency(): Optional = - nationalTaxCurrency.getOptional("national_tax_currency") + fun amount(): String = amount.getRequired("amount") /** - * An identifier from the merchant for the purchase to the issuer and cardholder. + * The card network specific interchange code. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun purchaseIdentifier(): Optional = - purchaseIdentifier.getOptional("purchase_identifier") + fun code(): Optional = code.getOptional("code") /** - * The format of the purchase identifier. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the interchange + * reimbursement. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). */ - fun purchaseIdentifierFormat(): Optional = - purchaseIdentifierFormat.getOptional("purchase_identifier_format") + fun currency(): Currency = currency.getRequired("currency") /** - * Fields specific to travel. + * Returns the raw JSON value of [amount]. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun travel(): Optional = travel.getOptional("travel") - - /** - * Returns the raw JSON value of [carRental]. - * - * Unlike [carRental], this method doesn't throw if the JSON field has an unexpected + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("car_rental") - @ExcludeMissing - fun _carRental(): JsonField = carRental - - /** - * Returns the raw JSON value of [customerReferenceIdentifier]. - * - * Unlike [customerReferenceIdentifier], this method doesn't throw if the JSON field - * has an unexpected type. - */ - @JsonProperty("customer_reference_identifier") - @ExcludeMissing - fun _customerReferenceIdentifier(): JsonField = customerReferenceIdentifier - - /** - * Returns the raw JSON value of [localTaxAmount]. - * - * Unlike [localTaxAmount], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("local_tax_amount") - @ExcludeMissing - fun _localTaxAmount(): JsonField = localTaxAmount - - /** - * Returns the raw JSON value of [localTaxCurrency]. - * - * Unlike [localTaxCurrency], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("local_tax_currency") - @ExcludeMissing - fun _localTaxCurrency(): JsonField = localTaxCurrency + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount /** - * Returns the raw JSON value of [lodging]. + * Returns the raw JSON value of [code]. * - * Unlike [lodging], this method doesn't throw if the JSON field has an unexpected + * Unlike [code], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("lodging") - @ExcludeMissing - fun _lodging(): JsonField = lodging - - /** - * Returns the raw JSON value of [nationalTaxAmount]. - * - * Unlike [nationalTaxAmount], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("national_tax_amount") - @ExcludeMissing - fun _nationalTaxAmount(): JsonField = nationalTaxAmount - - /** - * Returns the raw JSON value of [nationalTaxCurrency]. - * - * Unlike [nationalTaxCurrency], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("national_tax_currency") - @ExcludeMissing - fun _nationalTaxCurrency(): JsonField = nationalTaxCurrency - - /** - * Returns the raw JSON value of [purchaseIdentifier]. - * - * Unlike [purchaseIdentifier], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("purchase_identifier") - @ExcludeMissing - fun _purchaseIdentifier(): JsonField = purchaseIdentifier - - /** - * Returns the raw JSON value of [purchaseIdentifierFormat]. - * - * Unlike [purchaseIdentifierFormat], this method doesn't throw if the JSON field - * has an unexpected type. - */ - @JsonProperty("purchase_identifier_format") - @ExcludeMissing - fun _purchaseIdentifierFormat(): JsonField = - purchaseIdentifierFormat + @JsonProperty("code") @ExcludeMissing fun _code(): JsonField = code /** - * Returns the raw JSON value of [travel]. + * Returns the raw JSON value of [currency]. * - * Unlike [travel], this method doesn't throw if the JSON field has an unexpected + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("travel") @ExcludeMissing fun _travel(): JsonField = travel + @JsonProperty("currency") + @ExcludeMissing + fun _currency(): JsonField = currency @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -20930,294 +21406,88 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [PurchaseDetails]. + * Returns a mutable builder for constructing an instance of [Interchange]. * * The following fields are required: * ```java - * .carRental() - * .customerReferenceIdentifier() - * .localTaxAmount() - * .localTaxCurrency() - * .lodging() - * .nationalTaxAmount() - * .nationalTaxCurrency() - * .purchaseIdentifier() - * .purchaseIdentifierFormat() - * .travel() + * .amount() + * .code() + * .currency() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [PurchaseDetails]. */ + /** A builder for [Interchange]. */ class Builder internal constructor() { - private var carRental: JsonField? = null - private var customerReferenceIdentifier: JsonField? = null - private var localTaxAmount: JsonField? = null - private var localTaxCurrency: JsonField? = null - private var lodging: JsonField? = null - private var nationalTaxAmount: JsonField? = null - private var nationalTaxCurrency: JsonField? = null - private var purchaseIdentifier: JsonField? = null - private var purchaseIdentifierFormat: JsonField? = - null - private var travel: JsonField? = null + private var amount: JsonField? = null + private var code: JsonField? = null + private var currency: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(purchaseDetails: PurchaseDetails) = apply { - carRental = purchaseDetails.carRental - customerReferenceIdentifier = purchaseDetails.customerReferenceIdentifier - localTaxAmount = purchaseDetails.localTaxAmount - localTaxCurrency = purchaseDetails.localTaxCurrency - lodging = purchaseDetails.lodging - nationalTaxAmount = purchaseDetails.nationalTaxAmount - nationalTaxCurrency = purchaseDetails.nationalTaxCurrency - purchaseIdentifier = purchaseDetails.purchaseIdentifier - purchaseIdentifierFormat = purchaseDetails.purchaseIdentifierFormat - travel = purchaseDetails.travel - additionalProperties = purchaseDetails.additionalProperties.toMutableMap() - } - - /** Fields specific to car rentals. */ - fun carRental(carRental: CarRental?) = - carRental(JsonField.ofNullable(carRental)) - - /** Alias for calling [Builder.carRental] with `carRental.orElse(null)`. */ - fun carRental(carRental: Optional) = carRental(carRental.getOrNull()) - - /** - * Sets [Builder.carRental] to an arbitrary JSON value. - * - * You should usually call [Builder.carRental] with a well-typed [CarRental] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun carRental(carRental: JsonField) = apply { - this.carRental = carRental + internal fun from(interchange: Interchange) = apply { + amount = interchange.amount + code = interchange.code + currency = interchange.currency + additionalProperties = interchange.additionalProperties.toMutableMap() } - /** An identifier from the merchant for the customer or consumer. */ - fun customerReferenceIdentifier(customerReferenceIdentifier: String?) = - customerReferenceIdentifier( - JsonField.ofNullable(customerReferenceIdentifier) - ) - /** - * Alias for calling [Builder.customerReferenceIdentifier] with - * `customerReferenceIdentifier.orElse(null)`. + * The interchange amount given as a string containing a decimal number in major + * units (so e.g., "3.14" for $3.14). The amount is a positive number if it is + * credited to Increase (e.g., settlements) and a negative number if it is + * debited (e.g., refunds). */ - fun customerReferenceIdentifier(customerReferenceIdentifier: Optional) = - customerReferenceIdentifier(customerReferenceIdentifier.getOrNull()) + fun amount(amount: String) = amount(JsonField.of(amount)) /** - * Sets [Builder.customerReferenceIdentifier] to an arbitrary JSON value. + * Sets [Builder.amount] to an arbitrary JSON value. * - * You should usually call [Builder.customerReferenceIdentifier] with a - * well-typed [String] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * You should usually call [Builder.amount] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - fun customerReferenceIdentifier( - customerReferenceIdentifier: JsonField - ) = apply { this.customerReferenceIdentifier = customerReferenceIdentifier } + fun amount(amount: JsonField) = apply { this.amount = amount } - /** The state or provincial tax amount in minor units. */ - fun localTaxAmount(localTaxAmount: Long?) = - localTaxAmount(JsonField.ofNullable(localTaxAmount)) + /** The card network specific interchange code. */ + fun code(code: String?) = code(JsonField.ofNullable(code)) + + /** Alias for calling [Builder.code] with `code.orElse(null)`. */ + fun code(code: Optional) = code(code.getOrNull()) /** - * Alias for [Builder.localTaxAmount]. + * Sets [Builder.code] to an arbitrary JSON value. * - * This unboxed primitive overload exists for backwards compatibility. + * You should usually call [Builder.code] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - fun localTaxAmount(localTaxAmount: Long) = - localTaxAmount(localTaxAmount as Long?) + fun code(code: JsonField) = apply { this.code = code } /** - * Alias for calling [Builder.localTaxAmount] with - * `localTaxAmount.orElse(null)`. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * interchange reimbursement. */ - fun localTaxAmount(localTaxAmount: Optional) = - localTaxAmount(localTaxAmount.getOrNull()) + fun currency(currency: Currency) = currency(JsonField.of(currency)) /** - * Sets [Builder.localTaxAmount] to an arbitrary JSON value. + * Sets [Builder.currency] to an arbitrary JSON value. * - * You should usually call [Builder.localTaxAmount] with a well-typed [Long] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun localTaxAmount(localTaxAmount: JsonField) = apply { - this.localTaxAmount = localTaxAmount - } - - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax - * assessed. + * You should usually call [Builder.currency] with a well-typed [Currency] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - fun localTaxCurrency(localTaxCurrency: String?) = - localTaxCurrency(JsonField.ofNullable(localTaxCurrency)) + fun currency(currency: JsonField) = apply { this.currency = currency } - /** - * Alias for calling [Builder.localTaxCurrency] with - * `localTaxCurrency.orElse(null)`. - */ - fun localTaxCurrency(localTaxCurrency: Optional) = - localTaxCurrency(localTaxCurrency.getOrNull()) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * Sets [Builder.localTaxCurrency] to an arbitrary JSON value. - * - * You should usually call [Builder.localTaxCurrency] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun localTaxCurrency(localTaxCurrency: JsonField) = apply { - this.localTaxCurrency = localTaxCurrency - } - - /** Fields specific to lodging. */ - fun lodging(lodging: Lodging?) = lodging(JsonField.ofNullable(lodging)) - - /** Alias for calling [Builder.lodging] with `lodging.orElse(null)`. */ - fun lodging(lodging: Optional) = lodging(lodging.getOrNull()) - - /** - * Sets [Builder.lodging] to an arbitrary JSON value. - * - * You should usually call [Builder.lodging] with a well-typed [Lodging] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun lodging(lodging: JsonField) = apply { this.lodging = lodging } - - /** The national tax amount in minor units. */ - fun nationalTaxAmount(nationalTaxAmount: Long?) = - nationalTaxAmount(JsonField.ofNullable(nationalTaxAmount)) - - /** - * Alias for [Builder.nationalTaxAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun nationalTaxAmount(nationalTaxAmount: Long) = - nationalTaxAmount(nationalTaxAmount as Long?) - - /** - * Alias for calling [Builder.nationalTaxAmount] with - * `nationalTaxAmount.orElse(null)`. - */ - fun nationalTaxAmount(nationalTaxAmount: Optional) = - nationalTaxAmount(nationalTaxAmount.getOrNull()) - - /** - * Sets [Builder.nationalTaxAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.nationalTaxAmount] with a well-typed [Long] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun nationalTaxAmount(nationalTaxAmount: JsonField) = apply { - this.nationalTaxAmount = nationalTaxAmount - } - - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax - * assessed. - */ - fun nationalTaxCurrency(nationalTaxCurrency: String?) = - nationalTaxCurrency(JsonField.ofNullable(nationalTaxCurrency)) - - /** - * Alias for calling [Builder.nationalTaxCurrency] with - * `nationalTaxCurrency.orElse(null)`. - */ - fun nationalTaxCurrency(nationalTaxCurrency: Optional) = - nationalTaxCurrency(nationalTaxCurrency.getOrNull()) - - /** - * Sets [Builder.nationalTaxCurrency] to an arbitrary JSON value. - * - * You should usually call [Builder.nationalTaxCurrency] with a well-typed - * [String] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun nationalTaxCurrency(nationalTaxCurrency: JsonField) = apply { - this.nationalTaxCurrency = nationalTaxCurrency - } - - /** - * An identifier from the merchant for the purchase to the issuer and - * cardholder. - */ - fun purchaseIdentifier(purchaseIdentifier: String?) = - purchaseIdentifier(JsonField.ofNullable(purchaseIdentifier)) - - /** - * Alias for calling [Builder.purchaseIdentifier] with - * `purchaseIdentifier.orElse(null)`. - */ - fun purchaseIdentifier(purchaseIdentifier: Optional) = - purchaseIdentifier(purchaseIdentifier.getOrNull()) - - /** - * Sets [Builder.purchaseIdentifier] to an arbitrary JSON value. - * - * You should usually call [Builder.purchaseIdentifier] with a well-typed - * [String] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun purchaseIdentifier(purchaseIdentifier: JsonField) = apply { - this.purchaseIdentifier = purchaseIdentifier - } - - /** The format of the purchase identifier. */ - fun purchaseIdentifierFormat( - purchaseIdentifierFormat: PurchaseIdentifierFormat? - ) = purchaseIdentifierFormat(JsonField.ofNullable(purchaseIdentifierFormat)) - - /** - * Alias for calling [Builder.purchaseIdentifierFormat] with - * `purchaseIdentifierFormat.orElse(null)`. - */ - fun purchaseIdentifierFormat( - purchaseIdentifierFormat: Optional - ) = purchaseIdentifierFormat(purchaseIdentifierFormat.getOrNull()) - - /** - * Sets [Builder.purchaseIdentifierFormat] to an arbitrary JSON value. - * - * You should usually call [Builder.purchaseIdentifierFormat] with a well-typed - * [PurchaseIdentifierFormat] value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. - */ - fun purchaseIdentifierFormat( - purchaseIdentifierFormat: JsonField - ) = apply { this.purchaseIdentifierFormat = purchaseIdentifierFormat } - - /** Fields specific to travel. */ - fun travel(travel: Travel?) = travel(JsonField.ofNullable(travel)) - - /** Alias for calling [Builder.travel] with `travel.orElse(null)`. */ - fun travel(travel: Optional) = travel(travel.getOrNull()) - - /** - * Sets [Builder.travel] to an arbitrary JSON value. - * - * You should usually call [Builder.travel] with a well-typed [Travel] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun travel(travel: JsonField) = apply { this.travel = travel } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -21234,62 +21504,38 @@ private constructor( } /** - * Returns an immutable instance of [PurchaseDetails]. + * Returns an immutable instance of [Interchange]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .carRental() - * .customerReferenceIdentifier() - * .localTaxAmount() - * .localTaxCurrency() - * .lodging() - * .nationalTaxAmount() - * .nationalTaxCurrency() - * .purchaseIdentifier() - * .purchaseIdentifierFormat() - * .travel() + * .amount() + * .code() + * .currency() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): PurchaseDetails = - PurchaseDetails( - checkRequired("carRental", carRental), - checkRequired( - "customerReferenceIdentifier", - customerReferenceIdentifier, - ), - checkRequired("localTaxAmount", localTaxAmount), - checkRequired("localTaxCurrency", localTaxCurrency), - checkRequired("lodging", lodging), - checkRequired("nationalTaxAmount", nationalTaxAmount), - checkRequired("nationalTaxCurrency", nationalTaxCurrency), - checkRequired("purchaseIdentifier", purchaseIdentifier), - checkRequired("purchaseIdentifierFormat", purchaseIdentifierFormat), - checkRequired("travel", travel), + fun build(): Interchange = + Interchange( + checkRequired("amount", amount), + checkRequired("code", code), + checkRequired("currency", currency), additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): PurchaseDetails = apply { + fun validate(): Interchange = apply { if (validated) { return@apply } - carRental().ifPresent { it.validate() } - customerReferenceIdentifier() - localTaxAmount() - localTaxCurrency() - lodging().ifPresent { it.validate() } - nationalTaxAmount() - nationalTaxCurrency() - purchaseIdentifier() - purchaseIdentifierFormat().ifPresent { it.validate() } - travel().ifPresent { it.validate() } + amount() + code() + currency().validate() validated = true } @@ -21309,1735 +21555,1496 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (carRental.asKnown().getOrNull()?.validity() ?: 0) + - (if (customerReferenceIdentifier.asKnown().isPresent) 1 else 0) + - (if (localTaxAmount.asKnown().isPresent) 1 else 0) + - (if (localTaxCurrency.asKnown().isPresent) 1 else 0) + - (lodging.asKnown().getOrNull()?.validity() ?: 0) + - (if (nationalTaxAmount.asKnown().isPresent) 1 else 0) + - (if (nationalTaxCurrency.asKnown().isPresent) 1 else 0) + - (if (purchaseIdentifier.asKnown().isPresent) 1 else 0) + - (purchaseIdentifierFormat.asKnown().getOrNull()?.validity() ?: 0) + - (travel.asKnown().getOrNull()?.validity() ?: 0) + (if (amount.asKnown().isPresent) 1 else 0) + + (if (code.asKnown().isPresent) 1 else 0) + + (currency.asKnown().getOrNull()?.validity() ?: 0) - /** Fields specific to car rentals. */ - class CarRental - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val carClassCode: JsonField, - private val checkoutDate: JsonField, - private val dailyRentalRateAmount: JsonField, - private val dailyRentalRateCurrency: JsonField, - private val daysRented: JsonField, - private val extraCharges: JsonField, - private val fuelChargesAmount: JsonField, - private val fuelChargesCurrency: JsonField, - private val insuranceChargesAmount: JsonField, - private val insuranceChargesCurrency: JsonField, - private val noShowIndicator: JsonField, - private val oneWayDropOffChargesAmount: JsonField, - private val oneWayDropOffChargesCurrency: JsonField, - private val renterName: JsonField, - private val weeklyRentalRateAmount: JsonField, - private val weeklyRentalRateCurrency: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("car_class_code") - @ExcludeMissing - carClassCode: JsonField = JsonMissing.of(), - @JsonProperty("checkout_date") - @ExcludeMissing - checkoutDate: JsonField = JsonMissing.of(), - @JsonProperty("daily_rental_rate_amount") - @ExcludeMissing - dailyRentalRateAmount: JsonField = JsonMissing.of(), - @JsonProperty("daily_rental_rate_currency") - @ExcludeMissing - dailyRentalRateCurrency: JsonField = JsonMissing.of(), - @JsonProperty("days_rented") - @ExcludeMissing - daysRented: JsonField = JsonMissing.of(), - @JsonProperty("extra_charges") - @ExcludeMissing - extraCharges: JsonField = JsonMissing.of(), - @JsonProperty("fuel_charges_amount") - @ExcludeMissing - fuelChargesAmount: JsonField = JsonMissing.of(), - @JsonProperty("fuel_charges_currency") - @ExcludeMissing - fuelChargesCurrency: JsonField = JsonMissing.of(), - @JsonProperty("insurance_charges_amount") - @ExcludeMissing - insuranceChargesAmount: JsonField = JsonMissing.of(), - @JsonProperty("insurance_charges_currency") - @ExcludeMissing - insuranceChargesCurrency: JsonField = JsonMissing.of(), - @JsonProperty("no_show_indicator") - @ExcludeMissing - noShowIndicator: JsonField = JsonMissing.of(), - @JsonProperty("one_way_drop_off_charges_amount") - @ExcludeMissing - oneWayDropOffChargesAmount: JsonField = JsonMissing.of(), - @JsonProperty("one_way_drop_off_charges_currency") - @ExcludeMissing - oneWayDropOffChargesCurrency: JsonField = JsonMissing.of(), - @JsonProperty("renter_name") - @ExcludeMissing - renterName: JsonField = JsonMissing.of(), - @JsonProperty("weekly_rental_rate_amount") - @ExcludeMissing - weeklyRentalRateAmount: JsonField = JsonMissing.of(), - @JsonProperty("weekly_rental_rate_currency") - @ExcludeMissing - weeklyRentalRateCurrency: JsonField = JsonMissing.of(), - ) : this( - carClassCode, - checkoutDate, - dailyRentalRateAmount, - dailyRentalRateCurrency, - daysRented, - extraCharges, - fuelChargesAmount, - fuelChargesCurrency, - insuranceChargesAmount, - insuranceChargesCurrency, - noShowIndicator, - oneWayDropOffChargesAmount, - oneWayDropOffChargesCurrency, - renterName, - weeklyRentalRateAmount, - weeklyRentalRateCurrency, - mutableMapOf(), - ) + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the interchange + * reimbursement. + */ + class Currency + @JsonCreator + private constructor(private val value: JsonField) : Enum { /** - * Code indicating the vehicle's class. + * Returns this class instance's raw value. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. */ - fun carClassCode(): Optional = - carClassCode.getOptional("car_class_code") + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** - * Date the customer picked up the car or, in the case of a no-show or pre-pay - * transaction, the scheduled pick up date. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun checkoutDate(): Optional = - checkoutDate.getOptional("checkout_date") + companion object { - /** - * Daily rate being charged for the vehicle. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun dailyRentalRateAmount(): Optional = - dailyRentalRateAmount.getOptional("daily_rental_rate_amount") + /** US Dollar (USD) */ + @JvmField val USD = of("USD") - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily - * rental rate. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun dailyRentalRateCurrency(): Optional = - dailyRentalRateCurrency.getOptional("daily_rental_rate_currency") + @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) + } - /** - * Number of days the vehicle was rented. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun daysRented(): Optional = daysRented.getOptional("days_rented") + /** An enum containing [Currency]'s known values. */ + enum class Known { + /** US Dollar (USD) */ + USD + } /** - * Additional charges (gas, late fee, etc.) being billed. + * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] + * member. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * An instance of [Currency] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. */ - fun extraCharges(): Optional = - extraCharges.getOptional("extra_charges") + enum class Value { + /** US Dollar (USD) */ + USD, + /** + * An enum member indicating that [Currency] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } /** - * Fuel charges for the vehicle. + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. */ - fun fuelChargesAmount(): Optional = - fuelChargesAmount.getOptional("fuel_charges_amount") + fun value(): Value = + when (this) { + USD -> Value.USD + else -> Value._UNKNOWN + } /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fuel - * charges assessed. + * Returns an enum member corresponding to this class instance's value. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun fuelChargesCurrency(): Optional = - fuelChargesCurrency.getOptional("fuel_charges_currency") - - /** - * Any insurance being charged for the vehicle. + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. */ - fun insuranceChargesAmount(): Optional = - insuranceChargesAmount.getOptional("insurance_charges_amount") + fun known(): Known = + when (this) { + USD -> Known.USD + else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + } /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the insurance - * charges assessed. + * Returns this class instance's primitive wire representation. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun insuranceChargesCurrency(): Optional = - insuranceChargesCurrency.getOptional("insurance_charges_currency") - - /** - * An indicator that the cardholder is being billed for a reserved vehicle that - * was not actually rented (that is, a "no-show" charge). + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. */ - fun noShowIndicator(): Optional = - noShowIndicator.getOptional("no_show_indicator") + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - /** - * Charges for returning the vehicle at a different location than where it was - * picked up. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun oneWayDropOffChargesAmount(): Optional = - oneWayDropOffChargesAmount.getOptional("one_way_drop_off_charges_amount") + private var validated: Boolean = false - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the one-way - * drop-off charges assessed. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun oneWayDropOffChargesCurrency(): Optional = - oneWayDropOffChargesCurrency.getOptional( - "one_way_drop_off_charges_currency" - ) + fun validate(): Currency = apply { + if (validated) { + return@apply + } - /** - * Name of the person renting the vehicle. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun renterName(): Optional = renterName.getOptional("renter_name") + known() + validated = true + } - /** - * Weekly rate being charged for the vehicle. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun weeklyRentalRateAmount(): Optional = - weeklyRentalRateAmount.getOptional("weekly_rental_rate_amount") + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the weekly - * rental rate. + * Returns a score indicating how many valid values are contained in this object + * recursively. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * Used for best match union deserialization. */ - fun weeklyRentalRateCurrency(): Optional = - weeklyRentalRateCurrency.getOptional("weekly_rental_rate_currency") + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - /** - * Returns the raw JSON value of [carClassCode]. - * - * Unlike [carClassCode], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("car_class_code") - @ExcludeMissing - fun _carClassCode(): JsonField = carClassCode + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Returns the raw JSON value of [checkoutDate]. - * - * Unlike [checkoutDate], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("checkout_date") - @ExcludeMissing - fun _checkoutDate(): JsonField = checkoutDate + return other is Currency && value == other.value + } - /** - * Returns the raw JSON value of [dailyRentalRateAmount]. - * - * Unlike [dailyRentalRateAmount], this method doesn't throw if the JSON field - * has an unexpected type. - */ - @JsonProperty("daily_rental_rate_amount") - @ExcludeMissing - fun _dailyRentalRateAmount(): JsonField = dailyRentalRateAmount + override fun hashCode() = value.hashCode() - /** - * Returns the raw JSON value of [dailyRentalRateCurrency]. - * - * Unlike [dailyRentalRateCurrency], this method doesn't throw if the JSON field - * has an unexpected type. - */ - @JsonProperty("daily_rental_rate_currency") - @ExcludeMissing - fun _dailyRentalRateCurrency(): JsonField = dailyRentalRateCurrency + override fun toString() = value.toString() + } - /** - * Returns the raw JSON value of [daysRented]. - * - * Unlike [daysRented], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("days_rented") - @ExcludeMissing - fun _daysRented(): JsonField = daysRented + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Returns the raw JSON value of [extraCharges]. - * - * Unlike [extraCharges], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("extra_charges") - @ExcludeMissing - fun _extraCharges(): JsonField = extraCharges + return other is Interchange && + amount == other.amount && + code == other.code && + currency == other.currency && + additionalProperties == other.additionalProperties + } - /** - * Returns the raw JSON value of [fuelChargesAmount]. - * - * Unlike [fuelChargesAmount], this method doesn't throw if the JSON field has - * an unexpected type. - */ - @JsonProperty("fuel_charges_amount") - @ExcludeMissing - fun _fuelChargesAmount(): JsonField = fuelChargesAmount + private val hashCode: Int by lazy { + Objects.hash(amount, code, currency, additionalProperties) + } - /** - * Returns the raw JSON value of [fuelChargesCurrency]. - * - * Unlike [fuelChargesCurrency], this method doesn't throw if the JSON field has - * an unexpected type. - */ - @JsonProperty("fuel_charges_currency") - @ExcludeMissing - fun _fuelChargesCurrency(): JsonField = fuelChargesCurrency + override fun hashCode(): Int = hashCode - /** - * Returns the raw JSON value of [insuranceChargesAmount]. - * - * Unlike [insuranceChargesAmount], this method doesn't throw if the JSON field - * has an unexpected type. - */ - @JsonProperty("insurance_charges_amount") - @ExcludeMissing - fun _insuranceChargesAmount(): JsonField = insuranceChargesAmount + override fun toString() = + "Interchange{amount=$amount, code=$code, currency=$currency, additionalProperties=$additionalProperties}" + } - /** - * Returns the raw JSON value of [insuranceChargesCurrency]. - * - * Unlike [insuranceChargesCurrency], this method doesn't throw if the JSON - * field has an unexpected type. - */ - @JsonProperty("insurance_charges_currency") - @ExcludeMissing - fun _insuranceChargesCurrency(): JsonField = insuranceChargesCurrency + /** Network-specific identifiers for this refund. */ + class NetworkIdentifiers + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val acquirerBusinessId: JsonField, + private val acquirerReferenceNumber: JsonField, + private val authorizationIdentificationResponse: JsonField, + private val transactionId: JsonField, + private val additionalProperties: MutableMap, + ) { - /** - * Returns the raw JSON value of [noShowIndicator]. - * - * Unlike [noShowIndicator], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("no_show_indicator") + @JsonCreator + private constructor( + @JsonProperty("acquirer_business_id") @ExcludeMissing - fun _noShowIndicator(): JsonField = noShowIndicator - - /** - * Returns the raw JSON value of [oneWayDropOffChargesAmount]. - * - * Unlike [oneWayDropOffChargesAmount], this method doesn't throw if the JSON - * field has an unexpected type. - */ - @JsonProperty("one_way_drop_off_charges_amount") + acquirerBusinessId: JsonField = JsonMissing.of(), + @JsonProperty("acquirer_reference_number") @ExcludeMissing - fun _oneWayDropOffChargesAmount(): JsonField = oneWayDropOffChargesAmount - - /** - * Returns the raw JSON value of [oneWayDropOffChargesCurrency]. - * - * Unlike [oneWayDropOffChargesCurrency], this method doesn't throw if the JSON - * field has an unexpected type. - */ - @JsonProperty("one_way_drop_off_charges_currency") + acquirerReferenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("authorization_identification_response") @ExcludeMissing - fun _oneWayDropOffChargesCurrency(): JsonField = - oneWayDropOffChargesCurrency - - /** - * Returns the raw JSON value of [renterName]. - * - * Unlike [renterName], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("renter_name") + authorizationIdentificationResponse: JsonField = JsonMissing.of(), + @JsonProperty("transaction_id") @ExcludeMissing - fun _renterName(): JsonField = renterName + transactionId: JsonField = JsonMissing.of(), + ) : this( + acquirerBusinessId, + acquirerReferenceNumber, + authorizationIdentificationResponse, + transactionId, + mutableMapOf(), + ) - /** - * Returns the raw JSON value of [weeklyRentalRateAmount]. - * - * Unlike [weeklyRentalRateAmount], this method doesn't throw if the JSON field - * has an unexpected type. - */ - @JsonProperty("weekly_rental_rate_amount") - @ExcludeMissing - fun _weeklyRentalRateAmount(): JsonField = weeklyRentalRateAmount + /** + * A network assigned business ID that identifies the acquirer that processed this + * transaction. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun acquirerBusinessId(): String = + acquirerBusinessId.getRequired("acquirer_business_id") - /** - * Returns the raw JSON value of [weeklyRentalRateCurrency]. - * - * Unlike [weeklyRentalRateCurrency], this method doesn't throw if the JSON - * field has an unexpected type. - */ - @JsonProperty("weekly_rental_rate_currency") - @ExcludeMissing - fun _weeklyRentalRateCurrency(): JsonField = weeklyRentalRateCurrency + /** + * A globally unique identifier for this settlement. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun acquirerReferenceNumber(): String = + acquirerReferenceNumber.getRequired("acquirer_reference_number") - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** + * The randomly generated 6-character Authorization Identification Response code + * sent back to the acquirer in an approved response. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun authorizationIdentificationResponse(): Optional = + authorizationIdentificationResponse.getOptional( + "authorization_identification_response" + ) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** + * A globally unique transaction identifier provided by the card network, used + * across multiple life-cycle requests. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun transactionId(): Optional = transactionId.getOptional("transaction_id") - fun toBuilder() = Builder().from(this) + /** + * Returns the raw JSON value of [acquirerBusinessId]. + * + * Unlike [acquirerBusinessId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("acquirer_business_id") + @ExcludeMissing + fun _acquirerBusinessId(): JsonField = acquirerBusinessId - companion object { + /** + * Returns the raw JSON value of [acquirerReferenceNumber]. + * + * Unlike [acquirerReferenceNumber], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("acquirer_reference_number") + @ExcludeMissing + fun _acquirerReferenceNumber(): JsonField = acquirerReferenceNumber - /** - * Returns a mutable builder for constructing an instance of [CarRental]. - * - * The following fields are required: - * ```java - * .carClassCode() - * .checkoutDate() - * .dailyRentalRateAmount() - * .dailyRentalRateCurrency() - * .daysRented() - * .extraCharges() - * .fuelChargesAmount() - * .fuelChargesCurrency() - * .insuranceChargesAmount() - * .insuranceChargesCurrency() - * .noShowIndicator() - * .oneWayDropOffChargesAmount() - * .oneWayDropOffChargesCurrency() - * .renterName() - * .weeklyRentalRateAmount() - * .weeklyRentalRateCurrency() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + /** + * Returns the raw JSON value of [authorizationIdentificationResponse]. + * + * Unlike [authorizationIdentificationResponse], this method doesn't throw if the + * JSON field has an unexpected type. + */ + @JsonProperty("authorization_identification_response") + @ExcludeMissing + fun _authorizationIdentificationResponse(): JsonField = + authorizationIdentificationResponse - /** A builder for [CarRental]. */ - class Builder internal constructor() { + /** + * Returns the raw JSON value of [transactionId]. + * + * Unlike [transactionId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("transaction_id") + @ExcludeMissing + fun _transactionId(): JsonField = transactionId - private var carClassCode: JsonField? = null - private var checkoutDate: JsonField? = null - private var dailyRentalRateAmount: JsonField? = null - private var dailyRentalRateCurrency: JsonField? = null - private var daysRented: JsonField? = null - private var extraCharges: JsonField? = null - private var fuelChargesAmount: JsonField? = null - private var fuelChargesCurrency: JsonField? = null - private var insuranceChargesAmount: JsonField? = null - private var insuranceChargesCurrency: JsonField? = null - private var noShowIndicator: JsonField? = null - private var oneWayDropOffChargesAmount: JsonField? = null - private var oneWayDropOffChargesCurrency: JsonField? = null - private var renterName: JsonField? = null - private var weeklyRentalRateAmount: JsonField? = null - private var weeklyRentalRateCurrency: JsonField? = null - private var additionalProperties: MutableMap = - mutableMapOf() + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - @JvmSynthetic - internal fun from(carRental: CarRental) = apply { - carClassCode = carRental.carClassCode - checkoutDate = carRental.checkoutDate - dailyRentalRateAmount = carRental.dailyRentalRateAmount - dailyRentalRateCurrency = carRental.dailyRentalRateCurrency - daysRented = carRental.daysRented - extraCharges = carRental.extraCharges - fuelChargesAmount = carRental.fuelChargesAmount - fuelChargesCurrency = carRental.fuelChargesCurrency - insuranceChargesAmount = carRental.insuranceChargesAmount - insuranceChargesCurrency = carRental.insuranceChargesCurrency - noShowIndicator = carRental.noShowIndicator - oneWayDropOffChargesAmount = carRental.oneWayDropOffChargesAmount - oneWayDropOffChargesCurrency = carRental.oneWayDropOffChargesCurrency - renterName = carRental.renterName - weeklyRentalRateAmount = carRental.weeklyRentalRateAmount - weeklyRentalRateCurrency = carRental.weeklyRentalRateCurrency - additionalProperties = carRental.additionalProperties.toMutableMap() - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** Code indicating the vehicle's class. */ - fun carClassCode(carClassCode: String?) = - carClassCode(JsonField.ofNullable(carClassCode)) + fun toBuilder() = Builder().from(this) - /** - * Alias for calling [Builder.carClassCode] with - * `carClassCode.orElse(null)`. - */ - fun carClassCode(carClassCode: Optional) = - carClassCode(carClassCode.getOrNull()) + companion object { - /** - * Sets [Builder.carClassCode] to an arbitrary JSON value. - * - * You should usually call [Builder.carClassCode] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun carClassCode(carClassCode: JsonField) = apply { - this.carClassCode = carClassCode - } + /** + * Returns a mutable builder for constructing an instance of + * [NetworkIdentifiers]. + * + * The following fields are required: + * ```java + * .acquirerBusinessId() + * .acquirerReferenceNumber() + * .authorizationIdentificationResponse() + * .transactionId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - /** - * Date the customer picked up the car or, in the case of a no-show or - * pre-pay transaction, the scheduled pick up date. - */ - fun checkoutDate(checkoutDate: LocalDate?) = - checkoutDate(JsonField.ofNullable(checkoutDate)) + /** A builder for [NetworkIdentifiers]. */ + class Builder internal constructor() { - /** - * Alias for calling [Builder.checkoutDate] with - * `checkoutDate.orElse(null)`. - */ - fun checkoutDate(checkoutDate: Optional) = - checkoutDate(checkoutDate.getOrNull()) + private var acquirerBusinessId: JsonField? = null + private var acquirerReferenceNumber: JsonField? = null + private var authorizationIdentificationResponse: JsonField? = null + private var transactionId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** - * Sets [Builder.checkoutDate] to an arbitrary JSON value. - * - * You should usually call [Builder.checkoutDate] with a well-typed - * [LocalDate] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. - */ - fun checkoutDate(checkoutDate: JsonField) = apply { - this.checkoutDate = checkoutDate - } + @JvmSynthetic + internal fun from(networkIdentifiers: NetworkIdentifiers) = apply { + acquirerBusinessId = networkIdentifiers.acquirerBusinessId + acquirerReferenceNumber = networkIdentifiers.acquirerReferenceNumber + authorizationIdentificationResponse = + networkIdentifiers.authorizationIdentificationResponse + transactionId = networkIdentifiers.transactionId + additionalProperties = + networkIdentifiers.additionalProperties.toMutableMap() + } - /** Daily rate being charged for the vehicle. */ - fun dailyRentalRateAmount(dailyRentalRateAmount: Long?) = - dailyRentalRateAmount(JsonField.ofNullable(dailyRentalRateAmount)) + /** + * A network assigned business ID that identifies the acquirer that processed + * this transaction. + */ + fun acquirerBusinessId(acquirerBusinessId: String) = + acquirerBusinessId(JsonField.of(acquirerBusinessId)) - /** - * Alias for [Builder.dailyRentalRateAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun dailyRentalRateAmount(dailyRentalRateAmount: Long) = - dailyRentalRateAmount(dailyRentalRateAmount as Long?) + /** + * Sets [Builder.acquirerBusinessId] to an arbitrary JSON value. + * + * You should usually call [Builder.acquirerBusinessId] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun acquirerBusinessId(acquirerBusinessId: JsonField) = apply { + this.acquirerBusinessId = acquirerBusinessId + } - /** - * Alias for calling [Builder.dailyRentalRateAmount] with - * `dailyRentalRateAmount.orElse(null)`. - */ - fun dailyRentalRateAmount(dailyRentalRateAmount: Optional) = - dailyRentalRateAmount(dailyRentalRateAmount.getOrNull()) + /** A globally unique identifier for this settlement. */ + fun acquirerReferenceNumber(acquirerReferenceNumber: String) = + acquirerReferenceNumber(JsonField.of(acquirerReferenceNumber)) - /** - * Sets [Builder.dailyRentalRateAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.dailyRentalRateAmount] with a well-typed - * [Long] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun dailyRentalRateAmount(dailyRentalRateAmount: JsonField) = apply { - this.dailyRentalRateAmount = dailyRentalRateAmount + /** + * Sets [Builder.acquirerReferenceNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.acquirerReferenceNumber] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun acquirerReferenceNumber(acquirerReferenceNumber: JsonField) = + apply { + this.acquirerReferenceNumber = acquirerReferenceNumber } - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily - * rental rate. - */ - fun dailyRentalRateCurrency(dailyRentalRateCurrency: String?) = - dailyRentalRateCurrency(JsonField.ofNullable(dailyRentalRateCurrency)) + /** + * The randomly generated 6-character Authorization Identification Response code + * sent back to the acquirer in an approved response. + */ + fun authorizationIdentificationResponse( + authorizationIdentificationResponse: String? + ) = + authorizationIdentificationResponse( + JsonField.ofNullable(authorizationIdentificationResponse) + ) - /** - * Alias for calling [Builder.dailyRentalRateCurrency] with - * `dailyRentalRateCurrency.orElse(null)`. - */ - fun dailyRentalRateCurrency(dailyRentalRateCurrency: Optional) = - dailyRentalRateCurrency(dailyRentalRateCurrency.getOrNull()) + /** + * Alias for calling [Builder.authorizationIdentificationResponse] with + * `authorizationIdentificationResponse.orElse(null)`. + */ + fun authorizationIdentificationResponse( + authorizationIdentificationResponse: Optional + ) = + authorizationIdentificationResponse( + authorizationIdentificationResponse.getOrNull() + ) - /** - * Sets [Builder.dailyRentalRateCurrency] to an arbitrary JSON value. - * - * You should usually call [Builder.dailyRentalRateCurrency] with a - * well-typed [String] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. - */ - fun dailyRentalRateCurrency(dailyRentalRateCurrency: JsonField) = - apply { - this.dailyRentalRateCurrency = dailyRentalRateCurrency - } - - /** Number of days the vehicle was rented. */ - fun daysRented(daysRented: Long?) = - daysRented(JsonField.ofNullable(daysRented)) + /** + * Sets [Builder.authorizationIdentificationResponse] to an arbitrary JSON + * value. + * + * You should usually call [Builder.authorizationIdentificationResponse] with a + * well-typed [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun authorizationIdentificationResponse( + authorizationIdentificationResponse: JsonField + ) = apply { + this.authorizationIdentificationResponse = + authorizationIdentificationResponse + } - /** - * Alias for [Builder.daysRented]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun daysRented(daysRented: Long) = daysRented(daysRented as Long?) + /** + * A globally unique transaction identifier provided by the card network, used + * across multiple life-cycle requests. + */ + fun transactionId(transactionId: String?) = + transactionId(JsonField.ofNullable(transactionId)) - /** - * Alias for calling [Builder.daysRented] with `daysRented.orElse(null)`. - */ - fun daysRented(daysRented: Optional) = - daysRented(daysRented.getOrNull()) + /** + * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`. + */ + fun transactionId(transactionId: Optional) = + transactionId(transactionId.getOrNull()) - /** - * Sets [Builder.daysRented] to an arbitrary JSON value. - * - * You should usually call [Builder.daysRented] with a well-typed [Long] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun daysRented(daysRented: JsonField) = apply { - this.daysRented = daysRented - } + /** + * Sets [Builder.transactionId] to an arbitrary JSON value. + * + * You should usually call [Builder.transactionId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun transactionId(transactionId: JsonField) = apply { + this.transactionId = transactionId + } - /** Additional charges (gas, late fee, etc.) being billed. */ - fun extraCharges(extraCharges: ExtraCharges?) = - extraCharges(JsonField.ofNullable(extraCharges)) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * Alias for calling [Builder.extraCharges] with - * `extraCharges.orElse(null)`. - */ - fun extraCharges(extraCharges: Optional) = - extraCharges(extraCharges.getOrNull()) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * Sets [Builder.extraCharges] to an arbitrary JSON value. - * - * You should usually call [Builder.extraCharges] with a well-typed - * [ExtraCharges] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun extraCharges(extraCharges: JsonField) = apply { - this.extraCharges = extraCharges + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) } - /** Fuel charges for the vehicle. */ - fun fuelChargesAmount(fuelChargesAmount: Long?) = - fuelChargesAmount(JsonField.ofNullable(fuelChargesAmount)) + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * Alias for [Builder.fuelChargesAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun fuelChargesAmount(fuelChargesAmount: Long) = - fuelChargesAmount(fuelChargesAmount as Long?) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * Alias for calling [Builder.fuelChargesAmount] with - * `fuelChargesAmount.orElse(null)`. - */ - fun fuelChargesAmount(fuelChargesAmount: Optional) = - fuelChargesAmount(fuelChargesAmount.getOrNull()) + /** + * Returns an immutable instance of [NetworkIdentifiers]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .acquirerBusinessId() + * .acquirerReferenceNumber() + * .authorizationIdentificationResponse() + * .transactionId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): NetworkIdentifiers = + NetworkIdentifiers( + checkRequired("acquirerBusinessId", acquirerBusinessId), + checkRequired("acquirerReferenceNumber", acquirerReferenceNumber), + checkRequired( + "authorizationIdentificationResponse", + authorizationIdentificationResponse, + ), + checkRequired("transactionId", transactionId), + additionalProperties.toMutableMap(), + ) + } - /** - * Sets [Builder.fuelChargesAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.fuelChargesAmount] with a well-typed - * [Long] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun fuelChargesAmount(fuelChargesAmount: JsonField) = apply { - this.fuelChargesAmount = fuelChargesAmount - } + private var validated: Boolean = false - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fuel - * charges assessed. - */ - fun fuelChargesCurrency(fuelChargesCurrency: String?) = - fuelChargesCurrency(JsonField.ofNullable(fuelChargesCurrency)) + fun validate(): NetworkIdentifiers = apply { + if (validated) { + return@apply + } - /** - * Alias for calling [Builder.fuelChargesCurrency] with - * `fuelChargesCurrency.orElse(null)`. - */ - fun fuelChargesCurrency(fuelChargesCurrency: Optional) = - fuelChargesCurrency(fuelChargesCurrency.getOrNull()) + acquirerBusinessId() + acquirerReferenceNumber() + authorizationIdentificationResponse() + transactionId() + validated = true + } - /** - * Sets [Builder.fuelChargesCurrency] to an arbitrary JSON value. - * - * You should usually call [Builder.fuelChargesCurrency] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun fuelChargesCurrency(fuelChargesCurrency: JsonField) = apply { - this.fuelChargesCurrency = fuelChargesCurrency - } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** Any insurance being charged for the vehicle. */ - fun insuranceChargesAmount(insuranceChargesAmount: Long?) = - insuranceChargesAmount(JsonField.ofNullable(insuranceChargesAmount)) + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (acquirerBusinessId.asKnown().isPresent) 1 else 0) + + (if (acquirerReferenceNumber.asKnown().isPresent) 1 else 0) + + (if (authorizationIdentificationResponse.asKnown().isPresent) 1 else 0) + + (if (transactionId.asKnown().isPresent) 1 else 0) - /** - * Alias for [Builder.insuranceChargesAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun insuranceChargesAmount(insuranceChargesAmount: Long) = - insuranceChargesAmount(insuranceChargesAmount as Long?) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Alias for calling [Builder.insuranceChargesAmount] with - * `insuranceChargesAmount.orElse(null)`. - */ - fun insuranceChargesAmount(insuranceChargesAmount: Optional) = - insuranceChargesAmount(insuranceChargesAmount.getOrNull()) + return other is NetworkIdentifiers && + acquirerBusinessId == other.acquirerBusinessId && + acquirerReferenceNumber == other.acquirerReferenceNumber && + authorizationIdentificationResponse == + other.authorizationIdentificationResponse && + transactionId == other.transactionId && + additionalProperties == other.additionalProperties + } - /** - * Sets [Builder.insuranceChargesAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.insuranceChargesAmount] with a - * well-typed [Long] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun insuranceChargesAmount(insuranceChargesAmount: JsonField) = - apply { - this.insuranceChargesAmount = insuranceChargesAmount - } + private val hashCode: Int by lazy { + Objects.hash( + acquirerBusinessId, + acquirerReferenceNumber, + authorizationIdentificationResponse, + transactionId, + additionalProperties, + ) + } - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - * insurance charges assessed. - */ - fun insuranceChargesCurrency(insuranceChargesCurrency: String?) = - insuranceChargesCurrency(JsonField.ofNullable(insuranceChargesCurrency)) - - /** - * Alias for calling [Builder.insuranceChargesCurrency] with - * `insuranceChargesCurrency.orElse(null)`. - */ - fun insuranceChargesCurrency(insuranceChargesCurrency: Optional) = - insuranceChargesCurrency(insuranceChargesCurrency.getOrNull()) + override fun hashCode(): Int = hashCode - /** - * Sets [Builder.insuranceChargesCurrency] to an arbitrary JSON value. - * - * You should usually call [Builder.insuranceChargesCurrency] with a - * well-typed [String] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. - */ - fun insuranceChargesCurrency(insuranceChargesCurrency: JsonField) = - apply { - this.insuranceChargesCurrency = insuranceChargesCurrency - } + override fun toString() = + "NetworkIdentifiers{acquirerBusinessId=$acquirerBusinessId, acquirerReferenceNumber=$acquirerReferenceNumber, authorizationIdentificationResponse=$authorizationIdentificationResponse, transactionId=$transactionId, additionalProperties=$additionalProperties}" + } - /** - * An indicator that the cardholder is being billed for a reserved vehicle - * that was not actually rented (that is, a "no-show" charge). - */ - fun noShowIndicator(noShowIndicator: NoShowIndicator?) = - noShowIndicator(JsonField.ofNullable(noShowIndicator)) + /** + * Additional details about the card purchase, such as tax and industry-specific fields. + */ + class PurchaseDetails + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val carRental: JsonField, + private val customerReferenceIdentifier: JsonField, + private val localTaxAmount: JsonField, + private val localTaxCurrency: JsonField, + private val lodging: JsonField, + private val nationalTaxAmount: JsonField, + private val nationalTaxCurrency: JsonField, + private val purchaseIdentifier: JsonField, + private val purchaseIdentifierFormat: JsonField, + private val travel: JsonField, + private val additionalProperties: MutableMap, + ) { - /** - * Alias for calling [Builder.noShowIndicator] with - * `noShowIndicator.orElse(null)`. - */ - fun noShowIndicator(noShowIndicator: Optional) = - noShowIndicator(noShowIndicator.getOrNull()) + @JsonCreator + private constructor( + @JsonProperty("car_rental") + @ExcludeMissing + carRental: JsonField = JsonMissing.of(), + @JsonProperty("customer_reference_identifier") + @ExcludeMissing + customerReferenceIdentifier: JsonField = JsonMissing.of(), + @JsonProperty("local_tax_amount") + @ExcludeMissing + localTaxAmount: JsonField = JsonMissing.of(), + @JsonProperty("local_tax_currency") + @ExcludeMissing + localTaxCurrency: JsonField = JsonMissing.of(), + @JsonProperty("lodging") + @ExcludeMissing + lodging: JsonField = JsonMissing.of(), + @JsonProperty("national_tax_amount") + @ExcludeMissing + nationalTaxAmount: JsonField = JsonMissing.of(), + @JsonProperty("national_tax_currency") + @ExcludeMissing + nationalTaxCurrency: JsonField = JsonMissing.of(), + @JsonProperty("purchase_identifier") + @ExcludeMissing + purchaseIdentifier: JsonField = JsonMissing.of(), + @JsonProperty("purchase_identifier_format") + @ExcludeMissing + purchaseIdentifierFormat: JsonField = + JsonMissing.of(), + @JsonProperty("travel") + @ExcludeMissing + travel: JsonField = JsonMissing.of(), + ) : this( + carRental, + customerReferenceIdentifier, + localTaxAmount, + localTaxCurrency, + lodging, + nationalTaxAmount, + nationalTaxCurrency, + purchaseIdentifier, + purchaseIdentifierFormat, + travel, + mutableMapOf(), + ) - /** - * Sets [Builder.noShowIndicator] to an arbitrary JSON value. - * - * You should usually call [Builder.noShowIndicator] with a well-typed - * [NoShowIndicator] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun noShowIndicator(noShowIndicator: JsonField) = apply { - this.noShowIndicator = noShowIndicator - } + /** + * Fields specific to car rentals. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun carRental(): Optional = carRental.getOptional("car_rental") - /** - * Charges for returning the vehicle at a different location than where it - * was picked up. - */ - fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Long?) = - oneWayDropOffChargesAmount( - JsonField.ofNullable(oneWayDropOffChargesAmount) - ) + /** + * An identifier from the merchant for the customer or consumer. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun customerReferenceIdentifier(): Optional = + customerReferenceIdentifier.getOptional("customer_reference_identifier") - /** - * Alias for [Builder.oneWayDropOffChargesAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Long) = - oneWayDropOffChargesAmount(oneWayDropOffChargesAmount as Long?) + /** + * The state or provincial tax amount in minor units. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun localTaxAmount(): Optional = + localTaxAmount.getOptional("local_tax_amount") - /** - * Alias for calling [Builder.oneWayDropOffChargesAmount] with - * `oneWayDropOffChargesAmount.orElse(null)`. - */ - fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Optional) = - oneWayDropOffChargesAmount(oneWayDropOffChargesAmount.getOrNull()) + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax + * assessed. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun localTaxCurrency(): Optional = + localTaxCurrency.getOptional("local_tax_currency") - /** - * Sets [Builder.oneWayDropOffChargesAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.oneWayDropOffChargesAmount] with a - * well-typed [Long] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun oneWayDropOffChargesAmount( - oneWayDropOffChargesAmount: JsonField - ) = apply { this.oneWayDropOffChargesAmount = oneWayDropOffChargesAmount } + /** + * Fields specific to lodging. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun lodging(): Optional = lodging.getOptional("lodging") - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - * one-way drop-off charges assessed. - */ - fun oneWayDropOffChargesCurrency(oneWayDropOffChargesCurrency: String?) = - oneWayDropOffChargesCurrency( - JsonField.ofNullable(oneWayDropOffChargesCurrency) - ) + /** + * The national tax amount in minor units. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun nationalTaxAmount(): Optional = + nationalTaxAmount.getOptional("national_tax_amount") - /** - * Alias for calling [Builder.oneWayDropOffChargesCurrency] with - * `oneWayDropOffChargesCurrency.orElse(null)`. - */ - fun oneWayDropOffChargesCurrency( - oneWayDropOffChargesCurrency: Optional - ) = oneWayDropOffChargesCurrency(oneWayDropOffChargesCurrency.getOrNull()) + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax + * assessed. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun nationalTaxCurrency(): Optional = + nationalTaxCurrency.getOptional("national_tax_currency") - /** - * Sets [Builder.oneWayDropOffChargesCurrency] to an arbitrary JSON value. - * - * You should usually call [Builder.oneWayDropOffChargesCurrency] with a - * well-typed [String] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. - */ - fun oneWayDropOffChargesCurrency( - oneWayDropOffChargesCurrency: JsonField - ) = apply { - this.oneWayDropOffChargesCurrency = oneWayDropOffChargesCurrency - } + /** + * An identifier from the merchant for the purchase to the issuer and cardholder. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun purchaseIdentifier(): Optional = + purchaseIdentifier.getOptional("purchase_identifier") - /** Name of the person renting the vehicle. */ - fun renterName(renterName: String?) = - renterName(JsonField.ofNullable(renterName)) + /** + * The format of the purchase identifier. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun purchaseIdentifierFormat(): Optional = + purchaseIdentifierFormat.getOptional("purchase_identifier_format") - /** - * Alias for calling [Builder.renterName] with `renterName.orElse(null)`. - */ - fun renterName(renterName: Optional) = - renterName(renterName.getOrNull()) + /** + * Fields specific to travel. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun travel(): Optional = travel.getOptional("travel") - /** - * Sets [Builder.renterName] to an arbitrary JSON value. - * - * You should usually call [Builder.renterName] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun renterName(renterName: JsonField) = apply { - this.renterName = renterName - } + /** + * Returns the raw JSON value of [carRental]. + * + * Unlike [carRental], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("car_rental") + @ExcludeMissing + fun _carRental(): JsonField = carRental - /** Weekly rate being charged for the vehicle. */ - fun weeklyRentalRateAmount(weeklyRentalRateAmount: Long?) = - weeklyRentalRateAmount(JsonField.ofNullable(weeklyRentalRateAmount)) + /** + * Returns the raw JSON value of [customerReferenceIdentifier]. + * + * Unlike [customerReferenceIdentifier], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("customer_reference_identifier") + @ExcludeMissing + fun _customerReferenceIdentifier(): JsonField = customerReferenceIdentifier - /** - * Alias for [Builder.weeklyRentalRateAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun weeklyRentalRateAmount(weeklyRentalRateAmount: Long) = - weeklyRentalRateAmount(weeklyRentalRateAmount as Long?) + /** + * Returns the raw JSON value of [localTaxAmount]. + * + * Unlike [localTaxAmount], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("local_tax_amount") + @ExcludeMissing + fun _localTaxAmount(): JsonField = localTaxAmount - /** - * Alias for calling [Builder.weeklyRentalRateAmount] with - * `weeklyRentalRateAmount.orElse(null)`. - */ - fun weeklyRentalRateAmount(weeklyRentalRateAmount: Optional) = - weeklyRentalRateAmount(weeklyRentalRateAmount.getOrNull()) + /** + * Returns the raw JSON value of [localTaxCurrency]. + * + * Unlike [localTaxCurrency], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("local_tax_currency") + @ExcludeMissing + fun _localTaxCurrency(): JsonField = localTaxCurrency - /** - * Sets [Builder.weeklyRentalRateAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.weeklyRentalRateAmount] with a - * well-typed [Long] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun weeklyRentalRateAmount(weeklyRentalRateAmount: JsonField) = - apply { - this.weeklyRentalRateAmount = weeklyRentalRateAmount - } + /** + * Returns the raw JSON value of [lodging]. + * + * Unlike [lodging], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("lodging") + @ExcludeMissing + fun _lodging(): JsonField = lodging - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - * weekly rental rate. - */ - fun weeklyRentalRateCurrency(weeklyRentalRateCurrency: String?) = - weeklyRentalRateCurrency(JsonField.ofNullable(weeklyRentalRateCurrency)) + /** + * Returns the raw JSON value of [nationalTaxAmount]. + * + * Unlike [nationalTaxAmount], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("national_tax_amount") + @ExcludeMissing + fun _nationalTaxAmount(): JsonField = nationalTaxAmount - /** - * Alias for calling [Builder.weeklyRentalRateCurrency] with - * `weeklyRentalRateCurrency.orElse(null)`. - */ - fun weeklyRentalRateCurrency(weeklyRentalRateCurrency: Optional) = - weeklyRentalRateCurrency(weeklyRentalRateCurrency.getOrNull()) + /** + * Returns the raw JSON value of [nationalTaxCurrency]. + * + * Unlike [nationalTaxCurrency], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("national_tax_currency") + @ExcludeMissing + fun _nationalTaxCurrency(): JsonField = nationalTaxCurrency - /** - * Sets [Builder.weeklyRentalRateCurrency] to an arbitrary JSON value. - * - * You should usually call [Builder.weeklyRentalRateCurrency] with a - * well-typed [String] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. - */ - fun weeklyRentalRateCurrency(weeklyRentalRateCurrency: JsonField) = - apply { - this.weeklyRentalRateCurrency = weeklyRentalRateCurrency - } + /** + * Returns the raw JSON value of [purchaseIdentifier]. + * + * Unlike [purchaseIdentifier], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("purchase_identifier") + @ExcludeMissing + fun _purchaseIdentifier(): JsonField = purchaseIdentifier - fun additionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** + * Returns the raw JSON value of [purchaseIdentifierFormat]. + * + * Unlike [purchaseIdentifierFormat], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("purchase_identifier_format") + @ExcludeMissing + fun _purchaseIdentifierFormat(): JsonField = + purchaseIdentifierFormat - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** + * Returns the raw JSON value of [travel]. + * + * Unlike [travel], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("travel") @ExcludeMissing fun _travel(): JsonField = travel - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + fun toBuilder() = Builder().from(this) - /** - * Returns an immutable instance of [CarRental]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .carClassCode() - * .checkoutDate() - * .dailyRentalRateAmount() - * .dailyRentalRateCurrency() - * .daysRented() - * .extraCharges() - * .fuelChargesAmount() - * .fuelChargesCurrency() - * .insuranceChargesAmount() - * .insuranceChargesCurrency() - * .noShowIndicator() - * .oneWayDropOffChargesAmount() - * .oneWayDropOffChargesCurrency() - * .renterName() - * .weeklyRentalRateAmount() - * .weeklyRentalRateCurrency() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CarRental = - CarRental( - checkRequired("carClassCode", carClassCode), - checkRequired("checkoutDate", checkoutDate), - checkRequired("dailyRentalRateAmount", dailyRentalRateAmount), - checkRequired("dailyRentalRateCurrency", dailyRentalRateCurrency), - checkRequired("daysRented", daysRented), - checkRequired("extraCharges", extraCharges), - checkRequired("fuelChargesAmount", fuelChargesAmount), - checkRequired("fuelChargesCurrency", fuelChargesCurrency), - checkRequired("insuranceChargesAmount", insuranceChargesAmount), - checkRequired("insuranceChargesCurrency", insuranceChargesCurrency), - checkRequired("noShowIndicator", noShowIndicator), - checkRequired( - "oneWayDropOffChargesAmount", - oneWayDropOffChargesAmount, - ), - checkRequired( - "oneWayDropOffChargesCurrency", - oneWayDropOffChargesCurrency, - ), - checkRequired("renterName", renterName), - checkRequired("weeklyRentalRateAmount", weeklyRentalRateAmount), - checkRequired("weeklyRentalRateCurrency", weeklyRentalRateCurrency), - additionalProperties.toMutableMap(), - ) - } + companion object { - private var validated: Boolean = false + /** + * Returns a mutable builder for constructing an instance of [PurchaseDetails]. + * + * The following fields are required: + * ```java + * .carRental() + * .customerReferenceIdentifier() + * .localTaxAmount() + * .localTaxCurrency() + * .lodging() + * .nationalTaxAmount() + * .nationalTaxCurrency() + * .purchaseIdentifier() + * .purchaseIdentifierFormat() + * .travel() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - fun validate(): CarRental = apply { - if (validated) { - return@apply - } + /** A builder for [PurchaseDetails]. */ + class Builder internal constructor() { - carClassCode() - checkoutDate() - dailyRentalRateAmount() - dailyRentalRateCurrency() - daysRented() - extraCharges().ifPresent { it.validate() } - fuelChargesAmount() - fuelChargesCurrency() - insuranceChargesAmount() - insuranceChargesCurrency() - noShowIndicator().ifPresent { it.validate() } - oneWayDropOffChargesAmount() - oneWayDropOffChargesCurrency() - renterName() - weeklyRentalRateAmount() - weeklyRentalRateCurrency() - validated = true + private var carRental: JsonField? = null + private var customerReferenceIdentifier: JsonField? = null + private var localTaxAmount: JsonField? = null + private var localTaxCurrency: JsonField? = null + private var lodging: JsonField? = null + private var nationalTaxAmount: JsonField? = null + private var nationalTaxCurrency: JsonField? = null + private var purchaseIdentifier: JsonField? = null + private var purchaseIdentifierFormat: JsonField? = + null + private var travel: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(purchaseDetails: PurchaseDetails) = apply { + carRental = purchaseDetails.carRental + customerReferenceIdentifier = purchaseDetails.customerReferenceIdentifier + localTaxAmount = purchaseDetails.localTaxAmount + localTaxCurrency = purchaseDetails.localTaxCurrency + lodging = purchaseDetails.lodging + nationalTaxAmount = purchaseDetails.nationalTaxAmount + nationalTaxCurrency = purchaseDetails.nationalTaxCurrency + purchaseIdentifier = purchaseDetails.purchaseIdentifier + purchaseIdentifierFormat = purchaseDetails.purchaseIdentifierFormat + travel = purchaseDetails.travel + additionalProperties = purchaseDetails.additionalProperties.toMutableMap() } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** Fields specific to car rentals. */ + fun carRental(carRental: CarRental?) = + carRental(JsonField.ofNullable(carRental)) + + /** Alias for calling [Builder.carRental] with `carRental.orElse(null)`. */ + fun carRental(carRental: Optional) = carRental(carRental.getOrNull()) /** - * Returns a score indicating how many valid values are contained in this object - * recursively. + * Sets [Builder.carRental] to an arbitrary JSON value. * - * Used for best match union deserialization. + * You should usually call [Builder.carRental] with a well-typed [CarRental] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ - @JvmSynthetic - internal fun validity(): Int = - (if (carClassCode.asKnown().isPresent) 1 else 0) + - (if (checkoutDate.asKnown().isPresent) 1 else 0) + - (if (dailyRentalRateAmount.asKnown().isPresent) 1 else 0) + - (if (dailyRentalRateCurrency.asKnown().isPresent) 1 else 0) + - (if (daysRented.asKnown().isPresent) 1 else 0) + - (extraCharges.asKnown().getOrNull()?.validity() ?: 0) + - (if (fuelChargesAmount.asKnown().isPresent) 1 else 0) + - (if (fuelChargesCurrency.asKnown().isPresent) 1 else 0) + - (if (insuranceChargesAmount.asKnown().isPresent) 1 else 0) + - (if (insuranceChargesCurrency.asKnown().isPresent) 1 else 0) + - (noShowIndicator.asKnown().getOrNull()?.validity() ?: 0) + - (if (oneWayDropOffChargesAmount.asKnown().isPresent) 1 else 0) + - (if (oneWayDropOffChargesCurrency.asKnown().isPresent) 1 else 0) + - (if (renterName.asKnown().isPresent) 1 else 0) + - (if (weeklyRentalRateAmount.asKnown().isPresent) 1 else 0) + - (if (weeklyRentalRateCurrency.asKnown().isPresent) 1 else 0) + fun carRental(carRental: JsonField) = apply { + this.carRental = carRental + } - /** Additional charges (gas, late fee, etc.) being billed. */ - class ExtraCharges - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** An identifier from the merchant for the customer or consumer. */ + fun customerReferenceIdentifier(customerReferenceIdentifier: String?) = + customerReferenceIdentifier( + JsonField.ofNullable(customerReferenceIdentifier) + ) - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + /** + * Alias for calling [Builder.customerReferenceIdentifier] with + * `customerReferenceIdentifier.orElse(null)`. + */ + fun customerReferenceIdentifier(customerReferenceIdentifier: Optional) = + customerReferenceIdentifier(customerReferenceIdentifier.getOrNull()) - companion object { + /** + * Sets [Builder.customerReferenceIdentifier] to an arbitrary JSON value. + * + * You should usually call [Builder.customerReferenceIdentifier] with a + * well-typed [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun customerReferenceIdentifier( + customerReferenceIdentifier: JsonField + ) = apply { this.customerReferenceIdentifier = customerReferenceIdentifier } - /** No extra charge */ - @JvmField val NO_EXTRA_CHARGE = of("no_extra_charge") + /** The state or provincial tax amount in minor units. */ + fun localTaxAmount(localTaxAmount: Long?) = + localTaxAmount(JsonField.ofNullable(localTaxAmount)) - /** Gas */ - @JvmField val GAS = of("gas") + /** + * Alias for [Builder.localTaxAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun localTaxAmount(localTaxAmount: Long) = + localTaxAmount(localTaxAmount as Long?) - /** Extra mileage */ - @JvmField val EXTRA_MILEAGE = of("extra_mileage") + /** + * Alias for calling [Builder.localTaxAmount] with + * `localTaxAmount.orElse(null)`. + */ + fun localTaxAmount(localTaxAmount: Optional) = + localTaxAmount(localTaxAmount.getOrNull()) - /** Late return */ - @JvmField val LATE_RETURN = of("late_return") + /** + * Sets [Builder.localTaxAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.localTaxAmount] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun localTaxAmount(localTaxAmount: JsonField) = apply { + this.localTaxAmount = localTaxAmount + } - /** One way service fee */ - @JvmField val ONE_WAY_SERVICE_FEE = of("one_way_service_fee") + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax + * assessed. + */ + fun localTaxCurrency(localTaxCurrency: String?) = + localTaxCurrency(JsonField.ofNullable(localTaxCurrency)) - /** Parking violation */ - @JvmField val PARKING_VIOLATION = of("parking_violation") + /** + * Alias for calling [Builder.localTaxCurrency] with + * `localTaxCurrency.orElse(null)`. + */ + fun localTaxCurrency(localTaxCurrency: Optional) = + localTaxCurrency(localTaxCurrency.getOrNull()) - @JvmStatic fun of(value: String) = ExtraCharges(JsonField.of(value)) - } + /** + * Sets [Builder.localTaxCurrency] to an arbitrary JSON value. + * + * You should usually call [Builder.localTaxCurrency] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun localTaxCurrency(localTaxCurrency: JsonField) = apply { + this.localTaxCurrency = localTaxCurrency + } - /** An enum containing [ExtraCharges]'s known values. */ - enum class Known { - /** No extra charge */ - NO_EXTRA_CHARGE, - /** Gas */ - GAS, - /** Extra mileage */ - EXTRA_MILEAGE, - /** Late return */ - LATE_RETURN, - /** One way service fee */ - ONE_WAY_SERVICE_FEE, - /** Parking violation */ - PARKING_VIOLATION, - } + /** Fields specific to lodging. */ + fun lodging(lodging: Lodging?) = lodging(JsonField.ofNullable(lodging)) - /** - * An enum containing [ExtraCharges]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [ExtraCharges] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** No extra charge */ - NO_EXTRA_CHARGE, - /** Gas */ - GAS, - /** Extra mileage */ - EXTRA_MILEAGE, - /** Late return */ - LATE_RETURN, - /** One way service fee */ - ONE_WAY_SERVICE_FEE, - /** Parking violation */ - PARKING_VIOLATION, - /** - * An enum member indicating that [ExtraCharges] was instantiated with - * an unknown value. - */ - _UNKNOWN, - } + /** Alias for calling [Builder.lodging] with `lodging.orElse(null)`. */ + fun lodging(lodging: Optional) = lodging(lodging.getOrNull()) - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - NO_EXTRA_CHARGE -> Value.NO_EXTRA_CHARGE - GAS -> Value.GAS - EXTRA_MILEAGE -> Value.EXTRA_MILEAGE - LATE_RETURN -> Value.LATE_RETURN - ONE_WAY_SERVICE_FEE -> Value.ONE_WAY_SERVICE_FEE - PARKING_VIOLATION -> Value.PARKING_VIOLATION - else -> Value._UNKNOWN - } + /** + * Sets [Builder.lodging] to an arbitrary JSON value. + * + * You should usually call [Builder.lodging] with a well-typed [Lodging] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun lodging(lodging: JsonField) = apply { this.lodging = lodging } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - NO_EXTRA_CHARGE -> Known.NO_EXTRA_CHARGE - GAS -> Known.GAS - EXTRA_MILEAGE -> Known.EXTRA_MILEAGE - LATE_RETURN -> Known.LATE_RETURN - ONE_WAY_SERVICE_FEE -> Known.ONE_WAY_SERVICE_FEE - PARKING_VIOLATION -> Known.PARKING_VIOLATION - else -> - throw IncreaseInvalidDataException( - "Unknown ExtraCharges: $value" - ) - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + /** The national tax amount in minor units. */ + fun nationalTaxAmount(nationalTaxAmount: Long?) = + nationalTaxAmount(JsonField.ofNullable(nationalTaxAmount)) - private var validated: Boolean = false + /** + * Alias for [Builder.nationalTaxAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun nationalTaxAmount(nationalTaxAmount: Long) = + nationalTaxAmount(nationalTaxAmount as Long?) - fun validate(): ExtraCharges = apply { - if (validated) { - return@apply - } + /** + * Alias for calling [Builder.nationalTaxAmount] with + * `nationalTaxAmount.orElse(null)`. + */ + fun nationalTaxAmount(nationalTaxAmount: Optional) = + nationalTaxAmount(nationalTaxAmount.getOrNull()) - known() - validated = true - } + /** + * Sets [Builder.nationalTaxAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.nationalTaxAmount] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun nationalTaxAmount(nationalTaxAmount: JsonField) = apply { + this.nationalTaxAmount = nationalTaxAmount + } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax + * assessed. + */ + fun nationalTaxCurrency(nationalTaxCurrency: String?) = + nationalTaxCurrency(JsonField.ofNullable(nationalTaxCurrency)) - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + /** + * Alias for calling [Builder.nationalTaxCurrency] with + * `nationalTaxCurrency.orElse(null)`. + */ + fun nationalTaxCurrency(nationalTaxCurrency: Optional) = + nationalTaxCurrency(nationalTaxCurrency.getOrNull()) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Sets [Builder.nationalTaxCurrency] to an arbitrary JSON value. + * + * You should usually call [Builder.nationalTaxCurrency] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun nationalTaxCurrency(nationalTaxCurrency: JsonField) = apply { + this.nationalTaxCurrency = nationalTaxCurrency + } - return other is ExtraCharges && value == other.value - } + /** + * An identifier from the merchant for the purchase to the issuer and + * cardholder. + */ + fun purchaseIdentifier(purchaseIdentifier: String?) = + purchaseIdentifier(JsonField.ofNullable(purchaseIdentifier)) - override fun hashCode() = value.hashCode() + /** + * Alias for calling [Builder.purchaseIdentifier] with + * `purchaseIdentifier.orElse(null)`. + */ + fun purchaseIdentifier(purchaseIdentifier: Optional) = + purchaseIdentifier(purchaseIdentifier.getOrNull()) - override fun toString() = value.toString() + /** + * Sets [Builder.purchaseIdentifier] to an arbitrary JSON value. + * + * You should usually call [Builder.purchaseIdentifier] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun purchaseIdentifier(purchaseIdentifier: JsonField) = apply { + this.purchaseIdentifier = purchaseIdentifier } + /** The format of the purchase identifier. */ + fun purchaseIdentifierFormat( + purchaseIdentifierFormat: PurchaseIdentifierFormat? + ) = purchaseIdentifierFormat(JsonField.ofNullable(purchaseIdentifierFormat)) + /** - * An indicator that the cardholder is being billed for a reserved vehicle that - * was not actually rented (that is, a "no-show" charge). + * Alias for calling [Builder.purchaseIdentifierFormat] with + * `purchaseIdentifierFormat.orElse(null)`. */ - class NoShowIndicator - @JsonCreator - private constructor(private val value: JsonField) : Enum { + fun purchaseIdentifierFormat( + purchaseIdentifierFormat: Optional + ) = purchaseIdentifierFormat(purchaseIdentifierFormat.getOrNull()) - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + /** + * Sets [Builder.purchaseIdentifierFormat] to an arbitrary JSON value. + * + * You should usually call [Builder.purchaseIdentifierFormat] with a well-typed + * [PurchaseIdentifierFormat] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ + fun purchaseIdentifierFormat( + purchaseIdentifierFormat: JsonField + ) = apply { this.purchaseIdentifierFormat = purchaseIdentifierFormat } - companion object { + /** Fields specific to travel. */ + fun travel(travel: Travel?) = travel(JsonField.ofNullable(travel)) - /** Not applicable */ - @JvmField val NOT_APPLICABLE = of("not_applicable") + /** Alias for calling [Builder.travel] with `travel.orElse(null)`. */ + fun travel(travel: Optional) = travel(travel.getOrNull()) - /** No show for specialized vehicle */ - @JvmField - val NO_SHOW_FOR_SPECIALIZED_VEHICLE = - of("no_show_for_specialized_vehicle") + /** + * Sets [Builder.travel] to an arbitrary JSON value. + * + * You should usually call [Builder.travel] with a well-typed [Travel] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun travel(travel: JsonField) = apply { this.travel = travel } - @JvmStatic fun of(value: String) = NoShowIndicator(JsonField.of(value)) - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** An enum containing [NoShowIndicator]'s known values. */ - enum class Known { - /** Not applicable */ - NOT_APPLICABLE, - /** No show for specialized vehicle */ - NO_SHOW_FOR_SPECIALIZED_VEHICLE, - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * An enum containing [NoShowIndicator]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [NoShowIndicator] can contain an unknown value in a couple - * of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** Not applicable */ - NOT_APPLICABLE, - /** No show for specialized vehicle */ - NO_SHOW_FOR_SPECIALIZED_VEHICLE, - /** - * An enum member indicating that [NoShowIndicator] was instantiated - * with an unknown value. - */ - _UNKNOWN, + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - NOT_APPLICABLE -> Value.NOT_APPLICABLE - NO_SHOW_FOR_SPECIALIZED_VEHICLE -> - Value.NO_SHOW_FOR_SPECIALIZED_VEHICLE - else -> Value._UNKNOWN - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - NOT_APPLICABLE -> Known.NOT_APPLICABLE - NO_SHOW_FOR_SPECIALIZED_VEHICLE -> - Known.NO_SHOW_FOR_SPECIALIZED_VEHICLE - else -> - throw IncreaseInvalidDataException( - "Unknown NoShowIndicator: $value" - ) - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): NoShowIndicator = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - return other is NoShowIndicator && value == other.value - } + /** + * Returns an immutable instance of [PurchaseDetails]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .carRental() + * .customerReferenceIdentifier() + * .localTaxAmount() + * .localTaxCurrency() + * .lodging() + * .nationalTaxAmount() + * .nationalTaxCurrency() + * .purchaseIdentifier() + * .purchaseIdentifierFormat() + * .travel() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): PurchaseDetails = + PurchaseDetails( + checkRequired("carRental", carRental), + checkRequired( + "customerReferenceIdentifier", + customerReferenceIdentifier, + ), + checkRequired("localTaxAmount", localTaxAmount), + checkRequired("localTaxCurrency", localTaxCurrency), + checkRequired("lodging", lodging), + checkRequired("nationalTaxAmount", nationalTaxAmount), + checkRequired("nationalTaxCurrency", nationalTaxCurrency), + checkRequired("purchaseIdentifier", purchaseIdentifier), + checkRequired("purchaseIdentifierFormat", purchaseIdentifierFormat), + checkRequired("travel", travel), + additionalProperties.toMutableMap(), + ) + } - override fun hashCode() = value.hashCode() + private var validated: Boolean = false - override fun toString() = value.toString() + fun validate(): PurchaseDetails = apply { + if (validated) { + return@apply } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CarRental && - carClassCode == other.carClassCode && - checkoutDate == other.checkoutDate && - dailyRentalRateAmount == other.dailyRentalRateAmount && - dailyRentalRateCurrency == other.dailyRentalRateCurrency && - daysRented == other.daysRented && - extraCharges == other.extraCharges && - fuelChargesAmount == other.fuelChargesAmount && - fuelChargesCurrency == other.fuelChargesCurrency && - insuranceChargesAmount == other.insuranceChargesAmount && - insuranceChargesCurrency == other.insuranceChargesCurrency && - noShowIndicator == other.noShowIndicator && - oneWayDropOffChargesAmount == other.oneWayDropOffChargesAmount && - oneWayDropOffChargesCurrency == other.oneWayDropOffChargesCurrency && - renterName == other.renterName && - weeklyRentalRateAmount == other.weeklyRentalRateAmount && - weeklyRentalRateCurrency == other.weeklyRentalRateCurrency && - additionalProperties == other.additionalProperties - } + carRental().ifPresent { it.validate() } + customerReferenceIdentifier() + localTaxAmount() + localTaxCurrency() + lodging().ifPresent { it.validate() } + nationalTaxAmount() + nationalTaxCurrency() + purchaseIdentifier() + purchaseIdentifierFormat().ifPresent { it.validate() } + travel().ifPresent { it.validate() } + validated = true + } - private val hashCode: Int by lazy { - Objects.hash( - carClassCode, - checkoutDate, - dailyRentalRateAmount, - dailyRentalRateCurrency, - daysRented, - extraCharges, - fuelChargesAmount, - fuelChargesCurrency, - insuranceChargesAmount, - insuranceChargesCurrency, - noShowIndicator, - oneWayDropOffChargesAmount, - oneWayDropOffChargesCurrency, - renterName, - weeklyRentalRateAmount, - weeklyRentalRateCurrency, - additionalProperties, - ) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false } - override fun hashCode(): Int = hashCode - - override fun toString() = - "CarRental{carClassCode=$carClassCode, checkoutDate=$checkoutDate, dailyRentalRateAmount=$dailyRentalRateAmount, dailyRentalRateCurrency=$dailyRentalRateCurrency, daysRented=$daysRented, extraCharges=$extraCharges, fuelChargesAmount=$fuelChargesAmount, fuelChargesCurrency=$fuelChargesCurrency, insuranceChargesAmount=$insuranceChargesAmount, insuranceChargesCurrency=$insuranceChargesCurrency, noShowIndicator=$noShowIndicator, oneWayDropOffChargesAmount=$oneWayDropOffChargesAmount, oneWayDropOffChargesCurrency=$oneWayDropOffChargesCurrency, renterName=$renterName, weeklyRentalRateAmount=$weeklyRentalRateAmount, weeklyRentalRateCurrency=$weeklyRentalRateCurrency, additionalProperties=$additionalProperties}" - } + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (carRental.asKnown().getOrNull()?.validity() ?: 0) + + (if (customerReferenceIdentifier.asKnown().isPresent) 1 else 0) + + (if (localTaxAmount.asKnown().isPresent) 1 else 0) + + (if (localTaxCurrency.asKnown().isPresent) 1 else 0) + + (lodging.asKnown().getOrNull()?.validity() ?: 0) + + (if (nationalTaxAmount.asKnown().isPresent) 1 else 0) + + (if (nationalTaxCurrency.asKnown().isPresent) 1 else 0) + + (if (purchaseIdentifier.asKnown().isPresent) 1 else 0) + + (purchaseIdentifierFormat.asKnown().getOrNull()?.validity() ?: 0) + + (travel.asKnown().getOrNull()?.validity() ?: 0) - /** Fields specific to lodging. */ - class Lodging + /** Fields specific to car rentals. */ + class CarRental @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val checkInDate: JsonField, - private val dailyRoomRateAmount: JsonField, - private val dailyRoomRateCurrency: JsonField, + private val carClassCode: JsonField, + private val checkoutDate: JsonField, + private val dailyRentalRateAmount: JsonField, + private val dailyRentalRateCurrency: JsonField, + private val daysRented: JsonField, private val extraCharges: JsonField, - private val folioCashAdvancesAmount: JsonField, - private val folioCashAdvancesCurrency: JsonField, - private val foodBeverageChargesAmount: JsonField, - private val foodBeverageChargesCurrency: JsonField, + private val fuelChargesAmount: JsonField, + private val fuelChargesCurrency: JsonField, + private val insuranceChargesAmount: JsonField, + private val insuranceChargesCurrency: JsonField, private val noShowIndicator: JsonField, - private val prepaidExpensesAmount: JsonField, - private val prepaidExpensesCurrency: JsonField, - private val roomNights: JsonField, - private val totalRoomTaxAmount: JsonField, - private val totalRoomTaxCurrency: JsonField, - private val totalTaxAmount: JsonField, - private val totalTaxCurrency: JsonField, + private val oneWayDropOffChargesAmount: JsonField, + private val oneWayDropOffChargesCurrency: JsonField, + private val renterName: JsonField, + private val weeklyRentalRateAmount: JsonField, + private val weeklyRentalRateCurrency: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("check_in_date") + @JsonProperty("car_class_code") @ExcludeMissing - checkInDate: JsonField = JsonMissing.of(), - @JsonProperty("daily_room_rate_amount") + carClassCode: JsonField = JsonMissing.of(), + @JsonProperty("checkout_date") @ExcludeMissing - dailyRoomRateAmount: JsonField = JsonMissing.of(), - @JsonProperty("daily_room_rate_currency") + checkoutDate: JsonField = JsonMissing.of(), + @JsonProperty("daily_rental_rate_amount") @ExcludeMissing - dailyRoomRateCurrency: JsonField = JsonMissing.of(), + dailyRentalRateAmount: JsonField = JsonMissing.of(), + @JsonProperty("daily_rental_rate_currency") + @ExcludeMissing + dailyRentalRateCurrency: JsonField = JsonMissing.of(), + @JsonProperty("days_rented") + @ExcludeMissing + daysRented: JsonField = JsonMissing.of(), @JsonProperty("extra_charges") @ExcludeMissing extraCharges: JsonField = JsonMissing.of(), - @JsonProperty("folio_cash_advances_amount") + @JsonProperty("fuel_charges_amount") @ExcludeMissing - folioCashAdvancesAmount: JsonField = JsonMissing.of(), - @JsonProperty("folio_cash_advances_currency") + fuelChargesAmount: JsonField = JsonMissing.of(), + @JsonProperty("fuel_charges_currency") @ExcludeMissing - folioCashAdvancesCurrency: JsonField = JsonMissing.of(), - @JsonProperty("food_beverage_charges_amount") + fuelChargesCurrency: JsonField = JsonMissing.of(), + @JsonProperty("insurance_charges_amount") @ExcludeMissing - foodBeverageChargesAmount: JsonField = JsonMissing.of(), - @JsonProperty("food_beverage_charges_currency") + insuranceChargesAmount: JsonField = JsonMissing.of(), + @JsonProperty("insurance_charges_currency") @ExcludeMissing - foodBeverageChargesCurrency: JsonField = JsonMissing.of(), + insuranceChargesCurrency: JsonField = JsonMissing.of(), @JsonProperty("no_show_indicator") @ExcludeMissing noShowIndicator: JsonField = JsonMissing.of(), - @JsonProperty("prepaid_expenses_amount") - @ExcludeMissing - prepaidExpensesAmount: JsonField = JsonMissing.of(), - @JsonProperty("prepaid_expenses_currency") - @ExcludeMissing - prepaidExpensesCurrency: JsonField = JsonMissing.of(), - @JsonProperty("room_nights") + @JsonProperty("one_way_drop_off_charges_amount") @ExcludeMissing - roomNights: JsonField = JsonMissing.of(), - @JsonProperty("total_room_tax_amount") + oneWayDropOffChargesAmount: JsonField = JsonMissing.of(), + @JsonProperty("one_way_drop_off_charges_currency") @ExcludeMissing - totalRoomTaxAmount: JsonField = JsonMissing.of(), - @JsonProperty("total_room_tax_currency") + oneWayDropOffChargesCurrency: JsonField = JsonMissing.of(), + @JsonProperty("renter_name") @ExcludeMissing - totalRoomTaxCurrency: JsonField = JsonMissing.of(), - @JsonProperty("total_tax_amount") + renterName: JsonField = JsonMissing.of(), + @JsonProperty("weekly_rental_rate_amount") @ExcludeMissing - totalTaxAmount: JsonField = JsonMissing.of(), - @JsonProperty("total_tax_currency") + weeklyRentalRateAmount: JsonField = JsonMissing.of(), + @JsonProperty("weekly_rental_rate_currency") @ExcludeMissing - totalTaxCurrency: JsonField = JsonMissing.of(), + weeklyRentalRateCurrency: JsonField = JsonMissing.of(), ) : this( - checkInDate, - dailyRoomRateAmount, - dailyRoomRateCurrency, + carClassCode, + checkoutDate, + dailyRentalRateAmount, + dailyRentalRateCurrency, + daysRented, extraCharges, - folioCashAdvancesAmount, - folioCashAdvancesCurrency, - foodBeverageChargesAmount, - foodBeverageChargesCurrency, + fuelChargesAmount, + fuelChargesCurrency, + insuranceChargesAmount, + insuranceChargesCurrency, noShowIndicator, - prepaidExpensesAmount, - prepaidExpensesCurrency, - roomNights, - totalRoomTaxAmount, - totalRoomTaxCurrency, - totalTaxAmount, - totalTaxCurrency, + oneWayDropOffChargesAmount, + oneWayDropOffChargesCurrency, + renterName, + weeklyRentalRateAmount, + weeklyRentalRateCurrency, mutableMapOf(), ) /** - * Date the customer checked in. + * Code indicating the vehicle's class. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun checkInDate(): Optional = - checkInDate.getOptional("check_in_date") + fun carClassCode(): Optional = + carClassCode.getOptional("car_class_code") /** - * Daily rate being charged for the room. + * Date the customer picked up the car or, in the case of a no-show or pre-pay + * transaction, the scheduled pick up date. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun dailyRoomRateAmount(): Optional = - dailyRoomRateAmount.getOptional("daily_room_rate_amount") + fun checkoutDate(): Optional = + checkoutDate.getOptional("checkout_date") /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily - * room rate. + * Daily rate being charged for the vehicle. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun dailyRoomRateCurrency(): Optional = - dailyRoomRateCurrency.getOptional("daily_room_rate_currency") + fun dailyRentalRateAmount(): Optional = + dailyRentalRateAmount.getOptional("daily_rental_rate_amount") /** - * Additional charges (phone, late check-out, etc.) being billed. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily + * rental rate. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun extraCharges(): Optional = - extraCharges.getOptional("extra_charges") + fun dailyRentalRateCurrency(): Optional = + dailyRentalRateCurrency.getOptional("daily_rental_rate_currency") /** - * Folio cash advances for the room. + * Number of days the vehicle was rented. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun folioCashAdvancesAmount(): Optional = - folioCashAdvancesAmount.getOptional("folio_cash_advances_amount") + fun daysRented(): Optional = daysRented.getOptional("days_rented") /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the folio - * cash advances. + * Additional charges (gas, late fee, etc.) being billed. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun folioCashAdvancesCurrency(): Optional = - folioCashAdvancesCurrency.getOptional("folio_cash_advances_currency") + fun extraCharges(): Optional = + extraCharges.getOptional("extra_charges") /** - * Food and beverage charges for the room. + * Fuel charges for the vehicle. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun foodBeverageChargesAmount(): Optional = - foodBeverageChargesAmount.getOptional("food_beverage_charges_amount") + fun fuelChargesAmount(): Optional = + fuelChargesAmount.getOptional("fuel_charges_amount") /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the food and - * beverage charges. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fuel + * charges assessed. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun foodBeverageChargesCurrency(): Optional = - foodBeverageChargesCurrency.getOptional("food_beverage_charges_currency") + fun fuelChargesCurrency(): Optional = + fuelChargesCurrency.getOptional("fuel_charges_currency") /** - * Indicator that the cardholder is being billed for a reserved room that was - * not actually used. + * Any insurance being charged for the vehicle. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun noShowIndicator(): Optional = - noShowIndicator.getOptional("no_show_indicator") + fun insuranceChargesAmount(): Optional = + insuranceChargesAmount.getOptional("insurance_charges_amount") /** - * Prepaid expenses being charged for the room. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the insurance + * charges assessed. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun prepaidExpensesAmount(): Optional = - prepaidExpensesAmount.getOptional("prepaid_expenses_amount") + fun insuranceChargesCurrency(): Optional = + insuranceChargesCurrency.getOptional("insurance_charges_currency") /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the prepaid - * expenses. + * An indicator that the cardholder is being billed for a reserved vehicle that + * was not actually rented (that is, a "no-show" charge). * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun prepaidExpensesCurrency(): Optional = - prepaidExpensesCurrency.getOptional("prepaid_expenses_currency") + fun noShowIndicator(): Optional = + noShowIndicator.getOptional("no_show_indicator") /** - * Number of nights the room was rented. + * Charges for returning the vehicle at a different location than where it was + * picked up. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun roomNights(): Optional = roomNights.getOptional("room_nights") + fun oneWayDropOffChargesAmount(): Optional = + oneWayDropOffChargesAmount.getOptional("one_way_drop_off_charges_amount") /** - * Total room tax being charged. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the one-way + * drop-off charges assessed. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun totalRoomTaxAmount(): Optional = - totalRoomTaxAmount.getOptional("total_room_tax_amount") + fun oneWayDropOffChargesCurrency(): Optional = + oneWayDropOffChargesCurrency.getOptional( + "one_way_drop_off_charges_currency" + ) /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total - * room tax. + * Name of the person renting the vehicle. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun totalRoomTaxCurrency(): Optional = - totalRoomTaxCurrency.getOptional("total_room_tax_currency") + fun renterName(): Optional = renterName.getOptional("renter_name") /** - * Total tax being charged for the room. + * Weekly rate being charged for the vehicle. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun totalTaxAmount(): Optional = - totalTaxAmount.getOptional("total_tax_amount") + fun weeklyRentalRateAmount(): Optional = + weeklyRentalRateAmount.getOptional("weekly_rental_rate_amount") /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total tax - * assessed. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the weekly + * rental rate. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun totalTaxCurrency(): Optional = - totalTaxCurrency.getOptional("total_tax_currency") + fun weeklyRentalRateCurrency(): Optional = + weeklyRentalRateCurrency.getOptional("weekly_rental_rate_currency") /** - * Returns the raw JSON value of [checkInDate]. + * Returns the raw JSON value of [carClassCode]. * - * Unlike [checkInDate], this method doesn't throw if the JSON field has an + * Unlike [carClassCode], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("check_in_date") + @JsonProperty("car_class_code") @ExcludeMissing - fun _checkInDate(): JsonField = checkInDate + fun _carClassCode(): JsonField = carClassCode /** - * Returns the raw JSON value of [dailyRoomRateAmount]. + * Returns the raw JSON value of [checkoutDate]. * - * Unlike [dailyRoomRateAmount], this method doesn't throw if the JSON field has - * an unexpected type. + * Unlike [checkoutDate], this method doesn't throw if the JSON field has an + * unexpected type. */ - @JsonProperty("daily_room_rate_amount") + @JsonProperty("checkout_date") @ExcludeMissing - fun _dailyRoomRateAmount(): JsonField = dailyRoomRateAmount + fun _checkoutDate(): JsonField = checkoutDate /** - * Returns the raw JSON value of [dailyRoomRateCurrency]. + * Returns the raw JSON value of [dailyRentalRateAmount]. * - * Unlike [dailyRoomRateCurrency], this method doesn't throw if the JSON field + * Unlike [dailyRentalRateAmount], this method doesn't throw if the JSON field * has an unexpected type. */ - @JsonProperty("daily_room_rate_currency") + @JsonProperty("daily_rental_rate_amount") @ExcludeMissing - fun _dailyRoomRateCurrency(): JsonField = dailyRoomRateCurrency + fun _dailyRentalRateAmount(): JsonField = dailyRentalRateAmount + + /** + * Returns the raw JSON value of [dailyRentalRateCurrency]. + * + * Unlike [dailyRentalRateCurrency], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("daily_rental_rate_currency") + @ExcludeMissing + fun _dailyRentalRateCurrency(): JsonField = dailyRentalRateCurrency + + /** + * Returns the raw JSON value of [daysRented]. + * + * Unlike [daysRented], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("days_rented") + @ExcludeMissing + fun _daysRented(): JsonField = daysRented /** * Returns the raw JSON value of [extraCharges]. @@ -23050,45 +23057,44 @@ private constructor( fun _extraCharges(): JsonField = extraCharges /** - * Returns the raw JSON value of [folioCashAdvancesAmount]. + * Returns the raw JSON value of [fuelChargesAmount]. * - * Unlike [folioCashAdvancesAmount], this method doesn't throw if the JSON field - * has an unexpected type. + * Unlike [fuelChargesAmount], this method doesn't throw if the JSON field has + * an unexpected type. */ - @JsonProperty("folio_cash_advances_amount") + @JsonProperty("fuel_charges_amount") @ExcludeMissing - fun _folioCashAdvancesAmount(): JsonField = folioCashAdvancesAmount + fun _fuelChargesAmount(): JsonField = fuelChargesAmount /** - * Returns the raw JSON value of [folioCashAdvancesCurrency]. + * Returns the raw JSON value of [fuelChargesCurrency]. * - * Unlike [folioCashAdvancesCurrency], this method doesn't throw if the JSON - * field has an unexpected type. + * Unlike [fuelChargesCurrency], this method doesn't throw if the JSON field has + * an unexpected type. */ - @JsonProperty("folio_cash_advances_currency") + @JsonProperty("fuel_charges_currency") @ExcludeMissing - fun _folioCashAdvancesCurrency(): JsonField = folioCashAdvancesCurrency + fun _fuelChargesCurrency(): JsonField = fuelChargesCurrency /** - * Returns the raw JSON value of [foodBeverageChargesAmount]. + * Returns the raw JSON value of [insuranceChargesAmount]. * - * Unlike [foodBeverageChargesAmount], this method doesn't throw if the JSON - * field has an unexpected type. + * Unlike [insuranceChargesAmount], this method doesn't throw if the JSON field + * has an unexpected type. */ - @JsonProperty("food_beverage_charges_amount") + @JsonProperty("insurance_charges_amount") @ExcludeMissing - fun _foodBeverageChargesAmount(): JsonField = foodBeverageChargesAmount + fun _insuranceChargesAmount(): JsonField = insuranceChargesAmount /** - * Returns the raw JSON value of [foodBeverageChargesCurrency]. + * Returns the raw JSON value of [insuranceChargesCurrency]. * - * Unlike [foodBeverageChargesCurrency], this method doesn't throw if the JSON + * Unlike [insuranceChargesCurrency], this method doesn't throw if the JSON * field has an unexpected type. */ - @JsonProperty("food_beverage_charges_currency") + @JsonProperty("insurance_charges_currency") @ExcludeMissing - fun _foodBeverageChargesCurrency(): JsonField = - foodBeverageChargesCurrency + fun _insuranceChargesCurrency(): JsonField = insuranceChargesCurrency /** * Returns the raw JSON value of [noShowIndicator]. @@ -23101,74 +23107,55 @@ private constructor( fun _noShowIndicator(): JsonField = noShowIndicator /** - * Returns the raw JSON value of [prepaidExpensesAmount]. + * Returns the raw JSON value of [oneWayDropOffChargesAmount]. * - * Unlike [prepaidExpensesAmount], this method doesn't throw if the JSON field - * has an unexpected type. - */ - @JsonProperty("prepaid_expenses_amount") - @ExcludeMissing - fun _prepaidExpensesAmount(): JsonField = prepaidExpensesAmount - - /** - * Returns the raw JSON value of [prepaidExpensesCurrency]. - * - * Unlike [prepaidExpensesCurrency], this method doesn't throw if the JSON field - * has an unexpected type. + * Unlike [oneWayDropOffChargesAmount], this method doesn't throw if the JSON + * field has an unexpected type. */ - @JsonProperty("prepaid_expenses_currency") + @JsonProperty("one_way_drop_off_charges_amount") @ExcludeMissing - fun _prepaidExpensesCurrency(): JsonField = prepaidExpensesCurrency + fun _oneWayDropOffChargesAmount(): JsonField = oneWayDropOffChargesAmount /** - * Returns the raw JSON value of [roomNights]. + * Returns the raw JSON value of [oneWayDropOffChargesCurrency]. * - * Unlike [roomNights], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [oneWayDropOffChargesCurrency], this method doesn't throw if the JSON + * field has an unexpected type. */ - @JsonProperty("room_nights") + @JsonProperty("one_way_drop_off_charges_currency") @ExcludeMissing - fun _roomNights(): JsonField = roomNights + fun _oneWayDropOffChargesCurrency(): JsonField = + oneWayDropOffChargesCurrency /** - * Returns the raw JSON value of [totalRoomTaxAmount]. + * Returns the raw JSON value of [renterName]. * - * Unlike [totalRoomTaxAmount], this method doesn't throw if the JSON field has - * an unexpected type. + * Unlike [renterName], this method doesn't throw if the JSON field has an + * unexpected type. */ - @JsonProperty("total_room_tax_amount") + @JsonProperty("renter_name") @ExcludeMissing - fun _totalRoomTaxAmount(): JsonField = totalRoomTaxAmount + fun _renterName(): JsonField = renterName /** - * Returns the raw JSON value of [totalRoomTaxCurrency]. + * Returns the raw JSON value of [weeklyRentalRateAmount]. * - * Unlike [totalRoomTaxCurrency], this method doesn't throw if the JSON field + * Unlike [weeklyRentalRateAmount], this method doesn't throw if the JSON field * has an unexpected type. */ - @JsonProperty("total_room_tax_currency") - @ExcludeMissing - fun _totalRoomTaxCurrency(): JsonField = totalRoomTaxCurrency - - /** - * Returns the raw JSON value of [totalTaxAmount]. - * - * Unlike [totalTaxAmount], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("total_tax_amount") + @JsonProperty("weekly_rental_rate_amount") @ExcludeMissing - fun _totalTaxAmount(): JsonField = totalTaxAmount + fun _weeklyRentalRateAmount(): JsonField = weeklyRentalRateAmount /** - * Returns the raw JSON value of [totalTaxCurrency]. + * Returns the raw JSON value of [weeklyRentalRateCurrency]. * - * Unlike [totalTaxCurrency], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [weeklyRentalRateCurrency], this method doesn't throw if the JSON + * field has an unexpected type. */ - @JsonProperty("total_tax_currency") + @JsonProperty("weekly_rental_rate_currency") @ExcludeMissing - fun _totalTaxCurrency(): JsonField = totalTaxCurrency + fun _weeklyRentalRateCurrency(): JsonField = weeklyRentalRateCurrency @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -23185,152 +23172,206 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [Lodging]. + * Returns a mutable builder for constructing an instance of [CarRental]. * * The following fields are required: * ```java - * .checkInDate() - * .dailyRoomRateAmount() - * .dailyRoomRateCurrency() + * .carClassCode() + * .checkoutDate() + * .dailyRentalRateAmount() + * .dailyRentalRateCurrency() + * .daysRented() * .extraCharges() - * .folioCashAdvancesAmount() - * .folioCashAdvancesCurrency() - * .foodBeverageChargesAmount() - * .foodBeverageChargesCurrency() + * .fuelChargesAmount() + * .fuelChargesCurrency() + * .insuranceChargesAmount() + * .insuranceChargesCurrency() * .noShowIndicator() - * .prepaidExpensesAmount() - * .prepaidExpensesCurrency() - * .roomNights() - * .totalRoomTaxAmount() - * .totalRoomTaxCurrency() - * .totalTaxAmount() - * .totalTaxCurrency() + * .oneWayDropOffChargesAmount() + * .oneWayDropOffChargesCurrency() + * .renterName() + * .weeklyRentalRateAmount() + * .weeklyRentalRateCurrency() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [Lodging]. */ + /** A builder for [CarRental]. */ class Builder internal constructor() { - private var checkInDate: JsonField? = null - private var dailyRoomRateAmount: JsonField? = null - private var dailyRoomRateCurrency: JsonField? = null + private var carClassCode: JsonField? = null + private var checkoutDate: JsonField? = null + private var dailyRentalRateAmount: JsonField? = null + private var dailyRentalRateCurrency: JsonField? = null + private var daysRented: JsonField? = null private var extraCharges: JsonField? = null - private var folioCashAdvancesAmount: JsonField? = null - private var folioCashAdvancesCurrency: JsonField? = null - private var foodBeverageChargesAmount: JsonField? = null - private var foodBeverageChargesCurrency: JsonField? = null + private var fuelChargesAmount: JsonField? = null + private var fuelChargesCurrency: JsonField? = null + private var insuranceChargesAmount: JsonField? = null + private var insuranceChargesCurrency: JsonField? = null private var noShowIndicator: JsonField? = null - private var prepaidExpensesAmount: JsonField? = null - private var prepaidExpensesCurrency: JsonField? = null - private var roomNights: JsonField? = null - private var totalRoomTaxAmount: JsonField? = null - private var totalRoomTaxCurrency: JsonField? = null - private var totalTaxAmount: JsonField? = null - private var totalTaxCurrency: JsonField? = null + private var oneWayDropOffChargesAmount: JsonField? = null + private var oneWayDropOffChargesCurrency: JsonField? = null + private var renterName: JsonField? = null + private var weeklyRentalRateAmount: JsonField? = null + private var weeklyRentalRateCurrency: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(lodging: Lodging) = apply { - checkInDate = lodging.checkInDate - dailyRoomRateAmount = lodging.dailyRoomRateAmount - dailyRoomRateCurrency = lodging.dailyRoomRateCurrency - extraCharges = lodging.extraCharges - folioCashAdvancesAmount = lodging.folioCashAdvancesAmount - folioCashAdvancesCurrency = lodging.folioCashAdvancesCurrency - foodBeverageChargesAmount = lodging.foodBeverageChargesAmount - foodBeverageChargesCurrency = lodging.foodBeverageChargesCurrency - noShowIndicator = lodging.noShowIndicator - prepaidExpensesAmount = lodging.prepaidExpensesAmount - prepaidExpensesCurrency = lodging.prepaidExpensesCurrency - roomNights = lodging.roomNights - totalRoomTaxAmount = lodging.totalRoomTaxAmount - totalRoomTaxCurrency = lodging.totalRoomTaxCurrency - totalTaxAmount = lodging.totalTaxAmount - totalTaxCurrency = lodging.totalTaxCurrency - additionalProperties = lodging.additionalProperties.toMutableMap() + internal fun from(carRental: CarRental) = apply { + carClassCode = carRental.carClassCode + checkoutDate = carRental.checkoutDate + dailyRentalRateAmount = carRental.dailyRentalRateAmount + dailyRentalRateCurrency = carRental.dailyRentalRateCurrency + daysRented = carRental.daysRented + extraCharges = carRental.extraCharges + fuelChargesAmount = carRental.fuelChargesAmount + fuelChargesCurrency = carRental.fuelChargesCurrency + insuranceChargesAmount = carRental.insuranceChargesAmount + insuranceChargesCurrency = carRental.insuranceChargesCurrency + noShowIndicator = carRental.noShowIndicator + oneWayDropOffChargesAmount = carRental.oneWayDropOffChargesAmount + oneWayDropOffChargesCurrency = carRental.oneWayDropOffChargesCurrency + renterName = carRental.renterName + weeklyRentalRateAmount = carRental.weeklyRentalRateAmount + weeklyRentalRateCurrency = carRental.weeklyRentalRateCurrency + additionalProperties = carRental.additionalProperties.toMutableMap() } - /** Date the customer checked in. */ - fun checkInDate(checkInDate: LocalDate?) = - checkInDate(JsonField.ofNullable(checkInDate)) + /** Code indicating the vehicle's class. */ + fun carClassCode(carClassCode: String?) = + carClassCode(JsonField.ofNullable(carClassCode)) /** - * Alias for calling [Builder.checkInDate] with `checkInDate.orElse(null)`. + * Alias for calling [Builder.carClassCode] with + * `carClassCode.orElse(null)`. */ - fun checkInDate(checkInDate: Optional) = - checkInDate(checkInDate.getOrNull()) + fun carClassCode(carClassCode: Optional) = + carClassCode(carClassCode.getOrNull()) /** - * Sets [Builder.checkInDate] to an arbitrary JSON value. + * Sets [Builder.carClassCode] to an arbitrary JSON value. * - * You should usually call [Builder.checkInDate] with a well-typed + * You should usually call [Builder.carClassCode] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun carClassCode(carClassCode: JsonField) = apply { + this.carClassCode = carClassCode + } + + /** + * Date the customer picked up the car or, in the case of a no-show or + * pre-pay transaction, the scheduled pick up date. + */ + fun checkoutDate(checkoutDate: LocalDate?) = + checkoutDate(JsonField.ofNullable(checkoutDate)) + + /** + * Alias for calling [Builder.checkoutDate] with + * `checkoutDate.orElse(null)`. + */ + fun checkoutDate(checkoutDate: Optional) = + checkoutDate(checkoutDate.getOrNull()) + + /** + * Sets [Builder.checkoutDate] to an arbitrary JSON value. + * + * You should usually call [Builder.checkoutDate] with a well-typed * [LocalDate] value instead. This method is primarily for setting the field * to an undocumented or not yet supported value. */ - fun checkInDate(checkInDate: JsonField) = apply { - this.checkInDate = checkInDate + fun checkoutDate(checkoutDate: JsonField) = apply { + this.checkoutDate = checkoutDate } - /** Daily rate being charged for the room. */ - fun dailyRoomRateAmount(dailyRoomRateAmount: Long?) = - dailyRoomRateAmount(JsonField.ofNullable(dailyRoomRateAmount)) + /** Daily rate being charged for the vehicle. */ + fun dailyRentalRateAmount(dailyRentalRateAmount: Long?) = + dailyRentalRateAmount(JsonField.ofNullable(dailyRentalRateAmount)) /** - * Alias for [Builder.dailyRoomRateAmount]. + * Alias for [Builder.dailyRentalRateAmount]. * * This unboxed primitive overload exists for backwards compatibility. */ - fun dailyRoomRateAmount(dailyRoomRateAmount: Long) = - dailyRoomRateAmount(dailyRoomRateAmount as Long?) + fun dailyRentalRateAmount(dailyRentalRateAmount: Long) = + dailyRentalRateAmount(dailyRentalRateAmount as Long?) /** - * Alias for calling [Builder.dailyRoomRateAmount] with - * `dailyRoomRateAmount.orElse(null)`. + * Alias for calling [Builder.dailyRentalRateAmount] with + * `dailyRentalRateAmount.orElse(null)`. */ - fun dailyRoomRateAmount(dailyRoomRateAmount: Optional) = - dailyRoomRateAmount(dailyRoomRateAmount.getOrNull()) + fun dailyRentalRateAmount(dailyRentalRateAmount: Optional) = + dailyRentalRateAmount(dailyRentalRateAmount.getOrNull()) /** - * Sets [Builder.dailyRoomRateAmount] to an arbitrary JSON value. + * Sets [Builder.dailyRentalRateAmount] to an arbitrary JSON value. * - * You should usually call [Builder.dailyRoomRateAmount] with a well-typed + * You should usually call [Builder.dailyRentalRateAmount] with a well-typed * [Long] value instead. This method is primarily for setting the field to * an undocumented or not yet supported value. */ - fun dailyRoomRateAmount(dailyRoomRateAmount: JsonField) = apply { - this.dailyRoomRateAmount = dailyRoomRateAmount + fun dailyRentalRateAmount(dailyRentalRateAmount: JsonField) = apply { + this.dailyRentalRateAmount = dailyRentalRateAmount } /** * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily - * room rate. + * rental rate. */ - fun dailyRoomRateCurrency(dailyRoomRateCurrency: String?) = - dailyRoomRateCurrency(JsonField.ofNullable(dailyRoomRateCurrency)) + fun dailyRentalRateCurrency(dailyRentalRateCurrency: String?) = + dailyRentalRateCurrency(JsonField.ofNullable(dailyRentalRateCurrency)) /** - * Alias for calling [Builder.dailyRoomRateCurrency] with - * `dailyRoomRateCurrency.orElse(null)`. + * Alias for calling [Builder.dailyRentalRateCurrency] with + * `dailyRentalRateCurrency.orElse(null)`. */ - fun dailyRoomRateCurrency(dailyRoomRateCurrency: Optional) = - dailyRoomRateCurrency(dailyRoomRateCurrency.getOrNull()) + fun dailyRentalRateCurrency(dailyRentalRateCurrency: Optional) = + dailyRentalRateCurrency(dailyRentalRateCurrency.getOrNull()) /** - * Sets [Builder.dailyRoomRateCurrency] to an arbitrary JSON value. + * Sets [Builder.dailyRentalRateCurrency] to an arbitrary JSON value. * - * You should usually call [Builder.dailyRoomRateCurrency] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * You should usually call [Builder.dailyRentalRateCurrency] with a + * well-typed [String] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. */ - fun dailyRoomRateCurrency(dailyRoomRateCurrency: JsonField) = + fun dailyRentalRateCurrency(dailyRentalRateCurrency: JsonField) = apply { - this.dailyRoomRateCurrency = dailyRoomRateCurrency + this.dailyRentalRateCurrency = dailyRentalRateCurrency } - /** Additional charges (phone, late check-out, etc.) being billed. */ + /** Number of days the vehicle was rented. */ + fun daysRented(daysRented: Long?) = + daysRented(JsonField.ofNullable(daysRented)) + + /** + * Alias for [Builder.daysRented]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun daysRented(daysRented: Long) = daysRented(daysRented as Long?) + + /** + * Alias for calling [Builder.daysRented] with `daysRented.orElse(null)`. + */ + fun daysRented(daysRented: Optional) = + daysRented(daysRented.getOrNull()) + + /** + * Sets [Builder.daysRented] to an arbitrary JSON value. + * + * You should usually call [Builder.daysRented] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun daysRented(daysRented: JsonField) = apply { + this.daysRented = daysRented + } + + /** Additional charges (gas, late fee, etc.) being billed. */ fun extraCharges(extraCharges: ExtraCharges?) = extraCharges(JsonField.ofNullable(extraCharges)) @@ -23352,128 +23393,121 @@ private constructor( this.extraCharges = extraCharges } - /** Folio cash advances for the room. */ - fun folioCashAdvancesAmount(folioCashAdvancesAmount: Long?) = - folioCashAdvancesAmount(JsonField.ofNullable(folioCashAdvancesAmount)) + /** Fuel charges for the vehicle. */ + fun fuelChargesAmount(fuelChargesAmount: Long?) = + fuelChargesAmount(JsonField.ofNullable(fuelChargesAmount)) /** - * Alias for [Builder.folioCashAdvancesAmount]. + * Alias for [Builder.fuelChargesAmount]. * * This unboxed primitive overload exists for backwards compatibility. */ - fun folioCashAdvancesAmount(folioCashAdvancesAmount: Long) = - folioCashAdvancesAmount(folioCashAdvancesAmount as Long?) + fun fuelChargesAmount(fuelChargesAmount: Long) = + fuelChargesAmount(fuelChargesAmount as Long?) /** - * Alias for calling [Builder.folioCashAdvancesAmount] with - * `folioCashAdvancesAmount.orElse(null)`. + * Alias for calling [Builder.fuelChargesAmount] with + * `fuelChargesAmount.orElse(null)`. */ - fun folioCashAdvancesAmount(folioCashAdvancesAmount: Optional) = - folioCashAdvancesAmount(folioCashAdvancesAmount.getOrNull()) + fun fuelChargesAmount(fuelChargesAmount: Optional) = + fuelChargesAmount(fuelChargesAmount.getOrNull()) /** - * Sets [Builder.folioCashAdvancesAmount] to an arbitrary JSON value. + * Sets [Builder.fuelChargesAmount] to an arbitrary JSON value. * - * You should usually call [Builder.folioCashAdvancesAmount] with a - * well-typed [Long] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * You should usually call [Builder.fuelChargesAmount] with a well-typed + * [Long] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. */ - fun folioCashAdvancesAmount(folioCashAdvancesAmount: JsonField) = - apply { - this.folioCashAdvancesAmount = folioCashAdvancesAmount - } + fun fuelChargesAmount(fuelChargesAmount: JsonField) = apply { + this.fuelChargesAmount = fuelChargesAmount + } /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the folio - * cash advances. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fuel + * charges assessed. */ - fun folioCashAdvancesCurrency(folioCashAdvancesCurrency: String?) = - folioCashAdvancesCurrency( - JsonField.ofNullable(folioCashAdvancesCurrency) - ) + fun fuelChargesCurrency(fuelChargesCurrency: String?) = + fuelChargesCurrency(JsonField.ofNullable(fuelChargesCurrency)) /** - * Alias for calling [Builder.folioCashAdvancesCurrency] with - * `folioCashAdvancesCurrency.orElse(null)`. + * Alias for calling [Builder.fuelChargesCurrency] with + * `fuelChargesCurrency.orElse(null)`. */ - fun folioCashAdvancesCurrency(folioCashAdvancesCurrency: Optional) = - folioCashAdvancesCurrency(folioCashAdvancesCurrency.getOrNull()) + fun fuelChargesCurrency(fuelChargesCurrency: Optional) = + fuelChargesCurrency(fuelChargesCurrency.getOrNull()) /** - * Sets [Builder.folioCashAdvancesCurrency] to an arbitrary JSON value. + * Sets [Builder.fuelChargesCurrency] to an arbitrary JSON value. * - * You should usually call [Builder.folioCashAdvancesCurrency] with a - * well-typed [String] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. + * You should usually call [Builder.fuelChargesCurrency] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. */ - fun folioCashAdvancesCurrency( - folioCashAdvancesCurrency: JsonField - ) = apply { this.folioCashAdvancesCurrency = folioCashAdvancesCurrency } + fun fuelChargesCurrency(fuelChargesCurrency: JsonField) = apply { + this.fuelChargesCurrency = fuelChargesCurrency + } - /** Food and beverage charges for the room. */ - fun foodBeverageChargesAmount(foodBeverageChargesAmount: Long?) = - foodBeverageChargesAmount( - JsonField.ofNullable(foodBeverageChargesAmount) - ) + /** Any insurance being charged for the vehicle. */ + fun insuranceChargesAmount(insuranceChargesAmount: Long?) = + insuranceChargesAmount(JsonField.ofNullable(insuranceChargesAmount)) /** - * Alias for [Builder.foodBeverageChargesAmount]. + * Alias for [Builder.insuranceChargesAmount]. * * This unboxed primitive overload exists for backwards compatibility. */ - fun foodBeverageChargesAmount(foodBeverageChargesAmount: Long) = - foodBeverageChargesAmount(foodBeverageChargesAmount as Long?) + fun insuranceChargesAmount(insuranceChargesAmount: Long) = + insuranceChargesAmount(insuranceChargesAmount as Long?) /** - * Alias for calling [Builder.foodBeverageChargesAmount] with - * `foodBeverageChargesAmount.orElse(null)`. + * Alias for calling [Builder.insuranceChargesAmount] with + * `insuranceChargesAmount.orElse(null)`. */ - fun foodBeverageChargesAmount(foodBeverageChargesAmount: Optional) = - foodBeverageChargesAmount(foodBeverageChargesAmount.getOrNull()) + fun insuranceChargesAmount(insuranceChargesAmount: Optional) = + insuranceChargesAmount(insuranceChargesAmount.getOrNull()) /** - * Sets [Builder.foodBeverageChargesAmount] to an arbitrary JSON value. + * Sets [Builder.insuranceChargesAmount] to an arbitrary JSON value. * - * You should usually call [Builder.foodBeverageChargesAmount] with a + * You should usually call [Builder.insuranceChargesAmount] with a * well-typed [Long] value instead. This method is primarily for setting the * field to an undocumented or not yet supported value. */ - fun foodBeverageChargesAmount(foodBeverageChargesAmount: JsonField) = + fun insuranceChargesAmount(insuranceChargesAmount: JsonField) = apply { - this.foodBeverageChargesAmount = foodBeverageChargesAmount + this.insuranceChargesAmount = insuranceChargesAmount } /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the food - * and beverage charges. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * insurance charges assessed. */ - fun foodBeverageChargesCurrency(foodBeverageChargesCurrency: String?) = - foodBeverageChargesCurrency( - JsonField.ofNullable(foodBeverageChargesCurrency) - ) + fun insuranceChargesCurrency(insuranceChargesCurrency: String?) = + insuranceChargesCurrency(JsonField.ofNullable(insuranceChargesCurrency)) /** - * Alias for calling [Builder.foodBeverageChargesCurrency] with - * `foodBeverageChargesCurrency.orElse(null)`. + * Alias for calling [Builder.insuranceChargesCurrency] with + * `insuranceChargesCurrency.orElse(null)`. */ - fun foodBeverageChargesCurrency( - foodBeverageChargesCurrency: Optional - ) = foodBeverageChargesCurrency(foodBeverageChargesCurrency.getOrNull()) + fun insuranceChargesCurrency(insuranceChargesCurrency: Optional) = + insuranceChargesCurrency(insuranceChargesCurrency.getOrNull()) /** - * Sets [Builder.foodBeverageChargesCurrency] to an arbitrary JSON value. + * Sets [Builder.insuranceChargesCurrency] to an arbitrary JSON value. * - * You should usually call [Builder.foodBeverageChargesCurrency] with a + * You should usually call [Builder.insuranceChargesCurrency] with a * well-typed [String] value instead. This method is primarily for setting * the field to an undocumented or not yet supported value. */ - fun foodBeverageChargesCurrency( - foodBeverageChargesCurrency: JsonField - ) = apply { this.foodBeverageChargesCurrency = foodBeverageChargesCurrency } + fun insuranceChargesCurrency(insuranceChargesCurrency: JsonField) = + apply { + this.insuranceChargesCurrency = insuranceChargesCurrency + } /** - * Indicator that the cardholder is being billed for a reserved room that - * was not actually used. + * An indicator that the cardholder is being billed for a reserved vehicle + * that was not actually rented (that is, a "no-show" charge). */ fun noShowIndicator(noShowIndicator: NoShowIndicator?) = noShowIndicator(JsonField.ofNullable(noShowIndicator)) @@ -23496,199 +23530,148 @@ private constructor( this.noShowIndicator = noShowIndicator } - /** Prepaid expenses being charged for the room. */ - fun prepaidExpensesAmount(prepaidExpensesAmount: Long?) = - prepaidExpensesAmount(JsonField.ofNullable(prepaidExpensesAmount)) + /** + * Charges for returning the vehicle at a different location than where it + * was picked up. + */ + fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Long?) = + oneWayDropOffChargesAmount( + JsonField.ofNullable(oneWayDropOffChargesAmount) + ) /** - * Alias for [Builder.prepaidExpensesAmount]. + * Alias for [Builder.oneWayDropOffChargesAmount]. * * This unboxed primitive overload exists for backwards compatibility. */ - fun prepaidExpensesAmount(prepaidExpensesAmount: Long) = - prepaidExpensesAmount(prepaidExpensesAmount as Long?) + fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Long) = + oneWayDropOffChargesAmount(oneWayDropOffChargesAmount as Long?) /** - * Alias for calling [Builder.prepaidExpensesAmount] with - * `prepaidExpensesAmount.orElse(null)`. + * Alias for calling [Builder.oneWayDropOffChargesAmount] with + * `oneWayDropOffChargesAmount.orElse(null)`. */ - fun prepaidExpensesAmount(prepaidExpensesAmount: Optional) = - prepaidExpensesAmount(prepaidExpensesAmount.getOrNull()) + fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Optional) = + oneWayDropOffChargesAmount(oneWayDropOffChargesAmount.getOrNull()) /** - * Sets [Builder.prepaidExpensesAmount] to an arbitrary JSON value. + * Sets [Builder.oneWayDropOffChargesAmount] to an arbitrary JSON value. * - * You should usually call [Builder.prepaidExpensesAmount] with a well-typed - * [Long] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * You should usually call [Builder.oneWayDropOffChargesAmount] with a + * well-typed [Long] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - fun prepaidExpensesAmount(prepaidExpensesAmount: JsonField) = apply { - this.prepaidExpensesAmount = prepaidExpensesAmount - } + fun oneWayDropOffChargesAmount( + oneWayDropOffChargesAmount: JsonField + ) = apply { this.oneWayDropOffChargesAmount = oneWayDropOffChargesAmount } /** * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - * prepaid expenses. + * one-way drop-off charges assessed. */ - fun prepaidExpensesCurrency(prepaidExpensesCurrency: String?) = - prepaidExpensesCurrency(JsonField.ofNullable(prepaidExpensesCurrency)) + fun oneWayDropOffChargesCurrency(oneWayDropOffChargesCurrency: String?) = + oneWayDropOffChargesCurrency( + JsonField.ofNullable(oneWayDropOffChargesCurrency) + ) /** - * Alias for calling [Builder.prepaidExpensesCurrency] with - * `prepaidExpensesCurrency.orElse(null)`. + * Alias for calling [Builder.oneWayDropOffChargesCurrency] with + * `oneWayDropOffChargesCurrency.orElse(null)`. */ - fun prepaidExpensesCurrency(prepaidExpensesCurrency: Optional) = - prepaidExpensesCurrency(prepaidExpensesCurrency.getOrNull()) + fun oneWayDropOffChargesCurrency( + oneWayDropOffChargesCurrency: Optional + ) = oneWayDropOffChargesCurrency(oneWayDropOffChargesCurrency.getOrNull()) /** - * Sets [Builder.prepaidExpensesCurrency] to an arbitrary JSON value. + * Sets [Builder.oneWayDropOffChargesCurrency] to an arbitrary JSON value. * - * You should usually call [Builder.prepaidExpensesCurrency] with a + * You should usually call [Builder.oneWayDropOffChargesCurrency] with a * well-typed [String] value instead. This method is primarily for setting * the field to an undocumented or not yet supported value. */ - fun prepaidExpensesCurrency(prepaidExpensesCurrency: JsonField) = - apply { - this.prepaidExpensesCurrency = prepaidExpensesCurrency - } - - /** Number of nights the room was rented. */ - fun roomNights(roomNights: Long?) = - roomNights(JsonField.ofNullable(roomNights)) + fun oneWayDropOffChargesCurrency( + oneWayDropOffChargesCurrency: JsonField + ) = apply { + this.oneWayDropOffChargesCurrency = oneWayDropOffChargesCurrency + } - /** - * Alias for [Builder.roomNights]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun roomNights(roomNights: Long) = roomNights(roomNights as Long?) + /** Name of the person renting the vehicle. */ + fun renterName(renterName: String?) = + renterName(JsonField.ofNullable(renterName)) /** - * Alias for calling [Builder.roomNights] with `roomNights.orElse(null)`. + * Alias for calling [Builder.renterName] with `renterName.orElse(null)`. */ - fun roomNights(roomNights: Optional) = - roomNights(roomNights.getOrNull()) + fun renterName(renterName: Optional) = + renterName(renterName.getOrNull()) /** - * Sets [Builder.roomNights] to an arbitrary JSON value. + * Sets [Builder.renterName] to an arbitrary JSON value. * - * You should usually call [Builder.roomNights] with a well-typed [Long] + * You should usually call [Builder.renterName] with a well-typed [String] * value instead. This method is primarily for setting the field to an * undocumented or not yet supported value. */ - fun roomNights(roomNights: JsonField) = apply { - this.roomNights = roomNights - } - - /** Total room tax being charged. */ - fun totalRoomTaxAmount(totalRoomTaxAmount: Long?) = - totalRoomTaxAmount(JsonField.ofNullable(totalRoomTaxAmount)) - - /** - * Alias for [Builder.totalRoomTaxAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun totalRoomTaxAmount(totalRoomTaxAmount: Long) = - totalRoomTaxAmount(totalRoomTaxAmount as Long?) - - /** - * Alias for calling [Builder.totalRoomTaxAmount] with - * `totalRoomTaxAmount.orElse(null)`. - */ - fun totalRoomTaxAmount(totalRoomTaxAmount: Optional) = - totalRoomTaxAmount(totalRoomTaxAmount.getOrNull()) - - /** - * Sets [Builder.totalRoomTaxAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.totalRoomTaxAmount] with a well-typed - * [Long] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun totalRoomTaxAmount(totalRoomTaxAmount: JsonField) = apply { - this.totalRoomTaxAmount = totalRoomTaxAmount - } - - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total - * room tax. - */ - fun totalRoomTaxCurrency(totalRoomTaxCurrency: String?) = - totalRoomTaxCurrency(JsonField.ofNullable(totalRoomTaxCurrency)) - - /** - * Alias for calling [Builder.totalRoomTaxCurrency] with - * `totalRoomTaxCurrency.orElse(null)`. - */ - fun totalRoomTaxCurrency(totalRoomTaxCurrency: Optional) = - totalRoomTaxCurrency(totalRoomTaxCurrency.getOrNull()) - - /** - * Sets [Builder.totalRoomTaxCurrency] to an arbitrary JSON value. - * - * You should usually call [Builder.totalRoomTaxCurrency] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun totalRoomTaxCurrency(totalRoomTaxCurrency: JsonField) = apply { - this.totalRoomTaxCurrency = totalRoomTaxCurrency + fun renterName(renterName: JsonField) = apply { + this.renterName = renterName } - /** Total tax being charged for the room. */ - fun totalTaxAmount(totalTaxAmount: Long?) = - totalTaxAmount(JsonField.ofNullable(totalTaxAmount)) + /** Weekly rate being charged for the vehicle. */ + fun weeklyRentalRateAmount(weeklyRentalRateAmount: Long?) = + weeklyRentalRateAmount(JsonField.ofNullable(weeklyRentalRateAmount)) /** - * Alias for [Builder.totalTaxAmount]. + * Alias for [Builder.weeklyRentalRateAmount]. * * This unboxed primitive overload exists for backwards compatibility. */ - fun totalTaxAmount(totalTaxAmount: Long) = - totalTaxAmount(totalTaxAmount as Long?) + fun weeklyRentalRateAmount(weeklyRentalRateAmount: Long) = + weeklyRentalRateAmount(weeklyRentalRateAmount as Long?) /** - * Alias for calling [Builder.totalTaxAmount] with - * `totalTaxAmount.orElse(null)`. + * Alias for calling [Builder.weeklyRentalRateAmount] with + * `weeklyRentalRateAmount.orElse(null)`. */ - fun totalTaxAmount(totalTaxAmount: Optional) = - totalTaxAmount(totalTaxAmount.getOrNull()) + fun weeklyRentalRateAmount(weeklyRentalRateAmount: Optional) = + weeklyRentalRateAmount(weeklyRentalRateAmount.getOrNull()) /** - * Sets [Builder.totalTaxAmount] to an arbitrary JSON value. + * Sets [Builder.weeklyRentalRateAmount] to an arbitrary JSON value. * - * You should usually call [Builder.totalTaxAmount] with a well-typed [Long] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * You should usually call [Builder.weeklyRentalRateAmount] with a + * well-typed [Long] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - fun totalTaxAmount(totalTaxAmount: JsonField) = apply { - this.totalTaxAmount = totalTaxAmount - } + fun weeklyRentalRateAmount(weeklyRentalRateAmount: JsonField) = + apply { + this.weeklyRentalRateAmount = weeklyRentalRateAmount + } /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total - * tax assessed. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * weekly rental rate. */ - fun totalTaxCurrency(totalTaxCurrency: String?) = - totalTaxCurrency(JsonField.ofNullable(totalTaxCurrency)) + fun weeklyRentalRateCurrency(weeklyRentalRateCurrency: String?) = + weeklyRentalRateCurrency(JsonField.ofNullable(weeklyRentalRateCurrency)) /** - * Alias for calling [Builder.totalTaxCurrency] with - * `totalTaxCurrency.orElse(null)`. + * Alias for calling [Builder.weeklyRentalRateCurrency] with + * `weeklyRentalRateCurrency.orElse(null)`. */ - fun totalTaxCurrency(totalTaxCurrency: Optional) = - totalTaxCurrency(totalTaxCurrency.getOrNull()) + fun weeklyRentalRateCurrency(weeklyRentalRateCurrency: Optional) = + weeklyRentalRateCurrency(weeklyRentalRateCurrency.getOrNull()) /** - * Sets [Builder.totalTaxCurrency] to an arbitrary JSON value. + * Sets [Builder.weeklyRentalRateCurrency] to an arbitrary JSON value. * - * You should usually call [Builder.totalTaxCurrency] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * You should usually call [Builder.weeklyRentalRateCurrency] with a + * well-typed [String] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. */ - fun totalTaxCurrency(totalTaxCurrency: JsonField) = apply { - this.totalTaxCurrency = totalTaxCurrency - } + fun weeklyRentalRateCurrency(weeklyRentalRateCurrency: JsonField) = + apply { + this.weeklyRentalRateCurrency = weeklyRentalRateCurrency + } fun additionalProperties(additionalProperties: Map) = apply { @@ -23713,86 +23696,83 @@ private constructor( } /** - * Returns an immutable instance of [Lodging]. + * Returns an immutable instance of [CarRental]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .checkInDate() - * .dailyRoomRateAmount() - * .dailyRoomRateCurrency() + * .carClassCode() + * .checkoutDate() + * .dailyRentalRateAmount() + * .dailyRentalRateCurrency() + * .daysRented() * .extraCharges() - * .folioCashAdvancesAmount() - * .folioCashAdvancesCurrency() - * .foodBeverageChargesAmount() - * .foodBeverageChargesCurrency() + * .fuelChargesAmount() + * .fuelChargesCurrency() + * .insuranceChargesAmount() + * .insuranceChargesCurrency() * .noShowIndicator() - * .prepaidExpensesAmount() - * .prepaidExpensesCurrency() - * .roomNights() - * .totalRoomTaxAmount() - * .totalRoomTaxCurrency() - * .totalTaxAmount() - * .totalTaxCurrency() + * .oneWayDropOffChargesAmount() + * .oneWayDropOffChargesCurrency() + * .renterName() + * .weeklyRentalRateAmount() + * .weeklyRentalRateCurrency() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): Lodging = - Lodging( - checkRequired("checkInDate", checkInDate), - checkRequired("dailyRoomRateAmount", dailyRoomRateAmount), - checkRequired("dailyRoomRateCurrency", dailyRoomRateCurrency), + fun build(): CarRental = + CarRental( + checkRequired("carClassCode", carClassCode), + checkRequired("checkoutDate", checkoutDate), + checkRequired("dailyRentalRateAmount", dailyRentalRateAmount), + checkRequired("dailyRentalRateCurrency", dailyRentalRateCurrency), + checkRequired("daysRented", daysRented), checkRequired("extraCharges", extraCharges), - checkRequired("folioCashAdvancesAmount", folioCashAdvancesAmount), - checkRequired( - "folioCashAdvancesCurrency", - folioCashAdvancesCurrency, - ), + checkRequired("fuelChargesAmount", fuelChargesAmount), + checkRequired("fuelChargesCurrency", fuelChargesCurrency), + checkRequired("insuranceChargesAmount", insuranceChargesAmount), + checkRequired("insuranceChargesCurrency", insuranceChargesCurrency), + checkRequired("noShowIndicator", noShowIndicator), checkRequired( - "foodBeverageChargesAmount", - foodBeverageChargesAmount, + "oneWayDropOffChargesAmount", + oneWayDropOffChargesAmount, ), checkRequired( - "foodBeverageChargesCurrency", - foodBeverageChargesCurrency, + "oneWayDropOffChargesCurrency", + oneWayDropOffChargesCurrency, ), - checkRequired("noShowIndicator", noShowIndicator), - checkRequired("prepaidExpensesAmount", prepaidExpensesAmount), - checkRequired("prepaidExpensesCurrency", prepaidExpensesCurrency), - checkRequired("roomNights", roomNights), - checkRequired("totalRoomTaxAmount", totalRoomTaxAmount), - checkRequired("totalRoomTaxCurrency", totalRoomTaxCurrency), - checkRequired("totalTaxAmount", totalTaxAmount), - checkRequired("totalTaxCurrency", totalTaxCurrency), + checkRequired("renterName", renterName), + checkRequired("weeklyRentalRateAmount", weeklyRentalRateAmount), + checkRequired("weeklyRentalRateCurrency", weeklyRentalRateCurrency), additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): Lodging = apply { + fun validate(): CarRental = apply { if (validated) { return@apply } - checkInDate() - dailyRoomRateAmount() - dailyRoomRateCurrency() + carClassCode() + checkoutDate() + dailyRentalRateAmount() + dailyRentalRateCurrency() + daysRented() extraCharges().ifPresent { it.validate() } - folioCashAdvancesAmount() - folioCashAdvancesCurrency() - foodBeverageChargesAmount() - foodBeverageChargesCurrency() + fuelChargesAmount() + fuelChargesCurrency() + insuranceChargesAmount() + insuranceChargesCurrency() noShowIndicator().ifPresent { it.validate() } - prepaidExpensesAmount() - prepaidExpensesCurrency() - roomNights() - totalRoomTaxAmount() - totalRoomTaxCurrency() - totalTaxAmount() - totalTaxCurrency() + oneWayDropOffChargesAmount() + oneWayDropOffChargesCurrency() + renterName() + weeklyRentalRateAmount() + weeklyRentalRateCurrency() validated = true } @@ -23812,24 +23792,24 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (checkInDate.asKnown().isPresent) 1 else 0) + - (if (dailyRoomRateAmount.asKnown().isPresent) 1 else 0) + - (if (dailyRoomRateCurrency.asKnown().isPresent) 1 else 0) + + (if (carClassCode.asKnown().isPresent) 1 else 0) + + (if (checkoutDate.asKnown().isPresent) 1 else 0) + + (if (dailyRentalRateAmount.asKnown().isPresent) 1 else 0) + + (if (dailyRentalRateCurrency.asKnown().isPresent) 1 else 0) + + (if (daysRented.asKnown().isPresent) 1 else 0) + (extraCharges.asKnown().getOrNull()?.validity() ?: 0) + - (if (folioCashAdvancesAmount.asKnown().isPresent) 1 else 0) + - (if (folioCashAdvancesCurrency.asKnown().isPresent) 1 else 0) + - (if (foodBeverageChargesAmount.asKnown().isPresent) 1 else 0) + - (if (foodBeverageChargesCurrency.asKnown().isPresent) 1 else 0) + + (if (fuelChargesAmount.asKnown().isPresent) 1 else 0) + + (if (fuelChargesCurrency.asKnown().isPresent) 1 else 0) + + (if (insuranceChargesAmount.asKnown().isPresent) 1 else 0) + + (if (insuranceChargesCurrency.asKnown().isPresent) 1 else 0) + (noShowIndicator.asKnown().getOrNull()?.validity() ?: 0) + - (if (prepaidExpensesAmount.asKnown().isPresent) 1 else 0) + - (if (prepaidExpensesCurrency.asKnown().isPresent) 1 else 0) + - (if (roomNights.asKnown().isPresent) 1 else 0) + - (if (totalRoomTaxAmount.asKnown().isPresent) 1 else 0) + - (if (totalRoomTaxCurrency.asKnown().isPresent) 1 else 0) + - (if (totalTaxAmount.asKnown().isPresent) 1 else 0) + - (if (totalTaxCurrency.asKnown().isPresent) 1 else 0) + (if (oneWayDropOffChargesAmount.asKnown().isPresent) 1 else 0) + + (if (oneWayDropOffChargesCurrency.asKnown().isPresent) 1 else 0) + + (if (renterName.asKnown().isPresent) 1 else 0) + + (if (weeklyRentalRateAmount.asKnown().isPresent) 1 else 0) + + (if (weeklyRentalRateCurrency.asKnown().isPresent) 1 else 0) - /** Additional charges (phone, late check-out, etc.) being billed. */ + /** Additional charges (gas, late fee, etc.) being billed. */ class ExtraCharges @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -23850,23 +23830,20 @@ private constructor( /** No extra charge */ @JvmField val NO_EXTRA_CHARGE = of("no_extra_charge") - /** Restaurant */ - @JvmField val RESTAURANT = of("restaurant") - - /** Gift shop */ - @JvmField val GIFT_SHOP = of("gift_shop") + /** Gas */ + @JvmField val GAS = of("gas") - /** Mini bar */ - @JvmField val MINI_BAR = of("mini_bar") + /** Extra mileage */ + @JvmField val EXTRA_MILEAGE = of("extra_mileage") - /** Telephone */ - @JvmField val TELEPHONE = of("telephone") + /** Late return */ + @JvmField val LATE_RETURN = of("late_return") - /** Other */ - @JvmField val OTHER = of("other") + /** One way service fee */ + @JvmField val ONE_WAY_SERVICE_FEE = of("one_way_service_fee") - /** Laundry */ - @JvmField val LAUNDRY = of("laundry") + /** Parking violation */ + @JvmField val PARKING_VIOLATION = of("parking_violation") @JvmStatic fun of(value: String) = ExtraCharges(JsonField.of(value)) } @@ -23875,18 +23852,16 @@ private constructor( enum class Known { /** No extra charge */ NO_EXTRA_CHARGE, - /** Restaurant */ - RESTAURANT, - /** Gift shop */ - GIFT_SHOP, - /** Mini bar */ - MINI_BAR, - /** Telephone */ - TELEPHONE, - /** Other */ - OTHER, - /** Laundry */ - LAUNDRY, + /** Gas */ + GAS, + /** Extra mileage */ + EXTRA_MILEAGE, + /** Late return */ + LATE_RETURN, + /** One way service fee */ + ONE_WAY_SERVICE_FEE, + /** Parking violation */ + PARKING_VIOLATION, } /** @@ -23903,18 +23878,16 @@ private constructor( enum class Value { /** No extra charge */ NO_EXTRA_CHARGE, - /** Restaurant */ - RESTAURANT, - /** Gift shop */ - GIFT_SHOP, - /** Mini bar */ - MINI_BAR, - /** Telephone */ - TELEPHONE, - /** Other */ - OTHER, - /** Laundry */ - LAUNDRY, + /** Gas */ + GAS, + /** Extra mileage */ + EXTRA_MILEAGE, + /** Late return */ + LATE_RETURN, + /** One way service fee */ + ONE_WAY_SERVICE_FEE, + /** Parking violation */ + PARKING_VIOLATION, /** * An enum member indicating that [ExtraCharges] was instantiated with * an unknown value. @@ -23932,12 +23905,11 @@ private constructor( fun value(): Value = when (this) { NO_EXTRA_CHARGE -> Value.NO_EXTRA_CHARGE - RESTAURANT -> Value.RESTAURANT - GIFT_SHOP -> Value.GIFT_SHOP - MINI_BAR -> Value.MINI_BAR - TELEPHONE -> Value.TELEPHONE - OTHER -> Value.OTHER - LAUNDRY -> Value.LAUNDRY + GAS -> Value.GAS + EXTRA_MILEAGE -> Value.EXTRA_MILEAGE + LATE_RETURN -> Value.LATE_RETURN + ONE_WAY_SERVICE_FEE -> Value.ONE_WAY_SERVICE_FEE + PARKING_VIOLATION -> Value.PARKING_VIOLATION else -> Value._UNKNOWN } @@ -23953,12 +23925,11 @@ private constructor( fun known(): Known = when (this) { NO_EXTRA_CHARGE -> Known.NO_EXTRA_CHARGE - RESTAURANT -> Known.RESTAURANT - GIFT_SHOP -> Known.GIFT_SHOP - MINI_BAR -> Known.MINI_BAR - TELEPHONE -> Known.TELEPHONE - OTHER -> Known.OTHER - LAUNDRY -> Known.LAUNDRY + GAS -> Known.GAS + EXTRA_MILEAGE -> Known.EXTRA_MILEAGE + LATE_RETURN -> Known.LATE_RETURN + ONE_WAY_SERVICE_FEE -> Known.ONE_WAY_SERVICE_FEE + PARKING_VIOLATION -> Known.PARKING_VIOLATION else -> throw IncreaseInvalidDataException( "Unknown ExtraCharges: $value" @@ -24021,8 +23992,8 @@ private constructor( } /** - * Indicator that the cardholder is being billed for a reserved room that was - * not actually used. + * An indicator that the cardholder is being billed for a reserved vehicle that + * was not actually rented (that is, a "no-show" charge). */ class NoShowIndicator @JsonCreator @@ -24044,8 +24015,10 @@ private constructor( /** Not applicable */ @JvmField val NOT_APPLICABLE = of("not_applicable") - /** No show */ - @JvmField val NO_SHOW = of("no_show") + /** No show for specialized vehicle */ + @JvmField + val NO_SHOW_FOR_SPECIALIZED_VEHICLE = + of("no_show_for_specialized_vehicle") @JvmStatic fun of(value: String) = NoShowIndicator(JsonField.of(value)) } @@ -24054,8 +24027,8 @@ private constructor( enum class Known { /** Not applicable */ NOT_APPLICABLE, - /** No show */ - NO_SHOW, + /** No show for specialized vehicle */ + NO_SHOW_FOR_SPECIALIZED_VEHICLE, } /** @@ -24072,8 +24045,8 @@ private constructor( enum class Value { /** Not applicable */ NOT_APPLICABLE, - /** No show */ - NO_SHOW, + /** No show for specialized vehicle */ + NO_SHOW_FOR_SPECIALIZED_VEHICLE, /** * An enum member indicating that [NoShowIndicator] was instantiated * with an unknown value. @@ -24091,7 +24064,8 @@ private constructor( fun value(): Value = when (this) { NOT_APPLICABLE -> Value.NOT_APPLICABLE - NO_SHOW -> Value.NO_SHOW + NO_SHOW_FOR_SPECIALIZED_VEHICLE -> + Value.NO_SHOW_FOR_SPECIALIZED_VEHICLE else -> Value._UNKNOWN } @@ -24107,7 +24081,8 @@ private constructor( fun known(): Known = when (this) { NOT_APPLICABLE -> Known.NOT_APPLICABLE - NO_SHOW -> Known.NO_SHOW + NO_SHOW_FOR_SPECIALIZED_VEHICLE -> + Known.NO_SHOW_FOR_SPECIALIZED_VEHICLE else -> throw IncreaseInvalidDataException( "Unknown NoShowIndicator: $value" @@ -24174,44 +24149,44 @@ private constructor( return true } - return other is Lodging && - checkInDate == other.checkInDate && - dailyRoomRateAmount == other.dailyRoomRateAmount && - dailyRoomRateCurrency == other.dailyRoomRateCurrency && + return other is CarRental && + carClassCode == other.carClassCode && + checkoutDate == other.checkoutDate && + dailyRentalRateAmount == other.dailyRentalRateAmount && + dailyRentalRateCurrency == other.dailyRentalRateCurrency && + daysRented == other.daysRented && extraCharges == other.extraCharges && - folioCashAdvancesAmount == other.folioCashAdvancesAmount && - folioCashAdvancesCurrency == other.folioCashAdvancesCurrency && - foodBeverageChargesAmount == other.foodBeverageChargesAmount && - foodBeverageChargesCurrency == other.foodBeverageChargesCurrency && + fuelChargesAmount == other.fuelChargesAmount && + fuelChargesCurrency == other.fuelChargesCurrency && + insuranceChargesAmount == other.insuranceChargesAmount && + insuranceChargesCurrency == other.insuranceChargesCurrency && noShowIndicator == other.noShowIndicator && - prepaidExpensesAmount == other.prepaidExpensesAmount && - prepaidExpensesCurrency == other.prepaidExpensesCurrency && - roomNights == other.roomNights && - totalRoomTaxAmount == other.totalRoomTaxAmount && - totalRoomTaxCurrency == other.totalRoomTaxCurrency && - totalTaxAmount == other.totalTaxAmount && - totalTaxCurrency == other.totalTaxCurrency && + oneWayDropOffChargesAmount == other.oneWayDropOffChargesAmount && + oneWayDropOffChargesCurrency == other.oneWayDropOffChargesCurrency && + renterName == other.renterName && + weeklyRentalRateAmount == other.weeklyRentalRateAmount && + weeklyRentalRateCurrency == other.weeklyRentalRateCurrency && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { Objects.hash( - checkInDate, - dailyRoomRateAmount, - dailyRoomRateCurrency, + carClassCode, + checkoutDate, + dailyRentalRateAmount, + dailyRentalRateCurrency, + daysRented, extraCharges, - folioCashAdvancesAmount, - folioCashAdvancesCurrency, - foodBeverageChargesAmount, - foodBeverageChargesCurrency, + fuelChargesAmount, + fuelChargesCurrency, + insuranceChargesAmount, + insuranceChargesCurrency, noShowIndicator, - prepaidExpensesAmount, - prepaidExpensesCurrency, - roomNights, - totalRoomTaxAmount, - totalRoomTaxCurrency, - totalTaxAmount, - totalTaxCurrency, + oneWayDropOffChargesAmount, + oneWayDropOffChargesCurrency, + renterName, + weeklyRentalRateAmount, + weeklyRentalRateCurrency, additionalProperties, ) } @@ -24219,486 +24194,412 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Lodging{checkInDate=$checkInDate, dailyRoomRateAmount=$dailyRoomRateAmount, dailyRoomRateCurrency=$dailyRoomRateCurrency, extraCharges=$extraCharges, folioCashAdvancesAmount=$folioCashAdvancesAmount, folioCashAdvancesCurrency=$folioCashAdvancesCurrency, foodBeverageChargesAmount=$foodBeverageChargesAmount, foodBeverageChargesCurrency=$foodBeverageChargesCurrency, noShowIndicator=$noShowIndicator, prepaidExpensesAmount=$prepaidExpensesAmount, prepaidExpensesCurrency=$prepaidExpensesCurrency, roomNights=$roomNights, totalRoomTaxAmount=$totalRoomTaxAmount, totalRoomTaxCurrency=$totalRoomTaxCurrency, totalTaxAmount=$totalTaxAmount, totalTaxCurrency=$totalTaxCurrency, additionalProperties=$additionalProperties}" + "CarRental{carClassCode=$carClassCode, checkoutDate=$checkoutDate, dailyRentalRateAmount=$dailyRentalRateAmount, dailyRentalRateCurrency=$dailyRentalRateCurrency, daysRented=$daysRented, extraCharges=$extraCharges, fuelChargesAmount=$fuelChargesAmount, fuelChargesCurrency=$fuelChargesCurrency, insuranceChargesAmount=$insuranceChargesAmount, insuranceChargesCurrency=$insuranceChargesCurrency, noShowIndicator=$noShowIndicator, oneWayDropOffChargesAmount=$oneWayDropOffChargesAmount, oneWayDropOffChargesCurrency=$oneWayDropOffChargesCurrency, renterName=$renterName, weeklyRentalRateAmount=$weeklyRentalRateAmount, weeklyRentalRateCurrency=$weeklyRentalRateCurrency, additionalProperties=$additionalProperties}" } - /** The format of the purchase identifier. */ - class PurchaseIdentifierFormat - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - /** Free text */ - @JvmField val FREE_TEXT = of("free_text") - - /** Order number */ - @JvmField val ORDER_NUMBER = of("order_number") - - /** Rental agreement number */ - @JvmField val RENTAL_AGREEMENT_NUMBER = of("rental_agreement_number") - - /** Hotel folio number */ - @JvmField val HOTEL_FOLIO_NUMBER = of("hotel_folio_number") - - /** Invoice number */ - @JvmField val INVOICE_NUMBER = of("invoice_number") - - @JvmStatic - fun of(value: String) = PurchaseIdentifierFormat(JsonField.of(value)) - } - - /** An enum containing [PurchaseIdentifierFormat]'s known values. */ - enum class Known { - /** Free text */ - FREE_TEXT, - /** Order number */ - ORDER_NUMBER, - /** Rental agreement number */ - RENTAL_AGREEMENT_NUMBER, - /** Hotel folio number */ - HOTEL_FOLIO_NUMBER, - /** Invoice number */ - INVOICE_NUMBER, - } - - /** - * An enum containing [PurchaseIdentifierFormat]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [PurchaseIdentifierFormat] can contain an unknown value in a - * couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** Free text */ - FREE_TEXT, - /** Order number */ - ORDER_NUMBER, - /** Rental agreement number */ - RENTAL_AGREEMENT_NUMBER, - /** Hotel folio number */ - HOTEL_FOLIO_NUMBER, - /** Invoice number */ - INVOICE_NUMBER, - /** - * An enum member indicating that [PurchaseIdentifierFormat] was - * instantiated with an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - FREE_TEXT -> Value.FREE_TEXT - ORDER_NUMBER -> Value.ORDER_NUMBER - RENTAL_AGREEMENT_NUMBER -> Value.RENTAL_AGREEMENT_NUMBER - HOTEL_FOLIO_NUMBER -> Value.HOTEL_FOLIO_NUMBER - INVOICE_NUMBER -> Value.INVOICE_NUMBER - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a not - * a known member. - */ - fun known(): Known = - when (this) { - FREE_TEXT -> Known.FREE_TEXT - ORDER_NUMBER -> Known.ORDER_NUMBER - RENTAL_AGREEMENT_NUMBER -> Known.RENTAL_AGREEMENT_NUMBER - HOTEL_FOLIO_NUMBER -> Known.HOTEL_FOLIO_NUMBER - INVOICE_NUMBER -> Known.INVOICE_NUMBER - else -> - throw IncreaseInvalidDataException( - "Unknown PurchaseIdentifierFormat: $value" - ) - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): PurchaseIdentifierFormat = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is PurchaseIdentifierFormat && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** Fields specific to travel. */ - class Travel - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val ancillary: JsonField, - private val computerizedReservationSystem: JsonField, - private val creditReasonIndicator: JsonField, - private val departureDate: JsonField, - private val originationCityAirportCode: JsonField, - private val passengerName: JsonField, - private val restrictedTicketIndicator: JsonField, - private val ticketChangeIndicator: JsonField, - private val ticketNumber: JsonField, - private val travelAgencyCode: JsonField, - private val travelAgencyName: JsonField, - private val tripLegs: JsonField>, - private val additionalProperties: MutableMap, - ) { + /** Fields specific to lodging. */ + class Lodging + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val checkInDate: JsonField, + private val dailyRoomRateAmount: JsonField, + private val dailyRoomRateCurrency: JsonField, + private val extraCharges: JsonField, + private val folioCashAdvancesAmount: JsonField, + private val folioCashAdvancesCurrency: JsonField, + private val foodBeverageChargesAmount: JsonField, + private val foodBeverageChargesCurrency: JsonField, + private val noShowIndicator: JsonField, + private val prepaidExpensesAmount: JsonField, + private val prepaidExpensesCurrency: JsonField, + private val roomNights: JsonField, + private val totalRoomTaxAmount: JsonField, + private val totalRoomTaxCurrency: JsonField, + private val totalTaxAmount: JsonField, + private val totalTaxCurrency: JsonField, + private val additionalProperties: MutableMap, + ) { @JsonCreator private constructor( - @JsonProperty("ancillary") + @JsonProperty("check_in_date") @ExcludeMissing - ancillary: JsonField = JsonMissing.of(), - @JsonProperty("computerized_reservation_system") + checkInDate: JsonField = JsonMissing.of(), + @JsonProperty("daily_room_rate_amount") @ExcludeMissing - computerizedReservationSystem: JsonField = JsonMissing.of(), - @JsonProperty("credit_reason_indicator") + dailyRoomRateAmount: JsonField = JsonMissing.of(), + @JsonProperty("daily_room_rate_currency") @ExcludeMissing - creditReasonIndicator: JsonField = JsonMissing.of(), - @JsonProperty("departure_date") + dailyRoomRateCurrency: JsonField = JsonMissing.of(), + @JsonProperty("extra_charges") @ExcludeMissing - departureDate: JsonField = JsonMissing.of(), - @JsonProperty("origination_city_airport_code") + extraCharges: JsonField = JsonMissing.of(), + @JsonProperty("folio_cash_advances_amount") @ExcludeMissing - originationCityAirportCode: JsonField = JsonMissing.of(), - @JsonProperty("passenger_name") + folioCashAdvancesAmount: JsonField = JsonMissing.of(), + @JsonProperty("folio_cash_advances_currency") @ExcludeMissing - passengerName: JsonField = JsonMissing.of(), - @JsonProperty("restricted_ticket_indicator") + folioCashAdvancesCurrency: JsonField = JsonMissing.of(), + @JsonProperty("food_beverage_charges_amount") @ExcludeMissing - restrictedTicketIndicator: JsonField = - JsonMissing.of(), - @JsonProperty("ticket_change_indicator") + foodBeverageChargesAmount: JsonField = JsonMissing.of(), + @JsonProperty("food_beverage_charges_currency") @ExcludeMissing - ticketChangeIndicator: JsonField = JsonMissing.of(), - @JsonProperty("ticket_number") + foodBeverageChargesCurrency: JsonField = JsonMissing.of(), + @JsonProperty("no_show_indicator") @ExcludeMissing - ticketNumber: JsonField = JsonMissing.of(), - @JsonProperty("travel_agency_code") + noShowIndicator: JsonField = JsonMissing.of(), + @JsonProperty("prepaid_expenses_amount") @ExcludeMissing - travelAgencyCode: JsonField = JsonMissing.of(), - @JsonProperty("travel_agency_name") + prepaidExpensesAmount: JsonField = JsonMissing.of(), + @JsonProperty("prepaid_expenses_currency") @ExcludeMissing - travelAgencyName: JsonField = JsonMissing.of(), - @JsonProperty("trip_legs") + prepaidExpensesCurrency: JsonField = JsonMissing.of(), + @JsonProperty("room_nights") @ExcludeMissing - tripLegs: JsonField> = JsonMissing.of(), + roomNights: JsonField = JsonMissing.of(), + @JsonProperty("total_room_tax_amount") + @ExcludeMissing + totalRoomTaxAmount: JsonField = JsonMissing.of(), + @JsonProperty("total_room_tax_currency") + @ExcludeMissing + totalRoomTaxCurrency: JsonField = JsonMissing.of(), + @JsonProperty("total_tax_amount") + @ExcludeMissing + totalTaxAmount: JsonField = JsonMissing.of(), + @JsonProperty("total_tax_currency") + @ExcludeMissing + totalTaxCurrency: JsonField = JsonMissing.of(), ) : this( - ancillary, - computerizedReservationSystem, - creditReasonIndicator, - departureDate, - originationCityAirportCode, - passengerName, - restrictedTicketIndicator, - ticketChangeIndicator, - ticketNumber, - travelAgencyCode, - travelAgencyName, - tripLegs, + checkInDate, + dailyRoomRateAmount, + dailyRoomRateCurrency, + extraCharges, + folioCashAdvancesAmount, + folioCashAdvancesCurrency, + foodBeverageChargesAmount, + foodBeverageChargesCurrency, + noShowIndicator, + prepaidExpensesAmount, + prepaidExpensesCurrency, + roomNights, + totalRoomTaxAmount, + totalRoomTaxCurrency, + totalTaxAmount, + totalTaxCurrency, mutableMapOf(), ) /** - * Ancillary purchases in addition to the airfare. + * Date the customer checked in. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun ancillary(): Optional = ancillary.getOptional("ancillary") + fun checkInDate(): Optional = + checkInDate.getOptional("check_in_date") /** - * Indicates the computerized reservation system used to book the ticket. + * Daily rate being charged for the room. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun computerizedReservationSystem(): Optional = - computerizedReservationSystem.getOptional("computerized_reservation_system") + fun dailyRoomRateAmount(): Optional = + dailyRoomRateAmount.getOptional("daily_room_rate_amount") /** - * Indicates the reason for a credit to the cardholder. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily + * room rate. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun creditReasonIndicator(): Optional = - creditReasonIndicator.getOptional("credit_reason_indicator") + fun dailyRoomRateCurrency(): Optional = + dailyRoomRateCurrency.getOptional("daily_room_rate_currency") /** - * Date of departure. + * Additional charges (phone, late check-out, etc.) being billed. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun departureDate(): Optional = - departureDate.getOptional("departure_date") + fun extraCharges(): Optional = + extraCharges.getOptional("extra_charges") /** - * Code for the originating city or airport. + * Folio cash advances for the room. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun originationCityAirportCode(): Optional = - originationCityAirportCode.getOptional("origination_city_airport_code") + fun folioCashAdvancesAmount(): Optional = + folioCashAdvancesAmount.getOptional("folio_cash_advances_amount") /** - * Name of the passenger. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the folio + * cash advances. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun passengerName(): Optional = - passengerName.getOptional("passenger_name") + fun folioCashAdvancesCurrency(): Optional = + folioCashAdvancesCurrency.getOptional("folio_cash_advances_currency") /** - * Indicates whether this ticket is non-refundable. + * Food and beverage charges for the room. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun restrictedTicketIndicator(): Optional = - restrictedTicketIndicator.getOptional("restricted_ticket_indicator") + fun foodBeverageChargesAmount(): Optional = + foodBeverageChargesAmount.getOptional("food_beverage_charges_amount") /** - * Indicates why a ticket was changed. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the food and + * beverage charges. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun ticketChangeIndicator(): Optional = - ticketChangeIndicator.getOptional("ticket_change_indicator") + fun foodBeverageChargesCurrency(): Optional = + foodBeverageChargesCurrency.getOptional("food_beverage_charges_currency") /** - * Ticket number. + * Indicator that the cardholder is being billed for a reserved room that was + * not actually used. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun ticketNumber(): Optional = ticketNumber.getOptional("ticket_number") + fun noShowIndicator(): Optional = + noShowIndicator.getOptional("no_show_indicator") /** - * Code for the travel agency if the ticket was issued by a travel agency. + * Prepaid expenses being charged for the room. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun travelAgencyCode(): Optional = - travelAgencyCode.getOptional("travel_agency_code") + fun prepaidExpensesAmount(): Optional = + prepaidExpensesAmount.getOptional("prepaid_expenses_amount") /** - * Name of the travel agency if the ticket was issued by a travel agency. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the prepaid + * expenses. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun travelAgencyName(): Optional = - travelAgencyName.getOptional("travel_agency_name") + fun prepaidExpensesCurrency(): Optional = + prepaidExpensesCurrency.getOptional("prepaid_expenses_currency") /** - * Fields specific to each leg of the journey. + * Number of nights the room was rented. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun tripLegs(): Optional> = tripLegs.getOptional("trip_legs") + fun roomNights(): Optional = roomNights.getOptional("room_nights") /** - * Returns the raw JSON value of [ancillary]. + * Total room tax being charged. * - * Unlike [ancillary], this method doesn't throw if the JSON field has an + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun totalRoomTaxAmount(): Optional = + totalRoomTaxAmount.getOptional("total_room_tax_amount") + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total + * room tax. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun totalRoomTaxCurrency(): Optional = + totalRoomTaxCurrency.getOptional("total_room_tax_currency") + + /** + * Total tax being charged for the room. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun totalTaxAmount(): Optional = + totalTaxAmount.getOptional("total_tax_amount") + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total tax + * assessed. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun totalTaxCurrency(): Optional = + totalTaxCurrency.getOptional("total_tax_currency") + + /** + * Returns the raw JSON value of [checkInDate]. + * + * Unlike [checkInDate], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("ancillary") + @JsonProperty("check_in_date") @ExcludeMissing - fun _ancillary(): JsonField = ancillary + fun _checkInDate(): JsonField = checkInDate /** - * Returns the raw JSON value of [computerizedReservationSystem]. + * Returns the raw JSON value of [dailyRoomRateAmount]. * - * Unlike [computerizedReservationSystem], this method doesn't throw if the JSON - * field has an unexpected type. + * Unlike [dailyRoomRateAmount], this method doesn't throw if the JSON field has + * an unexpected type. */ - @JsonProperty("computerized_reservation_system") + @JsonProperty("daily_room_rate_amount") @ExcludeMissing - fun _computerizedReservationSystem(): JsonField = - computerizedReservationSystem + fun _dailyRoomRateAmount(): JsonField = dailyRoomRateAmount /** - * Returns the raw JSON value of [creditReasonIndicator]. + * Returns the raw JSON value of [dailyRoomRateCurrency]. * - * Unlike [creditReasonIndicator], this method doesn't throw if the JSON field + * Unlike [dailyRoomRateCurrency], this method doesn't throw if the JSON field * has an unexpected type. */ - @JsonProperty("credit_reason_indicator") + @JsonProperty("daily_room_rate_currency") @ExcludeMissing - fun _creditReasonIndicator(): JsonField = - creditReasonIndicator + fun _dailyRoomRateCurrency(): JsonField = dailyRoomRateCurrency /** - * Returns the raw JSON value of [departureDate]. + * Returns the raw JSON value of [extraCharges]. * - * Unlike [departureDate], this method doesn't throw if the JSON field has an + * Unlike [extraCharges], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("departure_date") + @JsonProperty("extra_charges") @ExcludeMissing - fun _departureDate(): JsonField = departureDate + fun _extraCharges(): JsonField = extraCharges /** - * Returns the raw JSON value of [originationCityAirportCode]. + * Returns the raw JSON value of [folioCashAdvancesAmount]. * - * Unlike [originationCityAirportCode], this method doesn't throw if the JSON + * Unlike [folioCashAdvancesAmount], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("folio_cash_advances_amount") + @ExcludeMissing + fun _folioCashAdvancesAmount(): JsonField = folioCashAdvancesAmount + + /** + * Returns the raw JSON value of [folioCashAdvancesCurrency]. + * + * Unlike [folioCashAdvancesCurrency], this method doesn't throw if the JSON * field has an unexpected type. */ - @JsonProperty("origination_city_airport_code") + @JsonProperty("folio_cash_advances_currency") @ExcludeMissing - fun _originationCityAirportCode(): JsonField = - originationCityAirportCode + fun _folioCashAdvancesCurrency(): JsonField = folioCashAdvancesCurrency /** - * Returns the raw JSON value of [passengerName]. + * Returns the raw JSON value of [foodBeverageChargesAmount]. * - * Unlike [passengerName], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [foodBeverageChargesAmount], this method doesn't throw if the JSON + * field has an unexpected type. */ - @JsonProperty("passenger_name") + @JsonProperty("food_beverage_charges_amount") @ExcludeMissing - fun _passengerName(): JsonField = passengerName + fun _foodBeverageChargesAmount(): JsonField = foodBeverageChargesAmount /** - * Returns the raw JSON value of [restrictedTicketIndicator]. + * Returns the raw JSON value of [foodBeverageChargesCurrency]. * - * Unlike [restrictedTicketIndicator], this method doesn't throw if the JSON + * Unlike [foodBeverageChargesCurrency], this method doesn't throw if the JSON * field has an unexpected type. */ - @JsonProperty("restricted_ticket_indicator") + @JsonProperty("food_beverage_charges_currency") @ExcludeMissing - fun _restrictedTicketIndicator(): JsonField = - restrictedTicketIndicator + fun _foodBeverageChargesCurrency(): JsonField = + foodBeverageChargesCurrency /** - * Returns the raw JSON value of [ticketChangeIndicator]. + * Returns the raw JSON value of [noShowIndicator]. * - * Unlike [ticketChangeIndicator], this method doesn't throw if the JSON field + * Unlike [noShowIndicator], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("no_show_indicator") + @ExcludeMissing + fun _noShowIndicator(): JsonField = noShowIndicator + + /** + * Returns the raw JSON value of [prepaidExpensesAmount]. + * + * Unlike [prepaidExpensesAmount], this method doesn't throw if the JSON field * has an unexpected type. */ - @JsonProperty("ticket_change_indicator") + @JsonProperty("prepaid_expenses_amount") @ExcludeMissing - fun _ticketChangeIndicator(): JsonField = - ticketChangeIndicator + fun _prepaidExpensesAmount(): JsonField = prepaidExpensesAmount /** - * Returns the raw JSON value of [ticketNumber]. + * Returns the raw JSON value of [prepaidExpensesCurrency]. * - * Unlike [ticketNumber], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [prepaidExpensesCurrency], this method doesn't throw if the JSON field + * has an unexpected type. */ - @JsonProperty("ticket_number") + @JsonProperty("prepaid_expenses_currency") @ExcludeMissing - fun _ticketNumber(): JsonField = ticketNumber + fun _prepaidExpensesCurrency(): JsonField = prepaidExpensesCurrency /** - * Returns the raw JSON value of [travelAgencyCode]. + * Returns the raw JSON value of [roomNights]. * - * Unlike [travelAgencyCode], this method doesn't throw if the JSON field has an + * Unlike [roomNights], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("travel_agency_code") + @JsonProperty("room_nights") @ExcludeMissing - fun _travelAgencyCode(): JsonField = travelAgencyCode + fun _roomNights(): JsonField = roomNights /** - * Returns the raw JSON value of [travelAgencyName]. + * Returns the raw JSON value of [totalRoomTaxAmount]. * - * Unlike [travelAgencyName], this method doesn't throw if the JSON field has an + * Unlike [totalRoomTaxAmount], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("total_room_tax_amount") + @ExcludeMissing + fun _totalRoomTaxAmount(): JsonField = totalRoomTaxAmount + + /** + * Returns the raw JSON value of [totalRoomTaxCurrency]. + * + * Unlike [totalRoomTaxCurrency], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("total_room_tax_currency") + @ExcludeMissing + fun _totalRoomTaxCurrency(): JsonField = totalRoomTaxCurrency + + /** + * Returns the raw JSON value of [totalTaxAmount]. + * + * Unlike [totalTaxAmount], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("travel_agency_name") + @JsonProperty("total_tax_amount") @ExcludeMissing - fun _travelAgencyName(): JsonField = travelAgencyName + fun _totalTaxAmount(): JsonField = totalTaxAmount /** - * Returns the raw JSON value of [tripLegs]. + * Returns the raw JSON value of [totalTaxCurrency]. * - * Unlike [tripLegs], this method doesn't throw if the JSON field has an + * Unlike [totalTaxCurrency], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("trip_legs") + @JsonProperty("total_tax_currency") @ExcludeMissing - fun _tripLegs(): JsonField> = tripLegs + fun _totalTaxCurrency(): JsonField = totalTaxCurrency @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -24715,882 +24616,808 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [Travel]. + * Returns a mutable builder for constructing an instance of [Lodging]. * * The following fields are required: * ```java - * .ancillary() - * .computerizedReservationSystem() - * .creditReasonIndicator() - * .departureDate() - * .originationCityAirportCode() - * .passengerName() - * .restrictedTicketIndicator() - * .ticketChangeIndicator() - * .ticketNumber() - * .travelAgencyCode() - * .travelAgencyName() - * .tripLegs() + * .checkInDate() + * .dailyRoomRateAmount() + * .dailyRoomRateCurrency() + * .extraCharges() + * .folioCashAdvancesAmount() + * .folioCashAdvancesCurrency() + * .foodBeverageChargesAmount() + * .foodBeverageChargesCurrency() + * .noShowIndicator() + * .prepaidExpensesAmount() + * .prepaidExpensesCurrency() + * .roomNights() + * .totalRoomTaxAmount() + * .totalRoomTaxCurrency() + * .totalTaxAmount() + * .totalTaxCurrency() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [Travel]. */ + /** A builder for [Lodging]. */ class Builder internal constructor() { - private var ancillary: JsonField? = null - private var computerizedReservationSystem: JsonField? = null - private var creditReasonIndicator: JsonField? = null - private var departureDate: JsonField? = null - private var originationCityAirportCode: JsonField? = null - private var passengerName: JsonField? = null - private var restrictedTicketIndicator: - JsonField? = - null - private var ticketChangeIndicator: JsonField? = null - private var ticketNumber: JsonField? = null - private var travelAgencyCode: JsonField? = null - private var travelAgencyName: JsonField? = null - private var tripLegs: JsonField>? = null + private var checkInDate: JsonField? = null + private var dailyRoomRateAmount: JsonField? = null + private var dailyRoomRateCurrency: JsonField? = null + private var extraCharges: JsonField? = null + private var folioCashAdvancesAmount: JsonField? = null + private var folioCashAdvancesCurrency: JsonField? = null + private var foodBeverageChargesAmount: JsonField? = null + private var foodBeverageChargesCurrency: JsonField? = null + private var noShowIndicator: JsonField? = null + private var prepaidExpensesAmount: JsonField? = null + private var prepaidExpensesCurrency: JsonField? = null + private var roomNights: JsonField? = null + private var totalRoomTaxAmount: JsonField? = null + private var totalRoomTaxCurrency: JsonField? = null + private var totalTaxAmount: JsonField? = null + private var totalTaxCurrency: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(travel: Travel) = apply { - ancillary = travel.ancillary - computerizedReservationSystem = travel.computerizedReservationSystem - creditReasonIndicator = travel.creditReasonIndicator - departureDate = travel.departureDate - originationCityAirportCode = travel.originationCityAirportCode - passengerName = travel.passengerName - restrictedTicketIndicator = travel.restrictedTicketIndicator - ticketChangeIndicator = travel.ticketChangeIndicator - ticketNumber = travel.ticketNumber - travelAgencyCode = travel.travelAgencyCode - travelAgencyName = travel.travelAgencyName - tripLegs = travel.tripLegs.map { it.toMutableList() } - additionalProperties = travel.additionalProperties.toMutableMap() + internal fun from(lodging: Lodging) = apply { + checkInDate = lodging.checkInDate + dailyRoomRateAmount = lodging.dailyRoomRateAmount + dailyRoomRateCurrency = lodging.dailyRoomRateCurrency + extraCharges = lodging.extraCharges + folioCashAdvancesAmount = lodging.folioCashAdvancesAmount + folioCashAdvancesCurrency = lodging.folioCashAdvancesCurrency + foodBeverageChargesAmount = lodging.foodBeverageChargesAmount + foodBeverageChargesCurrency = lodging.foodBeverageChargesCurrency + noShowIndicator = lodging.noShowIndicator + prepaidExpensesAmount = lodging.prepaidExpensesAmount + prepaidExpensesCurrency = lodging.prepaidExpensesCurrency + roomNights = lodging.roomNights + totalRoomTaxAmount = lodging.totalRoomTaxAmount + totalRoomTaxCurrency = lodging.totalRoomTaxCurrency + totalTaxAmount = lodging.totalTaxAmount + totalTaxCurrency = lodging.totalTaxCurrency + additionalProperties = lodging.additionalProperties.toMutableMap() } - /** Ancillary purchases in addition to the airfare. */ - fun ancillary(ancillary: Ancillary?) = - ancillary(JsonField.ofNullable(ancillary)) + /** Date the customer checked in. */ + fun checkInDate(checkInDate: LocalDate?) = + checkInDate(JsonField.ofNullable(checkInDate)) - /** Alias for calling [Builder.ancillary] with `ancillary.orElse(null)`. */ - fun ancillary(ancillary: Optional) = - ancillary(ancillary.getOrNull()) + /** + * Alias for calling [Builder.checkInDate] with `checkInDate.orElse(null)`. + */ + fun checkInDate(checkInDate: Optional) = + checkInDate(checkInDate.getOrNull()) /** - * Sets [Builder.ancillary] to an arbitrary JSON value. + * Sets [Builder.checkInDate] to an arbitrary JSON value. * - * You should usually call [Builder.ancillary] with a well-typed [Ancillary] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * You should usually call [Builder.checkInDate] with a well-typed + * [LocalDate] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. */ - fun ancillary(ancillary: JsonField) = apply { - this.ancillary = ancillary + fun checkInDate(checkInDate: JsonField) = apply { + this.checkInDate = checkInDate } + /** Daily rate being charged for the room. */ + fun dailyRoomRateAmount(dailyRoomRateAmount: Long?) = + dailyRoomRateAmount(JsonField.ofNullable(dailyRoomRateAmount)) + /** - * Indicates the computerized reservation system used to book the ticket. + * Alias for [Builder.dailyRoomRateAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. */ - fun computerizedReservationSystem(computerizedReservationSystem: String?) = - computerizedReservationSystem( - JsonField.ofNullable(computerizedReservationSystem) - ) + fun dailyRoomRateAmount(dailyRoomRateAmount: Long) = + dailyRoomRateAmount(dailyRoomRateAmount as Long?) /** - * Alias for calling [Builder.computerizedReservationSystem] with - * `computerizedReservationSystem.orElse(null)`. + * Alias for calling [Builder.dailyRoomRateAmount] with + * `dailyRoomRateAmount.orElse(null)`. */ - fun computerizedReservationSystem( - computerizedReservationSystem: Optional - ) = computerizedReservationSystem(computerizedReservationSystem.getOrNull()) + fun dailyRoomRateAmount(dailyRoomRateAmount: Optional) = + dailyRoomRateAmount(dailyRoomRateAmount.getOrNull()) /** - * Sets [Builder.computerizedReservationSystem] to an arbitrary JSON value. + * Sets [Builder.dailyRoomRateAmount] to an arbitrary JSON value. * - * You should usually call [Builder.computerizedReservationSystem] with a - * well-typed [String] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. + * You should usually call [Builder.dailyRoomRateAmount] with a well-typed + * [Long] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. */ - fun computerizedReservationSystem( - computerizedReservationSystem: JsonField - ) = apply { - this.computerizedReservationSystem = computerizedReservationSystem + fun dailyRoomRateAmount(dailyRoomRateAmount: JsonField) = apply { + this.dailyRoomRateAmount = dailyRoomRateAmount } - /** Indicates the reason for a credit to the cardholder. */ - fun creditReasonIndicator(creditReasonIndicator: CreditReasonIndicator?) = - creditReasonIndicator(JsonField.ofNullable(creditReasonIndicator)) + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily + * room rate. + */ + fun dailyRoomRateCurrency(dailyRoomRateCurrency: String?) = + dailyRoomRateCurrency(JsonField.ofNullable(dailyRoomRateCurrency)) /** - * Alias for calling [Builder.creditReasonIndicator] with - * `creditReasonIndicator.orElse(null)`. + * Alias for calling [Builder.dailyRoomRateCurrency] with + * `dailyRoomRateCurrency.orElse(null)`. */ - fun creditReasonIndicator( - creditReasonIndicator: Optional - ) = creditReasonIndicator(creditReasonIndicator.getOrNull()) + fun dailyRoomRateCurrency(dailyRoomRateCurrency: Optional) = + dailyRoomRateCurrency(dailyRoomRateCurrency.getOrNull()) /** - * Sets [Builder.creditReasonIndicator] to an arbitrary JSON value. + * Sets [Builder.dailyRoomRateCurrency] to an arbitrary JSON value. * - * You should usually call [Builder.creditReasonIndicator] with a well-typed - * [CreditReasonIndicator] value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. + * You should usually call [Builder.dailyRoomRateCurrency] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. */ - fun creditReasonIndicator( - creditReasonIndicator: JsonField - ) = apply { this.creditReasonIndicator = creditReasonIndicator } + fun dailyRoomRateCurrency(dailyRoomRateCurrency: JsonField) = + apply { + this.dailyRoomRateCurrency = dailyRoomRateCurrency + } - /** Date of departure. */ - fun departureDate(departureDate: LocalDate?) = - departureDate(JsonField.ofNullable(departureDate)) + /** Additional charges (phone, late check-out, etc.) being billed. */ + fun extraCharges(extraCharges: ExtraCharges?) = + extraCharges(JsonField.ofNullable(extraCharges)) /** - * Alias for calling [Builder.departureDate] with - * `departureDate.orElse(null)`. + * Alias for calling [Builder.extraCharges] with + * `extraCharges.orElse(null)`. */ - fun departureDate(departureDate: Optional) = - departureDate(departureDate.getOrNull()) + fun extraCharges(extraCharges: Optional) = + extraCharges(extraCharges.getOrNull()) /** - * Sets [Builder.departureDate] to an arbitrary JSON value. + * Sets [Builder.extraCharges] to an arbitrary JSON value. * - * You should usually call [Builder.departureDate] with a well-typed - * [LocalDate] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. + * You should usually call [Builder.extraCharges] with a well-typed + * [ExtraCharges] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - fun departureDate(departureDate: JsonField) = apply { - this.departureDate = departureDate + fun extraCharges(extraCharges: JsonField) = apply { + this.extraCharges = extraCharges } - /** Code for the originating city or airport. */ - fun originationCityAirportCode(originationCityAirportCode: String?) = - originationCityAirportCode( - JsonField.ofNullable(originationCityAirportCode) - ) - - /** - * Alias for calling [Builder.originationCityAirportCode] with - * `originationCityAirportCode.orElse(null)`. - */ - fun originationCityAirportCode( - originationCityAirportCode: Optional - ) = originationCityAirportCode(originationCityAirportCode.getOrNull()) + /** Folio cash advances for the room. */ + fun folioCashAdvancesAmount(folioCashAdvancesAmount: Long?) = + folioCashAdvancesAmount(JsonField.ofNullable(folioCashAdvancesAmount)) /** - * Sets [Builder.originationCityAirportCode] to an arbitrary JSON value. + * Alias for [Builder.folioCashAdvancesAmount]. * - * You should usually call [Builder.originationCityAirportCode] with a - * well-typed [String] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. + * This unboxed primitive overload exists for backwards compatibility. */ - fun originationCityAirportCode( - originationCityAirportCode: JsonField - ) = apply { this.originationCityAirportCode = originationCityAirportCode } - - /** Name of the passenger. */ - fun passengerName(passengerName: String?) = - passengerName(JsonField.ofNullable(passengerName)) + fun folioCashAdvancesAmount(folioCashAdvancesAmount: Long) = + folioCashAdvancesAmount(folioCashAdvancesAmount as Long?) /** - * Alias for calling [Builder.passengerName] with - * `passengerName.orElse(null)`. + * Alias for calling [Builder.folioCashAdvancesAmount] with + * `folioCashAdvancesAmount.orElse(null)`. */ - fun passengerName(passengerName: Optional) = - passengerName(passengerName.getOrNull()) + fun folioCashAdvancesAmount(folioCashAdvancesAmount: Optional) = + folioCashAdvancesAmount(folioCashAdvancesAmount.getOrNull()) /** - * Sets [Builder.passengerName] to an arbitrary JSON value. + * Sets [Builder.folioCashAdvancesAmount] to an arbitrary JSON value. * - * You should usually call [Builder.passengerName] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * You should usually call [Builder.folioCashAdvancesAmount] with a + * well-typed [Long] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - fun passengerName(passengerName: JsonField) = apply { - this.passengerName = passengerName - } + fun folioCashAdvancesAmount(folioCashAdvancesAmount: JsonField) = + apply { + this.folioCashAdvancesAmount = folioCashAdvancesAmount + } - /** Indicates whether this ticket is non-refundable. */ - fun restrictedTicketIndicator( - restrictedTicketIndicator: RestrictedTicketIndicator? - ) = - restrictedTicketIndicator( - JsonField.ofNullable(restrictedTicketIndicator) + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the folio + * cash advances. + */ + fun folioCashAdvancesCurrency(folioCashAdvancesCurrency: String?) = + folioCashAdvancesCurrency( + JsonField.ofNullable(folioCashAdvancesCurrency) ) /** - * Alias for calling [Builder.restrictedTicketIndicator] with - * `restrictedTicketIndicator.orElse(null)`. + * Alias for calling [Builder.folioCashAdvancesCurrency] with + * `folioCashAdvancesCurrency.orElse(null)`. */ - fun restrictedTicketIndicator( - restrictedTicketIndicator: Optional - ) = restrictedTicketIndicator(restrictedTicketIndicator.getOrNull()) + fun folioCashAdvancesCurrency(folioCashAdvancesCurrency: Optional) = + folioCashAdvancesCurrency(folioCashAdvancesCurrency.getOrNull()) /** - * Sets [Builder.restrictedTicketIndicator] to an arbitrary JSON value. + * Sets [Builder.folioCashAdvancesCurrency] to an arbitrary JSON value. * - * You should usually call [Builder.restrictedTicketIndicator] with a - * well-typed [RestrictedTicketIndicator] value instead. This method is - * primarily for setting the field to an undocumented or not yet supported - * value. + * You should usually call [Builder.folioCashAdvancesCurrency] with a + * well-typed [String] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. */ - fun restrictedTicketIndicator( - restrictedTicketIndicator: JsonField - ) = apply { this.restrictedTicketIndicator = restrictedTicketIndicator } + fun folioCashAdvancesCurrency( + folioCashAdvancesCurrency: JsonField + ) = apply { this.folioCashAdvancesCurrency = folioCashAdvancesCurrency } - /** Indicates why a ticket was changed. */ - fun ticketChangeIndicator(ticketChangeIndicator: TicketChangeIndicator?) = - ticketChangeIndicator(JsonField.ofNullable(ticketChangeIndicator)) + /** Food and beverage charges for the room. */ + fun foodBeverageChargesAmount(foodBeverageChargesAmount: Long?) = + foodBeverageChargesAmount( + JsonField.ofNullable(foodBeverageChargesAmount) + ) /** - * Alias for calling [Builder.ticketChangeIndicator] with - * `ticketChangeIndicator.orElse(null)`. + * Alias for [Builder.foodBeverageChargesAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. */ - fun ticketChangeIndicator( - ticketChangeIndicator: Optional - ) = ticketChangeIndicator(ticketChangeIndicator.getOrNull()) + fun foodBeverageChargesAmount(foodBeverageChargesAmount: Long) = + foodBeverageChargesAmount(foodBeverageChargesAmount as Long?) /** - * Sets [Builder.ticketChangeIndicator] to an arbitrary JSON value. + * Alias for calling [Builder.foodBeverageChargesAmount] with + * `foodBeverageChargesAmount.orElse(null)`. + */ + fun foodBeverageChargesAmount(foodBeverageChargesAmount: Optional) = + foodBeverageChargesAmount(foodBeverageChargesAmount.getOrNull()) + + /** + * Sets [Builder.foodBeverageChargesAmount] to an arbitrary JSON value. * - * You should usually call [Builder.ticketChangeIndicator] with a well-typed - * [TicketChangeIndicator] value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. + * You should usually call [Builder.foodBeverageChargesAmount] with a + * well-typed [Long] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - fun ticketChangeIndicator( - ticketChangeIndicator: JsonField - ) = apply { this.ticketChangeIndicator = ticketChangeIndicator } + fun foodBeverageChargesAmount(foodBeverageChargesAmount: JsonField) = + apply { + this.foodBeverageChargesAmount = foodBeverageChargesAmount + } - /** Ticket number. */ - fun ticketNumber(ticketNumber: String?) = - ticketNumber(JsonField.ofNullable(ticketNumber)) + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the food + * and beverage charges. + */ + fun foodBeverageChargesCurrency(foodBeverageChargesCurrency: String?) = + foodBeverageChargesCurrency( + JsonField.ofNullable(foodBeverageChargesCurrency) + ) /** - * Alias for calling [Builder.ticketNumber] with - * `ticketNumber.orElse(null)`. + * Alias for calling [Builder.foodBeverageChargesCurrency] with + * `foodBeverageChargesCurrency.orElse(null)`. */ - fun ticketNumber(ticketNumber: Optional) = - ticketNumber(ticketNumber.getOrNull()) + fun foodBeverageChargesCurrency( + foodBeverageChargesCurrency: Optional + ) = foodBeverageChargesCurrency(foodBeverageChargesCurrency.getOrNull()) /** - * Sets [Builder.ticketNumber] to an arbitrary JSON value. + * Sets [Builder.foodBeverageChargesCurrency] to an arbitrary JSON value. * - * You should usually call [Builder.ticketNumber] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * You should usually call [Builder.foodBeverageChargesCurrency] with a + * well-typed [String] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. */ - fun ticketNumber(ticketNumber: JsonField) = apply { - this.ticketNumber = ticketNumber - } + fun foodBeverageChargesCurrency( + foodBeverageChargesCurrency: JsonField + ) = apply { this.foodBeverageChargesCurrency = foodBeverageChargesCurrency } /** - * Code for the travel agency if the ticket was issued by a travel agency. + * Indicator that the cardholder is being billed for a reserved room that + * was not actually used. */ - fun travelAgencyCode(travelAgencyCode: String?) = - travelAgencyCode(JsonField.ofNullable(travelAgencyCode)) + fun noShowIndicator(noShowIndicator: NoShowIndicator?) = + noShowIndicator(JsonField.ofNullable(noShowIndicator)) /** - * Alias for calling [Builder.travelAgencyCode] with - * `travelAgencyCode.orElse(null)`. + * Alias for calling [Builder.noShowIndicator] with + * `noShowIndicator.orElse(null)`. */ - fun travelAgencyCode(travelAgencyCode: Optional) = - travelAgencyCode(travelAgencyCode.getOrNull()) + fun noShowIndicator(noShowIndicator: Optional) = + noShowIndicator(noShowIndicator.getOrNull()) /** - * Sets [Builder.travelAgencyCode] to an arbitrary JSON value. + * Sets [Builder.noShowIndicator] to an arbitrary JSON value. * - * You should usually call [Builder.travelAgencyCode] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * You should usually call [Builder.noShowIndicator] with a well-typed + * [NoShowIndicator] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - fun travelAgencyCode(travelAgencyCode: JsonField) = apply { - this.travelAgencyCode = travelAgencyCode + fun noShowIndicator(noShowIndicator: JsonField) = apply { + this.noShowIndicator = noShowIndicator } + /** Prepaid expenses being charged for the room. */ + fun prepaidExpensesAmount(prepaidExpensesAmount: Long?) = + prepaidExpensesAmount(JsonField.ofNullable(prepaidExpensesAmount)) + /** - * Name of the travel agency if the ticket was issued by a travel agency. + * Alias for [Builder.prepaidExpensesAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. */ - fun travelAgencyName(travelAgencyName: String?) = - travelAgencyName(JsonField.ofNullable(travelAgencyName)) + fun prepaidExpensesAmount(prepaidExpensesAmount: Long) = + prepaidExpensesAmount(prepaidExpensesAmount as Long?) /** - * Alias for calling [Builder.travelAgencyName] with - * `travelAgencyName.orElse(null)`. + * Alias for calling [Builder.prepaidExpensesAmount] with + * `prepaidExpensesAmount.orElse(null)`. */ - fun travelAgencyName(travelAgencyName: Optional) = - travelAgencyName(travelAgencyName.getOrNull()) + fun prepaidExpensesAmount(prepaidExpensesAmount: Optional) = + prepaidExpensesAmount(prepaidExpensesAmount.getOrNull()) /** - * Sets [Builder.travelAgencyName] to an arbitrary JSON value. + * Sets [Builder.prepaidExpensesAmount] to an arbitrary JSON value. * - * You should usually call [Builder.travelAgencyName] with a well-typed - * [String] value instead. This method is primarily for setting the field to + * You should usually call [Builder.prepaidExpensesAmount] with a well-typed + * [Long] value instead. This method is primarily for setting the field to * an undocumented or not yet supported value. */ - fun travelAgencyName(travelAgencyName: JsonField) = apply { - this.travelAgencyName = travelAgencyName + fun prepaidExpensesAmount(prepaidExpensesAmount: JsonField) = apply { + this.prepaidExpensesAmount = prepaidExpensesAmount } - /** Fields specific to each leg of the journey. */ - fun tripLegs(tripLegs: List?) = - tripLegs(JsonField.ofNullable(tripLegs)) - - /** Alias for calling [Builder.tripLegs] with `tripLegs.orElse(null)`. */ - fun tripLegs(tripLegs: Optional>) = - tripLegs(tripLegs.getOrNull()) + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * prepaid expenses. + */ + fun prepaidExpensesCurrency(prepaidExpensesCurrency: String?) = + prepaidExpensesCurrency(JsonField.ofNullable(prepaidExpensesCurrency)) /** - * Sets [Builder.tripLegs] to an arbitrary JSON value. - * - * You should usually call [Builder.tripLegs] with a well-typed - * `List` value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * Alias for calling [Builder.prepaidExpensesCurrency] with + * `prepaidExpensesCurrency.orElse(null)`. */ - fun tripLegs(tripLegs: JsonField>) = apply { - this.tripLegs = tripLegs.map { it.toMutableList() } - } + fun prepaidExpensesCurrency(prepaidExpensesCurrency: Optional) = + prepaidExpensesCurrency(prepaidExpensesCurrency.getOrNull()) /** - * Adds a single [TripLeg] to [tripLegs]. + * Sets [Builder.prepaidExpensesCurrency] to an arbitrary JSON value. * - * @throws IllegalStateException if the field was previously set to a - * non-list. + * You should usually call [Builder.prepaidExpensesCurrency] with a + * well-typed [String] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. */ - fun addTripLeg(tripLeg: TripLeg) = apply { - tripLegs = - (tripLegs ?: JsonField.of(mutableListOf())).also { - checkKnown("tripLegs", it).add(tripLeg) - } - } - - fun additionalProperties(additionalProperties: Map) = + fun prepaidExpensesCurrency(prepaidExpensesCurrency: JsonField) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) + this.prepaidExpensesCurrency = prepaidExpensesCurrency } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** Number of nights the room was rented. */ + fun roomNights(roomNights: Long?) = + roomNights(JsonField.ofNullable(roomNights)) - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } + /** + * Alias for [Builder.roomNights]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun roomNights(roomNights: Long) = roomNights(roomNights as Long?) - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** + * Alias for calling [Builder.roomNights] with `roomNights.orElse(null)`. + */ + fun roomNights(roomNights: Optional) = + roomNights(roomNights.getOrNull()) - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + /** + * Sets [Builder.roomNights] to an arbitrary JSON value. + * + * You should usually call [Builder.roomNights] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun roomNights(roomNights: JsonField) = apply { + this.roomNights = roomNights } + /** Total room tax being charged. */ + fun totalRoomTaxAmount(totalRoomTaxAmount: Long?) = + totalRoomTaxAmount(JsonField.ofNullable(totalRoomTaxAmount)) + /** - * Returns an immutable instance of [Travel]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .ancillary() - * .computerizedReservationSystem() - * .creditReasonIndicator() - * .departureDate() - * .originationCityAirportCode() - * .passengerName() - * .restrictedTicketIndicator() - * .ticketChangeIndicator() - * .ticketNumber() - * .travelAgencyCode() - * .travelAgencyName() - * .tripLegs() - * ``` + * Alias for [Builder.totalRoomTaxAmount]. * - * @throws IllegalStateException if any required field is unset. + * This unboxed primitive overload exists for backwards compatibility. */ - fun build(): Travel = - Travel( - checkRequired("ancillary", ancillary), - checkRequired( - "computerizedReservationSystem", - computerizedReservationSystem, - ), - checkRequired("creditReasonIndicator", creditReasonIndicator), - checkRequired("departureDate", departureDate), - checkRequired( - "originationCityAirportCode", - originationCityAirportCode, - ), - checkRequired("passengerName", passengerName), - checkRequired( - "restrictedTicketIndicator", - restrictedTicketIndicator, - ), - checkRequired("ticketChangeIndicator", ticketChangeIndicator), - checkRequired("ticketNumber", ticketNumber), - checkRequired("travelAgencyCode", travelAgencyCode), - checkRequired("travelAgencyName", travelAgencyName), - checkRequired("tripLegs", tripLegs).map { it.toImmutable() }, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Travel = apply { - if (validated) { - return@apply - } - - ancillary().ifPresent { it.validate() } - computerizedReservationSystem() - creditReasonIndicator().ifPresent { it.validate() } - departureDate() - originationCityAirportCode() - passengerName() - restrictedTicketIndicator().ifPresent { it.validate() } - ticketChangeIndicator().ifPresent { it.validate() } - ticketNumber() - travelAgencyCode() - travelAgencyName() - tripLegs().ifPresent { it.forEach { it.validate() } } - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (ancillary.asKnown().getOrNull()?.validity() ?: 0) + - (if (computerizedReservationSystem.asKnown().isPresent) 1 else 0) + - (creditReasonIndicator.asKnown().getOrNull()?.validity() ?: 0) + - (if (departureDate.asKnown().isPresent) 1 else 0) + - (if (originationCityAirportCode.asKnown().isPresent) 1 else 0) + - (if (passengerName.asKnown().isPresent) 1 else 0) + - (restrictedTicketIndicator.asKnown().getOrNull()?.validity() ?: 0) + - (ticketChangeIndicator.asKnown().getOrNull()?.validity() ?: 0) + - (if (ticketNumber.asKnown().isPresent) 1 else 0) + - (if (travelAgencyCode.asKnown().isPresent) 1 else 0) + - (if (travelAgencyName.asKnown().isPresent) 1 else 0) + - (tripLegs.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) - - /** Ancillary purchases in addition to the airfare. */ - class Ancillary - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val connectedTicketDocumentNumber: JsonField, - private val creditReasonIndicator: JsonField, - private val passengerNameOrDescription: JsonField, - private val services: JsonField>, - private val ticketDocumentNumber: JsonField, - private val additionalProperties: MutableMap, - ) { + fun totalRoomTaxAmount(totalRoomTaxAmount: Long) = + totalRoomTaxAmount(totalRoomTaxAmount as Long?) - @JsonCreator - private constructor( - @JsonProperty("connected_ticket_document_number") - @ExcludeMissing - connectedTicketDocumentNumber: JsonField = JsonMissing.of(), - @JsonProperty("credit_reason_indicator") - @ExcludeMissing - creditReasonIndicator: JsonField = - JsonMissing.of(), - @JsonProperty("passenger_name_or_description") - @ExcludeMissing - passengerNameOrDescription: JsonField = JsonMissing.of(), - @JsonProperty("services") - @ExcludeMissing - services: JsonField> = JsonMissing.of(), - @JsonProperty("ticket_document_number") - @ExcludeMissing - ticketDocumentNumber: JsonField = JsonMissing.of(), - ) : this( - connectedTicketDocumentNumber, - creditReasonIndicator, - passengerNameOrDescription, - services, - ticketDocumentNumber, - mutableMapOf(), - ) + /** + * Alias for calling [Builder.totalRoomTaxAmount] with + * `totalRoomTaxAmount.orElse(null)`. + */ + fun totalRoomTaxAmount(totalRoomTaxAmount: Optional) = + totalRoomTaxAmount(totalRoomTaxAmount.getOrNull()) /** - * If this purchase has a connection or relationship to another purchase, - * such as a baggage fee for a passenger transport ticket, this field should - * contain the ticket document number for the other purchase. + * Sets [Builder.totalRoomTaxAmount] to an arbitrary JSON value. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). + * You should usually call [Builder.totalRoomTaxAmount] with a well-typed + * [Long] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. */ - fun connectedTicketDocumentNumber(): Optional = - connectedTicketDocumentNumber.getOptional( - "connected_ticket_document_number" - ) + fun totalRoomTaxAmount(totalRoomTaxAmount: JsonField) = apply { + this.totalRoomTaxAmount = totalRoomTaxAmount + } /** - * Indicates the reason for a credit to the cardholder. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total + * room tax. */ - fun creditReasonIndicator(): Optional = - creditReasonIndicator.getOptional("credit_reason_indicator") + fun totalRoomTaxCurrency(totalRoomTaxCurrency: String?) = + totalRoomTaxCurrency(JsonField.ofNullable(totalRoomTaxCurrency)) /** - * Name of the passenger or description of the ancillary purchase. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). + * Alias for calling [Builder.totalRoomTaxCurrency] with + * `totalRoomTaxCurrency.orElse(null)`. */ - fun passengerNameOrDescription(): Optional = - passengerNameOrDescription.getOptional("passenger_name_or_description") + fun totalRoomTaxCurrency(totalRoomTaxCurrency: Optional) = + totalRoomTaxCurrency(totalRoomTaxCurrency.getOrNull()) /** - * Additional travel charges, such as baggage fees. + * Sets [Builder.totalRoomTaxCurrency] to an arbitrary JSON value. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type or is unexpectedly missing or null (e.g. if the server responded - * with an unexpected value). + * You should usually call [Builder.totalRoomTaxCurrency] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. */ - fun services(): List = services.getRequired("services") + fun totalRoomTaxCurrency(totalRoomTaxCurrency: JsonField) = apply { + this.totalRoomTaxCurrency = totalRoomTaxCurrency + } + + /** Total tax being charged for the room. */ + fun totalTaxAmount(totalTaxAmount: Long?) = + totalTaxAmount(JsonField.ofNullable(totalTaxAmount)) /** - * Ticket document number. + * Alias for [Builder.totalTaxAmount]. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). + * This unboxed primitive overload exists for backwards compatibility. */ - fun ticketDocumentNumber(): Optional = - ticketDocumentNumber.getOptional("ticket_document_number") + fun totalTaxAmount(totalTaxAmount: Long) = + totalTaxAmount(totalTaxAmount as Long?) /** - * Returns the raw JSON value of [connectedTicketDocumentNumber]. - * - * Unlike [connectedTicketDocumentNumber], this method doesn't throw if the - * JSON field has an unexpected type. + * Alias for calling [Builder.totalTaxAmount] with + * `totalTaxAmount.orElse(null)`. */ - @JsonProperty("connected_ticket_document_number") - @ExcludeMissing - fun _connectedTicketDocumentNumber(): JsonField = - connectedTicketDocumentNumber + fun totalTaxAmount(totalTaxAmount: Optional) = + totalTaxAmount(totalTaxAmount.getOrNull()) /** - * Returns the raw JSON value of [creditReasonIndicator]. + * Sets [Builder.totalTaxAmount] to an arbitrary JSON value. * - * Unlike [creditReasonIndicator], this method doesn't throw if the JSON - * field has an unexpected type. + * You should usually call [Builder.totalTaxAmount] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ - @JsonProperty("credit_reason_indicator") - @ExcludeMissing - fun _creditReasonIndicator(): JsonField = - creditReasonIndicator + fun totalTaxAmount(totalTaxAmount: JsonField) = apply { + this.totalTaxAmount = totalTaxAmount + } /** - * Returns the raw JSON value of [passengerNameOrDescription]. - * - * Unlike [passengerNameOrDescription], this method doesn't throw if the - * JSON field has an unexpected type. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total + * tax assessed. */ - @JsonProperty("passenger_name_or_description") - @ExcludeMissing - fun _passengerNameOrDescription(): JsonField = - passengerNameOrDescription + fun totalTaxCurrency(totalTaxCurrency: String?) = + totalTaxCurrency(JsonField.ofNullable(totalTaxCurrency)) /** - * Returns the raw JSON value of [services]. - * - * Unlike [services], this method doesn't throw if the JSON field has an - * unexpected type. + * Alias for calling [Builder.totalTaxCurrency] with + * `totalTaxCurrency.orElse(null)`. */ - @JsonProperty("services") - @ExcludeMissing - fun _services(): JsonField> = services + fun totalTaxCurrency(totalTaxCurrency: Optional) = + totalTaxCurrency(totalTaxCurrency.getOrNull()) /** - * Returns the raw JSON value of [ticketDocumentNumber]. + * Sets [Builder.totalTaxCurrency] to an arbitrary JSON value. * - * Unlike [ticketDocumentNumber], this method doesn't throw if the JSON - * field has an unexpected type. + * You should usually call [Builder.totalTaxCurrency] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. */ - @JsonProperty("ticket_document_number") - @ExcludeMissing - fun _ticketDocumentNumber(): JsonField = ticketDocumentNumber + fun totalTaxCurrency(totalTaxCurrency: JsonField) = apply { + this.totalTaxCurrency = totalTaxCurrency + } - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { additionalProperties.put(key, value) } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } - fun toBuilder() = Builder().from(this) + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - companion object { + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * Returns a mutable builder for constructing an instance of - * [Ancillary]. - * - * The following fields are required: - * ```java - * .connectedTicketDocumentNumber() - * .creditReasonIndicator() - * .passengerNameOrDescription() - * .services() - * .ticketDocumentNumber() - * ``` - */ - @JvmStatic fun builder() = Builder() + /** + * Returns an immutable instance of [Lodging]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .checkInDate() + * .dailyRoomRateAmount() + * .dailyRoomRateCurrency() + * .extraCharges() + * .folioCashAdvancesAmount() + * .folioCashAdvancesCurrency() + * .foodBeverageChargesAmount() + * .foodBeverageChargesCurrency() + * .noShowIndicator() + * .prepaidExpensesAmount() + * .prepaidExpensesCurrency() + * .roomNights() + * .totalRoomTaxAmount() + * .totalRoomTaxCurrency() + * .totalTaxAmount() + * .totalTaxCurrency() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Lodging = + Lodging( + checkRequired("checkInDate", checkInDate), + checkRequired("dailyRoomRateAmount", dailyRoomRateAmount), + checkRequired("dailyRoomRateCurrency", dailyRoomRateCurrency), + checkRequired("extraCharges", extraCharges), + checkRequired("folioCashAdvancesAmount", folioCashAdvancesAmount), + checkRequired( + "folioCashAdvancesCurrency", + folioCashAdvancesCurrency, + ), + checkRequired( + "foodBeverageChargesAmount", + foodBeverageChargesAmount, + ), + checkRequired( + "foodBeverageChargesCurrency", + foodBeverageChargesCurrency, + ), + checkRequired("noShowIndicator", noShowIndicator), + checkRequired("prepaidExpensesAmount", prepaidExpensesAmount), + checkRequired("prepaidExpensesCurrency", prepaidExpensesCurrency), + checkRequired("roomNights", roomNights), + checkRequired("totalRoomTaxAmount", totalRoomTaxAmount), + checkRequired("totalRoomTaxCurrency", totalRoomTaxCurrency), + checkRequired("totalTaxAmount", totalTaxAmount), + checkRequired("totalTaxCurrency", totalTaxCurrency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Lodging = apply { + if (validated) { + return@apply } - /** A builder for [Ancillary]. */ - class Builder internal constructor() { + checkInDate() + dailyRoomRateAmount() + dailyRoomRateCurrency() + extraCharges().ifPresent { it.validate() } + folioCashAdvancesAmount() + folioCashAdvancesCurrency() + foodBeverageChargesAmount() + foodBeverageChargesCurrency() + noShowIndicator().ifPresent { it.validate() } + prepaidExpensesAmount() + prepaidExpensesCurrency() + roomNights() + totalRoomTaxAmount() + totalRoomTaxCurrency() + totalTaxAmount() + totalTaxCurrency() + validated = true + } - private var connectedTicketDocumentNumber: JsonField? = null - private var creditReasonIndicator: JsonField? = - null - private var passengerNameOrDescription: JsonField? = null - private var services: JsonField>? = null - private var ticketDocumentNumber: JsonField? = null - private var additionalProperties: MutableMap = - mutableMapOf() + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - @JvmSynthetic - internal fun from(ancillary: Ancillary) = apply { - connectedTicketDocumentNumber = - ancillary.connectedTicketDocumentNumber - creditReasonIndicator = ancillary.creditReasonIndicator - passengerNameOrDescription = ancillary.passengerNameOrDescription - services = ancillary.services.map { it.toMutableList() } - ticketDocumentNumber = ancillary.ticketDocumentNumber - additionalProperties = ancillary.additionalProperties.toMutableMap() - } + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (checkInDate.asKnown().isPresent) 1 else 0) + + (if (dailyRoomRateAmount.asKnown().isPresent) 1 else 0) + + (if (dailyRoomRateCurrency.asKnown().isPresent) 1 else 0) + + (extraCharges.asKnown().getOrNull()?.validity() ?: 0) + + (if (folioCashAdvancesAmount.asKnown().isPresent) 1 else 0) + + (if (folioCashAdvancesCurrency.asKnown().isPresent) 1 else 0) + + (if (foodBeverageChargesAmount.asKnown().isPresent) 1 else 0) + + (if (foodBeverageChargesCurrency.asKnown().isPresent) 1 else 0) + + (noShowIndicator.asKnown().getOrNull()?.validity() ?: 0) + + (if (prepaidExpensesAmount.asKnown().isPresent) 1 else 0) + + (if (prepaidExpensesCurrency.asKnown().isPresent) 1 else 0) + + (if (roomNights.asKnown().isPresent) 1 else 0) + + (if (totalRoomTaxAmount.asKnown().isPresent) 1 else 0) + + (if (totalRoomTaxCurrency.asKnown().isPresent) 1 else 0) + + (if (totalTaxAmount.asKnown().isPresent) 1 else 0) + + (if (totalTaxCurrency.asKnown().isPresent) 1 else 0) - /** - * If this purchase has a connection or relationship to another - * purchase, such as a baggage fee for a passenger transport ticket, - * this field should contain the ticket document number for the other - * purchase. - */ - fun connectedTicketDocumentNumber( - connectedTicketDocumentNumber: String? - ) = - connectedTicketDocumentNumber( - JsonField.ofNullable(connectedTicketDocumentNumber) - ) + /** Additional charges (phone, late check-out, etc.) being billed. */ + class ExtraCharges + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** - * Alias for calling [Builder.connectedTicketDocumentNumber] with - * `connectedTicketDocumentNumber.orElse(null)`. - */ - fun connectedTicketDocumentNumber( - connectedTicketDocumentNumber: Optional - ) = - connectedTicketDocumentNumber( - connectedTicketDocumentNumber.getOrNull() - ) + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** - * Sets [Builder.connectedTicketDocumentNumber] to an arbitrary JSON - * value. - * - * You should usually call [Builder.connectedTicketDocumentNumber] with - * a well-typed [String] value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. - */ - fun connectedTicketDocumentNumber( - connectedTicketDocumentNumber: JsonField - ) = apply { - this.connectedTicketDocumentNumber = connectedTicketDocumentNumber - } + companion object { - /** Indicates the reason for a credit to the cardholder. */ - fun creditReasonIndicator( - creditReasonIndicator: CreditReasonIndicator? - ) = creditReasonIndicator(JsonField.ofNullable(creditReasonIndicator)) + /** No extra charge */ + @JvmField val NO_EXTRA_CHARGE = of("no_extra_charge") - /** - * Alias for calling [Builder.creditReasonIndicator] with - * `creditReasonIndicator.orElse(null)`. - */ - fun creditReasonIndicator( - creditReasonIndicator: Optional - ) = creditReasonIndicator(creditReasonIndicator.getOrNull()) + /** Restaurant */ + @JvmField val RESTAURANT = of("restaurant") - /** - * Sets [Builder.creditReasonIndicator] to an arbitrary JSON value. - * - * You should usually call [Builder.creditReasonIndicator] with a - * well-typed [CreditReasonIndicator] value instead. This method is - * primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun creditReasonIndicator( - creditReasonIndicator: JsonField - ) = apply { this.creditReasonIndicator = creditReasonIndicator } + /** Gift shop */ + @JvmField val GIFT_SHOP = of("gift_shop") - /** Name of the passenger or description of the ancillary purchase. */ - fun passengerNameOrDescription(passengerNameOrDescription: String?) = - passengerNameOrDescription( - JsonField.ofNullable(passengerNameOrDescription) - ) + /** Mini bar */ + @JvmField val MINI_BAR = of("mini_bar") - /** - * Alias for calling [Builder.passengerNameOrDescription] with - * `passengerNameOrDescription.orElse(null)`. - */ - fun passengerNameOrDescription( - passengerNameOrDescription: Optional - ) = passengerNameOrDescription(passengerNameOrDescription.getOrNull()) + /** Telephone */ + @JvmField val TELEPHONE = of("telephone") - /** - * Sets [Builder.passengerNameOrDescription] to an arbitrary JSON value. - * - * You should usually call [Builder.passengerNameOrDescription] with a - * well-typed [String] value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. - */ - fun passengerNameOrDescription( - passengerNameOrDescription: JsonField - ) = apply { - this.passengerNameOrDescription = passengerNameOrDescription - } - - /** Additional travel charges, such as baggage fees. */ - fun services(services: List) = services(JsonField.of(services)) - - /** - * Sets [Builder.services] to an arbitrary JSON value. - * - * You should usually call [Builder.services] with a well-typed - * `List` value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. - */ - fun services(services: JsonField>) = apply { - this.services = services.map { it.toMutableList() } - } + /** Other */ + @JvmField val OTHER = of("other") - /** - * Adds a single [Service] to [services]. - * - * @throws IllegalStateException if the field was previously set to a - * non-list. - */ - fun addService(service: Service) = apply { - services = - (services ?: JsonField.of(mutableListOf())).also { - checkKnown("services", it).add(service) - } - } + /** Laundry */ + @JvmField val LAUNDRY = of("laundry") - /** Ticket document number. */ - fun ticketDocumentNumber(ticketDocumentNumber: String?) = - ticketDocumentNumber(JsonField.ofNullable(ticketDocumentNumber)) + @JvmStatic fun of(value: String) = ExtraCharges(JsonField.of(value)) + } - /** - * Alias for calling [Builder.ticketDocumentNumber] with - * `ticketDocumentNumber.orElse(null)`. - */ - fun ticketDocumentNumber(ticketDocumentNumber: Optional) = - ticketDocumentNumber(ticketDocumentNumber.getOrNull()) + /** An enum containing [ExtraCharges]'s known values. */ + enum class Known { + /** No extra charge */ + NO_EXTRA_CHARGE, + /** Restaurant */ + RESTAURANT, + /** Gift shop */ + GIFT_SHOP, + /** Mini bar */ + MINI_BAR, + /** Telephone */ + TELEPHONE, + /** Other */ + OTHER, + /** Laundry */ + LAUNDRY, + } + /** + * An enum containing [ExtraCharges]'s known values, as well as an + * [_UNKNOWN] member. + * + * An instance of [ExtraCharges] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** No extra charge */ + NO_EXTRA_CHARGE, + /** Restaurant */ + RESTAURANT, + /** Gift shop */ + GIFT_SHOP, + /** Mini bar */ + MINI_BAR, + /** Telephone */ + TELEPHONE, + /** Other */ + OTHER, + /** Laundry */ + LAUNDRY, /** - * Sets [Builder.ticketDocumentNumber] to an arbitrary JSON value. - * - * You should usually call [Builder.ticketDocumentNumber] with a - * well-typed [String] value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. + * An enum member indicating that [ExtraCharges] was instantiated with + * an unknown value. */ - fun ticketDocumentNumber(ticketDocumentNumber: JsonField) = - apply { - this.ticketDocumentNumber = ticketDocumentNumber - } - - fun additionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + _UNKNOWN, + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NO_EXTRA_CHARGE -> Value.NO_EXTRA_CHARGE + RESTAURANT -> Value.RESTAURANT + GIFT_SHOP -> Value.GIFT_SHOP + MINI_BAR -> Value.MINI_BAR + TELEPHONE -> Value.TELEPHONE + OTHER -> Value.OTHER + LAUNDRY -> Value.LAUNDRY + else -> Value._UNKNOWN } - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + NO_EXTRA_CHARGE -> Known.NO_EXTRA_CHARGE + RESTAURANT -> Known.RESTAURANT + GIFT_SHOP -> Known.GIFT_SHOP + MINI_BAR -> Known.MINI_BAR + TELEPHONE -> Known.TELEPHONE + OTHER -> Known.OTHER + LAUNDRY -> Known.LAUNDRY + else -> + throw IncreaseInvalidDataException( + "Unknown ExtraCharges: $value" + ) } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") } - /** - * Returns an immutable instance of [Ancillary]. - * - * Further updates to this [Builder] will not mutate the returned - * instance. - * - * The following fields are required: - * ```java - * .connectedTicketDocumentNumber() - * .creditReasonIndicator() - * .passengerNameOrDescription() - * .services() - * .ticketDocumentNumber() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Ancillary = - Ancillary( - checkRequired( - "connectedTicketDocumentNumber", - connectedTicketDocumentNumber, - ), - checkRequired("creditReasonIndicator", creditReasonIndicator), - checkRequired( - "passengerNameOrDescription", - passengerNameOrDescription, - ), - checkRequired("services", services).map { it.toImmutable() }, - checkRequired("ticketDocumentNumber", ticketDocumentNumber), - additionalProperties.toMutableMap(), - ) - } - private var validated: Boolean = false - fun validate(): Ancillary = apply { + fun validate(): ExtraCharges = apply { if (validated) { return@apply } - connectedTicketDocumentNumber() - creditReasonIndicator().ifPresent { it.validate() } - passengerNameOrDescription() - services().forEach { it.validate() } - ticketDocumentNumber() + known() validated = true } @@ -25609,1498 +25436,1330 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = - (if (connectedTicketDocumentNumber.asKnown().isPresent) 1 else 0) + - (creditReasonIndicator.asKnown().getOrNull()?.validity() ?: 0) + - (if (passengerNameOrDescription.asKnown().isPresent) 1 else 0) + - (services.asKnown().getOrNull()?.sumOf { it.validity().toInt() } - ?: 0) + - (if (ticketDocumentNumber.asKnown().isPresent) 1 else 0) - - /** Indicates the reason for a credit to the cardholder. */ - class CreditReasonIndicator - @JsonCreator - private constructor(private val value: JsonField) : Enum { + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from - * data that doesn't match any known member, and you want to know that - * value. For example, if the SDK is on an older version than the API, - * then the API may respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - companion object { + return other is ExtraCharges && value == other.value + } - /** No credit */ - @JvmField val NO_CREDIT = of("no_credit") + override fun hashCode() = value.hashCode() - /** Passenger transport ancillary purchase cancellation */ - @JvmField - val PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = - of("passenger_transport_ancillary_purchase_cancellation") + override fun toString() = value.toString() + } - /** - * Airline ticket and passenger transport ancillary purchase - * cancellation - */ - @JvmField - val AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = - of( - "airline_ticket_and_passenger_transport_ancillary_purchase_cancellation" - ) + /** + * Indicator that the cardholder is being billed for a reserved room that was + * not actually used. + */ + class NoShowIndicator + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** Other */ - @JvmField val OTHER = of("other") + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - @JvmStatic - fun of(value: String) = CreditReasonIndicator(JsonField.of(value)) - } + companion object { - /** An enum containing [CreditReasonIndicator]'s known values. */ - enum class Known { - /** No credit */ - NO_CREDIT, - /** Passenger transport ancillary purchase cancellation */ - PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, - /** - * Airline ticket and passenger transport ancillary purchase - * cancellation - */ - AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, - /** Other */ - OTHER, - } + /** Not applicable */ + @JvmField val NOT_APPLICABLE = of("not_applicable") - /** - * An enum containing [CreditReasonIndicator]'s known values, as well as - * an [_UNKNOWN] member. - * - * An instance of [CreditReasonIndicator] can contain an unknown value - * in a couple of cases: - * - It was deserialized from data that doesn't match any known member. - * For example, if the SDK is on an older version than the API, then - * the API may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** No credit */ - NO_CREDIT, - /** Passenger transport ancillary purchase cancellation */ - PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, - /** - * Airline ticket and passenger transport ancillary purchase - * cancellation - */ - AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, - /** Other */ - OTHER, - /** - * An enum member indicating that [CreditReasonIndicator] was - * instantiated with an unknown value. - */ - _UNKNOWN, - } + /** No show */ + @JvmField val NO_SHOW = of("no_show") - /** - * Returns an enum member corresponding to this class instance's value, - * or [Value._UNKNOWN] if the class was instantiated with an unknown - * value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - NO_CREDIT -> Value.NO_CREDIT - PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> - Value.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION - AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> - Value - .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION - OTHER -> Value.OTHER - else -> Value._UNKNOWN - } + @JvmStatic fun of(value: String) = NoShowIndicator(JsonField.of(value)) + } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is - * always known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value - * is a not a known member. - */ - fun known(): Known = - when (this) { - NO_CREDIT -> Known.NO_CREDIT - PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> - Known.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION - AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> - Known - .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION - OTHER -> Known.OTHER - else -> - throw IncreaseInvalidDataException( - "Unknown CreditReasonIndicator: $value" - ) - } + /** An enum containing [NoShowIndicator]'s known values. */ + enum class Known { + /** Not applicable */ + NOT_APPLICABLE, + /** No show */ + NO_SHOW, + } + /** + * An enum containing [NoShowIndicator]'s known values, as well as an + * [_UNKNOWN] member. + * + * An instance of [NoShowIndicator] can contain an unknown value in a couple + * of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** Not applicable */ + NOT_APPLICABLE, + /** No show */ + NO_SHOW, /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is - * primarily for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value - * does not have the expected primitive type. + * An enum member indicating that [NoShowIndicator] was instantiated + * with an unknown value. */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): CreditReasonIndicator = apply { - if (validated) { - return@apply - } + _UNKNOWN, + } - known() - validated = true + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NOT_APPLICABLE -> Value.NOT_APPLICABLE + NO_SHOW -> Value.NO_SHOW + else -> Value._UNKNOWN } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + NOT_APPLICABLE -> Known.NOT_APPLICABLE + NO_SHOW -> Known.NO_SHOW + else -> + throw IncreaseInvalidDataException( + "Unknown NoShowIndicator: $value" + ) + } - /** - * Returns a score indicating how many valid values are contained in - * this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + private var validated: Boolean = false - return other is CreditReasonIndicator && value == other.value + fun validate(): NoShowIndicator = apply { + if (validated) { + return@apply } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() + known() + validated = true } - class Service - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val category: JsonField, - private val subCategory: JsonField, - private val additionalProperties: MutableMap, - ) { + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - @JsonCreator - private constructor( - @JsonProperty("category") - @ExcludeMissing - category: JsonField = JsonMissing.of(), - @JsonProperty("sub_category") - @ExcludeMissing - subCategory: JsonField = JsonMissing.of(), - ) : this(category, subCategory, mutableMapOf()) - - /** - * Category of the ancillary service. - * - * @throws IncreaseInvalidDataException if the JSON field has an - * unexpected type (e.g. if the server responded with an unexpected - * value). - */ - fun category(): Optional = category.getOptional("category") - - /** - * Sub-category of the ancillary service, free-form. - * - * @throws IncreaseInvalidDataException if the JSON field has an - * unexpected type (e.g. if the server responded with an unexpected - * value). - */ - fun subCategory(): Optional = - subCategory.getOptional("sub_category") - - /** - * Returns the raw JSON value of [category]. - * - * Unlike [category], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("category") - @ExcludeMissing - fun _category(): JsonField = category - - /** - * Returns the raw JSON value of [subCategory]. - * - * Unlike [subCategory], this method doesn't throw if the JSON field has - * an unexpected type. - */ - @JsonProperty("sub_category") - @ExcludeMissing - fun _subCategory(): JsonField = subCategory + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + return other is NoShowIndicator && value == other.value + } - fun toBuilder() = Builder().from(this) + override fun hashCode() = value.hashCode() - companion object { + override fun toString() = value.toString() + } - /** - * Returns a mutable builder for constructing an instance of - * [Service]. - * - * The following fields are required: - * ```java - * .category() - * .subCategory() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** A builder for [Service]. */ - class Builder internal constructor() { + return other is Lodging && + checkInDate == other.checkInDate && + dailyRoomRateAmount == other.dailyRoomRateAmount && + dailyRoomRateCurrency == other.dailyRoomRateCurrency && + extraCharges == other.extraCharges && + folioCashAdvancesAmount == other.folioCashAdvancesAmount && + folioCashAdvancesCurrency == other.folioCashAdvancesCurrency && + foodBeverageChargesAmount == other.foodBeverageChargesAmount && + foodBeverageChargesCurrency == other.foodBeverageChargesCurrency && + noShowIndicator == other.noShowIndicator && + prepaidExpensesAmount == other.prepaidExpensesAmount && + prepaidExpensesCurrency == other.prepaidExpensesCurrency && + roomNights == other.roomNights && + totalRoomTaxAmount == other.totalRoomTaxAmount && + totalRoomTaxCurrency == other.totalRoomTaxCurrency && + totalTaxAmount == other.totalTaxAmount && + totalTaxCurrency == other.totalTaxCurrency && + additionalProperties == other.additionalProperties + } - private var category: JsonField? = null - private var subCategory: JsonField? = null - private var additionalProperties: MutableMap = - mutableMapOf() + private val hashCode: Int by lazy { + Objects.hash( + checkInDate, + dailyRoomRateAmount, + dailyRoomRateCurrency, + extraCharges, + folioCashAdvancesAmount, + folioCashAdvancesCurrency, + foodBeverageChargesAmount, + foodBeverageChargesCurrency, + noShowIndicator, + prepaidExpensesAmount, + prepaidExpensesCurrency, + roomNights, + totalRoomTaxAmount, + totalRoomTaxCurrency, + totalTaxAmount, + totalTaxCurrency, + additionalProperties, + ) + } - @JvmSynthetic - internal fun from(service: Service) = apply { - category = service.category - subCategory = service.subCategory - additionalProperties = - service.additionalProperties.toMutableMap() - } + override fun hashCode(): Int = hashCode - /** Category of the ancillary service. */ - fun category(category: Category?) = - category(JsonField.ofNullable(category)) + override fun toString() = + "Lodging{checkInDate=$checkInDate, dailyRoomRateAmount=$dailyRoomRateAmount, dailyRoomRateCurrency=$dailyRoomRateCurrency, extraCharges=$extraCharges, folioCashAdvancesAmount=$folioCashAdvancesAmount, folioCashAdvancesCurrency=$folioCashAdvancesCurrency, foodBeverageChargesAmount=$foodBeverageChargesAmount, foodBeverageChargesCurrency=$foodBeverageChargesCurrency, noShowIndicator=$noShowIndicator, prepaidExpensesAmount=$prepaidExpensesAmount, prepaidExpensesCurrency=$prepaidExpensesCurrency, roomNights=$roomNights, totalRoomTaxAmount=$totalRoomTaxAmount, totalRoomTaxCurrency=$totalRoomTaxCurrency, totalTaxAmount=$totalTaxAmount, totalTaxCurrency=$totalTaxCurrency, additionalProperties=$additionalProperties}" + } - /** - * Alias for calling [Builder.category] with - * `category.orElse(null)`. - */ - fun category(category: Optional) = - category(category.getOrNull()) + /** The format of the purchase identifier. */ + class PurchaseIdentifierFormat + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** - * Sets [Builder.category] to an arbitrary JSON value. - * - * You should usually call [Builder.category] with a well-typed - * [Category] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. - */ - fun category(category: JsonField) = apply { - this.category = category - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** Sub-category of the ancillary service, free-form. */ - fun subCategory(subCategory: String?) = - subCategory(JsonField.ofNullable(subCategory)) + companion object { - /** - * Alias for calling [Builder.subCategory] with - * `subCategory.orElse(null)`. - */ - fun subCategory(subCategory: Optional) = - subCategory(subCategory.getOrNull()) + /** Free text */ + @JvmField val FREE_TEXT = of("free_text") - /** - * Sets [Builder.subCategory] to an arbitrary JSON value. - * - * You should usually call [Builder.subCategory] with a well-typed - * [String] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun subCategory(subCategory: JsonField) = apply { - this.subCategory = subCategory - } + /** Order number */ + @JvmField val ORDER_NUMBER = of("order_number") - fun additionalProperties( - additionalProperties: Map - ) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** Rental agreement number */ + @JvmField val RENTAL_AGREEMENT_NUMBER = of("rental_agreement_number") - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** Hotel folio number */ + @JvmField val HOTEL_FOLIO_NUMBER = of("hotel_folio_number") - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } + /** Invoice number */ + @JvmField val INVOICE_NUMBER = of("invoice_number") - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + @JvmStatic + fun of(value: String) = PurchaseIdentifierFormat(JsonField.of(value)) + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** An enum containing [PurchaseIdentifierFormat]'s known values. */ + enum class Known { + /** Free text */ + FREE_TEXT, + /** Order number */ + ORDER_NUMBER, + /** Rental agreement number */ + RENTAL_AGREEMENT_NUMBER, + /** Hotel folio number */ + HOTEL_FOLIO_NUMBER, + /** Invoice number */ + INVOICE_NUMBER, + } - /** - * Returns an immutable instance of [Service]. - * - * Further updates to this [Builder] will not mutate the returned - * instance. - * - * The following fields are required: - * ```java - * .category() - * .subCategory() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Service = - Service( - checkRequired("category", category), - checkRequired("subCategory", subCategory), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Service = apply { - if (validated) { - return@apply - } + /** + * An enum containing [PurchaseIdentifierFormat]'s known values, as well as an + * [_UNKNOWN] member. + * + * An instance of [PurchaseIdentifierFormat] can contain an unknown value in a + * couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** Free text */ + FREE_TEXT, + /** Order number */ + ORDER_NUMBER, + /** Rental agreement number */ + RENTAL_AGREEMENT_NUMBER, + /** Hotel folio number */ + HOTEL_FOLIO_NUMBER, + /** Invoice number */ + INVOICE_NUMBER, + /** + * An enum member indicating that [PurchaseIdentifierFormat] was + * instantiated with an unknown value. + */ + _UNKNOWN, + } - category().ifPresent { it.validate() } - subCategory() - validated = true - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + FREE_TEXT -> Value.FREE_TEXT + ORDER_NUMBER -> Value.ORDER_NUMBER + RENTAL_AGREEMENT_NUMBER -> Value.RENTAL_AGREEMENT_NUMBER + HOTEL_FOLIO_NUMBER -> Value.HOTEL_FOLIO_NUMBER + INVOICE_NUMBER -> Value.INVOICE_NUMBER + else -> Value._UNKNOWN + } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + FREE_TEXT -> Known.FREE_TEXT + ORDER_NUMBER -> Known.ORDER_NUMBER + RENTAL_AGREEMENT_NUMBER -> Known.RENTAL_AGREEMENT_NUMBER + HOTEL_FOLIO_NUMBER -> Known.HOTEL_FOLIO_NUMBER + INVOICE_NUMBER -> Known.INVOICE_NUMBER + else -> + throw IncreaseInvalidDataException( + "Unknown PurchaseIdentifierFormat: $value" + ) + } - /** - * Returns a score indicating how many valid values are contained in - * this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (category.asKnown().getOrNull()?.validity() ?: 0) + - (if (subCategory.asKnown().isPresent) 1 else 0) + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - /** Category of the ancillary service. */ - class Category - @JsonCreator - private constructor(private val value: JsonField) : Enum { + private var validated: Boolean = false - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized - * from data that doesn't match any known member, and you want to - * know that value. For example, if the SDK is on an older version - * than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + fun validate(): PurchaseIdentifierFormat = apply { + if (validated) { + return@apply + } - companion object { + known() + validated = true + } - /** None */ - @JvmField val NONE = of("none") + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** Bundled service */ - @JvmField val BUNDLED_SERVICE = of("bundled_service") + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - /** Baggage fee */ - @JvmField val BAGGAGE_FEE = of("baggage_fee") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** Change fee */ - @JvmField val CHANGE_FEE = of("change_fee") + return other is PurchaseIdentifierFormat && value == other.value + } - /** Cargo */ - @JvmField val CARGO = of("cargo") + override fun hashCode() = value.hashCode() - /** Carbon offset */ - @JvmField val CARBON_OFFSET = of("carbon_offset") + override fun toString() = value.toString() + } - /** Frequent flyer */ - @JvmField val FREQUENT_FLYER = of("frequent_flyer") + /** Fields specific to travel. */ + class Travel + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val ancillary: JsonField, + private val computerizedReservationSystem: JsonField, + private val creditReasonIndicator: JsonField, + private val departureDate: JsonField, + private val originationCityAirportCode: JsonField, + private val passengerName: JsonField, + private val restrictedTicketIndicator: JsonField, + private val ticketChangeIndicator: JsonField, + private val ticketNumber: JsonField, + private val travelAgencyCode: JsonField, + private val travelAgencyName: JsonField, + private val tripLegs: JsonField>, + private val additionalProperties: MutableMap, + ) { - /** Gift card */ - @JvmField val GIFT_CARD = of("gift_card") + @JsonCreator + private constructor( + @JsonProperty("ancillary") + @ExcludeMissing + ancillary: JsonField = JsonMissing.of(), + @JsonProperty("computerized_reservation_system") + @ExcludeMissing + computerizedReservationSystem: JsonField = JsonMissing.of(), + @JsonProperty("credit_reason_indicator") + @ExcludeMissing + creditReasonIndicator: JsonField = JsonMissing.of(), + @JsonProperty("departure_date") + @ExcludeMissing + departureDate: JsonField = JsonMissing.of(), + @JsonProperty("origination_city_airport_code") + @ExcludeMissing + originationCityAirportCode: JsonField = JsonMissing.of(), + @JsonProperty("passenger_name") + @ExcludeMissing + passengerName: JsonField = JsonMissing.of(), + @JsonProperty("restricted_ticket_indicator") + @ExcludeMissing + restrictedTicketIndicator: JsonField = + JsonMissing.of(), + @JsonProperty("ticket_change_indicator") + @ExcludeMissing + ticketChangeIndicator: JsonField = JsonMissing.of(), + @JsonProperty("ticket_number") + @ExcludeMissing + ticketNumber: JsonField = JsonMissing.of(), + @JsonProperty("travel_agency_code") + @ExcludeMissing + travelAgencyCode: JsonField = JsonMissing.of(), + @JsonProperty("travel_agency_name") + @ExcludeMissing + travelAgencyName: JsonField = JsonMissing.of(), + @JsonProperty("trip_legs") + @ExcludeMissing + tripLegs: JsonField> = JsonMissing.of(), + ) : this( + ancillary, + computerizedReservationSystem, + creditReasonIndicator, + departureDate, + originationCityAirportCode, + passengerName, + restrictedTicketIndicator, + ticketChangeIndicator, + ticketNumber, + travelAgencyCode, + travelAgencyName, + tripLegs, + mutableMapOf(), + ) - /** Ground transport */ - @JvmField val GROUND_TRANSPORT = of("ground_transport") + /** + * Ancillary purchases in addition to the airfare. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun ancillary(): Optional = ancillary.getOptional("ancillary") - /** In-flight entertainment */ - @JvmField - val IN_FLIGHT_ENTERTAINMENT = of("in_flight_entertainment") + /** + * Indicates the computerized reservation system used to book the ticket. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun computerizedReservationSystem(): Optional = + computerizedReservationSystem.getOptional("computerized_reservation_system") - /** Lounge */ - @JvmField val LOUNGE = of("lounge") + /** + * Indicates the reason for a credit to the cardholder. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun creditReasonIndicator(): Optional = + creditReasonIndicator.getOptional("credit_reason_indicator") - /** Medical */ - @JvmField val MEDICAL = of("medical") + /** + * Date of departure. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun departureDate(): Optional = + departureDate.getOptional("departure_date") - /** Meal beverage */ - @JvmField val MEAL_BEVERAGE = of("meal_beverage") + /** + * Code for the originating city or airport. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun originationCityAirportCode(): Optional = + originationCityAirportCode.getOptional("origination_city_airport_code") - /** Other */ - @JvmField val OTHER = of("other") + /** + * Name of the passenger. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun passengerName(): Optional = + passengerName.getOptional("passenger_name") - /** Passenger assist fee */ - @JvmField val PASSENGER_ASSIST_FEE = of("passenger_assist_fee") + /** + * Indicates whether this ticket is non-refundable. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun restrictedTicketIndicator(): Optional = + restrictedTicketIndicator.getOptional("restricted_ticket_indicator") - /** Pets */ - @JvmField val PETS = of("pets") + /** + * Indicates why a ticket was changed. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun ticketChangeIndicator(): Optional = + ticketChangeIndicator.getOptional("ticket_change_indicator") - /** Seat fees */ - @JvmField val SEAT_FEES = of("seat_fees") + /** + * Ticket number. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun ticketNumber(): Optional = ticketNumber.getOptional("ticket_number") - /** Standby */ - @JvmField val STANDBY = of("standby") + /** + * Code for the travel agency if the ticket was issued by a travel agency. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun travelAgencyCode(): Optional = + travelAgencyCode.getOptional("travel_agency_code") - /** Service fee */ - @JvmField val SERVICE_FEE = of("service_fee") + /** + * Name of the travel agency if the ticket was issued by a travel agency. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun travelAgencyName(): Optional = + travelAgencyName.getOptional("travel_agency_name") - /** Store */ - @JvmField val STORE = of("store") + /** + * Fields specific to each leg of the journey. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun tripLegs(): Optional> = tripLegs.getOptional("trip_legs") - /** Travel service */ - @JvmField val TRAVEL_SERVICE = of("travel_service") + /** + * Returns the raw JSON value of [ancillary]. + * + * Unlike [ancillary], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("ancillary") + @ExcludeMissing + fun _ancillary(): JsonField = ancillary - /** Unaccompanied travel */ - @JvmField val UNACCOMPANIED_TRAVEL = of("unaccompanied_travel") + /** + * Returns the raw JSON value of [computerizedReservationSystem]. + * + * Unlike [computerizedReservationSystem], this method doesn't throw if the JSON + * field has an unexpected type. + */ + @JsonProperty("computerized_reservation_system") + @ExcludeMissing + fun _computerizedReservationSystem(): JsonField = + computerizedReservationSystem - /** Upgrades */ - @JvmField val UPGRADES = of("upgrades") + /** + * Returns the raw JSON value of [creditReasonIndicator]. + * + * Unlike [creditReasonIndicator], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("credit_reason_indicator") + @ExcludeMissing + fun _creditReasonIndicator(): JsonField = + creditReasonIndicator - /** Wi-fi */ - @JvmField val WIFI = of("wifi") + /** + * Returns the raw JSON value of [departureDate]. + * + * Unlike [departureDate], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("departure_date") + @ExcludeMissing + fun _departureDate(): JsonField = departureDate - @JvmStatic fun of(value: String) = Category(JsonField.of(value)) - } + /** + * Returns the raw JSON value of [originationCityAirportCode]. + * + * Unlike [originationCityAirportCode], this method doesn't throw if the JSON + * field has an unexpected type. + */ + @JsonProperty("origination_city_airport_code") + @ExcludeMissing + fun _originationCityAirportCode(): JsonField = + originationCityAirportCode - /** An enum containing [Category]'s known values. */ - enum class Known { - /** None */ - NONE, - /** Bundled service */ - BUNDLED_SERVICE, - /** Baggage fee */ - BAGGAGE_FEE, - /** Change fee */ - CHANGE_FEE, - /** Cargo */ - CARGO, - /** Carbon offset */ - CARBON_OFFSET, - /** Frequent flyer */ - FREQUENT_FLYER, - /** Gift card */ - GIFT_CARD, - /** Ground transport */ - GROUND_TRANSPORT, - /** In-flight entertainment */ - IN_FLIGHT_ENTERTAINMENT, - /** Lounge */ - LOUNGE, - /** Medical */ - MEDICAL, - /** Meal beverage */ - MEAL_BEVERAGE, - /** Other */ - OTHER, - /** Passenger assist fee */ - PASSENGER_ASSIST_FEE, - /** Pets */ - PETS, - /** Seat fees */ - SEAT_FEES, - /** Standby */ - STANDBY, - /** Service fee */ - SERVICE_FEE, - /** Store */ - STORE, - /** Travel service */ - TRAVEL_SERVICE, - /** Unaccompanied travel */ - UNACCOMPANIED_TRAVEL, - /** Upgrades */ - UPGRADES, - /** Wi-fi */ - WIFI, - } + /** + * Returns the raw JSON value of [passengerName]. + * + * Unlike [passengerName], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("passenger_name") + @ExcludeMissing + fun _passengerName(): JsonField = passengerName - /** - * An enum containing [Category]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [Category] can contain an unknown value in a - * couple of cases: - * - It was deserialized from data that doesn't match any known - * member. For example, if the SDK is on an older version than the - * API, then the API may respond with new members that the SDK is - * unaware of. - * - It was constructed with an arbitrary value using the [of] - * method. - */ - enum class Value { - /** None */ - NONE, - /** Bundled service */ - BUNDLED_SERVICE, - /** Baggage fee */ - BAGGAGE_FEE, - /** Change fee */ - CHANGE_FEE, - /** Cargo */ - CARGO, - /** Carbon offset */ - CARBON_OFFSET, - /** Frequent flyer */ - FREQUENT_FLYER, - /** Gift card */ - GIFT_CARD, - /** Ground transport */ - GROUND_TRANSPORT, - /** In-flight entertainment */ - IN_FLIGHT_ENTERTAINMENT, - /** Lounge */ - LOUNGE, - /** Medical */ - MEDICAL, - /** Meal beverage */ - MEAL_BEVERAGE, - /** Other */ - OTHER, - /** Passenger assist fee */ - PASSENGER_ASSIST_FEE, - /** Pets */ - PETS, - /** Seat fees */ - SEAT_FEES, - /** Standby */ - STANDBY, - /** Service fee */ - SERVICE_FEE, - /** Store */ - STORE, - /** Travel service */ - TRAVEL_SERVICE, - /** Unaccompanied travel */ - UNACCOMPANIED_TRAVEL, - /** Upgrades */ - UPGRADES, - /** Wi-fi */ - WIFI, - /** - * An enum member indicating that [Category] was instantiated - * with an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's - * value, or [Value._UNKNOWN] if the class was instantiated with an - * unknown value. - * - * Use the [known] method instead if you're certain the value is - * always known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - NONE -> Value.NONE - BUNDLED_SERVICE -> Value.BUNDLED_SERVICE - BAGGAGE_FEE -> Value.BAGGAGE_FEE - CHANGE_FEE -> Value.CHANGE_FEE - CARGO -> Value.CARGO - CARBON_OFFSET -> Value.CARBON_OFFSET - FREQUENT_FLYER -> Value.FREQUENT_FLYER - GIFT_CARD -> Value.GIFT_CARD - GROUND_TRANSPORT -> Value.GROUND_TRANSPORT - IN_FLIGHT_ENTERTAINMENT -> Value.IN_FLIGHT_ENTERTAINMENT - LOUNGE -> Value.LOUNGE - MEDICAL -> Value.MEDICAL - MEAL_BEVERAGE -> Value.MEAL_BEVERAGE - OTHER -> Value.OTHER - PASSENGER_ASSIST_FEE -> Value.PASSENGER_ASSIST_FEE - PETS -> Value.PETS - SEAT_FEES -> Value.SEAT_FEES - STANDBY -> Value.STANDBY - SERVICE_FEE -> Value.SERVICE_FEE - STORE -> Value.STORE - TRAVEL_SERVICE -> Value.TRAVEL_SERVICE - UNACCOMPANIED_TRAVEL -> Value.UNACCOMPANIED_TRAVEL - UPGRADES -> Value.UPGRADES - WIFI -> Value.WIFI - else -> Value._UNKNOWN - } + /** + * Returns the raw JSON value of [restrictedTicketIndicator]. + * + * Unlike [restrictedTicketIndicator], this method doesn't throw if the JSON + * field has an unexpected type. + */ + @JsonProperty("restricted_ticket_indicator") + @ExcludeMissing + fun _restrictedTicketIndicator(): JsonField = + restrictedTicketIndicator - /** - * Returns an enum member corresponding to this class instance's - * value. - * - * Use the [value] method instead if you're uncertain the value is - * always known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's - * value is a not a known member. - */ - fun known(): Known = - when (this) { - NONE -> Known.NONE - BUNDLED_SERVICE -> Known.BUNDLED_SERVICE - BAGGAGE_FEE -> Known.BAGGAGE_FEE - CHANGE_FEE -> Known.CHANGE_FEE - CARGO -> Known.CARGO - CARBON_OFFSET -> Known.CARBON_OFFSET - FREQUENT_FLYER -> Known.FREQUENT_FLYER - GIFT_CARD -> Known.GIFT_CARD - GROUND_TRANSPORT -> Known.GROUND_TRANSPORT - IN_FLIGHT_ENTERTAINMENT -> Known.IN_FLIGHT_ENTERTAINMENT - LOUNGE -> Known.LOUNGE - MEDICAL -> Known.MEDICAL - MEAL_BEVERAGE -> Known.MEAL_BEVERAGE - OTHER -> Known.OTHER - PASSENGER_ASSIST_FEE -> Known.PASSENGER_ASSIST_FEE - PETS -> Known.PETS - SEAT_FEES -> Known.SEAT_FEES - STANDBY -> Known.STANDBY - SERVICE_FEE -> Known.SERVICE_FEE - STORE -> Known.STORE - TRAVEL_SERVICE -> Known.TRAVEL_SERVICE - UNACCOMPANIED_TRAVEL -> Known.UNACCOMPANIED_TRAVEL - UPGRADES -> Known.UPGRADES - WIFI -> Known.WIFI - else -> - throw IncreaseInvalidDataException( - "Unknown Category: $value" - ) - } + /** + * Returns the raw JSON value of [ticketChangeIndicator]. + * + * Unlike [ticketChangeIndicator], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("ticket_change_indicator") + @ExcludeMissing + fun _ticketChangeIndicator(): JsonField = + ticketChangeIndicator - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is - * primarily for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's - * value does not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + /** + * Returns the raw JSON value of [ticketNumber]. + * + * Unlike [ticketNumber], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("ticket_number") + @ExcludeMissing + fun _ticketNumber(): JsonField = ticketNumber - private var validated: Boolean = false + /** + * Returns the raw JSON value of [travelAgencyCode]. + * + * Unlike [travelAgencyCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("travel_agency_code") + @ExcludeMissing + fun _travelAgencyCode(): JsonField = travelAgencyCode - fun validate(): Category = apply { - if (validated) { - return@apply - } + /** + * Returns the raw JSON value of [travelAgencyName]. + * + * Unlike [travelAgencyName], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("travel_agency_name") + @ExcludeMissing + fun _travelAgencyName(): JsonField = travelAgencyName - known() - validated = true - } + /** + * Returns the raw JSON value of [tripLegs]. + * + * Unlike [tripLegs], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("trip_legs") + @ExcludeMissing + fun _tripLegs(): JsonField> = tripLegs - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - /** - * Returns a score indicating how many valid values are contained in - * this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - if (value() == Value._UNKNOWN) 0 else 1 + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun toBuilder() = Builder().from(this) - return other is Category && value == other.value - } + companion object { - override fun hashCode() = value.hashCode() + /** + * Returns a mutable builder for constructing an instance of [Travel]. + * + * The following fields are required: + * ```java + * .ancillary() + * .computerizedReservationSystem() + * .creditReasonIndicator() + * .departureDate() + * .originationCityAirportCode() + * .passengerName() + * .restrictedTicketIndicator() + * .ticketChangeIndicator() + * .ticketNumber() + * .travelAgencyCode() + * .travelAgencyName() + * .tripLegs() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - override fun toString() = value.toString() - } + /** A builder for [Travel]. */ + class Builder internal constructor() { - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Service && - category == other.category && - subCategory == other.subCategory && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(category, subCategory, additionalProperties) - } - - override fun hashCode(): Int = hashCode + private var ancillary: JsonField? = null + private var computerizedReservationSystem: JsonField? = null + private var creditReasonIndicator: JsonField? = null + private var departureDate: JsonField? = null + private var originationCityAirportCode: JsonField? = null + private var passengerName: JsonField? = null + private var restrictedTicketIndicator: + JsonField? = + null + private var ticketChangeIndicator: JsonField? = null + private var ticketNumber: JsonField? = null + private var travelAgencyCode: JsonField? = null + private var travelAgencyName: JsonField? = null + private var tripLegs: JsonField>? = null + private var additionalProperties: MutableMap = + mutableMapOf() - override fun toString() = - "Service{category=$category, subCategory=$subCategory, additionalProperties=$additionalProperties}" + @JvmSynthetic + internal fun from(travel: Travel) = apply { + ancillary = travel.ancillary + computerizedReservationSystem = travel.computerizedReservationSystem + creditReasonIndicator = travel.creditReasonIndicator + departureDate = travel.departureDate + originationCityAirportCode = travel.originationCityAirportCode + passengerName = travel.passengerName + restrictedTicketIndicator = travel.restrictedTicketIndicator + ticketChangeIndicator = travel.ticketChangeIndicator + ticketNumber = travel.ticketNumber + travelAgencyCode = travel.travelAgencyCode + travelAgencyName = travel.travelAgencyName + tripLegs = travel.tripLegs.map { it.toMutableList() } + additionalProperties = travel.additionalProperties.toMutableMap() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** Ancillary purchases in addition to the airfare. */ + fun ancillary(ancillary: Ancillary?) = + ancillary(JsonField.ofNullable(ancillary)) - return other is Ancillary && - connectedTicketDocumentNumber == - other.connectedTicketDocumentNumber && - creditReasonIndicator == other.creditReasonIndicator && - passengerNameOrDescription == other.passengerNameOrDescription && - services == other.services && - ticketDocumentNumber == other.ticketDocumentNumber && - additionalProperties == other.additionalProperties - } + /** Alias for calling [Builder.ancillary] with `ancillary.orElse(null)`. */ + fun ancillary(ancillary: Optional) = + ancillary(ancillary.getOrNull()) - private val hashCode: Int by lazy { - Objects.hash( - connectedTicketDocumentNumber, - creditReasonIndicator, - passengerNameOrDescription, - services, - ticketDocumentNumber, - additionalProperties, - ) + /** + * Sets [Builder.ancillary] to an arbitrary JSON value. + * + * You should usually call [Builder.ancillary] with a well-typed [Ancillary] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun ancillary(ancillary: JsonField) = apply { + this.ancillary = ancillary } - override fun hashCode(): Int = hashCode - - override fun toString() = - "Ancillary{connectedTicketDocumentNumber=$connectedTicketDocumentNumber, creditReasonIndicator=$creditReasonIndicator, passengerNameOrDescription=$passengerNameOrDescription, services=$services, ticketDocumentNumber=$ticketDocumentNumber, additionalProperties=$additionalProperties}" - } + /** + * Indicates the computerized reservation system used to book the ticket. + */ + fun computerizedReservationSystem(computerizedReservationSystem: String?) = + computerizedReservationSystem( + JsonField.ofNullable(computerizedReservationSystem) + ) - /** Indicates the reason for a credit to the cardholder. */ - class CreditReasonIndicator - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** + * Alias for calling [Builder.computerizedReservationSystem] with + * `computerizedReservationSystem.orElse(null)`. + */ + fun computerizedReservationSystem( + computerizedReservationSystem: Optional + ) = computerizedReservationSystem(computerizedReservationSystem.getOrNull()) /** - * Returns this class instance's raw value. + * Sets [Builder.computerizedReservationSystem] to an arbitrary JSON value. * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. + * You should usually call [Builder.computerizedReservationSystem] with a + * well-typed [String] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - /** No credit */ - @JvmField val NO_CREDIT = of("no_credit") + fun computerizedReservationSystem( + computerizedReservationSystem: JsonField + ) = apply { + this.computerizedReservationSystem = computerizedReservationSystem + } - /** Passenger transport ancillary purchase cancellation */ - @JvmField - val PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = - of("passenger_transport_ancillary_purchase_cancellation") + /** Indicates the reason for a credit to the cardholder. */ + fun creditReasonIndicator(creditReasonIndicator: CreditReasonIndicator?) = + creditReasonIndicator(JsonField.ofNullable(creditReasonIndicator)) - /** - * Airline ticket and passenger transport ancillary purchase - * cancellation - */ - @JvmField - val AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = - of( - "airline_ticket_and_passenger_transport_ancillary_purchase_cancellation" - ) + /** + * Alias for calling [Builder.creditReasonIndicator] with + * `creditReasonIndicator.orElse(null)`. + */ + fun creditReasonIndicator( + creditReasonIndicator: Optional + ) = creditReasonIndicator(creditReasonIndicator.getOrNull()) - /** Airline ticket cancellation */ - @JvmField - val AIRLINE_TICKET_CANCELLATION = of("airline_ticket_cancellation") + /** + * Sets [Builder.creditReasonIndicator] to an arbitrary JSON value. + * + * You should usually call [Builder.creditReasonIndicator] with a well-typed + * [CreditReasonIndicator] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ + fun creditReasonIndicator( + creditReasonIndicator: JsonField + ) = apply { this.creditReasonIndicator = creditReasonIndicator } - /** Other */ - @JvmField val OTHER = of("other") + /** Date of departure. */ + fun departureDate(departureDate: LocalDate?) = + departureDate(JsonField.ofNullable(departureDate)) - /** Partial refund of airline ticket */ - @JvmField - val PARTIAL_REFUND_OF_AIRLINE_TICKET = - of("partial_refund_of_airline_ticket") + /** + * Alias for calling [Builder.departureDate] with + * `departureDate.orElse(null)`. + */ + fun departureDate(departureDate: Optional) = + departureDate(departureDate.getOrNull()) - @JvmStatic - fun of(value: String) = CreditReasonIndicator(JsonField.of(value)) + /** + * Sets [Builder.departureDate] to an arbitrary JSON value. + * + * You should usually call [Builder.departureDate] with a well-typed + * [LocalDate] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun departureDate(departureDate: JsonField) = apply { + this.departureDate = departureDate } - /** An enum containing [CreditReasonIndicator]'s known values. */ - enum class Known { - /** No credit */ - NO_CREDIT, - /** Passenger transport ancillary purchase cancellation */ - PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, - /** - * Airline ticket and passenger transport ancillary purchase - * cancellation - */ - AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, - /** Airline ticket cancellation */ - AIRLINE_TICKET_CANCELLATION, - /** Other */ - OTHER, - /** Partial refund of airline ticket */ - PARTIAL_REFUND_OF_AIRLINE_TICKET, - } + /** Code for the originating city or airport. */ + fun originationCityAirportCode(originationCityAirportCode: String?) = + originationCityAirportCode( + JsonField.ofNullable(originationCityAirportCode) + ) /** - * An enum containing [CreditReasonIndicator]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [CreditReasonIndicator] can contain an unknown value in a - * couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. + * Alias for calling [Builder.originationCityAirportCode] with + * `originationCityAirportCode.orElse(null)`. */ - enum class Value { - /** No credit */ - NO_CREDIT, - /** Passenger transport ancillary purchase cancellation */ - PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, - /** - * Airline ticket and passenger transport ancillary purchase - * cancellation - */ - AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, - /** Airline ticket cancellation */ - AIRLINE_TICKET_CANCELLATION, - /** Other */ - OTHER, - /** Partial refund of airline ticket */ - PARTIAL_REFUND_OF_AIRLINE_TICKET, - /** - * An enum member indicating that [CreditReasonIndicator] was - * instantiated with an unknown value. - */ - _UNKNOWN, - } + fun originationCityAirportCode( + originationCityAirportCode: Optional + ) = originationCityAirportCode(originationCityAirportCode.getOrNull()) /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * Sets [Builder.originationCityAirportCode] to an arbitrary JSON value. * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. + * You should usually call [Builder.originationCityAirportCode] with a + * well-typed [String] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. */ - fun value(): Value = - when (this) { - NO_CREDIT -> Value.NO_CREDIT - PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> - Value.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION - AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> - Value - .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION - AIRLINE_TICKET_CANCELLATION -> Value.AIRLINE_TICKET_CANCELLATION - OTHER -> Value.OTHER - PARTIAL_REFUND_OF_AIRLINE_TICKET -> - Value.PARTIAL_REFUND_OF_AIRLINE_TICKET - else -> Value._UNKNOWN - } + fun originationCityAirportCode( + originationCityAirportCode: JsonField + ) = apply { this.originationCityAirportCode = originationCityAirportCode } + + /** Name of the passenger. */ + fun passengerName(passengerName: String?) = + passengerName(JsonField.ofNullable(passengerName)) /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. + * Alias for calling [Builder.passengerName] with + * `passengerName.orElse(null)`. */ - fun known(): Known = - when (this) { - NO_CREDIT -> Known.NO_CREDIT - PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> - Known.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION - AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> - Known - .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION - AIRLINE_TICKET_CANCELLATION -> Known.AIRLINE_TICKET_CANCELLATION - OTHER -> Known.OTHER - PARTIAL_REFUND_OF_AIRLINE_TICKET -> - Known.PARTIAL_REFUND_OF_AIRLINE_TICKET - else -> - throw IncreaseInvalidDataException( - "Unknown CreditReasonIndicator: $value" - ) - } + fun passengerName(passengerName: Optional) = + passengerName(passengerName.getOrNull()) /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. + * Sets [Builder.passengerName] to an arbitrary JSON value. * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. + * You should usually call [Builder.passengerName] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): CreditReasonIndicator = apply { - if (validated) { - return@apply - } - - known() - validated = true + fun passengerName(passengerName: JsonField) = apply { + this.passengerName = passengerName } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** Indicates whether this ticket is non-refundable. */ + fun restrictedTicketIndicator( + restrictedTicketIndicator: RestrictedTicketIndicator? + ) = + restrictedTicketIndicator( + JsonField.ofNullable(restrictedTicketIndicator) + ) /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. + * Alias for calling [Builder.restrictedTicketIndicator] with + * `restrictedTicketIndicator.orElse(null)`. */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CreditReasonIndicator && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** Indicates whether this ticket is non-refundable. */ - class RestrictedTicketIndicator - @JsonCreator - private constructor(private val value: JsonField) : Enum { + fun restrictedTicketIndicator( + restrictedTicketIndicator: Optional + ) = restrictedTicketIndicator(restrictedTicketIndicator.getOrNull()) /** - * Returns this class instance's raw value. + * Sets [Builder.restrictedTicketIndicator] to an arbitrary JSON value. * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. + * You should usually call [Builder.restrictedTicketIndicator] with a + * well-typed [RestrictedTicketIndicator] value instead. This method is + * primarily for setting the field to an undocumented or not yet supported + * value. */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + fun restrictedTicketIndicator( + restrictedTicketIndicator: JsonField + ) = apply { this.restrictedTicketIndicator = restrictedTicketIndicator } - companion object { + /** Indicates why a ticket was changed. */ + fun ticketChangeIndicator(ticketChangeIndicator: TicketChangeIndicator?) = + ticketChangeIndicator(JsonField.ofNullable(ticketChangeIndicator)) - /** No restrictions */ - @JvmField val NO_RESTRICTIONS = of("no_restrictions") + /** + * Alias for calling [Builder.ticketChangeIndicator] with + * `ticketChangeIndicator.orElse(null)`. + */ + fun ticketChangeIndicator( + ticketChangeIndicator: Optional + ) = ticketChangeIndicator(ticketChangeIndicator.getOrNull()) - /** Restricted non-refundable ticket */ - @JvmField - val RESTRICTED_NON_REFUNDABLE_TICKET = - of("restricted_non_refundable_ticket") + /** + * Sets [Builder.ticketChangeIndicator] to an arbitrary JSON value. + * + * You should usually call [Builder.ticketChangeIndicator] with a well-typed + * [TicketChangeIndicator] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ + fun ticketChangeIndicator( + ticketChangeIndicator: JsonField + ) = apply { this.ticketChangeIndicator = ticketChangeIndicator } - @JvmStatic - fun of(value: String) = RestrictedTicketIndicator(JsonField.of(value)) - } + /** Ticket number. */ + fun ticketNumber(ticketNumber: String?) = + ticketNumber(JsonField.ofNullable(ticketNumber)) - /** An enum containing [RestrictedTicketIndicator]'s known values. */ - enum class Known { - /** No restrictions */ - NO_RESTRICTIONS, - /** Restricted non-refundable ticket */ - RESTRICTED_NON_REFUNDABLE_TICKET, - } + /** + * Alias for calling [Builder.ticketNumber] with + * `ticketNumber.orElse(null)`. + */ + fun ticketNumber(ticketNumber: Optional) = + ticketNumber(ticketNumber.getOrNull()) /** - * An enum containing [RestrictedTicketIndicator]'s known values, as well as - * an [_UNKNOWN] member. + * Sets [Builder.ticketNumber] to an arbitrary JSON value. * - * An instance of [RestrictedTicketIndicator] can contain an unknown value - * in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. + * You should usually call [Builder.ticketNumber] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ - enum class Value { - /** No restrictions */ - NO_RESTRICTIONS, - /** Restricted non-refundable ticket */ - RESTRICTED_NON_REFUNDABLE_TICKET, - /** - * An enum member indicating that [RestrictedTicketIndicator] was - * instantiated with an unknown value. - */ - _UNKNOWN, + fun ticketNumber(ticketNumber: JsonField) = apply { + this.ticketNumber = ticketNumber } /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. + * Code for the travel agency if the ticket was issued by a travel agency. */ - fun value(): Value = - when (this) { - NO_RESTRICTIONS -> Value.NO_RESTRICTIONS - RESTRICTED_NON_REFUNDABLE_TICKET -> - Value.RESTRICTED_NON_REFUNDABLE_TICKET - else -> Value._UNKNOWN - } + fun travelAgencyCode(travelAgencyCode: String?) = + travelAgencyCode(JsonField.ofNullable(travelAgencyCode)) /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. + * Alias for calling [Builder.travelAgencyCode] with + * `travelAgencyCode.orElse(null)`. */ - fun known(): Known = - when (this) { - NO_RESTRICTIONS -> Known.NO_RESTRICTIONS - RESTRICTED_NON_REFUNDABLE_TICKET -> - Known.RESTRICTED_NON_REFUNDABLE_TICKET - else -> - throw IncreaseInvalidDataException( - "Unknown RestrictedTicketIndicator: $value" - ) - } + fun travelAgencyCode(travelAgencyCode: Optional) = + travelAgencyCode(travelAgencyCode.getOrNull()) /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. + * Sets [Builder.travelAgencyCode] to an arbitrary JSON value. * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. + * You should usually call [Builder.travelAgencyCode] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): RestrictedTicketIndicator = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + fun travelAgencyCode(travelAgencyCode: JsonField) = apply { + this.travelAgencyCode = travelAgencyCode + } /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. + * Name of the travel agency if the ticket was issued by a travel agency. */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is RestrictedTicketIndicator && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** Indicates why a ticket was changed. */ - class TicketChangeIndicator - @JsonCreator - private constructor(private val value: JsonField) : Enum { + fun travelAgencyName(travelAgencyName: String?) = + travelAgencyName(JsonField.ofNullable(travelAgencyName)) /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. + * Alias for calling [Builder.travelAgencyName] with + * `travelAgencyName.orElse(null)`. */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - /** None */ - @JvmField val NONE = of("none") - - /** Change to existing ticket */ - @JvmField - val CHANGE_TO_EXISTING_TICKET = of("change_to_existing_ticket") - - /** New ticket */ - @JvmField val NEW_TICKET = of("new_ticket") - - @JvmStatic - fun of(value: String) = TicketChangeIndicator(JsonField.of(value)) - } - - /** An enum containing [TicketChangeIndicator]'s known values. */ - enum class Known { - /** None */ - NONE, - /** Change to existing ticket */ - CHANGE_TO_EXISTING_TICKET, - /** New ticket */ - NEW_TICKET, - } + fun travelAgencyName(travelAgencyName: Optional) = + travelAgencyName(travelAgencyName.getOrNull()) /** - * An enum containing [TicketChangeIndicator]'s known values, as well as an - * [_UNKNOWN] member. + * Sets [Builder.travelAgencyName] to an arbitrary JSON value. * - * An instance of [TicketChangeIndicator] can contain an unknown value in a - * couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. + * You should usually call [Builder.travelAgencyName] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. */ - enum class Value { - /** None */ - NONE, - /** Change to existing ticket */ - CHANGE_TO_EXISTING_TICKET, - /** New ticket */ - NEW_TICKET, - /** - * An enum member indicating that [TicketChangeIndicator] was - * instantiated with an unknown value. - */ - _UNKNOWN, + fun travelAgencyName(travelAgencyName: JsonField) = apply { + this.travelAgencyName = travelAgencyName } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - NONE -> Value.NONE - CHANGE_TO_EXISTING_TICKET -> Value.CHANGE_TO_EXISTING_TICKET - NEW_TICKET -> Value.NEW_TICKET - else -> Value._UNKNOWN - } + /** Fields specific to each leg of the journey. */ + fun tripLegs(tripLegs: List?) = + tripLegs(JsonField.ofNullable(tripLegs)) + + /** Alias for calling [Builder.tripLegs] with `tripLegs.orElse(null)`. */ + fun tripLegs(tripLegs: Optional>) = + tripLegs(tripLegs.getOrNull()) /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. + * Sets [Builder.tripLegs] to an arbitrary JSON value. * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. + * You should usually call [Builder.tripLegs] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - fun known(): Known = - when (this) { - NONE -> Known.NONE - CHANGE_TO_EXISTING_TICKET -> Known.CHANGE_TO_EXISTING_TICKET - NEW_TICKET -> Known.NEW_TICKET - else -> - throw IncreaseInvalidDataException( - "Unknown TicketChangeIndicator: $value" - ) - } + fun tripLegs(tripLegs: JsonField>) = apply { + this.tripLegs = tripLegs.map { it.toMutableList() } + } /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. + * Adds a single [TripLeg] to [tripLegs]. * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. + * @throws IllegalStateException if the field was previously set to a + * non-list. */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") + fun addTripLeg(tripLeg: TripLeg) = apply { + tripLegs = + (tripLegs ?: JsonField.of(mutableListOf())).also { + checkKnown("tripLegs", it).add(tripLeg) + } + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) } - private var validated: Boolean = false + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun validate(): TicketChangeIndicator = apply { - if (validated) { - return@apply - } + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } - known() - validated = true + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } /** - * Returns a score indicating how many valid values are contained in this - * object recursively. + * Returns an immutable instance of [Travel]. * - * Used for best match union deserialization. + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .ancillary() + * .computerizedReservationSystem() + * .creditReasonIndicator() + * .departureDate() + * .originationCityAirportCode() + * .passengerName() + * .restrictedTicketIndicator() + * .ticketChangeIndicator() + * .ticketNumber() + * .travelAgencyCode() + * .travelAgencyName() + * .tripLegs() + * ``` + * + * @throws IllegalStateException if any required field is unset. */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + fun build(): Travel = + Travel( + checkRequired("ancillary", ancillary), + checkRequired( + "computerizedReservationSystem", + computerizedReservationSystem, + ), + checkRequired("creditReasonIndicator", creditReasonIndicator), + checkRequired("departureDate", departureDate), + checkRequired( + "originationCityAirportCode", + originationCityAirportCode, + ), + checkRequired("passengerName", passengerName), + checkRequired( + "restrictedTicketIndicator", + restrictedTicketIndicator, + ), + checkRequired("ticketChangeIndicator", ticketChangeIndicator), + checkRequired("ticketNumber", ticketNumber), + checkRequired("travelAgencyCode", travelAgencyCode), + checkRequired("travelAgencyName", travelAgencyName), + checkRequired("tripLegs", tripLegs).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + private var validated: Boolean = false - return other is TicketChangeIndicator && value == other.value + fun validate(): Travel = apply { + if (validated) { + return@apply } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() + ancillary().ifPresent { it.validate() } + computerizedReservationSystem() + creditReasonIndicator().ifPresent { it.validate() } + departureDate() + originationCityAirportCode() + passengerName() + restrictedTicketIndicator().ifPresent { it.validate() } + ticketChangeIndicator().ifPresent { it.validate() } + ticketNumber() + travelAgencyCode() + travelAgencyName() + tripLegs().ifPresent { it.forEach { it.validate() } } + validated = true } - class TripLeg + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (ancillary.asKnown().getOrNull()?.validity() ?: 0) + + (if (computerizedReservationSystem.asKnown().isPresent) 1 else 0) + + (creditReasonIndicator.asKnown().getOrNull()?.validity() ?: 0) + + (if (departureDate.asKnown().isPresent) 1 else 0) + + (if (originationCityAirportCode.asKnown().isPresent) 1 else 0) + + (if (passengerName.asKnown().isPresent) 1 else 0) + + (restrictedTicketIndicator.asKnown().getOrNull()?.validity() ?: 0) + + (ticketChangeIndicator.asKnown().getOrNull()?.validity() ?: 0) + + (if (ticketNumber.asKnown().isPresent) 1 else 0) + + (if (travelAgencyCode.asKnown().isPresent) 1 else 0) + + (if (travelAgencyName.asKnown().isPresent) 1 else 0) + + (tripLegs.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + /** Ancillary purchases in addition to the airfare. */ + class Ancillary @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val carrierCode: JsonField, - private val destinationCityAirportCode: JsonField, - private val fareBasisCode: JsonField, - private val flightNumber: JsonField, - private val serviceClass: JsonField, - private val stopOverCode: JsonField, + private val connectedTicketDocumentNumber: JsonField, + private val creditReasonIndicator: JsonField, + private val passengerNameOrDescription: JsonField, + private val services: JsonField>, + private val ticketDocumentNumber: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("carrier_code") - @ExcludeMissing - carrierCode: JsonField = JsonMissing.of(), - @JsonProperty("destination_city_airport_code") + @JsonProperty("connected_ticket_document_number") @ExcludeMissing - destinationCityAirportCode: JsonField = JsonMissing.of(), - @JsonProperty("fare_basis_code") + connectedTicketDocumentNumber: JsonField = JsonMissing.of(), + @JsonProperty("credit_reason_indicator") @ExcludeMissing - fareBasisCode: JsonField = JsonMissing.of(), - @JsonProperty("flight_number") + creditReasonIndicator: JsonField = + JsonMissing.of(), + @JsonProperty("passenger_name_or_description") @ExcludeMissing - flightNumber: JsonField = JsonMissing.of(), - @JsonProperty("service_class") + passengerNameOrDescription: JsonField = JsonMissing.of(), + @JsonProperty("services") @ExcludeMissing - serviceClass: JsonField = JsonMissing.of(), - @JsonProperty("stop_over_code") + services: JsonField> = JsonMissing.of(), + @JsonProperty("ticket_document_number") @ExcludeMissing - stopOverCode: JsonField = JsonMissing.of(), + ticketDocumentNumber: JsonField = JsonMissing.of(), ) : this( - carrierCode, - destinationCityAirportCode, - fareBasisCode, - flightNumber, - serviceClass, - stopOverCode, + connectedTicketDocumentNumber, + creditReasonIndicator, + passengerNameOrDescription, + services, + ticketDocumentNumber, mutableMapOf(), ) /** - * Carrier code (e.g., United Airlines, Jet Blue, etc.). - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). - */ - fun carrierCode(): Optional = - carrierCode.getOptional("carrier_code") - - /** - * Code for the destination city or airport. + * If this purchase has a connection or relationship to another purchase, + * such as a baggage fee for a passenger transport ticket, this field should + * contain the ticket document number for the other purchase. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun destinationCityAirportCode(): Optional = - destinationCityAirportCode.getOptional("destination_city_airport_code") + fun connectedTicketDocumentNumber(): Optional = + connectedTicketDocumentNumber.getOptional( + "connected_ticket_document_number" + ) /** - * Fare basis code. + * Indicates the reason for a credit to the cardholder. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun fareBasisCode(): Optional = - fareBasisCode.getOptional("fare_basis_code") + fun creditReasonIndicator(): Optional = + creditReasonIndicator.getOptional("credit_reason_indicator") /** - * Flight number. + * Name of the passenger or description of the ancillary purchase. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun flightNumber(): Optional = - flightNumber.getOptional("flight_number") + fun passengerNameOrDescription(): Optional = + passengerNameOrDescription.getOptional("passenger_name_or_description") /** - * Service class (e.g., first class, business class, etc.). + * Additional travel charges, such as baggage fees. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). + * type or is unexpectedly missing or null (e.g. if the server responded + * with an unexpected value). */ - fun serviceClass(): Optional = - serviceClass.getOptional("service_class") + fun services(): List = services.getRequired("services") /** - * Indicates whether a stopover is allowed on this ticket. + * Ticket document number. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). */ - fun stopOverCode(): Optional = - stopOverCode.getOptional("stop_over_code") - - /** - * Returns the raw JSON value of [carrierCode]. - * - * Unlike [carrierCode], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("carrier_code") - @ExcludeMissing - fun _carrierCode(): JsonField = carrierCode + fun ticketDocumentNumber(): Optional = + ticketDocumentNumber.getOptional("ticket_document_number") /** - * Returns the raw JSON value of [destinationCityAirportCode]. + * Returns the raw JSON value of [connectedTicketDocumentNumber]. * - * Unlike [destinationCityAirportCode], this method doesn't throw if the + * Unlike [connectedTicketDocumentNumber], this method doesn't throw if the * JSON field has an unexpected type. */ - @JsonProperty("destination_city_airport_code") + @JsonProperty("connected_ticket_document_number") @ExcludeMissing - fun _destinationCityAirportCode(): JsonField = - destinationCityAirportCode + fun _connectedTicketDocumentNumber(): JsonField = + connectedTicketDocumentNumber /** - * Returns the raw JSON value of [fareBasisCode]. + * Returns the raw JSON value of [creditReasonIndicator]. * - * Unlike [fareBasisCode], this method doesn't throw if the JSON field has - * an unexpected type. + * Unlike [creditReasonIndicator], this method doesn't throw if the JSON + * field has an unexpected type. */ - @JsonProperty("fare_basis_code") + @JsonProperty("credit_reason_indicator") @ExcludeMissing - fun _fareBasisCode(): JsonField = fareBasisCode + fun _creditReasonIndicator(): JsonField = + creditReasonIndicator /** - * Returns the raw JSON value of [flightNumber]. + * Returns the raw JSON value of [passengerNameOrDescription]. * - * Unlike [flightNumber], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [passengerNameOrDescription], this method doesn't throw if the + * JSON field has an unexpected type. */ - @JsonProperty("flight_number") + @JsonProperty("passenger_name_or_description") @ExcludeMissing - fun _flightNumber(): JsonField = flightNumber + fun _passengerNameOrDescription(): JsonField = + passengerNameOrDescription /** - * Returns the raw JSON value of [serviceClass]. + * Returns the raw JSON value of [services]. * - * Unlike [serviceClass], this method doesn't throw if the JSON field has an + * Unlike [services], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("service_class") + @JsonProperty("services") @ExcludeMissing - fun _serviceClass(): JsonField = serviceClass + fun _services(): JsonField> = services /** - * Returns the raw JSON value of [stopOverCode]. + * Returns the raw JSON value of [ticketDocumentNumber]. * - * Unlike [stopOverCode], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [ticketDocumentNumber], this method doesn't throw if the JSON + * field has an unexpected type. */ - @JsonProperty("stop_over_code") + @JsonProperty("ticket_document_number") @ExcludeMissing - fun _stopOverCode(): JsonField = stopOverCode + fun _ticketDocumentNumber(): JsonField = ticketDocumentNumber @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -27117,180 +26776,183 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [TripLeg]. + * Returns a mutable builder for constructing an instance of + * [Ancillary]. * * The following fields are required: * ```java - * .carrierCode() - * .destinationCityAirportCode() - * .fareBasisCode() - * .flightNumber() - * .serviceClass() - * .stopOverCode() + * .connectedTicketDocumentNumber() + * .creditReasonIndicator() + * .passengerNameOrDescription() + * .services() + * .ticketDocumentNumber() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [TripLeg]. */ + /** A builder for [Ancillary]. */ class Builder internal constructor() { - private var carrierCode: JsonField? = null - private var destinationCityAirportCode: JsonField? = null - private var fareBasisCode: JsonField? = null - private var flightNumber: JsonField? = null - private var serviceClass: JsonField? = null - private var stopOverCode: JsonField? = null + private var connectedTicketDocumentNumber: JsonField? = null + private var creditReasonIndicator: JsonField? = + null + private var passengerNameOrDescription: JsonField? = null + private var services: JsonField>? = null + private var ticketDocumentNumber: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(tripLeg: TripLeg) = apply { - carrierCode = tripLeg.carrierCode - destinationCityAirportCode = tripLeg.destinationCityAirportCode - fareBasisCode = tripLeg.fareBasisCode - flightNumber = tripLeg.flightNumber - serviceClass = tripLeg.serviceClass - stopOverCode = tripLeg.stopOverCode - additionalProperties = tripLeg.additionalProperties.toMutableMap() + internal fun from(ancillary: Ancillary) = apply { + connectedTicketDocumentNumber = + ancillary.connectedTicketDocumentNumber + creditReasonIndicator = ancillary.creditReasonIndicator + passengerNameOrDescription = ancillary.passengerNameOrDescription + services = ancillary.services.map { it.toMutableList() } + ticketDocumentNumber = ancillary.ticketDocumentNumber + additionalProperties = ancillary.additionalProperties.toMutableMap() } - /** Carrier code (e.g., United Airlines, Jet Blue, etc.). */ - fun carrierCode(carrierCode: String?) = - carrierCode(JsonField.ofNullable(carrierCode)) - /** - * Alias for calling [Builder.carrierCode] with - * `carrierCode.orElse(null)`. - */ - fun carrierCode(carrierCode: Optional) = - carrierCode(carrierCode.getOrNull()) - - /** - * Sets [Builder.carrierCode] to an arbitrary JSON value. - * - * You should usually call [Builder.carrierCode] with a well-typed - * [String] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * If this purchase has a connection or relationship to another + * purchase, such as a baggage fee for a passenger transport ticket, + * this field should contain the ticket document number for the other + * purchase. */ - fun carrierCode(carrierCode: JsonField) = apply { - this.carrierCode = carrierCode - } - - /** Code for the destination city or airport. */ - fun destinationCityAirportCode(destinationCityAirportCode: String?) = - destinationCityAirportCode( - JsonField.ofNullable(destinationCityAirportCode) + fun connectedTicketDocumentNumber( + connectedTicketDocumentNumber: String? + ) = + connectedTicketDocumentNumber( + JsonField.ofNullable(connectedTicketDocumentNumber) ) /** - * Alias for calling [Builder.destinationCityAirportCode] with - * `destinationCityAirportCode.orElse(null)`. + * Alias for calling [Builder.connectedTicketDocumentNumber] with + * `connectedTicketDocumentNumber.orElse(null)`. */ - fun destinationCityAirportCode( - destinationCityAirportCode: Optional - ) = destinationCityAirportCode(destinationCityAirportCode.getOrNull()) + fun connectedTicketDocumentNumber( + connectedTicketDocumentNumber: Optional + ) = + connectedTicketDocumentNumber( + connectedTicketDocumentNumber.getOrNull() + ) /** - * Sets [Builder.destinationCityAirportCode] to an arbitrary JSON value. + * Sets [Builder.connectedTicketDocumentNumber] to an arbitrary JSON + * value. * - * You should usually call [Builder.destinationCityAirportCode] with a - * well-typed [String] value instead. This method is primarily for + * You should usually call [Builder.connectedTicketDocumentNumber] with + * a well-typed [String] value instead. This method is primarily for * setting the field to an undocumented or not yet supported value. */ - fun destinationCityAirportCode( - destinationCityAirportCode: JsonField + fun connectedTicketDocumentNumber( + connectedTicketDocumentNumber: JsonField ) = apply { - this.destinationCityAirportCode = destinationCityAirportCode + this.connectedTicketDocumentNumber = connectedTicketDocumentNumber } - /** Fare basis code. */ - fun fareBasisCode(fareBasisCode: String?) = - fareBasisCode(JsonField.ofNullable(fareBasisCode)) + /** Indicates the reason for a credit to the cardholder. */ + fun creditReasonIndicator( + creditReasonIndicator: CreditReasonIndicator? + ) = creditReasonIndicator(JsonField.ofNullable(creditReasonIndicator)) /** - * Alias for calling [Builder.fareBasisCode] with - * `fareBasisCode.orElse(null)`. + * Alias for calling [Builder.creditReasonIndicator] with + * `creditReasonIndicator.orElse(null)`. */ - fun fareBasisCode(fareBasisCode: Optional) = - fareBasisCode(fareBasisCode.getOrNull()) + fun creditReasonIndicator( + creditReasonIndicator: Optional + ) = creditReasonIndicator(creditReasonIndicator.getOrNull()) /** - * Sets [Builder.fareBasisCode] to an arbitrary JSON value. + * Sets [Builder.creditReasonIndicator] to an arbitrary JSON value. * - * You should usually call [Builder.fareBasisCode] with a well-typed - * [String] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * You should usually call [Builder.creditReasonIndicator] with a + * well-typed [CreditReasonIndicator] value instead. This method is + * primarily for setting the field to an undocumented or not yet + * supported value. */ - fun fareBasisCode(fareBasisCode: JsonField) = apply { - this.fareBasisCode = fareBasisCode - } + fun creditReasonIndicator( + creditReasonIndicator: JsonField + ) = apply { this.creditReasonIndicator = creditReasonIndicator } - /** Flight number. */ - fun flightNumber(flightNumber: String?) = - flightNumber(JsonField.ofNullable(flightNumber)) + /** Name of the passenger or description of the ancillary purchase. */ + fun passengerNameOrDescription(passengerNameOrDescription: String?) = + passengerNameOrDescription( + JsonField.ofNullable(passengerNameOrDescription) + ) /** - * Alias for calling [Builder.flightNumber] with - * `flightNumber.orElse(null)`. + * Alias for calling [Builder.passengerNameOrDescription] with + * `passengerNameOrDescription.orElse(null)`. */ - fun flightNumber(flightNumber: Optional) = - flightNumber(flightNumber.getOrNull()) + fun passengerNameOrDescription( + passengerNameOrDescription: Optional + ) = passengerNameOrDescription(passengerNameOrDescription.getOrNull()) /** - * Sets [Builder.flightNumber] to an arbitrary JSON value. + * Sets [Builder.passengerNameOrDescription] to an arbitrary JSON value. * - * You should usually call [Builder.flightNumber] with a well-typed - * [String] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * You should usually call [Builder.passengerNameOrDescription] with a + * well-typed [String] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. */ - fun flightNumber(flightNumber: JsonField) = apply { - this.flightNumber = flightNumber + fun passengerNameOrDescription( + passengerNameOrDescription: JsonField + ) = apply { + this.passengerNameOrDescription = passengerNameOrDescription } - /** Service class (e.g., first class, business class, etc.). */ - fun serviceClass(serviceClass: String?) = - serviceClass(JsonField.ofNullable(serviceClass)) + /** Additional travel charges, such as baggage fees. */ + fun services(services: List) = services(JsonField.of(services)) /** - * Alias for calling [Builder.serviceClass] with - * `serviceClass.orElse(null)`. + * Sets [Builder.services] to an arbitrary JSON value. + * + * You should usually call [Builder.services] with a well-typed + * `List` value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. */ - fun serviceClass(serviceClass: Optional) = - serviceClass(serviceClass.getOrNull()) + fun services(services: JsonField>) = apply { + this.services = services.map { it.toMutableList() } + } /** - * Sets [Builder.serviceClass] to an arbitrary JSON value. + * Adds a single [Service] to [services]. * - * You should usually call [Builder.serviceClass] with a well-typed - * [String] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * @throws IllegalStateException if the field was previously set to a + * non-list. */ - fun serviceClass(serviceClass: JsonField) = apply { - this.serviceClass = serviceClass + fun addService(service: Service) = apply { + services = + (services ?: JsonField.of(mutableListOf())).also { + checkKnown("services", it).add(service) + } } - /** Indicates whether a stopover is allowed on this ticket. */ - fun stopOverCode(stopOverCode: StopOverCode?) = - stopOverCode(JsonField.ofNullable(stopOverCode)) + /** Ticket document number. */ + fun ticketDocumentNumber(ticketDocumentNumber: String?) = + ticketDocumentNumber(JsonField.ofNullable(ticketDocumentNumber)) /** - * Alias for calling [Builder.stopOverCode] with - * `stopOverCode.orElse(null)`. + * Alias for calling [Builder.ticketDocumentNumber] with + * `ticketDocumentNumber.orElse(null)`. */ - fun stopOverCode(stopOverCode: Optional) = - stopOverCode(stopOverCode.getOrNull()) + fun ticketDocumentNumber(ticketDocumentNumber: Optional) = + ticketDocumentNumber(ticketDocumentNumber.getOrNull()) /** - * Sets [Builder.stopOverCode] to an arbitrary JSON value. + * Sets [Builder.ticketDocumentNumber] to an arbitrary JSON value. * - * You should usually call [Builder.stopOverCode] with a well-typed - * [StopOverCode] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. + * You should usually call [Builder.ticketDocumentNumber] with a + * well-typed [String] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. */ - fun stopOverCode(stopOverCode: JsonField) = apply { - this.stopOverCode = stopOverCode - } + fun ticketDocumentNumber(ticketDocumentNumber: JsonField) = + apply { + this.ticketDocumentNumber = ticketDocumentNumber + } fun additionalProperties(additionalProperties: Map) = apply { @@ -27315,51 +26977,51 @@ private constructor( } /** - * Returns an immutable instance of [TripLeg]. + * Returns an immutable instance of [Ancillary]. * * Further updates to this [Builder] will not mutate the returned * instance. * * The following fields are required: * ```java - * .carrierCode() - * .destinationCityAirportCode() - * .fareBasisCode() - * .flightNumber() - * .serviceClass() - * .stopOverCode() + * .connectedTicketDocumentNumber() + * .creditReasonIndicator() + * .passengerNameOrDescription() + * .services() + * .ticketDocumentNumber() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): TripLeg = - TripLeg( - checkRequired("carrierCode", carrierCode), + fun build(): Ancillary = + Ancillary( checkRequired( - "destinationCityAirportCode", - destinationCityAirportCode, + "connectedTicketDocumentNumber", + connectedTicketDocumentNumber, ), - checkRequired("fareBasisCode", fareBasisCode), - checkRequired("flightNumber", flightNumber), - checkRequired("serviceClass", serviceClass), - checkRequired("stopOverCode", stopOverCode), + checkRequired("creditReasonIndicator", creditReasonIndicator), + checkRequired( + "passengerNameOrDescription", + passengerNameOrDescription, + ), + checkRequired("services", services).map { it.toImmutable() }, + checkRequired("ticketDocumentNumber", ticketDocumentNumber), additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): TripLeg = apply { + fun validate(): Ancillary = apply { if (validated) { return@apply } - carrierCode() - destinationCityAirportCode() - fareBasisCode() - flightNumber() - serviceClass() - stopOverCode().ifPresent { it.validate() } + connectedTicketDocumentNumber() + creditReasonIndicator().ifPresent { it.validate() } + passengerNameOrDescription() + services().forEach { it.validate() } + ticketDocumentNumber() validated = true } @@ -27379,15 +27041,15 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (carrierCode.asKnown().isPresent) 1 else 0) + - (if (destinationCityAirportCode.asKnown().isPresent) 1 else 0) + - (if (fareBasisCode.asKnown().isPresent) 1 else 0) + - (if (flightNumber.asKnown().isPresent) 1 else 0) + - (if (serviceClass.asKnown().isPresent) 1 else 0) + - (stopOverCode.asKnown().getOrNull()?.validity() ?: 0) + (if (connectedTicketDocumentNumber.asKnown().isPresent) 1 else 0) + + (creditReasonIndicator.asKnown().getOrNull()?.validity() ?: 0) + + (if (passengerNameOrDescription.asKnown().isPresent) 1 else 0) + + (services.asKnown().getOrNull()?.sumOf { it.validity().toInt() } + ?: 0) + + (if (ticketDocumentNumber.asKnown().isPresent) 1 else 0) - /** Indicates whether a stopover is allowed on this ticket. */ - class StopOverCode + /** Indicates the reason for a credit to the cardholder. */ + class CreditReasonIndicator @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -27404,49 +27066,72 @@ private constructor( companion object { - /** None */ - @JvmField val NONE = of("none") + /** No credit */ + @JvmField val NO_CREDIT = of("no_credit") - /** Stop over allowed */ - @JvmField val STOP_OVER_ALLOWED = of("stop_over_allowed") + /** Passenger transport ancillary purchase cancellation */ + @JvmField + val PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = + of("passenger_transport_ancillary_purchase_cancellation") - /** Stop over not allowed */ - @JvmField val STOP_OVER_NOT_ALLOWED = of("stop_over_not_allowed") + /** + * Airline ticket and passenger transport ancillary purchase + * cancellation + */ + @JvmField + val AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = + of( + "airline_ticket_and_passenger_transport_ancillary_purchase_cancellation" + ) - @JvmStatic fun of(value: String) = StopOverCode(JsonField.of(value)) + /** Other */ + @JvmField val OTHER = of("other") + + @JvmStatic + fun of(value: String) = CreditReasonIndicator(JsonField.of(value)) } - /** An enum containing [StopOverCode]'s known values. */ + /** An enum containing [CreditReasonIndicator]'s known values. */ enum class Known { - /** None */ - NONE, - /** Stop over allowed */ - STOP_OVER_ALLOWED, - /** Stop over not allowed */ - STOP_OVER_NOT_ALLOWED, + /** No credit */ + NO_CREDIT, + /** Passenger transport ancillary purchase cancellation */ + PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, + /** + * Airline ticket and passenger transport ancillary purchase + * cancellation + */ + AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, + /** Other */ + OTHER, } /** - * An enum containing [StopOverCode]'s known values, as well as an - * [_UNKNOWN] member. + * An enum containing [CreditReasonIndicator]'s known values, as well as + * an [_UNKNOWN] member. * - * An instance of [StopOverCode] can contain an unknown value in a - * couple of cases: + * An instance of [CreditReasonIndicator] can contain an unknown value + * in a couple of cases: * - It was deserialized from data that doesn't match any known member. * For example, if the SDK is on an older version than the API, then * the API may respond with new members that the SDK is unaware of. * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - /** None */ - NONE, - /** Stop over allowed */ - STOP_OVER_ALLOWED, - /** Stop over not allowed */ - STOP_OVER_NOT_ALLOWED, + /** No credit */ + NO_CREDIT, + /** Passenger transport ancillary purchase cancellation */ + PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, /** - * An enum member indicating that [StopOverCode] was instantiated - * with an unknown value. + * Airline ticket and passenger transport ancillary purchase + * cancellation + */ + AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, + /** Other */ + OTHER, + /** + * An enum member indicating that [CreditReasonIndicator] was + * instantiated with an unknown value. */ _UNKNOWN, } @@ -27461,9 +27146,13 @@ private constructor( */ fun value(): Value = when (this) { - NONE -> Value.NONE - STOP_OVER_ALLOWED -> Value.STOP_OVER_ALLOWED - STOP_OVER_NOT_ALLOWED -> Value.STOP_OVER_NOT_ALLOWED + NO_CREDIT -> Value.NO_CREDIT + PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> + Value.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION + AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> + Value + .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION + OTHER -> Value.OTHER else -> Value._UNKNOWN } @@ -27478,12 +27167,16 @@ private constructor( */ fun known(): Known = when (this) { - NONE -> Known.NONE - STOP_OVER_ALLOWED -> Known.STOP_OVER_ALLOWED - STOP_OVER_NOT_ALLOWED -> Known.STOP_OVER_NOT_ALLOWED + NO_CREDIT -> Known.NO_CREDIT + PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> + Known.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION + AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> + Known + .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION + OTHER -> Known.OTHER else -> throw IncreaseInvalidDataException( - "Unknown StopOverCode: $value" + "Unknown CreditReasonIndicator: $value" ) } @@ -27503,7 +27196,7 @@ private constructor( private var validated: Boolean = false - fun validate(): StopOverCode = apply { + fun validate(): CreditReasonIndicator = apply { if (validated) { return@apply } @@ -27534,7 +27227,7 @@ private constructor( return true } - return other is StopOverCode && value == other.value + return other is CreditReasonIndicator && value == other.value } override fun hashCode() = value.hashCode() @@ -27542,499 +27235,3554 @@ private constructor( override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is TripLeg && - carrierCode == other.carrierCode && - destinationCityAirportCode == other.destinationCityAirportCode && - fareBasisCode == other.fareBasisCode && - flightNumber == other.flightNumber && - serviceClass == other.serviceClass && - stopOverCode == other.stopOverCode && - additionalProperties == other.additionalProperties - } + class Service + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val category: JsonField, + private val subCategory: JsonField, + private val additionalProperties: MutableMap, + ) { - private val hashCode: Int by lazy { - Objects.hash( - carrierCode, - destinationCityAirportCode, - fareBasisCode, - flightNumber, - serviceClass, - stopOverCode, - additionalProperties, - ) - } + @JsonCreator + private constructor( + @JsonProperty("category") + @ExcludeMissing + category: JsonField = JsonMissing.of(), + @JsonProperty("sub_category") + @ExcludeMissing + subCategory: JsonField = JsonMissing.of(), + ) : this(category, subCategory, mutableMapOf()) - override fun hashCode(): Int = hashCode + /** + * Category of the ancillary service. + * + * @throws IncreaseInvalidDataException if the JSON field has an + * unexpected type (e.g. if the server responded with an unexpected + * value). + */ + fun category(): Optional = category.getOptional("category") - override fun toString() = - "TripLeg{carrierCode=$carrierCode, destinationCityAirportCode=$destinationCityAirportCode, fareBasisCode=$fareBasisCode, flightNumber=$flightNumber, serviceClass=$serviceClass, stopOverCode=$stopOverCode, additionalProperties=$additionalProperties}" - } + /** + * Sub-category of the ancillary service, free-form. + * + * @throws IncreaseInvalidDataException if the JSON field has an + * unexpected type (e.g. if the server responded with an unexpected + * value). + */ + fun subCategory(): Optional = + subCategory.getOptional("sub_category") - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Returns the raw JSON value of [category]. + * + * Unlike [category], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("category") + @ExcludeMissing + fun _category(): JsonField = category - return other is Travel && - ancillary == other.ancillary && - computerizedReservationSystem == other.computerizedReservationSystem && - creditReasonIndicator == other.creditReasonIndicator && - departureDate == other.departureDate && - originationCityAirportCode == other.originationCityAirportCode && - passengerName == other.passengerName && - restrictedTicketIndicator == other.restrictedTicketIndicator && - ticketChangeIndicator == other.ticketChangeIndicator && - ticketNumber == other.ticketNumber && - travelAgencyCode == other.travelAgencyCode && - travelAgencyName == other.travelAgencyName && - tripLegs == other.tripLegs && - additionalProperties == other.additionalProperties - } + /** + * Returns the raw JSON value of [subCategory]. + * + * Unlike [subCategory], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("sub_category") + @ExcludeMissing + fun _subCategory(): JsonField = subCategory - private val hashCode: Int by lazy { - Objects.hash( - ancillary, - computerizedReservationSystem, - creditReasonIndicator, - departureDate, - originationCityAirportCode, - passengerName, - restrictedTicketIndicator, - ticketChangeIndicator, - ticketNumber, - travelAgencyCode, - travelAgencyName, - tripLegs, - additionalProperties, - ) - } + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - override fun hashCode(): Int = hashCode + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - override fun toString() = - "Travel{ancillary=$ancillary, computerizedReservationSystem=$computerizedReservationSystem, creditReasonIndicator=$creditReasonIndicator, departureDate=$departureDate, originationCityAirportCode=$originationCityAirportCode, passengerName=$passengerName, restrictedTicketIndicator=$restrictedTicketIndicator, ticketChangeIndicator=$ticketChangeIndicator, ticketNumber=$ticketNumber, travelAgencyCode=$travelAgencyCode, travelAgencyName=$travelAgencyName, tripLegs=$tripLegs, additionalProperties=$additionalProperties}" - } + fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + companion object { - return other is PurchaseDetails && - carRental == other.carRental && - customerReferenceIdentifier == other.customerReferenceIdentifier && - localTaxAmount == other.localTaxAmount && - localTaxCurrency == other.localTaxCurrency && - lodging == other.lodging && - nationalTaxAmount == other.nationalTaxAmount && - nationalTaxCurrency == other.nationalTaxCurrency && - purchaseIdentifier == other.purchaseIdentifier && - purchaseIdentifierFormat == other.purchaseIdentifierFormat && - travel == other.travel && - additionalProperties == other.additionalProperties - } + /** + * Returns a mutable builder for constructing an instance of + * [Service]. + * + * The following fields are required: + * ```java + * .category() + * .subCategory() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - private val hashCode: Int by lazy { - Objects.hash( - carRental, - customerReferenceIdentifier, - localTaxAmount, - localTaxCurrency, - lodging, - nationalTaxAmount, - nationalTaxCurrency, - purchaseIdentifier, - purchaseIdentifierFormat, - travel, - additionalProperties, - ) - } + /** A builder for [Service]. */ + class Builder internal constructor() { - override fun hashCode(): Int = hashCode + private var category: JsonField? = null + private var subCategory: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() - override fun toString() = - "PurchaseDetails{carRental=$carRental, customerReferenceIdentifier=$customerReferenceIdentifier, localTaxAmount=$localTaxAmount, localTaxCurrency=$localTaxCurrency, lodging=$lodging, nationalTaxAmount=$nationalTaxAmount, nationalTaxCurrency=$nationalTaxCurrency, purchaseIdentifier=$purchaseIdentifier, purchaseIdentifierFormat=$purchaseIdentifierFormat, travel=$travel, additionalProperties=$additionalProperties}" - } + @JvmSynthetic + internal fun from(service: Service) = apply { + category = service.category + subCategory = service.subCategory + additionalProperties = + service.additionalProperties.toMutableMap() + } - /** - * A constant representing the object's type. For this resource it will always be - * `card_refund`. - */ - class Type @JsonCreator private constructor(private val value: JsonField) : - Enum { + /** Category of the ancillary service. */ + fun category(category: Category?) = + category(JsonField.ofNullable(category)) - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + /** + * Alias for calling [Builder.category] with + * `category.orElse(null)`. + */ + fun category(category: Optional) = + category(category.getOrNull()) - companion object { + /** + * Sets [Builder.category] to an arbitrary JSON value. + * + * You should usually call [Builder.category] with a well-typed + * [Category] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ + fun category(category: JsonField) = apply { + this.category = category + } - @JvmField val CARD_REFUND = of("card_refund") + /** Sub-category of the ancillary service, free-form. */ + fun subCategory(subCategory: String?) = + subCategory(JsonField.ofNullable(subCategory)) - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } + /** + * Alias for calling [Builder.subCategory] with + * `subCategory.orElse(null)`. + */ + fun subCategory(subCategory: Optional) = + subCategory(subCategory.getOrNull()) - /** An enum containing [Type]'s known values. */ - enum class Known { - CARD_REFUND - } + /** + * Sets [Builder.subCategory] to an arbitrary JSON value. + * + * You should usually call [Builder.subCategory] with a well-typed + * [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun subCategory(subCategory: JsonField) = apply { + this.subCategory = subCategory + } - /** - * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Type] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CARD_REFUND, - /** - * An enum member indicating that [Type] was instantiated with an unknown value. - */ - _UNKNOWN, - } + fun additionalProperties( + additionalProperties: Map + ) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CARD_REFUND -> Value.CARD_REFUND - else -> Value._UNKNOWN - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - CARD_REFUND -> Known.CARD_REFUND - else -> throw IncreaseInvalidDataException("Unknown Type: $value") - } + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - private var validated: Boolean = false + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun validate(): Type = apply { - if (validated) { - return@apply - } + /** + * Returns an immutable instance of [Service]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + * + * The following fields are required: + * ```java + * .category() + * .subCategory() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Service = + Service( + checkRequired("category", category), + checkRequired("subCategory", subCategory), + additionalProperties.toMutableMap(), + ) + } - known() - validated = true - } + private var validated: Boolean = false - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + fun validate(): Service = apply { + if (validated) { + return@apply + } - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + category().ifPresent { it.validate() } + subCategory() + validated = true + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - return other is Type && value == other.value - } + /** + * Returns a score indicating how many valid values are contained in + * this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (category.asKnown().getOrNull()?.validity() ?: 0) + + (if (subCategory.asKnown().isPresent) 1 else 0) - override fun hashCode() = value.hashCode() + /** Category of the ancillary service. */ + class Category + @JsonCreator + private constructor(private val value: JsonField) : Enum { - override fun toString() = value.toString() - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized + * from data that doesn't match any known member, and you want to + * know that value. For example, if the SDK is on an older version + * than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + companion object { - return other is CardRefund && - id == other.id && - amount == other.amount && - cardPaymentId == other.cardPaymentId && - cashback == other.cashback && - currency == other.currency && - interchange == other.interchange && - merchantAcceptorId == other.merchantAcceptorId && - merchantCategoryCode == other.merchantCategoryCode && - merchantCity == other.merchantCity && - merchantCountry == other.merchantCountry && - merchantName == other.merchantName && - merchantPostalCode == other.merchantPostalCode && - merchantState == other.merchantState && - networkIdentifiers == other.networkIdentifiers && - presentmentAmount == other.presentmentAmount && - presentmentCurrency == other.presentmentCurrency && - purchaseDetails == other.purchaseDetails && - transactionId == other.transactionId && - type == other.type && - additionalProperties == other.additionalProperties - } + /** None */ + @JvmField val NONE = of("none") - private val hashCode: Int by lazy { - Objects.hash( - id, - amount, - cardPaymentId, - cashback, - currency, - interchange, - merchantAcceptorId, - merchantCategoryCode, - merchantCity, - merchantCountry, - merchantName, - merchantPostalCode, - merchantState, - networkIdentifiers, - presentmentAmount, - presentmentCurrency, - purchaseDetails, - transactionId, - type, - additionalProperties, - ) - } + /** Bundled service */ + @JvmField val BUNDLED_SERVICE = of("bundled_service") - override fun hashCode(): Int = hashCode + /** Baggage fee */ + @JvmField val BAGGAGE_FEE = of("baggage_fee") - override fun toString() = - "CardRefund{id=$id, amount=$amount, cardPaymentId=$cardPaymentId, cashback=$cashback, currency=$currency, interchange=$interchange, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantName=$merchantName, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkIdentifiers=$networkIdentifiers, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, purchaseDetails=$purchaseDetails, transactionId=$transactionId, type=$type, additionalProperties=$additionalProperties}" - } + /** Change fee */ + @JvmField val CHANGE_FEE = of("change_fee") - /** - * A Card Revenue Payment object. This field will be present in the JSON response if and - * only if `category` is equal to `card_revenue_payment`. Card Revenue Payments reflect - * earnings from fees on card transactions. - */ - class CardRevenuePayment - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val amount: JsonField, - private val currency: JsonField, - private val periodEnd: JsonField, - private val periodStart: JsonField, - private val transactedOnAccountId: JsonField, - private val additionalProperties: MutableMap, - ) { + /** Cargo */ + @JvmField val CARGO = of("cargo") - @JsonCreator - private constructor( - @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - currency: JsonField = JsonMissing.of(), - @JsonProperty("period_end") - @ExcludeMissing - periodEnd: JsonField = JsonMissing.of(), - @JsonProperty("period_start") - @ExcludeMissing - periodStart: JsonField = JsonMissing.of(), - @JsonProperty("transacted_on_account_id") - @ExcludeMissing - transactedOnAccountId: JsonField = JsonMissing.of(), - ) : this( - amount, - currency, - periodEnd, - periodStart, - transactedOnAccountId, - mutableMapOf(), - ) + /** Carbon offset */ + @JvmField val CARBON_OFFSET = of("carbon_offset") - /** - * The amount in the minor unit of the transaction's currency. For dollars, for example, - * this is cents. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun amount(): Long = amount.getRequired("amount") + /** Frequent flyer */ + @JvmField val FREQUENT_FLYER = of("frequent_flyer") - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction - * currency. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun currency(): Currency = currency.getRequired("currency") + /** Gift card */ + @JvmField val GIFT_CARD = of("gift_card") - /** - * The end of the period for which this transaction paid interest. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun periodEnd(): OffsetDateTime = periodEnd.getRequired("period_end") + /** Ground transport */ + @JvmField val GROUND_TRANSPORT = of("ground_transport") - /** - * The start of the period for which this transaction paid interest. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun periodStart(): OffsetDateTime = periodStart.getRequired("period_start") + /** In-flight entertainment */ + @JvmField + val IN_FLIGHT_ENTERTAINMENT = of("in_flight_entertainment") - /** - * The account the card belonged to. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun transactedOnAccountId(): Optional = - transactedOnAccountId.getOptional("transacted_on_account_id") + /** Lounge */ + @JvmField val LOUNGE = of("lounge") - /** - * Returns the raw JSON value of [amount]. - * - * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + /** Medical */ + @JvmField val MEDICAL = of("medical") - /** - * Returns the raw JSON value of [currency]. - * - * Unlike [currency], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("currency") - @ExcludeMissing - fun _currency(): JsonField = currency + /** Meal beverage */ + @JvmField val MEAL_BEVERAGE = of("meal_beverage") - /** - * Returns the raw JSON value of [periodEnd]. - * - * Unlike [periodEnd], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("period_end") - @ExcludeMissing - fun _periodEnd(): JsonField = periodEnd + /** Other */ + @JvmField val OTHER = of("other") - /** - * Returns the raw JSON value of [periodStart]. - * - * Unlike [periodStart], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("period_start") - @ExcludeMissing - fun _periodStart(): JsonField = periodStart + /** Passenger assist fee */ + @JvmField val PASSENGER_ASSIST_FEE = of("passenger_assist_fee") - /** - * Returns the raw JSON value of [transactedOnAccountId]. - * - * Unlike [transactedOnAccountId], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("transacted_on_account_id") - @ExcludeMissing - fun _transactedOnAccountId(): JsonField = transactedOnAccountId + /** Pets */ + @JvmField val PETS = of("pets") - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** Seat fees */ + @JvmField val SEAT_FEES = of("seat_fees") - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** Standby */ + @JvmField val STANDBY = of("standby") - fun toBuilder() = Builder().from(this) + /** Service fee */ + @JvmField val SERVICE_FEE = of("service_fee") - companion object { + /** Store */ + @JvmField val STORE = of("store") - /** - * Returns a mutable builder for constructing an instance of [CardRevenuePayment]. - * - * The following fields are required: - * ```java - * .amount() - * .currency() - * .periodEnd() - * .periodStart() - * .transactedOnAccountId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + /** Travel service */ + @JvmField val TRAVEL_SERVICE = of("travel_service") - /** A builder for [CardRevenuePayment]. */ - class Builder internal constructor() { + /** Unaccompanied travel */ + @JvmField val UNACCOMPANIED_TRAVEL = of("unaccompanied_travel") - private var amount: JsonField? = null - private var currency: JsonField? = null - private var periodEnd: JsonField? = null - private var periodStart: JsonField? = null - private var transactedOnAccountId: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** Upgrades */ + @JvmField val UPGRADES = of("upgrades") - @JvmSynthetic - internal fun from(cardRevenuePayment: CardRevenuePayment) = apply { - amount = cardRevenuePayment.amount - currency = cardRevenuePayment.currency - periodEnd = cardRevenuePayment.periodEnd - periodStart = cardRevenuePayment.periodStart - transactedOnAccountId = cardRevenuePayment.transactedOnAccountId - additionalProperties = cardRevenuePayment.additionalProperties.toMutableMap() - } + /** Wi-fi */ + @JvmField val WIFI = of("wifi") - /** - * The amount in the minor unit of the transaction's currency. For dollars, for - * example, this is cents. - */ + @JvmStatic fun of(value: String) = Category(JsonField.of(value)) + } + + /** An enum containing [Category]'s known values. */ + enum class Known { + /** None */ + NONE, + /** Bundled service */ + BUNDLED_SERVICE, + /** Baggage fee */ + BAGGAGE_FEE, + /** Change fee */ + CHANGE_FEE, + /** Cargo */ + CARGO, + /** Carbon offset */ + CARBON_OFFSET, + /** Frequent flyer */ + FREQUENT_FLYER, + /** Gift card */ + GIFT_CARD, + /** Ground transport */ + GROUND_TRANSPORT, + /** In-flight entertainment */ + IN_FLIGHT_ENTERTAINMENT, + /** Lounge */ + LOUNGE, + /** Medical */ + MEDICAL, + /** Meal beverage */ + MEAL_BEVERAGE, + /** Other */ + OTHER, + /** Passenger assist fee */ + PASSENGER_ASSIST_FEE, + /** Pets */ + PETS, + /** Seat fees */ + SEAT_FEES, + /** Standby */ + STANDBY, + /** Service fee */ + SERVICE_FEE, + /** Store */ + STORE, + /** Travel service */ + TRAVEL_SERVICE, + /** Unaccompanied travel */ + UNACCOMPANIED_TRAVEL, + /** Upgrades */ + UPGRADES, + /** Wi-fi */ + WIFI, + } + + /** + * An enum containing [Category]'s known values, as well as an + * [_UNKNOWN] member. + * + * An instance of [Category] can contain an unknown value in a + * couple of cases: + * - It was deserialized from data that doesn't match any known + * member. For example, if the SDK is on an older version than the + * API, then the API may respond with new members that the SDK is + * unaware of. + * - It was constructed with an arbitrary value using the [of] + * method. + */ + enum class Value { + /** None */ + NONE, + /** Bundled service */ + BUNDLED_SERVICE, + /** Baggage fee */ + BAGGAGE_FEE, + /** Change fee */ + CHANGE_FEE, + /** Cargo */ + CARGO, + /** Carbon offset */ + CARBON_OFFSET, + /** Frequent flyer */ + FREQUENT_FLYER, + /** Gift card */ + GIFT_CARD, + /** Ground transport */ + GROUND_TRANSPORT, + /** In-flight entertainment */ + IN_FLIGHT_ENTERTAINMENT, + /** Lounge */ + LOUNGE, + /** Medical */ + MEDICAL, + /** Meal beverage */ + MEAL_BEVERAGE, + /** Other */ + OTHER, + /** Passenger assist fee */ + PASSENGER_ASSIST_FEE, + /** Pets */ + PETS, + /** Seat fees */ + SEAT_FEES, + /** Standby */ + STANDBY, + /** Service fee */ + SERVICE_FEE, + /** Store */ + STORE, + /** Travel service */ + TRAVEL_SERVICE, + /** Unaccompanied travel */ + UNACCOMPANIED_TRAVEL, + /** Upgrades */ + UPGRADES, + /** Wi-fi */ + WIFI, + /** + * An enum member indicating that [Category] was instantiated + * with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's + * value, or [Value._UNKNOWN] if the class was instantiated with an + * unknown value. + * + * Use the [known] method instead if you're certain the value is + * always known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NONE -> Value.NONE + BUNDLED_SERVICE -> Value.BUNDLED_SERVICE + BAGGAGE_FEE -> Value.BAGGAGE_FEE + CHANGE_FEE -> Value.CHANGE_FEE + CARGO -> Value.CARGO + CARBON_OFFSET -> Value.CARBON_OFFSET + FREQUENT_FLYER -> Value.FREQUENT_FLYER + GIFT_CARD -> Value.GIFT_CARD + GROUND_TRANSPORT -> Value.GROUND_TRANSPORT + IN_FLIGHT_ENTERTAINMENT -> Value.IN_FLIGHT_ENTERTAINMENT + LOUNGE -> Value.LOUNGE + MEDICAL -> Value.MEDICAL + MEAL_BEVERAGE -> Value.MEAL_BEVERAGE + OTHER -> Value.OTHER + PASSENGER_ASSIST_FEE -> Value.PASSENGER_ASSIST_FEE + PETS -> Value.PETS + SEAT_FEES -> Value.SEAT_FEES + STANDBY -> Value.STANDBY + SERVICE_FEE -> Value.SERVICE_FEE + STORE -> Value.STORE + TRAVEL_SERVICE -> Value.TRAVEL_SERVICE + UNACCOMPANIED_TRAVEL -> Value.UNACCOMPANIED_TRAVEL + UPGRADES -> Value.UPGRADES + WIFI -> Value.WIFI + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's + * value. + * + * Use the [value] method instead if you're uncertain the value is + * always known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's + * value is a not a known member. + */ + fun known(): Known = + when (this) { + NONE -> Known.NONE + BUNDLED_SERVICE -> Known.BUNDLED_SERVICE + BAGGAGE_FEE -> Known.BAGGAGE_FEE + CHANGE_FEE -> Known.CHANGE_FEE + CARGO -> Known.CARGO + CARBON_OFFSET -> Known.CARBON_OFFSET + FREQUENT_FLYER -> Known.FREQUENT_FLYER + GIFT_CARD -> Known.GIFT_CARD + GROUND_TRANSPORT -> Known.GROUND_TRANSPORT + IN_FLIGHT_ENTERTAINMENT -> Known.IN_FLIGHT_ENTERTAINMENT + LOUNGE -> Known.LOUNGE + MEDICAL -> Known.MEDICAL + MEAL_BEVERAGE -> Known.MEAL_BEVERAGE + OTHER -> Known.OTHER + PASSENGER_ASSIST_FEE -> Known.PASSENGER_ASSIST_FEE + PETS -> Known.PETS + SEAT_FEES -> Known.SEAT_FEES + STANDBY -> Known.STANDBY + SERVICE_FEE -> Known.SERVICE_FEE + STORE -> Known.STORE + TRAVEL_SERVICE -> Known.TRAVEL_SERVICE + UNACCOMPANIED_TRAVEL -> Known.UNACCOMPANIED_TRAVEL + UPGRADES -> Known.UPGRADES + WIFI -> Known.WIFI + else -> + throw IncreaseInvalidDataException( + "Unknown Category: $value" + ) + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is + * primarily for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's + * value does not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Category = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in + * this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Category && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Service && + category == other.category && + subCategory == other.subCategory && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(category, subCategory, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Service{category=$category, subCategory=$subCategory, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Ancillary && + connectedTicketDocumentNumber == + other.connectedTicketDocumentNumber && + creditReasonIndicator == other.creditReasonIndicator && + passengerNameOrDescription == other.passengerNameOrDescription && + services == other.services && + ticketDocumentNumber == other.ticketDocumentNumber && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + connectedTicketDocumentNumber, + creditReasonIndicator, + passengerNameOrDescription, + services, + ticketDocumentNumber, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Ancillary{connectedTicketDocumentNumber=$connectedTicketDocumentNumber, creditReasonIndicator=$creditReasonIndicator, passengerNameOrDescription=$passengerNameOrDescription, services=$services, ticketDocumentNumber=$ticketDocumentNumber, additionalProperties=$additionalProperties}" + } + + /** Indicates the reason for a credit to the cardholder. */ + class CreditReasonIndicator + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** No credit */ + @JvmField val NO_CREDIT = of("no_credit") + + /** Passenger transport ancillary purchase cancellation */ + @JvmField + val PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = + of("passenger_transport_ancillary_purchase_cancellation") + + /** + * Airline ticket and passenger transport ancillary purchase + * cancellation + */ + @JvmField + val AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = + of( + "airline_ticket_and_passenger_transport_ancillary_purchase_cancellation" + ) + + /** Airline ticket cancellation */ + @JvmField + val AIRLINE_TICKET_CANCELLATION = of("airline_ticket_cancellation") + + /** Other */ + @JvmField val OTHER = of("other") + + /** Partial refund of airline ticket */ + @JvmField + val PARTIAL_REFUND_OF_AIRLINE_TICKET = + of("partial_refund_of_airline_ticket") + + @JvmStatic + fun of(value: String) = CreditReasonIndicator(JsonField.of(value)) + } + + /** An enum containing [CreditReasonIndicator]'s known values. */ + enum class Known { + /** No credit */ + NO_CREDIT, + /** Passenger transport ancillary purchase cancellation */ + PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, + /** + * Airline ticket and passenger transport ancillary purchase + * cancellation + */ + AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, + /** Airline ticket cancellation */ + AIRLINE_TICKET_CANCELLATION, + /** Other */ + OTHER, + /** Partial refund of airline ticket */ + PARTIAL_REFUND_OF_AIRLINE_TICKET, + } + + /** + * An enum containing [CreditReasonIndicator]'s known values, as well as an + * [_UNKNOWN] member. + * + * An instance of [CreditReasonIndicator] can contain an unknown value in a + * couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** No credit */ + NO_CREDIT, + /** Passenger transport ancillary purchase cancellation */ + PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, + /** + * Airline ticket and passenger transport ancillary purchase + * cancellation + */ + AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, + /** Airline ticket cancellation */ + AIRLINE_TICKET_CANCELLATION, + /** Other */ + OTHER, + /** Partial refund of airline ticket */ + PARTIAL_REFUND_OF_AIRLINE_TICKET, + /** + * An enum member indicating that [CreditReasonIndicator] was + * instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NO_CREDIT -> Value.NO_CREDIT + PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> + Value.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION + AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> + Value + .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION + AIRLINE_TICKET_CANCELLATION -> Value.AIRLINE_TICKET_CANCELLATION + OTHER -> Value.OTHER + PARTIAL_REFUND_OF_AIRLINE_TICKET -> + Value.PARTIAL_REFUND_OF_AIRLINE_TICKET + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + NO_CREDIT -> Known.NO_CREDIT + PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> + Known.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION + AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> + Known + .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION + AIRLINE_TICKET_CANCELLATION -> Known.AIRLINE_TICKET_CANCELLATION + OTHER -> Known.OTHER + PARTIAL_REFUND_OF_AIRLINE_TICKET -> + Known.PARTIAL_REFUND_OF_AIRLINE_TICKET + else -> + throw IncreaseInvalidDataException( + "Unknown CreditReasonIndicator: $value" + ) + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): CreditReasonIndicator = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is CreditReasonIndicator && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Indicates whether this ticket is non-refundable. */ + class RestrictedTicketIndicator + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** No restrictions */ + @JvmField val NO_RESTRICTIONS = of("no_restrictions") + + /** Restricted non-refundable ticket */ + @JvmField + val RESTRICTED_NON_REFUNDABLE_TICKET = + of("restricted_non_refundable_ticket") + + @JvmStatic + fun of(value: String) = RestrictedTicketIndicator(JsonField.of(value)) + } + + /** An enum containing [RestrictedTicketIndicator]'s known values. */ + enum class Known { + /** No restrictions */ + NO_RESTRICTIONS, + /** Restricted non-refundable ticket */ + RESTRICTED_NON_REFUNDABLE_TICKET, + } + + /** + * An enum containing [RestrictedTicketIndicator]'s known values, as well as + * an [_UNKNOWN] member. + * + * An instance of [RestrictedTicketIndicator] can contain an unknown value + * in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** No restrictions */ + NO_RESTRICTIONS, + /** Restricted non-refundable ticket */ + RESTRICTED_NON_REFUNDABLE_TICKET, + /** + * An enum member indicating that [RestrictedTicketIndicator] was + * instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NO_RESTRICTIONS -> Value.NO_RESTRICTIONS + RESTRICTED_NON_REFUNDABLE_TICKET -> + Value.RESTRICTED_NON_REFUNDABLE_TICKET + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + NO_RESTRICTIONS -> Known.NO_RESTRICTIONS + RESTRICTED_NON_REFUNDABLE_TICKET -> + Known.RESTRICTED_NON_REFUNDABLE_TICKET + else -> + throw IncreaseInvalidDataException( + "Unknown RestrictedTicketIndicator: $value" + ) + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): RestrictedTicketIndicator = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RestrictedTicketIndicator && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Indicates why a ticket was changed. */ + class TicketChangeIndicator + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** None */ + @JvmField val NONE = of("none") + + /** Change to existing ticket */ + @JvmField + val CHANGE_TO_EXISTING_TICKET = of("change_to_existing_ticket") + + /** New ticket */ + @JvmField val NEW_TICKET = of("new_ticket") + + @JvmStatic + fun of(value: String) = TicketChangeIndicator(JsonField.of(value)) + } + + /** An enum containing [TicketChangeIndicator]'s known values. */ + enum class Known { + /** None */ + NONE, + /** Change to existing ticket */ + CHANGE_TO_EXISTING_TICKET, + /** New ticket */ + NEW_TICKET, + } + + /** + * An enum containing [TicketChangeIndicator]'s known values, as well as an + * [_UNKNOWN] member. + * + * An instance of [TicketChangeIndicator] can contain an unknown value in a + * couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** None */ + NONE, + /** Change to existing ticket */ + CHANGE_TO_EXISTING_TICKET, + /** New ticket */ + NEW_TICKET, + /** + * An enum member indicating that [TicketChangeIndicator] was + * instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NONE -> Value.NONE + CHANGE_TO_EXISTING_TICKET -> Value.CHANGE_TO_EXISTING_TICKET + NEW_TICKET -> Value.NEW_TICKET + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + NONE -> Known.NONE + CHANGE_TO_EXISTING_TICKET -> Known.CHANGE_TO_EXISTING_TICKET + NEW_TICKET -> Known.NEW_TICKET + else -> + throw IncreaseInvalidDataException( + "Unknown TicketChangeIndicator: $value" + ) + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): TicketChangeIndicator = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is TicketChangeIndicator && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class TripLeg + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val carrierCode: JsonField, + private val destinationCityAirportCode: JsonField, + private val fareBasisCode: JsonField, + private val flightNumber: JsonField, + private val serviceClass: JsonField, + private val stopOverCode: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("carrier_code") + @ExcludeMissing + carrierCode: JsonField = JsonMissing.of(), + @JsonProperty("destination_city_airport_code") + @ExcludeMissing + destinationCityAirportCode: JsonField = JsonMissing.of(), + @JsonProperty("fare_basis_code") + @ExcludeMissing + fareBasisCode: JsonField = JsonMissing.of(), + @JsonProperty("flight_number") + @ExcludeMissing + flightNumber: JsonField = JsonMissing.of(), + @JsonProperty("service_class") + @ExcludeMissing + serviceClass: JsonField = JsonMissing.of(), + @JsonProperty("stop_over_code") + @ExcludeMissing + stopOverCode: JsonField = JsonMissing.of(), + ) : this( + carrierCode, + destinationCityAirportCode, + fareBasisCode, + flightNumber, + serviceClass, + stopOverCode, + mutableMapOf(), + ) + + /** + * Carrier code (e.g., United Airlines, Jet Blue, etc.). + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun carrierCode(): Optional = + carrierCode.getOptional("carrier_code") + + /** + * Code for the destination city or airport. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun destinationCityAirportCode(): Optional = + destinationCityAirportCode.getOptional("destination_city_airport_code") + + /** + * Fare basis code. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun fareBasisCode(): Optional = + fareBasisCode.getOptional("fare_basis_code") + + /** + * Flight number. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun flightNumber(): Optional = + flightNumber.getOptional("flight_number") + + /** + * Service class (e.g., first class, business class, etc.). + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun serviceClass(): Optional = + serviceClass.getOptional("service_class") + + /** + * Indicates whether a stopover is allowed on this ticket. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun stopOverCode(): Optional = + stopOverCode.getOptional("stop_over_code") + + /** + * Returns the raw JSON value of [carrierCode]. + * + * Unlike [carrierCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("carrier_code") + @ExcludeMissing + fun _carrierCode(): JsonField = carrierCode + + /** + * Returns the raw JSON value of [destinationCityAirportCode]. + * + * Unlike [destinationCityAirportCode], this method doesn't throw if the + * JSON field has an unexpected type. + */ + @JsonProperty("destination_city_airport_code") + @ExcludeMissing + fun _destinationCityAirportCode(): JsonField = + destinationCityAirportCode + + /** + * Returns the raw JSON value of [fareBasisCode]. + * + * Unlike [fareBasisCode], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("fare_basis_code") + @ExcludeMissing + fun _fareBasisCode(): JsonField = fareBasisCode + + /** + * Returns the raw JSON value of [flightNumber]. + * + * Unlike [flightNumber], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("flight_number") + @ExcludeMissing + fun _flightNumber(): JsonField = flightNumber + + /** + * Returns the raw JSON value of [serviceClass]. + * + * Unlike [serviceClass], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("service_class") + @ExcludeMissing + fun _serviceClass(): JsonField = serviceClass + + /** + * Returns the raw JSON value of [stopOverCode]. + * + * Unlike [stopOverCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("stop_over_code") + @ExcludeMissing + fun _stopOverCode(): JsonField = stopOverCode + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [TripLeg]. + * + * The following fields are required: + * ```java + * .carrierCode() + * .destinationCityAirportCode() + * .fareBasisCode() + * .flightNumber() + * .serviceClass() + * .stopOverCode() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TripLeg]. */ + class Builder internal constructor() { + + private var carrierCode: JsonField? = null + private var destinationCityAirportCode: JsonField? = null + private var fareBasisCode: JsonField? = null + private var flightNumber: JsonField? = null + private var serviceClass: JsonField? = null + private var stopOverCode: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(tripLeg: TripLeg) = apply { + carrierCode = tripLeg.carrierCode + destinationCityAirportCode = tripLeg.destinationCityAirportCode + fareBasisCode = tripLeg.fareBasisCode + flightNumber = tripLeg.flightNumber + serviceClass = tripLeg.serviceClass + stopOverCode = tripLeg.stopOverCode + additionalProperties = tripLeg.additionalProperties.toMutableMap() + } + + /** Carrier code (e.g., United Airlines, Jet Blue, etc.). */ + fun carrierCode(carrierCode: String?) = + carrierCode(JsonField.ofNullable(carrierCode)) + + /** + * Alias for calling [Builder.carrierCode] with + * `carrierCode.orElse(null)`. + */ + fun carrierCode(carrierCode: Optional) = + carrierCode(carrierCode.getOrNull()) + + /** + * Sets [Builder.carrierCode] to an arbitrary JSON value. + * + * You should usually call [Builder.carrierCode] with a well-typed + * [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun carrierCode(carrierCode: JsonField) = apply { + this.carrierCode = carrierCode + } + + /** Code for the destination city or airport. */ + fun destinationCityAirportCode(destinationCityAirportCode: String?) = + destinationCityAirportCode( + JsonField.ofNullable(destinationCityAirportCode) + ) + + /** + * Alias for calling [Builder.destinationCityAirportCode] with + * `destinationCityAirportCode.orElse(null)`. + */ + fun destinationCityAirportCode( + destinationCityAirportCode: Optional + ) = destinationCityAirportCode(destinationCityAirportCode.getOrNull()) + + /** + * Sets [Builder.destinationCityAirportCode] to an arbitrary JSON value. + * + * You should usually call [Builder.destinationCityAirportCode] with a + * well-typed [String] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ + fun destinationCityAirportCode( + destinationCityAirportCode: JsonField + ) = apply { + this.destinationCityAirportCode = destinationCityAirportCode + } + + /** Fare basis code. */ + fun fareBasisCode(fareBasisCode: String?) = + fareBasisCode(JsonField.ofNullable(fareBasisCode)) + + /** + * Alias for calling [Builder.fareBasisCode] with + * `fareBasisCode.orElse(null)`. + */ + fun fareBasisCode(fareBasisCode: Optional) = + fareBasisCode(fareBasisCode.getOrNull()) + + /** + * Sets [Builder.fareBasisCode] to an arbitrary JSON value. + * + * You should usually call [Builder.fareBasisCode] with a well-typed + * [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun fareBasisCode(fareBasisCode: JsonField) = apply { + this.fareBasisCode = fareBasisCode + } + + /** Flight number. */ + fun flightNumber(flightNumber: String?) = + flightNumber(JsonField.ofNullable(flightNumber)) + + /** + * Alias for calling [Builder.flightNumber] with + * `flightNumber.orElse(null)`. + */ + fun flightNumber(flightNumber: Optional) = + flightNumber(flightNumber.getOrNull()) + + /** + * Sets [Builder.flightNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.flightNumber] with a well-typed + * [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun flightNumber(flightNumber: JsonField) = apply { + this.flightNumber = flightNumber + } + + /** Service class (e.g., first class, business class, etc.). */ + fun serviceClass(serviceClass: String?) = + serviceClass(JsonField.ofNullable(serviceClass)) + + /** + * Alias for calling [Builder.serviceClass] with + * `serviceClass.orElse(null)`. + */ + fun serviceClass(serviceClass: Optional) = + serviceClass(serviceClass.getOrNull()) + + /** + * Sets [Builder.serviceClass] to an arbitrary JSON value. + * + * You should usually call [Builder.serviceClass] with a well-typed + * [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun serviceClass(serviceClass: JsonField) = apply { + this.serviceClass = serviceClass + } + + /** Indicates whether a stopover is allowed on this ticket. */ + fun stopOverCode(stopOverCode: StopOverCode?) = + stopOverCode(JsonField.ofNullable(stopOverCode)) + + /** + * Alias for calling [Builder.stopOverCode] with + * `stopOverCode.orElse(null)`. + */ + fun stopOverCode(stopOverCode: Optional) = + stopOverCode(stopOverCode.getOrNull()) + + /** + * Sets [Builder.stopOverCode] to an arbitrary JSON value. + * + * You should usually call [Builder.stopOverCode] with a well-typed + * [StopOverCode] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ + fun stopOverCode(stopOverCode: JsonField) = apply { + this.stopOverCode = stopOverCode + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [TripLeg]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + * + * The following fields are required: + * ```java + * .carrierCode() + * .destinationCityAirportCode() + * .fareBasisCode() + * .flightNumber() + * .serviceClass() + * .stopOverCode() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): TripLeg = + TripLeg( + checkRequired("carrierCode", carrierCode), + checkRequired( + "destinationCityAirportCode", + destinationCityAirportCode, + ), + checkRequired("fareBasisCode", fareBasisCode), + checkRequired("flightNumber", flightNumber), + checkRequired("serviceClass", serviceClass), + checkRequired("stopOverCode", stopOverCode), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): TripLeg = apply { + if (validated) { + return@apply + } + + carrierCode() + destinationCityAirportCode() + fareBasisCode() + flightNumber() + serviceClass() + stopOverCode().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (carrierCode.asKnown().isPresent) 1 else 0) + + (if (destinationCityAirportCode.asKnown().isPresent) 1 else 0) + + (if (fareBasisCode.asKnown().isPresent) 1 else 0) + + (if (flightNumber.asKnown().isPresent) 1 else 0) + + (if (serviceClass.asKnown().isPresent) 1 else 0) + + (stopOverCode.asKnown().getOrNull()?.validity() ?: 0) + + /** Indicates whether a stopover is allowed on this ticket. */ + class StopOverCode + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from + * data that doesn't match any known member, and you want to know that + * value. For example, if the SDK is on an older version than the API, + * then the API may respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** None */ + @JvmField val NONE = of("none") + + /** Stop over allowed */ + @JvmField val STOP_OVER_ALLOWED = of("stop_over_allowed") + + /** Stop over not allowed */ + @JvmField val STOP_OVER_NOT_ALLOWED = of("stop_over_not_allowed") + + @JvmStatic fun of(value: String) = StopOverCode(JsonField.of(value)) + } + + /** An enum containing [StopOverCode]'s known values. */ + enum class Known { + /** None */ + NONE, + /** Stop over allowed */ + STOP_OVER_ALLOWED, + /** Stop over not allowed */ + STOP_OVER_NOT_ALLOWED, + } + + /** + * An enum containing [StopOverCode]'s known values, as well as an + * [_UNKNOWN] member. + * + * An instance of [StopOverCode] can contain an unknown value in a + * couple of cases: + * - It was deserialized from data that doesn't match any known member. + * For example, if the SDK is on an older version than the API, then + * the API may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** None */ + NONE, + /** Stop over allowed */ + STOP_OVER_ALLOWED, + /** Stop over not allowed */ + STOP_OVER_NOT_ALLOWED, + /** + * An enum member indicating that [StopOverCode] was instantiated + * with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, + * or [Value._UNKNOWN] if the class was instantiated with an unknown + * value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NONE -> Value.NONE + STOP_OVER_ALLOWED -> Value.STOP_OVER_ALLOWED + STOP_OVER_NOT_ALLOWED -> Value.STOP_OVER_NOT_ALLOWED + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is + * always known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value + * is a not a known member. + */ + fun known(): Known = + when (this) { + NONE -> Known.NONE + STOP_OVER_ALLOWED -> Known.STOP_OVER_ALLOWED + STOP_OVER_NOT_ALLOWED -> Known.STOP_OVER_NOT_ALLOWED + else -> + throw IncreaseInvalidDataException( + "Unknown StopOverCode: $value" + ) + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is + * primarily for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value + * does not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): StopOverCode = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in + * this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is StopOverCode && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is TripLeg && + carrierCode == other.carrierCode && + destinationCityAirportCode == other.destinationCityAirportCode && + fareBasisCode == other.fareBasisCode && + flightNumber == other.flightNumber && + serviceClass == other.serviceClass && + stopOverCode == other.stopOverCode && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + carrierCode, + destinationCityAirportCode, + fareBasisCode, + flightNumber, + serviceClass, + stopOverCode, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "TripLeg{carrierCode=$carrierCode, destinationCityAirportCode=$destinationCityAirportCode, fareBasisCode=$fareBasisCode, flightNumber=$flightNumber, serviceClass=$serviceClass, stopOverCode=$stopOverCode, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Travel && + ancillary == other.ancillary && + computerizedReservationSystem == other.computerizedReservationSystem && + creditReasonIndicator == other.creditReasonIndicator && + departureDate == other.departureDate && + originationCityAirportCode == other.originationCityAirportCode && + passengerName == other.passengerName && + restrictedTicketIndicator == other.restrictedTicketIndicator && + ticketChangeIndicator == other.ticketChangeIndicator && + ticketNumber == other.ticketNumber && + travelAgencyCode == other.travelAgencyCode && + travelAgencyName == other.travelAgencyName && + tripLegs == other.tripLegs && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + ancillary, + computerizedReservationSystem, + creditReasonIndicator, + departureDate, + originationCityAirportCode, + passengerName, + restrictedTicketIndicator, + ticketChangeIndicator, + ticketNumber, + travelAgencyCode, + travelAgencyName, + tripLegs, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Travel{ancillary=$ancillary, computerizedReservationSystem=$computerizedReservationSystem, creditReasonIndicator=$creditReasonIndicator, departureDate=$departureDate, originationCityAirportCode=$originationCityAirportCode, passengerName=$passengerName, restrictedTicketIndicator=$restrictedTicketIndicator, ticketChangeIndicator=$ticketChangeIndicator, ticketNumber=$ticketNumber, travelAgencyCode=$travelAgencyCode, travelAgencyName=$travelAgencyName, tripLegs=$tripLegs, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is PurchaseDetails && + carRental == other.carRental && + customerReferenceIdentifier == other.customerReferenceIdentifier && + localTaxAmount == other.localTaxAmount && + localTaxCurrency == other.localTaxCurrency && + lodging == other.lodging && + nationalTaxAmount == other.nationalTaxAmount && + nationalTaxCurrency == other.nationalTaxCurrency && + purchaseIdentifier == other.purchaseIdentifier && + purchaseIdentifierFormat == other.purchaseIdentifierFormat && + travel == other.travel && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + carRental, + customerReferenceIdentifier, + localTaxAmount, + localTaxCurrency, + lodging, + nationalTaxAmount, + nationalTaxCurrency, + purchaseIdentifier, + purchaseIdentifierFormat, + travel, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "PurchaseDetails{carRental=$carRental, customerReferenceIdentifier=$customerReferenceIdentifier, localTaxAmount=$localTaxAmount, localTaxCurrency=$localTaxCurrency, lodging=$lodging, nationalTaxAmount=$nationalTaxAmount, nationalTaxCurrency=$nationalTaxCurrency, purchaseIdentifier=$purchaseIdentifier, purchaseIdentifierFormat=$purchaseIdentifierFormat, travel=$travel, additionalProperties=$additionalProperties}" + } + + class SchemeFee + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val amount: JsonField, + private val createdAt: JsonField, + private val currency: JsonField, + private val feeType: JsonField, + private val fixedComponent: JsonField, + private val variableRate: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + createdAt: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("fee_type") + @ExcludeMissing + feeType: JsonField = JsonMissing.of(), + @JsonProperty("fixed_component") + @ExcludeMissing + fixedComponent: JsonField = JsonMissing.of(), + @JsonProperty("variable_rate") + @ExcludeMissing + variableRate: JsonField = JsonMissing.of(), + ) : this( + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, + mutableMapOf(), + ) + + /** + * The fee amount given as a string containing a decimal number. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun amount(): String = amount.getRequired("amount") + + /** + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + * created. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun currency(): Currency = currency.getRequired("currency") + + /** + * The type of fee being assessed. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun feeType(): FeeType = feeType.getRequired("fee_type") + + /** + * The fixed component of the fee, if applicable, given in major units of the fee + * amount. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun fixedComponent(): Optional = + fixedComponent.getOptional("fixed_component") + + /** + * The variable rate component of the fee, if applicable, given as a decimal (e.g., + * 0.015 for 1.5%). + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun variableRate(): Optional = variableRate.getOptional("variable_rate") + + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + + /** + * Returns the raw JSON value of [createdAt]. + * + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("created_at") + @ExcludeMissing + fun _createdAt(): JsonField = createdAt + + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("currency") + @ExcludeMissing + fun _currency(): JsonField = currency + + /** + * Returns the raw JSON value of [feeType]. + * + * Unlike [feeType], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("fee_type") + @ExcludeMissing + fun _feeType(): JsonField = feeType + + /** + * Returns the raw JSON value of [fixedComponent]. + * + * Unlike [fixedComponent], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("fixed_component") + @ExcludeMissing + fun _fixedComponent(): JsonField = fixedComponent + + /** + * Returns the raw JSON value of [variableRate]. + * + * Unlike [variableRate], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("variable_rate") + @ExcludeMissing + fun _variableRate(): JsonField = variableRate + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [SchemeFee]. + * + * The following fields are required: + * ```java + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SchemeFee]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var createdAt: JsonField? = null + private var currency: JsonField? = null + private var feeType: JsonField? = null + private var fixedComponent: JsonField? = null + private var variableRate: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(schemeFee: SchemeFee) = apply { + amount = schemeFee.amount + createdAt = schemeFee.createdAt + currency = schemeFee.currency + feeType = schemeFee.feeType + fixedComponent = schemeFee.fixedComponent + variableRate = schemeFee.variableRate + additionalProperties = schemeFee.additionalProperties.toMutableMap() + } + + /** The fee amount given as a string containing a decimal number. */ + fun amount(amount: String) = amount(JsonField.of(amount)) + + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun amount(amount: JsonField) = apply { this.amount = amount } + + /** + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee + * was created. + */ + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + /** + * Sets [Builder.createdAt] to an arbitrary JSON value. + * + * You should usually call [Builder.createdAt] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt + } + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + */ + fun currency(currency: Currency) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [Currency] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } + + /** The type of fee being assessed. */ + fun feeType(feeType: FeeType) = feeType(JsonField.of(feeType)) + + /** + * Sets [Builder.feeType] to an arbitrary JSON value. + * + * You should usually call [Builder.feeType] with a well-typed [FeeType] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun feeType(feeType: JsonField) = apply { this.feeType = feeType } + + /** + * The fixed component of the fee, if applicable, given in major units of the + * fee amount. + */ + fun fixedComponent(fixedComponent: String?) = + fixedComponent(JsonField.ofNullable(fixedComponent)) + + /** + * Alias for calling [Builder.fixedComponent] with + * `fixedComponent.orElse(null)`. + */ + fun fixedComponent(fixedComponent: Optional) = + fixedComponent(fixedComponent.getOrNull()) + + /** + * Sets [Builder.fixedComponent] to an arbitrary JSON value. + * + * You should usually call [Builder.fixedComponent] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun fixedComponent(fixedComponent: JsonField) = apply { + this.fixedComponent = fixedComponent + } + + /** + * The variable rate component of the fee, if applicable, given as a decimal + * (e.g., 0.015 for 1.5%). + */ + fun variableRate(variableRate: String?) = + variableRate(JsonField.ofNullable(variableRate)) + + /** + * Alias for calling [Builder.variableRate] with `variableRate.orElse(null)`. + */ + fun variableRate(variableRate: Optional) = + variableRate(variableRate.getOrNull()) + + /** + * Sets [Builder.variableRate] to an arbitrary JSON value. + * + * You should usually call [Builder.variableRate] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun variableRate(variableRate: JsonField) = apply { + this.variableRate = variableRate + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [SchemeFee]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SchemeFee = + SchemeFee( + checkRequired("amount", amount), + checkRequired("createdAt", createdAt), + checkRequired("currency", currency), + checkRequired("feeType", feeType), + checkRequired("fixedComponent", fixedComponent), + checkRequired("variableRate", variableRate), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): SchemeFee = apply { + if (validated) { + return@apply + } + + amount() + createdAt() + currency().validate() + feeType().validate() + fixedComponent() + variableRate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (currency.asKnown().getOrNull()?.validity() ?: 0) + + (feeType.asKnown().getOrNull()?.validity() ?: 0) + + (if (fixedComponent.asKnown().isPresent) 1 else 0) + + (if (variableRate.asKnown().isPresent) 1 else 0) + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + */ + class Currency + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** US Dollar (USD) */ + @JvmField val USD = of("USD") + + @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) + } + + /** An enum containing [Currency]'s known values. */ + enum class Known { + /** US Dollar (USD) */ + USD + } + + /** + * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Currency] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** US Dollar (USD) */ + USD, + /** + * An enum member indicating that [Currency] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + USD -> Value.USD + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + USD -> Known.USD + else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Currency = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Currency && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** The type of fee being assessed. */ + class FeeType + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY = + of("visa_international_service_assessment_single_currency") + + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY = + of("visa_international_service_assessment_cross_currency") + + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + @JvmField + val VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE = + of("visa_authorization_domestic_point_of_sale") + + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + @JvmField + val VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_international_point_of_sale") + + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + @JvmField + val VISA_AUTHORIZATION_CANADA_POINT_OF_SALE = + of("visa_authorization_canada_point_of_sale") + + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + @JvmField + val VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE = + of("visa_authorization_reversal_point_of_sale") + + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + @JvmField + val VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_reversal_international_point_of_sale") + + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + @JvmField + val VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE = + of("visa_authorization_address_verification_service") + + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + @JvmField + val VISA_ADVANCED_AUTHORIZATION = of("visa_advanced_authorization") + + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + @JvmField val VISA_MESSAGE_TRANSMISSION = of("visa_message_transmission") + + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_DOMESTIC = + of("visa_account_verification_domestic") + + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_INTERNATIONAL = + of("visa_account_verification_international") + + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_CANADA = + of("visa_account_verification_canada") + + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + @JvmField + val VISA_CORPORATE_ACCEPTANCE_FEE = of("visa_corporate_acceptance_fee") + + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + @JvmField + val VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE = + of("visa_consumer_debit_acceptance_fee") + + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + @JvmField + val VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE = + of("visa_business_debit_acceptance_fee") + + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + @JvmField + val VISA_PURCHASING_ACCEPTANCE_FEE = of("visa_purchasing_acceptance_fee") + + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + @JvmField val VISA_PURCHASE_DOMESTIC = of("visa_purchase_domestic") + + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + @JvmField + val VISA_PURCHASE_INTERNATIONAL = of("visa_purchase_international") + + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_CREDIT_PURCHASE_TOKEN = of("visa_credit_purchase_token") + + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_DEBIT_PURCHASE_TOKEN = of("visa_debit_purchase_token") + + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + @JvmField val VISA_CLEARING_TRANSMISSION = of("visa_clearing_transmission") + + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + @JvmField val VISA_DIRECT_AUTHORIZATION = of("visa_direct_authorization") + + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + @JvmField + val VISA_DIRECT_TRANSACTION_DOMESTIC = + of("visa_direct_transaction_domestic") + + /** Issuer card service fee for Commercial Credit cards. */ + @JvmField + val VISA_SERVICE_COMMERCIAL_CREDIT = of("visa_service_commercial_credit") + + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + @JvmField + val VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT = + of("visa_advertising_service_commercial_credit") + + /** Issuer Community Growth Acceleration Program Fee. */ + @JvmField + val VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM = + of("visa_community_growth_acceleration_program") + + /** Issuer Processing Guarantee for Commercial Credit cards. */ + @JvmField + val VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT = + of("visa_processing_guarantee_commercial_credit") + + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + @JvmField val PULSE_SWITCH_FEE = of("pulse_switch_fee") + + @JvmStatic fun of(value: String) = FeeType(JsonField.of(value)) + } + + /** An enum containing [FeeType]'s known values. */ + enum class Known { + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + VISA_ADVANCED_AUTHORIZATION, + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + VISA_MESSAGE_TRANSMISSION, + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_DOMESTIC, + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, + } + + /** + * An enum containing [FeeType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [FeeType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + VISA_ADVANCED_AUTHORIZATION, + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + VISA_MESSAGE_TRANSMISSION, + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_DOMESTIC, + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, + /** + * An enum member indicating that [FeeType] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Value.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Value.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Value.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Value.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Value.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Value.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Value.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Value.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Value.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Value.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Value.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Value.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Value.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Value.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Value.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Value.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Value.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Value.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Value.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Value.PULSE_SWITCH_FEE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Known.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Known.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Known.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Known.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Known.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Known.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Known.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Known.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Known.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Known.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Known.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Known.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Known.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Known.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Known.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Known.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Known.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Known.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Known.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Known.PULSE_SWITCH_FEE + else -> throw IncreaseInvalidDataException("Unknown FeeType: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): FeeType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is FeeType && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SchemeFee && + amount == other.amount && + createdAt == other.createdAt && + currency == other.currency && + feeType == other.feeType && + fixedComponent == other.fixedComponent && + variableRate == other.variableRate && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "SchemeFee{amount=$amount, createdAt=$createdAt, currency=$currency, feeType=$feeType, fixedComponent=$fixedComponent, variableRate=$variableRate, additionalProperties=$additionalProperties}" + } + + /** + * A constant representing the object's type. For this resource it will always be + * `card_refund`. + */ + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val CARD_REFUND = of("card_refund") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + CARD_REFUND + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + CARD_REFUND, + /** + * An enum member indicating that [Type] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + CARD_REFUND -> Value.CARD_REFUND + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + CARD_REFUND -> Known.CARD_REFUND + else -> throw IncreaseInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is CardRefund && + id == other.id && + amount == other.amount && + cardPaymentId == other.cardPaymentId && + cashback == other.cashback && + currency == other.currency && + interchange == other.interchange && + merchantAcceptorId == other.merchantAcceptorId && + merchantCategoryCode == other.merchantCategoryCode && + merchantCity == other.merchantCity && + merchantCountry == other.merchantCountry && + merchantName == other.merchantName && + merchantPostalCode == other.merchantPostalCode && + merchantState == other.merchantState && + networkIdentifiers == other.networkIdentifiers && + presentmentAmount == other.presentmentAmount && + presentmentCurrency == other.presentmentCurrency && + purchaseDetails == other.purchaseDetails && + schemeFees == other.schemeFees && + transactionId == other.transactionId && + type == other.type && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + amount, + cardPaymentId, + cashback, + currency, + interchange, + merchantAcceptorId, + merchantCategoryCode, + merchantCity, + merchantCountry, + merchantName, + merchantPostalCode, + merchantState, + networkIdentifiers, + presentmentAmount, + presentmentCurrency, + purchaseDetails, + schemeFees, + transactionId, + type, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "CardRefund{id=$id, amount=$amount, cardPaymentId=$cardPaymentId, cashback=$cashback, currency=$currency, interchange=$interchange, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantName=$merchantName, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkIdentifiers=$networkIdentifiers, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, purchaseDetails=$purchaseDetails, schemeFees=$schemeFees, transactionId=$transactionId, type=$type, additionalProperties=$additionalProperties}" + } + + /** + * A Card Revenue Payment object. This field will be present in the JSON response if and + * only if `category` is equal to `card_revenue_payment`. Card Revenue Payments reflect + * earnings from fees on card transactions. + */ + class CardRevenuePayment + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val periodEnd: JsonField, + private val periodStart: JsonField, + private val transactedOnAccountId: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("period_end") + @ExcludeMissing + periodEnd: JsonField = JsonMissing.of(), + @JsonProperty("period_start") + @ExcludeMissing + periodStart: JsonField = JsonMissing.of(), + @JsonProperty("transacted_on_account_id") + @ExcludeMissing + transactedOnAccountId: JsonField = JsonMissing.of(), + ) : this( + amount, + currency, + periodEnd, + periodStart, + transactedOnAccountId, + mutableMapOf(), + ) + + /** + * The amount in the minor unit of the transaction's currency. For dollars, for example, + * this is cents. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun amount(): Long = amount.getRequired("amount") + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction + * currency. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun currency(): Currency = currency.getRequired("currency") + + /** + * The end of the period for which this transaction paid interest. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun periodEnd(): OffsetDateTime = periodEnd.getRequired("period_end") + + /** + * The start of the period for which this transaction paid interest. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun periodStart(): OffsetDateTime = periodStart.getRequired("period_start") + + /** + * The account the card belonged to. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun transactedOnAccountId(): Optional = + transactedOnAccountId.getOptional("transacted_on_account_id") + + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("currency") + @ExcludeMissing + fun _currency(): JsonField = currency + + /** + * Returns the raw JSON value of [periodEnd]. + * + * Unlike [periodEnd], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("period_end") + @ExcludeMissing + fun _periodEnd(): JsonField = periodEnd + + /** + * Returns the raw JSON value of [periodStart]. + * + * Unlike [periodStart], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("period_start") + @ExcludeMissing + fun _periodStart(): JsonField = periodStart + + /** + * Returns the raw JSON value of [transactedOnAccountId]. + * + * Unlike [transactedOnAccountId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("transacted_on_account_id") + @ExcludeMissing + fun _transactedOnAccountId(): JsonField = transactedOnAccountId + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [CardRevenuePayment]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * .periodEnd() + * .periodStart() + * .transactedOnAccountId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [CardRevenuePayment]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var periodEnd: JsonField? = null + private var periodStart: JsonField? = null + private var transactedOnAccountId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(cardRevenuePayment: CardRevenuePayment) = apply { + amount = cardRevenuePayment.amount + currency = cardRevenuePayment.currency + periodEnd = cardRevenuePayment.periodEnd + periodStart = cardRevenuePayment.periodStart + transactedOnAccountId = cardRevenuePayment.transactedOnAccountId + additionalProperties = cardRevenuePayment.additionalProperties.toMutableMap() + } + + /** + * The amount in the minor unit of the transaction's currency. For dollars, for + * example, this is cents. + */ fun amount(amount: Long) = amount(JsonField.of(amount)) /** @@ -28390,6 +31138,7 @@ private constructor( private val presentmentAmount: JsonField, private val presentmentCurrency: JsonField, private val purchaseDetails: JsonField, + private val schemeFees: JsonField>, private val surcharge: JsonField, private val transactionId: JsonField, private val type: JsonField, @@ -28454,6 +31203,9 @@ private constructor( @JsonProperty("purchase_details") @ExcludeMissing purchaseDetails: JsonField = JsonMissing.of(), + @JsonProperty("scheme_fees") + @ExcludeMissing + schemeFees: JsonField> = JsonMissing.of(), @JsonProperty("surcharge") @ExcludeMissing surcharge: JsonField = JsonMissing.of(), @@ -28482,6 +31234,7 @@ private constructor( presentmentAmount, presentmentCurrency, purchaseDetails, + schemeFees, surcharge, transactionId, type, @@ -28674,6 +31427,15 @@ private constructor( fun purchaseDetails(): Optional = purchaseDetails.getOptional("purchase_details") + /** + * The scheme fees associated with this card settlement. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun schemeFees(): List = schemeFees.getRequired("scheme_fees") + /** * Surcharge amount details, if applicable. The amount is positive if the surcharge is * added to the overall transaction amount (surcharge), and negative if the surcharge is @@ -28894,6 +31656,16 @@ private constructor( @ExcludeMissing fun _purchaseDetails(): JsonField = purchaseDetails + /** + * Returns the raw JSON value of [schemeFees]. + * + * Unlike [schemeFees], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("scheme_fees") + @ExcludeMissing + fun _schemeFees(): JsonField> = schemeFees + /** * Returns the raw JSON value of [surcharge]. * @@ -28960,6 +31732,7 @@ private constructor( * .presentmentAmount() * .presentmentCurrency() * .purchaseDetails() + * .schemeFees() * .surcharge() * .transactionId() * .type() @@ -28991,6 +31764,7 @@ private constructor( private var presentmentAmount: JsonField? = null private var presentmentCurrency: JsonField? = null private var purchaseDetails: JsonField? = null + private var schemeFees: JsonField>? = null private var surcharge: JsonField? = null private var transactionId: JsonField? = null private var type: JsonField? = null @@ -29018,6 +31792,7 @@ private constructor( presentmentAmount = cardSettlement.presentmentAmount presentmentCurrency = cardSettlement.presentmentCurrency purchaseDetails = cardSettlement.purchaseDetails + schemeFees = cardSettlement.schemeFees.map { it.toMutableList() } surcharge = cardSettlement.surcharge transactionId = cardSettlement.transactionId type = cardSettlement.type @@ -29368,6 +32143,32 @@ private constructor( this.purchaseDetails = purchaseDetails } + /** The scheme fees associated with this card settlement. */ + fun schemeFees(schemeFees: List) = schemeFees(JsonField.of(schemeFees)) + + /** + * Sets [Builder.schemeFees] to an arbitrary JSON value. + * + * You should usually call [Builder.schemeFees] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun schemeFees(schemeFees: JsonField>) = apply { + this.schemeFees = schemeFees.map { it.toMutableList() } + } + + /** + * Adds a single [SchemeFee] to [schemeFees]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addSchemeFee(schemeFee: SchemeFee) = apply { + schemeFees = + (schemeFees ?: JsonField.of(mutableListOf())).also { + checkKnown("schemeFees", it).add(schemeFee) + } + } + /** * Surcharge amount details, if applicable. The amount is positive if the surcharge * is added to the overall transaction amount (surcharge), and negative if the @@ -29468,6 +32269,7 @@ private constructor( * .presentmentAmount() * .presentmentCurrency() * .purchaseDetails() + * .schemeFees() * .surcharge() * .transactionId() * .type() @@ -29497,6 +32299,7 @@ private constructor( checkRequired("presentmentAmount", presentmentAmount), checkRequired("presentmentCurrency", presentmentCurrency), checkRequired("purchaseDetails", purchaseDetails), + checkRequired("schemeFees", schemeFees).map { it.toImmutable() }, checkRequired("surcharge", surcharge), checkRequired("transactionId", transactionId), checkRequired("type", type), @@ -29531,6 +32334,7 @@ private constructor( presentmentAmount() presentmentCurrency() purchaseDetails().ifPresent { it.validate() } + schemeFees().forEach { it.validate() } surcharge().ifPresent { it.validate() } transactionId() type().validate() @@ -29573,6 +32377,7 @@ private constructor( (if (presentmentAmount.asKnown().isPresent) 1 else 0) + (if (presentmentCurrency.asKnown().isPresent) 1 else 0) + (purchaseDetails.asKnown().getOrNull()?.validity() ?: 0) + + (schemeFees.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (surcharge.asKnown().getOrNull()?.validity() ?: 0) + (if (transactionId.asKnown().isPresent) 1 else 0) + (type.asKnown().getOrNull()?.validity() ?: 0) @@ -34808,238 +37613,614 @@ private constructor( * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun computerizedReservationSystem(): Optional = - computerizedReservationSystem.getOptional("computerized_reservation_system") + fun computerizedReservationSystem(): Optional = + computerizedReservationSystem.getOptional("computerized_reservation_system") + + /** + * Indicates the reason for a credit to the cardholder. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun creditReasonIndicator(): Optional = + creditReasonIndicator.getOptional("credit_reason_indicator") + + /** + * Date of departure. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun departureDate(): Optional = + departureDate.getOptional("departure_date") + + /** + * Code for the originating city or airport. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun originationCityAirportCode(): Optional = + originationCityAirportCode.getOptional("origination_city_airport_code") + + /** + * Name of the passenger. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun passengerName(): Optional = + passengerName.getOptional("passenger_name") + + /** + * Indicates whether this ticket is non-refundable. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun restrictedTicketIndicator(): Optional = + restrictedTicketIndicator.getOptional("restricted_ticket_indicator") + + /** + * Indicates why a ticket was changed. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun ticketChangeIndicator(): Optional = + ticketChangeIndicator.getOptional("ticket_change_indicator") + + /** + * Ticket number. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun ticketNumber(): Optional = ticketNumber.getOptional("ticket_number") + + /** + * Code for the travel agency if the ticket was issued by a travel agency. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun travelAgencyCode(): Optional = + travelAgencyCode.getOptional("travel_agency_code") + + /** + * Name of the travel agency if the ticket was issued by a travel agency. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun travelAgencyName(): Optional = + travelAgencyName.getOptional("travel_agency_name") + + /** + * Fields specific to each leg of the journey. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun tripLegs(): Optional> = tripLegs.getOptional("trip_legs") + + /** + * Returns the raw JSON value of [ancillary]. + * + * Unlike [ancillary], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("ancillary") + @ExcludeMissing + fun _ancillary(): JsonField = ancillary + + /** + * Returns the raw JSON value of [computerizedReservationSystem]. + * + * Unlike [computerizedReservationSystem], this method doesn't throw if the JSON + * field has an unexpected type. + */ + @JsonProperty("computerized_reservation_system") + @ExcludeMissing + fun _computerizedReservationSystem(): JsonField = + computerizedReservationSystem + + /** + * Returns the raw JSON value of [creditReasonIndicator]. + * + * Unlike [creditReasonIndicator], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("credit_reason_indicator") + @ExcludeMissing + fun _creditReasonIndicator(): JsonField = + creditReasonIndicator + + /** + * Returns the raw JSON value of [departureDate]. + * + * Unlike [departureDate], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("departure_date") + @ExcludeMissing + fun _departureDate(): JsonField = departureDate + + /** + * Returns the raw JSON value of [originationCityAirportCode]. + * + * Unlike [originationCityAirportCode], this method doesn't throw if the JSON + * field has an unexpected type. + */ + @JsonProperty("origination_city_airport_code") + @ExcludeMissing + fun _originationCityAirportCode(): JsonField = + originationCityAirportCode + + /** + * Returns the raw JSON value of [passengerName]. + * + * Unlike [passengerName], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("passenger_name") + @ExcludeMissing + fun _passengerName(): JsonField = passengerName + + /** + * Returns the raw JSON value of [restrictedTicketIndicator]. + * + * Unlike [restrictedTicketIndicator], this method doesn't throw if the JSON + * field has an unexpected type. + */ + @JsonProperty("restricted_ticket_indicator") + @ExcludeMissing + fun _restrictedTicketIndicator(): JsonField = + restrictedTicketIndicator + + /** + * Returns the raw JSON value of [ticketChangeIndicator]. + * + * Unlike [ticketChangeIndicator], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("ticket_change_indicator") + @ExcludeMissing + fun _ticketChangeIndicator(): JsonField = + ticketChangeIndicator /** - * Indicates the reason for a credit to the cardholder. + * Returns the raw JSON value of [ticketNumber]. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * Unlike [ticketNumber], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun creditReasonIndicator(): Optional = - creditReasonIndicator.getOptional("credit_reason_indicator") + @JsonProperty("ticket_number") + @ExcludeMissing + fun _ticketNumber(): JsonField = ticketNumber /** - * Date of departure. + * Returns the raw JSON value of [travelAgencyCode]. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * Unlike [travelAgencyCode], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun departureDate(): Optional = - departureDate.getOptional("departure_date") + @JsonProperty("travel_agency_code") + @ExcludeMissing + fun _travelAgencyCode(): JsonField = travelAgencyCode /** - * Code for the originating city or airport. + * Returns the raw JSON value of [travelAgencyName]. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * Unlike [travelAgencyName], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun originationCityAirportCode(): Optional = - originationCityAirportCode.getOptional("origination_city_airport_code") + @JsonProperty("travel_agency_name") + @ExcludeMissing + fun _travelAgencyName(): JsonField = travelAgencyName /** - * Name of the passenger. + * Returns the raw JSON value of [tripLegs]. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * Unlike [tripLegs], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun passengerName(): Optional = - passengerName.getOptional("passenger_name") + @JsonProperty("trip_legs") + @ExcludeMissing + fun _tripLegs(): JsonField> = tripLegs + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Travel]. + * + * The following fields are required: + * ```java + * .ancillary() + * .computerizedReservationSystem() + * .creditReasonIndicator() + * .departureDate() + * .originationCityAirportCode() + * .passengerName() + * .restrictedTicketIndicator() + * .ticketChangeIndicator() + * .ticketNumber() + * .travelAgencyCode() + * .travelAgencyName() + * .tripLegs() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Travel]. */ + class Builder internal constructor() { + + private var ancillary: JsonField? = null + private var computerizedReservationSystem: JsonField? = null + private var creditReasonIndicator: JsonField? = null + private var departureDate: JsonField? = null + private var originationCityAirportCode: JsonField? = null + private var passengerName: JsonField? = null + private var restrictedTicketIndicator: + JsonField? = + null + private var ticketChangeIndicator: JsonField? = null + private var ticketNumber: JsonField? = null + private var travelAgencyCode: JsonField? = null + private var travelAgencyName: JsonField? = null + private var tripLegs: JsonField>? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(travel: Travel) = apply { + ancillary = travel.ancillary + computerizedReservationSystem = travel.computerizedReservationSystem + creditReasonIndicator = travel.creditReasonIndicator + departureDate = travel.departureDate + originationCityAirportCode = travel.originationCityAirportCode + passengerName = travel.passengerName + restrictedTicketIndicator = travel.restrictedTicketIndicator + ticketChangeIndicator = travel.ticketChangeIndicator + ticketNumber = travel.ticketNumber + travelAgencyCode = travel.travelAgencyCode + travelAgencyName = travel.travelAgencyName + tripLegs = travel.tripLegs.map { it.toMutableList() } + additionalProperties = travel.additionalProperties.toMutableMap() + } + + /** Ancillary purchases in addition to the airfare. */ + fun ancillary(ancillary: Ancillary?) = + ancillary(JsonField.ofNullable(ancillary)) + + /** Alias for calling [Builder.ancillary] with `ancillary.orElse(null)`. */ + fun ancillary(ancillary: Optional) = + ancillary(ancillary.getOrNull()) + + /** + * Sets [Builder.ancillary] to an arbitrary JSON value. + * + * You should usually call [Builder.ancillary] with a well-typed [Ancillary] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun ancillary(ancillary: JsonField) = apply { + this.ancillary = ancillary + } + + /** + * Indicates the computerized reservation system used to book the ticket. + */ + fun computerizedReservationSystem(computerizedReservationSystem: String?) = + computerizedReservationSystem( + JsonField.ofNullable(computerizedReservationSystem) + ) + + /** + * Alias for calling [Builder.computerizedReservationSystem] with + * `computerizedReservationSystem.orElse(null)`. + */ + fun computerizedReservationSystem( + computerizedReservationSystem: Optional + ) = computerizedReservationSystem(computerizedReservationSystem.getOrNull()) + + /** + * Sets [Builder.computerizedReservationSystem] to an arbitrary JSON value. + * + * You should usually call [Builder.computerizedReservationSystem] with a + * well-typed [String] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ + fun computerizedReservationSystem( + computerizedReservationSystem: JsonField + ) = apply { + this.computerizedReservationSystem = computerizedReservationSystem + } + + /** Indicates the reason for a credit to the cardholder. */ + fun creditReasonIndicator(creditReasonIndicator: CreditReasonIndicator?) = + creditReasonIndicator(JsonField.ofNullable(creditReasonIndicator)) + + /** + * Alias for calling [Builder.creditReasonIndicator] with + * `creditReasonIndicator.orElse(null)`. + */ + fun creditReasonIndicator( + creditReasonIndicator: Optional + ) = creditReasonIndicator(creditReasonIndicator.getOrNull()) + + /** + * Sets [Builder.creditReasonIndicator] to an arbitrary JSON value. + * + * You should usually call [Builder.creditReasonIndicator] with a well-typed + * [CreditReasonIndicator] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ + fun creditReasonIndicator( + creditReasonIndicator: JsonField + ) = apply { this.creditReasonIndicator = creditReasonIndicator } + + /** Date of departure. */ + fun departureDate(departureDate: LocalDate?) = + departureDate(JsonField.ofNullable(departureDate)) + + /** + * Alias for calling [Builder.departureDate] with + * `departureDate.orElse(null)`. + */ + fun departureDate(departureDate: Optional) = + departureDate(departureDate.getOrNull()) + + /** + * Sets [Builder.departureDate] to an arbitrary JSON value. + * + * You should usually call [Builder.departureDate] with a well-typed + * [LocalDate] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun departureDate(departureDate: JsonField) = apply { + this.departureDate = departureDate + } + + /** Code for the originating city or airport. */ + fun originationCityAirportCode(originationCityAirportCode: String?) = + originationCityAirportCode( + JsonField.ofNullable(originationCityAirportCode) + ) + + /** + * Alias for calling [Builder.originationCityAirportCode] with + * `originationCityAirportCode.orElse(null)`. + */ + fun originationCityAirportCode( + originationCityAirportCode: Optional + ) = originationCityAirportCode(originationCityAirportCode.getOrNull()) + + /** + * Sets [Builder.originationCityAirportCode] to an arbitrary JSON value. + * + * You should usually call [Builder.originationCityAirportCode] with a + * well-typed [String] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ + fun originationCityAirportCode( + originationCityAirportCode: JsonField + ) = apply { this.originationCityAirportCode = originationCityAirportCode } + + /** Name of the passenger. */ + fun passengerName(passengerName: String?) = + passengerName(JsonField.ofNullable(passengerName)) + + /** + * Alias for calling [Builder.passengerName] with + * `passengerName.orElse(null)`. + */ + fun passengerName(passengerName: Optional) = + passengerName(passengerName.getOrNull()) + + /** + * Sets [Builder.passengerName] to an arbitrary JSON value. + * + * You should usually call [Builder.passengerName] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun passengerName(passengerName: JsonField) = apply { + this.passengerName = passengerName + } - /** - * Indicates whether this ticket is non-refundable. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun restrictedTicketIndicator(): Optional = - restrictedTicketIndicator.getOptional("restricted_ticket_indicator") + /** Indicates whether this ticket is non-refundable. */ + fun restrictedTicketIndicator( + restrictedTicketIndicator: RestrictedTicketIndicator? + ) = + restrictedTicketIndicator( + JsonField.ofNullable(restrictedTicketIndicator) + ) - /** - * Indicates why a ticket was changed. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun ticketChangeIndicator(): Optional = - ticketChangeIndicator.getOptional("ticket_change_indicator") + /** + * Alias for calling [Builder.restrictedTicketIndicator] with + * `restrictedTicketIndicator.orElse(null)`. + */ + fun restrictedTicketIndicator( + restrictedTicketIndicator: Optional + ) = restrictedTicketIndicator(restrictedTicketIndicator.getOrNull()) - /** - * Ticket number. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun ticketNumber(): Optional = ticketNumber.getOptional("ticket_number") + /** + * Sets [Builder.restrictedTicketIndicator] to an arbitrary JSON value. + * + * You should usually call [Builder.restrictedTicketIndicator] with a + * well-typed [RestrictedTicketIndicator] value instead. This method is + * primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun restrictedTicketIndicator( + restrictedTicketIndicator: JsonField + ) = apply { this.restrictedTicketIndicator = restrictedTicketIndicator } - /** - * Code for the travel agency if the ticket was issued by a travel agency. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun travelAgencyCode(): Optional = - travelAgencyCode.getOptional("travel_agency_code") + /** Indicates why a ticket was changed. */ + fun ticketChangeIndicator(ticketChangeIndicator: TicketChangeIndicator?) = + ticketChangeIndicator(JsonField.ofNullable(ticketChangeIndicator)) - /** - * Name of the travel agency if the ticket was issued by a travel agency. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun travelAgencyName(): Optional = - travelAgencyName.getOptional("travel_agency_name") + /** + * Alias for calling [Builder.ticketChangeIndicator] with + * `ticketChangeIndicator.orElse(null)`. + */ + fun ticketChangeIndicator( + ticketChangeIndicator: Optional + ) = ticketChangeIndicator(ticketChangeIndicator.getOrNull()) - /** - * Fields specific to each leg of the journey. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun tripLegs(): Optional> = tripLegs.getOptional("trip_legs") + /** + * Sets [Builder.ticketChangeIndicator] to an arbitrary JSON value. + * + * You should usually call [Builder.ticketChangeIndicator] with a well-typed + * [TicketChangeIndicator] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ + fun ticketChangeIndicator( + ticketChangeIndicator: JsonField + ) = apply { this.ticketChangeIndicator = ticketChangeIndicator } - /** - * Returns the raw JSON value of [ancillary]. - * - * Unlike [ancillary], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("ancillary") - @ExcludeMissing - fun _ancillary(): JsonField = ancillary + /** Ticket number. */ + fun ticketNumber(ticketNumber: String?) = + ticketNumber(JsonField.ofNullable(ticketNumber)) - /** - * Returns the raw JSON value of [computerizedReservationSystem]. - * - * Unlike [computerizedReservationSystem], this method doesn't throw if the JSON - * field has an unexpected type. - */ - @JsonProperty("computerized_reservation_system") - @ExcludeMissing - fun _computerizedReservationSystem(): JsonField = - computerizedReservationSystem + /** + * Alias for calling [Builder.ticketNumber] with + * `ticketNumber.orElse(null)`. + */ + fun ticketNumber(ticketNumber: Optional) = + ticketNumber(ticketNumber.getOrNull()) - /** - * Returns the raw JSON value of [creditReasonIndicator]. - * - * Unlike [creditReasonIndicator], this method doesn't throw if the JSON field - * has an unexpected type. - */ - @JsonProperty("credit_reason_indicator") - @ExcludeMissing - fun _creditReasonIndicator(): JsonField = - creditReasonIndicator + /** + * Sets [Builder.ticketNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.ticketNumber] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun ticketNumber(ticketNumber: JsonField) = apply { + this.ticketNumber = ticketNumber + } - /** - * Returns the raw JSON value of [departureDate]. - * - * Unlike [departureDate], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("departure_date") - @ExcludeMissing - fun _departureDate(): JsonField = departureDate + /** + * Code for the travel agency if the ticket was issued by a travel agency. + */ + fun travelAgencyCode(travelAgencyCode: String?) = + travelAgencyCode(JsonField.ofNullable(travelAgencyCode)) - /** - * Returns the raw JSON value of [originationCityAirportCode]. - * - * Unlike [originationCityAirportCode], this method doesn't throw if the JSON - * field has an unexpected type. - */ - @JsonProperty("origination_city_airport_code") - @ExcludeMissing - fun _originationCityAirportCode(): JsonField = - originationCityAirportCode + /** + * Alias for calling [Builder.travelAgencyCode] with + * `travelAgencyCode.orElse(null)`. + */ + fun travelAgencyCode(travelAgencyCode: Optional) = + travelAgencyCode(travelAgencyCode.getOrNull()) - /** - * Returns the raw JSON value of [passengerName]. - * - * Unlike [passengerName], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("passenger_name") - @ExcludeMissing - fun _passengerName(): JsonField = passengerName + /** + * Sets [Builder.travelAgencyCode] to an arbitrary JSON value. + * + * You should usually call [Builder.travelAgencyCode] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun travelAgencyCode(travelAgencyCode: JsonField) = apply { + this.travelAgencyCode = travelAgencyCode + } - /** - * Returns the raw JSON value of [restrictedTicketIndicator]. - * - * Unlike [restrictedTicketIndicator], this method doesn't throw if the JSON - * field has an unexpected type. - */ - @JsonProperty("restricted_ticket_indicator") - @ExcludeMissing - fun _restrictedTicketIndicator(): JsonField = - restrictedTicketIndicator + /** + * Name of the travel agency if the ticket was issued by a travel agency. + */ + fun travelAgencyName(travelAgencyName: String?) = + travelAgencyName(JsonField.ofNullable(travelAgencyName)) - /** - * Returns the raw JSON value of [ticketChangeIndicator]. - * - * Unlike [ticketChangeIndicator], this method doesn't throw if the JSON field - * has an unexpected type. - */ - @JsonProperty("ticket_change_indicator") - @ExcludeMissing - fun _ticketChangeIndicator(): JsonField = - ticketChangeIndicator + /** + * Alias for calling [Builder.travelAgencyName] with + * `travelAgencyName.orElse(null)`. + */ + fun travelAgencyName(travelAgencyName: Optional) = + travelAgencyName(travelAgencyName.getOrNull()) - /** - * Returns the raw JSON value of [ticketNumber]. - * - * Unlike [ticketNumber], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("ticket_number") - @ExcludeMissing - fun _ticketNumber(): JsonField = ticketNumber + /** + * Sets [Builder.travelAgencyName] to an arbitrary JSON value. + * + * You should usually call [Builder.travelAgencyName] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun travelAgencyName(travelAgencyName: JsonField) = apply { + this.travelAgencyName = travelAgencyName + } - /** - * Returns the raw JSON value of [travelAgencyCode]. - * - * Unlike [travelAgencyCode], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("travel_agency_code") - @ExcludeMissing - fun _travelAgencyCode(): JsonField = travelAgencyCode + /** Fields specific to each leg of the journey. */ + fun tripLegs(tripLegs: List?) = + tripLegs(JsonField.ofNullable(tripLegs)) - /** - * Returns the raw JSON value of [travelAgencyName]. - * - * Unlike [travelAgencyName], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("travel_agency_name") - @ExcludeMissing - fun _travelAgencyName(): JsonField = travelAgencyName + /** Alias for calling [Builder.tripLegs] with `tripLegs.orElse(null)`. */ + fun tripLegs(tripLegs: Optional>) = + tripLegs(tripLegs.getOrNull()) - /** - * Returns the raw JSON value of [tripLegs]. - * - * Unlike [tripLegs], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("trip_legs") - @ExcludeMissing - fun _tripLegs(): JsonField> = tripLegs + /** + * Sets [Builder.tripLegs] to an arbitrary JSON value. + * + * You should usually call [Builder.tripLegs] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun tripLegs(tripLegs: JsonField>) = apply { + this.tripLegs = tripLegs.map { it.toMutableList() } + } - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** + * Adds a single [TripLeg] to [tripLegs]. + * + * @throws IllegalStateException if the field was previously set to a + * non-list. + */ + fun addTripLeg(tripLeg: TripLeg) = apply { + tripLegs = + (tripLegs ?: JsonField.of(mutableListOf())).also { + checkKnown("tripLegs", it).add(tripLeg) + } + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun toBuilder() = Builder().from(this) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - companion object { + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } /** - * Returns a mutable builder for constructing an instance of [Travel]. + * Returns an immutable instance of [Travel]. + * + * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java @@ -35056,1878 +38237,2258 @@ private constructor( * .travelAgencyName() * .tripLegs() * ``` + * + * @throws IllegalStateException if any required field is unset. */ - @JvmStatic fun builder() = Builder() + fun build(): Travel = + Travel( + checkRequired("ancillary", ancillary), + checkRequired( + "computerizedReservationSystem", + computerizedReservationSystem, + ), + checkRequired("creditReasonIndicator", creditReasonIndicator), + checkRequired("departureDate", departureDate), + checkRequired( + "originationCityAirportCode", + originationCityAirportCode, + ), + checkRequired("passengerName", passengerName), + checkRequired( + "restrictedTicketIndicator", + restrictedTicketIndicator, + ), + checkRequired("ticketChangeIndicator", ticketChangeIndicator), + checkRequired("ticketNumber", ticketNumber), + checkRequired("travelAgencyCode", travelAgencyCode), + checkRequired("travelAgencyName", travelAgencyName), + checkRequired("tripLegs", tripLegs).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) } - /** A builder for [Travel]. */ - class Builder internal constructor() { + private var validated: Boolean = false - private var ancillary: JsonField? = null - private var computerizedReservationSystem: JsonField? = null - private var creditReasonIndicator: JsonField? = null - private var departureDate: JsonField? = null - private var originationCityAirportCode: JsonField? = null - private var passengerName: JsonField? = null - private var restrictedTicketIndicator: - JsonField? = - null - private var ticketChangeIndicator: JsonField? = null - private var ticketNumber: JsonField? = null - private var travelAgencyCode: JsonField? = null - private var travelAgencyName: JsonField? = null - private var tripLegs: JsonField>? = null - private var additionalProperties: MutableMap = - mutableMapOf() + fun validate(): Travel = apply { + if (validated) { + return@apply + } - @JvmSynthetic - internal fun from(travel: Travel) = apply { - ancillary = travel.ancillary - computerizedReservationSystem = travel.computerizedReservationSystem - creditReasonIndicator = travel.creditReasonIndicator - departureDate = travel.departureDate - originationCityAirportCode = travel.originationCityAirportCode - passengerName = travel.passengerName - restrictedTicketIndicator = travel.restrictedTicketIndicator - ticketChangeIndicator = travel.ticketChangeIndicator - ticketNumber = travel.ticketNumber - travelAgencyCode = travel.travelAgencyCode - travelAgencyName = travel.travelAgencyName - tripLegs = travel.tripLegs.map { it.toMutableList() } - additionalProperties = travel.additionalProperties.toMutableMap() + ancillary().ifPresent { it.validate() } + computerizedReservationSystem() + creditReasonIndicator().ifPresent { it.validate() } + departureDate() + originationCityAirportCode() + passengerName() + restrictedTicketIndicator().ifPresent { it.validate() } + ticketChangeIndicator().ifPresent { it.validate() } + ticketNumber() + travelAgencyCode() + travelAgencyName() + tripLegs().ifPresent { it.forEach { it.validate() } } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false } - /** Ancillary purchases in addition to the airfare. */ - fun ancillary(ancillary: Ancillary?) = - ancillary(JsonField.ofNullable(ancillary)) + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (ancillary.asKnown().getOrNull()?.validity() ?: 0) + + (if (computerizedReservationSystem.asKnown().isPresent) 1 else 0) + + (creditReasonIndicator.asKnown().getOrNull()?.validity() ?: 0) + + (if (departureDate.asKnown().isPresent) 1 else 0) + + (if (originationCityAirportCode.asKnown().isPresent) 1 else 0) + + (if (passengerName.asKnown().isPresent) 1 else 0) + + (restrictedTicketIndicator.asKnown().getOrNull()?.validity() ?: 0) + + (ticketChangeIndicator.asKnown().getOrNull()?.validity() ?: 0) + + (if (ticketNumber.asKnown().isPresent) 1 else 0) + + (if (travelAgencyCode.asKnown().isPresent) 1 else 0) + + (if (travelAgencyName.asKnown().isPresent) 1 else 0) + + (tripLegs.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) - /** Alias for calling [Builder.ancillary] with `ancillary.orElse(null)`. */ - fun ancillary(ancillary: Optional) = - ancillary(ancillary.getOrNull()) + /** Ancillary purchases in addition to the airfare. */ + class Ancillary + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val connectedTicketDocumentNumber: JsonField, + private val creditReasonIndicator: JsonField, + private val passengerNameOrDescription: JsonField, + private val services: JsonField>, + private val ticketDocumentNumber: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("connected_ticket_document_number") + @ExcludeMissing + connectedTicketDocumentNumber: JsonField = JsonMissing.of(), + @JsonProperty("credit_reason_indicator") + @ExcludeMissing + creditReasonIndicator: JsonField = + JsonMissing.of(), + @JsonProperty("passenger_name_or_description") + @ExcludeMissing + passengerNameOrDescription: JsonField = JsonMissing.of(), + @JsonProperty("services") + @ExcludeMissing + services: JsonField> = JsonMissing.of(), + @JsonProperty("ticket_document_number") + @ExcludeMissing + ticketDocumentNumber: JsonField = JsonMissing.of(), + ) : this( + connectedTicketDocumentNumber, + creditReasonIndicator, + passengerNameOrDescription, + services, + ticketDocumentNumber, + mutableMapOf(), + ) + + /** + * If this purchase has a connection or relationship to another purchase, + * such as a baggage fee for a passenger transport ticket, this field should + * contain the ticket document number for the other purchase. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun connectedTicketDocumentNumber(): Optional = + connectedTicketDocumentNumber.getOptional( + "connected_ticket_document_number" + ) + + /** + * Indicates the reason for a credit to the cardholder. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun creditReasonIndicator(): Optional = + creditReasonIndicator.getOptional("credit_reason_indicator") + + /** + * Name of the passenger or description of the ancillary purchase. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun passengerNameOrDescription(): Optional = + passengerNameOrDescription.getOptional("passenger_name_or_description") /** - * Sets [Builder.ancillary] to an arbitrary JSON value. + * Additional travel charges, such as baggage fees. * - * You should usually call [Builder.ancillary] with a well-typed [Ancillary] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded + * with an unexpected value). */ - fun ancillary(ancillary: JsonField) = apply { - this.ancillary = ancillary - } + fun services(): List = services.getRequired("services") /** - * Indicates the computerized reservation system used to book the ticket. + * Ticket document number. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). */ - fun computerizedReservationSystem(computerizedReservationSystem: String?) = - computerizedReservationSystem( - JsonField.ofNullable(computerizedReservationSystem) - ) + fun ticketDocumentNumber(): Optional = + ticketDocumentNumber.getOptional("ticket_document_number") /** - * Alias for calling [Builder.computerizedReservationSystem] with - * `computerizedReservationSystem.orElse(null)`. + * Returns the raw JSON value of [connectedTicketDocumentNumber]. + * + * Unlike [connectedTicketDocumentNumber], this method doesn't throw if the + * JSON field has an unexpected type. */ - fun computerizedReservationSystem( - computerizedReservationSystem: Optional - ) = computerizedReservationSystem(computerizedReservationSystem.getOrNull()) + @JsonProperty("connected_ticket_document_number") + @ExcludeMissing + fun _connectedTicketDocumentNumber(): JsonField = + connectedTicketDocumentNumber /** - * Sets [Builder.computerizedReservationSystem] to an arbitrary JSON value. + * Returns the raw JSON value of [creditReasonIndicator]. * - * You should usually call [Builder.computerizedReservationSystem] with a - * well-typed [String] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. + * Unlike [creditReasonIndicator], this method doesn't throw if the JSON + * field has an unexpected type. */ - fun computerizedReservationSystem( - computerizedReservationSystem: JsonField - ) = apply { - this.computerizedReservationSystem = computerizedReservationSystem - } + @JsonProperty("credit_reason_indicator") + @ExcludeMissing + fun _creditReasonIndicator(): JsonField = + creditReasonIndicator - /** Indicates the reason for a credit to the cardholder. */ - fun creditReasonIndicator(creditReasonIndicator: CreditReasonIndicator?) = - creditReasonIndicator(JsonField.ofNullable(creditReasonIndicator)) + /** + * Returns the raw JSON value of [passengerNameOrDescription]. + * + * Unlike [passengerNameOrDescription], this method doesn't throw if the + * JSON field has an unexpected type. + */ + @JsonProperty("passenger_name_or_description") + @ExcludeMissing + fun _passengerNameOrDescription(): JsonField = + passengerNameOrDescription /** - * Alias for calling [Builder.creditReasonIndicator] with - * `creditReasonIndicator.orElse(null)`. + * Returns the raw JSON value of [services]. + * + * Unlike [services], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun creditReasonIndicator( - creditReasonIndicator: Optional - ) = creditReasonIndicator(creditReasonIndicator.getOrNull()) + @JsonProperty("services") + @ExcludeMissing + fun _services(): JsonField> = services /** - * Sets [Builder.creditReasonIndicator] to an arbitrary JSON value. + * Returns the raw JSON value of [ticketDocumentNumber]. * - * You should usually call [Builder.creditReasonIndicator] with a well-typed - * [CreditReasonIndicator] value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. + * Unlike [ticketDocumentNumber], this method doesn't throw if the JSON + * field has an unexpected type. */ - fun creditReasonIndicator( - creditReasonIndicator: JsonField - ) = apply { this.creditReasonIndicator = creditReasonIndicator } + @JsonProperty("ticket_document_number") + @ExcludeMissing + fun _ticketDocumentNumber(): JsonField = ticketDocumentNumber + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [Ancillary]. + * + * The following fields are required: + * ```java + * .connectedTicketDocumentNumber() + * .creditReasonIndicator() + * .passengerNameOrDescription() + * .services() + * .ticketDocumentNumber() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Ancillary]. */ + class Builder internal constructor() { + + private var connectedTicketDocumentNumber: JsonField? = null + private var creditReasonIndicator: JsonField? = + null + private var passengerNameOrDescription: JsonField? = null + private var services: JsonField>? = null + private var ticketDocumentNumber: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(ancillary: Ancillary) = apply { + connectedTicketDocumentNumber = + ancillary.connectedTicketDocumentNumber + creditReasonIndicator = ancillary.creditReasonIndicator + passengerNameOrDescription = ancillary.passengerNameOrDescription + services = ancillary.services.map { it.toMutableList() } + ticketDocumentNumber = ancillary.ticketDocumentNumber + additionalProperties = ancillary.additionalProperties.toMutableMap() + } + + /** + * If this purchase has a connection or relationship to another + * purchase, such as a baggage fee for a passenger transport ticket, + * this field should contain the ticket document number for the other + * purchase. + */ + fun connectedTicketDocumentNumber( + connectedTicketDocumentNumber: String? + ) = + connectedTicketDocumentNumber( + JsonField.ofNullable(connectedTicketDocumentNumber) + ) + + /** + * Alias for calling [Builder.connectedTicketDocumentNumber] with + * `connectedTicketDocumentNumber.orElse(null)`. + */ + fun connectedTicketDocumentNumber( + connectedTicketDocumentNumber: Optional + ) = + connectedTicketDocumentNumber( + connectedTicketDocumentNumber.getOrNull() + ) + + /** + * Sets [Builder.connectedTicketDocumentNumber] to an arbitrary JSON + * value. + * + * You should usually call [Builder.connectedTicketDocumentNumber] with + * a well-typed [String] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ + fun connectedTicketDocumentNumber( + connectedTicketDocumentNumber: JsonField + ) = apply { + this.connectedTicketDocumentNumber = connectedTicketDocumentNumber + } + + /** Indicates the reason for a credit to the cardholder. */ + fun creditReasonIndicator( + creditReasonIndicator: CreditReasonIndicator? + ) = creditReasonIndicator(JsonField.ofNullable(creditReasonIndicator)) + + /** + * Alias for calling [Builder.creditReasonIndicator] with + * `creditReasonIndicator.orElse(null)`. + */ + fun creditReasonIndicator( + creditReasonIndicator: Optional + ) = creditReasonIndicator(creditReasonIndicator.getOrNull()) + + /** + * Sets [Builder.creditReasonIndicator] to an arbitrary JSON value. + * + * You should usually call [Builder.creditReasonIndicator] with a + * well-typed [CreditReasonIndicator] value instead. This method is + * primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun creditReasonIndicator( + creditReasonIndicator: JsonField + ) = apply { this.creditReasonIndicator = creditReasonIndicator } + + /** Name of the passenger or description of the ancillary purchase. */ + fun passengerNameOrDescription(passengerNameOrDescription: String?) = + passengerNameOrDescription( + JsonField.ofNullable(passengerNameOrDescription) + ) + + /** + * Alias for calling [Builder.passengerNameOrDescription] with + * `passengerNameOrDescription.orElse(null)`. + */ + fun passengerNameOrDescription( + passengerNameOrDescription: Optional + ) = passengerNameOrDescription(passengerNameOrDescription.getOrNull()) + + /** + * Sets [Builder.passengerNameOrDescription] to an arbitrary JSON value. + * + * You should usually call [Builder.passengerNameOrDescription] with a + * well-typed [String] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ + fun passengerNameOrDescription( + passengerNameOrDescription: JsonField + ) = apply { + this.passengerNameOrDescription = passengerNameOrDescription + } + + /** Additional travel charges, such as baggage fees. */ + fun services(services: List) = services(JsonField.of(services)) + + /** + * Sets [Builder.services] to an arbitrary JSON value. + * + * You should usually call [Builder.services] with a well-typed + * `List` value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ + fun services(services: JsonField>) = apply { + this.services = services.map { it.toMutableList() } + } + + /** + * Adds a single [Service] to [services]. + * + * @throws IllegalStateException if the field was previously set to a + * non-list. + */ + fun addService(service: Service) = apply { + services = + (services ?: JsonField.of(mutableListOf())).also { + checkKnown("services", it).add(service) + } + } - /** Date of departure. */ - fun departureDate(departureDate: LocalDate?) = - departureDate(JsonField.ofNullable(departureDate)) + /** Ticket document number. */ + fun ticketDocumentNumber(ticketDocumentNumber: String?) = + ticketDocumentNumber(JsonField.ofNullable(ticketDocumentNumber)) - /** - * Alias for calling [Builder.departureDate] with - * `departureDate.orElse(null)`. - */ - fun departureDate(departureDate: Optional) = - departureDate(departureDate.getOrNull()) + /** + * Alias for calling [Builder.ticketDocumentNumber] with + * `ticketDocumentNumber.orElse(null)`. + */ + fun ticketDocumentNumber(ticketDocumentNumber: Optional) = + ticketDocumentNumber(ticketDocumentNumber.getOrNull()) - /** - * Sets [Builder.departureDate] to an arbitrary JSON value. - * - * You should usually call [Builder.departureDate] with a well-typed - * [LocalDate] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. - */ - fun departureDate(departureDate: JsonField) = apply { - this.departureDate = departureDate - } + /** + * Sets [Builder.ticketDocumentNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.ticketDocumentNumber] with a + * well-typed [String] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ + fun ticketDocumentNumber(ticketDocumentNumber: JsonField) = + apply { + this.ticketDocumentNumber = ticketDocumentNumber + } - /** Code for the originating city or airport. */ - fun originationCityAirportCode(originationCityAirportCode: String?) = - originationCityAirportCode( - JsonField.ofNullable(originationCityAirportCode) - ) + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * Alias for calling [Builder.originationCityAirportCode] with - * `originationCityAirportCode.orElse(null)`. - */ - fun originationCityAirportCode( - originationCityAirportCode: Optional - ) = originationCityAirportCode(originationCityAirportCode.getOrNull()) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * Sets [Builder.originationCityAirportCode] to an arbitrary JSON value. - * - * You should usually call [Builder.originationCityAirportCode] with a - * well-typed [String] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. - */ - fun originationCityAirportCode( - originationCityAirportCode: JsonField - ) = apply { this.originationCityAirportCode = originationCityAirportCode } + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } - /** Name of the passenger. */ - fun passengerName(passengerName: String?) = - passengerName(JsonField.ofNullable(passengerName)) + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * Alias for calling [Builder.passengerName] with - * `passengerName.orElse(null)`. - */ - fun passengerName(passengerName: Optional) = - passengerName(passengerName.getOrNull()) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * Sets [Builder.passengerName] to an arbitrary JSON value. - * - * You should usually call [Builder.passengerName] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun passengerName(passengerName: JsonField) = apply { - this.passengerName = passengerName + /** + * Returns an immutable instance of [Ancillary]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + * + * The following fields are required: + * ```java + * .connectedTicketDocumentNumber() + * .creditReasonIndicator() + * .passengerNameOrDescription() + * .services() + * .ticketDocumentNumber() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Ancillary = + Ancillary( + checkRequired( + "connectedTicketDocumentNumber", + connectedTicketDocumentNumber, + ), + checkRequired("creditReasonIndicator", creditReasonIndicator), + checkRequired( + "passengerNameOrDescription", + passengerNameOrDescription, + ), + checkRequired("services", services).map { it.toImmutable() }, + checkRequired("ticketDocumentNumber", ticketDocumentNumber), + additionalProperties.toMutableMap(), + ) } - /** Indicates whether this ticket is non-refundable. */ - fun restrictedTicketIndicator( - restrictedTicketIndicator: RestrictedTicketIndicator? - ) = - restrictedTicketIndicator( - JsonField.ofNullable(restrictedTicketIndicator) - ) - - /** - * Alias for calling [Builder.restrictedTicketIndicator] with - * `restrictedTicketIndicator.orElse(null)`. - */ - fun restrictedTicketIndicator( - restrictedTicketIndicator: Optional - ) = restrictedTicketIndicator(restrictedTicketIndicator.getOrNull()) + private var validated: Boolean = false - /** - * Sets [Builder.restrictedTicketIndicator] to an arbitrary JSON value. - * - * You should usually call [Builder.restrictedTicketIndicator] with a - * well-typed [RestrictedTicketIndicator] value instead. This method is - * primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun restrictedTicketIndicator( - restrictedTicketIndicator: JsonField - ) = apply { this.restrictedTicketIndicator = restrictedTicketIndicator } + fun validate(): Ancillary = apply { + if (validated) { + return@apply + } - /** Indicates why a ticket was changed. */ - fun ticketChangeIndicator(ticketChangeIndicator: TicketChangeIndicator?) = - ticketChangeIndicator(JsonField.ofNullable(ticketChangeIndicator)) + connectedTicketDocumentNumber() + creditReasonIndicator().ifPresent { it.validate() } + passengerNameOrDescription() + services().forEach { it.validate() } + ticketDocumentNumber() + validated = true + } - /** - * Alias for calling [Builder.ticketChangeIndicator] with - * `ticketChangeIndicator.orElse(null)`. - */ - fun ticketChangeIndicator( - ticketChangeIndicator: Optional - ) = ticketChangeIndicator(ticketChangeIndicator.getOrNull()) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } /** - * Sets [Builder.ticketChangeIndicator] to an arbitrary JSON value. + * Returns a score indicating how many valid values are contained in this + * object recursively. * - * You should usually call [Builder.ticketChangeIndicator] with a well-typed - * [TicketChangeIndicator] value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. + * Used for best match union deserialization. */ - fun ticketChangeIndicator( - ticketChangeIndicator: JsonField - ) = apply { this.ticketChangeIndicator = ticketChangeIndicator } - - /** Ticket number. */ - fun ticketNumber(ticketNumber: String?) = - ticketNumber(JsonField.ofNullable(ticketNumber)) + @JvmSynthetic + internal fun validity(): Int = + (if (connectedTicketDocumentNumber.asKnown().isPresent) 1 else 0) + + (creditReasonIndicator.asKnown().getOrNull()?.validity() ?: 0) + + (if (passengerNameOrDescription.asKnown().isPresent) 1 else 0) + + (services.asKnown().getOrNull()?.sumOf { it.validity().toInt() } + ?: 0) + + (if (ticketDocumentNumber.asKnown().isPresent) 1 else 0) - /** - * Alias for calling [Builder.ticketNumber] with - * `ticketNumber.orElse(null)`. - */ - fun ticketNumber(ticketNumber: Optional) = - ticketNumber(ticketNumber.getOrNull()) + /** Indicates the reason for a credit to the cardholder. */ + class CreditReasonIndicator + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** - * Sets [Builder.ticketNumber] to an arbitrary JSON value. - * - * You should usually call [Builder.ticketNumber] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun ticketNumber(ticketNumber: JsonField) = apply { - this.ticketNumber = ticketNumber - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from + * data that doesn't match any known member, and you want to know that + * value. For example, if the SDK is on an older version than the API, + * then the API may respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** - * Code for the travel agency if the ticket was issued by a travel agency. - */ - fun travelAgencyCode(travelAgencyCode: String?) = - travelAgencyCode(JsonField.ofNullable(travelAgencyCode)) + companion object { - /** - * Alias for calling [Builder.travelAgencyCode] with - * `travelAgencyCode.orElse(null)`. - */ - fun travelAgencyCode(travelAgencyCode: Optional) = - travelAgencyCode(travelAgencyCode.getOrNull()) + /** No credit */ + @JvmField val NO_CREDIT = of("no_credit") - /** - * Sets [Builder.travelAgencyCode] to an arbitrary JSON value. - * - * You should usually call [Builder.travelAgencyCode] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun travelAgencyCode(travelAgencyCode: JsonField) = apply { - this.travelAgencyCode = travelAgencyCode - } + /** Passenger transport ancillary purchase cancellation */ + @JvmField + val PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = + of("passenger_transport_ancillary_purchase_cancellation") - /** - * Name of the travel agency if the ticket was issued by a travel agency. - */ - fun travelAgencyName(travelAgencyName: String?) = - travelAgencyName(JsonField.ofNullable(travelAgencyName)) + /** + * Airline ticket and passenger transport ancillary purchase + * cancellation + */ + @JvmField + val AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = + of( + "airline_ticket_and_passenger_transport_ancillary_purchase_cancellation" + ) - /** - * Alias for calling [Builder.travelAgencyName] with - * `travelAgencyName.orElse(null)`. - */ - fun travelAgencyName(travelAgencyName: Optional) = - travelAgencyName(travelAgencyName.getOrNull()) + /** Other */ + @JvmField val OTHER = of("other") - /** - * Sets [Builder.travelAgencyName] to an arbitrary JSON value. - * - * You should usually call [Builder.travelAgencyName] with a well-typed - * [String] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun travelAgencyName(travelAgencyName: JsonField) = apply { - this.travelAgencyName = travelAgencyName - } + @JvmStatic + fun of(value: String) = CreditReasonIndicator(JsonField.of(value)) + } - /** Fields specific to each leg of the journey. */ - fun tripLegs(tripLegs: List?) = - tripLegs(JsonField.ofNullable(tripLegs)) + /** An enum containing [CreditReasonIndicator]'s known values. */ + enum class Known { + /** No credit */ + NO_CREDIT, + /** Passenger transport ancillary purchase cancellation */ + PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, + /** + * Airline ticket and passenger transport ancillary purchase + * cancellation + */ + AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, + /** Other */ + OTHER, + } - /** Alias for calling [Builder.tripLegs] with `tripLegs.orElse(null)`. */ - fun tripLegs(tripLegs: Optional>) = - tripLegs(tripLegs.getOrNull()) + /** + * An enum containing [CreditReasonIndicator]'s known values, as well as + * an [_UNKNOWN] member. + * + * An instance of [CreditReasonIndicator] can contain an unknown value + * in a couple of cases: + * - It was deserialized from data that doesn't match any known member. + * For example, if the SDK is on an older version than the API, then + * the API may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** No credit */ + NO_CREDIT, + /** Passenger transport ancillary purchase cancellation */ + PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, + /** + * Airline ticket and passenger transport ancillary purchase + * cancellation + */ + AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, + /** Other */ + OTHER, + /** + * An enum member indicating that [CreditReasonIndicator] was + * instantiated with an unknown value. + */ + _UNKNOWN, + } - /** - * Sets [Builder.tripLegs] to an arbitrary JSON value. - * - * You should usually call [Builder.tripLegs] with a well-typed - * `List` value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun tripLegs(tripLegs: JsonField>) = apply { - this.tripLegs = tripLegs.map { it.toMutableList() } - } + /** + * Returns an enum member corresponding to this class instance's value, + * or [Value._UNKNOWN] if the class was instantiated with an unknown + * value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NO_CREDIT -> Value.NO_CREDIT + PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> + Value.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION + AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> + Value + .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION + OTHER -> Value.OTHER + else -> Value._UNKNOWN + } - /** - * Adds a single [TripLeg] to [tripLegs]. - * - * @throws IllegalStateException if the field was previously set to a - * non-list. - */ - fun addTripLeg(tripLeg: TripLeg) = apply { - tripLegs = - (tripLegs ?: JsonField.of(mutableListOf())).also { - checkKnown("tripLegs", it).add(tripLeg) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is + * always known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value + * is a not a known member. + */ + fun known(): Known = + when (this) { + NO_CREDIT -> Known.NO_CREDIT + PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> + Known.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION + AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> + Known + .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION + OTHER -> Known.OTHER + else -> + throw IncreaseInvalidDataException( + "Unknown CreditReasonIndicator: $value" + ) } - } - fun additionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is + * primarily for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value + * does not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + private var validated: Boolean = false - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun validate(): CreditReasonIndicator = apply { + if (validated) { + return@apply + } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + known() + validated = true + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * Returns an immutable instance of [Travel]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .ancillary() - * .computerizedReservationSystem() - * .creditReasonIndicator() - * .departureDate() - * .originationCityAirportCode() - * .passengerName() - * .restrictedTicketIndicator() - * .ticketChangeIndicator() - * .ticketNumber() - * .travelAgencyCode() - * .travelAgencyName() - * .tripLegs() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Travel = - Travel( - checkRequired("ancillary", ancillary), - checkRequired( - "computerizedReservationSystem", - computerizedReservationSystem, - ), - checkRequired("creditReasonIndicator", creditReasonIndicator), - checkRequired("departureDate", departureDate), - checkRequired( - "originationCityAirportCode", - originationCityAirportCode, - ), - checkRequired("passengerName", passengerName), - checkRequired( - "restrictedTicketIndicator", - restrictedTicketIndicator, - ), - checkRequired("ticketChangeIndicator", ticketChangeIndicator), - checkRequired("ticketNumber", ticketNumber), - checkRequired("travelAgencyCode", travelAgencyCode), - checkRequired("travelAgencyName", travelAgencyName), - checkRequired("tripLegs", tripLegs).map { it.toImmutable() }, - additionalProperties.toMutableMap(), - ) - } + /** + * Returns a score indicating how many valid values are contained in + * this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - private var validated: Boolean = false + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun validate(): Travel = apply { - if (validated) { - return@apply - } + return other is CreditReasonIndicator && value == other.value + } - ancillary().ifPresent { it.validate() } - computerizedReservationSystem() - creditReasonIndicator().ifPresent { it.validate() } - departureDate() - originationCityAirportCode() - passengerName() - restrictedTicketIndicator().ifPresent { it.validate() } - ticketChangeIndicator().ifPresent { it.validate() } - ticketNumber() - travelAgencyCode() - travelAgencyName() - tripLegs().ifPresent { it.forEach { it.validate() } } - validated = true - } + override fun hashCode() = value.hashCode() - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false + override fun toString() = value.toString() } - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (ancillary.asKnown().getOrNull()?.validity() ?: 0) + - (if (computerizedReservationSystem.asKnown().isPresent) 1 else 0) + - (creditReasonIndicator.asKnown().getOrNull()?.validity() ?: 0) + - (if (departureDate.asKnown().isPresent) 1 else 0) + - (if (originationCityAirportCode.asKnown().isPresent) 1 else 0) + - (if (passengerName.asKnown().isPresent) 1 else 0) + - (restrictedTicketIndicator.asKnown().getOrNull()?.validity() ?: 0) + - (ticketChangeIndicator.asKnown().getOrNull()?.validity() ?: 0) + - (if (ticketNumber.asKnown().isPresent) 1 else 0) + - (if (travelAgencyCode.asKnown().isPresent) 1 else 0) + - (if (travelAgencyName.asKnown().isPresent) 1 else 0) + - (tripLegs.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + class Service + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val category: JsonField, + private val subCategory: JsonField, + private val additionalProperties: MutableMap, + ) { - /** Ancillary purchases in addition to the airfare. */ - class Ancillary - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val connectedTicketDocumentNumber: JsonField, - private val creditReasonIndicator: JsonField, - private val passengerNameOrDescription: JsonField, - private val services: JsonField>, - private val ticketDocumentNumber: JsonField, - private val additionalProperties: MutableMap, - ) { + @JsonCreator + private constructor( + @JsonProperty("category") + @ExcludeMissing + category: JsonField = JsonMissing.of(), + @JsonProperty("sub_category") + @ExcludeMissing + subCategory: JsonField = JsonMissing.of(), + ) : this(category, subCategory, mutableMapOf()) - @JsonCreator - private constructor( - @JsonProperty("connected_ticket_document_number") - @ExcludeMissing - connectedTicketDocumentNumber: JsonField = JsonMissing.of(), - @JsonProperty("credit_reason_indicator") - @ExcludeMissing - creditReasonIndicator: JsonField = - JsonMissing.of(), - @JsonProperty("passenger_name_or_description") - @ExcludeMissing - passengerNameOrDescription: JsonField = JsonMissing.of(), - @JsonProperty("services") + /** + * Category of the ancillary service. + * + * @throws IncreaseInvalidDataException if the JSON field has an + * unexpected type (e.g. if the server responded with an unexpected + * value). + */ + fun category(): Optional = category.getOptional("category") + + /** + * Sub-category of the ancillary service, free-form. + * + * @throws IncreaseInvalidDataException if the JSON field has an + * unexpected type (e.g. if the server responded with an unexpected + * value). + */ + fun subCategory(): Optional = + subCategory.getOptional("sub_category") + + /** + * Returns the raw JSON value of [category]. + * + * Unlike [category], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("category") @ExcludeMissing - services: JsonField> = JsonMissing.of(), - @JsonProperty("ticket_document_number") + fun _category(): JsonField = category + + /** + * Returns the raw JSON value of [subCategory]. + * + * Unlike [subCategory], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("sub_category") @ExcludeMissing - ticketDocumentNumber: JsonField = JsonMissing.of(), - ) : this( - connectedTicketDocumentNumber, - creditReasonIndicator, - passengerNameOrDescription, - services, - ticketDocumentNumber, - mutableMapOf(), - ) + fun _subCategory(): JsonField = subCategory - /** - * If this purchase has a connection or relationship to another purchase, - * such as a baggage fee for a passenger transport ticket, this field should - * contain the ticket document number for the other purchase. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). - */ - fun connectedTicketDocumentNumber(): Optional = - connectedTicketDocumentNumber.getOptional( - "connected_ticket_document_number" - ) + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - /** - * Indicates the reason for a credit to the cardholder. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). - */ - fun creditReasonIndicator(): Optional = - creditReasonIndicator.getOptional("credit_reason_indicator") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** - * Name of the passenger or description of the ancillary purchase. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). - */ - fun passengerNameOrDescription(): Optional = - passengerNameOrDescription.getOptional("passenger_name_or_description") + fun toBuilder() = Builder().from(this) - /** - * Additional travel charges, such as baggage fees. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type or is unexpectedly missing or null (e.g. if the server responded - * with an unexpected value). - */ - fun services(): List = services.getRequired("services") + companion object { - /** - * Ticket document number. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). - */ - fun ticketDocumentNumber(): Optional = - ticketDocumentNumber.getOptional("ticket_document_number") + /** + * Returns a mutable builder for constructing an instance of + * [Service]. + * + * The following fields are required: + * ```java + * .category() + * .subCategory() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - /** - * Returns the raw JSON value of [connectedTicketDocumentNumber]. - * - * Unlike [connectedTicketDocumentNumber], this method doesn't throw if the - * JSON field has an unexpected type. - */ - @JsonProperty("connected_ticket_document_number") - @ExcludeMissing - fun _connectedTicketDocumentNumber(): JsonField = - connectedTicketDocumentNumber + /** A builder for [Service]. */ + class Builder internal constructor() { - /** - * Returns the raw JSON value of [creditReasonIndicator]. - * - * Unlike [creditReasonIndicator], this method doesn't throw if the JSON - * field has an unexpected type. - */ - @JsonProperty("credit_reason_indicator") - @ExcludeMissing - fun _creditReasonIndicator(): JsonField = - creditReasonIndicator + private var category: JsonField? = null + private var subCategory: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() - /** - * Returns the raw JSON value of [passengerNameOrDescription]. - * - * Unlike [passengerNameOrDescription], this method doesn't throw if the - * JSON field has an unexpected type. - */ - @JsonProperty("passenger_name_or_description") - @ExcludeMissing - fun _passengerNameOrDescription(): JsonField = - passengerNameOrDescription + @JvmSynthetic + internal fun from(service: Service) = apply { + category = service.category + subCategory = service.subCategory + additionalProperties = + service.additionalProperties.toMutableMap() + } - /** - * Returns the raw JSON value of [services]. - * - * Unlike [services], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("services") - @ExcludeMissing - fun _services(): JsonField> = services + /** Category of the ancillary service. */ + fun category(category: Category?) = + category(JsonField.ofNullable(category)) - /** - * Returns the raw JSON value of [ticketDocumentNumber]. - * - * Unlike [ticketDocumentNumber], this method doesn't throw if the JSON - * field has an unexpected type. - */ - @JsonProperty("ticket_document_number") - @ExcludeMissing - fun _ticketDocumentNumber(): JsonField = ticketDocumentNumber + /** + * Alias for calling [Builder.category] with + * `category.orElse(null)`. + */ + fun category(category: Optional) = + category(category.getOrNull()) - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** + * Sets [Builder.category] to an arbitrary JSON value. + * + * You should usually call [Builder.category] with a well-typed + * [Category] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ + fun category(category: JsonField) = apply { + this.category = category + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** Sub-category of the ancillary service, free-form. */ + fun subCategory(subCategory: String?) = + subCategory(JsonField.ofNullable(subCategory)) - fun toBuilder() = Builder().from(this) + /** + * Alias for calling [Builder.subCategory] with + * `subCategory.orElse(null)`. + */ + fun subCategory(subCategory: Optional) = + subCategory(subCategory.getOrNull()) - companion object { + /** + * Sets [Builder.subCategory] to an arbitrary JSON value. + * + * You should usually call [Builder.subCategory] with a well-typed + * [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun subCategory(subCategory: JsonField) = apply { + this.subCategory = subCategory + } - /** - * Returns a mutable builder for constructing an instance of - * [Ancillary]. - * - * The following fields are required: - * ```java - * .connectedTicketDocumentNumber() - * .creditReasonIndicator() - * .passengerNameOrDescription() - * .services() - * .ticketDocumentNumber() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + fun additionalProperties( + additionalProperties: Map + ) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** A builder for [Ancillary]. */ - class Builder internal constructor() { + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - private var connectedTicketDocumentNumber: JsonField? = null - private var creditReasonIndicator: JsonField? = - null - private var passengerNameOrDescription: JsonField? = null - private var services: JsonField>? = null - private var ticketDocumentNumber: JsonField? = null - private var additionalProperties: MutableMap = - mutableMapOf() + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } - @JvmSynthetic - internal fun from(ancillary: Ancillary) = apply { - connectedTicketDocumentNumber = - ancillary.connectedTicketDocumentNumber - creditReasonIndicator = ancillary.creditReasonIndicator - passengerNameOrDescription = ancillary.passengerNameOrDescription - services = ancillary.services.map { it.toMutableList() } - ticketDocumentNumber = ancillary.ticketDocumentNumber - additionalProperties = ancillary.additionalProperties.toMutableMap() + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Service]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + * + * The following fields are required: + * ```java + * .category() + * .subCategory() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Service = + Service( + checkRequired("category", category), + checkRequired("subCategory", subCategory), + additionalProperties.toMutableMap(), + ) } - /** - * If this purchase has a connection or relationship to another - * purchase, such as a baggage fee for a passenger transport ticket, - * this field should contain the ticket document number for the other - * purchase. - */ - fun connectedTicketDocumentNumber( - connectedTicketDocumentNumber: String? - ) = - connectedTicketDocumentNumber( - JsonField.ofNullable(connectedTicketDocumentNumber) - ) + private var validated: Boolean = false - /** - * Alias for calling [Builder.connectedTicketDocumentNumber] with - * `connectedTicketDocumentNumber.orElse(null)`. - */ - fun connectedTicketDocumentNumber( - connectedTicketDocumentNumber: Optional - ) = - connectedTicketDocumentNumber( - connectedTicketDocumentNumber.getOrNull() - ) + fun validate(): Service = apply { + if (validated) { + return@apply + } - /** - * Sets [Builder.connectedTicketDocumentNumber] to an arbitrary JSON - * value. - * - * You should usually call [Builder.connectedTicketDocumentNumber] with - * a well-typed [String] value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. - */ - fun connectedTicketDocumentNumber( - connectedTicketDocumentNumber: JsonField - ) = apply { - this.connectedTicketDocumentNumber = connectedTicketDocumentNumber + category().ifPresent { it.validate() } + subCategory() + validated = true } - /** Indicates the reason for a credit to the cardholder. */ - fun creditReasonIndicator( - creditReasonIndicator: CreditReasonIndicator? - ) = creditReasonIndicator(JsonField.ofNullable(creditReasonIndicator)) - - /** - * Alias for calling [Builder.creditReasonIndicator] with - * `creditReasonIndicator.orElse(null)`. - */ - fun creditReasonIndicator( - creditReasonIndicator: Optional - ) = creditReasonIndicator(creditReasonIndicator.getOrNull()) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } /** - * Sets [Builder.creditReasonIndicator] to an arbitrary JSON value. + * Returns a score indicating how many valid values are contained in + * this object recursively. * - * You should usually call [Builder.creditReasonIndicator] with a - * well-typed [CreditReasonIndicator] value instead. This method is - * primarily for setting the field to an undocumented or not yet - * supported value. + * Used for best match union deserialization. */ - fun creditReasonIndicator( - creditReasonIndicator: JsonField - ) = apply { this.creditReasonIndicator = creditReasonIndicator } - - /** Name of the passenger or description of the ancillary purchase. */ - fun passengerNameOrDescription(passengerNameOrDescription: String?) = - passengerNameOrDescription( - JsonField.ofNullable(passengerNameOrDescription) - ) + @JvmSynthetic + internal fun validity(): Int = + (category.asKnown().getOrNull()?.validity() ?: 0) + + (if (subCategory.asKnown().isPresent) 1 else 0) - /** - * Alias for calling [Builder.passengerNameOrDescription] with - * `passengerNameOrDescription.orElse(null)`. - */ - fun passengerNameOrDescription( - passengerNameOrDescription: Optional - ) = passengerNameOrDescription(passengerNameOrDescription.getOrNull()) + /** Category of the ancillary service. */ + class Category + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** - * Sets [Builder.passengerNameOrDescription] to an arbitrary JSON value. - * - * You should usually call [Builder.passengerNameOrDescription] with a - * well-typed [String] value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. - */ - fun passengerNameOrDescription( - passengerNameOrDescription: JsonField - ) = apply { - this.passengerNameOrDescription = passengerNameOrDescription - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized + * from data that doesn't match any known member, and you want to + * know that value. For example, if the SDK is on an older version + * than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** Additional travel charges, such as baggage fees. */ - fun services(services: List) = services(JsonField.of(services)) + companion object { - /** - * Sets [Builder.services] to an arbitrary JSON value. - * - * You should usually call [Builder.services] with a well-typed - * `List` value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. - */ - fun services(services: JsonField>) = apply { - this.services = services.map { it.toMutableList() } - } + /** None */ + @JvmField val NONE = of("none") - /** - * Adds a single [Service] to [services]. - * - * @throws IllegalStateException if the field was previously set to a - * non-list. - */ - fun addService(service: Service) = apply { - services = - (services ?: JsonField.of(mutableListOf())).also { - checkKnown("services", it).add(service) - } - } + /** Bundled service */ + @JvmField val BUNDLED_SERVICE = of("bundled_service") - /** Ticket document number. */ - fun ticketDocumentNumber(ticketDocumentNumber: String?) = - ticketDocumentNumber(JsonField.ofNullable(ticketDocumentNumber)) + /** Baggage fee */ + @JvmField val BAGGAGE_FEE = of("baggage_fee") - /** - * Alias for calling [Builder.ticketDocumentNumber] with - * `ticketDocumentNumber.orElse(null)`. - */ - fun ticketDocumentNumber(ticketDocumentNumber: Optional) = - ticketDocumentNumber(ticketDocumentNumber.getOrNull()) + /** Change fee */ + @JvmField val CHANGE_FEE = of("change_fee") - /** - * Sets [Builder.ticketDocumentNumber] to an arbitrary JSON value. - * - * You should usually call [Builder.ticketDocumentNumber] with a - * well-typed [String] value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. - */ - fun ticketDocumentNumber(ticketDocumentNumber: JsonField) = - apply { - this.ticketDocumentNumber = ticketDocumentNumber - } + /** Cargo */ + @JvmField val CARGO = of("cargo") - fun additionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** Carbon offset */ + @JvmField val CARBON_OFFSET = of("carbon_offset") - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** Frequent flyer */ + @JvmField val FREQUENT_FLYER = of("frequent_flyer") - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } + /** Gift card */ + @JvmField val GIFT_CARD = of("gift_card") - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** Ground transport */ + @JvmField val GROUND_TRANSPORT = of("ground_transport") - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** In-flight entertainment */ + @JvmField + val IN_FLIGHT_ENTERTAINMENT = of("in_flight_entertainment") - /** - * Returns an immutable instance of [Ancillary]. - * - * Further updates to this [Builder] will not mutate the returned - * instance. - * - * The following fields are required: - * ```java - * .connectedTicketDocumentNumber() - * .creditReasonIndicator() - * .passengerNameOrDescription() - * .services() - * .ticketDocumentNumber() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Ancillary = - Ancillary( - checkRequired( - "connectedTicketDocumentNumber", - connectedTicketDocumentNumber, - ), - checkRequired("creditReasonIndicator", creditReasonIndicator), - checkRequired( - "passengerNameOrDescription", - passengerNameOrDescription, - ), - checkRequired("services", services).map { it.toImmutable() }, - checkRequired("ticketDocumentNumber", ticketDocumentNumber), - additionalProperties.toMutableMap(), - ) - } + /** Lounge */ + @JvmField val LOUNGE = of("lounge") - private var validated: Boolean = false + /** Medical */ + @JvmField val MEDICAL = of("medical") - fun validate(): Ancillary = apply { - if (validated) { - return@apply - } + /** Meal beverage */ + @JvmField val MEAL_BEVERAGE = of("meal_beverage") - connectedTicketDocumentNumber() - creditReasonIndicator().ifPresent { it.validate() } - passengerNameOrDescription() - services().forEach { it.validate() } - ticketDocumentNumber() - validated = true - } + /** Other */ + @JvmField val OTHER = of("other") - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** Passenger assist fee */ + @JvmField val PASSENGER_ASSIST_FEE = of("passenger_assist_fee") - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (connectedTicketDocumentNumber.asKnown().isPresent) 1 else 0) + - (creditReasonIndicator.asKnown().getOrNull()?.validity() ?: 0) + - (if (passengerNameOrDescription.asKnown().isPresent) 1 else 0) + - (services.asKnown().getOrNull()?.sumOf { it.validity().toInt() } - ?: 0) + - (if (ticketDocumentNumber.asKnown().isPresent) 1 else 0) + /** Pets */ + @JvmField val PETS = of("pets") - /** Indicates the reason for a credit to the cardholder. */ - class CreditReasonIndicator - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** Seat fees */ + @JvmField val SEAT_FEES = of("seat_fees") - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from - * data that doesn't match any known member, and you want to know that - * value. For example, if the SDK is on an older version than the API, - * then the API may respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + /** Standby */ + @JvmField val STANDBY = of("standby") - companion object { + /** Service fee */ + @JvmField val SERVICE_FEE = of("service_fee") - /** No credit */ - @JvmField val NO_CREDIT = of("no_credit") + /** Store */ + @JvmField val STORE = of("store") - /** Passenger transport ancillary purchase cancellation */ - @JvmField - val PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = - of("passenger_transport_ancillary_purchase_cancellation") + /** Travel service */ + @JvmField val TRAVEL_SERVICE = of("travel_service") - /** - * Airline ticket and passenger transport ancillary purchase - * cancellation - */ - @JvmField - val AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = - of( - "airline_ticket_and_passenger_transport_ancillary_purchase_cancellation" - ) + /** Unaccompanied travel */ + @JvmField val UNACCOMPANIED_TRAVEL = of("unaccompanied_travel") - /** Other */ - @JvmField val OTHER = of("other") + /** Upgrades */ + @JvmField val UPGRADES = of("upgrades") - @JvmStatic - fun of(value: String) = CreditReasonIndicator(JsonField.of(value)) - } + /** Wi-fi */ + @JvmField val WIFI = of("wifi") + + @JvmStatic fun of(value: String) = Category(JsonField.of(value)) + } + + /** An enum containing [Category]'s known values. */ + enum class Known { + /** None */ + NONE, + /** Bundled service */ + BUNDLED_SERVICE, + /** Baggage fee */ + BAGGAGE_FEE, + /** Change fee */ + CHANGE_FEE, + /** Cargo */ + CARGO, + /** Carbon offset */ + CARBON_OFFSET, + /** Frequent flyer */ + FREQUENT_FLYER, + /** Gift card */ + GIFT_CARD, + /** Ground transport */ + GROUND_TRANSPORT, + /** In-flight entertainment */ + IN_FLIGHT_ENTERTAINMENT, + /** Lounge */ + LOUNGE, + /** Medical */ + MEDICAL, + /** Meal beverage */ + MEAL_BEVERAGE, + /** Other */ + OTHER, + /** Passenger assist fee */ + PASSENGER_ASSIST_FEE, + /** Pets */ + PETS, + /** Seat fees */ + SEAT_FEES, + /** Standby */ + STANDBY, + /** Service fee */ + SERVICE_FEE, + /** Store */ + STORE, + /** Travel service */ + TRAVEL_SERVICE, + /** Unaccompanied travel */ + UNACCOMPANIED_TRAVEL, + /** Upgrades */ + UPGRADES, + /** Wi-fi */ + WIFI, + } - /** An enum containing [CreditReasonIndicator]'s known values. */ - enum class Known { - /** No credit */ - NO_CREDIT, - /** Passenger transport ancillary purchase cancellation */ - PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, /** - * Airline ticket and passenger transport ancillary purchase - * cancellation + * An enum containing [Category]'s known values, as well as an + * [_UNKNOWN] member. + * + * An instance of [Category] can contain an unknown value in a + * couple of cases: + * - It was deserialized from data that doesn't match any known + * member. For example, if the SDK is on an older version than the + * API, then the API may respond with new members that the SDK is + * unaware of. + * - It was constructed with an arbitrary value using the [of] + * method. */ - AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, - /** Other */ - OTHER, - } + enum class Value { + /** None */ + NONE, + /** Bundled service */ + BUNDLED_SERVICE, + /** Baggage fee */ + BAGGAGE_FEE, + /** Change fee */ + CHANGE_FEE, + /** Cargo */ + CARGO, + /** Carbon offset */ + CARBON_OFFSET, + /** Frequent flyer */ + FREQUENT_FLYER, + /** Gift card */ + GIFT_CARD, + /** Ground transport */ + GROUND_TRANSPORT, + /** In-flight entertainment */ + IN_FLIGHT_ENTERTAINMENT, + /** Lounge */ + LOUNGE, + /** Medical */ + MEDICAL, + /** Meal beverage */ + MEAL_BEVERAGE, + /** Other */ + OTHER, + /** Passenger assist fee */ + PASSENGER_ASSIST_FEE, + /** Pets */ + PETS, + /** Seat fees */ + SEAT_FEES, + /** Standby */ + STANDBY, + /** Service fee */ + SERVICE_FEE, + /** Store */ + STORE, + /** Travel service */ + TRAVEL_SERVICE, + /** Unaccompanied travel */ + UNACCOMPANIED_TRAVEL, + /** Upgrades */ + UPGRADES, + /** Wi-fi */ + WIFI, + /** + * An enum member indicating that [Category] was instantiated + * with an unknown value. + */ + _UNKNOWN, + } - /** - * An enum containing [CreditReasonIndicator]'s known values, as well as - * an [_UNKNOWN] member. - * - * An instance of [CreditReasonIndicator] can contain an unknown value - * in a couple of cases: - * - It was deserialized from data that doesn't match any known member. - * For example, if the SDK is on an older version than the API, then - * the API may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** No credit */ - NO_CREDIT, - /** Passenger transport ancillary purchase cancellation */ - PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, /** - * Airline ticket and passenger transport ancillary purchase - * cancellation + * Returns an enum member corresponding to this class instance's + * value, or [Value._UNKNOWN] if the class was instantiated with an + * unknown value. + * + * Use the [known] method instead if you're certain the value is + * always known or if you want to throw for the unknown case. */ - AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, - /** Other */ - OTHER, + fun value(): Value = + when (this) { + NONE -> Value.NONE + BUNDLED_SERVICE -> Value.BUNDLED_SERVICE + BAGGAGE_FEE -> Value.BAGGAGE_FEE + CHANGE_FEE -> Value.CHANGE_FEE + CARGO -> Value.CARGO + CARBON_OFFSET -> Value.CARBON_OFFSET + FREQUENT_FLYER -> Value.FREQUENT_FLYER + GIFT_CARD -> Value.GIFT_CARD + GROUND_TRANSPORT -> Value.GROUND_TRANSPORT + IN_FLIGHT_ENTERTAINMENT -> Value.IN_FLIGHT_ENTERTAINMENT + LOUNGE -> Value.LOUNGE + MEDICAL -> Value.MEDICAL + MEAL_BEVERAGE -> Value.MEAL_BEVERAGE + OTHER -> Value.OTHER + PASSENGER_ASSIST_FEE -> Value.PASSENGER_ASSIST_FEE + PETS -> Value.PETS + SEAT_FEES -> Value.SEAT_FEES + STANDBY -> Value.STANDBY + SERVICE_FEE -> Value.SERVICE_FEE + STORE -> Value.STORE + TRAVEL_SERVICE -> Value.TRAVEL_SERVICE + UNACCOMPANIED_TRAVEL -> Value.UNACCOMPANIED_TRAVEL + UPGRADES -> Value.UPGRADES + WIFI -> Value.WIFI + else -> Value._UNKNOWN + } + /** - * An enum member indicating that [CreditReasonIndicator] was - * instantiated with an unknown value. + * Returns an enum member corresponding to this class instance's + * value. + * + * Use the [value] method instead if you're uncertain the value is + * always known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's + * value is a not a known member. */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, - * or [Value._UNKNOWN] if the class was instantiated with an unknown - * value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - NO_CREDIT -> Value.NO_CREDIT - PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> - Value.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION - AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> - Value - .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION - OTHER -> Value.OTHER - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is - * always known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value - * is a not a known member. - */ - fun known(): Known = - when (this) { - NO_CREDIT -> Known.NO_CREDIT - PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> - Known.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION - AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> - Known - .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION - OTHER -> Known.OTHER - else -> - throw IncreaseInvalidDataException( - "Unknown CreditReasonIndicator: $value" - ) - } + fun known(): Known = + when (this) { + NONE -> Known.NONE + BUNDLED_SERVICE -> Known.BUNDLED_SERVICE + BAGGAGE_FEE -> Known.BAGGAGE_FEE + CHANGE_FEE -> Known.CHANGE_FEE + CARGO -> Known.CARGO + CARBON_OFFSET -> Known.CARBON_OFFSET + FREQUENT_FLYER -> Known.FREQUENT_FLYER + GIFT_CARD -> Known.GIFT_CARD + GROUND_TRANSPORT -> Known.GROUND_TRANSPORT + IN_FLIGHT_ENTERTAINMENT -> Known.IN_FLIGHT_ENTERTAINMENT + LOUNGE -> Known.LOUNGE + MEDICAL -> Known.MEDICAL + MEAL_BEVERAGE -> Known.MEAL_BEVERAGE + OTHER -> Known.OTHER + PASSENGER_ASSIST_FEE -> Known.PASSENGER_ASSIST_FEE + PETS -> Known.PETS + SEAT_FEES -> Known.SEAT_FEES + STANDBY -> Known.STANDBY + SERVICE_FEE -> Known.SERVICE_FEE + STORE -> Known.STORE + TRAVEL_SERVICE -> Known.TRAVEL_SERVICE + UNACCOMPANIED_TRAVEL -> Known.UNACCOMPANIED_TRAVEL + UPGRADES -> Known.UPGRADES + WIFI -> Known.WIFI + else -> + throw IncreaseInvalidDataException( + "Unknown Category: $value" + ) + } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is - * primarily for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value - * does not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is + * primarily for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's + * value does not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - private var validated: Boolean = false + private var validated: Boolean = false - fun validate(): CreditReasonIndicator = apply { - if (validated) { - return@apply + fun validate(): Category = apply { + if (validated) { + return@apply + } + + known() + validated = true } - known() - validated = true - } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false + /** + * Returns a score indicating how many valid values are contained in + * this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Category && value == other.value } - /** - * Returns a score indicating how many valid values are contained in - * this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is CreditReasonIndicator && value == other.value + return other is Service && + category == other.category && + subCategory == other.subCategory && + additionalProperties == other.additionalProperties } - override fun hashCode() = value.hashCode() + private val hashCode: Int by lazy { + Objects.hash(category, subCategory, additionalProperties) + } - override fun toString() = value.toString() + override fun hashCode(): Int = hashCode + + override fun toString() = + "Service{category=$category, subCategory=$subCategory, additionalProperties=$additionalProperties}" } - class Service - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val category: JsonField, - private val subCategory: JsonField, - private val additionalProperties: MutableMap, - ) { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JsonCreator - private constructor( - @JsonProperty("category") - @ExcludeMissing - category: JsonField = JsonMissing.of(), - @JsonProperty("sub_category") - @ExcludeMissing - subCategory: JsonField = JsonMissing.of(), - ) : this(category, subCategory, mutableMapOf()) + return other is Ancillary && + connectedTicketDocumentNumber == + other.connectedTicketDocumentNumber && + creditReasonIndicator == other.creditReasonIndicator && + passengerNameOrDescription == other.passengerNameOrDescription && + services == other.services && + ticketDocumentNumber == other.ticketDocumentNumber && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + connectedTicketDocumentNumber, + creditReasonIndicator, + passengerNameOrDescription, + services, + ticketDocumentNumber, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Ancillary{connectedTicketDocumentNumber=$connectedTicketDocumentNumber, creditReasonIndicator=$creditReasonIndicator, passengerNameOrDescription=$passengerNameOrDescription, services=$services, ticketDocumentNumber=$ticketDocumentNumber, additionalProperties=$additionalProperties}" + } + + /** Indicates the reason for a credit to the cardholder. */ + class CreditReasonIndicator + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** No credit */ + @JvmField val NO_CREDIT = of("no_credit") + + /** Passenger transport ancillary purchase cancellation */ + @JvmField + val PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = + of("passenger_transport_ancillary_purchase_cancellation") /** - * Category of the ancillary service. - * - * @throws IncreaseInvalidDataException if the JSON field has an - * unexpected type (e.g. if the server responded with an unexpected - * value). + * Airline ticket and passenger transport ancillary purchase + * cancellation */ - fun category(): Optional = category.getOptional("category") + @JvmField + val AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = + of( + "airline_ticket_and_passenger_transport_ancillary_purchase_cancellation" + ) + + /** Airline ticket cancellation */ + @JvmField + val AIRLINE_TICKET_CANCELLATION = of("airline_ticket_cancellation") + + /** Other */ + @JvmField val OTHER = of("other") + + /** Partial refund of airline ticket */ + @JvmField + val PARTIAL_REFUND_OF_AIRLINE_TICKET = + of("partial_refund_of_airline_ticket") + + @JvmStatic + fun of(value: String) = CreditReasonIndicator(JsonField.of(value)) + } + /** An enum containing [CreditReasonIndicator]'s known values. */ + enum class Known { + /** No credit */ + NO_CREDIT, + /** Passenger transport ancillary purchase cancellation */ + PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, /** - * Sub-category of the ancillary service, free-form. - * - * @throws IncreaseInvalidDataException if the JSON field has an - * unexpected type (e.g. if the server responded with an unexpected - * value). + * Airline ticket and passenger transport ancillary purchase + * cancellation */ - fun subCategory(): Optional = - subCategory.getOptional("sub_category") + AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, + /** Airline ticket cancellation */ + AIRLINE_TICKET_CANCELLATION, + /** Other */ + OTHER, + /** Partial refund of airline ticket */ + PARTIAL_REFUND_OF_AIRLINE_TICKET, + } + /** + * An enum containing [CreditReasonIndicator]'s known values, as well as an + * [_UNKNOWN] member. + * + * An instance of [CreditReasonIndicator] can contain an unknown value in a + * couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** No credit */ + NO_CREDIT, + /** Passenger transport ancillary purchase cancellation */ + PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, /** - * Returns the raw JSON value of [category]. - * - * Unlike [category], this method doesn't throw if the JSON field has an - * unexpected type. + * Airline ticket and passenger transport ancillary purchase + * cancellation */ - @JsonProperty("category") - @ExcludeMissing - fun _category(): JsonField = category - + AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, + /** Airline ticket cancellation */ + AIRLINE_TICKET_CANCELLATION, + /** Other */ + OTHER, + /** Partial refund of airline ticket */ + PARTIAL_REFUND_OF_AIRLINE_TICKET, /** - * Returns the raw JSON value of [subCategory]. - * - * Unlike [subCategory], this method doesn't throw if the JSON field has - * an unexpected type. + * An enum member indicating that [CreditReasonIndicator] was + * instantiated with an unknown value. */ - @JsonProperty("sub_category") - @ExcludeMissing - fun _subCategory(): JsonField = subCategory + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NO_CREDIT -> Value.NO_CREDIT + PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> + Value.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION + AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> + Value + .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION + AIRLINE_TICKET_CANCELLATION -> Value.AIRLINE_TICKET_CANCELLATION + OTHER -> Value.OTHER + PARTIAL_REFUND_OF_AIRLINE_TICKET -> + Value.PARTIAL_REFUND_OF_AIRLINE_TICKET + else -> Value._UNKNOWN + } - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + NO_CREDIT -> Known.NO_CREDIT + PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> + Known.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION + AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> + Known + .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION + AIRLINE_TICKET_CANCELLATION -> Known.AIRLINE_TICKET_CANCELLATION + OTHER -> Known.OTHER + PARTIAL_REFUND_OF_AIRLINE_TICKET -> + Known.PARTIAL_REFUND_OF_AIRLINE_TICKET + else -> + throw IncreaseInvalidDataException( + "Unknown CreditReasonIndicator: $value" + ) } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - fun toBuilder() = Builder().from(this) + private var validated: Boolean = false - companion object { + fun validate(): CreditReasonIndicator = apply { + if (validated) { + return@apply + } - /** - * Returns a mutable builder for constructing an instance of - * [Service]. - * - * The following fields are required: - * ```java - * .category() - * .subCategory() - * ``` - */ - @JvmStatic fun builder() = Builder() + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false } - /** A builder for [Service]. */ - class Builder internal constructor() { + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - private var category: JsonField? = null - private var subCategory: JsonField? = null - private var additionalProperties: MutableMap = - mutableMapOf() + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmSynthetic - internal fun from(service: Service) = apply { - category = service.category - subCategory = service.subCategory - additionalProperties = - service.additionalProperties.toMutableMap() - } + return other is CreditReasonIndicator && value == other.value + } - /** Category of the ancillary service. */ - fun category(category: Category?) = - category(JsonField.ofNullable(category)) + override fun hashCode() = value.hashCode() - /** - * Alias for calling [Builder.category] with - * `category.orElse(null)`. - */ - fun category(category: Optional) = - category(category.getOrNull()) + override fun toString() = value.toString() + } - /** - * Sets [Builder.category] to an arbitrary JSON value. - * - * You should usually call [Builder.category] with a well-typed - * [Category] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. - */ - fun category(category: JsonField) = apply { - this.category = category - } + /** Indicates whether this ticket is non-refundable. */ + class RestrictedTicketIndicator + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** Sub-category of the ancillary service, free-form. */ - fun subCategory(subCategory: String?) = - subCategory(JsonField.ofNullable(subCategory)) + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** - * Alias for calling [Builder.subCategory] with - * `subCategory.orElse(null)`. - */ - fun subCategory(subCategory: Optional) = - subCategory(subCategory.getOrNull()) + companion object { - /** - * Sets [Builder.subCategory] to an arbitrary JSON value. - * - * You should usually call [Builder.subCategory] with a well-typed - * [String] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun subCategory(subCategory: JsonField) = apply { - this.subCategory = subCategory - } + /** No restrictions */ + @JvmField val NO_RESTRICTIONS = of("no_restrictions") - fun additionalProperties( - additionalProperties: Map - ) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** Restricted non-refundable ticket */ + @JvmField + val RESTRICTED_NON_REFUNDABLE_TICKET = + of("restricted_non_refundable_ticket") - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + @JvmStatic + fun of(value: String) = RestrictedTicketIndicator(JsonField.of(value)) + } - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } + /** An enum containing [RestrictedTicketIndicator]'s known values. */ + enum class Known { + /** No restrictions */ + NO_RESTRICTIONS, + /** Restricted non-refundable ticket */ + RESTRICTED_NON_REFUNDABLE_TICKET, + } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** + * An enum containing [RestrictedTicketIndicator]'s known values, as well as + * an [_UNKNOWN] member. + * + * An instance of [RestrictedTicketIndicator] can contain an unknown value + * in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** No restrictions */ + NO_RESTRICTIONS, + /** Restricted non-refundable ticket */ + RESTRICTED_NON_REFUNDABLE_TICKET, + /** + * An enum member indicating that [RestrictedTicketIndicator] was + * instantiated with an unknown value. + */ + _UNKNOWN, + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NO_RESTRICTIONS -> Value.NO_RESTRICTIONS + RESTRICTED_NON_REFUNDABLE_TICKET -> + Value.RESTRICTED_NON_REFUNDABLE_TICKET + else -> Value._UNKNOWN + } - /** - * Returns an immutable instance of [Service]. - * - * Further updates to this [Builder] will not mutate the returned - * instance. - * - * The following fields are required: - * ```java - * .category() - * .subCategory() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Service = - Service( - checkRequired("category", category), - checkRequired("subCategory", subCategory), - additionalProperties.toMutableMap(), + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + NO_RESTRICTIONS -> Known.NO_RESTRICTIONS + RESTRICTED_NON_REFUNDABLE_TICKET -> + Known.RESTRICTED_NON_REFUNDABLE_TICKET + else -> + throw IncreaseInvalidDataException( + "Unknown RestrictedTicketIndicator: $value" ) } - private var validated: Boolean = false - - fun validate(): Service = apply { - if (validated) { - return@apply - } - - category().ifPresent { it.validate() } - subCategory() - validated = true + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in - * this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (category.asKnown().getOrNull()?.validity() ?: 0) + - (if (subCategory.asKnown().isPresent) 1 else 0) - - /** Category of the ancillary service. */ - class Category - @JsonCreator - private constructor(private val value: JsonField) : Enum { + private var validated: Boolean = false - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized - * from data that doesn't match any known member, and you want to - * know that value. For example, if the SDK is on an older version - * than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + fun validate(): RestrictedTicketIndicator = apply { + if (validated) { + return@apply + } - companion object { + known() + validated = true + } - /** None */ - @JvmField val NONE = of("none") + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** Bundled service */ - @JvmField val BUNDLED_SERVICE = of("bundled_service") + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - /** Baggage fee */ - @JvmField val BAGGAGE_FEE = of("baggage_fee") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** Change fee */ - @JvmField val CHANGE_FEE = of("change_fee") + return other is RestrictedTicketIndicator && value == other.value + } - /** Cargo */ - @JvmField val CARGO = of("cargo") + override fun hashCode() = value.hashCode() - /** Carbon offset */ - @JvmField val CARBON_OFFSET = of("carbon_offset") + override fun toString() = value.toString() + } - /** Frequent flyer */ - @JvmField val FREQUENT_FLYER = of("frequent_flyer") + /** Indicates why a ticket was changed. */ + class TicketChangeIndicator + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** Gift card */ - @JvmField val GIFT_CARD = of("gift_card") + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** Ground transport */ - @JvmField val GROUND_TRANSPORT = of("ground_transport") + companion object { - /** In-flight entertainment */ - @JvmField - val IN_FLIGHT_ENTERTAINMENT = of("in_flight_entertainment") + /** None */ + @JvmField val NONE = of("none") - /** Lounge */ - @JvmField val LOUNGE = of("lounge") + /** Change to existing ticket */ + @JvmField + val CHANGE_TO_EXISTING_TICKET = of("change_to_existing_ticket") - /** Medical */ - @JvmField val MEDICAL = of("medical") + /** New ticket */ + @JvmField val NEW_TICKET = of("new_ticket") - /** Meal beverage */ - @JvmField val MEAL_BEVERAGE = of("meal_beverage") + @JvmStatic + fun of(value: String) = TicketChangeIndicator(JsonField.of(value)) + } - /** Other */ - @JvmField val OTHER = of("other") + /** An enum containing [TicketChangeIndicator]'s known values. */ + enum class Known { + /** None */ + NONE, + /** Change to existing ticket */ + CHANGE_TO_EXISTING_TICKET, + /** New ticket */ + NEW_TICKET, + } - /** Passenger assist fee */ - @JvmField val PASSENGER_ASSIST_FEE = of("passenger_assist_fee") + /** + * An enum containing [TicketChangeIndicator]'s known values, as well as an + * [_UNKNOWN] member. + * + * An instance of [TicketChangeIndicator] can contain an unknown value in a + * couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** None */ + NONE, + /** Change to existing ticket */ + CHANGE_TO_EXISTING_TICKET, + /** New ticket */ + NEW_TICKET, + /** + * An enum member indicating that [TicketChangeIndicator] was + * instantiated with an unknown value. + */ + _UNKNOWN, + } - /** Pets */ - @JvmField val PETS = of("pets") + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NONE -> Value.NONE + CHANGE_TO_EXISTING_TICKET -> Value.CHANGE_TO_EXISTING_TICKET + NEW_TICKET -> Value.NEW_TICKET + else -> Value._UNKNOWN + } - /** Seat fees */ - @JvmField val SEAT_FEES = of("seat_fees") + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + NONE -> Known.NONE + CHANGE_TO_EXISTING_TICKET -> Known.CHANGE_TO_EXISTING_TICKET + NEW_TICKET -> Known.NEW_TICKET + else -> + throw IncreaseInvalidDataException( + "Unknown TicketChangeIndicator: $value" + ) + } - /** Standby */ - @JvmField val STANDBY = of("standby") + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - /** Service fee */ - @JvmField val SERVICE_FEE = of("service_fee") + private var validated: Boolean = false - /** Store */ - @JvmField val STORE = of("store") + fun validate(): TicketChangeIndicator = apply { + if (validated) { + return@apply + } - /** Travel service */ - @JvmField val TRAVEL_SERVICE = of("travel_service") + known() + validated = true + } - /** Unaccompanied travel */ - @JvmField val UNACCOMPANIED_TRAVEL = of("unaccompanied_travel") + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** Upgrades */ - @JvmField val UPGRADES = of("upgrades") + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - /** Wi-fi */ - @JvmField val WIFI = of("wifi") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmStatic fun of(value: String) = Category(JsonField.of(value)) - } + return other is TicketChangeIndicator && value == other.value + } - /** An enum containing [Category]'s known values. */ - enum class Known { - /** None */ - NONE, - /** Bundled service */ - BUNDLED_SERVICE, - /** Baggage fee */ - BAGGAGE_FEE, - /** Change fee */ - CHANGE_FEE, - /** Cargo */ - CARGO, - /** Carbon offset */ - CARBON_OFFSET, - /** Frequent flyer */ - FREQUENT_FLYER, - /** Gift card */ - GIFT_CARD, - /** Ground transport */ - GROUND_TRANSPORT, - /** In-flight entertainment */ - IN_FLIGHT_ENTERTAINMENT, - /** Lounge */ - LOUNGE, - /** Medical */ - MEDICAL, - /** Meal beverage */ - MEAL_BEVERAGE, - /** Other */ - OTHER, - /** Passenger assist fee */ - PASSENGER_ASSIST_FEE, - /** Pets */ - PETS, - /** Seat fees */ - SEAT_FEES, - /** Standby */ - STANDBY, - /** Service fee */ - SERVICE_FEE, - /** Store */ - STORE, - /** Travel service */ - TRAVEL_SERVICE, - /** Unaccompanied travel */ - UNACCOMPANIED_TRAVEL, - /** Upgrades */ - UPGRADES, - /** Wi-fi */ - WIFI, - } + override fun hashCode() = value.hashCode() - /** - * An enum containing [Category]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [Category] can contain an unknown value in a - * couple of cases: - * - It was deserialized from data that doesn't match any known - * member. For example, if the SDK is on an older version than the - * API, then the API may respond with new members that the SDK is - * unaware of. - * - It was constructed with an arbitrary value using the [of] - * method. - */ - enum class Value { - /** None */ - NONE, - /** Bundled service */ - BUNDLED_SERVICE, - /** Baggage fee */ - BAGGAGE_FEE, - /** Change fee */ - CHANGE_FEE, - /** Cargo */ - CARGO, - /** Carbon offset */ - CARBON_OFFSET, - /** Frequent flyer */ - FREQUENT_FLYER, - /** Gift card */ - GIFT_CARD, - /** Ground transport */ - GROUND_TRANSPORT, - /** In-flight entertainment */ - IN_FLIGHT_ENTERTAINMENT, - /** Lounge */ - LOUNGE, - /** Medical */ - MEDICAL, - /** Meal beverage */ - MEAL_BEVERAGE, - /** Other */ - OTHER, - /** Passenger assist fee */ - PASSENGER_ASSIST_FEE, - /** Pets */ - PETS, - /** Seat fees */ - SEAT_FEES, - /** Standby */ - STANDBY, - /** Service fee */ - SERVICE_FEE, - /** Store */ - STORE, - /** Travel service */ - TRAVEL_SERVICE, - /** Unaccompanied travel */ - UNACCOMPANIED_TRAVEL, - /** Upgrades */ - UPGRADES, - /** Wi-fi */ - WIFI, - /** - * An enum member indicating that [Category] was instantiated - * with an unknown value. - */ - _UNKNOWN, - } + override fun toString() = value.toString() + } - /** - * Returns an enum member corresponding to this class instance's - * value, or [Value._UNKNOWN] if the class was instantiated with an - * unknown value. - * - * Use the [known] method instead if you're certain the value is - * always known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - NONE -> Value.NONE - BUNDLED_SERVICE -> Value.BUNDLED_SERVICE - BAGGAGE_FEE -> Value.BAGGAGE_FEE - CHANGE_FEE -> Value.CHANGE_FEE - CARGO -> Value.CARGO - CARBON_OFFSET -> Value.CARBON_OFFSET - FREQUENT_FLYER -> Value.FREQUENT_FLYER - GIFT_CARD -> Value.GIFT_CARD - GROUND_TRANSPORT -> Value.GROUND_TRANSPORT - IN_FLIGHT_ENTERTAINMENT -> Value.IN_FLIGHT_ENTERTAINMENT - LOUNGE -> Value.LOUNGE - MEDICAL -> Value.MEDICAL - MEAL_BEVERAGE -> Value.MEAL_BEVERAGE - OTHER -> Value.OTHER - PASSENGER_ASSIST_FEE -> Value.PASSENGER_ASSIST_FEE - PETS -> Value.PETS - SEAT_FEES -> Value.SEAT_FEES - STANDBY -> Value.STANDBY - SERVICE_FEE -> Value.SERVICE_FEE - STORE -> Value.STORE - TRAVEL_SERVICE -> Value.TRAVEL_SERVICE - UNACCOMPANIED_TRAVEL -> Value.UNACCOMPANIED_TRAVEL - UPGRADES -> Value.UPGRADES - WIFI -> Value.WIFI - else -> Value._UNKNOWN - } + class TripLeg + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val carrierCode: JsonField, + private val destinationCityAirportCode: JsonField, + private val fareBasisCode: JsonField, + private val flightNumber: JsonField, + private val serviceClass: JsonField, + private val stopOverCode: JsonField, + private val additionalProperties: MutableMap, + ) { - /** - * Returns an enum member corresponding to this class instance's - * value. - * - * Use the [value] method instead if you're uncertain the value is - * always known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's - * value is a not a known member. - */ - fun known(): Known = - when (this) { - NONE -> Known.NONE - BUNDLED_SERVICE -> Known.BUNDLED_SERVICE - BAGGAGE_FEE -> Known.BAGGAGE_FEE - CHANGE_FEE -> Known.CHANGE_FEE - CARGO -> Known.CARGO - CARBON_OFFSET -> Known.CARBON_OFFSET - FREQUENT_FLYER -> Known.FREQUENT_FLYER - GIFT_CARD -> Known.GIFT_CARD - GROUND_TRANSPORT -> Known.GROUND_TRANSPORT - IN_FLIGHT_ENTERTAINMENT -> Known.IN_FLIGHT_ENTERTAINMENT - LOUNGE -> Known.LOUNGE - MEDICAL -> Known.MEDICAL - MEAL_BEVERAGE -> Known.MEAL_BEVERAGE - OTHER -> Known.OTHER - PASSENGER_ASSIST_FEE -> Known.PASSENGER_ASSIST_FEE - PETS -> Known.PETS - SEAT_FEES -> Known.SEAT_FEES - STANDBY -> Known.STANDBY - SERVICE_FEE -> Known.SERVICE_FEE - STORE -> Known.STORE - TRAVEL_SERVICE -> Known.TRAVEL_SERVICE - UNACCOMPANIED_TRAVEL -> Known.UNACCOMPANIED_TRAVEL - UPGRADES -> Known.UPGRADES - WIFI -> Known.WIFI - else -> - throw IncreaseInvalidDataException( - "Unknown Category: $value" - ) - } + @JsonCreator + private constructor( + @JsonProperty("carrier_code") + @ExcludeMissing + carrierCode: JsonField = JsonMissing.of(), + @JsonProperty("destination_city_airport_code") + @ExcludeMissing + destinationCityAirportCode: JsonField = JsonMissing.of(), + @JsonProperty("fare_basis_code") + @ExcludeMissing + fareBasisCode: JsonField = JsonMissing.of(), + @JsonProperty("flight_number") + @ExcludeMissing + flightNumber: JsonField = JsonMissing.of(), + @JsonProperty("service_class") + @ExcludeMissing + serviceClass: JsonField = JsonMissing.of(), + @JsonProperty("stop_over_code") + @ExcludeMissing + stopOverCode: JsonField = JsonMissing.of(), + ) : this( + carrierCode, + destinationCityAirportCode, + fareBasisCode, + flightNumber, + serviceClass, + stopOverCode, + mutableMapOf(), + ) - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is - * primarily for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's - * value does not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + /** + * Carrier code (e.g., United Airlines, Jet Blue, etc.). + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun carrierCode(): Optional = + carrierCode.getOptional("carrier_code") - private var validated: Boolean = false + /** + * Code for the destination city or airport. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun destinationCityAirportCode(): Optional = + destinationCityAirportCode.getOptional("destination_city_airport_code") - fun validate(): Category = apply { - if (validated) { - return@apply - } + /** + * Fare basis code. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun fareBasisCode(): Optional = + fareBasisCode.getOptional("fare_basis_code") - known() - validated = true - } + /** + * Flight number. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun flightNumber(): Optional = + flightNumber.getOptional("flight_number") - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * Service class (e.g., first class, business class, etc.). + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun serviceClass(): Optional = + serviceClass.getOptional("service_class") - /** - * Returns a score indicating how many valid values are contained in - * this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - if (value() == Value._UNKNOWN) 0 else 1 + /** + * Indicates whether a stopover is allowed on this ticket. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun stopOverCode(): Optional = + stopOverCode.getOptional("stop_over_code") - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Returns the raw JSON value of [carrierCode]. + * + * Unlike [carrierCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("carrier_code") + @ExcludeMissing + fun _carrierCode(): JsonField = carrierCode - return other is Category && value == other.value - } + /** + * Returns the raw JSON value of [destinationCityAirportCode]. + * + * Unlike [destinationCityAirportCode], this method doesn't throw if the + * JSON field has an unexpected type. + */ + @JsonProperty("destination_city_airport_code") + @ExcludeMissing + fun _destinationCityAirportCode(): JsonField = + destinationCityAirportCode - override fun hashCode() = value.hashCode() + /** + * Returns the raw JSON value of [fareBasisCode]. + * + * Unlike [fareBasisCode], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("fare_basis_code") + @ExcludeMissing + fun _fareBasisCode(): JsonField = fareBasisCode - override fun toString() = value.toString() - } + /** + * Returns the raw JSON value of [flightNumber]. + * + * Unlike [flightNumber], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("flight_number") + @ExcludeMissing + fun _flightNumber(): JsonField = flightNumber - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Returns the raw JSON value of [serviceClass]. + * + * Unlike [serviceClass], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("service_class") + @ExcludeMissing + fun _serviceClass(): JsonField = serviceClass - return other is Service && - category == other.category && - subCategory == other.subCategory && - additionalProperties == other.additionalProperties - } + /** + * Returns the raw JSON value of [stopOverCode]. + * + * Unlike [stopOverCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("stop_over_code") + @ExcludeMissing + fun _stopOverCode(): JsonField = stopOverCode - private val hashCode: Int by lazy { - Objects.hash(category, subCategory, additionalProperties) - } + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - override fun hashCode(): Int = hashCode + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - override fun toString() = - "Service{category=$category, subCategory=$subCategory, additionalProperties=$additionalProperties}" - } + fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + companion object { - return other is Ancillary && - connectedTicketDocumentNumber == - other.connectedTicketDocumentNumber && - creditReasonIndicator == other.creditReasonIndicator && - passengerNameOrDescription == other.passengerNameOrDescription && - services == other.services && - ticketDocumentNumber == other.ticketDocumentNumber && - additionalProperties == other.additionalProperties + /** + * Returns a mutable builder for constructing an instance of [TripLeg]. + * + * The following fields are required: + * ```java + * .carrierCode() + * .destinationCityAirportCode() + * .fareBasisCode() + * .flightNumber() + * .serviceClass() + * .stopOverCode() + * ``` + */ + @JvmStatic fun builder() = Builder() } - private val hashCode: Int by lazy { - Objects.hash( - connectedTicketDocumentNumber, - creditReasonIndicator, - passengerNameOrDescription, - services, - ticketDocumentNumber, - additionalProperties, - ) - } + /** A builder for [TripLeg]. */ + class Builder internal constructor() { - override fun hashCode(): Int = hashCode + private var carrierCode: JsonField? = null + private var destinationCityAirportCode: JsonField? = null + private var fareBasisCode: JsonField? = null + private var flightNumber: JsonField? = null + private var serviceClass: JsonField? = null + private var stopOverCode: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(tripLeg: TripLeg) = apply { + carrierCode = tripLeg.carrierCode + destinationCityAirportCode = tripLeg.destinationCityAirportCode + fareBasisCode = tripLeg.fareBasisCode + flightNumber = tripLeg.flightNumber + serviceClass = tripLeg.serviceClass + stopOverCode = tripLeg.stopOverCode + additionalProperties = tripLeg.additionalProperties.toMutableMap() + } + + /** Carrier code (e.g., United Airlines, Jet Blue, etc.). */ + fun carrierCode(carrierCode: String?) = + carrierCode(JsonField.ofNullable(carrierCode)) + + /** + * Alias for calling [Builder.carrierCode] with + * `carrierCode.orElse(null)`. + */ + fun carrierCode(carrierCode: Optional) = + carrierCode(carrierCode.getOrNull()) - override fun toString() = - "Ancillary{connectedTicketDocumentNumber=$connectedTicketDocumentNumber, creditReasonIndicator=$creditReasonIndicator, passengerNameOrDescription=$passengerNameOrDescription, services=$services, ticketDocumentNumber=$ticketDocumentNumber, additionalProperties=$additionalProperties}" - } + /** + * Sets [Builder.carrierCode] to an arbitrary JSON value. + * + * You should usually call [Builder.carrierCode] with a well-typed + * [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun carrierCode(carrierCode: JsonField) = apply { + this.carrierCode = carrierCode + } - /** Indicates the reason for a credit to the cardholder. */ - class CreditReasonIndicator - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** Code for the destination city or airport. */ + fun destinationCityAirportCode(destinationCityAirportCode: String?) = + destinationCityAirportCode( + JsonField.ofNullable(destinationCityAirportCode) + ) - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + /** + * Alias for calling [Builder.destinationCityAirportCode] with + * `destinationCityAirportCode.orElse(null)`. + */ + fun destinationCityAirportCode( + destinationCityAirportCode: Optional + ) = destinationCityAirportCode(destinationCityAirportCode.getOrNull()) - companion object { + /** + * Sets [Builder.destinationCityAirportCode] to an arbitrary JSON value. + * + * You should usually call [Builder.destinationCityAirportCode] with a + * well-typed [String] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ + fun destinationCityAirportCode( + destinationCityAirportCode: JsonField + ) = apply { + this.destinationCityAirportCode = destinationCityAirportCode + } - /** No credit */ - @JvmField val NO_CREDIT = of("no_credit") + /** Fare basis code. */ + fun fareBasisCode(fareBasisCode: String?) = + fareBasisCode(JsonField.ofNullable(fareBasisCode)) - /** Passenger transport ancillary purchase cancellation */ - @JvmField - val PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = - of("passenger_transport_ancillary_purchase_cancellation") + /** + * Alias for calling [Builder.fareBasisCode] with + * `fareBasisCode.orElse(null)`. + */ + fun fareBasisCode(fareBasisCode: Optional) = + fareBasisCode(fareBasisCode.getOrNull()) /** - * Airline ticket and passenger transport ancillary purchase - * cancellation + * Sets [Builder.fareBasisCode] to an arbitrary JSON value. + * + * You should usually call [Builder.fareBasisCode] with a well-typed + * [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - @JvmField - val AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = - of( - "airline_ticket_and_passenger_transport_ancillary_purchase_cancellation" - ) + fun fareBasisCode(fareBasisCode: JsonField) = apply { + this.fareBasisCode = fareBasisCode + } - /** Airline ticket cancellation */ - @JvmField - val AIRLINE_TICKET_CANCELLATION = of("airline_ticket_cancellation") + /** Flight number. */ + fun flightNumber(flightNumber: String?) = + flightNumber(JsonField.ofNullable(flightNumber)) - /** Other */ - @JvmField val OTHER = of("other") + /** + * Alias for calling [Builder.flightNumber] with + * `flightNumber.orElse(null)`. + */ + fun flightNumber(flightNumber: Optional) = + flightNumber(flightNumber.getOrNull()) - /** Partial refund of airline ticket */ - @JvmField - val PARTIAL_REFUND_OF_AIRLINE_TICKET = - of("partial_refund_of_airline_ticket") + /** + * Sets [Builder.flightNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.flightNumber] with a well-typed + * [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun flightNumber(flightNumber: JsonField) = apply { + this.flightNumber = flightNumber + } - @JvmStatic - fun of(value: String) = CreditReasonIndicator(JsonField.of(value)) - } + /** Service class (e.g., first class, business class, etc.). */ + fun serviceClass(serviceClass: String?) = + serviceClass(JsonField.ofNullable(serviceClass)) - /** An enum containing [CreditReasonIndicator]'s known values. */ - enum class Known { - /** No credit */ - NO_CREDIT, - /** Passenger transport ancillary purchase cancellation */ - PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, /** - * Airline ticket and passenger transport ancillary purchase - * cancellation + * Alias for calling [Builder.serviceClass] with + * `serviceClass.orElse(null)`. */ - AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, - /** Airline ticket cancellation */ - AIRLINE_TICKET_CANCELLATION, - /** Other */ - OTHER, - /** Partial refund of airline ticket */ - PARTIAL_REFUND_OF_AIRLINE_TICKET, - } + fun serviceClass(serviceClass: Optional) = + serviceClass(serviceClass.getOrNull()) - /** - * An enum containing [CreditReasonIndicator]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [CreditReasonIndicator] can contain an unknown value in a - * couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** No credit */ - NO_CREDIT, - /** Passenger transport ancillary purchase cancellation */ - PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, /** - * Airline ticket and passenger transport ancillary purchase - * cancellation + * Sets [Builder.serviceClass] to an arbitrary JSON value. + * + * You should usually call [Builder.serviceClass] with a well-typed + * [String] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION, - /** Airline ticket cancellation */ - AIRLINE_TICKET_CANCELLATION, - /** Other */ - OTHER, - /** Partial refund of airline ticket */ - PARTIAL_REFUND_OF_AIRLINE_TICKET, + fun serviceClass(serviceClass: JsonField) = apply { + this.serviceClass = serviceClass + } + + /** Indicates whether a stopover is allowed on this ticket. */ + fun stopOverCode(stopOverCode: StopOverCode?) = + stopOverCode(JsonField.ofNullable(stopOverCode)) + /** - * An enum member indicating that [CreditReasonIndicator] was - * instantiated with an unknown value. + * Alias for calling [Builder.stopOverCode] with + * `stopOverCode.orElse(null)`. */ - _UNKNOWN, - } + fun stopOverCode(stopOverCode: Optional) = + stopOverCode(stopOverCode.getOrNull()) - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - NO_CREDIT -> Value.NO_CREDIT - PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> - Value.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION - AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> - Value - .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION - AIRLINE_TICKET_CANCELLATION -> Value.AIRLINE_TICKET_CANCELLATION - OTHER -> Value.OTHER - PARTIAL_REFUND_OF_AIRLINE_TICKET -> - Value.PARTIAL_REFUND_OF_AIRLINE_TICKET - else -> Value._UNKNOWN + /** + * Sets [Builder.stopOverCode] to an arbitrary JSON value. + * + * You should usually call [Builder.stopOverCode] with a well-typed + * [StopOverCode] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ + fun stopOverCode(stopOverCode: JsonField) = apply { + this.stopOverCode = stopOverCode } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - NO_CREDIT -> Known.NO_CREDIT - PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> - Known.PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION - AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION -> - Known - .AIRLINE_TICKET_AND_PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION - AIRLINE_TICKET_CANCELLATION -> Known.AIRLINE_TICKET_CANCELLATION - OTHER -> Known.OTHER - PARTIAL_REFUND_OF_AIRLINE_TICKET -> - Known.PARTIAL_REFUND_OF_AIRLINE_TICKET - else -> - throw IncreaseInvalidDataException( - "Unknown CreditReasonIndicator: $value" - ) + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [TripLeg]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + * + * The following fields are required: + * ```java + * .carrierCode() + * .destinationCityAirportCode() + * .fareBasisCode() + * .flightNumber() + * .serviceClass() + * .stopOverCode() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): TripLeg = + TripLeg( + checkRequired("carrierCode", carrierCode), + checkRequired( + "destinationCityAirportCode", + destinationCityAirportCode, + ), + checkRequired("fareBasisCode", fareBasisCode), + checkRequired("flightNumber", flightNumber), + checkRequired("serviceClass", serviceClass), + checkRequired("stopOverCode", stopOverCode), + additionalProperties.toMutableMap(), + ) + } + private var validated: Boolean = false - fun validate(): CreditReasonIndicator = apply { + fun validate(): TripLeg = apply { if (validated) { return@apply } - known() + carrierCode() + destinationCityAirportCode() + fareBasisCode() + flightNumber() + serviceClass() + stopOverCode().ifPresent { it.validate() } validated = true } @@ -36946,1002 +40507,1569 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CreditReasonIndicator && value == other.value - } + internal fun validity(): Int = + (if (carrierCode.asKnown().isPresent) 1 else 0) + + (if (destinationCityAirportCode.asKnown().isPresent) 1 else 0) + + (if (fareBasisCode.asKnown().isPresent) 1 else 0) + + (if (flightNumber.asKnown().isPresent) 1 else 0) + + (if (serviceClass.asKnown().isPresent) 1 else 0) + + (stopOverCode.asKnown().getOrNull()?.validity() ?: 0) - override fun hashCode() = value.hashCode() + /** Indicates whether a stopover is allowed on this ticket. */ + class StopOverCode + @JsonCreator + private constructor(private val value: JsonField) : Enum { - override fun toString() = value.toString() - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from + * data that doesn't match any known member, and you want to know that + * value. For example, if the SDK is on an older version than the API, + * then the API may respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** Indicates whether this ticket is non-refundable. */ - class RestrictedTicketIndicator - @JsonCreator - private constructor(private val value: JsonField) : Enum { + companion object { - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + /** None */ + @JvmField val NONE = of("none") - companion object { + /** Stop over allowed */ + @JvmField val STOP_OVER_ALLOWED = of("stop_over_allowed") - /** No restrictions */ - @JvmField val NO_RESTRICTIONS = of("no_restrictions") + /** Stop over not allowed */ + @JvmField val STOP_OVER_NOT_ALLOWED = of("stop_over_not_allowed") - /** Restricted non-refundable ticket */ - @JvmField - val RESTRICTED_NON_REFUNDABLE_TICKET = - of("restricted_non_refundable_ticket") + @JvmStatic fun of(value: String) = StopOverCode(JsonField.of(value)) + } - @JvmStatic - fun of(value: String) = RestrictedTicketIndicator(JsonField.of(value)) - } + /** An enum containing [StopOverCode]'s known values. */ + enum class Known { + /** None */ + NONE, + /** Stop over allowed */ + STOP_OVER_ALLOWED, + /** Stop over not allowed */ + STOP_OVER_NOT_ALLOWED, + } - /** An enum containing [RestrictedTicketIndicator]'s known values. */ - enum class Known { - /** No restrictions */ - NO_RESTRICTIONS, - /** Restricted non-refundable ticket */ - RESTRICTED_NON_REFUNDABLE_TICKET, - } + /** + * An enum containing [StopOverCode]'s known values, as well as an + * [_UNKNOWN] member. + * + * An instance of [StopOverCode] can contain an unknown value in a + * couple of cases: + * - It was deserialized from data that doesn't match any known member. + * For example, if the SDK is on an older version than the API, then + * the API may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** None */ + NONE, + /** Stop over allowed */ + STOP_OVER_ALLOWED, + /** Stop over not allowed */ + STOP_OVER_NOT_ALLOWED, + /** + * An enum member indicating that [StopOverCode] was instantiated + * with an unknown value. + */ + _UNKNOWN, + } - /** - * An enum containing [RestrictedTicketIndicator]'s known values, as well as - * an [_UNKNOWN] member. - * - * An instance of [RestrictedTicketIndicator] can contain an unknown value - * in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** No restrictions */ - NO_RESTRICTIONS, - /** Restricted non-refundable ticket */ - RESTRICTED_NON_REFUNDABLE_TICKET, /** - * An enum member indicating that [RestrictedTicketIndicator] was - * instantiated with an unknown value. + * Returns an enum member corresponding to this class instance's value, + * or [Value._UNKNOWN] if the class was instantiated with an unknown + * value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. */ - _UNKNOWN, - } + fun value(): Value = + when (this) { + NONE -> Value.NONE + STOP_OVER_ALLOWED -> Value.STOP_OVER_ALLOWED + STOP_OVER_NOT_ALLOWED -> Value.STOP_OVER_NOT_ALLOWED + else -> Value._UNKNOWN + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - NO_RESTRICTIONS -> Value.NO_RESTRICTIONS - RESTRICTED_NON_REFUNDABLE_TICKET -> - Value.RESTRICTED_NON_REFUNDABLE_TICKET - else -> Value._UNKNOWN - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is + * always known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value + * is a not a known member. + */ + fun known(): Known = + when (this) { + NONE -> Known.NONE + STOP_OVER_ALLOWED -> Known.STOP_OVER_ALLOWED + STOP_OVER_NOT_ALLOWED -> Known.STOP_OVER_NOT_ALLOWED + else -> + throw IncreaseInvalidDataException( + "Unknown StopOverCode: $value" + ) + } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - NO_RESTRICTIONS -> Known.NO_RESTRICTIONS - RESTRICTED_NON_REFUNDABLE_TICKET -> - Known.RESTRICTED_NON_REFUNDABLE_TICKET - else -> - throw IncreaseInvalidDataException( - "Unknown RestrictedTicketIndicator: $value" - ) - } + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is + * primarily for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value + * does not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + private var validated: Boolean = false - private var validated: Boolean = false + fun validate(): StopOverCode = apply { + if (validated) { + return@apply + } - fun validate(): RestrictedTicketIndicator = apply { - if (validated) { - return@apply + known() + validated = true } - known() - validated = true - } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false + /** + * Returns a score indicating how many valid values are contained in + * this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is StopOverCode && value == other.value } - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is RestrictedTicketIndicator && value == other.value + return other is TripLeg && + carrierCode == other.carrierCode && + destinationCityAirportCode == other.destinationCityAirportCode && + fareBasisCode == other.fareBasisCode && + flightNumber == other.flightNumber && + serviceClass == other.serviceClass && + stopOverCode == other.stopOverCode && + additionalProperties == other.additionalProperties } - override fun hashCode() = value.hashCode() + private val hashCode: Int by lazy { + Objects.hash( + carrierCode, + destinationCityAirportCode, + fareBasisCode, + flightNumber, + serviceClass, + stopOverCode, + additionalProperties, + ) + } - override fun toString() = value.toString() + override fun hashCode(): Int = hashCode + + override fun toString() = + "TripLeg{carrierCode=$carrierCode, destinationCityAirportCode=$destinationCityAirportCode, fareBasisCode=$fareBasisCode, flightNumber=$flightNumber, serviceClass=$serviceClass, stopOverCode=$stopOverCode, additionalProperties=$additionalProperties}" } - /** Indicates why a ticket was changed. */ - class TicketChangeIndicator - @JsonCreator - private constructor(private val value: JsonField) : Enum { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + return other is Travel && + ancillary == other.ancillary && + computerizedReservationSystem == other.computerizedReservationSystem && + creditReasonIndicator == other.creditReasonIndicator && + departureDate == other.departureDate && + originationCityAirportCode == other.originationCityAirportCode && + passengerName == other.passengerName && + restrictedTicketIndicator == other.restrictedTicketIndicator && + ticketChangeIndicator == other.ticketChangeIndicator && + ticketNumber == other.ticketNumber && + travelAgencyCode == other.travelAgencyCode && + travelAgencyName == other.travelAgencyName && + tripLegs == other.tripLegs && + additionalProperties == other.additionalProperties + } - companion object { + private val hashCode: Int by lazy { + Objects.hash( + ancillary, + computerizedReservationSystem, + creditReasonIndicator, + departureDate, + originationCityAirportCode, + passengerName, + restrictedTicketIndicator, + ticketChangeIndicator, + ticketNumber, + travelAgencyCode, + travelAgencyName, + tripLegs, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Travel{ancillary=$ancillary, computerizedReservationSystem=$computerizedReservationSystem, creditReasonIndicator=$creditReasonIndicator, departureDate=$departureDate, originationCityAirportCode=$originationCityAirportCode, passengerName=$passengerName, restrictedTicketIndicator=$restrictedTicketIndicator, ticketChangeIndicator=$ticketChangeIndicator, ticketNumber=$ticketNumber, travelAgencyCode=$travelAgencyCode, travelAgencyName=$travelAgencyName, tripLegs=$tripLegs, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is PurchaseDetails && + carRental == other.carRental && + customerReferenceIdentifier == other.customerReferenceIdentifier && + localTaxAmount == other.localTaxAmount && + localTaxCurrency == other.localTaxCurrency && + lodging == other.lodging && + nationalTaxAmount == other.nationalTaxAmount && + nationalTaxCurrency == other.nationalTaxCurrency && + purchaseIdentifier == other.purchaseIdentifier && + purchaseIdentifierFormat == other.purchaseIdentifierFormat && + travel == other.travel && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + carRental, + customerReferenceIdentifier, + localTaxAmount, + localTaxCurrency, + lodging, + nationalTaxAmount, + nationalTaxCurrency, + purchaseIdentifier, + purchaseIdentifierFormat, + travel, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "PurchaseDetails{carRental=$carRental, customerReferenceIdentifier=$customerReferenceIdentifier, localTaxAmount=$localTaxAmount, localTaxCurrency=$localTaxCurrency, lodging=$lodging, nationalTaxAmount=$nationalTaxAmount, nationalTaxCurrency=$nationalTaxCurrency, purchaseIdentifier=$purchaseIdentifier, purchaseIdentifierFormat=$purchaseIdentifierFormat, travel=$travel, additionalProperties=$additionalProperties}" + } + + class SchemeFee + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val amount: JsonField, + private val createdAt: JsonField, + private val currency: JsonField, + private val feeType: JsonField, + private val fixedComponent: JsonField, + private val variableRate: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + createdAt: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("fee_type") + @ExcludeMissing + feeType: JsonField = JsonMissing.of(), + @JsonProperty("fixed_component") + @ExcludeMissing + fixedComponent: JsonField = JsonMissing.of(), + @JsonProperty("variable_rate") + @ExcludeMissing + variableRate: JsonField = JsonMissing.of(), + ) : this( + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, + mutableMapOf(), + ) + + /** + * The fee amount given as a string containing a decimal number. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun amount(): String = amount.getRequired("amount") + + /** + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + * created. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun currency(): Currency = currency.getRequired("currency") + + /** + * The type of fee being assessed. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun feeType(): FeeType = feeType.getRequired("fee_type") + + /** + * The fixed component of the fee, if applicable, given in major units of the fee + * amount. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun fixedComponent(): Optional = + fixedComponent.getOptional("fixed_component") + + /** + * The variable rate component of the fee, if applicable, given as a decimal (e.g., + * 0.015 for 1.5%). + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun variableRate(): Optional = variableRate.getOptional("variable_rate") - /** None */ - @JvmField val NONE = of("none") + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - /** Change to existing ticket */ - @JvmField - val CHANGE_TO_EXISTING_TICKET = of("change_to_existing_ticket") + /** + * Returns the raw JSON value of [createdAt]. + * + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("created_at") + @ExcludeMissing + fun _createdAt(): JsonField = createdAt - /** New ticket */ - @JvmField val NEW_TICKET = of("new_ticket") + /** + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("currency") + @ExcludeMissing + fun _currency(): JsonField = currency - @JvmStatic - fun of(value: String) = TicketChangeIndicator(JsonField.of(value)) - } + /** + * Returns the raw JSON value of [feeType]. + * + * Unlike [feeType], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("fee_type") + @ExcludeMissing + fun _feeType(): JsonField = feeType - /** An enum containing [TicketChangeIndicator]'s known values. */ - enum class Known { - /** None */ - NONE, - /** Change to existing ticket */ - CHANGE_TO_EXISTING_TICKET, - /** New ticket */ - NEW_TICKET, - } + /** + * Returns the raw JSON value of [fixedComponent]. + * + * Unlike [fixedComponent], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("fixed_component") + @ExcludeMissing + fun _fixedComponent(): JsonField = fixedComponent - /** - * An enum containing [TicketChangeIndicator]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [TicketChangeIndicator] can contain an unknown value in a - * couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** None */ - NONE, - /** Change to existing ticket */ - CHANGE_TO_EXISTING_TICKET, - /** New ticket */ - NEW_TICKET, - /** - * An enum member indicating that [TicketChangeIndicator] was - * instantiated with an unknown value. - */ - _UNKNOWN, - } + /** + * Returns the raw JSON value of [variableRate]. + * + * Unlike [variableRate], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("variable_rate") + @ExcludeMissing + fun _variableRate(): JsonField = variableRate - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - NONE -> Value.NONE - CHANGE_TO_EXISTING_TICKET -> Value.CHANGE_TO_EXISTING_TICKET - NEW_TICKET -> Value.NEW_TICKET - else -> Value._UNKNOWN - } + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - NONE -> Known.NONE - CHANGE_TO_EXISTING_TICKET -> Known.CHANGE_TO_EXISTING_TICKET - NEW_TICKET -> Known.NEW_TICKET - else -> - throw IncreaseInvalidDataException( - "Unknown TicketChangeIndicator: $value" - ) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + fun toBuilder() = Builder().from(this) - private var validated: Boolean = false + companion object { - fun validate(): TicketChangeIndicator = apply { - if (validated) { - return@apply - } + /** + * Returns a mutable builder for constructing an instance of [SchemeFee]. + * + * The following fields are required: + * ```java + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - known() - validated = true - } + /** A builder for [SchemeFee]. */ + class Builder internal constructor() { - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + private var amount: JsonField? = null + private var createdAt: JsonField? = null + private var currency: JsonField? = null + private var feeType: JsonField? = null + private var fixedComponent: JsonField? = null + private var variableRate: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + @JvmSynthetic + internal fun from(schemeFee: SchemeFee) = apply { + amount = schemeFee.amount + createdAt = schemeFee.createdAt + currency = schemeFee.currency + feeType = schemeFee.feeType + fixedComponent = schemeFee.fixedComponent + variableRate = schemeFee.variableRate + additionalProperties = schemeFee.additionalProperties.toMutableMap() + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** The fee amount given as a string containing a decimal number. */ + fun amount(amount: String) = amount(JsonField.of(amount)) - return other is TicketChangeIndicator && value == other.value - } + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun amount(amount: JsonField) = apply { this.amount = amount } - override fun hashCode() = value.hashCode() + /** + * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee + * was created. + */ + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - override fun toString() = value.toString() + /** + * Sets [Builder.createdAt] to an arbitrary JSON value. + * + * You should usually call [Builder.createdAt] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } - class TripLeg - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val carrierCode: JsonField, - private val destinationCityAirportCode: JsonField, - private val fareBasisCode: JsonField, - private val flightNumber: JsonField, - private val serviceClass: JsonField, - private val stopOverCode: JsonField, - private val additionalProperties: MutableMap, - ) { + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + */ + fun currency(currency: Currency) = currency(JsonField.of(currency)) - @JsonCreator - private constructor( - @JsonProperty("carrier_code") - @ExcludeMissing - carrierCode: JsonField = JsonMissing.of(), - @JsonProperty("destination_city_airport_code") - @ExcludeMissing - destinationCityAirportCode: JsonField = JsonMissing.of(), - @JsonProperty("fare_basis_code") - @ExcludeMissing - fareBasisCode: JsonField = JsonMissing.of(), - @JsonProperty("flight_number") - @ExcludeMissing - flightNumber: JsonField = JsonMissing.of(), - @JsonProperty("service_class") - @ExcludeMissing - serviceClass: JsonField = JsonMissing.of(), - @JsonProperty("stop_over_code") - @ExcludeMissing - stopOverCode: JsonField = JsonMissing.of(), - ) : this( - carrierCode, - destinationCityAirportCode, - fareBasisCode, - flightNumber, - serviceClass, - stopOverCode, - mutableMapOf(), - ) + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [Currency] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } + + /** The type of fee being assessed. */ + fun feeType(feeType: FeeType) = feeType(JsonField.of(feeType)) + + /** + * Sets [Builder.feeType] to an arbitrary JSON value. + * + * You should usually call [Builder.feeType] with a well-typed [FeeType] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun feeType(feeType: JsonField) = apply { this.feeType = feeType } - /** - * Carrier code (e.g., United Airlines, Jet Blue, etc.). - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). - */ - fun carrierCode(): Optional = - carrierCode.getOptional("carrier_code") + /** + * The fixed component of the fee, if applicable, given in major units of the + * fee amount. + */ + fun fixedComponent(fixedComponent: String?) = + fixedComponent(JsonField.ofNullable(fixedComponent)) - /** - * Code for the destination city or airport. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). - */ - fun destinationCityAirportCode(): Optional = - destinationCityAirportCode.getOptional("destination_city_airport_code") + /** + * Alias for calling [Builder.fixedComponent] with + * `fixedComponent.orElse(null)`. + */ + fun fixedComponent(fixedComponent: Optional) = + fixedComponent(fixedComponent.getOrNull()) - /** - * Fare basis code. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). - */ - fun fareBasisCode(): Optional = - fareBasisCode.getOptional("fare_basis_code") + /** + * Sets [Builder.fixedComponent] to an arbitrary JSON value. + * + * You should usually call [Builder.fixedComponent] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun fixedComponent(fixedComponent: JsonField) = apply { + this.fixedComponent = fixedComponent + } - /** - * Flight number. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). - */ - fun flightNumber(): Optional = - flightNumber.getOptional("flight_number") + /** + * The variable rate component of the fee, if applicable, given as a decimal + * (e.g., 0.015 for 1.5%). + */ + fun variableRate(variableRate: String?) = + variableRate(JsonField.ofNullable(variableRate)) - /** - * Service class (e.g., first class, business class, etc.). - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). - */ - fun serviceClass(): Optional = - serviceClass.getOptional("service_class") + /** + * Alias for calling [Builder.variableRate] with `variableRate.orElse(null)`. + */ + fun variableRate(variableRate: Optional) = + variableRate(variableRate.getOrNull()) - /** - * Indicates whether a stopover is allowed on this ticket. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). - */ - fun stopOverCode(): Optional = - stopOverCode.getOptional("stop_over_code") + /** + * Sets [Builder.variableRate] to an arbitrary JSON value. + * + * You should usually call [Builder.variableRate] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun variableRate(variableRate: JsonField) = apply { + this.variableRate = variableRate + } - /** - * Returns the raw JSON value of [carrierCode]. - * - * Unlike [carrierCode], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("carrier_code") - @ExcludeMissing - fun _carrierCode(): JsonField = carrierCode + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * Returns the raw JSON value of [destinationCityAirportCode]. - * - * Unlike [destinationCityAirportCode], this method doesn't throw if the - * JSON field has an unexpected type. - */ - @JsonProperty("destination_city_airport_code") - @ExcludeMissing - fun _destinationCityAirportCode(): JsonField = - destinationCityAirportCode + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * Returns the raw JSON value of [fareBasisCode]. - * - * Unlike [fareBasisCode], this method doesn't throw if the JSON field has - * an unexpected type. - */ - @JsonProperty("fare_basis_code") - @ExcludeMissing - fun _fareBasisCode(): JsonField = fareBasisCode + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** - * Returns the raw JSON value of [flightNumber]. - * - * Unlike [flightNumber], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("flight_number") - @ExcludeMissing - fun _flightNumber(): JsonField = flightNumber + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * Returns the raw JSON value of [serviceClass]. - * - * Unlike [serviceClass], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("service_class") - @ExcludeMissing - fun _serviceClass(): JsonField = serviceClass + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * Returns the raw JSON value of [stopOverCode]. - * - * Unlike [stopOverCode], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("stop_over_code") - @ExcludeMissing - fun _stopOverCode(): JsonField = stopOverCode + /** + * Returns an immutable instance of [SchemeFee]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .amount() + * .createdAt() + * .currency() + * .feeType() + * .fixedComponent() + * .variableRate() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SchemeFee = + SchemeFee( + checkRequired("amount", amount), + checkRequired("createdAt", createdAt), + checkRequired("currency", currency), + checkRequired("feeType", feeType), + checkRequired("fixedComponent", fixedComponent), + checkRequired("variableRate", variableRate), + additionalProperties.toMutableMap(), + ) + } - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + private var validated: Boolean = false - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + fun validate(): SchemeFee = apply { + if (validated) { + return@apply + } - fun toBuilder() = Builder().from(this) + amount() + createdAt() + currency().validate() + feeType().validate() + fixedComponent() + variableRate() + validated = true + } - companion object { + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * Returns a mutable builder for constructing an instance of [TripLeg]. - * - * The following fields are required: - * ```java - * .carrierCode() - * .destinationCityAirportCode() - * .fareBasisCode() - * .flightNumber() - * .serviceClass() - * .stopOverCode() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (currency.asKnown().getOrNull()?.validity() ?: 0) + + (feeType.asKnown().getOrNull()?.validity() ?: 0) + + (if (fixedComponent.asKnown().isPresent) 1 else 0) + + (if (variableRate.asKnown().isPresent) 1 else 0) - /** A builder for [TripLeg]. */ - class Builder internal constructor() { + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + * reimbursement. + */ + class Currency + @JsonCreator + private constructor(private val value: JsonField) : Enum { - private var carrierCode: JsonField? = null - private var destinationCityAirportCode: JsonField? = null - private var fareBasisCode: JsonField? = null - private var flightNumber: JsonField? = null - private var serviceClass: JsonField? = null - private var stopOverCode: JsonField? = null - private var additionalProperties: MutableMap = - mutableMapOf() + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - @JvmSynthetic - internal fun from(tripLeg: TripLeg) = apply { - carrierCode = tripLeg.carrierCode - destinationCityAirportCode = tripLeg.destinationCityAirportCode - fareBasisCode = tripLeg.fareBasisCode - flightNumber = tripLeg.flightNumber - serviceClass = tripLeg.serviceClass - stopOverCode = tripLeg.stopOverCode - additionalProperties = tripLeg.additionalProperties.toMutableMap() - } + companion object { + + /** US Dollar (USD) */ + @JvmField val USD = of("USD") + + @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) + } + + /** An enum containing [Currency]'s known values. */ + enum class Known { + /** US Dollar (USD) */ + USD + } - /** Carrier code (e.g., United Airlines, Jet Blue, etc.). */ - fun carrierCode(carrierCode: String?) = - carrierCode(JsonField.ofNullable(carrierCode)) + /** + * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Currency] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** US Dollar (USD) */ + USD, + /** + * An enum member indicating that [Currency] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** - * Alias for calling [Builder.carrierCode] with - * `carrierCode.orElse(null)`. - */ - fun carrierCode(carrierCode: Optional) = - carrierCode(carrierCode.getOrNull()) + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + USD -> Value.USD + else -> Value._UNKNOWN + } - /** - * Sets [Builder.carrierCode] to an arbitrary JSON value. - * - * You should usually call [Builder.carrierCode] with a well-typed - * [String] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun carrierCode(carrierCode: JsonField) = apply { - this.carrierCode = carrierCode - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + USD -> Known.USD + else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + } - /** Code for the destination city or airport. */ - fun destinationCityAirportCode(destinationCityAirportCode: String?) = - destinationCityAirportCode( - JsonField.ofNullable(destinationCityAirportCode) - ) + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - /** - * Alias for calling [Builder.destinationCityAirportCode] with - * `destinationCityAirportCode.orElse(null)`. - */ - fun destinationCityAirportCode( - destinationCityAirportCode: Optional - ) = destinationCityAirportCode(destinationCityAirportCode.getOrNull()) + private var validated: Boolean = false - /** - * Sets [Builder.destinationCityAirportCode] to an arbitrary JSON value. - * - * You should usually call [Builder.destinationCityAirportCode] with a - * well-typed [String] value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. - */ - fun destinationCityAirportCode( - destinationCityAirportCode: JsonField - ) = apply { - this.destinationCityAirportCode = destinationCityAirportCode - } + fun validate(): Currency = apply { + if (validated) { + return@apply + } - /** Fare basis code. */ - fun fareBasisCode(fareBasisCode: String?) = - fareBasisCode(JsonField.ofNullable(fareBasisCode)) + known() + validated = true + } - /** - * Alias for calling [Builder.fareBasisCode] with - * `fareBasisCode.orElse(null)`. - */ - fun fareBasisCode(fareBasisCode: Optional) = - fareBasisCode(fareBasisCode.getOrNull()) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * Sets [Builder.fareBasisCode] to an arbitrary JSON value. - * - * You should usually call [Builder.fareBasisCode] with a well-typed - * [String] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun fareBasisCode(fareBasisCode: JsonField) = apply { - this.fareBasisCode = fareBasisCode - } + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - /** Flight number. */ - fun flightNumber(flightNumber: String?) = - flightNumber(JsonField.ofNullable(flightNumber)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Alias for calling [Builder.flightNumber] with - * `flightNumber.orElse(null)`. - */ - fun flightNumber(flightNumber: Optional) = - flightNumber(flightNumber.getOrNull()) + return other is Currency && value == other.value + } - /** - * Sets [Builder.flightNumber] to an arbitrary JSON value. - * - * You should usually call [Builder.flightNumber] with a well-typed - * [String] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun flightNumber(flightNumber: JsonField) = apply { - this.flightNumber = flightNumber - } + override fun hashCode() = value.hashCode() - /** Service class (e.g., first class, business class, etc.). */ - fun serviceClass(serviceClass: String?) = - serviceClass(JsonField.ofNullable(serviceClass)) + override fun toString() = value.toString() + } - /** - * Alias for calling [Builder.serviceClass] with - * `serviceClass.orElse(null)`. - */ - fun serviceClass(serviceClass: Optional) = - serviceClass(serviceClass.getOrNull()) + /** The type of fee being assessed. */ + class FeeType + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** - * Sets [Builder.serviceClass] to an arbitrary JSON value. - * - * You should usually call [Builder.serviceClass] with a well-typed - * [String] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun serviceClass(serviceClass: JsonField) = apply { - this.serviceClass = serviceClass - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** Indicates whether a stopover is allowed on this ticket. */ - fun stopOverCode(stopOverCode: StopOverCode?) = - stopOverCode(JsonField.ofNullable(stopOverCode)) + companion object { - /** - * Alias for calling [Builder.stopOverCode] with - * `stopOverCode.orElse(null)`. - */ - fun stopOverCode(stopOverCode: Optional) = - stopOverCode(stopOverCode.getOrNull()) + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY = + of("visa_international_service_assessment_single_currency") - /** - * Sets [Builder.stopOverCode] to an arbitrary JSON value. - * - * You should usually call [Builder.stopOverCode] with a well-typed - * [StopOverCode] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. - */ - fun stopOverCode(stopOverCode: JsonField) = apply { - this.stopOverCode = stopOverCode - } + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + @JvmField + val VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY = + of("visa_international_service_assessment_cross_currency") - fun additionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + @JvmField + val VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE = + of("visa_authorization_domestic_point_of_sale") - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + @JvmField + val VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_international_point_of_sale") - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + @JvmField + val VISA_AUTHORIZATION_CANADA_POINT_OF_SALE = + of("visa_authorization_canada_point_of_sale") + + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + @JvmField + val VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE = + of("visa_authorization_reversal_point_of_sale") - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + @JvmField + val VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE = + of("visa_authorization_reversal_international_point_of_sale") - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + @JvmField + val VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE = + of("visa_authorization_address_verification_service") - /** - * Returns an immutable instance of [TripLeg]. - * - * Further updates to this [Builder] will not mutate the returned - * instance. - * - * The following fields are required: - * ```java - * .carrierCode() - * .destinationCityAirportCode() - * .fareBasisCode() - * .flightNumber() - * .serviceClass() - * .stopOverCode() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): TripLeg = - TripLeg( - checkRequired("carrierCode", carrierCode), - checkRequired( - "destinationCityAirportCode", - destinationCityAirportCode, - ), - checkRequired("fareBasisCode", fareBasisCode), - checkRequired("flightNumber", flightNumber), - checkRequired("serviceClass", serviceClass), - checkRequired("stopOverCode", stopOverCode), - additionalProperties.toMutableMap(), - ) - } + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + @JvmField + val VISA_ADVANCED_AUTHORIZATION = of("visa_advanced_authorization") - private var validated: Boolean = false + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + @JvmField val VISA_MESSAGE_TRANSMISSION = of("visa_message_transmission") - fun validate(): TripLeg = apply { - if (validated) { - return@apply - } + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_DOMESTIC = + of("visa_account_verification_domestic") - carrierCode() - destinationCityAirportCode() - fareBasisCode() - flightNumber() - serviceClass() - stopOverCode().ifPresent { it.validate() } - validated = true - } + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_INTERNATIONAL = + of("visa_account_verification_international") - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + @JvmField + val VISA_ACCOUNT_VERIFICATION_CANADA = + of("visa_account_verification_canada") /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. */ - @JvmSynthetic - internal fun validity(): Int = - (if (carrierCode.asKnown().isPresent) 1 else 0) + - (if (destinationCityAirportCode.asKnown().isPresent) 1 else 0) + - (if (fareBasisCode.asKnown().isPresent) 1 else 0) + - (if (flightNumber.asKnown().isPresent) 1 else 0) + - (if (serviceClass.asKnown().isPresent) 1 else 0) + - (stopOverCode.asKnown().getOrNull()?.validity() ?: 0) + @JvmField + val VISA_CORPORATE_ACCEPTANCE_FEE = of("visa_corporate_acceptance_fee") - /** Indicates whether a stopover is allowed on this ticket. */ - class StopOverCode - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + @JvmField + val VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE = + of("visa_consumer_debit_acceptance_fee") - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from - * data that doesn't match any known member, and you want to know that - * value. For example, if the SDK is on an older version than the API, - * then the API may respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + @JvmField + val VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE = + of("visa_business_debit_acceptance_fee") - companion object { + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + @JvmField + val VISA_PURCHASING_ACCEPTANCE_FEE = of("visa_purchasing_acceptance_fee") - /** None */ - @JvmField val NONE = of("none") + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + @JvmField val VISA_PURCHASE_DOMESTIC = of("visa_purchase_domestic") - /** Stop over allowed */ - @JvmField val STOP_OVER_ALLOWED = of("stop_over_allowed") + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + @JvmField + val VISA_PURCHASE_INTERNATIONAL = of("visa_purchase_international") - /** Stop over not allowed */ - @JvmField val STOP_OVER_NOT_ALLOWED = of("stop_over_not_allowed") + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_CREDIT_PURCHASE_TOKEN = of("visa_credit_purchase_token") - @JvmStatic fun of(value: String) = StopOverCode(JsonField.of(value)) - } + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + @JvmField val VISA_DEBIT_PURCHASE_TOKEN = of("visa_debit_purchase_token") - /** An enum containing [StopOverCode]'s known values. */ - enum class Known { - /** None */ - NONE, - /** Stop over allowed */ - STOP_OVER_ALLOWED, - /** Stop over not allowed */ - STOP_OVER_NOT_ALLOWED, - } + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + @JvmField val VISA_CLEARING_TRANSMISSION = of("visa_clearing_transmission") - /** - * An enum containing [StopOverCode]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [StopOverCode] can contain an unknown value in a - * couple of cases: - * - It was deserialized from data that doesn't match any known member. - * For example, if the SDK is on an older version than the API, then - * the API may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** None */ - NONE, - /** Stop over allowed */ - STOP_OVER_ALLOWED, - /** Stop over not allowed */ - STOP_OVER_NOT_ALLOWED, - /** - * An enum member indicating that [StopOverCode] was instantiated - * with an unknown value. - */ - _UNKNOWN, - } + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + @JvmField val VISA_DIRECT_AUTHORIZATION = of("visa_direct_authorization") - /** - * Returns an enum member corresponding to this class instance's value, - * or [Value._UNKNOWN] if the class was instantiated with an unknown - * value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - NONE -> Value.NONE - STOP_OVER_ALLOWED -> Value.STOP_OVER_ALLOWED - STOP_OVER_NOT_ALLOWED -> Value.STOP_OVER_NOT_ALLOWED - else -> Value._UNKNOWN - } + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + @JvmField + val VISA_DIRECT_TRANSACTION_DOMESTIC = + of("visa_direct_transaction_domestic") - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is - * always known and don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value - * is a not a known member. - */ - fun known(): Known = - when (this) { - NONE -> Known.NONE - STOP_OVER_ALLOWED -> Known.STOP_OVER_ALLOWED - STOP_OVER_NOT_ALLOWED -> Known.STOP_OVER_NOT_ALLOWED - else -> - throw IncreaseInvalidDataException( - "Unknown StopOverCode: $value" - ) - } + /** Issuer card service fee for Commercial Credit cards. */ + @JvmField + val VISA_SERVICE_COMMERCIAL_CREDIT = of("visa_service_commercial_credit") - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is - * primarily for debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value - * does not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + @JvmField + val VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT = + of("visa_advertising_service_commercial_credit") - private var validated: Boolean = false + /** Issuer Community Growth Acceleration Program Fee. */ + @JvmField + val VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM = + of("visa_community_growth_acceleration_program") - fun validate(): StopOverCode = apply { - if (validated) { - return@apply - } + /** Issuer Processing Guarantee for Commercial Credit cards. */ + @JvmField + val VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT = + of("visa_processing_guarantee_commercial_credit") - known() - validated = true - } + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + @JvmField val PULSE_SWITCH_FEE = of("pulse_switch_fee") - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + @JvmStatic fun of(value: String) = FeeType(JsonField.of(value)) + } - /** - * Returns a score indicating how many valid values are contained in - * this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + /** An enum containing [FeeType]'s known values. */ + enum class Known { + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + VISA_ADVANCED_AUTHORIZATION, + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + VISA_MESSAGE_TRANSMISSION, + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_DOMESTIC, + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * An enum containing [FeeType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [FeeType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** + * International Service Assessment (ISA) single-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in the same currency. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY, + /** + * International Service Assessment (ISA) cross-currency is a fee assessed + * by the card network for cross-border transactions presented and settled + * in different currencies. + */ + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) authorization transactions. Authorization is the process + * of approving or declining the transaction amount specified. The fee is + * assessed to the Issuer. + */ + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for POS + * (Point-Of-Sale) International authorization transactions. Authorization + * is the process of approving or declining the transaction amount + * specified. The fee is assessed to the Issuer. + */ + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE, + /** + * Activity and charges for Visa Settlement System processing for Canada + * Region POS (Point-of-Sale) authorization transactions. Authorization is + * the process of approving or declining the transaction amount specified. + */ + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) reversal transactions. Authorization reversal represents + * a VSS message that undoes the complete or partial actions of a previous + * authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE, + /** + * Activity only for Visa Settlement System authorization processing of POS + * (Point-Of-Sale) International reversal transactions. Authorization + * reversal represents a VSS message that undoes the complete or partial + * actions of a previous authorization request. + */ + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE, + /** + * A per Address Verification Service (AVS) result fee. Applies to all + * usable AVS result codes. + */ + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE, + /** + * Advanced Authorization is a fraud detection tool that monitors and risk + * evaluates 100 percent of US VisaNet authorizations in real-time. Activity + * related to Purchase (includes Signature Authenticated Visa and PIN + * Authenticated Visa Debit (PAVD) transactions). + */ + VISA_ADVANCED_AUTHORIZATION, + /** + * Issuer Transactions Visa represents a charge based on total actual + * monthly processing (Visa transactions only) through a VisaNet Access + * Point (VAP). Charges are assessed to the processor for each VisaNet + * Access Point. + */ + VISA_MESSAGE_TRANSMISSION, + /** + * Activity, per inquiry, related to the domestic Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_DOMESTIC, + /** + * Activity, per inquiry, related to the international Issuer for Account + * Number Verification. + */ + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL, + /** + * Activity, per inquiry, related to the US-Canada Issuer for Account Number + * Verification. + */ + VISA_ACCOUNT_VERIFICATION_CANADA, + /** + * The Corporate Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Commercial and Government Debit, Prepaid, Credit, + * Charge, or Deferred Debit card transactions. + */ + VISA_CORPORATE_ACCEPTANCE_FEE, + /** + * The Consumer Debit Acceptance Fee is charged to issuers and is based on + * the monthly sales volume of Consumer Debit or Prepaid card transactions. + * The cashback portion of a Debit and Prepaid card transaction is excluded + * from the sales volume calculation. + */ + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE, + /** + * The Business Acceptance Fee is charged to issuers and is based on the + * monthly sales volume on Business Debit, Prepaid, Credit, Charge, or + * Deferred Debit card transactions. The cashback portion is included in the + * sales volume calculation with the exception of a Debit and Prepaid card + * transactions. + */ + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE, + /** + * The Purchasing Card Acceptance Fee is charged to issuers and is based on + * the monthly sales volume on Commercial and Government Debit, Prepaid, + * Credit, Charge, or Deferred Debit card transactions. + */ + VISA_PURCHASING_ACCEPTANCE_FEE, + /** + * Activity and fees for the processing of a sales draft original for a + * purchase transaction. + */ + VISA_PURCHASE_DOMESTIC, + /** + * Activity and fees for the processing of an international sales draft + * original for a purchase transaction. + */ + VISA_PURCHASE_INTERNATIONAL, + /** + * Apple Pay Credit Product Token Purchase Original Transactions. This fee + * is billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_CREDIT_PURCHASE_TOKEN, + /** + * Apple Pay Debit Product Token Purchase Original Transactions. This fee is + * billed by Visa on behalf of Apple Inc. for Apple Pay transactions. + */ + VISA_DEBIT_PURCHASE_TOKEN, + /** A per transaction fee assessed for Base II financial draft - Issuer. */ + VISA_CLEARING_TRANSMISSION, + /** + * Issuer charge for Non-Financial OCT/AFT Authorization 0100 and Declined + * Financial OCT/AFT 0200 transactions. + */ + VISA_DIRECT_AUTHORIZATION, + /** + * Data processing charge for Visa Direct OCTs for all business application + * identifiers (BAIs) other than money transfer-bank initiated (BI). BASE II + * transactions. + */ + VISA_DIRECT_TRANSACTION_DOMESTIC, + /** Issuer card service fee for Commercial Credit cards. */ + VISA_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Advertising Service Fee for Commercial Credit cards. */ + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT, + /** Issuer Community Growth Acceleration Program Fee. */ + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM, + /** Issuer Processing Guarantee for Commercial Credit cards. */ + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT, + /** + * Pulse Switch Fee is a fee charged by the Pulse network for processing + * transactions on its network. + */ + PULSE_SWITCH_FEE, + /** + * An enum member indicating that [FeeType] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } - return other is StopOverCode && value == other.value - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Value.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Value.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Value.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Value.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Value.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Value.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Value.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Value.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Value.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Value.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Value.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Value.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Value.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Value.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Value.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Value.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Value.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Value.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Value.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Value.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Value.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Value.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Value.PULSE_SWITCH_FEE + else -> Value._UNKNOWN + } - override fun hashCode() = value.hashCode() + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_SINGLE_CURRENCY + VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY -> + Known.VISA_INTERNATIONAL_SERVICE_ASSESSMENT_CROSS_CURRENCY + VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_DOMESTIC_POINT_OF_SALE + VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_CANADA_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_CANADA_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_POINT_OF_SALE + VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE -> + Known.VISA_AUTHORIZATION_REVERSAL_INTERNATIONAL_POINT_OF_SALE + VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE -> + Known.VISA_AUTHORIZATION_ADDRESS_VERIFICATION_SERVICE + VISA_ADVANCED_AUTHORIZATION -> Known.VISA_ADVANCED_AUTHORIZATION + VISA_MESSAGE_TRANSMISSION -> Known.VISA_MESSAGE_TRANSMISSION + VISA_ACCOUNT_VERIFICATION_DOMESTIC -> + Known.VISA_ACCOUNT_VERIFICATION_DOMESTIC + VISA_ACCOUNT_VERIFICATION_INTERNATIONAL -> + Known.VISA_ACCOUNT_VERIFICATION_INTERNATIONAL + VISA_ACCOUNT_VERIFICATION_CANADA -> + Known.VISA_ACCOUNT_VERIFICATION_CANADA + VISA_CORPORATE_ACCEPTANCE_FEE -> Known.VISA_CORPORATE_ACCEPTANCE_FEE + VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_CONSUMER_DEBIT_ACCEPTANCE_FEE + VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE -> + Known.VISA_BUSINESS_DEBIT_ACCEPTANCE_FEE + VISA_PURCHASING_ACCEPTANCE_FEE -> Known.VISA_PURCHASING_ACCEPTANCE_FEE + VISA_PURCHASE_DOMESTIC -> Known.VISA_PURCHASE_DOMESTIC + VISA_PURCHASE_INTERNATIONAL -> Known.VISA_PURCHASE_INTERNATIONAL + VISA_CREDIT_PURCHASE_TOKEN -> Known.VISA_CREDIT_PURCHASE_TOKEN + VISA_DEBIT_PURCHASE_TOKEN -> Known.VISA_DEBIT_PURCHASE_TOKEN + VISA_CLEARING_TRANSMISSION -> Known.VISA_CLEARING_TRANSMISSION + VISA_DIRECT_AUTHORIZATION -> Known.VISA_DIRECT_AUTHORIZATION + VISA_DIRECT_TRANSACTION_DOMESTIC -> + Known.VISA_DIRECT_TRANSACTION_DOMESTIC + VISA_SERVICE_COMMERCIAL_CREDIT -> Known.VISA_SERVICE_COMMERCIAL_CREDIT + VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT -> + Known.VISA_ADVERTISING_SERVICE_COMMERCIAL_CREDIT + VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM -> + Known.VISA_COMMUNITY_GROWTH_ACCELERATION_PROGRAM + VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT -> + Known.VISA_PROCESSING_GUARANTEE_COMMERCIAL_CREDIT + PULSE_SWITCH_FEE -> Known.PULSE_SWITCH_FEE + else -> throw IncreaseInvalidDataException("Unknown FeeType: $value") + } - override fun toString() = value.toString() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + private var validated: Boolean = false - return other is TripLeg && - carrierCode == other.carrierCode && - destinationCityAirportCode == other.destinationCityAirportCode && - fareBasisCode == other.fareBasisCode && - flightNumber == other.flightNumber && - serviceClass == other.serviceClass && - stopOverCode == other.stopOverCode && - additionalProperties == other.additionalProperties + fun validate(): FeeType = apply { + if (validated) { + return@apply } - private val hashCode: Int by lazy { - Objects.hash( - carrierCode, - destinationCityAirportCode, - fareBasisCode, - flightNumber, - serviceClass, - stopOverCode, - additionalProperties, - ) - } + known() + validated = true + } - override fun hashCode(): Int = hashCode + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - override fun toString() = - "TripLeg{carrierCode=$carrierCode, destinationCityAirportCode=$destinationCityAirportCode, fareBasisCode=$fareBasisCode, flightNumber=$flightNumber, serviceClass=$serviceClass, stopOverCode=$stopOverCode, additionalProperties=$additionalProperties}" - } + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is Travel && - ancillary == other.ancillary && - computerizedReservationSystem == other.computerizedReservationSystem && - creditReasonIndicator == other.creditReasonIndicator && - departureDate == other.departureDate && - originationCityAirportCode == other.originationCityAirportCode && - passengerName == other.passengerName && - restrictedTicketIndicator == other.restrictedTicketIndicator && - ticketChangeIndicator == other.ticketChangeIndicator && - ticketNumber == other.ticketNumber && - travelAgencyCode == other.travelAgencyCode && - travelAgencyName == other.travelAgencyName && - tripLegs == other.tripLegs && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - ancillary, - computerizedReservationSystem, - creditReasonIndicator, - departureDate, - originationCityAirportCode, - passengerName, - restrictedTicketIndicator, - ticketChangeIndicator, - ticketNumber, - travelAgencyCode, - travelAgencyName, - tripLegs, - additionalProperties, - ) + return other is FeeType && value == other.value } - override fun hashCode(): Int = hashCode + override fun hashCode() = value.hashCode() - override fun toString() = - "Travel{ancillary=$ancillary, computerizedReservationSystem=$computerizedReservationSystem, creditReasonIndicator=$creditReasonIndicator, departureDate=$departureDate, originationCityAirportCode=$originationCityAirportCode, passengerName=$passengerName, restrictedTicketIndicator=$restrictedTicketIndicator, ticketChangeIndicator=$ticketChangeIndicator, ticketNumber=$ticketNumber, travelAgencyCode=$travelAgencyCode, travelAgencyName=$travelAgencyName, tripLegs=$tripLegs, additionalProperties=$additionalProperties}" + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { @@ -37949,32 +42077,24 @@ private constructor( return true } - return other is PurchaseDetails && - carRental == other.carRental && - customerReferenceIdentifier == other.customerReferenceIdentifier && - localTaxAmount == other.localTaxAmount && - localTaxCurrency == other.localTaxCurrency && - lodging == other.lodging && - nationalTaxAmount == other.nationalTaxAmount && - nationalTaxCurrency == other.nationalTaxCurrency && - purchaseIdentifier == other.purchaseIdentifier && - purchaseIdentifierFormat == other.purchaseIdentifierFormat && - travel == other.travel && + return other is SchemeFee && + amount == other.amount && + createdAt == other.createdAt && + currency == other.currency && + feeType == other.feeType && + fixedComponent == other.fixedComponent && + variableRate == other.variableRate && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { Objects.hash( - carRental, - customerReferenceIdentifier, - localTaxAmount, - localTaxCurrency, - lodging, - nationalTaxAmount, - nationalTaxCurrency, - purchaseIdentifier, - purchaseIdentifierFormat, - travel, + amount, + createdAt, + currency, + feeType, + fixedComponent, + variableRate, additionalProperties, ) } @@ -37982,7 +42102,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PurchaseDetails{carRental=$carRental, customerReferenceIdentifier=$customerReferenceIdentifier, localTaxAmount=$localTaxAmount, localTaxCurrency=$localTaxCurrency, lodging=$lodging, nationalTaxAmount=$nationalTaxAmount, nationalTaxCurrency=$nationalTaxCurrency, purchaseIdentifier=$purchaseIdentifier, purchaseIdentifierFormat=$purchaseIdentifierFormat, travel=$travel, additionalProperties=$additionalProperties}" + "SchemeFee{amount=$amount, createdAt=$createdAt, currency=$currency, feeType=$feeType, fixedComponent=$fixedComponent, variableRate=$variableRate, additionalProperties=$additionalProperties}" } /** @@ -38366,6 +42486,7 @@ private constructor( presentmentAmount == other.presentmentAmount && presentmentCurrency == other.presentmentCurrency && purchaseDetails == other.purchaseDetails && + schemeFees == other.schemeFees && surcharge == other.surcharge && transactionId == other.transactionId && type == other.type && @@ -38394,6 +42515,7 @@ private constructor( presentmentAmount, presentmentCurrency, purchaseDetails, + schemeFees, surcharge, transactionId, type, @@ -38404,7 +42526,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CardSettlement{id=$id, amount=$amount, cardAuthorization=$cardAuthorization, cardPaymentId=$cardPaymentId, cashback=$cashback, currency=$currency, interchange=$interchange, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantName=$merchantName, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, network=$network, networkIdentifiers=$networkIdentifiers, pendingTransactionId=$pendingTransactionId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, purchaseDetails=$purchaseDetails, surcharge=$surcharge, transactionId=$transactionId, type=$type, additionalProperties=$additionalProperties}" + "CardSettlement{id=$id, amount=$amount, cardAuthorization=$cardAuthorization, cardPaymentId=$cardPaymentId, cashback=$cashback, currency=$currency, interchange=$interchange, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantName=$merchantName, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, network=$network, networkIdentifiers=$networkIdentifiers, pendingTransactionId=$pendingTransactionId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, purchaseDetails=$purchaseDetails, schemeFees=$schemeFees, surcharge=$surcharge, transactionId=$transactionId, type=$type, additionalProperties=$additionalProperties}" } /** diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/cardpayments/CardPaymentListPageResponseTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/cardpayments/CardPaymentListPageResponseTest.kt index 8d9c2ab88..ff2eba4fa 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/cardpayments/CardPaymentListPageResponseTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/cardpayments/CardPaymentListPageResponseTest.kt @@ -402,6 +402,29 @@ internal class CardPaymentListPageResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardAuthorization.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardAuthorization + .SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardAuthorization + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardAuthorization.Type @@ -663,6 +686,29 @@ internal class CardPaymentListPageResponseTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardBalanceInquiry + .SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardBalanceInquiry + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardBalanceInquiry.Type @@ -912,6 +958,26 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardDecline.Reason .INSUFFICIENT_FUNDS ) + .addSchemeFee( + CardPayment.Element.CardDecline.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardDecline.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardDecline.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( CardPayment.Element.CardDecline.Verification @@ -1146,6 +1212,27 @@ internal class CardPaymentListPageResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardFinancial.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardFinancial.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFinancial.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type( @@ -1232,6 +1319,29 @@ internal class CardPaymentListPageResponseTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .addSchemeFee( + CardPayment.Element.CardFuelConfirmation.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardFuelConfirmation + .SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFuelConfirmation + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardFuelConfirmation.Type .CARD_FUEL_CONFIRMATION @@ -1364,6 +1474,27 @@ internal class CardPaymentListPageResponseTest { .presentmentAmount(20L) .presentmentCurrency("USD") .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardIncrement.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardIncrement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardIncrement.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardIncrement.Type .CARD_INCREMENT @@ -1635,6 +1766,26 @@ internal class CardPaymentListPageResponseTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardRefund.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardRefund.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardRefund.Type.CARD_REFUND) .build() @@ -1673,6 +1824,26 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardReversal.ReversalReason .REVERSED_BY_CUSTOMER ) + .addSchemeFee( + CardPayment.Element.CardReversal.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardReversal.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardReversal.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardReversal.Type.CARD_REVERSAL @@ -1956,6 +2127,27 @@ internal class CardPaymentListPageResponseTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardSettlement.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardSettlement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardSettlement.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( CardPayment.Element.CardSettlement.Surcharge .builder() @@ -2143,6 +2335,27 @@ internal class CardPaymentListPageResponseTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardValidation.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardValidation.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardValidation.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardValidation.Type @@ -2581,6 +2794,29 @@ internal class CardPaymentListPageResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardAuthorization.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardAuthorization + .SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardAuthorization + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardAuthorization.Type @@ -2842,6 +3078,29 @@ internal class CardPaymentListPageResponseTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardBalanceInquiry + .SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardBalanceInquiry + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardBalanceInquiry.Type @@ -3091,6 +3350,26 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardDecline.Reason .INSUFFICIENT_FUNDS ) + .addSchemeFee( + CardPayment.Element.CardDecline.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardDecline.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardDecline.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( CardPayment.Element.CardDecline.Verification @@ -3325,6 +3604,27 @@ internal class CardPaymentListPageResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardFinancial.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardFinancial.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFinancial.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type( @@ -3411,6 +3711,29 @@ internal class CardPaymentListPageResponseTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .addSchemeFee( + CardPayment.Element.CardFuelConfirmation.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardFuelConfirmation + .SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFuelConfirmation + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardFuelConfirmation.Type .CARD_FUEL_CONFIRMATION @@ -3543,6 +3866,27 @@ internal class CardPaymentListPageResponseTest { .presentmentAmount(20L) .presentmentCurrency("USD") .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardIncrement.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardIncrement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardIncrement.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardIncrement.Type .CARD_INCREMENT @@ -3814,6 +4158,26 @@ internal class CardPaymentListPageResponseTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardRefund.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardRefund.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardRefund.Type.CARD_REFUND) .build() @@ -3852,6 +4216,26 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardReversal.ReversalReason .REVERSED_BY_CUSTOMER ) + .addSchemeFee( + CardPayment.Element.CardReversal.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardReversal.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardReversal.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardReversal.Type.CARD_REVERSAL @@ -4135,6 +4519,27 @@ internal class CardPaymentListPageResponseTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardSettlement.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardSettlement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardSettlement.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( CardPayment.Element.CardSettlement.Surcharge .builder() @@ -4322,6 +4727,27 @@ internal class CardPaymentListPageResponseTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardValidation.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardValidation.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardValidation.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardValidation.Type @@ -4760,6 +5186,29 @@ internal class CardPaymentListPageResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardAuthorization.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardAuthorization + .SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardAuthorization + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardAuthorization.Type @@ -5021,6 +5470,29 @@ internal class CardPaymentListPageResponseTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardBalanceInquiry + .SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardBalanceInquiry + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardBalanceInquiry.Type @@ -5270,6 +5742,26 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardDecline.Reason .INSUFFICIENT_FUNDS ) + .addSchemeFee( + CardPayment.Element.CardDecline.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardDecline.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardDecline.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( CardPayment.Element.CardDecline.Verification @@ -5504,6 +5996,27 @@ internal class CardPaymentListPageResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardFinancial.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardFinancial.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFinancial.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type( @@ -5590,6 +6103,29 @@ internal class CardPaymentListPageResponseTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .addSchemeFee( + CardPayment.Element.CardFuelConfirmation.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardFuelConfirmation + .SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFuelConfirmation + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardFuelConfirmation.Type .CARD_FUEL_CONFIRMATION @@ -5722,6 +6258,27 @@ internal class CardPaymentListPageResponseTest { .presentmentAmount(20L) .presentmentCurrency("USD") .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardIncrement.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardIncrement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardIncrement.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardIncrement.Type .CARD_INCREMENT @@ -5993,6 +6550,26 @@ internal class CardPaymentListPageResponseTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardRefund.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardRefund.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardRefund.Type.CARD_REFUND) .build() @@ -6031,6 +6608,26 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardReversal.ReversalReason .REVERSED_BY_CUSTOMER ) + .addSchemeFee( + CardPayment.Element.CardReversal.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardReversal.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardReversal.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardReversal.Type.CARD_REVERSAL @@ -6314,6 +6911,27 @@ internal class CardPaymentListPageResponseTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardSettlement.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardSettlement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardSettlement.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( CardPayment.Element.CardSettlement.Surcharge .builder() @@ -6501,6 +7119,27 @@ internal class CardPaymentListPageResponseTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardValidation.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardValidation.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardValidation.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardValidation.Type @@ -6939,6 +7578,29 @@ internal class CardPaymentListPageResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardAuthorization.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardAuthorization + .SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardAuthorization + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardAuthorization.Type @@ -7200,6 +7862,29 @@ internal class CardPaymentListPageResponseTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardBalanceInquiry + .SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardBalanceInquiry + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardBalanceInquiry.Type @@ -7449,6 +8134,26 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardDecline.Reason .INSUFFICIENT_FUNDS ) + .addSchemeFee( + CardPayment.Element.CardDecline.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardDecline.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardDecline.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( CardPayment.Element.CardDecline.Verification @@ -7683,6 +8388,27 @@ internal class CardPaymentListPageResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardFinancial.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardFinancial.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFinancial.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type( @@ -7769,6 +8495,29 @@ internal class CardPaymentListPageResponseTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .addSchemeFee( + CardPayment.Element.CardFuelConfirmation.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardFuelConfirmation + .SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFuelConfirmation + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardFuelConfirmation.Type .CARD_FUEL_CONFIRMATION @@ -7901,6 +8650,27 @@ internal class CardPaymentListPageResponseTest { .presentmentAmount(20L) .presentmentCurrency("USD") .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardIncrement.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardIncrement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardIncrement.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardIncrement.Type .CARD_INCREMENT @@ -8172,6 +8942,26 @@ internal class CardPaymentListPageResponseTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardRefund.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardRefund.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardRefund.Type.CARD_REFUND) .build() @@ -8210,6 +9000,26 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardReversal.ReversalReason .REVERSED_BY_CUSTOMER ) + .addSchemeFee( + CardPayment.Element.CardReversal.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardReversal.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardReversal.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardReversal.Type.CARD_REVERSAL @@ -8493,6 +9303,27 @@ internal class CardPaymentListPageResponseTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardSettlement.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardSettlement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardSettlement.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( CardPayment.Element.CardSettlement.Surcharge .builder() @@ -8680,6 +9511,27 @@ internal class CardPaymentListPageResponseTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardValidation.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardValidation.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardValidation.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardValidation.Type @@ -8743,18 +9595,6 @@ internal class CardPaymentListPageResponseTest { ) ) .physicalCardId(null) - .addSchemeFee( - CardPayment.SchemeFee.builder() - .amount("0.137465") - .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .currency(CardPayment.SchemeFee.Currency.USD) - .feeType( - CardPayment.SchemeFee.FeeType.VISA_CORPORATE_ACCEPTANCE_FEE - ) - .fixedComponent(null) - .variableRate("0.0002") - .build() - ) .state( CardPayment.State.builder() .authorizedAmount(100L) @@ -9144,6 +9984,27 @@ internal class CardPaymentListPageResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardAuthorization.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardAuthorization.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardAuthorization.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardAuthorization.Type @@ -9390,6 +10251,27 @@ internal class CardPaymentListPageResponseTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardBalanceInquiry.Type @@ -9627,6 +10509,26 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardDecline.Reason .INSUFFICIENT_FUNDS ) + .addSchemeFee( + CardPayment.Element.CardDecline.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardDecline.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardDecline.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( CardPayment.Element.CardDecline.Verification.builder() @@ -9850,6 +10752,26 @@ internal class CardPaymentListPageResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardFinancial.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardFinancial.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFinancial.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardFinancial.Type.CARD_FINANCIAL) @@ -9923,6 +10845,29 @@ internal class CardPaymentListPageResponseTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .addSchemeFee( + CardPayment.Element.CardFuelConfirmation.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardFuelConfirmation + .SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFuelConfirmation + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardFuelConfirmation.Type .CARD_FUEL_CONFIRMATION @@ -10053,6 +10998,26 @@ internal class CardPaymentListPageResponseTest { .presentmentAmount(20L) .presentmentCurrency("USD") .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardIncrement.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardIncrement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardIncrement.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) .build() @@ -10302,6 +11267,25 @@ internal class CardPaymentListPageResponseTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardRefund.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardRefund.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardRefund.Type.CARD_REFUND) .build() @@ -10340,6 +11324,26 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardReversal.ReversalReason .REVERSED_BY_CUSTOMER ) + .addSchemeFee( + CardPayment.Element.CardReversal.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardReversal.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardReversal.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type(CardPayment.Element.CardReversal.Type.CARD_REVERSAL) .updatedAuthorizationAmount(80L) @@ -10603,6 +11607,26 @@ internal class CardPaymentListPageResponseTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardSettlement.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardSettlement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardSettlement.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( CardPayment.Element.CardSettlement.Surcharge.builder() .amount(0L) @@ -10785,6 +11809,26 @@ internal class CardPaymentListPageResponseTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardValidation.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardValidation.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardValidation.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardValidation.Type @@ -11200,6 +12244,27 @@ internal class CardPaymentListPageResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardAuthorization.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardAuthorization.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardAuthorization.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardAuthorization.Type @@ -11446,6 +12511,27 @@ internal class CardPaymentListPageResponseTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardBalanceInquiry.Type @@ -11683,6 +12769,26 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardDecline.Reason .INSUFFICIENT_FUNDS ) + .addSchemeFee( + CardPayment.Element.CardDecline.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardDecline.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardDecline.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( CardPayment.Element.CardDecline.Verification.builder() @@ -11906,6 +13012,26 @@ internal class CardPaymentListPageResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardFinancial.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardFinancial.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFinancial.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardFinancial.Type.CARD_FINANCIAL) @@ -11979,6 +13105,29 @@ internal class CardPaymentListPageResponseTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .addSchemeFee( + CardPayment.Element.CardFuelConfirmation.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardFuelConfirmation + .SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFuelConfirmation + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardFuelConfirmation.Type .CARD_FUEL_CONFIRMATION @@ -12109,6 +13258,26 @@ internal class CardPaymentListPageResponseTest { .presentmentAmount(20L) .presentmentCurrency("USD") .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardIncrement.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardIncrement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardIncrement.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) .build() @@ -12358,6 +13527,25 @@ internal class CardPaymentListPageResponseTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardRefund.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardRefund.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardRefund.Type.CARD_REFUND) .build() @@ -12396,6 +13584,26 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardReversal.ReversalReason .REVERSED_BY_CUSTOMER ) + .addSchemeFee( + CardPayment.Element.CardReversal.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardReversal.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardReversal.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type(CardPayment.Element.CardReversal.Type.CARD_REVERSAL) .updatedAuthorizationAmount(80L) @@ -12659,6 +13867,26 @@ internal class CardPaymentListPageResponseTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardSettlement.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardSettlement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardSettlement.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( CardPayment.Element.CardSettlement.Surcharge.builder() .amount(0L) @@ -12841,6 +14069,26 @@ internal class CardPaymentListPageResponseTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardValidation.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardValidation.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardValidation.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardValidation.Type @@ -13256,6 +14504,27 @@ internal class CardPaymentListPageResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardAuthorization.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardAuthorization.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardAuthorization.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardAuthorization.Type @@ -13502,6 +14771,27 @@ internal class CardPaymentListPageResponseTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardBalanceInquiry.Type @@ -13739,6 +15029,26 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardDecline.Reason .INSUFFICIENT_FUNDS ) + .addSchemeFee( + CardPayment.Element.CardDecline.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardDecline.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardDecline.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( CardPayment.Element.CardDecline.Verification.builder() @@ -13962,6 +15272,26 @@ internal class CardPaymentListPageResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardFinancial.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardFinancial.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFinancial.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardFinancial.Type.CARD_FINANCIAL) @@ -14035,6 +15365,29 @@ internal class CardPaymentListPageResponseTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .addSchemeFee( + CardPayment.Element.CardFuelConfirmation.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardFuelConfirmation + .SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFuelConfirmation + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardFuelConfirmation.Type .CARD_FUEL_CONFIRMATION @@ -14165,6 +15518,26 @@ internal class CardPaymentListPageResponseTest { .presentmentAmount(20L) .presentmentCurrency("USD") .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardIncrement.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardIncrement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardIncrement.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) .build() @@ -14414,6 +15787,25 @@ internal class CardPaymentListPageResponseTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardRefund.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardRefund.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardRefund.Type.CARD_REFUND) .build() @@ -14452,6 +15844,26 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardReversal.ReversalReason .REVERSED_BY_CUSTOMER ) + .addSchemeFee( + CardPayment.Element.CardReversal.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardReversal.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardReversal.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type(CardPayment.Element.CardReversal.Type.CARD_REVERSAL) .updatedAuthorizationAmount(80L) @@ -14715,6 +16127,26 @@ internal class CardPaymentListPageResponseTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardSettlement.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardSettlement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardSettlement.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( CardPayment.Element.CardSettlement.Surcharge.builder() .amount(0L) @@ -14897,6 +16329,26 @@ internal class CardPaymentListPageResponseTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardValidation.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardValidation.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardValidation.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardValidation.Type @@ -15312,6 +16764,27 @@ internal class CardPaymentListPageResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardAuthorization.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardAuthorization.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardAuthorization.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardAuthorization.Type @@ -15558,6 +17031,27 @@ internal class CardPaymentListPageResponseTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardBalanceInquiry.Type @@ -15795,6 +17289,26 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardDecline.Reason .INSUFFICIENT_FUNDS ) + .addSchemeFee( + CardPayment.Element.CardDecline.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardDecline.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardDecline.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( CardPayment.Element.CardDecline.Verification.builder() @@ -16018,6 +17532,26 @@ internal class CardPaymentListPageResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardFinancial.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardFinancial.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFinancial.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardFinancial.Type.CARD_FINANCIAL) @@ -16091,6 +17625,29 @@ internal class CardPaymentListPageResponseTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .addSchemeFee( + CardPayment.Element.CardFuelConfirmation.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardFuelConfirmation + .SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFuelConfirmation + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardFuelConfirmation.Type .CARD_FUEL_CONFIRMATION @@ -16221,6 +17778,26 @@ internal class CardPaymentListPageResponseTest { .presentmentAmount(20L) .presentmentCurrency("USD") .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardIncrement.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardIncrement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardIncrement.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) .build() @@ -16470,6 +18047,25 @@ internal class CardPaymentListPageResponseTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardRefund.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardRefund.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardRefund.Type.CARD_REFUND) .build() @@ -16508,6 +18104,26 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardReversal.ReversalReason .REVERSED_BY_CUSTOMER ) + .addSchemeFee( + CardPayment.Element.CardReversal.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardReversal.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardReversal.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type(CardPayment.Element.CardReversal.Type.CARD_REVERSAL) .updatedAuthorizationAmount(80L) @@ -16771,6 +18387,26 @@ internal class CardPaymentListPageResponseTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardSettlement.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardSettlement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardSettlement.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( CardPayment.Element.CardSettlement.Surcharge.builder() .amount(0L) @@ -16953,6 +18589,26 @@ internal class CardPaymentListPageResponseTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardValidation.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardValidation.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardValidation.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardValidation.Type @@ -17009,16 +18665,6 @@ internal class CardPaymentListPageResponseTest { ) ) .physicalCardId(null) - .addSchemeFee( - CardPayment.SchemeFee.builder() - .amount("0.137465") - .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .currency(CardPayment.SchemeFee.Currency.USD) - .feeType(CardPayment.SchemeFee.FeeType.VISA_CORPORATE_ACCEPTANCE_FEE) - .fixedComponent(null) - .variableRate("0.0002") - .build() - ) .state( CardPayment.State.builder() .authorizedAmount(100L) @@ -17428,6 +19074,29 @@ internal class CardPaymentListPageResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardAuthorization.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardAuthorization + .SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardAuthorization + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardAuthorization.Type @@ -17689,6 +19358,29 @@ internal class CardPaymentListPageResponseTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardBalanceInquiry + .SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardBalanceInquiry + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardBalanceInquiry.Type @@ -17938,6 +19630,26 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardDecline.Reason .INSUFFICIENT_FUNDS ) + .addSchemeFee( + CardPayment.Element.CardDecline.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardDecline.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardDecline.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( CardPayment.Element.CardDecline.Verification @@ -18172,6 +19884,27 @@ internal class CardPaymentListPageResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardFinancial.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardFinancial.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFinancial.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type( @@ -18258,6 +19991,29 @@ internal class CardPaymentListPageResponseTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .addSchemeFee( + CardPayment.Element.CardFuelConfirmation.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardFuelConfirmation + .SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFuelConfirmation + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardFuelConfirmation.Type .CARD_FUEL_CONFIRMATION @@ -18390,6 +20146,27 @@ internal class CardPaymentListPageResponseTest { .presentmentAmount(20L) .presentmentCurrency("USD") .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardIncrement.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardIncrement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardIncrement.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardIncrement.Type .CARD_INCREMENT @@ -18661,6 +20438,26 @@ internal class CardPaymentListPageResponseTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardRefund.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardRefund.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardRefund.Type.CARD_REFUND) .build() @@ -18699,6 +20496,26 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardReversal.ReversalReason .REVERSED_BY_CUSTOMER ) + .addSchemeFee( + CardPayment.Element.CardReversal.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardReversal.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardReversal.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardReversal.Type.CARD_REVERSAL @@ -18982,6 +20799,27 @@ internal class CardPaymentListPageResponseTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardSettlement.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardSettlement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardSettlement.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( CardPayment.Element.CardSettlement.Surcharge .builder() @@ -19169,6 +21007,27 @@ internal class CardPaymentListPageResponseTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardValidation.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardValidation.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardValidation.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardValidation.Type @@ -19607,6 +21466,29 @@ internal class CardPaymentListPageResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardAuthorization.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardAuthorization + .SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardAuthorization + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardAuthorization.Type @@ -19868,6 +21750,29 @@ internal class CardPaymentListPageResponseTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardBalanceInquiry + .SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardBalanceInquiry + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardBalanceInquiry.Type @@ -20117,6 +22022,26 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardDecline.Reason .INSUFFICIENT_FUNDS ) + .addSchemeFee( + CardPayment.Element.CardDecline.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardDecline.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardDecline.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( CardPayment.Element.CardDecline.Verification @@ -20351,6 +22276,27 @@ internal class CardPaymentListPageResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardFinancial.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardFinancial.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFinancial.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type( @@ -20437,6 +22383,29 @@ internal class CardPaymentListPageResponseTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .addSchemeFee( + CardPayment.Element.CardFuelConfirmation.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardFuelConfirmation + .SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFuelConfirmation + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardFuelConfirmation.Type .CARD_FUEL_CONFIRMATION @@ -20569,6 +22538,27 @@ internal class CardPaymentListPageResponseTest { .presentmentAmount(20L) .presentmentCurrency("USD") .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardIncrement.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardIncrement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardIncrement.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardIncrement.Type .CARD_INCREMENT @@ -20840,6 +22830,26 @@ internal class CardPaymentListPageResponseTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardRefund.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardRefund.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardRefund.Type.CARD_REFUND) .build() @@ -20878,6 +22888,26 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardReversal.ReversalReason .REVERSED_BY_CUSTOMER ) + .addSchemeFee( + CardPayment.Element.CardReversal.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardReversal.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardReversal.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardReversal.Type.CARD_REVERSAL @@ -21161,6 +23191,27 @@ internal class CardPaymentListPageResponseTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardSettlement.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardSettlement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardSettlement.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( CardPayment.Element.CardSettlement.Surcharge .builder() @@ -21345,9 +23396,30 @@ internal class CardPaymentListPageResponseTest { .transactionId("627199945183184") .build() ) - .networkRiskScore(10L) - .physicalCardId(null) - .realTimeDecisionId(null) + .networkRiskScore(10L) + .physicalCardId(null) + .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardValidation.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardValidation.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardValidation.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardValidation.Type @@ -21786,6 +23858,29 @@ internal class CardPaymentListPageResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardAuthorization.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardAuthorization + .SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardAuthorization + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardAuthorization.Type @@ -22047,6 +24142,29 @@ internal class CardPaymentListPageResponseTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardBalanceInquiry + .SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardBalanceInquiry + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardBalanceInquiry.Type @@ -22296,6 +24414,26 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardDecline.Reason .INSUFFICIENT_FUNDS ) + .addSchemeFee( + CardPayment.Element.CardDecline.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardDecline.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardDecline.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( CardPayment.Element.CardDecline.Verification @@ -22530,6 +24668,27 @@ internal class CardPaymentListPageResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardFinancial.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardFinancial.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFinancial.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type( @@ -22616,6 +24775,29 @@ internal class CardPaymentListPageResponseTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .addSchemeFee( + CardPayment.Element.CardFuelConfirmation.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardFuelConfirmation + .SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFuelConfirmation + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardFuelConfirmation.Type .CARD_FUEL_CONFIRMATION @@ -22748,6 +24930,27 @@ internal class CardPaymentListPageResponseTest { .presentmentAmount(20L) .presentmentCurrency("USD") .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardIncrement.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardIncrement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardIncrement.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardIncrement.Type .CARD_INCREMENT @@ -23019,6 +25222,26 @@ internal class CardPaymentListPageResponseTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardRefund.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardRefund.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardRefund.Type.CARD_REFUND) .build() @@ -23057,6 +25280,26 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardReversal.ReversalReason .REVERSED_BY_CUSTOMER ) + .addSchemeFee( + CardPayment.Element.CardReversal.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardReversal.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardReversal.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardReversal.Type.CARD_REVERSAL @@ -23340,6 +25583,27 @@ internal class CardPaymentListPageResponseTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardSettlement.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardSettlement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardSettlement.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( CardPayment.Element.CardSettlement.Surcharge .builder() @@ -23527,6 +25791,27 @@ internal class CardPaymentListPageResponseTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardValidation.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardValidation.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardValidation.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardValidation.Type @@ -23965,6 +26250,29 @@ internal class CardPaymentListPageResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardAuthorization.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardAuthorization + .SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardAuthorization + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardAuthorization.Type @@ -24226,6 +26534,29 @@ internal class CardPaymentListPageResponseTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardBalanceInquiry + .SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardBalanceInquiry + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardBalanceInquiry.Type @@ -24475,6 +26806,26 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardDecline.Reason .INSUFFICIENT_FUNDS ) + .addSchemeFee( + CardPayment.Element.CardDecline.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardDecline.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardDecline.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( CardPayment.Element.CardDecline.Verification @@ -24709,6 +27060,27 @@ internal class CardPaymentListPageResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardFinancial.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardFinancial.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFinancial.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type( @@ -24795,6 +27167,29 @@ internal class CardPaymentListPageResponseTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .addSchemeFee( + CardPayment.Element.CardFuelConfirmation.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardFuelConfirmation + .SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFuelConfirmation + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardFuelConfirmation.Type .CARD_FUEL_CONFIRMATION @@ -24927,6 +27322,27 @@ internal class CardPaymentListPageResponseTest { .presentmentAmount(20L) .presentmentCurrency("USD") .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardIncrement.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardIncrement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardIncrement.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardIncrement.Type .CARD_INCREMENT @@ -25198,6 +27614,26 @@ internal class CardPaymentListPageResponseTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardRefund.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardRefund.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardRefund.Type.CARD_REFUND) .build() @@ -25236,6 +27672,26 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardReversal.ReversalReason .REVERSED_BY_CUSTOMER ) + .addSchemeFee( + CardPayment.Element.CardReversal.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardReversal.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardReversal.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardReversal.Type.CARD_REVERSAL @@ -25519,6 +27975,27 @@ internal class CardPaymentListPageResponseTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardSettlement.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardSettlement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardSettlement.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( CardPayment.Element.CardSettlement.Surcharge .builder() @@ -25706,6 +28183,27 @@ internal class CardPaymentListPageResponseTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardValidation.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + CardPayment.Element.CardValidation.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardValidation.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardValidation.Type @@ -25769,18 +28267,6 @@ internal class CardPaymentListPageResponseTest { ) ) .physicalCardId(null) - .addSchemeFee( - CardPayment.SchemeFee.builder() - .amount("0.137465") - .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .currency(CardPayment.SchemeFee.Currency.USD) - .feeType( - CardPayment.SchemeFee.FeeType.VISA_CORPORATE_ACCEPTANCE_FEE - ) - .fixedComponent(null) - .variableRate("0.0002") - .build() - ) .state( CardPayment.State.builder() .authorizedAmount(100L) diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/cardpayments/CardPaymentTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/cardpayments/CardPaymentTest.kt index 14b6c3300..a16742672 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/cardpayments/CardPaymentTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/cardpayments/CardPaymentTest.kt @@ -370,6 +370,24 @@ internal class CardPaymentTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardAuthorization.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardAuthorization.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardAuthorization.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardAuthorization.Type @@ -605,6 +623,24 @@ internal class CardPaymentTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardBalanceInquiry.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardBalanceInquiry.Type @@ -821,6 +857,22 @@ internal class CardPaymentTest { .reason( CardPayment.Element.CardDecline.Reason.INSUFFICIENT_FUNDS ) + .addSchemeFee( + CardPayment.Element.CardDecline.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardDecline.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardDecline.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( CardPayment.Element.CardDecline.Verification.builder() @@ -1029,6 +1081,22 @@ internal class CardPaymentTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardFinancial.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardFinancial.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardFinancial.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardFinancial.Type.CARD_FINANCIAL) @@ -1095,6 +1163,24 @@ internal class CardPaymentTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .addSchemeFee( + CardPayment.Element.CardFuelConfirmation.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardFuelConfirmation.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFuelConfirmation.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardFuelConfirmation.Type .CARD_FUEL_CONFIRMATION @@ -1211,6 +1297,22 @@ internal class CardPaymentTest { .presentmentAmount(20L) .presentmentCurrency("USD") .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardIncrement.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardIncrement.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardIncrement.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) .build() @@ -1453,6 +1555,22 @@ internal class CardPaymentTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardRefund.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardRefund.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardRefund.Type.CARD_REFUND) .build() @@ -1489,6 +1607,22 @@ internal class CardPaymentTest { CardPayment.Element.CardReversal.ReversalReason .REVERSED_BY_CUSTOMER ) + .addSchemeFee( + CardPayment.Element.CardReversal.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardReversal.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardReversal.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type(CardPayment.Element.CardReversal.Type.CARD_REVERSAL) .updatedAuthorizationAmount(80L) @@ -1739,6 +1873,23 @@ internal class CardPaymentTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardSettlement.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardSettlement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardSettlement.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( CardPayment.Element.CardSettlement.Surcharge.builder() .amount(0L) @@ -1903,6 +2054,23 @@ internal class CardPaymentTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardValidation.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardValidation.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardValidation.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardValidation.Type @@ -2303,6 +2471,24 @@ internal class CardPaymentTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardAuthorization.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardAuthorization.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardAuthorization.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardAuthorization.Type @@ -2538,6 +2724,24 @@ internal class CardPaymentTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardBalanceInquiry.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardBalanceInquiry.Type @@ -2754,6 +2958,22 @@ internal class CardPaymentTest { .reason( CardPayment.Element.CardDecline.Reason.INSUFFICIENT_FUNDS ) + .addSchemeFee( + CardPayment.Element.CardDecline.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardDecline.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardDecline.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( CardPayment.Element.CardDecline.Verification.builder() @@ -2962,6 +3182,22 @@ internal class CardPaymentTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardFinancial.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardFinancial.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardFinancial.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardFinancial.Type.CARD_FINANCIAL) @@ -3028,6 +3264,24 @@ internal class CardPaymentTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .addSchemeFee( + CardPayment.Element.CardFuelConfirmation.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardFuelConfirmation.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFuelConfirmation.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardFuelConfirmation.Type .CARD_FUEL_CONFIRMATION @@ -3144,6 +3398,22 @@ internal class CardPaymentTest { .presentmentAmount(20L) .presentmentCurrency("USD") .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardIncrement.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardIncrement.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardIncrement.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) .build() @@ -3386,6 +3656,22 @@ internal class CardPaymentTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardRefund.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardRefund.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardRefund.Type.CARD_REFUND) .build() @@ -3422,6 +3708,22 @@ internal class CardPaymentTest { CardPayment.Element.CardReversal.ReversalReason .REVERSED_BY_CUSTOMER ) + .addSchemeFee( + CardPayment.Element.CardReversal.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardReversal.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardReversal.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type(CardPayment.Element.CardReversal.Type.CARD_REVERSAL) .updatedAuthorizationAmount(80L) @@ -3672,6 +3974,23 @@ internal class CardPaymentTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardSettlement.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardSettlement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardSettlement.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( CardPayment.Element.CardSettlement.Surcharge.builder() .amount(0L) @@ -3836,6 +4155,23 @@ internal class CardPaymentTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardValidation.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardValidation.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardValidation.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardValidation.Type @@ -4236,6 +4572,24 @@ internal class CardPaymentTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardAuthorization.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardAuthorization.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardAuthorization.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardAuthorization.Type @@ -4471,6 +4825,24 @@ internal class CardPaymentTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardBalanceInquiry.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardBalanceInquiry.Type @@ -4687,6 +5059,22 @@ internal class CardPaymentTest { .reason( CardPayment.Element.CardDecline.Reason.INSUFFICIENT_FUNDS ) + .addSchemeFee( + CardPayment.Element.CardDecline.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardDecline.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardDecline.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( CardPayment.Element.CardDecline.Verification.builder() @@ -4895,6 +5283,22 @@ internal class CardPaymentTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardFinancial.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardFinancial.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardFinancial.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardFinancial.Type.CARD_FINANCIAL) @@ -4961,6 +5365,24 @@ internal class CardPaymentTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .addSchemeFee( + CardPayment.Element.CardFuelConfirmation.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardFuelConfirmation.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFuelConfirmation.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardFuelConfirmation.Type .CARD_FUEL_CONFIRMATION @@ -5077,6 +5499,22 @@ internal class CardPaymentTest { .presentmentAmount(20L) .presentmentCurrency("USD") .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardIncrement.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardIncrement.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardIncrement.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) .build() @@ -5319,6 +5757,22 @@ internal class CardPaymentTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardRefund.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardRefund.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardRefund.Type.CARD_REFUND) .build() @@ -5355,6 +5809,22 @@ internal class CardPaymentTest { CardPayment.Element.CardReversal.ReversalReason .REVERSED_BY_CUSTOMER ) + .addSchemeFee( + CardPayment.Element.CardReversal.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardReversal.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardReversal.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type(CardPayment.Element.CardReversal.Type.CARD_REVERSAL) .updatedAuthorizationAmount(80L) @@ -5605,6 +6075,23 @@ internal class CardPaymentTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardSettlement.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardSettlement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardSettlement.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( CardPayment.Element.CardSettlement.Surcharge.builder() .amount(0L) @@ -5769,6 +6256,23 @@ internal class CardPaymentTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardValidation.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardValidation.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardValidation.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardValidation.Type @@ -6169,7 +6673,25 @@ internal class CardPaymentTest { .PURCHASE ) .realTimeDecisionId(null) - .terminalId("RCN5VNXS") + .addSchemeFee( + CardPayment.Element.CardAuthorization.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardAuthorization.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardAuthorization.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) + .terminalId("RCN5VNXS") .type( CardPayment.Element.CardAuthorization.Type .CARD_AUTHORIZATION @@ -6404,6 +6926,24 @@ internal class CardPaymentTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardBalanceInquiry.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardBalanceInquiry.Type @@ -6620,6 +7160,22 @@ internal class CardPaymentTest { .reason( CardPayment.Element.CardDecline.Reason.INSUFFICIENT_FUNDS ) + .addSchemeFee( + CardPayment.Element.CardDecline.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardDecline.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardDecline.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( CardPayment.Element.CardDecline.Verification.builder() @@ -6828,6 +7384,22 @@ internal class CardPaymentTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardFinancial.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardFinancial.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardFinancial.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardFinancial.Type.CARD_FINANCIAL) @@ -6894,6 +7466,24 @@ internal class CardPaymentTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .addSchemeFee( + CardPayment.Element.CardFuelConfirmation.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardFuelConfirmation.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFuelConfirmation.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardFuelConfirmation.Type .CARD_FUEL_CONFIRMATION @@ -7010,6 +7600,22 @@ internal class CardPaymentTest { .presentmentAmount(20L) .presentmentCurrency("USD") .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardIncrement.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardIncrement.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardIncrement.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) .build() @@ -7252,6 +7858,22 @@ internal class CardPaymentTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardRefund.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardRefund.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardRefund.Type.CARD_REFUND) .build() @@ -7288,6 +7910,22 @@ internal class CardPaymentTest { CardPayment.Element.CardReversal.ReversalReason .REVERSED_BY_CUSTOMER ) + .addSchemeFee( + CardPayment.Element.CardReversal.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardReversal.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardReversal.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type(CardPayment.Element.CardReversal.Type.CARD_REVERSAL) .updatedAuthorizationAmount(80L) @@ -7538,6 +8176,23 @@ internal class CardPaymentTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardSettlement.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardSettlement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardSettlement.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( CardPayment.Element.CardSettlement.Surcharge.builder() .amount(0L) @@ -7702,6 +8357,23 @@ internal class CardPaymentTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardValidation.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardValidation.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardValidation.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardValidation.Type @@ -7757,16 +8429,6 @@ internal class CardPaymentTest { ) ) .physicalCardId(null) - .addSchemeFee( - CardPayment.SchemeFee.builder() - .amount("0.137465") - .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .currency(CardPayment.SchemeFee.Currency.USD) - .feeType(CardPayment.SchemeFee.FeeType.VISA_CORPORATE_ACCEPTANCE_FEE) - .fixedComponent(null) - .variableRate("0.0002") - .build() - ) .state( CardPayment.State.builder() .authorizedAmount(100L) @@ -8094,6 +8756,21 @@ internal class CardPaymentTest { CardPayment.Element.CardAuthorization.ProcessingCategory.PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardAuthorization.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardAuthorization.SchemeFee.Currency.USD + ) + .feeType( + CardPayment.Element.CardAuthorization.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type(CardPayment.Element.CardAuthorization.Type.CARD_AUTHORIZATION) .verification( @@ -8302,6 +8979,22 @@ internal class CardPaymentTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardBalanceInquiry.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardBalanceInquiry.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardBalanceInquiry.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type(CardPayment.Element.CardBalanceInquiry.Type.CARD_BALANCE_INQUIRY) .verification( @@ -8493,6 +9186,21 @@ internal class CardPaymentTest { .realTimeDecisionId(null) .realTimeDecisionReason(null) .reason(CardPayment.Element.CardDecline.Reason.INSUFFICIENT_FUNDS) + .addSchemeFee( + CardPayment.Element.CardDecline.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardDecline.SchemeFee.Currency.USD + ) + .feeType( + CardPayment.Element.CardDecline.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( CardPayment.Element.CardDecline.Verification.builder() @@ -8683,6 +9391,21 @@ internal class CardPaymentTest { CardPayment.Element.CardFinancial.ProcessingCategory.PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardFinancial.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardFinancial.SchemeFee.Currency.USD + ) + .feeType( + CardPayment.Element.CardFinancial.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardFinancial.Type.CARD_FINANCIAL) @@ -8745,6 +9468,22 @@ internal class CardPaymentTest { .build() ) .pendingTransactionId("pending_transaction_k1sfetcau2qbvjbzgju4") + .addSchemeFee( + CardPayment.Element.CardFuelConfirmation.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardFuelConfirmation.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardFuelConfirmation.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardFuelConfirmation.Type.CARD_FUEL_CONFIRMATION ) @@ -8850,6 +9589,21 @@ internal class CardPaymentTest { .presentmentAmount(20L) .presentmentCurrency("USD") .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardIncrement.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardIncrement.SchemeFee.Currency.USD + ) + .feeType( + CardPayment.Element.CardIncrement.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) .build() @@ -9068,6 +9822,19 @@ internal class CardPaymentTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency(CardPayment.Element.CardRefund.SchemeFee.Currency.USD) + .feeType( + CardPayment.Element.CardRefund.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardRefund.Type.CARD_REFUND) .build() @@ -9100,6 +9867,21 @@ internal class CardPaymentTest { .reversalReason( CardPayment.Element.CardReversal.ReversalReason.REVERSED_BY_CUSTOMER ) + .addSchemeFee( + CardPayment.Element.CardReversal.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardReversal.SchemeFee.Currency.USD + ) + .feeType( + CardPayment.Element.CardReversal.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type(CardPayment.Element.CardReversal.Type.CARD_REVERSAL) .updatedAuthorizationAmount(80L) @@ -9325,6 +10107,21 @@ internal class CardPaymentTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardSettlement.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardSettlement.SchemeFee.Currency.USD + ) + .feeType( + CardPayment.Element.CardSettlement.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( CardPayment.Element.CardSettlement.Surcharge.builder() .amount(0L) @@ -9476,6 +10273,21 @@ internal class CardPaymentTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardValidation.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardValidation.SchemeFee.Currency.USD + ) + .feeType( + CardPayment.Element.CardValidation.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type(CardPayment.Element.CardValidation.Type.INBOUND_CARD_VALIDATION) .verification( @@ -9829,6 +10641,21 @@ internal class CardPaymentTest { CardPayment.Element.CardAuthorization.ProcessingCategory.PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardAuthorization.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardAuthorization.SchemeFee.Currency.USD + ) + .feeType( + CardPayment.Element.CardAuthorization.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type(CardPayment.Element.CardAuthorization.Type.CARD_AUTHORIZATION) .verification( @@ -10037,6 +10864,22 @@ internal class CardPaymentTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardBalanceInquiry.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardBalanceInquiry.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardBalanceInquiry.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type(CardPayment.Element.CardBalanceInquiry.Type.CARD_BALANCE_INQUIRY) .verification( @@ -10228,6 +11071,21 @@ internal class CardPaymentTest { .realTimeDecisionId(null) .realTimeDecisionReason(null) .reason(CardPayment.Element.CardDecline.Reason.INSUFFICIENT_FUNDS) + .addSchemeFee( + CardPayment.Element.CardDecline.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardDecline.SchemeFee.Currency.USD + ) + .feeType( + CardPayment.Element.CardDecline.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( CardPayment.Element.CardDecline.Verification.builder() @@ -10418,6 +11276,21 @@ internal class CardPaymentTest { CardPayment.Element.CardFinancial.ProcessingCategory.PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardFinancial.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardFinancial.SchemeFee.Currency.USD + ) + .feeType( + CardPayment.Element.CardFinancial.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardFinancial.Type.CARD_FINANCIAL) @@ -10480,6 +11353,22 @@ internal class CardPaymentTest { .build() ) .pendingTransactionId("pending_transaction_k1sfetcau2qbvjbzgju4") + .addSchemeFee( + CardPayment.Element.CardFuelConfirmation.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardFuelConfirmation.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardFuelConfirmation.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardFuelConfirmation.Type.CARD_FUEL_CONFIRMATION ) @@ -10585,6 +11474,21 @@ internal class CardPaymentTest { .presentmentAmount(20L) .presentmentCurrency("USD") .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardIncrement.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardIncrement.SchemeFee.Currency.USD + ) + .feeType( + CardPayment.Element.CardIncrement.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) .build() @@ -10803,6 +11707,19 @@ internal class CardPaymentTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency(CardPayment.Element.CardRefund.SchemeFee.Currency.USD) + .feeType( + CardPayment.Element.CardRefund.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardRefund.Type.CARD_REFUND) .build() @@ -10835,6 +11752,21 @@ internal class CardPaymentTest { .reversalReason( CardPayment.Element.CardReversal.ReversalReason.REVERSED_BY_CUSTOMER ) + .addSchemeFee( + CardPayment.Element.CardReversal.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardReversal.SchemeFee.Currency.USD + ) + .feeType( + CardPayment.Element.CardReversal.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type(CardPayment.Element.CardReversal.Type.CARD_REVERSAL) .updatedAuthorizationAmount(80L) @@ -11060,6 +11992,21 @@ internal class CardPaymentTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardSettlement.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardSettlement.SchemeFee.Currency.USD + ) + .feeType( + CardPayment.Element.CardSettlement.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( CardPayment.Element.CardSettlement.Surcharge.builder() .amount(0L) @@ -11211,6 +12158,21 @@ internal class CardPaymentTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardValidation.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardValidation.SchemeFee.Currency.USD + ) + .feeType( + CardPayment.Element.CardValidation.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type(CardPayment.Element.CardValidation.Type.INBOUND_CARD_VALIDATION) .verification( @@ -11564,6 +12526,21 @@ internal class CardPaymentTest { CardPayment.Element.CardAuthorization.ProcessingCategory.PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardAuthorization.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardAuthorization.SchemeFee.Currency.USD + ) + .feeType( + CardPayment.Element.CardAuthorization.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type(CardPayment.Element.CardAuthorization.Type.CARD_AUTHORIZATION) .verification( @@ -11772,6 +12749,22 @@ internal class CardPaymentTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardBalanceInquiry.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardBalanceInquiry.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardBalanceInquiry.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type(CardPayment.Element.CardBalanceInquiry.Type.CARD_BALANCE_INQUIRY) .verification( @@ -11963,6 +12956,21 @@ internal class CardPaymentTest { .realTimeDecisionId(null) .realTimeDecisionReason(null) .reason(CardPayment.Element.CardDecline.Reason.INSUFFICIENT_FUNDS) + .addSchemeFee( + CardPayment.Element.CardDecline.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardDecline.SchemeFee.Currency.USD + ) + .feeType( + CardPayment.Element.CardDecline.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( CardPayment.Element.CardDecline.Verification.builder() @@ -12153,6 +13161,21 @@ internal class CardPaymentTest { CardPayment.Element.CardFinancial.ProcessingCategory.PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardFinancial.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardFinancial.SchemeFee.Currency.USD + ) + .feeType( + CardPayment.Element.CardFinancial.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardFinancial.Type.CARD_FINANCIAL) @@ -12215,10 +13238,26 @@ internal class CardPaymentTest { .build() ) .pendingTransactionId("pending_transaction_k1sfetcau2qbvjbzgju4") - .type( - CardPayment.Element.CardFuelConfirmation.Type.CARD_FUEL_CONFIRMATION - ) - .updatedAuthorizationAmount(120L) + .addSchemeFee( + CardPayment.Element.CardFuelConfirmation.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardFuelConfirmation.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardFuelConfirmation.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) + .type( + CardPayment.Element.CardFuelConfirmation.Type.CARD_FUEL_CONFIRMATION + ) + .updatedAuthorizationAmount(120L) .build() ) .cardIncrement( @@ -12320,6 +13359,21 @@ internal class CardPaymentTest { .presentmentAmount(20L) .presentmentCurrency("USD") .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardIncrement.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardIncrement.SchemeFee.Currency.USD + ) + .feeType( + CardPayment.Element.CardIncrement.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) .build() @@ -12538,6 +13592,19 @@ internal class CardPaymentTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency(CardPayment.Element.CardRefund.SchemeFee.Currency.USD) + .feeType( + CardPayment.Element.CardRefund.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardRefund.Type.CARD_REFUND) .build() @@ -12570,6 +13637,21 @@ internal class CardPaymentTest { .reversalReason( CardPayment.Element.CardReversal.ReversalReason.REVERSED_BY_CUSTOMER ) + .addSchemeFee( + CardPayment.Element.CardReversal.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardReversal.SchemeFee.Currency.USD + ) + .feeType( + CardPayment.Element.CardReversal.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type(CardPayment.Element.CardReversal.Type.CARD_REVERSAL) .updatedAuthorizationAmount(80L) @@ -12795,6 +13877,21 @@ internal class CardPaymentTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardSettlement.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardSettlement.SchemeFee.Currency.USD + ) + .feeType( + CardPayment.Element.CardSettlement.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( CardPayment.Element.CardSettlement.Surcharge.builder() .amount(0L) @@ -12946,6 +14043,21 @@ internal class CardPaymentTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardValidation.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardValidation.SchemeFee.Currency.USD + ) + .feeType( + CardPayment.Element.CardValidation.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type(CardPayment.Element.CardValidation.Type.INBOUND_CARD_VALIDATION) .verification( @@ -13299,6 +14411,21 @@ internal class CardPaymentTest { CardPayment.Element.CardAuthorization.ProcessingCategory.PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardAuthorization.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardAuthorization.SchemeFee.Currency.USD + ) + .feeType( + CardPayment.Element.CardAuthorization.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type(CardPayment.Element.CardAuthorization.Type.CARD_AUTHORIZATION) .verification( @@ -13507,6 +14634,22 @@ internal class CardPaymentTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardBalanceInquiry.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardBalanceInquiry.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardBalanceInquiry.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type(CardPayment.Element.CardBalanceInquiry.Type.CARD_BALANCE_INQUIRY) .verification( @@ -13698,6 +14841,21 @@ internal class CardPaymentTest { .realTimeDecisionId(null) .realTimeDecisionReason(null) .reason(CardPayment.Element.CardDecline.Reason.INSUFFICIENT_FUNDS) + .addSchemeFee( + CardPayment.Element.CardDecline.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardDecline.SchemeFee.Currency.USD + ) + .feeType( + CardPayment.Element.CardDecline.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( CardPayment.Element.CardDecline.Verification.builder() @@ -13888,6 +15046,21 @@ internal class CardPaymentTest { CardPayment.Element.CardFinancial.ProcessingCategory.PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardFinancial.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardFinancial.SchemeFee.Currency.USD + ) + .feeType( + CardPayment.Element.CardFinancial.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardFinancial.Type.CARD_FINANCIAL) @@ -13950,6 +15123,22 @@ internal class CardPaymentTest { .build() ) .pendingTransactionId("pending_transaction_k1sfetcau2qbvjbzgju4") + .addSchemeFee( + CardPayment.Element.CardFuelConfirmation.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardFuelConfirmation.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardFuelConfirmation.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardFuelConfirmation.Type.CARD_FUEL_CONFIRMATION ) @@ -14055,6 +15244,21 @@ internal class CardPaymentTest { .presentmentAmount(20L) .presentmentCurrency("USD") .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardIncrement.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardIncrement.SchemeFee.Currency.USD + ) + .feeType( + CardPayment.Element.CardIncrement.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) .build() @@ -14273,6 +15477,19 @@ internal class CardPaymentTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency(CardPayment.Element.CardRefund.SchemeFee.Currency.USD) + .feeType( + CardPayment.Element.CardRefund.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardRefund.Type.CARD_REFUND) .build() @@ -14305,6 +15522,21 @@ internal class CardPaymentTest { .reversalReason( CardPayment.Element.CardReversal.ReversalReason.REVERSED_BY_CUSTOMER ) + .addSchemeFee( + CardPayment.Element.CardReversal.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardReversal.SchemeFee.Currency.USD + ) + .feeType( + CardPayment.Element.CardReversal.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type(CardPayment.Element.CardReversal.Type.CARD_REVERSAL) .updatedAuthorizationAmount(80L) @@ -14530,6 +15762,21 @@ internal class CardPaymentTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardSettlement.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardSettlement.SchemeFee.Currency.USD + ) + .feeType( + CardPayment.Element.CardSettlement.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( CardPayment.Element.CardSettlement.Surcharge.builder() .amount(0L) @@ -14681,6 +15928,21 @@ internal class CardPaymentTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardValidation.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardValidation.SchemeFee.Currency.USD + ) + .feeType( + CardPayment.Element.CardValidation.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type(CardPayment.Element.CardValidation.Type.INBOUND_CARD_VALIDATION) .verification( @@ -14730,17 +15992,6 @@ internal class CardPaymentTest { .build(), ) assertThat(cardPayment.physicalCardId()).isEmpty - assertThat(cardPayment.schemeFees()) - .containsExactly( - CardPayment.SchemeFee.builder() - .amount("0.137465") - .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .currency(CardPayment.SchemeFee.Currency.USD) - .feeType(CardPayment.SchemeFee.FeeType.VISA_CORPORATE_ACCEPTANCE_FEE) - .fixedComponent(null) - .variableRate("0.0002") - .build() - ) assertThat(cardPayment.state()) .isEqualTo( CardPayment.State.builder() @@ -15116,6 +16367,24 @@ internal class CardPaymentTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardAuthorization.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardAuthorization.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardAuthorization.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardAuthorization.Type @@ -15351,6 +16620,24 @@ internal class CardPaymentTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardBalanceInquiry.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardBalanceInquiry.Type @@ -15567,6 +16854,22 @@ internal class CardPaymentTest { .reason( CardPayment.Element.CardDecline.Reason.INSUFFICIENT_FUNDS ) + .addSchemeFee( + CardPayment.Element.CardDecline.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardDecline.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardDecline.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( CardPayment.Element.CardDecline.Verification.builder() @@ -15775,6 +17078,22 @@ internal class CardPaymentTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardFinancial.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardFinancial.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardFinancial.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardFinancial.Type.CARD_FINANCIAL) @@ -15841,6 +17160,24 @@ internal class CardPaymentTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .addSchemeFee( + CardPayment.Element.CardFuelConfirmation.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardFuelConfirmation.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFuelConfirmation.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardFuelConfirmation.Type .CARD_FUEL_CONFIRMATION @@ -15957,6 +17294,22 @@ internal class CardPaymentTest { .presentmentAmount(20L) .presentmentCurrency("USD") .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardIncrement.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardIncrement.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardIncrement.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) .build() @@ -16199,6 +17552,22 @@ internal class CardPaymentTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardRefund.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardRefund.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardRefund.Type.CARD_REFUND) .build() @@ -16235,6 +17604,22 @@ internal class CardPaymentTest { CardPayment.Element.CardReversal.ReversalReason .REVERSED_BY_CUSTOMER ) + .addSchemeFee( + CardPayment.Element.CardReversal.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardReversal.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardReversal.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type(CardPayment.Element.CardReversal.Type.CARD_REVERSAL) .updatedAuthorizationAmount(80L) @@ -16485,6 +17870,23 @@ internal class CardPaymentTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardSettlement.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardSettlement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardSettlement.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( CardPayment.Element.CardSettlement.Surcharge.builder() .amount(0L) @@ -16649,6 +18051,23 @@ internal class CardPaymentTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardValidation.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardValidation.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardValidation.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardValidation.Type @@ -17049,6 +18468,24 @@ internal class CardPaymentTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardAuthorization.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardAuthorization.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardAuthorization.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardAuthorization.Type @@ -17284,6 +18721,24 @@ internal class CardPaymentTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardBalanceInquiry.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardBalanceInquiry.Type @@ -17500,6 +18955,22 @@ internal class CardPaymentTest { .reason( CardPayment.Element.CardDecline.Reason.INSUFFICIENT_FUNDS ) + .addSchemeFee( + CardPayment.Element.CardDecline.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardDecline.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardDecline.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( CardPayment.Element.CardDecline.Verification.builder() @@ -17708,6 +19179,22 @@ internal class CardPaymentTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardFinancial.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardFinancial.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardFinancial.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardFinancial.Type.CARD_FINANCIAL) @@ -17774,6 +19261,24 @@ internal class CardPaymentTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .addSchemeFee( + CardPayment.Element.CardFuelConfirmation.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardFuelConfirmation.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFuelConfirmation.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardFuelConfirmation.Type .CARD_FUEL_CONFIRMATION @@ -17890,6 +19395,22 @@ internal class CardPaymentTest { .presentmentAmount(20L) .presentmentCurrency("USD") .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardIncrement.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardIncrement.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardIncrement.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) .build() @@ -18132,6 +19653,22 @@ internal class CardPaymentTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardRefund.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardRefund.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardRefund.Type.CARD_REFUND) .build() @@ -18168,6 +19705,22 @@ internal class CardPaymentTest { CardPayment.Element.CardReversal.ReversalReason .REVERSED_BY_CUSTOMER ) + .addSchemeFee( + CardPayment.Element.CardReversal.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardReversal.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardReversal.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type(CardPayment.Element.CardReversal.Type.CARD_REVERSAL) .updatedAuthorizationAmount(80L) @@ -18418,6 +19971,23 @@ internal class CardPaymentTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardSettlement.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardSettlement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardSettlement.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( CardPayment.Element.CardSettlement.Surcharge.builder() .amount(0L) @@ -18582,6 +20152,23 @@ internal class CardPaymentTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardValidation.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardValidation.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardValidation.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardValidation.Type @@ -18982,6 +20569,24 @@ internal class CardPaymentTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardAuthorization.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardAuthorization.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardAuthorization.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardAuthorization.Type @@ -19217,6 +20822,24 @@ internal class CardPaymentTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardBalanceInquiry.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardBalanceInquiry.Type @@ -19433,6 +21056,22 @@ internal class CardPaymentTest { .reason( CardPayment.Element.CardDecline.Reason.INSUFFICIENT_FUNDS ) + .addSchemeFee( + CardPayment.Element.CardDecline.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardDecline.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardDecline.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( CardPayment.Element.CardDecline.Verification.builder() @@ -19641,6 +21280,22 @@ internal class CardPaymentTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardFinancial.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardFinancial.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardFinancial.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardFinancial.Type.CARD_FINANCIAL) @@ -19707,6 +21362,24 @@ internal class CardPaymentTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .addSchemeFee( + CardPayment.Element.CardFuelConfirmation.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardFuelConfirmation.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFuelConfirmation.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardFuelConfirmation.Type .CARD_FUEL_CONFIRMATION @@ -19823,6 +21496,22 @@ internal class CardPaymentTest { .presentmentAmount(20L) .presentmentCurrency("USD") .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardIncrement.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardIncrement.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardIncrement.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) .build() @@ -20065,6 +21754,22 @@ internal class CardPaymentTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardRefund.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardRefund.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardRefund.Type.CARD_REFUND) .build() @@ -20101,6 +21806,22 @@ internal class CardPaymentTest { CardPayment.Element.CardReversal.ReversalReason .REVERSED_BY_CUSTOMER ) + .addSchemeFee( + CardPayment.Element.CardReversal.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardReversal.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardReversal.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type(CardPayment.Element.CardReversal.Type.CARD_REVERSAL) .updatedAuthorizationAmount(80L) @@ -20351,6 +22072,23 @@ internal class CardPaymentTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardSettlement.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardSettlement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardSettlement.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( CardPayment.Element.CardSettlement.Surcharge.builder() .amount(0L) @@ -20515,6 +22253,23 @@ internal class CardPaymentTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardValidation.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardValidation.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardValidation.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardValidation.Type @@ -20915,6 +22670,24 @@ internal class CardPaymentTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardAuthorization.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardAuthorization.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardAuthorization.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardAuthorization.Type @@ -21150,6 +22923,24 @@ internal class CardPaymentTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardBalanceInquiry.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardBalanceInquiry.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardBalanceInquiry.Type @@ -21366,6 +23157,22 @@ internal class CardPaymentTest { .reason( CardPayment.Element.CardDecline.Reason.INSUFFICIENT_FUNDS ) + .addSchemeFee( + CardPayment.Element.CardDecline.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardDecline.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardDecline.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( CardPayment.Element.CardDecline.Verification.builder() @@ -21574,6 +23381,22 @@ internal class CardPaymentTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardFinancial.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardFinancial.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardFinancial.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardFinancial.Type.CARD_FINANCIAL) @@ -21640,6 +23463,24 @@ internal class CardPaymentTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .addSchemeFee( + CardPayment.Element.CardFuelConfirmation.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardFuelConfirmation.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardFuelConfirmation.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type( CardPayment.Element.CardFuelConfirmation.Type .CARD_FUEL_CONFIRMATION @@ -21756,6 +23597,22 @@ internal class CardPaymentTest { .presentmentAmount(20L) .presentmentCurrency("USD") .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardIncrement.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardIncrement.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardIncrement.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) .build() @@ -21998,6 +23855,22 @@ internal class CardPaymentTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardRefund.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardRefund.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(CardPayment.Element.CardRefund.Type.CARD_REFUND) .build() @@ -22034,6 +23907,22 @@ internal class CardPaymentTest { CardPayment.Element.CardReversal.ReversalReason .REVERSED_BY_CUSTOMER ) + .addSchemeFee( + CardPayment.Element.CardReversal.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardReversal.SchemeFee.Currency + .USD + ) + .feeType( + CardPayment.Element.CardReversal.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type(CardPayment.Element.CardReversal.Type.CARD_REVERSAL) .updatedAuthorizationAmount(80L) @@ -22284,6 +24173,23 @@ internal class CardPaymentTest { ) .build() ) + .addSchemeFee( + CardPayment.Element.CardSettlement.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardSettlement.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardSettlement.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( CardPayment.Element.CardSettlement.Surcharge.builder() .amount(0L) @@ -22448,6 +24354,23 @@ internal class CardPaymentTest { .networkRiskScore(10L) .physicalCardId(null) .realTimeDecisionId(null) + .addSchemeFee( + CardPayment.Element.CardValidation.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + CardPayment.Element.CardValidation.SchemeFee + .Currency + .USD + ) + .feeType( + CardPayment.Element.CardValidation.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( CardPayment.Element.CardValidation.Type @@ -22503,16 +24426,6 @@ internal class CardPaymentTest { ) ) .physicalCardId(null) - .addSchemeFee( - CardPayment.SchemeFee.builder() - .amount("0.137465") - .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .currency(CardPayment.SchemeFee.Currency.USD) - .feeType(CardPayment.SchemeFee.FeeType.VISA_CORPORATE_ACCEPTANCE_FEE) - .fixedComponent(null) - .variableRate("0.0002") - .build() - ) .state( CardPayment.State.builder() .authorizedAmount(100L) diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/declinedtransactions/DeclinedTransactionListPageResponseTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/declinedtransactions/DeclinedTransactionListPageResponseTest.kt index 0643da90a..041902237 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/declinedtransactions/DeclinedTransactionListPageResponseTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/declinedtransactions/DeclinedTransactionListPageResponseTest.kt @@ -244,6 +244,27 @@ internal class DeclinedTransactionListPageResponseTest { DeclinedTransaction.Source.CardDecline.Reason .INSUFFICIENT_FUNDS ) + .addSchemeFee( + DeclinedTransaction.Source.CardDecline.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + DeclinedTransaction.Source.CardDecline.SchemeFee + .Currency + .USD + ) + .feeType( + DeclinedTransaction.Source.CardDecline.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( DeclinedTransaction.Source.CardDecline.Verification @@ -614,6 +635,24 @@ internal class DeclinedTransactionListPageResponseTest { DeclinedTransaction.Source.CardDecline.Reason .INSUFFICIENT_FUNDS ) + .addSchemeFee( + DeclinedTransaction.Source.CardDecline.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + DeclinedTransaction.Source.CardDecline.SchemeFee + .Currency + .USD + ) + .feeType( + DeclinedTransaction.Source.CardDecline.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( DeclinedTransaction.Source.CardDecline.Verification @@ -989,6 +1028,27 @@ internal class DeclinedTransactionListPageResponseTest { DeclinedTransaction.Source.CardDecline.Reason .INSUFFICIENT_FUNDS ) + .addSchemeFee( + DeclinedTransaction.Source.CardDecline.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + DeclinedTransaction.Source.CardDecline.SchemeFee + .Currency + .USD + ) + .feeType( + DeclinedTransaction.Source.CardDecline.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( DeclinedTransaction.Source.CardDecline.Verification diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/declinedtransactions/DeclinedTransactionTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/declinedtransactions/DeclinedTransactionTest.kt index ad827b653..db8747219 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/declinedtransactions/DeclinedTransactionTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/declinedtransactions/DeclinedTransactionTest.kt @@ -213,6 +213,23 @@ internal class DeclinedTransactionTest { .reason( DeclinedTransaction.Source.CardDecline.Reason.INSUFFICIENT_FUNDS ) + .addSchemeFee( + DeclinedTransaction.Source.CardDecline.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + DeclinedTransaction.Source.CardDecline.SchemeFee + .Currency + .USD + ) + .feeType( + DeclinedTransaction.Source.CardDecline.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( DeclinedTransaction.Source.CardDecline.Verification.builder() @@ -532,6 +549,22 @@ internal class DeclinedTransactionTest { .reason( DeclinedTransaction.Source.CardDecline.Reason.INSUFFICIENT_FUNDS ) + .addSchemeFee( + DeclinedTransaction.Source.CardDecline.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + DeclinedTransaction.Source.CardDecline.SchemeFee.Currency + .USD + ) + .feeType( + DeclinedTransaction.Source.CardDecline.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( DeclinedTransaction.Source.CardDecline.Verification.builder() @@ -853,6 +886,23 @@ internal class DeclinedTransactionTest { .reason( DeclinedTransaction.Source.CardDecline.Reason.INSUFFICIENT_FUNDS ) + .addSchemeFee( + DeclinedTransaction.Source.CardDecline.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + DeclinedTransaction.Source.CardDecline.SchemeFee + .Currency + .USD + ) + .feeType( + DeclinedTransaction.Source.CardDecline.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( DeclinedTransaction.Source.CardDecline.Verification.builder() diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/pendingtransactions/PendingTransactionListPageResponseTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/pendingtransactions/PendingTransactionListPageResponseTest.kt index f295deb13..bf61490ca 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/pendingtransactions/PendingTransactionListPageResponseTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/pendingtransactions/PendingTransactionListPageResponseTest.kt @@ -265,6 +265,29 @@ internal class PendingTransactionListPageResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + PendingTransaction.Source.CardAuthorization.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + PendingTransaction.Source.CardAuthorization + .SchemeFee + .Currency + .USD + ) + .feeType( + PendingTransaction.Source.CardAuthorization + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( PendingTransaction.Source.CardAuthorization.Type @@ -668,6 +691,27 @@ internal class PendingTransactionListPageResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + PendingTransaction.Source.CardAuthorization.SchemeFee + .builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + PendingTransaction.Source.CardAuthorization + .SchemeFee + .Currency + .USD + ) + .feeType( + PendingTransaction.Source.CardAuthorization + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( PendingTransaction.Source.CardAuthorization.Type @@ -1075,6 +1119,29 @@ internal class PendingTransactionListPageResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + PendingTransaction.Source.CardAuthorization.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + PendingTransaction.Source.CardAuthorization + .SchemeFee + .Currency + .USD + ) + .feeType( + PendingTransaction.Source.CardAuthorization + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( PendingTransaction.Source.CardAuthorization.Type diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/pendingtransactions/PendingTransactionTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/pendingtransactions/PendingTransactionTest.kt index b256fafcc..da084b16a 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/pendingtransactions/PendingTransactionTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/pendingtransactions/PendingTransactionTest.kt @@ -243,6 +243,24 @@ internal class PendingTransactionTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + PendingTransaction.Source.CardAuthorization.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + PendingTransaction.Source.CardAuthorization.SchemeFee + .Currency + .USD + ) + .feeType( + PendingTransaction.Source.CardAuthorization.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( PendingTransaction.Source.CardAuthorization.Type @@ -601,6 +619,24 @@ internal class PendingTransactionTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + PendingTransaction.Source.CardAuthorization.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + PendingTransaction.Source.CardAuthorization.SchemeFee + .Currency + .USD + ) + .feeType( + PendingTransaction.Source.CardAuthorization.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( PendingTransaction.Source.CardAuthorization.Type.CARD_AUTHORIZATION @@ -966,6 +1002,24 @@ internal class PendingTransactionTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + PendingTransaction.Source.CardAuthorization.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + PendingTransaction.Source.CardAuthorization.SchemeFee + .Currency + .USD + ) + .feeType( + PendingTransaction.Source.CardAuthorization.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( PendingTransaction.Source.CardAuthorization.Type diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/cardauthorizations/CardAuthorizationCreateResponseTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/cardauthorizations/CardAuthorizationCreateResponseTest.kt index aad94c64d..6d41a85c6 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/cardauthorizations/CardAuthorizationCreateResponseTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/cardauthorizations/CardAuthorizationCreateResponseTest.kt @@ -247,6 +247,27 @@ internal class CardAuthorizationCreateResponseTest { DeclinedTransaction.Source.CardDecline.Reason .INSUFFICIENT_FUNDS ) + .addSchemeFee( + DeclinedTransaction.Source.CardDecline.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + DeclinedTransaction.Source.CardDecline.SchemeFee + .Currency + .USD + ) + .feeType( + DeclinedTransaction.Source.CardDecline.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( DeclinedTransaction.Source.CardDecline.Verification @@ -638,6 +659,29 @@ internal class CardAuthorizationCreateResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + PendingTransaction.Source.CardAuthorization.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + PendingTransaction.Source.CardAuthorization + .SchemeFee + .Currency + .USD + ) + .feeType( + PendingTransaction.Source.CardAuthorization + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( PendingTransaction.Source.CardAuthorization.Type @@ -1027,6 +1071,24 @@ internal class CardAuthorizationCreateResponseTest { DeclinedTransaction.Source.CardDecline.Reason .INSUFFICIENT_FUNDS ) + .addSchemeFee( + DeclinedTransaction.Source.CardDecline.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + DeclinedTransaction.Source.CardDecline.SchemeFee + .Currency + .USD + ) + .feeType( + DeclinedTransaction.Source.CardDecline.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( DeclinedTransaction.Source.CardDecline.Verification @@ -1405,6 +1467,27 @@ internal class CardAuthorizationCreateResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + PendingTransaction.Source.CardAuthorization.SchemeFee + .builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + PendingTransaction.Source.CardAuthorization + .SchemeFee + .Currency + .USD + ) + .feeType( + PendingTransaction.Source.CardAuthorization + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( PendingTransaction.Source.CardAuthorization.Type @@ -1795,6 +1878,27 @@ internal class CardAuthorizationCreateResponseTest { DeclinedTransaction.Source.CardDecline.Reason .INSUFFICIENT_FUNDS ) + .addSchemeFee( + DeclinedTransaction.Source.CardDecline.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + DeclinedTransaction.Source.CardDecline.SchemeFee + .Currency + .USD + ) + .feeType( + DeclinedTransaction.Source.CardDecline.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .verification( DeclinedTransaction.Source.CardDecline.Verification @@ -2186,6 +2290,29 @@ internal class CardAuthorizationCreateResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + PendingTransaction.Source.CardAuthorization.SchemeFee + .builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + PendingTransaction.Source.CardAuthorization + .SchemeFee + .Currency + .USD + ) + .feeType( + PendingTransaction.Source.CardAuthorization + .SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .type( PendingTransaction.Source.CardAuthorization.Type diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/transactions/TransactionListPageResponseTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/transactions/TransactionListPageResponseTest.kt index 53a3a0f77..fab809208 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/transactions/TransactionListPageResponseTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/transactions/TransactionListPageResponseTest.kt @@ -304,6 +304,26 @@ internal class TransactionListPageResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + Transaction.Source.CardFinancial.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + Transaction.Source.CardFinancial.SchemeFee + .Currency + .USD + ) + .feeType( + Transaction.Source.CardFinancial.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(Transaction.Source.CardFinancial.Type.CARD_FINANCIAL) @@ -605,6 +625,24 @@ internal class TransactionListPageResponseTest { ) .build() ) + .addSchemeFee( + Transaction.Source.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + Transaction.Source.CardRefund.SchemeFee.Currency + .USD + ) + .feeType( + Transaction.Source.CardRefund.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(Transaction.Source.CardRefund.Type.CARD_REFUND) .build() @@ -881,6 +919,26 @@ internal class TransactionListPageResponseTest { ) .build() ) + .addSchemeFee( + Transaction.Source.CardSettlement.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + Transaction.Source.CardSettlement.SchemeFee + .Currency + .USD + ) + .feeType( + Transaction.Source.CardSettlement.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( Transaction.Source.CardSettlement.Surcharge.builder() .amount(0L) @@ -1434,6 +1492,22 @@ internal class TransactionListPageResponseTest { Transaction.Source.CardFinancial.ProcessingCategory.PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + Transaction.Source.CardFinancial.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + Transaction.Source.CardFinancial.SchemeFee.Currency + .USD + ) + .feeType( + Transaction.Source.CardFinancial.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(Transaction.Source.CardFinancial.Type.CARD_FINANCIAL) @@ -1725,6 +1799,21 @@ internal class TransactionListPageResponseTest { ) .build() ) + .addSchemeFee( + Transaction.Source.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + Transaction.Source.CardRefund.SchemeFee.Currency.USD + ) + .feeType( + Transaction.Source.CardRefund.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(Transaction.Source.CardRefund.Type.CARD_REFUND) .build() @@ -1982,6 +2071,22 @@ internal class TransactionListPageResponseTest { ) .build() ) + .addSchemeFee( + Transaction.Source.CardSettlement.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + Transaction.Source.CardSettlement.SchemeFee.Currency + .USD + ) + .feeType( + Transaction.Source.CardSettlement.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( Transaction.Source.CardSettlement.Surcharge.builder() .amount(0L) @@ -2547,6 +2652,26 @@ internal class TransactionListPageResponseTest { .PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + Transaction.Source.CardFinancial.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + Transaction.Source.CardFinancial.SchemeFee + .Currency + .USD + ) + .feeType( + Transaction.Source.CardFinancial.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(Transaction.Source.CardFinancial.Type.CARD_FINANCIAL) @@ -2848,6 +2973,24 @@ internal class TransactionListPageResponseTest { ) .build() ) + .addSchemeFee( + Transaction.Source.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + Transaction.Source.CardRefund.SchemeFee.Currency + .USD + ) + .feeType( + Transaction.Source.CardRefund.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(Transaction.Source.CardRefund.Type.CARD_REFUND) .build() @@ -3124,6 +3267,26 @@ internal class TransactionListPageResponseTest { ) .build() ) + .addSchemeFee( + Transaction.Source.CardSettlement.SchemeFee.builder() + .amount("0.137465") + .createdAt( + OffsetDateTime.parse("2020-01-31T23:59:59Z") + ) + .currency( + Transaction.Source.CardSettlement.SchemeFee + .Currency + .USD + ) + .feeType( + Transaction.Source.CardSettlement.SchemeFee + .FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( Transaction.Source.CardSettlement.Surcharge.builder() .amount(0L) diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/transactions/TransactionTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/transactions/TransactionTest.kt index 357e080a5..218a1bde2 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/transactions/TransactionTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/transactions/TransactionTest.kt @@ -265,6 +265,21 @@ internal class TransactionTest { Transaction.Source.CardFinancial.ProcessingCategory.PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + Transaction.Source.CardFinancial.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + Transaction.Source.CardFinancial.SchemeFee.Currency.USD + ) + .feeType( + Transaction.Source.CardFinancial.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(Transaction.Source.CardFinancial.Type.CARD_FINANCIAL) @@ -541,6 +556,21 @@ internal class TransactionTest { ) .build() ) + .addSchemeFee( + Transaction.Source.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + Transaction.Source.CardRefund.SchemeFee.Currency.USD + ) + .feeType( + Transaction.Source.CardRefund.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(Transaction.Source.CardRefund.Type.CARD_REFUND) .build() @@ -794,6 +824,21 @@ internal class TransactionTest { ) .build() ) + .addSchemeFee( + Transaction.Source.CardSettlement.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + Transaction.Source.CardSettlement.SchemeFee.Currency.USD + ) + .feeType( + Transaction.Source.CardSettlement.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( Transaction.Source.CardSettlement.Surcharge.builder() .amount(0L) @@ -1282,6 +1327,21 @@ internal class TransactionTest { Transaction.Source.CardFinancial.ProcessingCategory.PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + Transaction.Source.CardFinancial.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + Transaction.Source.CardFinancial.SchemeFee.Currency.USD + ) + .feeType( + Transaction.Source.CardFinancial.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(Transaction.Source.CardFinancial.Type.CARD_FINANCIAL) @@ -1542,6 +1602,19 @@ internal class TransactionTest { ) .build() ) + .addSchemeFee( + Transaction.Source.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency(Transaction.Source.CardRefund.SchemeFee.Currency.USD) + .feeType( + Transaction.Source.CardRefund.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(Transaction.Source.CardRefund.Type.CARD_REFUND) .build() @@ -1774,6 +1847,21 @@ internal class TransactionTest { ) .build() ) + .addSchemeFee( + Transaction.Source.CardSettlement.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + Transaction.Source.CardSettlement.SchemeFee.Currency.USD + ) + .feeType( + Transaction.Source.CardSettlement.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( Transaction.Source.CardSettlement.Surcharge.builder() .amount(0L) @@ -2273,6 +2361,21 @@ internal class TransactionTest { Transaction.Source.CardFinancial.ProcessingCategory.PURCHASE ) .realTimeDecisionId(null) + .addSchemeFee( + Transaction.Source.CardFinancial.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + Transaction.Source.CardFinancial.SchemeFee.Currency.USD + ) + .feeType( + Transaction.Source.CardFinancial.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .terminalId("RCN5VNXS") .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(Transaction.Source.CardFinancial.Type.CARD_FINANCIAL) @@ -2549,6 +2652,21 @@ internal class TransactionTest { ) .build() ) + .addSchemeFee( + Transaction.Source.CardRefund.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + Transaction.Source.CardRefund.SchemeFee.Currency.USD + ) + .feeType( + Transaction.Source.CardRefund.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .transactionId("transaction_uyrp7fld2ium70oa7oi") .type(Transaction.Source.CardRefund.Type.CARD_REFUND) .build() @@ -2802,6 +2920,21 @@ internal class TransactionTest { ) .build() ) + .addSchemeFee( + Transaction.Source.CardSettlement.SchemeFee.builder() + .amount("0.137465") + .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .currency( + Transaction.Source.CardSettlement.SchemeFee.Currency.USD + ) + .feeType( + Transaction.Source.CardSettlement.SchemeFee.FeeType + .VISA_CORPORATE_ACCEPTANCE_FEE + ) + .fixedComponent(null) + .variableRate("0.0002") + .build() + ) .surcharge( Transaction.Source.CardSettlement.Surcharge.builder() .amount(0L) From 4e4534eb90813a53ad1bc1ee4e33f5c1dda53bf4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 30 Mar 2026 20:38:44 +0000 Subject: [PATCH 3/3] release: 0.497.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ README.md | 10 +++++----- build.gradle.kts | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 9a47da071..646eee7bd 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.496.0" + ".": "0.497.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 88e8f23d3..19994dec7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.497.0 (2026-03-30) + +Full Changelog: [v0.496.0...v0.497.0](https://github.com/Increase/increase-java/compare/v0.496.0...v0.497.0) + +### Features + +* **api:** api update ([8fdd517](https://github.com/Increase/increase-java/commit/8fdd5170cbf62b0f697ebeb8bc0c377fd58211b6)) + ## 0.496.0 (2026-03-27) Full Changelog: [v0.495.0...v0.496.0](https://github.com/Increase/increase-java/compare/v0.495.0...v0.496.0) diff --git a/README.md b/README.md index 0292cf3a6..af0fbaf3f 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.increase.api/increase-java)](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.496.0) -[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.496.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.496.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.increase.api/increase-java)](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.497.0) +[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.497.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.497.0) @@ -13,7 +13,7 @@ The Increase Java SDK is similar to the Increase Kotlin SDK but with minor diffe -The REST API documentation can be found on [increase.com](https://increase.com/documentation). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.increase.api/increase-java/0.496.0). +The REST API documentation can be found on [increase.com](https://increase.com/documentation). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.increase.api/increase-java/0.497.0). @@ -24,7 +24,7 @@ The REST API documentation can be found on [increase.com](https://increase.com/d ### Gradle ```kotlin -implementation("com.increase.api:increase-java:0.496.0") +implementation("com.increase.api:increase-java:0.497.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.496.0") com.increase.api increase-java - 0.496.0 + 0.497.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 3899a5179..e16537bdc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.increase.api" - version = "0.496.0" // x-release-please-version + version = "0.497.0" // x-release-please-version } subprojects {