diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 75b3f25b4..37556d6b0 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.267.0" + ".": "0.268.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 093b8c5d0..1cc1a647b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 202 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-976ae14d2349a3599f9bd33dba52b3c12c265493a8af9e581c71b2e819b8de04.yml -openapi_spec_hash: d8a9fef4dfe082acdf834ac0339e800c +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-5fa3dfeb071930598ed9243dd96db808cf54d4a455c99b1acceadc3335f1a387.yml +openapi_spec_hash: 18dfa4d31cd512dcd83b646e40fb2c86 config_hash: a185e9a72778cc4658ea73fb3a7f1354 diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ecf86ef5..ffdd03305 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 0.268.0 (2025-07-29) + +Full Changelog: [v0.267.0...v0.268.0](https://github.com/Increase/increase-java/compare/v0.267.0...v0.268.0) + +### Features + +* **api:** api update ([e7bc58f](https://github.com/Increase/increase-java/commit/e7bc58f92a987c248ec33a71e62fa1ad15e8c40f)) +* **api:** api update ([17a4f0e](https://github.com/Increase/increase-java/commit/17a4f0efa9a6769383a8c6eeff639df17998998c)) + ## 0.267.0 (2025-07-29) Full Changelog: [v0.266.1...v0.267.0](https://github.com/Increase/increase-java/compare/v0.266.1...v0.267.0) diff --git a/README.md b/README.md index 57dbc244e..358670d50 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.267.0) -[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.267.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.267.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.268.0) +[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.268.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.268.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.267.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.268.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.267.0") +implementation("com.increase.api:increase-java:0.268.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.267.0") com.increase.api increase-java - 0.267.0 + 0.268.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index b513e151e..a2e822248 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.increase.api" - version = "0.267.0" // x-release-please-version + version = "0.268.0" // x-release-please-version } subprojects { 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 f42167ccd..07f8425aa 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 @@ -3959,6 +3959,7 @@ private constructor( private constructor( private val id: JsonField, private val actioner: JsonField, + private val additionalAmounts: JsonField, private val amount: JsonField, private val cardPaymentId: JsonField, private val currency: JsonField, @@ -3993,6 +3994,9 @@ private constructor( @JsonProperty("actioner") @ExcludeMissing actioner: JsonField = JsonMissing.of(), + @JsonProperty("additional_amounts") + @ExcludeMissing + additionalAmounts: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), @JsonProperty("card_payment_id") @ExcludeMissing @@ -4067,6 +4071,7 @@ private constructor( ) : this( id, actioner, + additionalAmounts, amount, cardPaymentId, currency, @@ -4114,6 +4119,18 @@ private constructor( */ fun actioner(): Actioner = actioner.getRequired("actioner") + /** + * 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 pending amount in the minor unit of the transaction's currency. For dollars, for * example, this is cents. @@ -4371,6 +4388,16 @@ private constructor( @ExcludeMissing fun _actioner(): JsonField = actioner + /** + * 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 [amount]. * @@ -4636,6 +4663,7 @@ private constructor( * ```java * .id() * .actioner() + * .additionalAmounts() * .amount() * .cardPaymentId() * .currency() @@ -4671,6 +4699,7 @@ private constructor( private var id: JsonField? = null private var actioner: JsonField? = null + private var additionalAmounts: JsonField? = null private var amount: JsonField? = null private var cardPaymentId: JsonField? = null private var currency: JsonField? = null @@ -4702,6 +4731,7 @@ private constructor( internal fun from(cardAuthorization: CardAuthorization) = apply { id = cardAuthorization.id actioner = cardAuthorization.actioner + additionalAmounts = cardAuthorization.additionalAmounts amount = cardAuthorization.amount cardPaymentId = cardAuthorization.cardPaymentId currency = cardAuthorization.currency @@ -4757,6 +4787,25 @@ private constructor( */ fun actioner(actioner: JsonField) = apply { this.actioner = actioner } + /** + * 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 pending amount in the minor unit of the transaction's currency. For dollars, * for example, this is cents. @@ -5258,6 +5307,7 @@ private constructor( * ```java * .id() * .actioner() + * .additionalAmounts() * .amount() * .cardPaymentId() * .currency() @@ -5291,6 +5341,7 @@ private constructor( CardAuthorization( checkRequired("id", id), checkRequired("actioner", actioner), + checkRequired("additionalAmounts", additionalAmounts), checkRequired("amount", amount), checkRequired("cardPaymentId", cardPaymentId), checkRequired("currency", currency), @@ -5329,6 +5380,7 @@ private constructor( id() actioner().validate() + additionalAmounts().validate() amount() cardPaymentId() currency().validate() @@ -5375,6 +5427,7 @@ private constructor( internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + (actioner.asKnown().getOrNull()?.validity() ?: 0) + + (additionalAmounts.asKnown().getOrNull()?.validity() ?: 0) + (if (amount.asKnown().isPresent) 1 else 0) + (if (cardPaymentId.asKnown().isPresent) 1 else 0) + (currency.asKnown().getOrNull()?.validity() ?: 0) + @@ -5552,382 +5605,224 @@ private constructor( } /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's - * currency. + * 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 Currency @JsonCreator private constructor(private val value: JsonField) : - Enum { + class AdditionalAmounts + private constructor( + private val clinic: JsonField, + private val dental: 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("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, + prescription, + surcharge, + totalCumulative, + totalHealthcare, + transit, + unknown, + vision, + mutableMapOf(), + ) /** - * Returns this class instance's raw value. + * The part of this transaction amount that was for clinic-related services. * - * 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 { - - /** Canadian Dollar (CAD) */ - @JvmField val CAD = of("CAD") - - /** Swiss Franc (CHF) */ - @JvmField val CHF = of("CHF") - - /** Euro (EUR) */ - @JvmField val EUR = of("EUR") - - /** British Pound (GBP) */ - @JvmField val GBP = of("GBP") - - /** Japanese Yen (JPY) */ - @JvmField val JPY = of("JPY") - - /** 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 { - /** Canadian Dollar (CAD) */ - CAD, - /** Swiss Franc (CHF) */ - CHF, - /** Euro (EUR) */ - EUR, - /** British Pound (GBP) */ - GBP, - /** Japanese Yen (JPY) */ - JPY, - /** US Dollar (USD) */ - USD, - } + fun clinic(): Optional = clinic.getOptional("clinic") /** - * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] member. + * The part of this transaction amount that was for dental-related services. * - * 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 { - /** Canadian Dollar (CAD) */ - CAD, - /** Swiss Franc (CHF) */ - CHF, - /** Euro (EUR) */ - EUR, - /** British Pound (GBP) */ - GBP, - /** Japanese Yen (JPY) */ - JPY, - /** US Dollar (USD) */ - USD, - /** - * An enum member indicating that [Currency] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } + fun dental(): Optional = dental.getOptional("dental") /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * The part of this transaction amount that was for healthcare prescriptions. * - * 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) { - CAD -> Value.CAD - CHF -> Value.CHF - EUR -> Value.EUR - GBP -> Value.GBP - JPY -> Value.JPY - USD -> Value.USD - else -> Value._UNKNOWN - } + fun prescription(): Optional = + prescription.getOptional("prescription") /** - * 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 surcharge amount charged for this transaction by the merchant. * - * @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) { - CAD -> Known.CAD - CHF -> Known.CHF - EUR -> Known.EUR - GBP -> Known.GBP - JPY -> Known.JPY - USD -> Known.USD - else -> throw IncreaseInvalidDataException("Unknown Currency: $value") - } + fun surcharge(): Optional = surcharge.getOptional("surcharge") /** - * 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 total amount of a series of incremental authorizations, optionally provided. * - * @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(): Currency = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + fun totalCumulative(): Optional = + totalCumulative.getOptional("total_cumulative") /** - * Returns a score indicating how many valid values are contained in this object - * recursively. + * The total amount of healthcare-related additional amounts. * - * 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 /* spotless:off */ other is Currency && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** - * The direction describes the direction the funds will move, either from the cardholder - * to the merchant or from the merchant to the cardholder. - */ - class Direction @JsonCreator private constructor(private val value: JsonField) : - Enum { + fun totalHealthcare(): Optional = + totalHealthcare.getOptional("total_healthcare") /** - * Returns this class instance's raw value. + * The part of this transaction amount that was for transit-related services. * - * 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 { - - /** A regular card authorization where funds are debited from the cardholder. */ - @JvmField val SETTLEMENT = of("settlement") - - /** - * A refund card authorization, sometimes referred to as a credit voucher - * authorization, where funds are credited to the cardholder. - */ - @JvmField val REFUND = of("refund") - - @JvmStatic fun of(value: String) = Direction(JsonField.of(value)) - } - - /** An enum containing [Direction]'s known values. */ - enum class Known { - /** A regular card authorization where funds are debited from the cardholder. */ - SETTLEMENT, - /** - * A refund card authorization, sometimes referred to as a credit voucher - * authorization, where funds are credited to the cardholder. - */ - REFUND, - } + fun transit(): Optional = transit.getOptional("transit") /** - * An enum containing [Direction]'s known values, as well as an [_UNKNOWN] member. + * An unknown additional amount. * - * An instance of [Direction] 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 { - /** A regular card authorization where funds are debited from the cardholder. */ - SETTLEMENT, - /** - * A refund card authorization, sometimes referred to as a credit voucher - * authorization, where funds are credited to the cardholder. - */ - REFUND, - /** - * An enum member indicating that [Direction] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } + fun unknown(): Optional = unknown.getOptional("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 part of this transaction amount that was for vision-related services. * - * 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) { - SETTLEMENT -> Value.SETTLEMENT - REFUND -> Value.REFUND - else -> Value._UNKNOWN - } + fun vision(): Optional = vision.getOptional("vision") /** - * Returns an enum member corresponding to this class instance's value. + * Returns the raw JSON value of [clinic]. * - * 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. + * Unlike [clinic], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun known(): Known = - when (this) { - SETTLEMENT -> Known.SETTLEMENT - REFUND -> Known.REFUND - else -> throw IncreaseInvalidDataException("Unknown Direction: $value") - } + @JsonProperty("clinic") @ExcludeMissing fun _clinic(): JsonField = clinic /** - * Returns this class instance's primitive wire representation. + * Returns the raw JSON value of [dental]. * - * 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 [dental], 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") - } - - private var validated: Boolean = false - - fun validate(): Direction = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + @JsonProperty("dental") @ExcludeMissing fun _dental(): JsonField = dental /** - * Returns a score indicating how many valid values are contained in this object - * recursively. + * Returns the raw JSON value of [prescription]. * - * Used for best match union deserialization. + * Unlike [prescription], 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 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Direction && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } + @JsonProperty("prescription") + @ExcludeMissing + fun _prescription(): JsonField = prescription - /** Fields specific to the `network`. */ - class NetworkDetails - private constructor( - private val category: JsonField, - private val visa: JsonField, - private val additionalProperties: MutableMap, - ) { + /** + * 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 - @JsonCreator - private constructor( - @JsonProperty("category") - @ExcludeMissing - category: JsonField = JsonMissing.of(), - @JsonProperty("visa") @ExcludeMissing visa: JsonField = JsonMissing.of(), - ) : this(category, visa, mutableMapOf()) + /** + * 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 /** - * The payment network used to process this card authorization. + * Returns the raw JSON value of [totalHealthcare]. * - * @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 [totalHealthcare], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun category(): Category = category.getRequired("category") + @JsonProperty("total_healthcare") + @ExcludeMissing + fun _totalHealthcare(): JsonField = totalHealthcare /** - * Fields specific to the `visa` network. + * Returns the raw JSON value of [transit]. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * Unlike [transit], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun visa(): Optional = visa.getOptional("visa") + @JsonProperty("transit") + @ExcludeMissing + fun _transit(): JsonField = transit /** - * Returns the raw JSON value of [category]. + * Returns the raw JSON value of [unknown]. * - * Unlike [category], this method doesn't throw if the JSON field has an unexpected + * Unlike [unknown], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("category") + @JsonProperty("unknown") @ExcludeMissing - fun _category(): JsonField = category + fun _unknown(): JsonField = unknown /** - * Returns the raw JSON value of [visa]. + * Returns the raw JSON value of [vision]. * - * Unlike [visa], this method doesn't throw if the JSON field has an unexpected + * Unlike [vision], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("visa") @ExcludeMissing fun _visa(): JsonField = visa + @JsonProperty("vision") @ExcludeMissing fun _vision(): JsonField = vision @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -5944,57 +5839,217 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [NetworkDetails]. + * Returns a mutable builder for constructing an instance of + * [AdditionalAmounts]. * * The following fields are required: * ```java - * .category() - * .visa() + * .clinic() + * .dental() + * .prescription() + * .surcharge() + * .totalCumulative() + * .totalHealthcare() + * .transit() + * .unknown() + * .vision() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [NetworkDetails]. */ + /** A builder for [AdditionalAmounts]. */ class Builder internal constructor() { - private var category: JsonField? = null - private var visa: JsonField? = null + private var clinic: JsonField? = null + private var dental: 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(networkDetails: NetworkDetails) = apply { - category = networkDetails.category - visa = networkDetails.visa - additionalProperties = networkDetails.additionalProperties.toMutableMap() + internal fun from(additionalAmounts: AdditionalAmounts) = apply { + clinic = additionalAmounts.clinic + dental = additionalAmounts.dental + 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 payment network used to process this card authorization. */ - fun category(category: Category) = category(JsonField.of(category)) + /** 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.category] to an arbitrary JSON value. + * Sets [Builder.clinic] to an arbitrary JSON value. * - * You should usually call [Builder.category] with a well-typed [Category] 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 category(category: JsonField) = apply { this.category = category } + fun clinic(clinic: JsonField) = apply { this.clinic = clinic } - /** Fields specific to the `visa` network. */ - fun visa(visa: Visa?) = visa(JsonField.ofNullable(visa)) + /** The part of this transaction amount that was for dental-related services. */ + fun dental(dental: Dental?) = dental(JsonField.ofNullable(dental)) - /** Alias for calling [Builder.visa] with `visa.orElse(null)`. */ - fun visa(visa: Optional) = visa(visa.getOrNull()) + /** Alias for calling [Builder.dental] with `dental.orElse(null)`. */ + fun dental(dental: Optional) = dental(dental.getOrNull()) /** - * Sets [Builder.visa] to an arbitrary JSON value. + * Sets [Builder.dental] to an arbitrary JSON value. * - * You should usually call [Builder.visa] with a well-typed [Visa] 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 visa(visa: JsonField) = apply { this.visa = visa } + fun dental(dental: JsonField) = apply { this.dental = dental } + + /** + * The part of this transaction amount that was for healthcare prescriptions. + */ + fun prescription(prescription: Prescription?) = + prescription(JsonField.ofNullable(prescription)) + + /** + * Alias for calling [Builder.prescription] with `prescription.orElse(null)`. + */ + fun prescription(prescription: Optional) = + prescription(prescription.getOrNull()) + + /** + * Sets [Builder.prescription] to an arbitrary JSON value. + * + * You should usually call [Builder.prescription] with a well-typed + * [Prescription] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun prescription(prescription: JsonField) = apply { + this.prescription = prescription + } + + /** The surcharge amount charged for this transaction by the merchant. */ + fun surcharge(surcharge: Surcharge?) = + surcharge(JsonField.ofNullable(surcharge)) + + /** Alias for calling [Builder.surcharge] with `surcharge.orElse(null)`. */ + fun surcharge(surcharge: Optional) = surcharge(surcharge.getOrNull()) + + /** + * Sets [Builder.surcharge] to an arbitrary JSON value. + * + * You should usually call [Builder.surcharge] with a well-typed [Surcharge] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun surcharge(surcharge: JsonField) = apply { + this.surcharge = surcharge + } + + /** + * The total amount of a series of incremental authorizations, optionally + * provided. + */ + fun totalCumulative(totalCumulative: TotalCumulative?) = + totalCumulative(JsonField.ofNullable(totalCumulative)) + + /** + * Alias for calling [Builder.totalCumulative] with + * `totalCumulative.orElse(null)`. + */ + fun totalCumulative(totalCumulative: Optional) = + totalCumulative(totalCumulative.getOrNull()) + + /** + * Sets [Builder.totalCumulative] to an arbitrary JSON value. + * + * You should usually call [Builder.totalCumulative] with a well-typed + * [TotalCumulative] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun totalCumulative(totalCumulative: JsonField) = apply { + this.totalCumulative = totalCumulative + } + + /** The total amount of healthcare-related additional amounts. */ + fun totalHealthcare(totalHealthcare: TotalHealthcare?) = + totalHealthcare(JsonField.ofNullable(totalHealthcare)) + + /** + * Alias for calling [Builder.totalHealthcare] with + * `totalHealthcare.orElse(null)`. + */ + fun totalHealthcare(totalHealthcare: Optional) = + totalHealthcare(totalHealthcare.getOrNull()) + + /** + * Sets [Builder.totalHealthcare] to an arbitrary JSON value. + * + * You should usually call [Builder.totalHealthcare] with a well-typed + * [TotalHealthcare] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun totalHealthcare(totalHealthcare: JsonField) = apply { + this.totalHealthcare = totalHealthcare + } + + /** + * The part of this transaction amount that was for transit-related services. + */ + fun transit(transit: Transit?) = transit(JsonField.ofNullable(transit)) + + /** Alias for calling [Builder.transit] with `transit.orElse(null)`. */ + fun transit(transit: Optional) = transit(transit.getOrNull()) + + /** + * Sets [Builder.transit] to an arbitrary JSON value. + * + * You should usually call [Builder.transit] with a well-typed [Transit] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun transit(transit: JsonField) = apply { this.transit = transit } + + /** An unknown additional amount. */ + fun unknown(unknown: Unknown?) = unknown(JsonField.ofNullable(unknown)) + + /** Alias for calling [Builder.unknown] with `unknown.orElse(null)`. */ + fun unknown(unknown: Optional) = unknown(unknown.getOrNull()) + + /** + * Sets [Builder.unknown] to an arbitrary JSON value. + * + * You should usually call [Builder.unknown] with a well-typed [Unknown] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun unknown(unknown: JsonField) = apply { this.unknown = unknown } + + /** The part of this transaction amount that was for vision-related services. */ + fun vision(vision: Vision?) = vision(JsonField.ofNullable(vision)) + + /** Alias for calling [Builder.vision] with `vision.orElse(null)`. */ + fun vision(vision: Optional) = vision(vision.getOrNull()) + + /** + * Sets [Builder.vision] to an arbitrary JSON value. + * + * You should usually call [Builder.vision] with a well-typed [Vision] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun vision(vision: JsonField) = apply { this.vision = vision } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -6019,35 +6074,56 @@ private constructor( } /** - * Returns an immutable instance of [NetworkDetails]. + * Returns an immutable instance of [AdditionalAmounts]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .category() - * .visa() + * .clinic() + * .dental() + * .prescription() + * .surcharge() + * .totalCumulative() + * .totalHealthcare() + * .transit() + * .unknown() + * .vision() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): NetworkDetails = - NetworkDetails( - checkRequired("category", category), - checkRequired("visa", visa), + fun build(): AdditionalAmounts = + AdditionalAmounts( + checkRequired("clinic", clinic), + checkRequired("dental", dental), + checkRequired("prescription", prescription), + checkRequired("surcharge", surcharge), + checkRequired("totalCumulative", totalCumulative), + checkRequired("totalHealthcare", totalHealthcare), + checkRequired("transit", transit), + checkRequired("unknown", unknown), + checkRequired("vision", vision), additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): NetworkDetails = apply { + fun validate(): AdditionalAmounts = apply { if (validated) { return@apply } - category().validate() - visa().ifPresent { it.validate() } + clinic().ifPresent { it.validate() } + dental().ifPresent { it.validate() } + prescription().ifPresent { it.validate() } + surcharge().ifPresent { it.validate() } + totalCumulative().ifPresent { it.validate() } + totalHealthcare().ifPresent { it.validate() } + transit().ifPresent { it.validate() } + unknown().ifPresent { it.validate() } + vision().ifPresent { it.validate() } validated = true } @@ -6067,109 +6143,193 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (category.asKnown().getOrNull()?.validity() ?: 0) + - (visa.asKnown().getOrNull()?.validity() ?: 0) + (clinic.asKnown().getOrNull()?.validity() ?: 0) + + (dental.asKnown().getOrNull()?.validity() ?: 0) + + (prescription.asKnown().getOrNull()?.validity() ?: 0) + + (surcharge.asKnown().getOrNull()?.validity() ?: 0) + + (totalCumulative.asKnown().getOrNull()?.validity() ?: 0) + + (totalHealthcare.asKnown().getOrNull()?.validity() ?: 0) + + (transit.asKnown().getOrNull()?.validity() ?: 0) + + (unknown.asKnown().getOrNull()?.validity() ?: 0) + + (vision.asKnown().getOrNull()?.validity() ?: 0) + + /** The part of this transaction amount that was for clinic-related services. */ + class Clinic + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { - /** The payment network used to process this card authorization. */ - class Category - @JsonCreator - private constructor(private val value: JsonField) : Enum { + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) /** - * Returns this class instance's raw value. + * The amount in minor units of the `currency` field. * - * 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 { - - /** Visa */ - @JvmField val VISA = of("visa") - - @JvmStatic fun of(value: String) = Category(JsonField.of(value)) - } - - /** An enum containing [Category]'s known values. */ - enum class Known { - /** Visa */ - VISA - } + fun amount(): Long = amount.getRequired("amount") /** - * An enum containing [Category]'s known values, as well as an [_UNKNOWN] - * member. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. * - * 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. + * @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 { - /** Visa */ - VISA, - /** - * An enum member indicating that [Category] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } + fun currency(): String = currency.getRequired("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 [amount]. * - * 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 [amount], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun value(): Value = - when (this) { - VISA -> Value.VISA - else -> Value._UNKNOWN - } + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = 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. + * Returns the raw JSON value of [currency]. * - * @throws IncreaseInvalidDataException if this class instance's value is a not - * a known member. + * Unlike [currency], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun known(): Known = - when (this) { - VISA -> Known.VISA - else -> throw IncreaseInvalidDataException("Unknown Category: $value") + @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 [Clinic]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Clinic]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(clinic: Clinic) = apply { + amount = clinic.amount + currency = clinic.currency + additionalProperties = clinic.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 amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [Clinic]. + * + * 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(): Clinic = + Clinic( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + private var validated: Boolean = false - fun validate(): Category = apply { + fun validate(): Clinic = apply { if (validated) { return@apply } - known() + amount() + currency() validated = true } @@ -6188,114 +6348,82 @@ 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 (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is Category && value == other.value /* spotless:on */ + return /* spotless:off */ other is Clinic && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } - override fun hashCode() = value.hashCode() + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ - override fun toString() = value.toString() + override fun hashCode(): Int = hashCode + + override fun toString() = + "Clinic{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" } - /** Fields specific to the `visa` network. */ - class Visa + /** The part of this transaction amount that was for dental-related services. */ + class Dental private constructor( - private val electronicCommerceIndicator: JsonField, - private val pointOfServiceEntryMode: JsonField, - private val standInProcessingReason: JsonField, + private val amount: JsonField, + private val currency: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("electronic_commerce_indicator") - @ExcludeMissing - electronicCommerceIndicator: JsonField = - JsonMissing.of(), - @JsonProperty("point_of_service_entry_mode") + @JsonProperty("amount") @ExcludeMissing - pointOfServiceEntryMode: JsonField = - JsonMissing.of(), - @JsonProperty("stand_in_processing_reason") + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing - standInProcessingReason: JsonField = - JsonMissing.of(), - ) : this( - electronicCommerceIndicator, - pointOfServiceEntryMode, - standInProcessingReason, - 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") + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) /** - * The method used to enter the cardholder's primary account number and card - * expiration date. + * The amount in minor units of the `currency` field. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). */ - fun pointOfServiceEntryMode(): Optional = - pointOfServiceEntryMode.getOptional("point_of_service_entry_mode") + fun amount(): Long = amount.getRequired("amount") /** - * Only present when `actioner: network`. Describes why a card authorization was - * approved or declined by Visa through stand-in processing. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. * * @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 the raw JSON value of [electronicCommerceIndicator]. - * - * Unlike [electronicCommerceIndicator], this method doesn't throw if the JSON - * field has an unexpected type. + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). */ - @JsonProperty("electronic_commerce_indicator") - @ExcludeMissing - fun _electronicCommerceIndicator(): JsonField = - electronicCommerceIndicator + fun currency(): String = currency.getRequired("currency") /** - * Returns the raw JSON value of [pointOfServiceEntryMode]. + * Returns the raw JSON value of [amount]. * - * Unlike [pointOfServiceEntryMode], 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("point_of_service_entry_mode") - @ExcludeMissing - fun _pointOfServiceEntryMode(): JsonField = - pointOfServiceEntryMode + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount /** - * Returns the raw JSON value of [standInProcessingReason]. + * Returns the raw JSON value of [currency]. * - * Unlike [standInProcessingReason], 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("stand_in_processing_reason") + @JsonProperty("currency") @ExcludeMissing - fun _standInProcessingReason(): JsonField = - standInProcessingReason + fun _currency(): JsonField = currency @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -6312,127 +6440,60 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [Visa]. + * Returns a mutable builder for constructing an instance of [Dental]. * * The following fields are required: * ```java - * .electronicCommerceIndicator() - * .pointOfServiceEntryMode() - * .standInProcessingReason() + * .amount() + * .currency() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [Visa]. */ + /** A builder for [Dental]. */ class Builder internal constructor() { - private var electronicCommerceIndicator: - JsonField? = - null - private var pointOfServiceEntryMode: JsonField? = - null - private var standInProcessingReason: JsonField? = - null + private var amount: JsonField? = null + private var currency: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(visa: Visa) = apply { - electronicCommerceIndicator = visa.electronicCommerceIndicator - pointOfServiceEntryMode = visa.pointOfServiceEntryMode - standInProcessingReason = visa.standInProcessingReason - additionalProperties = visa.additionalProperties.toMutableMap() + internal fun from(dental: Dental) = apply { + amount = dental.amount + currency = dental.currency + additionalProperties = dental.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()) + /** The amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) /** - * Sets [Builder.pointOfServiceEntryMode] to an arbitrary JSON value. + * Sets [Builder.amount] 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. + * 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 standInProcessingReason( - standInProcessingReason: StandInProcessingReason? - ) = standInProcessingReason(JsonField.ofNullable(standInProcessingReason)) + fun amount(amount: JsonField) = apply { this.amount = amount } /** - * Alias for calling [Builder.standInProcessingReason] with - * `standInProcessingReason.orElse(null)`. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. */ - fun standInProcessingReason( - standInProcessingReason: Optional - ) = standInProcessingReason(standInProcessingReason.getOrNull()) + fun currency(currency: String) = currency(JsonField.of(currency)) /** - * Sets [Builder.standInProcessingReason] to an arbitrary JSON value. + * Sets [Builder.currency] 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. + * You should usually call [Builder.currency] with a well-typed [String] + * 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 } + fun currency(currency: JsonField) = apply { + this.currency = currency + } fun additionalProperties(additionalProperties: Map) = apply { @@ -6457,41 +6518,35 @@ private constructor( } /** - * Returns an immutable instance of [Visa]. + * Returns an immutable instance of [Dental]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .electronicCommerceIndicator() - * .pointOfServiceEntryMode() - * .standInProcessingReason() + * .amount() + * .currency() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): Visa = - Visa( - checkRequired( - "electronicCommerceIndicator", - electronicCommerceIndicator, - ), - checkRequired("pointOfServiceEntryMode", pointOfServiceEntryMode), - checkRequired("standInProcessingReason", standInProcessingReason), + fun build(): Dental = + Dental( + checkRequired("amount", amount), + checkRequired("currency", currency), additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): Visa = apply { + fun validate(): Dental = apply { if (validated) { return@apply } - electronicCommerceIndicator().ifPresent { it.validate() } - pointOfServiceEntryMode().ifPresent { it.validate() } - standInProcessingReason().ifPresent { it.validate() } + amount() + currency() validated = true } @@ -6511,1308 +6566,1651 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (electronicCommerceIndicator.asKnown().getOrNull()?.validity() ?: 0) + - (pointOfServiceEntryMode.asKnown().getOrNull()?.validity() ?: 0) + - (standInProcessingReason.asKnown().getOrNull()?.validity() ?: 0) + (if (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) - /** - * 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 { + 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 /* spotless:off */ other is Dental && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } - companion object { + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ - /** - * 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") + override fun hashCode(): Int = hashCode - /** - * Recurring transaction: Payment indicator used to indicate a recurring - * transaction that originates from an acquirer in the US region. - */ - @JvmField val RECURRING = of("recurring") + override fun toString() = + "Dental{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } - /** - * 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") + /** The part of this transaction amount that was for healthcare prescriptions. */ + class Prescription + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { - /** - * 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") + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) - /** - * 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") + /** + * The amount in minor units of the `currency` field. + * + * @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") - /** - * 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") + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount'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(): String = currency.getRequired("currency") - /** - * 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 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 - /** - * Non-secure transaction: Use to identify an electronic commerce - * transaction that has no data protection. - */ - @JvmField val NON_SECURE_TRANSACTION = of("non_secure_transaction") + /** + * 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) = ElectronicCommerceIndicator(JsonField.of(value)) - } + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - /** 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, - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { /** - * An enum containing [ElectronicCommerceIndicator]'s known values, as well - * as an [_UNKNOWN] member. + * Returns a mutable builder for constructing an instance of [Prescription]. * - * 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. + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` */ - 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, + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Prescription]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(prescription: Prescription) = apply { + amount = prescription.amount + currency = prescription.currency + additionalProperties = prescription.additionalProperties.toMutableMap() } + /** The amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) + /** - * 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.amount] 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.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 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 - } + fun amount(amount: JsonField) = apply { this.amount = 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. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. */ - 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 currency(currency: String) = currency(JsonField.of(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. + * Sets [Builder.currency] 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.currency] 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") + fun currency(currency: JsonField) = apply { + this.currency = currency + } + + 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(): ElectronicCommerceIndicator = 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 [Prescription]. * - * Used for best match union deserialization. + * 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. */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + fun build(): Prescription = + Prescription( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + private var validated: Boolean = false - return /* spotless:off */ other is ElectronicCommerceIndicator && value == other.value /* spotless:on */ + fun validate(): Prescription = apply { + if (validated) { + return@apply } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() + amount() + currency() + validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + /** - * The method used to enter the cardholder's primary account number and card - * expiration date. + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. */ - class PointOfServiceEntryMode - @JsonCreator - private constructor(private val value: JsonField) : Enum { + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) - /** - * 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 /* spotless:off */ other is Prescription && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** Unknown */ - @JvmField val UNKNOWN = of("unknown") + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ - /** Manual key entry */ - @JvmField val MANUAL = of("manual") + override fun hashCode(): Int = hashCode - /** Magnetic stripe read, without card verification value */ - @JvmField val MAGNETIC_STRIPE_NO_CVV = of("magnetic_stripe_no_cvv") + override fun toString() = + "Prescription{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } - /** Optical code */ - @JvmField val OPTICAL_CODE = of("optical_code") + /** The surcharge amount charged for this transaction by the merchant. */ + class Surcharge + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { - /** Contact chip card */ - @JvmField val INTEGRATED_CIRCUIT_CARD = of("integrated_circuit_card") + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) - /** Contactless read of chip card */ - @JvmField val CONTACTLESS = of("contactless") + /** + * The amount in minor units of the `currency` field. + * + * @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") - /** - * Transaction initiated using a credential that has previously been - * stored on file - */ - @JvmField val CREDENTIAL_ON_FILE = of("credential_on_file") + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount'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(): String = currency.getRequired("currency") - /** Magnetic stripe read */ - @JvmField val MAGNETIC_STRIPE = of("magnetic_stripe") + /** + * 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 - /** Contactless read of magnetic stripe data */ - @JvmField - val CONTACTLESS_MAGNETIC_STRIPE = of("contactless_magnetic_stripe") + /** + * 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 - /** Contact chip card, without card verification value */ - @JvmField - val INTEGRATED_CIRCUIT_CARD_NO_CVV = - of("integrated_circuit_card_no_cvv") + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - @JvmStatic - fun of(value: String) = PointOfServiceEntryMode(JsonField.of(value)) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** 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, - } + fun toBuilder() = Builder().from(this) + + companion object { /** - * An enum containing [PointOfServiceEntryMode]'s known values, as well as - * an [_UNKNOWN] member. + * Returns a mutable builder for constructing an instance of [Surcharge]. * - * 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. + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` */ - 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, + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Surcharge]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(surcharge: Surcharge) = apply { + amount = surcharge.amount + currency = surcharge.currency + additionalProperties = surcharge.additionalProperties.toMutableMap() } + /** The amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) + /** - * 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.amount] 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.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 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 - } + fun amount(amount: JsonField) = apply { this.amount = 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. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. */ - 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" - ) - } + fun currency(currency: String) = currency(JsonField.of(currency)) /** - * Returns this class instance's primitive wire representation. + * Sets [Builder.currency] to an arbitrary JSON 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. + * You should usually call [Builder.currency] 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") + fun currency(currency: JsonField) = apply { + this.currency = currency + } + + 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(): PointOfServiceEntryMode = 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 [Surcharge]. * - * Used for best match union deserialization. + * 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. */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + fun build(): Surcharge = + Surcharge( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + private var validated: Boolean = false - return /* spotless:off */ other is PointOfServiceEntryMode && value == other.value /* spotless:on */ + fun validate(): Surcharge = apply { + if (validated) { + return@apply } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() + amount() + currency() + validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + /** - * Only present when `actioner: network`. Describes why a card authorization was - * approved or declined by Visa through stand-in processing. + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. */ - class StandInProcessingReason - @JsonCreator - private constructor(private val value: JsonField) : Enum { + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) - /** - * 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 /* spotless:off */ other is Surcharge && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** Increase failed to process the authorization in a timely manner. */ - @JvmField val ISSUER_ERROR = of("issuer_error") + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ - /** - * The physical card read had an invalid CVV, dCVV, or authorization - * request cryptogram. - */ - @JvmField val INVALID_PHYSICAL_CARD = of("invalid_physical_card") + override fun hashCode(): Int = hashCode - /** The 3DS cardholder authentication verification value was invalid. */ - @JvmField - val INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE = - of("invalid_cardholder_authentication_verification_value") + override fun toString() = + "Surcharge{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } - /** - * 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 total amount of a series of incremental authorizations, optionally provided. + */ + class TotalCumulative + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { - /** - * 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") + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) - /** - * 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 amount in minor units of the `currency` field. + * + * @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") - /** An unspecific reason for stand-in processing. */ - @JvmField val OTHER = of("other") + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount'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(): String = currency.getRequired("currency") - @JvmStatic - fun of(value: String) = StandInProcessingReason(JsonField.of(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 - /** 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, dCVV, or authorization - * request cryptogram. - */ - INVALID_PHYSICAL_CARD, - /** 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 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 { /** - * An enum containing [StandInProcessingReason]'s known values, as well as - * an [_UNKNOWN] member. + * Returns a mutable builder for constructing an instance of + * [TotalCumulative]. * - * 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. + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` */ - enum class Value { - /** Increase failed to process the authorization in a timely manner. */ - ISSUER_ERROR, - /** - * The physical card read had an invalid CVV, dCVV, or authorization - * request cryptogram. - */ - INVALID_PHYSICAL_CARD, - /** 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, + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TotalCumulative]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(totalCumulative: TotalCumulative) = apply { + amount = totalCumulative.amount + currency = totalCumulative.currency + additionalProperties = + totalCumulative.additionalProperties.toMutableMap() } + /** The amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) + /** - * 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.amount] 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.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 value(): Value = - when (this) { - ISSUER_ERROR -> Value.ISSUER_ERROR - INVALID_PHYSICAL_CARD -> Value.INVALID_PHYSICAL_CARD - 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 - } + fun amount(amount: JsonField) = apply { this.amount = 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. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. */ - fun known(): Known = - when (this) { - ISSUER_ERROR -> Known.ISSUER_ERROR - INVALID_PHYSICAL_CARD -> Known.INVALID_PHYSICAL_CARD - 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" - ) - } + fun currency(currency: String) = currency(JsonField.of(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. + * Sets [Builder.currency] 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.currency] 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") + fun currency(currency: JsonField) = apply { + this.currency = currency + } + + 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(): StandInProcessingReason = 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 [TotalCumulative]. * - * Used for best match union deserialization. + * 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. */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + fun build(): TotalCumulative = + TotalCumulative( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + private var validated: Boolean = false - return /* spotless:off */ other is StandInProcessingReason && value == other.value /* spotless:on */ + fun validate(): TotalCumulative = apply { + if (validated) { + return@apply } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is Visa && electronicCommerceIndicator == other.electronicCommerceIndicator && pointOfServiceEntryMode == other.pointOfServiceEntryMode && standInProcessingReason == other.standInProcessingReason && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TotalCumulative && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(electronicCommerceIndicator, pointOfServiceEntryMode, standInProcessingReason, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Visa{electronicCommerceIndicator=$electronicCommerceIndicator, pointOfServiceEntryMode=$pointOfServiceEntryMode, standInProcessingReason=$standInProcessingReason, additionalProperties=$additionalProperties}" + "TotalCumulative{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is NetworkDetails && category == other.category && visa == other.visa && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** The total amount of healthcare-related additional amounts. */ + class TotalHealthcare + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(category, visa, additionalProperties) } - /* spotless:on */ + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) - override fun hashCode(): Int = hashCode + /** + * The amount in minor units of the `currency` field. + * + * @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") - override fun toString() = - "NetworkDetails{category=$category, visa=$visa, additionalProperties=$additionalProperties}" - } + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount'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(): String = currency.getRequired("currency") - /** Network-specific identifiers for a specific request or transaction. */ - class NetworkIdentifiers - private constructor( - private val retrievalReferenceNumber: JsonField, - private val traceNumber: JsonField, - private val transactionId: JsonField, - private val additionalProperties: MutableMap, - ) { + /** + * 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 - @JsonCreator - private constructor( - @JsonProperty("retrieval_reference_number") - @ExcludeMissing - retrievalReferenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("trace_number") - @ExcludeMissing - traceNumber: JsonField = JsonMissing.of(), - @JsonProperty("transaction_id") + /** + * 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 - transactionId: JsonField = JsonMissing.of(), - ) : this(retrievalReferenceNumber, traceNumber, transactionId, mutableMapOf()) + fun _currency(): JsonField = currency - /** - * 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") + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - /** - * 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") + @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 [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 + companion object { - /** - * 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 a mutable builder for constructing an instance of + * [TotalHealthcare]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - /** - * 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 + /** A builder for [TotalHealthcare]. */ + class Builder internal constructor() { - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + @JvmSynthetic + internal fun from(totalHealthcare: TotalHealthcare) = apply { + amount = totalHealthcare.amount + currency = totalHealthcare.currency + additionalProperties = + totalHealthcare.additionalProperties.toMutableMap() + } - fun toBuilder() = Builder().from(this) + /** The amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) - companion object { + /** + * 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 } - /** - * Returns a mutable builder for constructing an instance of - * [NetworkIdentifiers]. - * - * The following fields are required: - * ```java - * .retrievalReferenceNumber() - * .traceNumber() - * .transactionId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) - /** A builder for [NetworkIdentifiers]. */ - class Builder internal constructor() { + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: JsonField) = apply { + this.currency = currency + } - private var retrievalReferenceNumber: JsonField? = null - private var traceNumber: JsonField? = null - private var transactionId: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - @JvmSynthetic - internal fun from(networkIdentifiers: NetworkIdentifiers) = apply { - retrievalReferenceNumber = networkIdentifiers.retrievalReferenceNumber - traceNumber = networkIdentifiers.traceNumber - transactionId = networkIdentifiers.transactionId - additionalProperties = - networkIdentifiers.additionalProperties.toMutableMap() + 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 [TotalHealthcare]. + * + * 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(): TotalHealthcare = + TotalHealthcare( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) } - /** - * 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)) + private var validated: Boolean = false - /** - * Alias for calling [Builder.retrievalReferenceNumber] with - * `retrievalReferenceNumber.orElse(null)`. - */ - fun retrievalReferenceNumber(retrievalReferenceNumber: Optional) = - retrievalReferenceNumber(retrievalReferenceNumber.getOrNull()) + fun validate(): TotalHealthcare = apply { + if (validated) { + return@apply + } + + amount() + currency() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } /** - * Sets [Builder.retrievalReferenceNumber] to an arbitrary JSON value. + * Returns a score indicating how many valid values are contained in this object + * recursively. * - * 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. + * Used for best match union deserialization. */ - fun retrievalReferenceNumber(retrievalReferenceNumber: JsonField) = - apply { - this.retrievalReferenceNumber = retrievalReferenceNumber + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - /** - * 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)) + return /* spotless:off */ other is TotalHealthcare && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** Alias for calling [Builder.traceNumber] with `traceNumber.orElse(null)`. */ - fun traceNumber(traceNumber: Optional) = - traceNumber(traceNumber.getOrNull()) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "TotalHealthcare{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** The part of this transaction amount that was for transit-related services. */ + class Transit + 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.traceNumber] to an arbitrary JSON value. + * The amount in minor units of the `currency` field. * - * 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. + * @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 traceNumber(traceNumber: JsonField) = apply { - this.traceNumber = traceNumber - } + fun amount(): Long = amount.getRequired("amount") /** - * A globally unique transaction identifier provided by the card network, used - * across multiple life-cycle requests. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount'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 transactionId(transactionId: String?) = - transactionId(JsonField.ofNullable(transactionId)) + fun currency(): String = currency.getRequired("currency") /** - * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`. + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun transactionId(transactionId: Optional) = - transactionId(transactionId.getOrNull()) + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount /** - * Sets [Builder.transactionId] to an arbitrary JSON value. + * Returns the raw JSON value of [currency]. * - * 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. + * Unlike [currency], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun transactionId(transactionId: JsonField) = apply { - this.transactionId = transactionId - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + @JsonProperty("currency") + @ExcludeMissing + fun _currency(): JsonField = currency - fun putAdditionalProperty(key: String, value: JsonValue) = apply { + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { 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) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** - * Returns an immutable instance of [NetworkIdentifiers]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .retrievalReferenceNumber() - * .traceNumber() - * .transactionId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): NetworkIdentifiers = - NetworkIdentifiers( - checkRequired("retrievalReferenceNumber", retrievalReferenceNumber), - checkRequired("traceNumber", traceNumber), - checkRequired("transactionId", transactionId), - additionalProperties.toMutableMap(), - ) - } + fun toBuilder() = Builder().from(this) - private var validated: Boolean = false + companion object { - fun validate(): NetworkIdentifiers = apply { - if (validated) { - return@apply + /** + * Returns a mutable builder for constructing an instance of [Transit]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() } - retrievalReferenceNumber() - traceNumber() - transactionId() - validated = true - } + /** A builder for [Transit]. */ + class Builder internal constructor() { - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + private var amount: JsonField? = null + private var currency: 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 (retrievalReferenceNumber.asKnown().isPresent) 1 else 0) + - (if (traceNumber.asKnown().isPresent) 1 else 0) + - (if (transactionId.asKnown().isPresent) 1 else 0) + @JvmSynthetic + internal fun from(transit: Transit) = apply { + amount = transit.amount + currency = transit.currency + additionalProperties = transit.additionalProperties.toMutableMap() + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** The amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) - return /* spotless:off */ other is NetworkIdentifiers && retrievalReferenceNumber == other.retrievalReferenceNumber && traceNumber == other.traceNumber && transactionId == other.transactionId && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * 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 } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(retrievalReferenceNumber, traceNumber, transactionId, additionalProperties) } - /* spotless:on */ + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) - override fun hashCode(): Int = hashCode + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: JsonField) = apply { + this.currency = currency + } - override fun toString() = - "NetworkIdentifiers{retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}" - } + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(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 { + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + 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 + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } - companion object { + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * Account funding transactions are transactions used to e.g., fund an account - * or transfer funds between accounts. - */ - @JvmField val ACCOUNT_FUNDING = of("account_funding") + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * 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 an immutable instance of [Transit]. + * + * 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(): Transit = + Transit( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } - /** 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(): Transit = apply { + if (validated) { + return@apply + } - /** A regular purchase. */ - @JvmField val PURCHASE = of("purchase") + amount() + currency() + 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. + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. */ - @JvmField val REFUND = of("refund") + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) - /** - * 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 + } - /** The processing category is unknown. */ - @JvmField val UNKNOWN = of("unknown") + return /* spotless:off */ other is Transit && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } - @JvmStatic fun of(value: String) = ProcessingCategory(JsonField.of(value)) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Transit{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" } - /** 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, + /** An unknown additional amount. */ + class Unknown + 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()) + /** - * A refund card authorization, sometimes referred to as a credit voucher - * authorization, where funds are credited to the cardholder. + * The amount in minor units of the `currency` field. + * + * @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). */ - REFUND, + fun amount(): Long = amount.getRequired("amount") + /** - * Cash disbursement transactions are used to withdraw cash from an ATM or a - * point of sale. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount'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). */ - CASH_DISBURSEMENT, - /** The processing category is unknown. */ - UNKNOWN, - } + fun currency(): String = currency.getRequired("currency") - /** - * 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. + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an + * unexpected type. */ - ACCOUNT_FUNDING, + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + /** - * 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. + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an + * unexpected type. */ - 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, + @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 [Unknown]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Unknown]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(unknown: Unknown) = apply { + amount = unknown.amount + currency = unknown.currency + additionalProperties = unknown.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [Unknown]. + * + * 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(): Unknown = + Unknown( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Unknown = apply { + if (validated) { + return@apply + } + + amount() + currency() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + /** - * Quasi-cash transactions represent purchases of items which may be convertible - * to cash. + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. */ - QUASI_CASH, + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Unknown && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Unknown{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** The part of this transaction amount that was for vision-related services. */ + class Vision + 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()) + /** - * A refund card authorization, sometimes referred to as a credit voucher - * authorization, where funds are credited to the cardholder. + * The amount in minor units of the `currency` field. + * + * @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). */ - REFUND, + fun amount(): Long = amount.getRequired("amount") + /** - * Cash disbursement transactions are used to withdraw cash from an ATM or a - * point of sale. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount'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). */ - CASH_DISBURSEMENT, - /** The processing category is unknown. */ - UNKNOWN, + fun currency(): String = currency.getRequired("currency") + /** - * An enum member indicating that [ProcessingCategory] was instantiated with an - * unknown 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 + + /** + * 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 [Vision]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Vision]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(vision: Vision) = apply { + amount = vision.amount + currency = vision.currency + additionalProperties = vision.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [Vision]. + * + * 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(): Vision = + Vision( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Vision = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Vision && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Vision{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is AdditionalAmounts && clinic == other.clinic && dental == other.dental && prescription == other.prescription && surcharge == other.surcharge && totalCumulative == other.totalCumulative && totalHealthcare == other.totalHealthcare && transit == other.transit && unknown == other.unknown && vision == other.vision && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(clinic, dental, prescription, surcharge, totalCumulative, totalHealthcare, transit, unknown, vision, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "AdditionalAmounts{clinic=$clinic, dental=$dental, prescription=$prescription, surcharge=$surcharge, totalCumulative=$totalCumulative, totalHealthcare=$totalHealthcare, transit=$transit, unknown=$unknown, vision=$vision, additionalProperties=$additionalProperties}" + } + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's + * currency. + */ + 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 { + + /** Canadian Dollar (CAD) */ + @JvmField val CAD = of("CAD") + + /** Swiss Franc (CHF) */ + @JvmField val CHF = of("CHF") + + /** Euro (EUR) */ + @JvmField val EUR = of("EUR") + + /** British Pound (GBP) */ + @JvmField val GBP = of("GBP") + + /** Japanese Yen (JPY) */ + @JvmField val JPY = of("JPY") + + /** 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 { + /** Canadian Dollar (CAD) */ + CAD, + /** Swiss Franc (CHF) */ + CHF, + /** Euro (EUR) */ + EUR, + /** British Pound (GBP) */ + GBP, + /** Japanese Yen (JPY) */ + JPY, + /** 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 { + /** Canadian Dollar (CAD) */ + CAD, + /** Swiss Franc (CHF) */ + CHF, + /** Euro (EUR) */ + EUR, + /** British Pound (GBP) */ + GBP, + /** Japanese Yen (JPY) */ + JPY, + /** US Dollar (USD) */ + USD, + /** + * An enum member indicating that [Currency] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -7826,15 +8224,12 @@ 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 - UNKNOWN -> Value.UNKNOWN + CAD -> Value.CAD + CHF -> Value.CHF + EUR -> Value.EUR + GBP -> Value.GBP + JPY -> Value.JPY + USD -> Value.USD else -> Value._UNKNOWN } @@ -7849,17 +8244,13 @@ 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 - UNKNOWN -> Known.UNKNOWN - else -> - throw IncreaseInvalidDataException("Unknown ProcessingCategory: $value") + CAD -> Known.CAD + CHF -> Known.CHF + EUR -> Known.EUR + GBP -> Known.GBP + JPY -> Known.JPY + USD -> Known.USD + else -> throw IncreaseInvalidDataException("Unknown Currency: $value") } /** @@ -7878,7 +8269,7 @@ private constructor( private var validated: Boolean = false - fun validate(): ProcessingCategory = apply { + fun validate(): Currency = apply { if (validated) { return@apply } @@ -7908,7 +8299,7 @@ private constructor( return true } - return /* spotless:off */ other is ProcessingCategory && value == other.value /* spotless:on */ + return /* spotless:off */ other is Currency && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -7917,10 +8308,10 @@ private constructor( } /** - * A constant representing the object's type. For this resource it will always be - * `card_authorization`. + * The direction describes the direction the funds will move, either from the cardholder + * to the merchant or from the merchant to the cardholder. */ - class Type @JsonCreator private constructor(private val value: JsonField) : + class Direction @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -7935,29 +8326,49 @@ private constructor( companion object { - @JvmField val CARD_AUTHORIZATION = of("card_authorization") + /** A regular card authorization where funds are debited from the cardholder. */ + @JvmField val SETTLEMENT = of("settlement") - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + /** + * A refund card authorization, sometimes referred to as a credit voucher + * authorization, where funds are credited to the cardholder. + */ + @JvmField val REFUND = of("refund") + + @JvmStatic fun of(value: String) = Direction(JsonField.of(value)) } - /** An enum containing [Type]'s known values. */ + /** An enum containing [Direction]'s known values. */ enum class Known { - CARD_AUTHORIZATION + /** A regular card authorization where funds are debited from the cardholder. */ + SETTLEMENT, + /** + * A refund card authorization, sometimes referred to as a credit voucher + * authorization, where funds are credited to the cardholder. + */ + REFUND, } /** - * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [Direction]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [Type] can contain an unknown value in a couple of cases: + * An instance of [Direction] 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, + /** A regular card authorization where funds are debited from the cardholder. */ + SETTLEMENT, /** - * An enum member indicating that [Type] was instantiated with an unknown value. + * A refund card authorization, sometimes referred to as a credit voucher + * authorization, where funds are credited to the cardholder. + */ + REFUND, + /** + * An enum member indicating that [Direction] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -7971,7 +8382,8 @@ private constructor( */ fun value(): Value = when (this) { - CARD_AUTHORIZATION -> Value.CARD_AUTHORIZATION + SETTLEMENT -> Value.SETTLEMENT + REFUND -> Value.REFUND else -> Value._UNKNOWN } @@ -7986,8 +8398,9 @@ private constructor( */ fun known(): Known = when (this) { - CARD_AUTHORIZATION -> Known.CARD_AUTHORIZATION - else -> throw IncreaseInvalidDataException("Unknown Type: $value") + SETTLEMENT -> Known.SETTLEMENT + REFUND -> Known.REFUND + else -> throw IncreaseInvalidDataException("Unknown Direction: $value") } /** @@ -8006,7 +8419,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Type = apply { + fun validate(): Direction = apply { if (validated) { return@apply } @@ -8036,7 +8449,7 @@ private constructor( return true } - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + return /* spotless:off */ other is Direction && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -8044,65 +8457,56 @@ private constructor( override fun toString() = value.toString() } - /** Fields related to verification of cardholder-provided values. */ - class Verification + /** Fields specific to the `network`. */ + class NetworkDetails private constructor( - private val cardVerificationCode: JsonField, - private val cardholderAddress: JsonField, + private val category: JsonField, + private val visa: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("card_verification_code") - @ExcludeMissing - cardVerificationCode: JsonField = JsonMissing.of(), - @JsonProperty("cardholder_address") + @JsonProperty("category") @ExcludeMissing - cardholderAddress: JsonField = JsonMissing.of(), - ) : this(cardVerificationCode, cardholderAddress, mutableMapOf()) + category: JsonField = JsonMissing.of(), + @JsonProperty("visa") @ExcludeMissing visa: JsonField = JsonMissing.of(), + ) : this(category, visa, mutableMapOf()) /** - * Fields related to verification of the Card Verification Code, a 3-digit code on - * the back of the card. + * The payment 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 cardVerificationCode(): CardVerificationCode = - cardVerificationCode.getRequired("card_verification_code") + fun category(): Category = category.getRequired("category") /** - * Cardholder address provided in the authorization request and the address on file - * we verified it against. + * Fields specific to the `visa` 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). + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ - fun cardholderAddress(): CardholderAddress = - cardholderAddress.getRequired("cardholder_address") + fun visa(): Optional = visa.getOptional("visa") /** - * Returns the raw JSON value of [cardVerificationCode]. + * Returns the raw JSON value of [category]. * - * Unlike [cardVerificationCode], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [category], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("card_verification_code") + @JsonProperty("category") @ExcludeMissing - fun _cardVerificationCode(): JsonField = cardVerificationCode + fun _category(): JsonField = category /** - * Returns the raw JSON value of [cardholderAddress]. + * Returns the raw JSON value of [visa]. * - * Unlike [cardholderAddress], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [visa], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("cardholder_address") - @ExcludeMissing - fun _cardholderAddress(): JsonField = cardholderAddress + @JsonProperty("visa") @ExcludeMissing fun _visa(): JsonField = visa @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -8119,66 +8523,57 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [Verification]. + * Returns a mutable builder for constructing an instance of [NetworkDetails]. * * The following fields are required: * ```java - * .cardVerificationCode() - * .cardholderAddress() + * .category() + * .visa() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [Verification]. */ + /** A builder for [NetworkDetails]. */ class Builder internal constructor() { - private var cardVerificationCode: JsonField? = null - private var cardholderAddress: JsonField? = null + private var category: JsonField? = null + private var visa: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(verification: Verification) = apply { - cardVerificationCode = verification.cardVerificationCode - cardholderAddress = verification.cardholderAddress - additionalProperties = verification.additionalProperties.toMutableMap() + internal fun from(networkDetails: NetworkDetails) = apply { + category = networkDetails.category + visa = networkDetails.visa + additionalProperties = networkDetails.additionalProperties.toMutableMap() } - /** - * Fields related to verification of the Card Verification Code, a 3-digit code - * on the back of the card. - */ - fun cardVerificationCode(cardVerificationCode: CardVerificationCode) = - cardVerificationCode(JsonField.of(cardVerificationCode)) + /** The payment network used to process this card authorization. */ + fun category(category: Category) = category(JsonField.of(category)) /** - * Sets [Builder.cardVerificationCode] to an arbitrary JSON value. + * Sets [Builder.category] 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.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 cardVerificationCode( - cardVerificationCode: JsonField - ) = apply { this.cardVerificationCode = cardVerificationCode } + fun category(category: JsonField) = apply { this.category = category } - /** - * Cardholder address provided in the authorization request and the address on - * file we verified it against. - */ - fun cardholderAddress(cardholderAddress: CardholderAddress) = - cardholderAddress(JsonField.of(cardholderAddress)) + /** Fields specific to the `visa` network. */ + fun visa(visa: Visa?) = visa(JsonField.ofNullable(visa)) + + /** Alias for calling [Builder.visa] with `visa.orElse(null)`. */ + fun visa(visa: Optional) = visa(visa.getOrNull()) /** - * Sets [Builder.cardholderAddress] to an arbitrary JSON value. + * Sets [Builder.visa] 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.visa] with a well-typed [Visa] 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 visa(visa: JsonField) = apply { this.visa = visa } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -8203,35 +8598,35 @@ private constructor( } /** - * Returns an immutable instance of [Verification]. + * Returns an immutable instance of [NetworkDetails]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .cardVerificationCode() - * .cardholderAddress() + * .category() + * .visa() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): Verification = - Verification( - checkRequired("cardVerificationCode", cardVerificationCode), - checkRequired("cardholderAddress", cardholderAddress), + fun build(): NetworkDetails = + NetworkDetails( + checkRequired("category", category), + checkRequired("visa", visa), additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): Verification = apply { + fun validate(): NetworkDetails = apply { if (validated) { return@apply } - cardVerificationCode().validate() - cardholderAddress().validate() + category().validate() + visa().ifPresent { it.validate() } validated = true } @@ -8251,44 +8646,235 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (cardVerificationCode.asKnown().getOrNull()?.validity() ?: 0) + - (cardholderAddress.asKnown().getOrNull()?.validity() ?: 0) + (category.asKnown().getOrNull()?.validity() ?: 0) + + (visa.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 + /** 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") + + @JvmStatic fun of(value: String) = Category(JsonField.of(value)) + } + + /** An enum containing [Category]'s known values. */ + enum class Known { + /** Visa */ + VISA + } + + /** + * 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, + /** + * 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 + 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 + 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 /* spotless:off */ other is Category && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Fields specific to the `visa` network. */ + class Visa private constructor( - private val result: JsonField, + private val electronicCommerceIndicator: JsonField, + private val pointOfServiceEntryMode: JsonField, + private val standInProcessingReason: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("result") + @JsonProperty("electronic_commerce_indicator") @ExcludeMissing - result: JsonField = JsonMissing.of() - ) : this(result, mutableMapOf()) + 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(), + ) : this( + electronicCommerceIndicator, + pointOfServiceEntryMode, + standInProcessingReason, + mutableMapOf(), + ) /** - * The result of verifying the Card Verification Code. + * 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 - * or is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). + * (e.g. if the server responded with an unexpected value). */ - fun result(): Result = result.getRequired("result") + fun electronicCommerceIndicator(): Optional = + electronicCommerceIndicator.getOptional("electronic_commerce_indicator") /** - * Returns the raw JSON value of [result]. + * The method used to enter the cardholder's primary account number and card + * expiration date. * - * Unlike [result], 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("result") + 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") + + /** + * 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 _result(): JsonField = result + 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 @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -8305,42 +8891,127 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [CardVerificationCode]. + * Returns a mutable builder for constructing an instance of [Visa]. * * The following fields are required: * ```java - * .result() + * .electronicCommerceIndicator() + * .pointOfServiceEntryMode() + * .standInProcessingReason() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [CardVerificationCode]. */ + /** A builder for [Visa]. */ class Builder internal constructor() { - private var result: JsonField? = null + private var electronicCommerceIndicator: + JsonField? = + null + private var pointOfServiceEntryMode: JsonField? = + null + private var standInProcessingReason: JsonField? = + null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(cardVerificationCode: CardVerificationCode) = apply { - result = cardVerificationCode.result - additionalProperties = - cardVerificationCode.additionalProperties.toMutableMap() + internal fun from(visa: Visa) = apply { + electronicCommerceIndicator = visa.electronicCommerceIndicator + pointOfServiceEntryMode = visa.pointOfServiceEntryMode + standInProcessingReason = visa.standInProcessingReason + additionalProperties = visa.additionalProperties.toMutableMap() } - /** The result of verifying the Card Verification Code. */ - fun result(result: Result) = result(JsonField.of(result)) + /** + * 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) + ) /** - * Sets [Builder.result] to an arbitrary JSON value. + * 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.result] with a well-typed [Result] value - * instead. This method is primarily for setting the field to an - * undocumented or not yet supported 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 result(result: JsonField) = apply { this.result = result } + 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 } fun additionalProperties(additionalProperties: Map) = apply { @@ -8365,32 +9036,41 @@ private constructor( } /** - * Returns an immutable instance of [CardVerificationCode]. + * Returns an immutable instance of [Visa]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .result() + * .electronicCommerceIndicator() + * .pointOfServiceEntryMode() + * .standInProcessingReason() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): CardVerificationCode = - CardVerificationCode( - checkRequired("result", result), + fun build(): Visa = + Visa( + checkRequired( + "electronicCommerceIndicator", + electronicCommerceIndicator, + ), + checkRequired("pointOfServiceEntryMode", pointOfServiceEntryMode), + checkRequired("standInProcessingReason", standInProcessingReason), additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): CardVerificationCode = apply { + fun validate(): Visa = apply { if (validated) { return@apply } - result().validate() + electronicCommerceIndicator().ifPresent { it.validate() } + pointOfServiceEntryMode().ifPresent { it.validate() } + standInProcessingReason().ifPresent { it.validate() } validated = true } @@ -8409,10 +9089,17 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = (result.asKnown().getOrNull()?.validity() ?: 0) + internal fun validity(): Int = + (electronicCommerceIndicator.asKnown().getOrNull()?.validity() ?: 0) + + (pointOfServiceEntryMode.asKnown().getOrNull()?.validity() ?: 0) + + (standInProcessingReason.asKnown().getOrNull()?.validity() ?: 0) - /** The result of verifying the Card Verification Code. */ - class Result + /** + * 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 { @@ -8430,37 +9117,136 @@ private constructor( companion object { /** - * No card verification code was provided in the authorization request. + * 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 NOT_CHECKED = of("not_checked") - - /** The card verification code matched the one on file. */ - @JvmField val MATCH = of("match") + @JvmField val MAIL_PHONE_ORDER = of("mail_phone_order") - /** The card verification code did not match the one on file. */ - @JvmField val NO_MATCH = of("no_match") + /** + * Recurring transaction: Payment indicator used to indicate a recurring + * transaction that originates from an acquirer in the US region. + */ + @JvmField val RECURRING = of("recurring") - @JvmStatic fun of(value: String) = Result(JsonField.of(value)) + /** + * 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)) } - /** An enum containing [Result]'s known values. */ + /** An enum containing [ElectronicCommerceIndicator]'s known values. */ enum class Known { /** - * No card verification code was provided in the authorization request. + * 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. */ - 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, + 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 [Result]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [ElectronicCommerceIndicator]'s known values, as well + * as an [_UNKNOWN] member. * - * An instance of [Result] can contain an unknown value in a couple of - * cases: + * 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. @@ -8468,16 +9254,60 @@ private constructor( */ enum class Value { /** - * No card verification code was provided in the authorization request. + * 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. */ - 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, + MAIL_PHONE_ORDER, /** - * An enum member indicating that [Result] was instantiated with an - * unknown value. + * 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, } @@ -8491,9 +9321,17 @@ private constructor( */ fun value(): Value = when (this) { - NOT_CHECKED -> Value.NOT_CHECKED - MATCH -> Value.MATCH - NO_MATCH -> Value.NO_MATCH + 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 } @@ -8508,10 +9346,21 @@ private constructor( */ fun known(): Known = when (this) { - NOT_CHECKED -> Known.NOT_CHECKED - MATCH -> Known.MATCH - NO_MATCH -> Known.NO_MATCH - else -> throw IncreaseInvalidDataException("Unknown Result: $value") + 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" + ) } /** @@ -8530,7 +9379,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Result = apply { + fun validate(): ElectronicCommerceIndicator = apply { if (validated) { return@apply } @@ -8561,7 +9410,7 @@ private constructor( return true } - return /* spotless:off */ other is Result && value == other.value /* spotless:on */ + return /* spotless:off */ other is ElectronicCommerceIndicator && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -8569,403 +9418,247 @@ private constructor( override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is CardVerificationCode && result == other.result && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(result, additionalProperties) } - /* spotless:on */ - - 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 - 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") - - /** - * 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). + * The method used to enter the cardholder's primary account number and card + * expiration date. */ - fun result(): Result = result.getRequired("result") + class PointOfServiceEntryMode + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** - * 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 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 [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 + companion object { - /** - * 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 + /** Unknown */ + @JvmField val UNKNOWN = of("unknown") - /** - * 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 + /** Manual key entry */ + @JvmField val MANUAL = of("manual") - /** - * 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 + /** Magnetic stripe read, without card verification value */ + @JvmField val MAGNETIC_STRIPE_NO_CVV = of("magnetic_stripe_no_cvv") - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** Optical code */ + @JvmField val OPTICAL_CODE = of("optical_code") - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** Contact chip card */ + @JvmField val INTEGRATED_CIRCUIT_CARD = of("integrated_circuit_card") - fun toBuilder() = Builder().from(this) + /** Contactless read of chip card */ + @JvmField val CONTACTLESS = of("contactless") - companion object { + /** + * Transaction initiated using a credential that has previously been + * stored on file + */ + @JvmField val CREDENTIAL_ON_FILE = of("credential_on_file") - /** - * 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() - } + /** Magnetic stripe read */ + @JvmField val MAGNETIC_STRIPE = of("magnetic_stripe") - /** A builder for [CardholderAddress]. */ - class Builder internal constructor() { + /** Contactless read of magnetic stripe data */ + @JvmField + val CONTACTLESS_MAGNETIC_STRIPE = of("contactless_magnetic_stripe") - 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() + /** Contact chip card, without card verification value */ + @JvmField + val INTEGRATED_CIRCUIT_CARD_NO_CVV = + of("integrated_circuit_card_no_cvv") - @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() + @JvmStatic + fun of(value: String) = PointOfServiceEntryMode(JsonField.of(value)) } - /** 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()) + /** 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, + } /** - * Sets [Builder.actualLine1] to an arbitrary JSON value. + * An enum containing [PointOfServiceEntryMode]'s known values, as well as + * an [_UNKNOWN] member. * - * 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. + * 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 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 + 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, } /** - * 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. + * 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.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)`. + * 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 providedPostalCode(providedPostalCode: Optional) = - providedPostalCode(providedPostalCode.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.providedPostalCode] to an arbitrary JSON value. + * Returns an enum member corresponding to this class instance's 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. + * 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 providedPostalCode(providedPostalCode: JsonField) = apply { - this.providedPostalCode = providedPostalCode - } - - /** The address verification result returned to the card network. */ - fun result(result: Result) = result(JsonField.of(result)) + 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.result] to an arbitrary JSON value. + * Returns this class instance's primitive wire representation. * - * 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. + * 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 result(result: JsonField) = apply { this.result = result } - - 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(): PointOfServiceEntryMode = 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 [CardholderAddress]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .actualLine1() - * .actualPostalCode() - * .providedLine1() - * .providedPostalCode() - * .result() - * ``` + * 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(): CardholderAddress = - CardholderAddress( - checkRequired("actualLine1", actualLine1), - checkRequired("actualPostalCode", actualPostalCode), - checkRequired("providedLine1", providedLine1), - checkRequired("providedPostalCode", providedPostalCode), - checkRequired("result", result), - 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(): CardholderAddress = apply { - if (validated) { - return@apply + return /* spotless:off */ other is PointOfServiceEntryMode && value == other.value /* spotless:on */ } - actualLine1() - actualPostalCode() - providedLine1() - providedPostalCode() - result().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. + * Only present when `actioner: network`. Describes why a card authorization was + * approved or declined by Visa through stand-in processing. */ - @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) - - /** The address verification result returned to the card network. */ - class Result + class StandInProcessingReason @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -8982,76 +9675,129 @@ private constructor( companion object { - /** No address was provided in the authorization request. */ - @JvmField val NOT_CHECKED = of("not_checked") + /** Increase failed to process the authorization in a timely manner. */ + @JvmField val ISSUER_ERROR = of("issuer_error") - /** Postal code matches, but the street address was not verified. */ - @JvmField - val POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED = - of("postal_code_match_address_not_checked") + /** + * The physical card read had an invalid CVV, dCVV, or authorization + * request cryptogram. + */ + @JvmField val INVALID_PHYSICAL_CARD = of("invalid_physical_card") - /** Postal code matches, but the street address does not match. */ + /** The 3DS cardholder authentication verification value was invalid. */ @JvmField - val POSTAL_CODE_MATCH_ADDRESS_NO_MATCH = - of("postal_code_match_address_no_match") + val INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE = + of("invalid_cardholder_authentication_verification_value") - /** Postal code does not match, but the street address matches. */ + /** + * 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 POSTAL_CODE_NO_MATCH_ADDRESS_MATCH = - of("postal_code_no_match_address_match") + val MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED = + of("merchant_transaction_advisory_service_authentication_required") - /** Postal code and street address match. */ - @JvmField val MATCH = of("match") + /** + * 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") - /** Postal code and street address do not match. */ - @JvmField val NO_MATCH = of("no_match") + /** An unspecific reason for stand-in processing. */ + @JvmField val OTHER = of("other") - @JvmStatic fun of(value: String) = Result(JsonField.of(value)) + @JvmStatic + fun of(value: String) = StandInProcessingReason(JsonField.of(value)) } - /** An enum containing [Result]'s known values. */ + /** An enum containing [StandInProcessingReason]'s known values. */ enum class Known { - /** No address was provided in the authorization request. */ - NOT_CHECKED, - /** Postal code matches, but the street address was not verified. */ - POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED, - /** Postal code matches, but the street address does not match. */ - POSTAL_CODE_MATCH_ADDRESS_NO_MATCH, - /** Postal code does not match, but the street address matches. */ - POSTAL_CODE_NO_MATCH_ADDRESS_MATCH, - /** Postal code and street address match. */ - MATCH, - /** Postal code and street address do not match. */ - NO_MATCH, + /** Increase failed to process the authorization in a timely manner. */ + ISSUER_ERROR, + /** + * The physical card read had an invalid CVV, dCVV, or authorization + * request cryptogram. + */ + INVALID_PHYSICAL_CARD, + /** 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 [Result]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [StandInProcessingReason]'s known values, as well as + * an [_UNKNOWN] member. * - * An instance of [Result] can contain an unknown value in a couple of - * cases: + * 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 { - /** No address was provided in the authorization request. */ - NOT_CHECKED, - /** Postal code matches, but the street address was not verified. */ - POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED, - /** Postal code matches, but the street address does not match. */ - POSTAL_CODE_MATCH_ADDRESS_NO_MATCH, - /** Postal code does not match, but the street address matches. */ - POSTAL_CODE_NO_MATCH_ADDRESS_MATCH, - /** Postal code and street address match. */ - MATCH, - /** Postal code and street address do not match. */ - NO_MATCH, + /** Increase failed to process the authorization in a timely manner. */ + ISSUER_ERROR, /** - * An enum member indicating that [Result] was instantiated with an - * unknown value. + * The physical card read had an invalid CVV, dCVV, or authorization + * request cryptogram. + */ + INVALID_PHYSICAL_CARD, + /** 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, } @@ -9065,15 +9811,17 @@ private constructor( */ fun value(): Value = when (this) { - NOT_CHECKED -> Value.NOT_CHECKED - POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED -> - Value.POSTAL_CODE_MATCH_ADDRESS_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 + ISSUER_ERROR -> Value.ISSUER_ERROR + INVALID_PHYSICAL_CARD -> Value.INVALID_PHYSICAL_CARD + 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 } @@ -9088,16 +9836,21 @@ private constructor( */ fun known(): Known = when (this) { - NOT_CHECKED -> Known.NOT_CHECKED - POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED -> - Known.POSTAL_CODE_MATCH_ADDRESS_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 - else -> throw IncreaseInvalidDataException("Unknown Result: $value") + ISSUER_ERROR -> Known.ISSUER_ERROR + INVALID_PHYSICAL_CARD -> Known.INVALID_PHYSICAL_CARD + 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" + ) } /** @@ -9116,7 +9869,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Result = apply { + fun validate(): StandInProcessingReason = apply { if (validated) { return@apply } @@ -9147,7 +9900,7 @@ private constructor( return true } - return /* spotless:off */ other is Result && value == other.value /* spotless:on */ + return /* spotless:off */ other is StandInProcessingReason && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -9160,17 +9913,17 @@ private constructor( return true } - return /* spotless:off */ other is CardholderAddress && actualLine1 == other.actualLine1 && actualPostalCode == other.actualPostalCode && providedLine1 == other.providedLine1 && providedPostalCode == other.providedPostalCode && result == other.result && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Visa && electronicCommerceIndicator == other.electronicCommerceIndicator && pointOfServiceEntryMode == other.pointOfServiceEntryMode && standInProcessingReason == other.standInProcessingReason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(actualLine1, actualPostalCode, providedLine1, providedPostalCode, result, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(electronicCommerceIndicator, pointOfServiceEntryMode, standInProcessingReason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CardholderAddress{actualLine1=$actualLine1, actualPostalCode=$actualPostalCode, providedLine1=$providedLine1, providedPostalCode=$providedPostalCode, result=$result, additionalProperties=$additionalProperties}" + "Visa{electronicCommerceIndicator=$electronicCommerceIndicator, pointOfServiceEntryMode=$pointOfServiceEntryMode, standInProcessingReason=$standInProcessingReason, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -9178,500 +9931,467 @@ private constructor( return true } - return /* spotless:off */ other is Verification && cardVerificationCode == other.cardVerificationCode && cardholderAddress == other.cardholderAddress && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NetworkDetails && category == other.category && visa == other.visa && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cardVerificationCode, cardholderAddress, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(category, visa, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Verification{cardVerificationCode=$cardVerificationCode, cardholderAddress=$cardholderAddress, additionalProperties=$additionalProperties}" + "NetworkDetails{category=$category, visa=$visa, additionalProperties=$additionalProperties}" } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** Network-specific identifiers for a specific request or transaction. */ + class NetworkIdentifiers + private constructor( + private val retrievalReferenceNumber: JsonField, + private val traceNumber: JsonField, + private val transactionId: JsonField, + private val additionalProperties: MutableMap, + ) { - return /* spotless:off */ other is CardAuthorization && id == other.id && actioner == other.actioner && 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 /* spotless:on */ - } + @JsonCreator + private constructor( + @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(retrievalReferenceNumber, traceNumber, transactionId, mutableMapOf()) - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, actioner, 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) } - /* spotless:on */ + /** + * 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") - override fun hashCode(): Int = hashCode + /** + * 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") - override fun toString() = - "CardAuthorization{id=$id, actioner=$actioner, 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}" - } + /** + * 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 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 - 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, - ) { - - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("card_authorization_id") + /** + * 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 - cardAuthorizationId: JsonField = JsonMissing.of(), - @JsonProperty("currency") + 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 - currency: JsonField = JsonMissing.of(), - @JsonProperty("expired_amount") + 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 - expiredAmount: JsonField = JsonMissing.of(), - @JsonProperty("network") + fun _transactionId(): JsonField = transactionId + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter @ExcludeMissing - network: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - ) : this( - id, - cardAuthorizationId, - currency, - expiredAmount, - network, - type, - mutableMapOf(), - ) + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** - * 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") + fun toBuilder() = Builder().from(this) - /** - * 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") + companion object { - /** - * 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") + /** + * Returns a mutable builder for constructing an instance of + * [NetworkIdentifiers]. + * + * The following fields are required: + * ```java + * .retrievalReferenceNumber() + * .traceNumber() + * .transactionId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - /** - * 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") + /** A builder for [NetworkIdentifiers]. */ + class Builder internal constructor() { - /** - * 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") + private var retrievalReferenceNumber: JsonField? = null + private var traceNumber: JsonField? = null + private var transactionId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** - * 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") + @JvmSynthetic + internal fun from(networkIdentifiers: NetworkIdentifiers) = apply { + retrievalReferenceNumber = networkIdentifiers.retrievalReferenceNumber + traceNumber = networkIdentifiers.traceNumber + transactionId = networkIdentifiers.transactionId + additionalProperties = + networkIdentifiers.additionalProperties.toMutableMap() + } - /** - * 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 + /** + * 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 [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 + /** + * Alias for calling [Builder.retrievalReferenceNumber] with + * `retrievalReferenceNumber.orElse(null)`. + */ + fun retrievalReferenceNumber(retrievalReferenceNumber: Optional) = + retrievalReferenceNumber(retrievalReferenceNumber.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.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 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 + /** + * 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 [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + /** + * 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 + } - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, 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)) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** + * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`. + */ + fun transactionId(transactionId: Optional) = + transactionId(transactionId.getOrNull()) - fun toBuilder() = Builder().from(this) + /** + * 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 + } - companion object { + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * 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() - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** A builder for [CardAuthorizationExpiration]. */ - class Builder internal constructor() { + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - 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() + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - @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() + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } - /** The Card Authorization Expiration identifier. */ - fun id(id: String) = id(JsonField.of(id)) + /** + * Returns an immutable instance of [NetworkIdentifiers]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .retrievalReferenceNumber() + * .traceNumber() + * .transactionId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): NetworkIdentifiers = + NetworkIdentifiers( + checkRequired("retrievalReferenceNumber", retrievalReferenceNumber), + checkRequired("traceNumber", traceNumber), + checkRequired("transactionId", transactionId), + additionalProperties.toMutableMap(), + ) + } - /** - * 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 } + private var validated: Boolean = false - /** The identifier for the Card Authorization this reverses. */ - fun cardAuthorizationId(cardAuthorizationId: String) = - cardAuthorizationId(JsonField.of(cardAuthorizationId)) + fun validate(): NetworkIdentifiers = apply { + if (validated) { + return@apply + } - /** - * 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 + retrievalReferenceNumber() + traceNumber() + transactionId() + validated = true } - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the reversal's - * currency. - */ - 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. + * Returns a score indicating how many valid values are contained in this object + * recursively. * - * 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. + * Used for best match union deserialization. */ - fun currency(currency: JsonField) = apply { this.currency = currency } + @JvmSynthetic + internal fun validity(): Int = + (if (retrievalReferenceNumber.asKnown().isPresent) 1 else 0) + + (if (traceNumber.asKnown().isPresent) 1 else 0) + + (if (transactionId.asKnown().isPresent) 1 else 0) - /** - * 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)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * 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 + return /* spotless:off */ other is NetworkIdentifiers && retrievalReferenceNumber == other.retrievalReferenceNumber && traceNumber == other.traceNumber && transactionId == other.transactionId && additionalProperties == other.additionalProperties /* spotless:on */ } - /** The card network used to process this card authorization. */ - fun network(network: Network) = network(JsonField.of(network)) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(retrievalReferenceNumber, traceNumber, transactionId, additionalProperties) } + /* spotless:on */ - /** - * 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 } + override fun hashCode(): Int = hashCode - /** - * 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)) + override fun toString() = + "NetworkIdentifiers{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 { /** - * Sets [Builder.type] to an arbitrary JSON value. + * Returns this class instance's raw 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. + * 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 type(type: JsonField) = apply { this.type = type } + @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) - } + /** + * Account funding transactions are transactions used to e.g., fund an account + * or transfer funds between accounts. + */ + @JvmField val ACCOUNT_FUNDING = of("account_funding") - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + /** + * 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") - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** A transaction used to pay a bill. */ + @JvmField val BILL_PAYMENT = of("bill_payment") - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** Original credit transactions are used to send money to a cardholder. */ + @JvmField val ORIGINAL_CREDIT = of("original_credit") - /** - * 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(), - ) - } - - private var validated: Boolean = false - - fun validate(): CardAuthorizationExpiration = apply { - if (validated) { - return@apply - } - - id() - cardAuthorizationId() - currency().validate() - expiredAmount() - network().validate() - 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 (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) - - /** - * 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 { - - /** - * 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 { - - /** Canadian Dollar (CAD) */ - @JvmField val CAD = of("CAD") - - /** Swiss Franc (CHF) */ - @JvmField val CHF = of("CHF") + /** A regular purchase. */ + @JvmField val PURCHASE = of("purchase") - /** Euro (EUR) */ - @JvmField val EUR = of("EUR") + /** + * Quasi-cash transactions represent purchases of items which may be convertible + * to cash. + */ + @JvmField val QUASI_CASH = of("quasi_cash") - /** British Pound (GBP) */ - @JvmField val GBP = of("GBP") + /** + * A refund card authorization, sometimes referred to as a credit voucher + * authorization, where funds are credited to the cardholder. + */ + @JvmField val REFUND = of("refund") - /** Japanese Yen (JPY) */ - @JvmField val JPY = of("JPY") + /** + * Cash disbursement transactions are used to withdraw cash from an ATM or a + * point of sale. + */ + @JvmField val CASH_DISBURSEMENT = of("cash_disbursement") - /** US Dollar (USD) */ - @JvmField val USD = of("USD") + /** The processing category is unknown. */ + @JvmField val UNKNOWN = of("unknown") - @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) + @JvmStatic fun of(value: String) = ProcessingCategory(JsonField.of(value)) } - /** An enum containing [Currency]'s known values. */ + /** An enum containing [ProcessingCategory]'s known values. */ enum class Known { - /** Canadian Dollar (CAD) */ - CAD, - /** Swiss Franc (CHF) */ - CHF, - /** Euro (EUR) */ - EUR, - /** British Pound (GBP) */ - GBP, - /** Japanese Yen (JPY) */ - JPY, - /** US Dollar (USD) */ - USD, + /** + * 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, + /** The processing category is unknown. */ + UNKNOWN, } /** - * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [ProcessingCategory]'s known values, as well as an [_UNKNOWN] + * member. * - * An instance of [Currency] can contain an unknown value in a couple of cases: + * 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 { - /** Canadian Dollar (CAD) */ - CAD, - /** Swiss Franc (CHF) */ - CHF, - /** Euro (EUR) */ - EUR, - /** British Pound (GBP) */ - GBP, - /** Japanese Yen (JPY) */ - JPY, - /** US Dollar (USD) */ - USD, /** - * An enum member indicating that [Currency] was instantiated with an unknown - * 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, + /** The processing category is unknown. */ + UNKNOWN, + /** + * An enum member indicating that [ProcessingCategory] was instantiated with an + * unknown value. */ _UNKNOWN, } @@ -9685,12 +10405,15 @@ private constructor( */ fun value(): Value = when (this) { - CAD -> Value.CAD - CHF -> Value.CHF - EUR -> Value.EUR - GBP -> Value.GBP - JPY -> Value.JPY - USD -> Value.USD + 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 + UNKNOWN -> Value.UNKNOWN else -> Value._UNKNOWN } @@ -9705,13 +10428,17 @@ private constructor( */ fun known(): Known = when (this) { - CAD -> Known.CAD - CHF -> Known.CHF - EUR -> Known.EUR - GBP -> Known.GBP - JPY -> Known.JPY - USD -> Known.USD - else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + 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 + UNKNOWN -> Known.UNKNOWN + else -> + throw IncreaseInvalidDataException("Unknown ProcessingCategory: $value") } /** @@ -9730,7 +10457,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Currency = apply { + fun validate(): ProcessingCategory = apply { if (validated) { return@apply } @@ -9760,7 +10487,7 @@ private constructor( return true } - return /* spotless:off */ other is Currency && value == other.value /* spotless:on */ + return /* spotless:off */ other is ProcessingCategory && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -9768,8 +10495,11 @@ 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) : + /** + * 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 { /** @@ -9784,33 +10514,29 @@ private constructor( companion object { - /** Visa */ - @JvmField val VISA = of("visa") + @JvmField val CARD_AUTHORIZATION = of("card_authorization") - @JvmStatic fun of(value: String) = Network(JsonField.of(value)) + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } - /** An enum containing [Network]'s known values. */ + /** An enum containing [Type]'s known values. */ enum class Known { - /** Visa */ - VISA + CARD_AUTHORIZATION } /** - * An enum containing [Network]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [Type]'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 [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 { - /** Visa */ - VISA, + CARD_AUTHORIZATION, /** - * An enum member indicating that [Network] was instantiated with an unknown - * value. + * An enum member indicating that [Type] was instantiated with an unknown value. */ _UNKNOWN, } @@ -9824,7 +10550,7 @@ private constructor( */ fun value(): Value = when (this) { - VISA -> Value.VISA + CARD_AUTHORIZATION -> Value.CARD_AUTHORIZATION else -> Value._UNKNOWN } @@ -9839,8 +10565,8 @@ private constructor( */ fun known(): Known = when (this) { - VISA -> Known.VISA - else -> throw IncreaseInvalidDataException("Unknown Network: $value") + CARD_AUTHORIZATION -> Known.CARD_AUTHORIZATION + else -> throw IncreaseInvalidDataException("Unknown Type: $value") } /** @@ -9859,7 +10585,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Network = apply { + fun validate(): Type = apply { if (validated) { return@apply } @@ -9889,7 +10615,7 @@ private constructor( return true } - return /* spotless:off */ other is Network && value == other.value /* spotless:on */ + return /* spotless:off */ other is Type && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -9897,1556 +10623,1527 @@ private constructor( 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 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_AUTHORIZATION_EXPIRATION = of("card_authorization_expiration") - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } + /** Fields related to verification of cardholder-provided values. */ + class Verification + private constructor( + private val cardVerificationCode: JsonField, + private val cardholderAddress: JsonField, + private val additionalProperties: MutableMap, + ) { - /** An enum containing [Type]'s known values. */ - enum class Known { - CARD_AUTHORIZATION_EXPIRATION - } + @JsonCreator + private constructor( + @JsonProperty("card_verification_code") + @ExcludeMissing + cardVerificationCode: JsonField = JsonMissing.of(), + @JsonProperty("cardholder_address") + @ExcludeMissing + cardholderAddress: JsonField = JsonMissing.of(), + ) : this(cardVerificationCode, cardholderAddress, mutableMapOf()) /** - * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * Fields related to verification of the Card Verification Code, a 3-digit code on + * the back of the card. * - * 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_EXPIRATION, - /** - * An enum member indicating that [Type] was instantiated with an unknown value. - */ - _UNKNOWN, - } + fun cardVerificationCode(): CardVerificationCode = + cardVerificationCode.getRequired("card_verification_code") /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * Cardholder address provided in the authorization request and the address on file + * we verified it against. * - * 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_EXPIRATION -> Value.CARD_AUTHORIZATION_EXPIRATION - else -> Value._UNKNOWN - } + fun cardholderAddress(): CardholderAddress = + cardholderAddress.getRequired("cardholder_address") /** - * 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 [cardVerificationCode]. * - * @throws IncreaseInvalidDataException if this class instance's value is a not a - * known member. + * Unlike [cardVerificationCode], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun known(): Known = - when (this) { - CARD_AUTHORIZATION_EXPIRATION -> Known.CARD_AUTHORIZATION_EXPIRATION - else -> throw IncreaseInvalidDataException("Unknown Type: $value") - } + @JsonProperty("card_verification_code") + @ExcludeMissing + fun _cardVerificationCode(): JsonField = cardVerificationCode /** - * 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. + * Returns the raw JSON value of [cardholderAddress]. * - * @throws IncreaseInvalidDataException if this class instance's value does not have - * the expected primitive type. + * Unlike [cardholderAddress], 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("cardholder_address") + @ExcludeMissing + fun _cardholderAddress(): JsonField = cardholderAddress - private var validated: Boolean = false + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - fun validate(): Type = 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 [Verification]. + * + * The following fields are required: + * ```java + * .cardVerificationCode() + * .cardholderAddress() + * ``` + */ + @JvmStatic fun builder() = Builder() } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** A builder for [Verification]. */ + 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 cardVerificationCode: JsonField? = null + private var cardholderAddress: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + @JvmSynthetic + internal fun from(verification: Verification) = apply { + cardVerificationCode = verification.cardVerificationCode + cardholderAddress = verification.cardholderAddress + additionalProperties = verification.additionalProperties.toMutableMap() } - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() + /** + * Fields related to verification of the Card Verification Code, a 3-digit code + * on the back of the card. + */ + fun cardVerificationCode(cardVerificationCode: CardVerificationCode) = + cardVerificationCode(JsonField.of(cardVerificationCode)) - override fun toString() = value.toString() - } + /** + * Sets [Builder.cardVerificationCode] 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. + */ + fun cardVerificationCode( + cardVerificationCode: JsonField + ) = apply { this.cardVerificationCode = cardVerificationCode } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Cardholder address provided in the authorization request and the address on + * file we verified it against. + */ + fun cardholderAddress(cardholderAddress: CardholderAddress) = + cardholderAddress(JsonField.of(cardholderAddress)) - return /* spotless:off */ other is CardAuthorizationExpiration && id == other.id && cardAuthorizationId == other.cardAuthorizationId && currency == other.currency && expiredAmount == other.expiredAmount && network == other.network && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * Sets [Builder.cardholderAddress] 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. + */ + fun cardholderAddress(cardholderAddress: JsonField) = apply { + this.cardholderAddress = cardholderAddress + } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, cardAuthorizationId, currency, expiredAmount, network, type, additionalProperties) } - /* spotless:on */ + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - override fun hashCode(): Int = hashCode + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - override fun toString() = - "CardAuthorizationExpiration{id=$id, cardAuthorizationId=$cardAuthorizationId, currency=$currency, expiredAmount=$expiredAmount, network=$network, type=$type, additionalProperties=$additionalProperties}" - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** - * A Card Decline object. This field will be present in the JSON response if and only if - * `category` is equal to `card_decline`. - */ - class CardDecline - private constructor( - private val id: JsonField, - private val actioner: JsonField, - private val amount: JsonField, - private val cardPaymentId: JsonField, - private val currency: JsonField, - private val declinedTransactionId: JsonField, - private val digitalWalletTokenId: JsonField, - private val direction: 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 presentmentAmount: JsonField, - private val presentmentCurrency: JsonField, - private val processingCategory: JsonField, - private val realTimeDecisionId: JsonField, - private val realTimeDecisionReason: JsonField, - private val reason: JsonField, - private val terminalId: JsonField, - private val verification: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("actioner") - @ExcludeMissing - actioner: JsonField = JsonMissing.of(), - @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - @JsonProperty("card_payment_id") - @ExcludeMissing - cardPaymentId: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - currency: JsonField = JsonMissing.of(), - @JsonProperty("declined_transaction_id") - @ExcludeMissing - declinedTransactionId: JsonField = JsonMissing.of(), - @JsonProperty("digital_wallet_token_id") - @ExcludeMissing - digitalWalletTokenId: JsonField = JsonMissing.of(), - @JsonProperty("direction") - @ExcludeMissing - direction: 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("presentment_amount") - @ExcludeMissing - presentmentAmount: JsonField = JsonMissing.of(), - @JsonProperty("presentment_currency") - @ExcludeMissing - presentmentCurrency: JsonField = JsonMissing.of(), - @JsonProperty("processing_category") - @ExcludeMissing - processingCategory: JsonField = JsonMissing.of(), - @JsonProperty("real_time_decision_id") - @ExcludeMissing - realTimeDecisionId: JsonField = JsonMissing.of(), - @JsonProperty("real_time_decision_reason") - @ExcludeMissing - realTimeDecisionReason: JsonField = JsonMissing.of(), - @JsonProperty("reason") - @ExcludeMissing - reason: JsonField = JsonMissing.of(), - @JsonProperty("terminal_id") - @ExcludeMissing - terminalId: JsonField = JsonMissing.of(), - @JsonProperty("verification") - @ExcludeMissing - verification: JsonField = JsonMissing.of(), - ) : this( - id, - actioner, - amount, - cardPaymentId, - currency, - declinedTransactionId, - digitalWalletTokenId, - direction, - merchantAcceptorId, - merchantCategoryCode, - merchantCity, - merchantCountry, - merchantDescriptor, - merchantPostalCode, - merchantState, - networkDetails, - networkIdentifiers, - networkRiskScore, - physicalCardId, - presentmentAmount, - presentmentCurrency, - processingCategory, - realTimeDecisionId, - realTimeDecisionReason, - reason, - terminalId, - verification, - mutableMapOf(), - ) + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * The Card Decline 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 removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * Whether this authorization was approved by Increase, the card network through - * stand-in processing, or the user through a real-time decision. - * - * @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 actioner(): Actioner = actioner.getRequired("actioner") + /** + * 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() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Verification = + Verification( + checkRequired("cardVerificationCode", cardVerificationCode), + checkRequired("cardholderAddress", cardholderAddress), + additionalProperties.toMutableMap(), + ) + } - /** - * The declined amount in the minor unit of the destination account 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") + private var validated: Boolean = 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") + fun validate(): Verification = apply { + if (validated) { + return@apply + } - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the destination - * account 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") + cardVerificationCode().validate() + cardholderAddress().validate() + validated = true + } - /** - * The identifier of the declined transaction created for 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 declinedTransactionId(): String = - declinedTransactionId.getRequired("declined_transaction_id") + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * 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") + /** + * 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) - /** - * The direction describes the direction the funds will move, either from the cardholder - * to the merchant or from the merchant to the cardholder. - * - * @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 direction(): Direction = direction.getRequired("direction") + /** + * Fields related to verification of the Card Verification Code, a 3-digit code on + * the back of the card. + */ + class CardVerificationCode + private constructor( + private val result: JsonField, + private val additionalProperties: MutableMap, + ) { - /** - * 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") + @JsonCreator + private constructor( + @JsonProperty("result") + @ExcludeMissing + result: JsonField = JsonMissing.of() + ) : this(result, mutableMapOf()) - /** - * 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 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") - /** - * 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") + /** + * 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 - /** - * 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") + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - /** - * 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") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** - * 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") + fun toBuilder() = Builder().from(this) - /** - * 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") + companion object { - /** - * 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") + /** + * Returns a mutable builder for constructing an instance of + * [CardVerificationCode]. + * + * The following fields are required: + * ```java + * .result() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - /** - * 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") + /** A builder for [CardVerificationCode]. */ + class Builder internal constructor() { - /** - * 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. - * - * @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") + private var result: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() - /** - * 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") + @JvmSynthetic + internal fun from(cardVerificationCode: CardVerificationCode) = apply { + result = cardVerificationCode.result + additionalProperties = + cardVerificationCode.additionalProperties.toMutableMap() + } - /** - * The declined 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") + /** The result of verifying the Card Verification Code. */ + fun result(result: Result) = result(JsonField.of(result)) - /** - * 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") + /** + * 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 processing category describes the intent behind the authorization, such as - * whether it was used for bill payments or an automatic fuel dispenser. - * - * @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 processingCategory(): ProcessingCategory = - processingCategory.getRequired("processing_category") + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * 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") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * This is present if a specific decline reason was given in the real-time decision. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun realTimeDecisionReason(): Optional = - realTimeDecisionReason.getOptional("real_time_decision_reason") + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } - /** - * Why the transaction was declined. - * - * @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 reason(): Reason = reason.getRequired("reason") + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * 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 removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * 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 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(), + ) + } - /** - * 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 var validated: Boolean = false - /** - * Returns the raw JSON value of [actioner]. - * - * Unlike [actioner], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("actioner") - @ExcludeMissing - fun _actioner(): JsonField = actioner + fun validate(): CardVerificationCode = apply { + if (validated) { + return@apply + } - /** - * 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 + result().validate() + validated = 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 + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * 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 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) - /** - * Returns the raw JSON value of [declinedTransactionId]. - * - * Unlike [declinedTransactionId], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("declined_transaction_id") - @ExcludeMissing - fun _declinedTransactionId(): JsonField = declinedTransactionId + /** The result of verifying the Card Verification Code. */ + class Result + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** - * 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 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 [direction]. - * - * Unlike [direction], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("direction") - @ExcludeMissing - fun _direction(): JsonField = direction + companion object { - /** - * 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 + /** + * No card verification code was provided in the authorization request. + */ + @JvmField val NOT_CHECKED = of("not_checked") - /** - * 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 + /** The card verification code matched the one on file. */ + @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 + /** The card verification code did not match the one on file. */ + @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 + @JvmStatic fun of(value: String) = Result(JsonField.of(value)) + } - /** - * 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 + /** 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, + } - /** - * 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, 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 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 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 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 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 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 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 [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 + private var validated: Boolean = false - /** - * 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 + fun validate(): Result = apply { + if (validated) { + return@apply + } - /** - * 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 + known() + validated = true + } - /** - * 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 + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * Returns the raw JSON value of [processingCategory]. - * - * Unlike [processingCategory], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("processing_category") - @ExcludeMissing - fun _processingCategory(): JsonField = processingCategory + /** + * 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 [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 + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Returns the raw JSON value of [realTimeDecisionReason]. - * - * Unlike [realTimeDecisionReason], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("real_time_decision_reason") - @ExcludeMissing - fun _realTimeDecisionReason(): JsonField = - realTimeDecisionReason + return /* spotless:off */ other is Result && value == other.value /* spotless:on */ + } - /** - * Returns the raw JSON value of [reason]. - * - * Unlike [reason], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason + override fun hashCode() = value.hashCode() - /** - * 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 + override fun toString() = value.toString() + } - /** - * 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 + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + return /* spotless:off */ other is CardVerificationCode && result == other.result && additionalProperties == other.additionalProperties /* spotless:on */ + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(result, additionalProperties) } + /* spotless:on */ - fun toBuilder() = Builder().from(this) + override fun hashCode(): Int = hashCode - companion object { + override fun toString() = + "CardVerificationCode{result=$result, additionalProperties=$additionalProperties}" + } /** - * Returns a mutable builder for constructing an instance of [CardDecline]. - * - * The following fields are required: - * ```java - * .id() - * .actioner() - * .amount() - * .cardPaymentId() - * .currency() - * .declinedTransactionId() - * .digitalWalletTokenId() - * .direction() - * .merchantAcceptorId() - * .merchantCategoryCode() - * .merchantCity() - * .merchantCountry() - * .merchantDescriptor() - * .merchantPostalCode() - * .merchantState() - * .networkDetails() - * .networkIdentifiers() - * .networkRiskScore() - * .physicalCardId() - * .presentmentAmount() - * .presentmentCurrency() - * .processingCategory() - * .realTimeDecisionId() - * .realTimeDecisionReason() - * .reason() - * .terminalId() - * .verification() - * ``` + * Cardholder address provided in the authorization request and the address on file + * we verified it against. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CardDecline]. */ - class Builder internal constructor() { + class CardholderAddress + 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, + ) { - private var id: JsonField? = null - private var actioner: JsonField? = null - private var amount: JsonField? = null - private var cardPaymentId: JsonField? = null - private var currency: JsonField? = null - private var declinedTransactionId: JsonField? = null - private var digitalWalletTokenId: JsonField? = null - private var direction: 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 presentmentAmount: JsonField? = null - private var presentmentCurrency: JsonField? = null - private var processingCategory: JsonField? = null - private var realTimeDecisionId: JsonField? = null - private var realTimeDecisionReason: JsonField? = null - private var reason: JsonField? = null - private var terminalId: JsonField? = null - private var verification: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + @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(), + ) - @JvmSynthetic - internal fun from(cardDecline: CardDecline) = apply { - id = cardDecline.id - actioner = cardDecline.actioner - amount = cardDecline.amount - cardPaymentId = cardDecline.cardPaymentId - currency = cardDecline.currency - declinedTransactionId = cardDecline.declinedTransactionId - digitalWalletTokenId = cardDecline.digitalWalletTokenId - direction = cardDecline.direction - merchantAcceptorId = cardDecline.merchantAcceptorId - merchantCategoryCode = cardDecline.merchantCategoryCode - merchantCity = cardDecline.merchantCity - merchantCountry = cardDecline.merchantCountry - merchantDescriptor = cardDecline.merchantDescriptor - merchantPostalCode = cardDecline.merchantPostalCode - merchantState = cardDecline.merchantState - networkDetails = cardDecline.networkDetails - networkIdentifiers = cardDecline.networkIdentifiers - networkRiskScore = cardDecline.networkRiskScore - physicalCardId = cardDecline.physicalCardId - presentmentAmount = cardDecline.presentmentAmount - presentmentCurrency = cardDecline.presentmentCurrency - processingCategory = cardDecline.processingCategory - realTimeDecisionId = cardDecline.realTimeDecisionId - realTimeDecisionReason = cardDecline.realTimeDecisionReason - reason = cardDecline.reason - terminalId = cardDecline.terminalId - verification = cardDecline.verification - additionalProperties = cardDecline.additionalProperties.toMutableMap() - } + /** + * 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 Card Decline identifier. */ - fun id(id: String) = id(JsonField.of(id)) + /** + * 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") - /** - * 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 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") - /** - * Whether this authorization was approved by Increase, the card network through - * stand-in processing, or the user through a real-time decision. - */ - fun actioner(actioner: Actioner) = actioner(JsonField.of(actioner)) + /** + * 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") - /** - * Sets [Builder.actioner] to an arbitrary JSON value. - * - * You should usually call [Builder.actioner] with a well-typed [Actioner] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun actioner(actioner: JsonField) = apply { this.actioner = actioner } + /** + * 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") - /** - * The declined amount in the minor unit of the destination account currency. For - * dollars, for example, this is cents. - */ - fun amount(amount: Long) = amount(JsonField.of(amount)) + /** + * 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 - /** - * 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 } + /** + * 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 - /** The ID of the Card Payment this transaction belongs to. */ - fun cardPaymentId(cardPaymentId: String) = - cardPaymentId(JsonField.of(cardPaymentId)) + /** + * 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 - /** - * 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 - } + /** + * 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 - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the destination - * account currency. - */ - fun currency(currency: Currency) = currency(JsonField.of(currency)) + /** + * 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 - /** - * 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 } + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - /** The identifier of the declined transaction created for this Card Decline. */ - fun declinedTransactionId(declinedTransactionId: String) = - declinedTransactionId(JsonField.of(declinedTransactionId)) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** - * Sets [Builder.declinedTransactionId] to an arbitrary JSON value. - * - * You should usually call [Builder.declinedTransactionId] with a well-typed - * [String] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun declinedTransactionId(declinedTransactionId: JsonField) = apply { - this.declinedTransactionId = declinedTransactionId - } + fun toBuilder() = Builder().from(this) - /** - * 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)) + companion object { - /** - * Alias for calling [Builder.digitalWalletTokenId] with - * `digitalWalletTokenId.orElse(null)`. - */ - fun digitalWalletTokenId(digitalWalletTokenId: Optional) = - digitalWalletTokenId(digitalWalletTokenId.getOrNull()) + /** + * 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() + } - /** - * 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 - } + /** A builder for [CardholderAddress]. */ + class Builder internal constructor() { - /** - * The direction describes the direction the funds will move, either from the - * cardholder to the merchant or from the merchant to the cardholder. - */ - fun direction(direction: Direction) = direction(JsonField.of(direction)) + 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() - /** - * Sets [Builder.direction] to an arbitrary JSON value. - * - * You should usually call [Builder.direction] with a well-typed [Direction] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun direction(direction: JsonField) = apply { - this.direction = direction - } + @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() + } - /** - * The merchant identifier (commonly abbreviated as MID) of the merchant the card is - * transacting with. - */ - fun merchantAcceptorId(merchantAcceptorId: String) = - merchantAcceptorId(JsonField.of(merchantAcceptorId)) + /** Line 1 of the address on file for the cardholder. */ + fun actualLine1(actualLine1: String?) = + actualLine1(JsonField.ofNullable(actualLine1)) - /** - * 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.actualLine1] with `actualLine1.orElse(null)`. + */ + fun actualLine1(actualLine1: Optional) = + actualLine1(actualLine1.getOrNull()) - /** - * 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.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 + } - /** - * 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 postal code of the address on file for the cardholder. */ + fun actualPostalCode(actualPostalCode: String?) = + actualPostalCode(JsonField.ofNullable(actualPostalCode)) - /** The city the merchant resides in. */ - fun merchantCity(merchantCity: String?) = - merchantCity(JsonField.ofNullable(merchantCity)) + /** + * Alias for calling [Builder.actualPostalCode] with + * `actualPostalCode.orElse(null)`. + */ + fun actualPostalCode(actualPostalCode: Optional) = + actualPostalCode(actualPostalCode.getOrNull()) - /** Alias for calling [Builder.merchantCity] with `merchantCity.orElse(null)`. */ - fun merchantCity(merchantCity: Optional) = - merchantCity(merchantCity.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 + } - /** - * 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 cardholder address line 1 provided for verification in the + * authorization request. + */ + fun providedLine1(providedLine1: String?) = + providedLine1(JsonField.ofNullable(providedLine1)) - /** The country the merchant resides in. */ - fun merchantCountry(merchantCountry: String) = - merchantCountry(JsonField.of(merchantCountry)) + /** + * Alias for calling [Builder.providedLine1] with + * `providedLine1.orElse(null)`. + */ + fun providedLine1(providedLine1: Optional) = + providedLine1(providedLine1.getOrNull()) - /** - * 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 - } + /** + * 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 merchant descriptor of the merchant the card is transacting with. */ - fun merchantDescriptor(merchantDescriptor: String) = - merchantDescriptor(JsonField.of(merchantDescriptor)) + /** + * The postal code provided for verification in the authorization request. + */ + fun providedPostalCode(providedPostalCode: String?) = + providedPostalCode(JsonField.ofNullable(providedPostalCode)) - /** - * 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 - } + /** + * Alias for calling [Builder.providedPostalCode] with + * `providedPostalCode.orElse(null)`. + */ + fun providedPostalCode(providedPostalCode: Optional) = + providedPostalCode(providedPostalCode.getOrNull()) - /** - * 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)) + /** + * 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 + } - /** - * Alias for calling [Builder.merchantPostalCode] with - * `merchantPostalCode.orElse(null)`. - */ - fun merchantPostalCode(merchantPostalCode: Optional) = - merchantPostalCode(merchantPostalCode.getOrNull()) + /** The address verification result returned to the card network. */ + fun result(result: Result) = result(JsonField.of(result)) - /** - * 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 - } + /** + * 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 state the merchant resides in. */ - fun merchantState(merchantState: String?) = - merchantState(JsonField.ofNullable(merchantState)) + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** Alias for calling [Builder.merchantState] with `merchantState.orElse(null)`. */ - fun merchantState(merchantState: Optional) = - merchantState(merchantState.getOrNull()) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * 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 putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } - /** Fields specific to the `network`. */ - fun networkDetails(networkDetails: NetworkDetails) = - networkDetails(JsonField.of(networkDetails)) + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * 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 - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** Network-specific identifiers for a specific request or transaction. */ - fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) = - networkIdentifiers(JsonField.of(networkIdentifiers)) + /** + * 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(), + ) + } - /** - * 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 - } + private var validated: Boolean = false - /** - * 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. - */ - fun networkRiskScore(networkRiskScore: Long?) = - networkRiskScore(JsonField.ofNullable(networkRiskScore)) + fun validate(): CardholderAddress = apply { + if (validated) { + return@apply + } - /** - * Alias for [Builder.networkRiskScore]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun networkRiskScore(networkRiskScore: Long) = - networkRiskScore(networkRiskScore as Long?) + actualLine1() + actualPostalCode() + providedLine1() + providedPostalCode() + result().validate() + validated = true + } - /** - * Alias for calling [Builder.networkRiskScore] with - * `networkRiskScore.orElse(null)`. - */ - fun networkRiskScore(networkRiskScore: Optional) = - networkRiskScore(networkRiskScore.getOrNull()) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * 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 - } + /** + * 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) - /** - * 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)) + /** The address verification result returned to the card network. */ + class Result + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** - * Alias for calling [Builder.physicalCardId] with `physicalCardId.orElse(null)`. - */ - fun physicalCardId(physicalCardId: Optional) = - physicalCardId(physicalCardId.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.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 - } + companion object { - /** - * The declined amount in the minor unit of the transaction's presentment currency. - */ - fun presentmentAmount(presentmentAmount: Long) = - presentmentAmount(JsonField.of(presentmentAmount)) + /** No address was provided in the authorization request. */ + @JvmField val NOT_CHECKED = of("not_checked") - /** - * 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 - } + /** Postal code matches, but the street address was not verified. */ + @JvmField + val POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED = + of("postal_code_match_address_not_checked") - /** - * 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)) + /** Postal code matches, but the street address does not match. */ + @JvmField + val POSTAL_CODE_MATCH_ADDRESS_NO_MATCH = + of("postal_code_match_address_no_match") - /** - * 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 - } + /** Postal code does not match, but the street address matches. */ + @JvmField + val POSTAL_CODE_NO_MATCH_ADDRESS_MATCH = + of("postal_code_no_match_address_match") - /** - * The processing category describes the intent behind the authorization, such as - * whether it was used for bill payments or an automatic fuel dispenser. - */ - fun processingCategory(processingCategory: ProcessingCategory) = - processingCategory(JsonField.of(processingCategory)) + /** Postal code and street address match. */ + @JvmField val MATCH = of("match") - /** - * Sets [Builder.processingCategory] to an arbitrary JSON value. - * - * You should usually call [Builder.processingCategory] with a well-typed - * [ProcessingCategory] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun processingCategory(processingCategory: JsonField) = apply { - this.processingCategory = processingCategory - } + /** Postal code and street address do not match. */ + @JvmField val NO_MATCH = of("no_match") - /** - * The identifier of the Real-Time Decision sent to approve or decline this - * transaction. - */ - fun realTimeDecisionId(realTimeDecisionId: String?) = - realTimeDecisionId(JsonField.ofNullable(realTimeDecisionId)) + @JvmStatic fun of(value: String) = Result(JsonField.of(value)) + } - /** - * Alias for calling [Builder.realTimeDecisionId] with - * `realTimeDecisionId.orElse(null)`. - */ - fun realTimeDecisionId(realTimeDecisionId: Optional) = - realTimeDecisionId(realTimeDecisionId.getOrNull()) + /** An enum containing [Result]'s known values. */ + enum class Known { + /** No address was provided in the authorization request. */ + NOT_CHECKED, + /** Postal code matches, but the street address was not verified. */ + POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED, + /** Postal code matches, but the street address does not match. */ + POSTAL_CODE_MATCH_ADDRESS_NO_MATCH, + /** Postal code does not match, but the street address matches. */ + POSTAL_CODE_NO_MATCH_ADDRESS_MATCH, + /** Postal code and street address match. */ + MATCH, + /** Postal code and street address do not match. */ + NO_MATCH, + } - /** - * 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 - } + /** + * 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 was provided in the authorization request. */ + NOT_CHECKED, + /** Postal code matches, but the street address was not verified. */ + POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED, + /** Postal code matches, but the street address does not match. */ + POSTAL_CODE_MATCH_ADDRESS_NO_MATCH, + /** Postal code does not match, but the street address matches. */ + POSTAL_CODE_NO_MATCH_ADDRESS_MATCH, + /** Postal code and street address match. */ + MATCH, + /** Postal code and street address do not match. */ + NO_MATCH, + /** + * An enum member indicating that [Result] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** - * This is present if a specific decline reason was given in the real-time decision. - */ - fun realTimeDecisionReason(realTimeDecisionReason: RealTimeDecisionReason?) = - realTimeDecisionReason(JsonField.ofNullable(realTimeDecisionReason)) + /** + * 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_NOT_CHECKED -> + Value.POSTAL_CODE_MATCH_ADDRESS_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 + else -> Value._UNKNOWN + } - /** - * Alias for calling [Builder.realTimeDecisionReason] with - * `realTimeDecisionReason.orElse(null)`. - */ - fun realTimeDecisionReason( - realTimeDecisionReason: Optional - ) = realTimeDecisionReason(realTimeDecisionReason.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) { + NOT_CHECKED -> Known.NOT_CHECKED + POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED -> + Known.POSTAL_CODE_MATCH_ADDRESS_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 + else -> throw IncreaseInvalidDataException("Unknown Result: $value") + } - /** - * Sets [Builder.realTimeDecisionReason] to an arbitrary JSON value. - * - * You should usually call [Builder.realTimeDecisionReason] with a well-typed - * [RealTimeDecisionReason] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun realTimeDecisionReason( - realTimeDecisionReason: JsonField - ) = apply { this.realTimeDecisionReason = realTimeDecisionReason } + /** + * 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") + } - /** Why the transaction was declined. */ - fun reason(reason: Reason) = reason(JsonField.of(reason)) + private var validated: Boolean = false - /** - * Sets [Builder.reason] to an arbitrary JSON value. - * - * You should usually call [Builder.reason] with a well-typed [Reason] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun reason(reason: JsonField) = apply { this.reason = reason } + fun validate(): Result = apply { + if (validated) { + return@apply + } - /** - * The terminal identifier (commonly abbreviated as TID) of the terminal the card is - * transacting with. - */ - fun terminalId(terminalId: String?) = terminalId(JsonField.ofNullable(terminalId)) + known() + validated = true + } - /** Alias for calling [Builder.terminalId] with `terminalId.orElse(null)`. */ - fun terminalId(terminalId: Optional) = terminalId(terminalId.getOrNull()) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * 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 - } + /** + * 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 related to verification of cardholder-provided values. */ - fun verification(verification: Verification) = - verification(JsonField.of(verification)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * 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 - } + return /* spotless:off */ other is Result && value == other.value /* spotless:on */ + } - 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() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is CardholderAddress && actualLine1 == other.actualLine1 && actualPostalCode == other.actualPostalCode && providedLine1 == other.providedLine1 && providedPostalCode == other.providedPostalCode && result == other.result && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(actualLine1, actualPostalCode, providedLine1, providedPostalCode, result, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "CardholderAddress{actualLine1=$actualLine1, actualPostalCode=$actualPostalCode, providedLine1=$providedLine1, providedPostalCode=$providedPostalCode, result=$result, additionalProperties=$additionalProperties}" } - 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 /* spotless:off */ other is Verification && cardVerificationCode == other.cardVerificationCode && cardholderAddress == other.cardholderAddress && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(cardVerificationCode, cardholderAddress, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Verification{cardVerificationCode=$cardVerificationCode, cardholderAddress=$cardholderAddress, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - /** - * Returns an immutable instance of [CardDecline]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .actioner() - * .amount() - * .cardPaymentId() - * .currency() - * .declinedTransactionId() - * .digitalWalletTokenId() - * .direction() - * .merchantAcceptorId() - * .merchantCategoryCode() - * .merchantCity() - * .merchantCountry() - * .merchantDescriptor() - * .merchantPostalCode() - * .merchantState() - * .networkDetails() - * .networkIdentifiers() - * .networkRiskScore() - * .physicalCardId() - * .presentmentAmount() - * .presentmentCurrency() - * .processingCategory() - * .realTimeDecisionId() - * .realTimeDecisionReason() - * .reason() - * .terminalId() - * .verification() + return /* spotless:off */ 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 /* spotless:on */ + } + + /* spotless:off */ + 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) } + /* spotless:on */ + + 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}" + } + + /** + * 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 + 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, + ) { + + @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(), + ) + + /** + * 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") + + /** + * 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") + + /** + * 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") + + /** + * 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") + + /** + * 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 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") + + /** + * 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 + + /** + * 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 + + /** + * 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 + + /** + * 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 + * [CardAuthorizationExpiration]. + * + * The following fields are required: + * ```java + * .id() + * .cardAuthorizationId() + * .currency() + * .expiredAmount() + * .network() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [CardAuthorizationExpiration]. */ + class Builder internal constructor() { + + 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() + + @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() + } + + /** The Card Authorization Expiration 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 identifier for the Card Authorization this reverses. */ + fun cardAuthorizationId(cardAuthorizationId: String) = + cardAuthorizationId(JsonField.of(cardAuthorizationId)) + + /** + * 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 + } + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the reversal'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 } + + /** + * 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)) + + /** + * 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 + } + + /** The card network used to process this card authorization. */ + fun network(network: Network) = network(JsonField.of(network)) + + /** + * 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 } + + /** + * 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)) + + /** + * 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 } + + 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 [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(): CardDecline = - CardDecline( + fun build(): CardAuthorizationExpiration = + CardAuthorizationExpiration( checkRequired("id", id), - checkRequired("actioner", actioner), - checkRequired("amount", amount), - checkRequired("cardPaymentId", cardPaymentId), + checkRequired("cardAuthorizationId", cardAuthorizationId), checkRequired("currency", currency), - checkRequired("declinedTransactionId", declinedTransactionId), - checkRequired("digitalWalletTokenId", digitalWalletTokenId), - checkRequired("direction", direction), - 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("presentmentAmount", presentmentAmount), - checkRequired("presentmentCurrency", presentmentCurrency), - checkRequired("processingCategory", processingCategory), - checkRequired("realTimeDecisionId", realTimeDecisionId), - checkRequired("realTimeDecisionReason", realTimeDecisionReason), - checkRequired("reason", reason), - checkRequired("terminalId", terminalId), - checkRequired("verification", verification), + checkRequired("expiredAmount", expiredAmount), + checkRequired("network", network), + checkRequired("type", type), additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): CardDecline = apply { + fun validate(): CardAuthorizationExpiration = apply { if (validated) { return@apply } id() - actioner().validate() - amount() - cardPaymentId() + cardAuthorizationId() currency().validate() - declinedTransactionId() - digitalWalletTokenId() - direction().validate() - merchantAcceptorId() - merchantCategoryCode() - merchantCity() - merchantCountry() - merchantDescriptor() - merchantPostalCode() - merchantState() - networkDetails().validate() - networkIdentifiers().validate() - networkRiskScore() - physicalCardId() - presentmentAmount() - presentmentCurrency() - processingCategory().validate() - realTimeDecisionId() - realTimeDecisionReason().ifPresent { it.validate() } - reason().validate() - terminalId() - verification().validate() + expiredAmount() + network().validate() + type().validate() validated = true } @@ -11467,38 +12164,17 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (actioner.asKnown().getOrNull()?.validity() ?: 0) + - (if (amount.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 (declinedTransactionId.asKnown().isPresent) 1 else 0) + - (if (digitalWalletTokenId.asKnown().isPresent) 1 else 0) + - (direction.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 (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 (presentmentAmount.asKnown().isPresent) 1 else 0) + - (if (presentmentCurrency.asKnown().isPresent) 1 else 0) + - (processingCategory.asKnown().getOrNull()?.validity() ?: 0) + - (if (realTimeDecisionId.asKnown().isPresent) 1 else 0) + - (realTimeDecisionReason.asKnown().getOrNull()?.validity() ?: 0) + - (reason.asKnown().getOrNull()?.validity() ?: 0) + - (if (terminalId.asKnown().isPresent) 1 else 0) + - (verification.asKnown().getOrNull()?.validity() ?: 0) + (if (expiredAmount.asKnown().isPresent) 1 else 0) + + (network.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) /** - * Whether this authorization was approved by Increase, the card network through - * stand-in processing, or the user through a real-time decision. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the reversal's + * currency. */ - class Actioner @JsonCreator private constructor(private val value: JsonField) : + class Currency @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -11513,63 +12189,87 @@ private constructor( companion object { - /** This object was actioned by the user through a real-time decision. */ - @JvmField val USER = of("user") + /** Canadian Dollar (CAD) */ + @JvmField val CAD = of("CAD") - /** This object was actioned by Increase without user intervention. */ - @JvmField val INCREASE = of("increase") + /** Swiss Franc (CHF) */ + @JvmField val CHF = of("CHF") - /** This object was actioned by the network, through stand-in processing. */ - @JvmField val NETWORK = of("network") + /** Euro (EUR) */ + @JvmField val EUR = of("EUR") - @JvmStatic fun of(value: String) = Actioner(JsonField.of(value)) + /** British Pound (GBP) */ + @JvmField val GBP = of("GBP") + + /** Japanese Yen (JPY) */ + @JvmField val JPY = of("JPY") + + /** US Dollar (USD) */ + @JvmField val USD = of("USD") + + @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) } - /** An enum containing [Actioner]'s known values. */ + /** An enum containing [Currency]'s known values. */ enum class Known { - /** This object was actioned by the user through a real-time decision. */ - USER, - /** This object was actioned by Increase without user intervention. */ - INCREASE, - /** This object was actioned by the network, through stand-in processing. */ - NETWORK, + /** Canadian Dollar (CAD) */ + CAD, + /** Swiss Franc (CHF) */ + CHF, + /** Euro (EUR) */ + EUR, + /** British Pound (GBP) */ + GBP, + /** Japanese Yen (JPY) */ + JPY, + /** US Dollar (USD) */ + USD, } /** - * An enum containing [Actioner]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [Actioner] can contain an unknown value in a couple of cases: + * 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 { - /** This object was actioned by the user through a real-time decision. */ - USER, - /** This object was actioned by Increase without user intervention. */ - INCREASE, - /** This object was actioned by the network, through stand-in processing. */ - NETWORK, - /** - * An enum member indicating that [Actioner] 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. - * + /** Canadian Dollar (CAD) */ + CAD, + /** Swiss Franc (CHF) */ + CHF, + /** Euro (EUR) */ + EUR, + /** British Pound (GBP) */ + GBP, + /** Japanese Yen (JPY) */ + JPY, + /** 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) { - USER -> Value.USER - INCREASE -> Value.INCREASE - NETWORK -> Value.NETWORK + CAD -> Value.CAD + CHF -> Value.CHF + EUR -> Value.EUR + GBP -> Value.GBP + JPY -> Value.JPY + USD -> Value.USD else -> Value._UNKNOWN } @@ -11584,10 +12284,13 @@ private constructor( */ fun known(): Known = when (this) { - USER -> Known.USER - INCREASE -> Known.INCREASE - NETWORK -> Known.NETWORK - else -> throw IncreaseInvalidDataException("Unknown Actioner: $value") + CAD -> Known.CAD + CHF -> Known.CHF + EUR -> Known.EUR + GBP -> Known.GBP + JPY -> Known.JPY + USD -> Known.USD + else -> throw IncreaseInvalidDataException("Unknown Currency: $value") } /** @@ -11606,7 +12309,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Actioner = apply { + fun validate(): Currency = apply { if (validated) { return@apply } @@ -11636,7 +12339,7 @@ private constructor( return true } - return /* spotless:off */ other is Actioner && value == other.value /* spotless:on */ + return /* spotless:off */ other is Currency && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -11644,11 +12347,8 @@ private constructor( override fun toString() = value.toString() } - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the destination - * account currency. - */ - class Currency @JsonCreator private constructor(private val value: JsonField) : + /** The card network used to process this card authorization. */ + class Network @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -11663,67 +12363,32 @@ private constructor( companion object { - /** Canadian Dollar (CAD) */ - @JvmField val CAD = of("CAD") - - /** Swiss Franc (CHF) */ - @JvmField val CHF = of("CHF") - - /** Euro (EUR) */ - @JvmField val EUR = of("EUR") - - /** British Pound (GBP) */ - @JvmField val GBP = of("GBP") - - /** Japanese Yen (JPY) */ - @JvmField val JPY = of("JPY") - - /** US Dollar (USD) */ - @JvmField val USD = of("USD") + /** Visa */ + @JvmField val VISA = of("visa") - @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) + @JvmStatic fun of(value: String) = Network(JsonField.of(value)) } - /** An enum containing [Currency]'s known values. */ + /** An enum containing [Network]'s known values. */ enum class Known { - /** Canadian Dollar (CAD) */ - CAD, - /** Swiss Franc (CHF) */ - CHF, - /** Euro (EUR) */ - EUR, - /** British Pound (GBP) */ - GBP, - /** Japanese Yen (JPY) */ - JPY, - /** US Dollar (USD) */ - USD, + /** Visa */ + VISA } /** - * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [Network]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [Currency] can contain an unknown value in a couple of cases: + * 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 { - /** Canadian Dollar (CAD) */ - CAD, - /** Swiss Franc (CHF) */ - CHF, - /** Euro (EUR) */ - EUR, - /** British Pound (GBP) */ - GBP, - /** Japanese Yen (JPY) */ - JPY, - /** US Dollar (USD) */ - USD, + /** Visa */ + VISA, /** - * An enum member indicating that [Currency] was instantiated with an unknown + * An enum member indicating that [Network] was instantiated with an unknown * value. */ _UNKNOWN, @@ -11738,12 +12403,7 @@ private constructor( */ fun value(): Value = when (this) { - CAD -> Value.CAD - CHF -> Value.CHF - EUR -> Value.EUR - GBP -> Value.GBP - JPY -> Value.JPY - USD -> Value.USD + VISA -> Value.VISA else -> Value._UNKNOWN } @@ -11758,13 +12418,8 @@ private constructor( */ fun known(): Known = when (this) { - CAD -> Known.CAD - CHF -> Known.CHF - EUR -> Known.EUR - GBP -> Known.GBP - JPY -> Known.JPY - USD -> Known.USD - else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + VISA -> Known.VISA + else -> throw IncreaseInvalidDataException("Unknown Network: $value") } /** @@ -11783,7 +12438,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Currency = apply { + fun validate(): Network = apply { if (validated) { return@apply } @@ -11813,7 +12468,7 @@ private constructor( return true } - return /* spotless:off */ other is Currency && value == other.value /* spotless:on */ + return /* spotless:off */ other is Network && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -11822,10 +12477,10 @@ private constructor( } /** - * The direction describes the direction the funds will move, either from the cardholder - * to the merchant or from the merchant to the cardholder. + * A constant representing the object's type. For this resource it will always be + * `card_authorization_expiration`. */ - class Direction @JsonCreator private constructor(private val value: JsonField) : + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -11840,49 +12495,30 @@ private constructor( companion object { - /** A regular card authorization where funds are debited from the cardholder. */ - @JvmField val SETTLEMENT = of("settlement") - - /** - * A refund card authorization, sometimes referred to as a credit voucher - * authorization, where funds are credited to the cardholder. - */ - @JvmField val REFUND = of("refund") + @JvmField + val CARD_AUTHORIZATION_EXPIRATION = of("card_authorization_expiration") - @JvmStatic fun of(value: String) = Direction(JsonField.of(value)) + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } - /** An enum containing [Direction]'s known values. */ + /** An enum containing [Type]'s known values. */ enum class Known { - /** A regular card authorization where funds are debited from the cardholder. */ - SETTLEMENT, - /** - * A refund card authorization, sometimes referred to as a credit voucher - * authorization, where funds are credited to the cardholder. - */ - REFUND, + CARD_AUTHORIZATION_EXPIRATION } /** - * An enum containing [Direction]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [Direction] can contain an unknown value in a couple of cases: + * 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 { - /** A regular card authorization where funds are debited from the cardholder. */ - SETTLEMENT, - /** - * A refund card authorization, sometimes referred to as a credit voucher - * authorization, where funds are credited to the cardholder. - */ - REFUND, + CARD_AUTHORIZATION_EXPIRATION, /** - * An enum member indicating that [Direction] was instantiated with an unknown - * value. + * An enum member indicating that [Type] was instantiated with an unknown value. */ _UNKNOWN, } @@ -11896,8 +12532,7 @@ private constructor( */ fun value(): Value = when (this) { - SETTLEMENT -> Value.SETTLEMENT - REFUND -> Value.REFUND + CARD_AUTHORIZATION_EXPIRATION -> Value.CARD_AUTHORIZATION_EXPIRATION else -> Value._UNKNOWN } @@ -11912,9 +12547,8 @@ private constructor( */ fun known(): Known = when (this) { - SETTLEMENT -> Known.SETTLEMENT - REFUND -> Known.REFUND - else -> throw IncreaseInvalidDataException("Unknown Direction: $value") + CARD_AUTHORIZATION_EXPIRATION -> Known.CARD_AUTHORIZATION_EXPIRATION + else -> throw IncreaseInvalidDataException("Unknown Type: $value") } /** @@ -11933,7 +12567,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Direction = apply { + fun validate(): Type = apply { if (validated) { return@apply } @@ -11963,7 +12597,7 @@ private constructor( return true } - return /* spotless:off */ other is Direction && value == other.value /* spotless:on */ + return /* spotless:off */ other is Type && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -11971,1692 +12605,2124 @@ private constructor( override fun toString() = value.toString() } - /** Fields specific to the `network`. */ - class NetworkDetails - private constructor( - private val category: JsonField, - private val visa: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("category") - @ExcludeMissing - category: JsonField = JsonMissing.of(), - @JsonProperty("visa") @ExcludeMissing visa: JsonField = JsonMissing.of(), - ) : this(category, visa, mutableMapOf()) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * The payment 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 category(): Category = category.getRequired("category") + return /* spotless:off */ other is CardAuthorizationExpiration && id == other.id && cardAuthorizationId == other.cardAuthorizationId && currency == other.currency && expiredAmount == other.expiredAmount && network == other.network && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * Fields specific to the `visa` network. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun visa(): Optional = visa.getOptional("visa") + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, cardAuthorizationId, currency, expiredAmount, network, type, additionalProperties) } + /* spotless:on */ - /** - * 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 + override fun hashCode(): Int = hashCode - /** - * Returns the raw JSON value of [visa]. - * - * Unlike [visa], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("visa") @ExcludeMissing fun _visa(): JsonField = visa + override fun toString() = + "CardAuthorizationExpiration{id=$id, cardAuthorizationId=$cardAuthorizationId, currency=$currency, expiredAmount=$expiredAmount, network=$network, type=$type, additionalProperties=$additionalProperties}" + } - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** + * A Card Decline object. This field will be present in the JSON response if and only if + * `category` is equal to `card_decline`. + */ + class CardDecline + private constructor( + private val id: JsonField, + private val actioner: JsonField, + private val additionalAmounts: JsonField, + private val amount: JsonField, + private val cardPaymentId: JsonField, + private val currency: JsonField, + private val declinedTransactionId: JsonField, + private val digitalWalletTokenId: JsonField, + private val direction: 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 presentmentAmount: JsonField, + private val presentmentCurrency: JsonField, + private val processingCategory: JsonField, + private val realTimeDecisionId: JsonField, + private val realTimeDecisionReason: JsonField, + private val reason: JsonField, + private val terminalId: JsonField, + private val verification: JsonField, + private val additionalProperties: MutableMap, + ) { - @JsonAnyGetter + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("actioner") @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) + actioner: JsonField = JsonMissing.of(), + @JsonProperty("additional_amounts") + @ExcludeMissing + additionalAmounts: JsonField = JsonMissing.of(), + @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), + @JsonProperty("card_payment_id") + @ExcludeMissing + cardPaymentId: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("declined_transaction_id") + @ExcludeMissing + declinedTransactionId: JsonField = JsonMissing.of(), + @JsonProperty("digital_wallet_token_id") + @ExcludeMissing + digitalWalletTokenId: JsonField = JsonMissing.of(), + @JsonProperty("direction") + @ExcludeMissing + direction: 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("presentment_amount") + @ExcludeMissing + presentmentAmount: JsonField = JsonMissing.of(), + @JsonProperty("presentment_currency") + @ExcludeMissing + presentmentCurrency: JsonField = JsonMissing.of(), + @JsonProperty("processing_category") + @ExcludeMissing + processingCategory: JsonField = JsonMissing.of(), + @JsonProperty("real_time_decision_id") + @ExcludeMissing + realTimeDecisionId: JsonField = JsonMissing.of(), + @JsonProperty("real_time_decision_reason") + @ExcludeMissing + realTimeDecisionReason: JsonField = JsonMissing.of(), + @JsonProperty("reason") + @ExcludeMissing + reason: JsonField = JsonMissing.of(), + @JsonProperty("terminal_id") + @ExcludeMissing + terminalId: JsonField = JsonMissing.of(), + @JsonProperty("verification") + @ExcludeMissing + verification: JsonField = JsonMissing.of(), + ) : this( + id, + actioner, + additionalAmounts, + amount, + cardPaymentId, + currency, + declinedTransactionId, + digitalWalletTokenId, + direction, + merchantAcceptorId, + merchantCategoryCode, + merchantCity, + merchantCountry, + merchantDescriptor, + merchantPostalCode, + merchantState, + networkDetails, + networkIdentifiers, + networkRiskScore, + physicalCardId, + presentmentAmount, + presentmentCurrency, + processingCategory, + realTimeDecisionId, + realTimeDecisionReason, + reason, + terminalId, + verification, + mutableMapOf(), + ) - companion object { + /** + * The Card Decline 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") - /** - * Returns a mutable builder for constructing an instance of [NetworkDetails]. - * - * The following fields are required: - * ```java - * .category() - * .visa() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + /** + * Whether this authorization was approved by Increase, the card network through + * stand-in processing, or the user through a real-time decision. + * + * @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 actioner(): Actioner = actioner.getRequired("actioner") - /** A builder for [NetworkDetails]. */ - class Builder internal constructor() { + /** + * 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") - private var category: JsonField? = null - private var visa: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** + * The declined amount in the minor unit of the destination account 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") - @JvmSynthetic - internal fun from(networkDetails: NetworkDetails) = apply { - category = networkDetails.category - visa = networkDetails.visa - additionalProperties = networkDetails.additionalProperties.toMutableMap() - } + /** + * 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 payment network used to process this card authorization. */ - fun category(category: Category) = category(JsonField.of(category)) + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the destination + * account 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.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 } + /** + * The identifier of the declined transaction created for 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 declinedTransactionId(): String = + declinedTransactionId.getRequired("declined_transaction_id") - /** Fields specific to the `visa` network. */ - fun visa(visa: Visa?) = visa(JsonField.ofNullable(visa)) + /** + * 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") - /** Alias for calling [Builder.visa] with `visa.orElse(null)`. */ - fun visa(visa: Optional) = visa(visa.getOrNull()) + /** + * The direction describes the direction the funds will move, either from the cardholder + * to the merchant or from the merchant to the cardholder. + * + * @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 direction(): Direction = direction.getRequired("direction") - /** - * Sets [Builder.visa] to an arbitrary JSON value. - * - * You should usually call [Builder.visa] with a well-typed [Visa] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun visa(visa: JsonField) = apply { this.visa = visa } + /** + * 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") - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** + * 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") - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** + * 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") - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + /** + * 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 removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** + * 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") - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** + * 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") - /** - * Returns an immutable instance of [NetworkDetails]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .category() - * .visa() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): NetworkDetails = - NetworkDetails( - checkRequired("category", category), - checkRequired("visa", visa), - additionalProperties.toMutableMap(), - ) - } + /** + * 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 + /** + * 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") - fun validate(): NetworkDetails = apply { - if (validated) { - return@apply - } + /** + * 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") - category().validate() - visa().ifPresent { it.validate() } - validated = true - } + /** + * 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. + * + * @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") - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * 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") - /** - * 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) + - (visa.asKnown().getOrNull()?.validity() ?: 0) + /** + * The declined 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") - /** The payment network used to process this card authorization. */ - class Category - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** + * 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") - /** - * 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 processing category describes the intent behind the authorization, such as + * whether it was used for bill payments or an automatic fuel dispenser. + * + * @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 processingCategory(): ProcessingCategory = + processingCategory.getRequired("processing_category") - companion object { + /** + * 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") - /** Visa */ - @JvmField val VISA = of("visa") + /** + * This is present if a specific decline reason was given in the real-time decision. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun realTimeDecisionReason(): Optional = + realTimeDecisionReason.getOptional("real_time_decision_reason") - @JvmStatic fun of(value: String) = Category(JsonField.of(value)) - } + /** + * Why the transaction was declined. + * + * @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 reason(): Reason = reason.getRequired("reason") - /** An enum containing [Category]'s known values. */ - enum class Known { - /** Visa */ - VISA - } + /** + * 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") - /** - * 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, - /** - * An enum member indicating that [Category] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } + /** + * 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 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 - else -> Value._UNKNOWN - } + /** + * 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 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 - else -> throw IncreaseInvalidDataException("Unknown Category: $value") - } + /** + * Returns the raw JSON value of [actioner]. + * + * Unlike [actioner], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("actioner") + @ExcludeMissing + fun _actioner(): JsonField = actioner - /** - * 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 [additionalAmounts]. + * + * Unlike [additionalAmounts], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("additional_amounts") + @ExcludeMissing + fun _additionalAmounts(): JsonField = additionalAmounts - private var validated: Boolean = 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 - fun validate(): Category = apply { - if (validated) { - return@apply - } + /** + * 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 - known() - validated = true - } + /** + * 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 - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * Returns the raw JSON value of [declinedTransactionId]. + * + * Unlike [declinedTransactionId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("declined_transaction_id") + @ExcludeMissing + fun _declinedTransactionId(): JsonField = declinedTransactionId - /** - * 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 [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 - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Returns the raw JSON value of [direction]. + * + * Unlike [direction], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("direction") + @ExcludeMissing + fun _direction(): JsonField = direction - return /* spotless:off */ other is Category && value == other.value /* spotless:on */ - } + /** + * 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 - override fun hashCode() = value.hashCode() + /** + * 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 - override fun toString() = value.toString() - } + /** + * 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 - /** Fields specific to the `visa` network. */ - class Visa - private constructor( - private val electronicCommerceIndicator: JsonField, - private val pointOfServiceEntryMode: JsonField, - private val standInProcessingReason: JsonField, - private val additionalProperties: MutableMap, - ) { + /** + * 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 - @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(), - ) : this( - electronicCommerceIndicator, - pointOfServiceEntryMode, - standInProcessingReason, - mutableMapOf(), - ) + /** + * 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 - /** - * 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") + /** + * 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 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") + /** + * 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 - /** - * 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 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 [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 [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 [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 [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 [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 [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 - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** + * 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 - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** + * 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 - fun toBuilder() = Builder().from(this) + /** + * Returns the raw JSON value of [processingCategory]. + * + * Unlike [processingCategory], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("processing_category") + @ExcludeMissing + fun _processingCategory(): JsonField = processingCategory - companion object { + /** + * 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 a mutable builder for constructing an instance of [Visa]. - * - * The following fields are required: - * ```java - * .electronicCommerceIndicator() - * .pointOfServiceEntryMode() - * .standInProcessingReason() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + /** + * Returns the raw JSON value of [realTimeDecisionReason]. + * + * Unlike [realTimeDecisionReason], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("real_time_decision_reason") + @ExcludeMissing + fun _realTimeDecisionReason(): JsonField = + realTimeDecisionReason - /** A builder for [Visa]. */ - class Builder internal constructor() { + /** + * Returns the raw JSON value of [reason]. + * + * Unlike [reason], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason - private var electronicCommerceIndicator: - JsonField? = - null - private var pointOfServiceEntryMode: JsonField? = - null - private var standInProcessingReason: JsonField? = - null - private var additionalProperties: MutableMap = - mutableMapOf() + /** + * 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 - @JvmSynthetic - internal fun from(visa: Visa) = apply { - electronicCommerceIndicator = visa.electronicCommerceIndicator - pointOfServiceEntryMode = visa.pointOfServiceEntryMode - standInProcessingReason = visa.standInProcessingReason - additionalProperties = visa.additionalProperties.toMutableMap() - } + /** + * 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 - /** - * 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) - ) + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - /** - * Alias for calling [Builder.electronicCommerceIndicator] with - * `electronicCommerceIndicator.orElse(null)`. - */ - fun electronicCommerceIndicator( - electronicCommerceIndicator: Optional - ) = electronicCommerceIndicator(electronicCommerceIndicator.getOrNull()) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** - * 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 } + fun toBuilder() = Builder().from(this) - /** - * 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()) + /** + * Returns a mutable builder for constructing an instance of [CardDecline]. + * + * The following fields are required: + * ```java + * .id() + * .actioner() + * .additionalAmounts() + * .amount() + * .cardPaymentId() + * .currency() + * .declinedTransactionId() + * .digitalWalletTokenId() + * .direction() + * .merchantAcceptorId() + * .merchantCategoryCode() + * .merchantCity() + * .merchantCountry() + * .merchantDescriptor() + * .merchantPostalCode() + * .merchantState() + * .networkDetails() + * .networkIdentifiers() + * .networkRiskScore() + * .physicalCardId() + * .presentmentAmount() + * .presentmentCurrency() + * .processingCategory() + * .realTimeDecisionId() + * .realTimeDecisionReason() + * .reason() + * .terminalId() + * .verification() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - /** - * 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 } + /** A builder for [CardDecline]. */ + class Builder internal constructor() { - /** - * 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)) + private var id: JsonField? = null + private var actioner: JsonField? = null + private var additionalAmounts: JsonField? = null + private var amount: JsonField? = null + private var cardPaymentId: JsonField? = null + private var currency: JsonField? = null + private var declinedTransactionId: JsonField? = null + private var digitalWalletTokenId: JsonField? = null + private var direction: 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 presentmentAmount: JsonField? = null + private var presentmentCurrency: JsonField? = null + private var processingCategory: JsonField? = null + private var realTimeDecisionId: JsonField? = null + private var realTimeDecisionReason: JsonField? = null + private var reason: JsonField? = null + private var terminalId: JsonField? = null + private var verification: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** - * Alias for calling [Builder.standInProcessingReason] with - * `standInProcessingReason.orElse(null)`. - */ - fun standInProcessingReason( - standInProcessingReason: Optional - ) = standInProcessingReason(standInProcessingReason.getOrNull()) + @JvmSynthetic + internal fun from(cardDecline: CardDecline) = apply { + id = cardDecline.id + actioner = cardDecline.actioner + additionalAmounts = cardDecline.additionalAmounts + amount = cardDecline.amount + cardPaymentId = cardDecline.cardPaymentId + currency = cardDecline.currency + declinedTransactionId = cardDecline.declinedTransactionId + digitalWalletTokenId = cardDecline.digitalWalletTokenId + direction = cardDecline.direction + merchantAcceptorId = cardDecline.merchantAcceptorId + merchantCategoryCode = cardDecline.merchantCategoryCode + merchantCity = cardDecline.merchantCity + merchantCountry = cardDecline.merchantCountry + merchantDescriptor = cardDecline.merchantDescriptor + merchantPostalCode = cardDecline.merchantPostalCode + merchantState = cardDecline.merchantState + networkDetails = cardDecline.networkDetails + networkIdentifiers = cardDecline.networkIdentifiers + networkRiskScore = cardDecline.networkRiskScore + physicalCardId = cardDecline.physicalCardId + presentmentAmount = cardDecline.presentmentAmount + presentmentCurrency = cardDecline.presentmentCurrency + processingCategory = cardDecline.processingCategory + realTimeDecisionId = cardDecline.realTimeDecisionId + realTimeDecisionReason = cardDecline.realTimeDecisionReason + reason = cardDecline.reason + terminalId = cardDecline.terminalId + verification = cardDecline.verification + additionalProperties = cardDecline.additionalProperties.toMutableMap() + } - /** - * 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 Card Decline identifier. */ + fun id(id: String) = id(JsonField.of(id)) - fun additionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.clear() - putAllAdditionalProperties(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 putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** + * Whether this authorization was approved by Increase, the card network through + * stand-in processing, or the user through a real-time decision. + */ + fun actioner(actioner: Actioner) = actioner(JsonField.of(actioner)) - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } + /** + * Sets [Builder.actioner] to an arbitrary JSON value. + * + * You should usually call [Builder.actioner] with a well-typed [Actioner] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun actioner(actioner: JsonField) = apply { this.actioner = actioner } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** + * 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)) - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** + * 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 + } - /** - * 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() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Visa = - Visa( - checkRequired( - "electronicCommerceIndicator", - electronicCommerceIndicator, - ), - checkRequired("pointOfServiceEntryMode", pointOfServiceEntryMode), - checkRequired("standInProcessingReason", standInProcessingReason), - additionalProperties.toMutableMap(), - ) - } + /** + * The declined amount in the minor unit of the destination account currency. For + * dollars, for example, this is cents. + */ + fun amount(amount: Long) = amount(JsonField.of(amount)) - private var validated: Boolean = false + /** + * 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 } - fun validate(): Visa = apply { - if (validated) { - return@apply - } + /** The ID of the Card Payment this transaction belongs to. */ + fun cardPaymentId(cardPaymentId: String) = + cardPaymentId(JsonField.of(cardPaymentId)) - electronicCommerceIndicator().ifPresent { it.validate() } - pointOfServiceEntryMode().ifPresent { it.validate() } - standInProcessingReason().ifPresent { it.validate() } - validated = true - } + /** + * 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 + } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the destination + * account currency. + */ + fun currency(currency: Currency) = currency(JsonField.of(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 = - (electronicCommerceIndicator.asKnown().getOrNull()?.validity() ?: 0) + - (pointOfServiceEntryMode.asKnown().getOrNull()?.validity() ?: 0) + - (standInProcessingReason.asKnown().getOrNull()?.validity() ?: 0) - - /** - * 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 { + /** + * 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 } - /** - * 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") + /** The identifier of the declined transaction created for this Card Decline. */ + fun declinedTransactionId(declinedTransactionId: String) = + declinedTransactionId(JsonField.of(declinedTransactionId)) - /** - * Recurring transaction: Payment indicator used to indicate a recurring - * transaction that originates from an acquirer in the US region. - */ - @JvmField val RECURRING = of("recurring") + /** + * Sets [Builder.declinedTransactionId] to an arbitrary JSON value. + * + * You should usually call [Builder.declinedTransactionId] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun declinedTransactionId(declinedTransactionId: JsonField) = apply { + this.declinedTransactionId = declinedTransactionId + } - /** - * 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") + /** + * 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)) - /** - * 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") + /** + * Alias for calling [Builder.digitalWalletTokenId] with + * `digitalWalletTokenId.orElse(null)`. + */ + fun digitalWalletTokenId(digitalWalletTokenId: Optional) = + digitalWalletTokenId(digitalWalletTokenId.getOrNull()) - /** - * 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") + /** + * 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 + } - /** - * 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") + /** + * The direction describes the direction the funds will move, either from the + * cardholder to the merchant or from the merchant to the cardholder. + */ + fun direction(direction: Direction) = direction(JsonField.of(direction)) - /** - * 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") + /** + * Sets [Builder.direction] to an arbitrary JSON value. + * + * You should usually call [Builder.direction] with a well-typed [Direction] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun direction(direction: JsonField) = apply { + this.direction = direction + } - /** - * 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 merchant identifier (commonly abbreviated as MID) of the merchant the card is + * transacting with. + */ + fun merchantAcceptorId(merchantAcceptorId: String) = + merchantAcceptorId(JsonField.of(merchantAcceptorId)) - @JvmStatic - fun of(value: String) = ElectronicCommerceIndicator(JsonField.of(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 + } - /** 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, - } + /** + * The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card + * is transacting with. + */ + fun merchantCategoryCode(merchantCategoryCode: String) = + merchantCategoryCode(JsonField.of(merchantCategoryCode)) - /** - * 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, - } + /** + * 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, 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 - } + /** The city the merchant resides in. */ + fun merchantCity(merchantCity: String?) = + merchantCity(JsonField.ofNullable(merchantCity)) - /** - * 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" - ) - } + /** Alias for calling [Builder.merchantCity] with `merchantCity.orElse(null)`. */ + fun merchantCity(merchantCity: Optional) = + merchantCity(merchantCity.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.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(): ElectronicCommerceIndicator = 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 merchant descriptor of the merchant the card is transacting with. */ + fun merchantDescriptor(merchantDescriptor: String) = + merchantDescriptor(JsonField.of(merchantDescriptor)) - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * 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 + } - /** - * 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 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)) - 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 /* spotless:off */ other is ElectronicCommerceIndicator && value == other.value /* spotless:on */ - } + /** + * 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() + /** The state the merchant resides in. */ + fun merchantState(merchantState: String?) = + merchantState(JsonField.ofNullable(merchantState)) - override fun toString() = value.toString() - } + /** Alias for calling [Builder.merchantState] with `merchantState.orElse(null)`. */ + fun merchantState(merchantState: Optional) = + merchantState(merchantState.getOrNull()) - /** - * 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 { + /** + * 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 + } - /** - * 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 + /** Fields specific to the `network`. */ + fun networkDetails(networkDetails: NetworkDetails) = + networkDetails(JsonField.of(networkDetails)) - companion object { + /** + * 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 + } - /** Unknown */ - @JvmField val UNKNOWN = of("unknown") + /** Network-specific identifiers for a specific request or transaction. */ + fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) = + networkIdentifiers(JsonField.of(networkIdentifiers)) - /** Manual key entry */ - @JvmField val MANUAL = of("manual") - - /** Magnetic stripe read, without card verification value */ - @JvmField val MAGNETIC_STRIPE_NO_CVV = of("magnetic_stripe_no_cvv") - - /** Optical code */ - @JvmField val OPTICAL_CODE = of("optical_code") - - /** Contact chip card */ - @JvmField val INTEGRATED_CIRCUIT_CARD = of("integrated_circuit_card") - - /** Contactless read of chip card */ - @JvmField val CONTACTLESS = of("contactless") + /** + * 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 + } - /** - * Transaction initiated using a credential that has previously been - * stored on file - */ - @JvmField val CREDENTIAL_ON_FILE = of("credential_on_file") + /** + * 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. + */ + fun networkRiskScore(networkRiskScore: Long?) = + networkRiskScore(JsonField.ofNullable(networkRiskScore)) - /** Magnetic stripe read */ - @JvmField val MAGNETIC_STRIPE = of("magnetic_stripe") + /** + * Alias for [Builder.networkRiskScore]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun networkRiskScore(networkRiskScore: Long) = + networkRiskScore(networkRiskScore as Long?) - /** Contactless read of magnetic stripe data */ - @JvmField - val CONTACTLESS_MAGNETIC_STRIPE = of("contactless_magnetic_stripe") + /** + * Alias for calling [Builder.networkRiskScore] with + * `networkRiskScore.orElse(null)`. + */ + fun networkRiskScore(networkRiskScore: Optional) = + networkRiskScore(networkRiskScore.getOrNull()) - /** Contact chip card, without card verification value */ - @JvmField - val INTEGRATED_CIRCUIT_CARD_NO_CVV = - of("integrated_circuit_card_no_cvv") + /** + * 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 + } - @JvmStatic - fun of(value: String) = PointOfServiceEntryMode(JsonField.of(value)) - } + /** + * 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)) - /** 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, - } + /** + * Alias for calling [Builder.physicalCardId] with `physicalCardId.orElse(null)`. + */ + fun physicalCardId(physicalCardId: Optional) = + physicalCardId(physicalCardId.getOrNull()) - /** - * 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, - } + /** + * 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 + } - /** - * 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 - } + /** + * The declined amount in the minor unit of the transaction's presentment currency. + */ + fun presentmentAmount(presentmentAmount: Long) = + presentmentAmount(JsonField.of(presentmentAmount)) - /** - * 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.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 + } - /** - * 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 transaction's + * presentment currency. + */ + fun presentmentCurrency(presentmentCurrency: String) = + presentmentCurrency(JsonField.of(presentmentCurrency)) - private var validated: Boolean = false + /** + * 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 validate(): PointOfServiceEntryMode = apply { - if (validated) { - return@apply - } + /** + * The processing category describes the intent behind the authorization, such as + * whether it was used for bill payments or an automatic fuel dispenser. + */ + fun processingCategory(processingCategory: ProcessingCategory) = + processingCategory(JsonField.of(processingCategory)) - known() - validated = true - } + /** + * Sets [Builder.processingCategory] to an arbitrary JSON value. + * + * You should usually call [Builder.processingCategory] with a well-typed + * [ProcessingCategory] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun processingCategory(processingCategory: JsonField) = apply { + this.processingCategory = processingCategory + } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * The identifier of the Real-Time Decision sent to approve or decline this + * transaction. + */ + fun realTimeDecisionId(realTimeDecisionId: String?) = + realTimeDecisionId(JsonField.ofNullable(realTimeDecisionId)) - /** - * 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.realTimeDecisionId] with + * `realTimeDecisionId.orElse(null)`. + */ + fun realTimeDecisionId(realTimeDecisionId: Optional) = + realTimeDecisionId(realTimeDecisionId.getOrNull()) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * 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 + } - return /* spotless:off */ other is PointOfServiceEntryMode && value == other.value /* spotless:on */ - } + /** + * This is present if a specific decline reason was given in the real-time decision. + */ + fun realTimeDecisionReason(realTimeDecisionReason: RealTimeDecisionReason?) = + realTimeDecisionReason(JsonField.ofNullable(realTimeDecisionReason)) - override fun hashCode() = value.hashCode() + /** + * Alias for calling [Builder.realTimeDecisionReason] with + * `realTimeDecisionReason.orElse(null)`. + */ + fun realTimeDecisionReason( + realTimeDecisionReason: Optional + ) = realTimeDecisionReason(realTimeDecisionReason.getOrNull()) - override fun toString() = value.toString() - } + /** + * Sets [Builder.realTimeDecisionReason] to an arbitrary JSON value. + * + * You should usually call [Builder.realTimeDecisionReason] with a well-typed + * [RealTimeDecisionReason] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun realTimeDecisionReason( + realTimeDecisionReason: JsonField + ) = apply { this.realTimeDecisionReason = realTimeDecisionReason } - /** - * 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 { + /** Why the transaction was declined. */ + fun reason(reason: Reason) = reason(JsonField.of(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 + /** + * Sets [Builder.reason] to an arbitrary JSON value. + * + * You should usually call [Builder.reason] with a well-typed [Reason] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun reason(reason: JsonField) = apply { this.reason = reason } - companion object { + /** + * The terminal identifier (commonly abbreviated as TID) of the terminal the card is + * transacting with. + */ + fun terminalId(terminalId: String?) = terminalId(JsonField.ofNullable(terminalId)) - /** Increase failed to process the authorization in a timely manner. */ - @JvmField val ISSUER_ERROR = of("issuer_error") + /** Alias for calling [Builder.terminalId] with `terminalId.orElse(null)`. */ + fun terminalId(terminalId: Optional) = terminalId(terminalId.getOrNull()) - /** - * The physical card read had an invalid CVV, dCVV, or authorization - * request cryptogram. - */ - @JvmField val INVALID_PHYSICAL_CARD = of("invalid_physical_card") + /** + * 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 + } - /** The 3DS cardholder authentication verification value was invalid. */ - @JvmField - val INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE = - of("invalid_cardholder_authentication_verification_value") + /** Fields related to verification of cardholder-provided values. */ + fun verification(verification: Verification) = + verification(JsonField.of(verification)) - /** - * 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") + /** + * 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 + } - /** - * 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") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(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") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** An unspecific reason for stand-in processing. */ - @JvmField val OTHER = of("other") + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - @JvmStatic - fun of(value: String) = StandInProcessingReason(JsonField.of(value)) - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** 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, dCVV, or authorization - * request cryptogram. - */ - INVALID_PHYSICAL_CARD, - /** 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, - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * 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, dCVV, or authorization - * request cryptogram. - */ - INVALID_PHYSICAL_CARD, - /** 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 immutable instance of [CardDecline]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .actioner() + * .additionalAmounts() + * .amount() + * .cardPaymentId() + * .currency() + * .declinedTransactionId() + * .digitalWalletTokenId() + * .direction() + * .merchantAcceptorId() + * .merchantCategoryCode() + * .merchantCity() + * .merchantCountry() + * .merchantDescriptor() + * .merchantPostalCode() + * .merchantState() + * .networkDetails() + * .networkIdentifiers() + * .networkRiskScore() + * .physicalCardId() + * .presentmentAmount() + * .presentmentCurrency() + * .processingCategory() + * .realTimeDecisionId() + * .realTimeDecisionReason() + * .reason() + * .terminalId() + * .verification() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CardDecline = + CardDecline( + checkRequired("id", id), + checkRequired("actioner", actioner), + checkRequired("additionalAmounts", additionalAmounts), + checkRequired("amount", amount), + checkRequired("cardPaymentId", cardPaymentId), + checkRequired("currency", currency), + checkRequired("declinedTransactionId", declinedTransactionId), + checkRequired("digitalWalletTokenId", digitalWalletTokenId), + checkRequired("direction", direction), + 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("presentmentAmount", presentmentAmount), + checkRequired("presentmentCurrency", presentmentCurrency), + checkRequired("processingCategory", processingCategory), + checkRequired("realTimeDecisionId", realTimeDecisionId), + checkRequired("realTimeDecisionReason", realTimeDecisionReason), + checkRequired("reason", reason), + checkRequired("terminalId", terminalId), + checkRequired("verification", verification), + 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) { - ISSUER_ERROR -> Value.ISSUER_ERROR - INVALID_PHYSICAL_CARD -> Value.INVALID_PHYSICAL_CARD - 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 - } + 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) { - ISSUER_ERROR -> Known.ISSUER_ERROR - INVALID_PHYSICAL_CARD -> Known.INVALID_PHYSICAL_CARD - 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" - ) - } + fun validate(): CardDecline = 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") - } + id() + actioner().validate() + additionalAmounts().validate() + amount() + cardPaymentId() + currency().validate() + declinedTransactionId() + digitalWalletTokenId() + direction().validate() + merchantAcceptorId() + merchantCategoryCode() + merchantCity() + merchantCountry() + merchantDescriptor() + merchantPostalCode() + merchantState() + networkDetails().validate() + networkIdentifiers().validate() + networkRiskScore() + physicalCardId() + presentmentAmount() + presentmentCurrency() + processingCategory().validate() + realTimeDecisionId() + realTimeDecisionReason().ifPresent { it.validate() } + reason().validate() + terminalId() + verification().validate() + validated = true + } - private var validated: Boolean = false + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - fun validate(): StandInProcessingReason = 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 (id.asKnown().isPresent) 1 else 0) + + (actioner.asKnown().getOrNull()?.validity() ?: 0) + + (additionalAmounts.asKnown().getOrNull()?.validity() ?: 0) + + (if (amount.asKnown().isPresent) 1 else 0) + + (if (cardPaymentId.asKnown().isPresent) 1 else 0) + + (currency.asKnown().getOrNull()?.validity() ?: 0) + + (if (declinedTransactionId.asKnown().isPresent) 1 else 0) + + (if (digitalWalletTokenId.asKnown().isPresent) 1 else 0) + + (direction.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 (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 (presentmentAmount.asKnown().isPresent) 1 else 0) + + (if (presentmentCurrency.asKnown().isPresent) 1 else 0) + + (processingCategory.asKnown().getOrNull()?.validity() ?: 0) + + (if (realTimeDecisionId.asKnown().isPresent) 1 else 0) + + (realTimeDecisionReason.asKnown().getOrNull()?.validity() ?: 0) + + (reason.asKnown().getOrNull()?.validity() ?: 0) + + (if (terminalId.asKnown().isPresent) 1 else 0) + + (verification.asKnown().getOrNull()?.validity() ?: 0) - known() - validated = true - } + /** + * Whether this authorization was approved by Increase, the card network through + * stand-in processing, or the user through a real-time decision. + */ + class Actioner @JsonCreator private constructor(private val value: JsonField) : + Enum { - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - 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 - /** - * 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 - } + /** This object was actioned by the user through a real-time decision. */ + @JvmField val USER = of("user") - return /* spotless:off */ other is StandInProcessingReason && value == other.value /* spotless:on */ - } + /** This object was actioned by Increase without user intervention. */ + @JvmField val INCREASE = of("increase") - override fun hashCode() = value.hashCode() + /** This object was actioned by the network, through stand-in processing. */ + @JvmField val NETWORK = of("network") - override fun toString() = value.toString() + @JvmStatic fun of(value: String) = Actioner(JsonField.of(value)) + } + + /** An enum containing [Actioner]'s known values. */ + enum class Known { + /** This object was actioned by the user through a real-time decision. */ + USER, + /** This object was actioned by Increase without user intervention. */ + INCREASE, + /** This object was actioned by the network, through stand-in processing. */ + NETWORK, + } + + /** + * An enum containing [Actioner]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Actioner] 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 { + /** This object was actioned by the user through a real-time decision. */ + USER, + /** This object was actioned by Increase without user intervention. */ + INCREASE, + /** This object was actioned by the network, through stand-in processing. */ + NETWORK, + /** + * An enum member indicating that [Actioner] 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) { + USER -> Value.USER + INCREASE -> Value.INCREASE + NETWORK -> Value.NETWORK + 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) { + USER -> Known.USER + INCREASE -> Known.INCREASE + NETWORK -> Known.NETWORK + else -> throw IncreaseInvalidDataException("Unknown Actioner: $value") + } - return /* spotless:off */ other is Visa && electronicCommerceIndicator == other.electronicCommerceIndicator && pointOfServiceEntryMode == other.pointOfServiceEntryMode && standInProcessingReason == other.standInProcessingReason && additionalProperties == other.additionalProperties /* spotless:on */ + /** + * 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") } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(electronicCommerceIndicator, pointOfServiceEntryMode, standInProcessingReason, additionalProperties) } - /* spotless:on */ + private var validated: Boolean = false - override fun hashCode(): Int = hashCode + fun validate(): Actioner = apply { + if (validated) { + return@apply + } - override fun toString() = - "Visa{electronicCommerceIndicator=$electronicCommerceIndicator, pointOfServiceEntryMode=$pointOfServiceEntryMode, standInProcessingReason=$standInProcessingReason, additionalProperties=$additionalProperties}" + 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 /* spotless:off */ other is NetworkDetails && category == other.category && visa == other.visa && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Actioner && value == other.value /* spotless:on */ } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(category, visa, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode + override fun hashCode() = value.hashCode() - override fun toString() = - "NetworkDetails{category=$category, visa=$visa, additionalProperties=$additionalProperties}" + override fun toString() = value.toString() } - /** Network-specific identifiers for a specific request or transaction. */ - class NetworkIdentifiers + /** + * 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 private constructor( - private val retrievalReferenceNumber: JsonField, - private val traceNumber: JsonField, - private val transactionId: JsonField, + private val clinic: JsonField, + private val dental: 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("retrieval_reference_number") + @JsonProperty("clinic") @ExcludeMissing - retrievalReferenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("trace_number") + clinic: JsonField = JsonMissing.of(), + @JsonProperty("dental") @ExcludeMissing - traceNumber: JsonField = JsonMissing.of(), - @JsonProperty("transaction_id") + dental: JsonField = JsonMissing.of(), + @JsonProperty("prescription") @ExcludeMissing - transactionId: JsonField = JsonMissing.of(), - ) : this(retrievalReferenceNumber, traceNumber, transactionId, mutableMapOf()) + 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, + prescription, + surcharge, + totalCumulative, + totalHealthcare, + transit, + unknown, + vision, + mutableMapOf(), + ) /** - * 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 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 retrievalReferenceNumber(): Optional = - retrievalReferenceNumber.getOptional("retrieval_reference_number") + fun clinic(): Optional = clinic.getOptional("clinic") /** - * A counter used to verify an individual authorization. Expected to be unique per - * acquirer within a window of time. + * 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 traceNumber(): Optional = traceNumber.getOptional("trace_number") + fun dental(): Optional = dental.getOptional("dental") /** - * A globally unique transaction identifier provided by the card network, used - * across multiple life-cycle requests. + * 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 transactionId(): Optional = transactionId.getOptional("transaction_id") + fun prescription(): Optional = + prescription.getOptional("prescription") /** - * Returns the raw JSON value of [retrievalReferenceNumber]. + * The surcharge amount charged for this transaction by the merchant. * - * Unlike [retrievalReferenceNumber], 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("retrieval_reference_number") - @ExcludeMissing - fun _retrievalReferenceNumber(): JsonField = retrievalReferenceNumber + fun surcharge(): Optional = surcharge.getOptional("surcharge") /** - * Returns the raw JSON value of [traceNumber]. + * The total amount of a series of incremental authorizations, optionally provided. * - * Unlike [traceNumber], 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("trace_number") - @ExcludeMissing - fun _traceNumber(): JsonField = traceNumber + fun totalCumulative(): Optional = + totalCumulative.getOptional("total_cumulative") /** - * Returns the raw JSON value of [transactionId]. + * The total amount of healthcare-related additional amounts. * - * Unlike [transactionId], 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("transaction_id") - @ExcludeMissing - fun _transactionId(): JsonField = transactionId + fun totalHealthcare(): Optional = + totalHealthcare.getOptional("total_healthcare") - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** + * 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") - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** + * 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") - fun toBuilder() = Builder().from(this) + /** + * 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") - companion object { + /** + * 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 a mutable builder for constructing an instance of - * [NetworkIdentifiers]. - * - * The following fields are required: - * ```java - * .retrievalReferenceNumber() - * .traceNumber() - * .transactionId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + /** + * 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 - /** A builder for [NetworkIdentifiers]. */ - class Builder internal constructor() { + /** + * 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 - private var retrievalReferenceNumber: JsonField? = null - private var traceNumber: JsonField? = null - private var transactionId: JsonField? = null + /** + * 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() + * .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 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(networkIdentifiers: NetworkIdentifiers) = apply { - retrievalReferenceNumber = networkIdentifiers.retrievalReferenceNumber - traceNumber = networkIdentifiers.traceNumber - transactionId = networkIdentifiers.transactionId - additionalProperties = - networkIdentifiers.additionalProperties.toMutableMap() + internal fun from(additionalAmounts: AdditionalAmounts) = apply { + clinic = additionalAmounts.clinic + dental = additionalAmounts.dental + 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()) + /** - * 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. + * 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 retrievalReferenceNumber(retrievalReferenceNumber: String?) = - retrievalReferenceNumber(JsonField.ofNullable(retrievalReferenceNumber)) + 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()) /** - * Alias for calling [Builder.retrievalReferenceNumber] with - * `retrievalReferenceNumber.orElse(null)`. + * 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 retrievalReferenceNumber(retrievalReferenceNumber: Optional) = - retrievalReferenceNumber(retrievalReferenceNumber.getOrNull()) + fun dental(dental: JsonField) = apply { this.dental = dental } /** - * 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 part of this transaction amount that was for healthcare prescriptions. */ - fun retrievalReferenceNumber(retrievalReferenceNumber: JsonField) = - apply { - this.retrievalReferenceNumber = retrievalReferenceNumber - } + fun prescription(prescription: Prescription?) = + prescription(JsonField.ofNullable(prescription)) /** - * A counter used to verify an individual authorization. Expected to be unique - * per acquirer within a window of time. + * Alias for calling [Builder.prescription] with `prescription.orElse(null)`. */ - fun traceNumber(traceNumber: String?) = - traceNumber(JsonField.ofNullable(traceNumber)) + fun prescription(prescription: Optional) = + prescription(prescription.getOrNull()) - /** Alias for calling [Builder.traceNumber] with `traceNumber.orElse(null)`. */ - fun traceNumber(traceNumber: Optional) = - traceNumber(traceNumber.getOrNull()) + /** + * Sets [Builder.prescription] to an arbitrary JSON value. + * + * You should usually call [Builder.prescription] with a well-typed + * [Prescription] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun prescription(prescription: JsonField) = apply { + this.prescription = prescription + } + + /** The surcharge amount charged for this transaction by the merchant. */ + fun surcharge(surcharge: Surcharge?) = + surcharge(JsonField.ofNullable(surcharge)) + + /** Alias for calling [Builder.surcharge] with `surcharge.orElse(null)`. */ + fun surcharge(surcharge: Optional) = surcharge(surcharge.getOrNull()) /** - * Sets [Builder.traceNumber] to an arbitrary JSON value. + * Sets [Builder.surcharge] to an arbitrary JSON value. * - * You should usually call [Builder.traceNumber] with a well-typed [String] + * You should usually call [Builder.surcharge] with a well-typed [Surcharge] * 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 surcharge(surcharge: JsonField) = apply { + this.surcharge = surcharge } /** - * A globally unique transaction identifier provided by the card network, used - * across multiple life-cycle requests. + * The total amount of a series of incremental authorizations, optionally + * provided. */ - fun transactionId(transactionId: String?) = - transactionId(JsonField.ofNullable(transactionId)) + fun totalCumulative(totalCumulative: TotalCumulative?) = + totalCumulative(JsonField.ofNullable(totalCumulative)) /** - * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`. + * Alias for calling [Builder.totalCumulative] with + * `totalCumulative.orElse(null)`. */ - fun transactionId(transactionId: Optional) = - transactionId(transactionId.getOrNull()) + fun totalCumulative(totalCumulative: Optional) = + totalCumulative(totalCumulative.getOrNull()) /** - * Sets [Builder.transactionId] to an arbitrary JSON value. + * Sets [Builder.totalCumulative] 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.totalCumulative] with a well-typed + * [TotalCumulative] 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 totalCumulative(totalCumulative: JsonField) = apply { + this.totalCumulative = totalCumulative + } + + /** The total amount of healthcare-related additional amounts. */ + fun totalHealthcare(totalHealthcare: TotalHealthcare?) = + totalHealthcare(JsonField.ofNullable(totalHealthcare)) + + /** + * Alias for calling [Builder.totalHealthcare] with + * `totalHealthcare.orElse(null)`. + */ + fun totalHealthcare(totalHealthcare: Optional) = + totalHealthcare(totalHealthcare.getOrNull()) + + /** + * Sets [Builder.totalHealthcare] to an arbitrary JSON value. + * + * You should usually call [Builder.totalHealthcare] with a well-typed + * [TotalHealthcare] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun totalHealthcare(totalHealthcare: JsonField) = apply { + this.totalHealthcare = totalHealthcare } + /** + * The part of this transaction amount that was for transit-related services. + */ + fun transit(transit: Transit?) = transit(JsonField.ofNullable(transit)) + + /** Alias for calling [Builder.transit] with `transit.orElse(null)`. */ + fun transit(transit: Optional) = transit(transit.getOrNull()) + + /** + * Sets [Builder.transit] to an arbitrary JSON value. + * + * You should usually call [Builder.transit] with a well-typed [Transit] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun transit(transit: JsonField) = apply { this.transit = transit } + + /** An unknown additional amount. */ + fun unknown(unknown: Unknown?) = unknown(JsonField.ofNullable(unknown)) + + /** Alias for calling [Builder.unknown] with `unknown.orElse(null)`. */ + fun unknown(unknown: Optional) = unknown(unknown.getOrNull()) + + /** + * Sets [Builder.unknown] to an arbitrary JSON value. + * + * You should usually call [Builder.unknown] with a well-typed [Unknown] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun unknown(unknown: JsonField) = apply { this.unknown = unknown } + + /** The part of this transaction amount that was for vision-related services. */ + fun vision(vision: Vision?) = vision(JsonField.ofNullable(vision)) + + /** Alias for calling [Builder.vision] with `vision.orElse(null)`. */ + fun vision(vision: Optional) = vision(vision.getOrNull()) + + /** + * Sets [Builder.vision] to an arbitrary JSON value. + * + * You should usually call [Builder.vision] with a well-typed [Vision] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun vision(vision: JsonField) = apply { this.vision = vision } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -13680,38 +14746,56 @@ private constructor( } /** - * Returns an immutable instance of [NetworkIdentifiers]. + * Returns an immutable instance of [AdditionalAmounts]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .retrievalReferenceNumber() - * .traceNumber() - * .transactionId() + * .clinic() + * .dental() + * .prescription() + * .surcharge() + * .totalCumulative() + * .totalHealthcare() + * .transit() + * .unknown() + * .vision() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): NetworkIdentifiers = - NetworkIdentifiers( - checkRequired("retrievalReferenceNumber", retrievalReferenceNumber), - checkRequired("traceNumber", traceNumber), - checkRequired("transactionId", transactionId), + fun build(): AdditionalAmounts = + AdditionalAmounts( + checkRequired("clinic", clinic), + checkRequired("dental", dental), + checkRequired("prescription", prescription), + checkRequired("surcharge", surcharge), + checkRequired("totalCumulative", totalCumulative), + checkRequired("totalHealthcare", totalHealthcare), + checkRequired("transit", transit), + checkRequired("unknown", unknown), + checkRequired("vision", vision), additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): NetworkIdentifiers = apply { + fun validate(): AdditionalAmounts = apply { if (validated) { return@apply } - retrievalReferenceNumber() - traceNumber() - transactionId() + clinic().ifPresent { it.validate() } + dental().ifPresent { it.validate() } + prescription().ifPresent { it.validate() } + surcharge().ifPresent { it.validate() } + totalCumulative().ifPresent { it.validate() } + totalHealthcare().ifPresent { it.validate() } + transit().ifPresent { it.validate() } + unknown().ifPresent { it.validate() } + vision().ifPresent { it.validate() } validated = true } @@ -13731,1107 +14815,940 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (retrievalReferenceNumber.asKnown().isPresent) 1 else 0) + - (if (traceNumber.asKnown().isPresent) 1 else 0) + - (if (transactionId.asKnown().isPresent) 1 else 0) + (clinic.asKnown().getOrNull()?.validity() ?: 0) + + (dental.asKnown().getOrNull()?.validity() ?: 0) + + (prescription.asKnown().getOrNull()?.validity() ?: 0) + + (surcharge.asKnown().getOrNull()?.validity() ?: 0) + + (totalCumulative.asKnown().getOrNull()?.validity() ?: 0) + + (totalHealthcare.asKnown().getOrNull()?.validity() ?: 0) + + (transit.asKnown().getOrNull()?.validity() ?: 0) + + (unknown.asKnown().getOrNull()?.validity() ?: 0) + + (vision.asKnown().getOrNull()?.validity() ?: 0) + + /** The part of this transaction amount that was for clinic-related services. */ + class Clinic + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) + + /** + * The amount in minor units of the `currency` field. + * + * @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 + * additional amount'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(): String = 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) } - return /* spotless:off */ other is NetworkIdentifiers && retrievalReferenceNumber == other.retrievalReferenceNumber && traceNumber == other.traceNumber && transactionId == other.transactionId && additionalProperties == other.additionalProperties /* spotless:on */ - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(retrievalReferenceNumber, traceNumber, transactionId, additionalProperties) } - /* spotless:on */ + fun toBuilder() = Builder().from(this) - override fun hashCode(): Int = hashCode + companion object { - override fun toString() = - "NetworkIdentifiers{retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}" - } + /** + * Returns a mutable builder for constructing an instance of [Clinic]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - /** - * 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 { + /** A builder for [Clinic]. */ + class Builder internal constructor() { - /** - * 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 amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() - companion object { + @JvmSynthetic + internal fun from(clinic: Clinic) = apply { + amount = clinic.amount + currency = clinic.currency + additionalProperties = clinic.additionalProperties.toMutableMap() + } - /** - * 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 amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) - /** - * 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") + /** + * 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 } - /** A transaction used to pay a bill. */ - @JvmField val BILL_PAYMENT = of("bill_payment") + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) - /** Original credit transactions are used to send money to a cardholder. */ - @JvmField val ORIGINAL_CREDIT = of("original_credit") + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: JsonField) = apply { + this.currency = currency + } - /** A regular purchase. */ - @JvmField val PURCHASE = of("purchase") + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * Quasi-cash transactions represent purchases of items which may be convertible - * to cash. - */ - @JvmField val QUASI_CASH = of("quasi_cash") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * A refund card authorization, sometimes referred to as a credit voucher - * authorization, where funds are credited to the cardholder. - */ - @JvmField val REFUND = of("refund") + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } - /** - * Cash disbursement transactions are used to withdraw cash from an ATM or a - * point of sale. - */ - @JvmField val CASH_DISBURSEMENT = of("cash_disbursement") + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** The processing category is unknown. */ - @JvmField val UNKNOWN = of("unknown") + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - @JvmStatic fun of(value: String) = ProcessingCategory(JsonField.of(value)) - } + /** + * Returns an immutable instance of [Clinic]. + * + * 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(): Clinic = + Clinic( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Clinic = apply { + if (validated) { + return@apply + } + + amount() + currency() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** 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. + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. */ - CASH_DISBURSEMENT, - /** The processing category is unknown. */ - UNKNOWN, + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Clinic && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Clinic{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" } - /** - * 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, + /** The part of this transaction amount that was for dental-related services. */ + class Dental + 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()) + /** - * Quasi-cash transactions represent purchases of items which may be convertible - * to cash. + * The amount in minor units of the `currency` field. + * + * @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). */ - QUASI_CASH, + fun amount(): Long = amount.getRequired("amount") + /** - * A refund card authorization, sometimes referred to as a credit voucher - * authorization, where funds are credited to the cardholder. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount'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). */ - REFUND, + fun currency(): String = currency.getRequired("currency") + /** - * Cash disbursement transactions are used to withdraw cash from an ATM or a - * point of sale. + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an + * unexpected type. */ - CASH_DISBURSEMENT, - /** The processing category is unknown. */ - UNKNOWN, + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + /** - * An enum member indicating that [ProcessingCategory] was instantiated with an - * unknown value. + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an + * unexpected type. */ - _UNKNOWN, - } + @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. - * - * 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 - UNKNOWN -> Value.UNKNOWN - 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) { - 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 - UNKNOWN -> Known.UNKNOWN - else -> - throw IncreaseInvalidDataException("Unknown ProcessingCategory: $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(): ProcessingCategory = apply { - if (validated) { - return@apply + /** + * Returns a mutable builder for constructing an instance of [Dental]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() } - known() - validated = true - } + /** A builder for [Dental]. */ + class Builder internal constructor() { - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + private var amount: JsonField? = null + private var currency: 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(dental: Dental) = apply { + amount = dental.amount + currency = dental.currency + additionalProperties = dental.additionalProperties.toMutableMap() + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** The amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) - return /* spotless:off */ other is ProcessingCategory && value == other.value /* spotless:on */ - } + /** + * 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 } - override fun hashCode() = value.hashCode() + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) - override fun toString() = value.toString() - } + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: JsonField) = apply { + this.currency = currency + } - /** 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 { + 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) } - /** - * The cardholder does not have sufficient funds to cover the transaction. The - * merchant may attempt to process the transaction again. - */ - @JvmField val INSUFFICIENT_FUNDS = of("insufficient_funds") + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * This type of transaction is not allowed for this card. This transaction - * should not be retried. - */ - @JvmField val TRANSACTION_NEVER_ALLOWED = of("transaction_never_allowed") + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * The transaction amount exceeds the cardholder's approval limit. The merchant - * may attempt to process the transaction again. - */ - @JvmField val EXCEEDS_APPROVAL_LIMIT = of("exceeds_approval_limit") + /** + * Returns an immutable instance of [Dental]. + * + * 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(): Dental = + Dental( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } - /** - * The card has been temporarily disabled or not yet activated. The merchant may - * attempt to process the transaction again. - */ - @JvmField val CARD_TEMPORARILY_DISABLED = of("card_temporarily_disabled") + private var validated: Boolean = false - /** - * The transaction is suspected to be fraudulent. The merchant may attempt to - * process the transaction again. - */ - @JvmField val SUSPECTED_FRAUD = of("suspected_fraud") + fun validate(): Dental = apply { + if (validated) { + return@apply + } - /** - * The transaction was declined for another reason. The merchant may attempt to - * process the transaction again. This should be used sparingly. - */ - @JvmField val OTHER = of("other") + amount() + currency() + validated = true + } - @JvmStatic fun of(value: String) = RealTimeDecisionReason(JsonField.of(value)) - } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** 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. + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. */ - OTHER, + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Dental && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Dental{amount=$amount, currency=$currency, additionalProperties=$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 part of this transaction amount that was for healthcare prescriptions. */ + class Prescription + 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 card has been temporarily disabled or not yet activated. The merchant may - * attempt to process the transaction again. + * The amount in minor units of the `currency` field. + * + * @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). */ - CARD_TEMPORARILY_DISABLED, + fun amount(): Long = amount.getRequired("amount") + /** - * 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 + * additional amount'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). */ - SUSPECTED_FRAUD, + fun currency(): String = currency.getRequired("currency") + /** - * The transaction was declined for another reason. The merchant may attempt to - * process the transaction again. This should be used sparingly. + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an + * unexpected type. */ - OTHER, + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + /** - * An enum member indicating that [RealTimeDecisionReason] was instantiated with - * an unknown value. + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an + * unexpected type. */ - _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) { - 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 - } - - /** - * 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" - ) - } + @JsonProperty("currency") + @ExcludeMissing + fun _currency(): JsonField = 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") + @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(): RealTimeDecisionReason = 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 [Prescription]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @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 [Prescription]. */ + class Builder internal constructor() { - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() - return /* spotless:off */ other is RealTimeDecisionReason && value == other.value /* spotless:on */ - } + @JvmSynthetic + internal fun from(prescription: Prescription) = apply { + amount = prescription.amount + currency = prescription.currency + additionalProperties = prescription.additionalProperties.toMutableMap() + } - override fun hashCode() = value.hashCode() + /** The amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) - override fun toString() = value.toString() - } + /** + * 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 } - /** Why the transaction was declined. */ - class Reason @JsonCreator private constructor(private val value: JsonField) : - Enum { + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(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 + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: JsonField) = apply { + this.currency = currency + } - companion object { + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The account has been closed. */ - @JvmField val ACCOUNT_CLOSED = of("account_closed") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** The Card was not active. */ - @JvmField val CARD_NOT_ACTIVE = of("card_not_active") + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } - /** The Card has been canceled. */ - @JvmField val CARD_CANCELED = of("card_canceled") + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** The Physical Card was not active. */ - @JvmField val PHYSICAL_CARD_NOT_ACTIVE = of("physical_card_not_active") + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** The account's entity was not active. */ - @JvmField val ENTITY_NOT_ACTIVE = of("entity_not_active") + /** + * Returns an immutable instance of [Prescription]. + * + * 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(): Prescription = + Prescription( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } - /** The account was inactive. */ - @JvmField val GROUP_LOCKED = of("group_locked") + private var validated: Boolean = false - /** The Card's Account did not have a sufficient available balance. */ - @JvmField val INSUFFICIENT_FUNDS = of("insufficient_funds") + fun validate(): Prescription = apply { + if (validated) { + return@apply + } - /** The given CVV2 did not match the card's value. */ - @JvmField val CVV2_MISMATCH = of("cvv2_mismatch") + amount() + currency() + validated = true + } - /** The given PIN did not match the card's value. */ - @JvmField val PIN_MISMATCH = of("pin_mismatch") + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } /** - * The given expiration date did not match the card's value. Only applies when a - * CVV2 is present. + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. */ - @JvmField val CARD_EXPIRATION_MISMATCH = of("card_expiration_mismatch") - - /** The attempted card transaction is not allowed per Increase's terms. */ - @JvmField val TRANSACTION_NOT_ALLOWED = of("transaction_not_allowed") + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) - /** The transaction was blocked by a Limit. */ - @JvmField val BREACHES_LIMIT = of("breaches_limit") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** Your application declined the transaction via webhook. */ - @JvmField val WEBHOOK_DECLINED = of("webhook_declined") + return /* spotless:off */ other is Prescription && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** Your application webhook did not respond without the required timeout. */ - @JvmField val WEBHOOK_TIMED_OUT = of("webhook_timed_out") + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ - /** Declined by stand-in processing. */ - @JvmField - val DECLINED_BY_STAND_IN_PROCESSING = of("declined_by_stand_in_processing") + override fun hashCode(): Int = hashCode - /** - * The card read had an invalid CVV, dCVV, or authorization request cryptogram. - */ - @JvmField val INVALID_PHYSICAL_CARD = of("invalid_physical_card") + override fun toString() = + "Prescription{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } - /** - * The original card authorization for this incremental authorization does not - * exist. - */ - @JvmField - val MISSING_ORIGINAL_AUTHORIZATION = of("missing_original_authorization") + /** The surcharge amount charged for this transaction by the merchant. */ + class Surcharge + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { - /** The transaction was declined because the 3DS authentication failed. */ - @JvmField val FAILED_3DS_AUTHENTICATION = of("failed_3ds_authentication") + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) /** - * The transaction was suspected to be used by a card tester to test for valid - * card numbers. + * The amount in minor units of the `currency` field. + * + * @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). */ - @JvmField val SUSPECTED_CARD_TESTING = of("suspected_card_testing") + fun amount(): Long = amount.getRequired("amount") /** - * The transaction was suspected to be fraudulent. Please reach out to - * support@increase.com for more information. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount'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). */ - @JvmField val SUSPECTED_FRAUD = of("suspected_fraud") - - @JvmStatic fun of(value: String) = Reason(JsonField.of(value)) - } + fun currency(): String = currency.getRequired("currency") - /** 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, dCVV, or authorization request cryptogram. - */ - INVALID_PHYSICAL_CARD, - /** - * The original card authorization for this incremental authorization does not - * exist. - */ - MISSING_ORIGINAL_AUTHORIZATION, - /** 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 the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an + * unexpected type. */ - SUSPECTED_FRAUD, - } + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - /** - * 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, dCVV, or authorization request cryptogram. - */ - INVALID_PHYSICAL_CARD, /** - * The original card authorization for this incremental authorization does not - * exist. - */ - MISSING_ORIGINAL_AUTHORIZATION, - /** 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 the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an + * unexpected type. */ - _UNKNOWN, - } + @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. - * - * 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 - FAILED_3DS_AUTHENTICATION -> Value.FAILED_3DS_AUTHENTICATION - SUSPECTED_CARD_TESTING -> Value.SUSPECTED_CARD_TESTING - SUSPECTED_FRAUD -> Value.SUSPECTED_FRAUD - 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) { - 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 - 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") - } + @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(): Reason = apply { - if (validated) { - return@apply + /** + * Returns a mutable builder for constructing an instance of [Surcharge]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() } - known() - validated = true - } + /** A builder for [Surcharge]. */ + class Builder internal constructor() { - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + private var amount: JsonField? = null + private var currency: 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(surcharge: Surcharge) = apply { + amount = surcharge.amount + currency = surcharge.currency + additionalProperties = surcharge.additionalProperties.toMutableMap() + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** The amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) - return /* spotless:off */ other is Reason && value == other.value /* spotless:on */ - } + /** + * 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 } - override fun hashCode() = value.hashCode() + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) - override fun toString() = value.toString() - } + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: JsonField) = apply { + this.currency = currency + } - /** Fields related to verification of cardholder-provided values. */ - class Verification - private constructor( - private val cardVerificationCode: JsonField, - private val cardholderAddress: JsonField, - private val additionalProperties: MutableMap, - ) { + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - @JsonCreator - private constructor( - @JsonProperty("card_verification_code") - @ExcludeMissing - cardVerificationCode: JsonField = JsonMissing.of(), - @JsonProperty("cardholder_address") - @ExcludeMissing - cardholderAddress: JsonField = JsonMissing.of(), - ) : this(cardVerificationCode, cardholderAddress, mutableMapOf()) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * 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") + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } - /** - * 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") + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * 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 + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * 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 an immutable instance of [Surcharge]. + * + * 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(): Surcharge = + Surcharge( + checkRequired("amount", amount), + checkRequired("currency", currency), + 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(): Surcharge = apply { + if (validated) { + return@apply + } - fun toBuilder() = Builder().from(this) + amount() + currency() + validated = true + } - companion object { + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } /** - * Returns a mutable builder for constructing an instance of [Verification]. + * Returns a score indicating how many valid values are contained in this object + * recursively. * - * The following fields are required: - * ```java - * .cardVerificationCode() - * .cardholderAddress() - * ``` + * Used for best match union deserialization. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Verification]. */ - class Builder internal constructor() { + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) - private var cardVerificationCode: JsonField? = null - private var cardholderAddress: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmSynthetic - internal fun from(verification: Verification) = apply { - cardVerificationCode = verification.cardVerificationCode - cardholderAddress = verification.cardholderAddress - additionalProperties = verification.additionalProperties.toMutableMap() + return /* spotless:off */ other is Surcharge && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Surcharge{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** + * The total amount of a series of incremental authorizations, optionally provided. + */ + class TotalCumulative + 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()) + /** - * Fields related to verification of the Card Verification Code, a 3-digit code - * on the back of the card. + * The amount in minor units of the `currency` field. + * + * @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) = - cardVerificationCode(JsonField.of(cardVerificationCode)) + fun amount(): Long = amount.getRequired("amount") /** - * Sets [Builder.cardVerificationCode] to an arbitrary JSON value. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. * - * 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. + * @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: JsonField - ) = apply { this.cardVerificationCode = cardVerificationCode } + fun currency(): String = currency.getRequired("currency") /** - * Cardholder address provided in the authorization request and the address on - * file we verified it against. + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun cardholderAddress(cardholderAddress: CardholderAddress) = - cardholderAddress(JsonField.of(cardholderAddress)) + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount /** - * Sets [Builder.cardholderAddress] to an arbitrary JSON value. + * Returns the raw JSON value of [currency]. * - * 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. + * Unlike [currency], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun cardholderAddress(cardholderAddress: JsonField) = apply { - this.cardholderAddress = cardholderAddress - } - - 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() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Verification = - Verification( - checkRequired("cardVerificationCode", cardVerificationCode), - checkRequired("cardholderAddress", cardholderAddress), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Verification = apply { - if (validated) { - return@apply - } - - cardVerificationCode().validate() - cardholderAddress().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) - - /** - * Fields related to verification of the Card Verification Code, a 3-digit code on - * the back of the card. - */ - class CardVerificationCode - 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") + @JsonProperty("currency") @ExcludeMissing - fun _result(): JsonField = result + fun _currency(): JsonField = currency @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -14849,41 +15766,61 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [CardVerificationCode]. + * [TotalCumulative]. * * The following fields are required: * ```java - * .result() + * .amount() + * .currency() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [CardVerificationCode]. */ + /** A builder for [TotalCumulative]. */ class Builder internal constructor() { - private var result: JsonField? = null + private var amount: JsonField? = null + private var currency: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(cardVerificationCode: CardVerificationCode) = apply { - result = cardVerificationCode.result + internal fun from(totalCumulative: TotalCumulative) = apply { + amount = totalCumulative.amount + currency = totalCumulative.currency additionalProperties = - cardVerificationCode.additionalProperties.toMutableMap() + totalCumulative.additionalProperties.toMutableMap() } - /** The result of verifying the Card Verification Code. */ - fun result(result: Result) = result(JsonField.of(result)) + /** The amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) /** - * Sets [Builder.result] to an arbitrary JSON value. + * Sets [Builder.amount] to an arbitrary JSON value. * - * You should usually call [Builder.result] with a well-typed [Result] 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 result(result: JsonField) = apply { this.result = result } + fun amount(amount: JsonField) = apply { this.amount = amount } + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: JsonField) = apply { + this.currency = currency + } fun additionalProperties(additionalProperties: Map) = apply { @@ -14908,32 +15845,35 @@ private constructor( } /** - * Returns an immutable instance of [CardVerificationCode]. + * Returns an immutable instance of [TotalCumulative]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .result() + * .amount() + * .currency() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): CardVerificationCode = - CardVerificationCode( - checkRequired("result", result), + fun build(): TotalCumulative = + TotalCumulative( + checkRequired("amount", amount), + checkRequired("currency", currency), additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): CardVerificationCode = apply { + fun validate(): TotalCumulative = apply { if (validated) { return@apply } - result().validate() + amount() + currency() validated = true } @@ -14952,318 +15892,301 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = (result.asKnown().getOrNull()?.validity() ?: 0) + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is TotalCumulative && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "TotalCumulative{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** The total amount of healthcare-related additional amounts. */ + class TotalHealthcare + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { - /** The result of verifying the Card Verification Code. */ - class Result @JsonCreator - private constructor(private val value: JsonField) : Enum { + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, 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 amount in minor units of the `currency` field. + * + * @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") - companion object { + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount'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(): String = currency.getRequired("currency") - /** - * No card verification code was provided in the authorization request. - */ - @JvmField val NOT_CHECKED = of("not_checked") + /** + * 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 card verification code matched the one on file. */ - @JvmField val MATCH = of("match") + /** + * 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 - /** The card verification code did not match the one on file. */ - @JvmField val NO_MATCH = of("no_match") + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - @JvmStatic fun of(value: String) = Result(JsonField.of(value)) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(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, - } + fun toBuilder() = Builder().from(this) + + companion object { /** - * An enum containing [Result]'s known values, as well as an [_UNKNOWN] - * member. + * Returns a mutable builder for constructing an instance of + * [TotalHealthcare]. * - * 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. + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` */ - 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, + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TotalHealthcare]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(totalHealthcare: TotalHealthcare) = apply { + amount = totalHealthcare.amount + currency = totalHealthcare.currency + additionalProperties = + totalHealthcare.additionalProperties.toMutableMap() } + /** The amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) + /** - * 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.amount] 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.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 value(): Value = - when (this) { - NOT_CHECKED -> Value.NOT_CHECKED - MATCH -> Value.MATCH - NO_MATCH -> Value.NO_MATCH - else -> Value._UNKNOWN - } + fun amount(amount: JsonField) = apply { this.amount = 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. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. */ - fun known(): Known = - when (this) { - NOT_CHECKED -> Known.NOT_CHECKED - MATCH -> Known.MATCH - NO_MATCH -> Known.NO_MATCH - else -> throw IncreaseInvalidDataException("Unknown Result: $value") - } + fun currency(currency: String) = currency(JsonField.of(currency)) /** - * Returns this class instance's primitive wire representation. + * Sets [Builder.currency] to an arbitrary JSON 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. + * You should usually call [Builder.currency] 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") + fun currency(currency: JsonField) = apply { + this.currency = currency + } + + 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(): Result = 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 [TotalHealthcare]. * - * Used for best match union deserialization. + * 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. */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + fun build(): TotalHealthcare = + TotalHealthcare( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + private var validated: Boolean = false - return /* spotless:off */ other is Result && value == other.value /* spotless:on */ + fun validate(): TotalHealthcare = apply { + if (validated) { + return@apply } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CardVerificationCode && result == other.result && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TotalHealthcare && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(result, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CardVerificationCode{result=$result, additionalProperties=$additionalProperties}" + "TotalHealthcare{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" } - /** - * Cardholder address provided in the authorization request and the address on file - * we verified it against. - */ - class CardholderAddress + /** The part of this transaction amount that was for transit-related services. */ + class Transit private constructor( - private val actualLine1: JsonField, - private val actualPostalCode: JsonField, - private val providedLine1: JsonField, - private val providedPostalCode: JsonField, - private val result: JsonField, + private val amount: JsonField, + private val currency: 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") + @JsonProperty("amount") @ExcludeMissing - providedPostalCode: JsonField = JsonMissing.of(), - @JsonProperty("result") + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") @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") + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) /** - * The postal code provided for verification in the authorization request. + * The amount in minor units of the `currency` field. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). */ - fun providedPostalCode(): Optional = - providedPostalCode.getOptional("provided_postal_code") + fun amount(): Long = amount.getRequired("amount") /** - * The address verification result returned to the card network. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount'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 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 + fun currency(): String = currency.getRequired("currency") /** - * Returns the raw JSON value of [providedLine1]. + * Returns the raw JSON value of [amount]. * - * Unlike [providedLine1], this method doesn't throw if the JSON field has an + * Unlike [amount], 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 + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount /** - * Returns the raw JSON value of [result]. + * Returns the raw JSON value of [currency]. * - * Unlike [result], this method doesn't throw if the JSON field has an + * Unlike [currency], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("result") + @JsonProperty("currency") @ExcludeMissing - fun _result(): JsonField = result + fun _currency(): JsonField = currency @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -15280,146 +16203,277 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [CardholderAddress]. + * Returns a mutable builder for constructing an instance of [Transit]. * * The following fields are required: * ```java - * .actualLine1() - * .actualPostalCode() - * .providedLine1() - * .providedPostalCode() - * .result() + * .amount() + * .currency() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [CardholderAddress]. */ + /** A builder for [Transit]. */ 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 amount: JsonField? = null + private var currency: 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() + internal fun from(transit: Transit) = apply { + amount = transit.amount + currency = transit.currency + additionalProperties = transit.additionalProperties.toMutableMap() } - /** Line 1 of the address on file for the cardholder. */ - fun actualLine1(actualLine1: String?) = - actualLine1(JsonField.ofNullable(actualLine1)) + /** The amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) /** - * Alias for calling [Builder.actualLine1] with `actualLine1.orElse(null)`. + * 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 actualLine1(actualLine1: Optional) = - actualLine1(actualLine1.getOrNull()) + fun amount(amount: JsonField) = apply { this.amount = amount } /** - * Sets [Builder.actualLine1] to an arbitrary JSON value. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. * - * You should usually call [Builder.actualLine1] with a well-typed [String] + * You should usually call [Builder.currency] 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 currency(currency: JsonField) = apply { + this.currency = currency } - /** The postal code of the address on file for the cardholder. */ - fun actualPostalCode(actualPostalCode: String?) = - actualPostalCode(JsonField.ofNullable(actualPostalCode)) + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * Alias for calling [Builder.actualPostalCode] with - * `actualPostalCode.orElse(null)`. - */ - fun actualPostalCode(actualPostalCode: Optional) = - actualPostalCode(actualPostalCode.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.actualPostalCode] to an arbitrary JSON value. + * Returns an immutable instance of [Transit]. * - * 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. + * 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 actualPostalCode(actualPostalCode: JsonField) = apply { - this.actualPostalCode = actualPostalCode + fun build(): Transit = + Transit( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Transit = apply { + if (validated) { + return@apply } - /** - * The cardholder address line 1 provided for verification in the - * authorization request. - */ - fun providedLine1(providedLine1: String?) = - providedLine1(JsonField.ofNullable(providedLine1)) + amount() + currency() + validated = true + } - /** - * Alias for calling [Builder.providedLine1] with - * `providedLine1.orElse(null)`. - */ - fun providedLine1(providedLine1: Optional) = - providedLine1(providedLine1.getOrNull()) + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Transit && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Transit{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** An unknown additional amount. */ + class Unknown + 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 amount in minor units of the `currency` field. + * + * @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 + * additional amount'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(): String = 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 { /** - * Sets [Builder.providedLine1] to an arbitrary JSON value. + * Returns a mutable builder for constructing an instance of [Unknown]. * - * 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. + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` */ - fun providedLine1(providedLine1: JsonField) = apply { - this.providedLine1 = providedLine1 + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Unknown]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(unknown: Unknown) = apply { + amount = unknown.amount + currency = unknown.currency + additionalProperties = unknown.additionalProperties.toMutableMap() } - /** - * The postal code provided for verification in the authorization request. - */ - fun providedPostalCode(providedPostalCode: String?) = - providedPostalCode(JsonField.ofNullable(providedPostalCode)) + /** The amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) /** - * Alias for calling [Builder.providedPostalCode] with - * `providedPostalCode.orElse(null)`. + * 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 providedPostalCode(providedPostalCode: Optional) = - providedPostalCode(providedPostalCode.getOrNull()) + fun amount(amount: JsonField) = apply { this.amount = amount } /** - * 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. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. */ - 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)) + fun currency(currency: String) = currency(JsonField.of(currency)) /** - * Sets [Builder.result] to an arbitrary JSON value. + * Sets [Builder.currency] 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 + * You should usually call [Builder.currency] with a well-typed [String] + * 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 currency(currency: JsonField) = apply { + this.currency = currency + } fun additionalProperties(additionalProperties: Map) = apply { @@ -15444,44 +16498,35 @@ private constructor( } /** - * Returns an immutable instance of [CardholderAddress]. + * Returns an immutable instance of [Unknown]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .actualLine1() - * .actualPostalCode() - * .providedLine1() - * .providedPostalCode() - * .result() + * .amount() + * .currency() * ``` * * @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), + fun build(): Unknown = + Unknown( + checkRequired("amount", amount), + checkRequired("currency", currency), additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): CardholderAddress = apply { + fun validate(): Unknown = apply { if (validated) { return@apply } - actualLine1() - actualPostalCode() - providedLine1() - providedPostalCode() - result().validate() + amount() + currency() validated = true } @@ -15501,219 +16546,242 @@ private constructor( */ @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) + (if (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) - /** 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 /* spotless:off */ other is Unknown && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } - companion object { + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ - /** No address was provided in the authorization request. */ - @JvmField val NOT_CHECKED = of("not_checked") + override fun hashCode(): Int = hashCode - /** Postal code matches, but the street address was not verified. */ - @JvmField - val POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED = - of("postal_code_match_address_not_checked") + override fun toString() = + "Unknown{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } - /** Postal code matches, but the street address does not match. */ - @JvmField - val POSTAL_CODE_MATCH_ADDRESS_NO_MATCH = - of("postal_code_match_address_no_match") + /** The part of this transaction amount that was for vision-related services. */ + class Vision + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { - /** Postal code does not match, but the street address matches. */ - @JvmField - val POSTAL_CODE_NO_MATCH_ADDRESS_MATCH = - of("postal_code_no_match_address_match") + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) - /** Postal code and street address match. */ - @JvmField val MATCH = of("match") + /** + * The amount in minor units of the `currency` field. + * + * @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") - /** Postal code and street address do not match. */ - @JvmField val NO_MATCH = of("no_match") + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount'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(): String = currency.getRequired("currency") - @JvmStatic fun of(value: String) = Result(JsonField.of(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 - /** An enum containing [Result]'s known values. */ - enum class Known { - /** No address was provided in the authorization request. */ - NOT_CHECKED, - /** Postal code matches, but the street address was not verified. */ - POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED, - /** Postal code matches, but the street address does not match. */ - POSTAL_CODE_MATCH_ADDRESS_NO_MATCH, - /** Postal code does not match, but the street address matches. */ - POSTAL_CODE_NO_MATCH_ADDRESS_MATCH, - /** Postal code and street address match. */ - MATCH, - /** Postal code and street address do not match. */ - NO_MATCH, - } + /** + * 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 { /** - * An enum containing [Result]'s known values, as well as an [_UNKNOWN] - * member. + * Returns a mutable builder for constructing an instance of [Vision]. * - * 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. + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` */ - enum class Value { - /** No address was provided in the authorization request. */ - NOT_CHECKED, - /** Postal code matches, but the street address was not verified. */ - POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED, - /** Postal code matches, but the street address does not match. */ - POSTAL_CODE_MATCH_ADDRESS_NO_MATCH, - /** Postal code does not match, but the street address matches. */ - POSTAL_CODE_NO_MATCH_ADDRESS_MATCH, - /** Postal code and street address match. */ - MATCH, - /** Postal code and street address do not match. */ - NO_MATCH, - /** - * An enum member indicating that [Result] was instantiated with an - * unknown value. - */ - _UNKNOWN, + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Vision]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(vision: Vision) = apply { + amount = vision.amount + currency = vision.currency + additionalProperties = vision.additionalProperties.toMutableMap() } + /** The amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) + /** - * 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.amount] 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.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 value(): Value = - when (this) { - NOT_CHECKED -> Value.NOT_CHECKED - POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED -> - Value.POSTAL_CODE_MATCH_ADDRESS_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 - else -> Value._UNKNOWN - } + fun amount(amount: JsonField) = apply { this.amount = 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. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. */ - fun known(): Known = - when (this) { - NOT_CHECKED -> Known.NOT_CHECKED - POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED -> - Known.POSTAL_CODE_MATCH_ADDRESS_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 - else -> throw IncreaseInvalidDataException("Unknown Result: $value") - } + fun currency(currency: String) = currency(JsonField.of(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. + * Sets [Builder.currency] 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.currency] 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") + fun currency(currency: JsonField) = apply { + this.currency = currency + } + + 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(): Result = 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 [Vision]. * - * Used for best match union deserialization. + * 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. */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + fun build(): Vision = + Vision( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + private var validated: Boolean = false - return /* spotless:off */ other is Result && value == other.value /* spotless:on */ + fun validate(): Vision = apply { + if (validated) { + return@apply } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CardholderAddress && actualLine1 == other.actualLine1 && actualPostalCode == other.actualPostalCode && providedLine1 == other.providedLine1 && providedPostalCode == other.providedPostalCode && result == other.result && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Vision && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(actualLine1, actualPostalCode, providedLine1, providedPostalCode, result, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CardholderAddress{actualLine1=$actualLine1, actualPostalCode=$actualPostalCode, providedLine1=$providedLine1, providedPostalCode=$providedPostalCode, result=$result, additionalProperties=$additionalProperties}" + "Vision{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -15721,526 +16789,22 @@ private constructor( return true } - return /* spotless:off */ other is Verification && cardVerificationCode == other.cardVerificationCode && cardholderAddress == other.cardholderAddress && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AdditionalAmounts && clinic == other.clinic && dental == other.dental && prescription == other.prescription && surcharge == other.surcharge && totalCumulative == other.totalCumulative && totalHealthcare == other.totalHealthcare && transit == other.transit && unknown == other.unknown && vision == other.vision && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cardVerificationCode, cardholderAddress, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(clinic, dental, prescription, surcharge, totalCumulative, totalHealthcare, transit, unknown, vision, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Verification{cardVerificationCode=$cardVerificationCode, cardholderAddress=$cardholderAddress, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is CardDecline && id == other.id && actioner == other.actioner && amount == other.amount && cardPaymentId == other.cardPaymentId && currency == other.currency && declinedTransactionId == other.declinedTransactionId && 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 && realTimeDecisionReason == other.realTimeDecisionReason && reason == other.reason && terminalId == other.terminalId && verification == other.verification && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, actioner, amount, cardPaymentId, currency, declinedTransactionId, digitalWalletTokenId, direction, merchantAcceptorId, merchantCategoryCode, merchantCity, merchantCountry, merchantDescriptor, merchantPostalCode, merchantState, networkDetails, networkIdentifiers, networkRiskScore, physicalCardId, presentmentAmount, presentmentCurrency, processingCategory, realTimeDecisionId, realTimeDecisionReason, reason, terminalId, verification, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "CardDecline{id=$id, actioner=$actioner, amount=$amount, cardPaymentId=$cardPaymentId, currency=$currency, declinedTransactionId=$declinedTransactionId, 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, realTimeDecisionReason=$realTimeDecisionReason, reason=$reason, terminalId=$terminalId, 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 - 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, - ) { - - @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("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - @JsonProperty("updated_authorization_amount") - @ExcludeMissing - updatedAuthorizationAmount: JsonField = JsonMissing.of(), - ) : this( - id, - cardAuthorizationId, - currency, - network, - networkIdentifiers, - pendingTransactionId, - 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") - - /** - * 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 - - /** - * 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 - - /** - * 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 [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 - - /** - * 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 [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 - - @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 [CardFuelConfirmation]. - * - * The following fields are required: - * ```java - * .id() - * .cardAuthorizationId() - * .currency() - * .network() - * .networkIdentifiers() - * .pendingTransactionId() - * .type() - * .updatedAuthorizationAmount() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CardFuelConfirmation]. */ - class Builder internal constructor() { - - 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() - - @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() - } - - /** The Card Fuel Confirmation 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 identifier for the Card Authorization this updates. */ - fun cardAuthorizationId(cardAuthorizationId: String) = - cardAuthorizationId(JsonField.of(cardAuthorizationId)) - - /** - * 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 - } - - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the increment'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 } - - /** The card network used to process this card authorization. */ - fun network(network: Network) = network(JsonField.of(network)) - - /** - * 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 } - - /** 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 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)`. - */ - fun pendingTransactionId(pendingTransactionId: Optional) = - pendingTransactionId(pendingTransactionId.getOrNull()) - - /** - * 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 - } - - /** - * 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)) - - /** - * 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 } - - /** - * 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)) - - /** - * 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) - } - - 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 [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() - * ``` - * - * @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("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 + "AdditionalAmounts{clinic=$clinic, dental=$dental, prescription=$prescription, surcharge=$surcharge, totalCumulative=$totalCumulative, totalHealthcare=$totalHealthcare, transit=$transit, unknown=$unknown, vision=$vision, additionalProperties=$additionalProperties}" } - 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. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the destination + * account currency. */ class Currency @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -16415,12 +16979,15 @@ 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 { - - /** - * Returns this class instance's raw value. + /** + * The direction describes the direction the funds will move, either from the cardholder + * to the merchant or from the merchant to the cardholder. + */ + class Direction @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 @@ -16431,32 +16998,48 @@ private constructor( companion object { - /** Visa */ - @JvmField val VISA = of("visa") + /** A regular card authorization where funds are debited from the cardholder. */ + @JvmField val SETTLEMENT = of("settlement") - @JvmStatic fun of(value: String) = Network(JsonField.of(value)) + /** + * A refund card authorization, sometimes referred to as a credit voucher + * authorization, where funds are credited to the cardholder. + */ + @JvmField val REFUND = of("refund") + + @JvmStatic fun of(value: String) = Direction(JsonField.of(value)) } - /** An enum containing [Network]'s known values. */ + /** An enum containing [Direction]'s known values. */ enum class Known { - /** Visa */ - VISA + /** A regular card authorization where funds are debited from the cardholder. */ + SETTLEMENT, + /** + * A refund card authorization, sometimes referred to as a credit voucher + * authorization, where funds are credited to the cardholder. + */ + REFUND, } /** - * An enum containing [Network]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [Direction]'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 [Direction] 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, + /** A regular card authorization where funds are debited from the cardholder. */ + SETTLEMENT, /** - * An enum member indicating that [Network] was instantiated with an unknown + * A refund card authorization, sometimes referred to as a credit voucher + * authorization, where funds are credited to the cardholder. + */ + REFUND, + /** + * An enum member indicating that [Direction] was instantiated with an unknown * value. */ _UNKNOWN, @@ -16471,7 +17054,8 @@ private constructor( */ fun value(): Value = when (this) { - VISA -> Value.VISA + SETTLEMENT -> Value.SETTLEMENT + REFUND -> Value.REFUND else -> Value._UNKNOWN } @@ -16486,8 +17070,9 @@ private constructor( */ fun known(): Known = when (this) { - VISA -> Known.VISA - else -> throw IncreaseInvalidDataException("Unknown Network: $value") + SETTLEMENT -> Known.SETTLEMENT + REFUND -> Known.REFUND + else -> throw IncreaseInvalidDataException("Unknown Direction: $value") } /** @@ -16506,7 +17091,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Network = apply { + fun validate(): Direction = apply { if (validated) { return@apply } @@ -16536,7 +17121,7 @@ private constructor( return true } - return /* spotless:off */ other is Network && value == other.value /* spotless:on */ + return /* spotless:off */ other is Direction && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -16544,86 +17129,56 @@ private constructor( override fun toString() = value.toString() } - /** Network-specific identifiers for a specific request or transaction. */ - class NetworkIdentifiers + /** Fields specific to the `network`. */ + class NetworkDetails private constructor( - private val retrievalReferenceNumber: JsonField, - private val traceNumber: JsonField, - private val transactionId: JsonField, + private val category: JsonField, + private val visa: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("retrieval_reference_number") - @ExcludeMissing - retrievalReferenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("trace_number") - @ExcludeMissing - traceNumber: JsonField = JsonMissing.of(), - @JsonProperty("transaction_id") + @JsonProperty("category") @ExcludeMissing - transactionId: JsonField = JsonMissing.of(), - ) : this(retrievalReferenceNumber, traceNumber, transactionId, mutableMapOf()) - - /** - * 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") + category: JsonField = JsonMissing.of(), + @JsonProperty("visa") @ExcludeMissing visa: JsonField = JsonMissing.of(), + ) : this(category, visa, mutableMapOf()) /** - * A counter used to verify an individual authorization. Expected to be unique per - * acquirer within a window of time. + * The payment network used to process this card authorization. * - * @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 traceNumber(): Optional = traceNumber.getOptional("trace_number") + fun category(): Category = category.getRequired("category") /** - * A globally unique transaction identifier provided by the card network, used - * across multiple life-cycle requests. + * Fields specific to the `visa` network. * * @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 [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 + fun visa(): Optional = visa.getOptional("visa") /** - * Returns the raw JSON value of [traceNumber]. + * Returns the raw JSON value of [category]. * - * Unlike [traceNumber], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [category], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("trace_number") + @JsonProperty("category") @ExcludeMissing - fun _traceNumber(): JsonField = traceNumber + fun _category(): JsonField = category /** - * Returns the raw JSON value of [transactionId]. + * Returns the raw JSON value of [visa]. * - * Unlike [transactionId], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [visa], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("transaction_id") - @ExcludeMissing - fun _transactionId(): JsonField = transactionId + @JsonProperty("visa") @ExcludeMissing fun _visa(): JsonField = visa @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -16640,108 +17195,57 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [NetworkIdentifiers]. + * Returns a mutable builder for constructing an instance of [NetworkDetails]. * * The following fields are required: * ```java - * .retrievalReferenceNumber() - * .traceNumber() - * .transactionId() + * .category() + * .visa() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [NetworkIdentifiers]. */ + /** A builder for [NetworkDetails]. */ class Builder internal constructor() { - private var retrievalReferenceNumber: JsonField? = null - private var traceNumber: JsonField? = null - private var transactionId: JsonField? = null + private var category: JsonField? = null + private var visa: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(networkIdentifiers: NetworkIdentifiers) = apply { - retrievalReferenceNumber = networkIdentifiers.retrievalReferenceNumber - traceNumber = networkIdentifiers.traceNumber - transactionId = networkIdentifiers.transactionId - additionalProperties = - networkIdentifiers.additionalProperties.toMutableMap() + internal fun from(networkDetails: NetworkDetails) = apply { + category = networkDetails.category + visa = networkDetails.visa + additionalProperties = networkDetails.additionalProperties.toMutableMap() } - /** - * 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()) + /** The payment network used to process this card authorization. */ + fun category(category: Category) = category(JsonField.of(category)) /** - * Sets [Builder.traceNumber] to an arbitrary JSON value. + * Sets [Builder.category] 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. + * 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 traceNumber(traceNumber: JsonField) = apply { - this.traceNumber = traceNumber - } + fun category(category: JsonField) = apply { this.category = category } - /** - * A globally unique transaction identifier provided by the card network, used - * across multiple life-cycle requests. - */ - fun transactionId(transactionId: String?) = - transactionId(JsonField.ofNullable(transactionId)) + /** Fields specific to the `visa` network. */ + fun visa(visa: Visa?) = visa(JsonField.ofNullable(visa)) - /** - * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`. - */ - fun transactionId(transactionId: Optional) = - transactionId(transactionId.getOrNull()) + /** Alias for calling [Builder.visa] with `visa.orElse(null)`. */ + fun visa(visa: Optional) = visa(visa.getOrNull()) /** - * Sets [Builder.transactionId] to an arbitrary JSON value. + * Sets [Builder.visa] 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.visa] with a well-typed [Visa] 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 visa(visa: JsonField) = apply { this.visa = visa } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -16766,38 +17270,35 @@ private constructor( } /** - * Returns an immutable instance of [NetworkIdentifiers]. + * Returns an immutable instance of [NetworkDetails]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .retrievalReferenceNumber() - * .traceNumber() - * .transactionId() + * .category() + * .visa() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): NetworkIdentifiers = - NetworkIdentifiers( - checkRequired("retrievalReferenceNumber", retrievalReferenceNumber), - checkRequired("traceNumber", traceNumber), - checkRequired("transactionId", transactionId), + fun build(): NetworkDetails = + NetworkDetails( + checkRequired("category", category), + checkRequired("visa", visa), additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): NetworkIdentifiers = apply { + fun validate(): NetworkDetails = apply { if (validated) { return@apply } - retrievalReferenceNumber() - traceNumber() - transactionId() + category().validate() + visa().ifPresent { it.validate() } validated = true } @@ -16817,1323 +17318,1302 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (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 /* spotless:off */ other is NetworkIdentifiers && retrievalReferenceNumber == other.retrievalReferenceNumber && traceNumber == other.traceNumber && transactionId == other.transactionId && additionalProperties == other.additionalProperties /* spotless:on */ - } + (category.asKnown().getOrNull()?.validity() ?: 0) + + (visa.asKnown().getOrNull()?.validity() ?: 0) - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(retrievalReferenceNumber, traceNumber, transactionId, additionalProperties) } - /* spotless:on */ + /** The payment network used to process this card authorization. */ + class Category + @JsonCreator + private constructor(private val value: JsonField) : Enum { - override fun hashCode(): Int = hashCode + /** + * 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 toString() = - "NetworkIdentifiers{retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}" - } + companion object { - /** - * A constant representing the object's type. For this resource it will always be - * `card_fuel_confirmation`. - */ - class Type @JsonCreator private constructor(private val value: JsonField) : - Enum { + /** Visa */ + @JvmField val VISA = of("visa") - /** - * 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) = Category(JsonField.of(value)) + } - companion object { + /** An enum containing [Category]'s known values. */ + enum class Known { + /** Visa */ + VISA + } - @JvmField val CARD_FUEL_CONFIRMATION = of("card_fuel_confirmation") + /** + * 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, + /** + * An enum member indicating that [Category] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - @JvmStatic fun of(value: String) = Type(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) { + VISA -> Value.VISA + else -> Value._UNKNOWN + } - /** An enum containing [Type]'s known values. */ - enum class Known { - CARD_FUEL_CONFIRMATION - } + /** + * 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 + else -> throw IncreaseInvalidDataException("Unknown Category: $value") + } - /** - * 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_FUEL_CONFIRMATION, /** - * An enum member indicating that [Type] 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) { - CARD_FUEL_CONFIRMATION -> Value.CARD_FUEL_CONFIRMATION - 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) { - CARD_FUEL_CONFIRMATION -> Known.CARD_FUEL_CONFIRMATION - else -> throw IncreaseInvalidDataException("Unknown Type: $value") - } + fun validate(): Category = 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(): Type = 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 /* spotless:off */ other is Category && value == other.value /* spotless:on */ } - /** - * 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() - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + override fun toString() = value.toString() } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** Fields specific to the `visa` network. */ + class Visa + private constructor( + private val electronicCommerceIndicator: JsonField, + private val pointOfServiceEntryMode: JsonField, + private val standInProcessingReason: JsonField, + private val additionalProperties: MutableMap, + ) { - return /* spotless:off */ other is CardFuelConfirmation && id == other.id && cardAuthorizationId == other.cardAuthorizationId && currency == other.currency && network == other.network && networkIdentifiers == other.networkIdentifiers && pendingTransactionId == other.pendingTransactionId && type == other.type && updatedAuthorizationAmount == other.updatedAuthorizationAmount && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, cardAuthorizationId, currency, network, networkIdentifiers, pendingTransactionId, type, updatedAuthorizationAmount, additionalProperties) } - /* spotless:on */ - - 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}" - } - - /** - * A Card Increment object. This field will be present in the JSON response if and only if - * `category` is equal to `card_increment`. Card Increments increase the pending amount of - * an authorized transaction. - */ - class CardIncrement - private constructor( - private val id: JsonField, - private val actioner: JsonField, - private val amount: JsonField, - private val cardAuthorizationId: JsonField, - private val currency: JsonField, - private val network: JsonField, - private val networkIdentifiers: JsonField, - private val networkRiskScore: JsonField, - private val pendingTransactionId: JsonField, - private val realTimeDecisionId: JsonField, - private val type: JsonField, - private val updatedAuthorizationAmount: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("actioner") - @ExcludeMissing - actioner: JsonField = JsonMissing.of(), - @JsonProperty("amount") @ExcludeMissing amount: 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("network_risk_score") - @ExcludeMissing - networkRiskScore: JsonField = JsonMissing.of(), - @JsonProperty("pending_transaction_id") - @ExcludeMissing - pendingTransactionId: JsonField = JsonMissing.of(), - @JsonProperty("real_time_decision_id") - @ExcludeMissing - realTimeDecisionId: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - @JsonProperty("updated_authorization_amount") - @ExcludeMissing - updatedAuthorizationAmount: JsonField = JsonMissing.of(), - ) : this( - id, - actioner, - amount, - cardAuthorizationId, - currency, - network, - networkIdentifiers, - networkRiskScore, - pendingTransactionId, - realTimeDecisionId, - type, - updatedAuthorizationAmount, - mutableMapOf(), - ) + @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(), + ) : this( + electronicCommerceIndicator, + pointOfServiceEntryMode, + standInProcessingReason, + mutableMapOf(), + ) - /** - * The Card Increment 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") + /** + * 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") - /** - * Whether this authorization was approved by Increase, the card network through - * stand-in processing, or the user through a real-time decision. - * - * @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 actioner(): Actioner = actioner.getRequired("actioner") + /** + * 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") - /** - * The amount of this increment 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") + /** + * 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 identifier for the Card Authorization this increments. - * - * @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") + /** + * 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 - /** - * 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 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 - /** - * 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") + /** + * 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 - /** - * 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") + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - /** - * 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. - * - * @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") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** - * The identifier of the Pending Transaction associated with this Card Increment. - * - * @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") + fun toBuilder() = Builder().from(this) - /** - * The identifier of the Real-Time Decision sent to approve or decline this incremental - * authorization. - * - * @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") + companion object { - /** - * A constant representing the object's type. For this resource it will always be - * `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 type(): Type = type.getRequired("type") + /** + * Returns a mutable builder for constructing an instance of [Visa]. + * + * The following fields are required: + * ```java + * .electronicCommerceIndicator() + * .pointOfServiceEntryMode() + * .standInProcessingReason() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - /** - * The updated authorization amount after this increment, 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") + /** A builder for [Visa]. */ + class Builder internal constructor() { - /** - * 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 var electronicCommerceIndicator: + JsonField? = + null + private var pointOfServiceEntryMode: JsonField? = + null + private var standInProcessingReason: JsonField? = + null + private var additionalProperties: MutableMap = + mutableMapOf() - /** - * Returns the raw JSON value of [actioner]. - * - * Unlike [actioner], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("actioner") - @ExcludeMissing - fun _actioner(): JsonField = actioner + @JvmSynthetic + internal fun from(visa: Visa) = apply { + electronicCommerceIndicator = visa.electronicCommerceIndicator + pointOfServiceEntryMode = visa.pointOfServiceEntryMode + standInProcessingReason = visa.standInProcessingReason + additionalProperties = visa.additionalProperties.toMutableMap() + } - /** - * 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 + /** + * 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) + ) - /** - * 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 + /** + * Alias for calling [Builder.electronicCommerceIndicator] with + * `electronicCommerceIndicator.orElse(null)`. + */ + fun electronicCommerceIndicator( + electronicCommerceIndicator: Optional + ) = electronicCommerceIndicator(electronicCommerceIndicator.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.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 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 + /** + * The method used to enter the cardholder's primary account number and card + * expiration date. + */ + fun pointOfServiceEntryMode( + pointOfServiceEntryMode: PointOfServiceEntryMode? + ) = pointOfServiceEntryMode(JsonField.ofNullable(pointOfServiceEntryMode)) - /** - * 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 + /** + * Alias for calling [Builder.pointOfServiceEntryMode] with + * `pointOfServiceEntryMode.orElse(null)`. + */ + fun pointOfServiceEntryMode( + pointOfServiceEntryMode: Optional + ) = pointOfServiceEntryMode(pointOfServiceEntryMode.getOrNull()) - /** - * 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 + /** + * 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 } - /** - * 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 + /** + * 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)) - /** - * 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 + /** + * Alias for calling [Builder.standInProcessingReason] with + * `standInProcessingReason.orElse(null)`. + */ + fun standInProcessingReason( + standInProcessingReason: Optional + ) = standInProcessingReason(standInProcessingReason.getOrNull()) - /** - * 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 + /** + * 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 } - /** - * 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 + 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 [CardIncrement]. - * - * The following fields are required: - * ```java - * .id() - * .actioner() - * .amount() - * .cardAuthorizationId() - * .currency() - * .network() - * .networkIdentifiers() - * .networkRiskScore() - * .pendingTransactionId() - * .realTimeDecisionId() - * .type() - * .updatedAuthorizationAmount() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + /** + * 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() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Visa = + Visa( + checkRequired( + "electronicCommerceIndicator", + electronicCommerceIndicator, + ), + checkRequired("pointOfServiceEntryMode", pointOfServiceEntryMode), + checkRequired("standInProcessingReason", standInProcessingReason), + additionalProperties.toMutableMap(), + ) + } - /** A builder for [CardIncrement]. */ - class Builder internal constructor() { + private var validated: Boolean = false - private var id: JsonField? = null - private var actioner: JsonField? = null - private var amount: JsonField? = null - private var cardAuthorizationId: JsonField? = null - private var currency: JsonField? = null - private var network: JsonField? = null - private var networkIdentifiers: JsonField? = null - private var networkRiskScore: JsonField? = null - private var pendingTransactionId: JsonField? = null - private var realTimeDecisionId: JsonField? = null - private var type: JsonField? = null - private var updatedAuthorizationAmount: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + fun validate(): Visa = apply { + if (validated) { + return@apply + } - @JvmSynthetic - internal fun from(cardIncrement: CardIncrement) = apply { - id = cardIncrement.id - actioner = cardIncrement.actioner - amount = cardIncrement.amount - cardAuthorizationId = cardIncrement.cardAuthorizationId - currency = cardIncrement.currency - network = cardIncrement.network - networkIdentifiers = cardIncrement.networkIdentifiers - networkRiskScore = cardIncrement.networkRiskScore - pendingTransactionId = cardIncrement.pendingTransactionId - realTimeDecisionId = cardIncrement.realTimeDecisionId - type = cardIncrement.type - updatedAuthorizationAmount = cardIncrement.updatedAuthorizationAmount - additionalProperties = cardIncrement.additionalProperties.toMutableMap() - } + electronicCommerceIndicator().ifPresent { it.validate() } + pointOfServiceEntryMode().ifPresent { it.validate() } + standInProcessingReason().ifPresent { it.validate() } + validated = true + } - /** The Card Increment 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. - * - * 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 } + /** + * 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) - /** - * Whether this authorization was approved by Increase, the card network through - * stand-in processing, or the user through a real-time decision. - */ - fun actioner(actioner: Actioner) = actioner(JsonField.of(actioner)) + /** + * 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 { - /** - * Sets [Builder.actioner] to an arbitrary JSON value. - * - * You should usually call [Builder.actioner] with a well-typed [Actioner] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun actioner(actioner: JsonField) = apply { this.actioner = actioner } + /** + * 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 amount of this increment in the minor unit of the transaction's currency. For - * dollars, for example, this is cents. - */ - fun amount(amount: Long) = amount(JsonField.of(amount)) + companion object { - /** - * 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 } + /** + * 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") - /** The identifier for the Card Authorization this increments. */ - fun cardAuthorizationId(cardAuthorizationId: String) = - cardAuthorizationId(JsonField.of(cardAuthorizationId)) + /** + * Recurring transaction: Payment indicator used to indicate a recurring + * transaction that originates from an acquirer in the US region. + */ + @JvmField val RECURRING = of("recurring") - /** - * 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 - } + /** + * 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") - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the increment's - * currency. - */ - fun currency(currency: Currency) = currency(JsonField.of(currency)) + /** + * 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") - /** - * 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 } + /** + * 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") - /** The card network used to process this card authorization. */ - fun network(network: Network) = network(JsonField.of(network)) + /** + * 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") - /** - * 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 } + /** + * 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") - /** Network-specific identifiers for a specific request or transaction. */ - fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) = - networkIdentifiers(JsonField.of(networkIdentifiers)) + /** + * Non-secure transaction: Use to identify an electronic commerce + * transaction that has no data protection. + */ + @JvmField val NON_SECURE_TRANSACTION = of("non_secure_transaction") - /** - * 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 - } + @JvmStatic + fun of(value: String) = ElectronicCommerceIndicator(JsonField.of(value)) + } - /** - * 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. - */ - fun networkRiskScore(networkRiskScore: Long?) = - networkRiskScore(JsonField.ofNullable(networkRiskScore)) + /** 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, + } - /** - * Alias for [Builder.networkRiskScore]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun networkRiskScore(networkRiskScore: Long) = - networkRiskScore(networkRiskScore as Long?) + /** + * 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, + } - /** - * Alias for calling [Builder.networkRiskScore] with - * `networkRiskScore.orElse(null)`. - */ - fun networkRiskScore(networkRiskScore: Optional) = - networkRiskScore(networkRiskScore.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) { + 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 + } - /** - * 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 - } + /** + * 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" + ) + } - /** - * The identifier of the Pending Transaction associated with this Card Increment. - */ - fun pendingTransactionId(pendingTransactionId: String?) = - pendingTransactionId(JsonField.ofNullable(pendingTransactionId)) + /** + * 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.pendingTransactionId] with - * `pendingTransactionId.orElse(null)`. - */ - fun pendingTransactionId(pendingTransactionId: Optional) = - pendingTransactionId(pendingTransactionId.getOrNull()) + private var validated: Boolean = false - /** - * 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 - } + fun validate(): ElectronicCommerceIndicator = apply { + if (validated) { + return@apply + } - /** - * The identifier of the Real-Time Decision sent to approve or decline this - * incremental authorization. - */ - fun realTimeDecisionId(realTimeDecisionId: String?) = - realTimeDecisionId(JsonField.ofNullable(realTimeDecisionId)) + known() + validated = true + } - /** - * Alias for calling [Builder.realTimeDecisionId] with - * `realTimeDecisionId.orElse(null)`. - */ - fun realTimeDecisionId(realTimeDecisionId: Optional) = - realTimeDecisionId(realTimeDecisionId.getOrNull()) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * 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 - } + /** + * 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 constant representing the object's type. For this resource it will always be - * `card_increment`. - */ - fun type(type: Type) = type(JsonField.of(type)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * 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 } + return /* spotless:off */ other is ElectronicCommerceIndicator && value == other.value /* spotless:on */ + } - /** - * The updated authorization amount after this increment, in the minor unit of the - * transaction's currency. For dollars, for example, this is cents. - */ - fun updatedAuthorizationAmount(updatedAuthorizationAmount: Long) = - updatedAuthorizationAmount(JsonField.of(updatedAuthorizationAmount)) + override fun hashCode() = value.hashCode() - /** - * 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 + override fun toString() = value.toString() } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** + * 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 { - 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) - } + /** Unknown */ + @JvmField val UNKNOWN = of("unknown") - /** - * Returns an immutable instance of [CardIncrement]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .actioner() - * .amount() - * .cardAuthorizationId() - * .currency() - * .network() - * .networkIdentifiers() - * .networkRiskScore() - * .pendingTransactionId() - * .realTimeDecisionId() - * .type() - * .updatedAuthorizationAmount() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CardIncrement = - CardIncrement( - checkRequired("id", id), - checkRequired("actioner", actioner), - checkRequired("amount", amount), - checkRequired("cardAuthorizationId", cardAuthorizationId), - checkRequired("currency", currency), - checkRequired("network", network), - checkRequired("networkIdentifiers", networkIdentifiers), - checkRequired("networkRiskScore", networkRiskScore), - checkRequired("pendingTransactionId", pendingTransactionId), - checkRequired("realTimeDecisionId", realTimeDecisionId), - checkRequired("type", type), - checkRequired("updatedAuthorizationAmount", updatedAuthorizationAmount), - additionalProperties.toMutableMap(), - ) - } + /** Manual key entry */ + @JvmField val MANUAL = of("manual") - private var validated: Boolean = false + /** Magnetic stripe read, without card verification value */ + @JvmField val MAGNETIC_STRIPE_NO_CVV = of("magnetic_stripe_no_cvv") - fun validate(): CardIncrement = apply { - if (validated) { - return@apply - } + /** Optical code */ + @JvmField val OPTICAL_CODE = of("optical_code") - id() - actioner().validate() - amount() - cardAuthorizationId() - currency().validate() - network().validate() - networkIdentifiers().validate() - networkRiskScore() - pendingTransactionId() - realTimeDecisionId() - type().validate() - updatedAuthorizationAmount() - validated = true - } + /** Contact chip card */ + @JvmField val INTEGRATED_CIRCUIT_CARD = of("integrated_circuit_card") - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** Contactless read of chip card */ + @JvmField val CONTACTLESS = of("contactless") - /** - * 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) + - (actioner.asKnown().getOrNull()?.validity() ?: 0) + - (if (amount.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 (networkRiskScore.asKnown().isPresent) 1 else 0) + - (if (pendingTransactionId.asKnown().isPresent) 1 else 0) + - (if (realTimeDecisionId.asKnown().isPresent) 1 else 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) + - (if (updatedAuthorizationAmount.asKnown().isPresent) 1 else 0) + /** + * Transaction initiated using a credential that has previously been + * stored on file + */ + @JvmField val CREDENTIAL_ON_FILE = of("credential_on_file") - /** - * Whether this authorization was approved by Increase, the card network through - * stand-in processing, or the user through a real-time decision. - */ - class Actioner @JsonCreator private constructor(private val value: JsonField) : - Enum { + /** Magnetic stripe read */ + @JvmField val MAGNETIC_STRIPE = of("magnetic_stripe") - /** - * 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 + /** Contactless read of magnetic stripe data */ + @JvmField + val CONTACTLESS_MAGNETIC_STRIPE = of("contactless_magnetic_stripe") - companion object { + /** Contact chip card, without card verification value */ + @JvmField + val INTEGRATED_CIRCUIT_CARD_NO_CVV = + of("integrated_circuit_card_no_cvv") - /** This object was actioned by the user through a real-time decision. */ - @JvmField val USER = of("user") + @JvmStatic + fun of(value: String) = PointOfServiceEntryMode(JsonField.of(value)) + } - /** This object was actioned by Increase without user intervention. */ - @JvmField val INCREASE = of("increase") + /** 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, + } - /** This object was actioned by the network, through stand-in processing. */ - @JvmField val NETWORK = of("network") + /** + * 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, + } - @JvmStatic fun of(value: String) = Actioner(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) { + 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 + } - /** An enum containing [Actioner]'s known values. */ - enum class Known { - /** This object was actioned by the user through a real-time decision. */ - USER, - /** This object was actioned by Increase without user intervention. */ - INCREASE, - /** This object was actioned by the network, through stand-in processing. */ - NETWORK, - } + /** + * 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" + ) + } - /** - * An enum containing [Actioner]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Actioner] 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 { - /** This object was actioned by the user through a real-time decision. */ - USER, - /** This object was actioned by Increase without user intervention. */ - INCREASE, - /** This object was actioned by the network, through stand-in processing. */ - NETWORK, - /** - * An enum member indicating that [Actioner] was instantiated with an unknown - * 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, 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) { - USER -> Value.USER - INCREASE -> Value.INCREASE - NETWORK -> Value.NETWORK - 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) { - USER -> Known.USER - INCREASE -> Known.INCREASE - NETWORK -> Known.NETWORK - else -> throw IncreaseInvalidDataException("Unknown Actioner: $value") - } + fun validate(): PointOfServiceEntryMode = 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(): Actioner = 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 /* spotless:off */ other is PointOfServiceEntryMode && value == other.value /* spotless:on */ + } - /** - * 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 equals(other: Any?): Boolean { - if (this === other) { - return true + override fun toString() = value.toString() } - return /* spotless:off */ other is Actioner && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** - * 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 { - - /** - * 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 { - - /** Canadian Dollar (CAD) */ - @JvmField val CAD = of("CAD") - - /** Swiss Franc (CHF) */ - @JvmField val CHF = of("CHF") - - /** Euro (EUR) */ - @JvmField val EUR = of("EUR") - - /** British Pound (GBP) */ - @JvmField val GBP = of("GBP") - - /** Japanese Yen (JPY) */ - @JvmField val JPY = of("JPY") + /** + * 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 { - /** US Dollar (USD) */ - @JvmField val USD = of("USD") + /** + * 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) = Currency(JsonField.of(value)) - } + companion object { - /** An enum containing [Currency]'s known values. */ - enum class Known { - /** Canadian Dollar (CAD) */ - CAD, - /** Swiss Franc (CHF) */ - CHF, - /** Euro (EUR) */ - EUR, - /** British Pound (GBP) */ - GBP, - /** Japanese Yen (JPY) */ - JPY, - /** US Dollar (USD) */ - USD, - } + /** Increase failed to process the authorization in a timely manner. */ + @JvmField val ISSUER_ERROR = of("issuer_error") - /** - * 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 { - /** Canadian Dollar (CAD) */ - CAD, - /** Swiss Franc (CHF) */ - CHF, - /** Euro (EUR) */ - EUR, - /** British Pound (GBP) */ - GBP, - /** Japanese Yen (JPY) */ - JPY, - /** US Dollar (USD) */ - USD, - /** - * An enum member indicating that [Currency] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } + /** + * The physical card read had an invalid CVV, dCVV, or authorization + * request cryptogram. + */ + @JvmField val INVALID_PHYSICAL_CARD = of("invalid_physical_card") - /** - * 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) { - CAD -> Value.CAD - CHF -> Value.CHF - EUR -> Value.EUR - GBP -> Value.GBP - JPY -> Value.JPY - USD -> Value.USD - else -> Value._UNKNOWN - } + /** The 3DS cardholder authentication verification value was invalid. */ + @JvmField + val INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE = + of("invalid_cardholder_authentication_verification_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) { - CAD -> Known.CAD - CHF -> Known.CHF - EUR -> Known.EUR - GBP -> Known.GBP - JPY -> Known.JPY - USD -> Known.USD - else -> throw IncreaseInvalidDataException("Unknown Currency: $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") - /** - * 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 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 var validated: Boolean = false + /** + * 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") - fun validate(): Currency = apply { - if (validated) { - return@apply - } + /** An unspecific reason for stand-in processing. */ + @JvmField val OTHER = of("other") - known() - validated = true - } + @JvmStatic + fun of(value: String) = StandInProcessingReason(JsonField.of(value)) + } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** 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, dCVV, or authorization + * request cryptogram. + */ + INVALID_PHYSICAL_CARD, + /** 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 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 [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, dCVV, or authorization + * request cryptogram. + */ + INVALID_PHYSICAL_CARD, + /** 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, + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return 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) { + ISSUER_ERROR -> Value.ISSUER_ERROR + INVALID_PHYSICAL_CARD -> Value.INVALID_PHYSICAL_CARD + 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 + } - return /* spotless:off */ other is Currency && value == other.value /* spotless:on */ - } + /** + * 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_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" + ) + } - override fun hashCode() = value.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() = value.toString() - } + private var validated: Boolean = false - /** The card network used to process this card authorization. */ - class Network @JsonCreator private constructor(private val value: JsonField) : - Enum { + fun validate(): StandInProcessingReason = 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 + known() + validated = true + } - companion object { + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** Visa */ - @JvmField val VISA = of("visa") + /** + * 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 - @JvmStatic fun of(value: String) = Network(JsonField.of(value)) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** An enum containing [Network]'s known values. */ - enum class Known { - /** Visa */ - VISA - } + return /* spotless:off */ other is StandInProcessingReason && value == other.value /* spotless:on */ + } - /** - * 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, - /** - * An enum member indicating that [Network] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } + override fun hashCode() = value.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) { - VISA -> Value.VISA - else -> Value._UNKNOWN + override fun toString() = value.toString() } - /** - * 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 - else -> throw IncreaseInvalidDataException("Unknown Network: $value") - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return 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") + return /* spotless:off */ other is Visa && electronicCommerceIndicator == other.electronicCommerceIndicator && pointOfServiceEntryMode == other.pointOfServiceEntryMode && standInProcessingReason == other.standInProcessingReason && additionalProperties == other.additionalProperties /* spotless:on */ } - private var validated: Boolean = false + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(electronicCommerceIndicator, pointOfServiceEntryMode, standInProcessingReason, additionalProperties) } + /* spotless:on */ - fun validate(): Network = apply { - if (validated) { - return@apply - } + override fun hashCode(): Int = hashCode - known() - validated = true + override fun toString() = + "Visa{electronicCommerceIndicator=$electronicCommerceIndicator, pointOfServiceEntryMode=$pointOfServiceEntryMode, standInProcessingReason=$standInProcessingReason, additionalProperties=$additionalProperties}" } - 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 /* spotless:off */ other is Network && value == other.value /* spotless:on */ + return /* spotless:off */ other is NetworkDetails && category == other.category && visa == other.visa && additionalProperties == other.additionalProperties /* spotless:on */ } - override fun hashCode() = value.hashCode() + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(category, visa, additionalProperties) } + /* spotless:on */ - override fun toString() = value.toString() + override fun hashCode(): Int = hashCode + + override fun toString() = + "NetworkDetails{category=$category, visa=$visa, additionalProperties=$additionalProperties}" } /** Network-specific identifiers for a specific request or transaction. */ @@ -18432,11 +18912,12 @@ private constructor( } /** - * A constant representing the object's type. For this resource it will always be - * `card_increment`. + * The processing category describes the intent behind the authorization, such as + * whether it was used for bill payments or an automatic fuel dispenser. */ - class Type @JsonCreator private constructor(private val value: JsonField) : - Enum { + class ProcessingCategory + @JsonCreator + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -18450,29 +18931,139 @@ private constructor( companion object { - @JvmField val CARD_INCREMENT = of("card_increment") + /** + * Account funding transactions are transactions used to e.g., fund an account + * or transfer funds between accounts. + */ + @JvmField val ACCOUNT_FUNDING = of("account_funding") - @JvmStatic fun of(value: String) = Type(JsonField.of(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") + + /** 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") + + /** The processing category is unknown. */ + @JvmField val UNKNOWN = of("unknown") + + @JvmStatic fun of(value: String) = ProcessingCategory(JsonField.of(value)) } - /** An enum containing [Type]'s known values. */ + /** An enum containing [ProcessingCategory]'s known values. */ enum class Known { - CARD_INCREMENT + /** + * 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, + /** The processing category is unknown. */ + UNKNOWN, } /** - * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [ProcessingCategory]'s known values, as well as an [_UNKNOWN] + * member. * - * An instance of [Type] can contain an unknown value in a couple of cases: + * 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 { - CARD_INCREMENT, /** - * An enum member indicating that [Type] was instantiated with an unknown 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, + /** The processing category is unknown. */ + UNKNOWN, + /** + * An enum member indicating that [ProcessingCategory] was instantiated with an + * unknown value. */ _UNKNOWN, } @@ -18486,7 +19077,15 @@ private constructor( */ fun value(): Value = when (this) { - CARD_INCREMENT -> Value.CARD_INCREMENT + 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 + UNKNOWN -> Value.UNKNOWN else -> Value._UNKNOWN } @@ -18501,8 +19100,17 @@ private constructor( */ fun known(): Known = when (this) { - CARD_INCREMENT -> Known.CARD_INCREMENT - else -> throw IncreaseInvalidDataException("Unknown Type: $value") + 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 + UNKNOWN -> Known.UNKNOWN + else -> + throw IncreaseInvalidDataException("Unknown ProcessingCategory: $value") } /** @@ -18521,7 +19129,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Type = apply { + fun validate(): ProcessingCategory = apply { if (validated) { return@apply } @@ -18551,7 +19159,7 @@ private constructor( return true } - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + return /* spotless:off */ other is ProcessingCategory && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -18559,1165 +19167,719 @@ private constructor( override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is CardIncrement && id == other.id && actioner == other.actioner && amount == other.amount && cardAuthorizationId == other.cardAuthorizationId && currency == other.currency && network == other.network && networkIdentifiers == other.networkIdentifiers && networkRiskScore == other.networkRiskScore && pendingTransactionId == other.pendingTransactionId && realTimeDecisionId == other.realTimeDecisionId && type == other.type && updatedAuthorizationAmount == other.updatedAuthorizationAmount && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** 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 { - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, actioner, amount, cardAuthorizationId, currency, network, networkIdentifiers, networkRiskScore, pendingTransactionId, realTimeDecisionId, type, updatedAuthorizationAmount, additionalProperties) } - /* spotless:on */ + /** + * 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() = - "CardIncrement{id=$id, actioner=$actioner, amount=$amount, cardAuthorizationId=$cardAuthorizationId, currency=$currency, network=$network, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, pendingTransactionId=$pendingTransactionId, realTimeDecisionId=$realTimeDecisionId, type=$type, updatedAuthorizationAmount=$updatedAuthorizationAmount, additionalProperties=$additionalProperties}" - } + /** + * The cardholder does not have sufficient funds to cover the transaction. The + * merchant may attempt to process the transaction again. + */ + @JvmField val INSUFFICIENT_FUNDS = of("insufficient_funds") - /** - * 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 - 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, - ) { + /** + * This type of transaction is not allowed for this card. This transaction + * should not be retried. + */ + @JvmField val TRANSACTION_NEVER_ALLOWED = of("transaction_never_allowed") - @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 transaction amount exceeds the cardholder's approval limit. The merchant + * may attempt to process the transaction again. + */ + @JvmField val EXCEEDS_APPROVAL_LIMIT = of("exceeds_approval_limit") - /** - * 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") + /** + * The card has been temporarily disabled or not yet activated. The merchant may + * attempt to process the transaction again. + */ + @JvmField val CARD_TEMPORARILY_DISABLED = of("card_temporarily_disabled") - /** - * 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") + /** + * The transaction is suspected to be fraudulent. The merchant may attempt to + * process the transaction again. + */ + @JvmField val SUSPECTED_FRAUD = of("suspected_fraud") - /** - * 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 transaction was declined for another reason. The merchant may attempt to + * process the transaction again. This should be used sparingly. + */ + @JvmField val OTHER = of("other") - /** - * 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") + @JvmStatic fun of(value: String) = RealTimeDecisionReason(JsonField.of(value)) + } - /** - * 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") + /** 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. + */ + OTHER, + } - /** - * Interchange assessed as a part of this transaciton. - * - * @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") + /** + * 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, + } - /** - * 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") + /** + * 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 + } - /** - * 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") + /** + * 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" + ) + } - /** - * 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") - - /** - * 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 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") - - /** - * 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") - - /** - * 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 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") + } - /** - * 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(): RealTimeDecisionReason = 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") + known() + 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 (value() == Value._UNKNOWN) 0 else 1 - /** - * 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 equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * 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 + return /* spotless:off */ other is RealTimeDecisionReason && value == other.value /* spotless:on */ + } - /** - * 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 [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 + override fun toString() = value.toString() + } - /** - * 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 + /** Why the transaction was declined. */ + class Reason @JsonCreator private constructor(private val value: JsonField) : + Enum { - /** - * 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 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 [interchange]. - * - * Unlike [interchange], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("interchange") - @ExcludeMissing - fun _interchange(): JsonField = interchange + companion object { - /** - * 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 account has been closed. */ + @JvmField val ACCOUNT_CLOSED = of("account_closed") - /** - * 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 + /** The Card was not active. */ + @JvmField val CARD_NOT_ACTIVE = of("card_not_active") - /** - * 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 + /** The Card has been canceled. */ + @JvmField val CARD_CANCELED = of("card_canceled") - /** - * 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 + /** The Physical Card was not active. */ + @JvmField val PHYSICAL_CARD_NOT_ACTIVE = of("physical_card_not_active") - /** - * 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 + /** The account's entity was not active. */ + @JvmField val ENTITY_NOT_ACTIVE = of("entity_not_active") - /** - * 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 account was inactive. */ + @JvmField val GROUP_LOCKED = of("group_locked") - /** - * 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 + /** The Card's Account did not have a sufficient available balance. */ + @JvmField val INSUFFICIENT_FUNDS = of("insufficient_funds") - /** - * 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 + /** The given CVV2 did not match the card's value. */ + @JvmField val CVV2_MISMATCH = of("cvv2_mismatch") - /** - * 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 given PIN did not match the card's value. */ + @JvmField val PIN_MISMATCH = of("pin_mismatch") - /** - * 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 + /** + * 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") - /** - * 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 + /** The attempted card transaction is not allowed per Increase's terms. */ + @JvmField val TRANSACTION_NOT_ALLOWED = of("transaction_not_allowed") - /** - * 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 + /** The transaction was blocked by a Limit. */ + @JvmField val BREACHES_LIMIT = of("breaches_limit") - /** - * 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 + /** Your application declined the transaction via webhook. */ + @JvmField val WEBHOOK_DECLINED = of("webhook_declined") - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** Your application webhook did not respond without the required timeout. */ + @JvmField val WEBHOOK_TIMED_OUT = of("webhook_timed_out") - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** Declined by stand-in processing. */ + @JvmField + val DECLINED_BY_STAND_IN_PROCESSING = of("declined_by_stand_in_processing") - fun toBuilder() = Builder().from(this) + /** + * The card read had an invalid CVV, dCVV, or authorization request cryptogram. + */ + @JvmField val INVALID_PHYSICAL_CARD = of("invalid_physical_card") - companion object { + /** + * The original card authorization for this incremental authorization does not + * exist. + */ + @JvmField + val MISSING_ORIGINAL_AUTHORIZATION = of("missing_original_authorization") - /** - * 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() - } + /** The transaction was declined because the 3DS authentication failed. */ + @JvmField val FAILED_3DS_AUTHENTICATION = of("failed_3ds_authentication") - /** A builder for [CardRefund]. */ - class Builder internal constructor() { + /** + * The transaction was suspected to be used by a card tester to test for valid + * card numbers. + */ + @JvmField val SUSPECTED_CARD_TESTING = of("suspected_card_testing") - 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() + /** + * The transaction was suspected to be fraudulent. Please reach out to + * support@increase.com for more information. + */ + @JvmField val SUSPECTED_FRAUD = of("suspected_fraud") - @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() + @JvmStatic fun of(value: String) = Reason(JsonField.of(value)) } - /** The Card Refund identifier. */ - fun id(id: String) = id(JsonField.of(id)) + /** 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, dCVV, or authorization request cryptogram. + */ + INVALID_PHYSICAL_CARD, + /** + * The original card authorization for this incremental authorization does not + * exist. + */ + MISSING_ORIGINAL_AUTHORIZATION, + /** 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, + } /** - * Sets [Builder.id] to an arbitrary JSON value. + * An enum containing [Reason]'s known values, as well as an [_UNKNOWN] member. * - * 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. + * 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. */ - fun amount(amount: Long) = amount(JsonField.of(amount)) + 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, dCVV, or authorization request cryptogram. + */ + INVALID_PHYSICAL_CARD, + /** + * The original card authorization for this incremental authorization does not + * exist. + */ + MISSING_ORIGINAL_AUTHORIZATION, + /** 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. + */ + _UNKNOWN, + } /** - * Sets [Builder.amount] 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.amount] with a well-typed [Long] 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 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)) + 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 + FAILED_3DS_AUTHENTICATION -> Value.FAILED_3DS_AUTHENTICATION + SUSPECTED_CARD_TESTING -> Value.SUSPECTED_CARD_TESTING + SUSPECTED_FRAUD -> Value.SUSPECTED_FRAUD + else -> Value._UNKNOWN + } /** - * Sets [Builder.cardPaymentId] to an arbitrary JSON value. + * Returns an enum member corresponding to this class instance's 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. + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. * - * 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. + * @throws IncreaseInvalidDataException if this class instance's value is a not a + * known member. */ - fun currency(currency: Currency) = currency(JsonField.of(currency)) + 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 + 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") + } /** - * Sets [Builder.currency] to an arbitrary JSON value. + * Returns this class instance's primitive wire representation. * - * 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 transaciton. */ - 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. + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. * - * 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. + * @throws IncreaseInvalidDataException if this class instance's value does not have + * the expected primitive type. */ - fun merchantAcceptorId(merchantAcceptorId: String) = - merchantAcceptorId(JsonField.of(merchantAcceptorId)) + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } - /** - * 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 - } + private var validated: Boolean = false - /** The 4-digit MCC describing the merchant's business. */ - fun merchantCategoryCode(merchantCategoryCode: String) = - merchantCategoryCode(JsonField.of(merchantCategoryCode)) + fun validate(): Reason = apply { + if (validated) { + return@apply + } - /** - * 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 + known() + validated = true } - /** The city the merchant resides in. */ - fun merchantCity(merchantCity: String) = merchantCity(JsonField.of(merchantCity)) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } /** - * Sets [Builder.merchantCity] to an arbitrary JSON value. + * Returns a score indicating how many valid values are contained in this object + * recursively. * - * 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. + * Used for best match union deserialization. */ - fun merchantCity(merchantCity: JsonField) = apply { - this.merchantCity = merchantCity - } + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - /** The country the merchant resides in. */ - fun merchantCountry(merchantCountry: String) = - merchantCountry(JsonField.of(merchantCountry)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * 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 + return /* spotless:off */ other is Reason && value == other.value /* spotless:on */ } - /** The name of the merchant. */ - fun merchantName(merchantName: String) = merchantName(JsonField.of(merchantName)) + override fun hashCode() = value.hashCode() - /** - * 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 - } + override fun toString() = value.toString() + } - /** - * The merchant's postal code. For US merchants this is always a 5-digit ZIP code. - */ - fun merchantPostalCode(merchantPostalCode: String?) = - merchantPostalCode(JsonField.ofNullable(merchantPostalCode)) + /** Fields related to verification of cardholder-provided values. */ + class Verification + private constructor( + private val cardVerificationCode: JsonField, + private val cardholderAddress: JsonField, + private val additionalProperties: MutableMap, + ) { - /** - * Alias for calling [Builder.merchantPostalCode] with - * `merchantPostalCode.orElse(null)`. - */ - fun merchantPostalCode(merchantPostalCode: Optional) = - merchantPostalCode(merchantPostalCode.getOrNull()) + @JsonCreator + private constructor( + @JsonProperty("card_verification_code") + @ExcludeMissing + cardVerificationCode: JsonField = JsonMissing.of(), + @JsonProperty("cardholder_address") + @ExcludeMissing + cardholderAddress: JsonField = JsonMissing.of(), + ) : this(cardVerificationCode, cardholderAddress, mutableMapOf()) /** - * Sets [Builder.merchantPostalCode] to an arbitrary JSON value. + * Fields related to verification of the Card Verification Code, a 3-digit code on + * the back of the card. * - * 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. + * @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 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()) + fun cardVerificationCode(): CardVerificationCode = + cardVerificationCode.getRequired("card_verification_code") /** - * Sets [Builder.merchantState] to an arbitrary JSON value. + * Cardholder address provided in the authorization request and the address on file + * we verified it against. * - * 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. + * @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 merchantState(merchantState: JsonField) = apply { - this.merchantState = merchantState - } - - /** Network-specific identifiers for this refund. */ - fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) = - networkIdentifiers(JsonField.of(networkIdentifiers)) + fun cardholderAddress(): CardholderAddress = + cardholderAddress.getRequired("cardholder_address") /** - * Sets [Builder.networkIdentifiers] to an arbitrary JSON value. + * Returns the raw JSON value of [cardVerificationCode]. * - * 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. + * Unlike [cardVerificationCode], this method doesn't throw if the JSON field has an + * unexpected type. */ - 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)) + @JsonProperty("card_verification_code") + @ExcludeMissing + fun _cardVerificationCode(): JsonField = cardVerificationCode /** - * Sets [Builder.presentmentAmount] to an arbitrary JSON value. + * Returns the raw JSON value of [cardholderAddress]. * - * 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. + * Unlike [cardholderAddress], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun presentmentCurrency(presentmentCurrency: String) = - presentmentCurrency(JsonField.of(presentmentCurrency)) + @JsonProperty("cardholder_address") + @ExcludeMissing + fun _cardholderAddress(): JsonField = cardholderAddress - /** - * 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 + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) } - /** - * Additional details about the card purchase, such as tax and industry-specific - * fields. - */ - fun purchaseDetails(purchaseDetails: PurchaseDetails?) = - purchaseDetails(JsonField.ofNullable(purchaseDetails)) - - /** - * Alias for calling [Builder.purchaseDetails] with `purchaseDetails.orElse(null)`. - */ - fun purchaseDetails(purchaseDetails: Optional) = - purchaseDetails(purchaseDetails.getOrNull()) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** - * 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 - } + fun toBuilder() = Builder().from(this) - /** The identifier of the Transaction associated with this Transaction. */ - fun transactionId(transactionId: String) = - transactionId(JsonField.of(transactionId)) + 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 + /** + * Returns a mutable builder for constructing an instance of [Verification]. + * + * The following fields are required: + * ```java + * .cardVerificationCode() + * .cardholderAddress() + * ``` + */ + @JvmStatic fun builder() = Builder() } - /** - * A constant representing the object's type. For this resource it will always be - * `card_refund`. - */ - 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 } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** A builder for [Verification]. */ + class Builder internal constructor() { - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + private var cardVerificationCode: JsonField? = null + private var cardholderAddress: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + @JvmSynthetic + internal fun from(verification: Verification) = apply { + cardVerificationCode = verification.cardVerificationCode + cardholderAddress = verification.cardholderAddress + additionalProperties = verification.additionalProperties.toMutableMap() } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * 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 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() } - 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) + - (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 - 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(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)) + /** + * Fields related to verification of the Card Verification Code, a 3-digit code + * on the back of the card. + */ + fun cardVerificationCode(cardVerificationCode: CardVerificationCode) = + cardVerificationCode(JsonField.of(cardVerificationCode)) /** - * Sets [Builder.amount] to an arbitrary JSON value. + * Sets [Builder.cardVerificationCode] 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.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 amount(amount: JsonField) = apply { this.amount = amount } + fun cardVerificationCode( + cardVerificationCode: JsonField + ) = apply { this.cardVerificationCode = cardVerificationCode } /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the cashback. + * Cardholder address provided in the authorization request and the address on + * file we verified it against. */ - fun currency(currency: Currency) = currency(JsonField.of(currency)) + fun cardholderAddress(cardholderAddress: CardholderAddress) = + cardholderAddress(JsonField.of(cardholderAddress)) /** - * Sets [Builder.currency] to an arbitrary JSON value. + * Sets [Builder.cardholderAddress] 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. + * 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. */ - fun currency(currency: JsonField) = apply { this.currency = currency } + fun cardholderAddress(cardholderAddress: JsonField) = apply { + this.cardholderAddress = cardholderAddress + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -19742,35 +19904,35 @@ private constructor( } /** - * Returns an immutable instance of [Cashback]. + * Returns an immutable instance of [Verification]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .amount() - * .currency() + * .cardVerificationCode() + * .cardholderAddress() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): Cashback = - Cashback( - checkRequired("amount", amount), - checkRequired("currency", currency), + fun build(): Verification = + Verification( + checkRequired("cardVerificationCode", cardVerificationCode), + checkRequired("cardholderAddress", cardholderAddress), additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): Cashback = apply { + fun validate(): Verification = apply { if (validated) { return@apply } - amount() - currency().validate() + cardVerificationCode().validate() + cardholderAddress().validate() validated = true } @@ -19790,154 +19952,146 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (amount.asKnown().isPresent) 1 else 0) + - (currency.asKnown().getOrNull()?.validity() ?: 0) + (cardVerificationCode.asKnown().getOrNull()?.validity() ?: 0) + + (cardholderAddress.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 { + /** + * Fields related to verification of the Card Verification Code, a 3-digit code on + * the back of the card. + */ + class CardVerificationCode + private constructor( + private val result: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("result") + @ExcludeMissing + result: JsonField = JsonMissing.of() + ) : this(result, mutableMapOf()) /** - * Returns this class instance's raw value. + * The result of verifying the Card Verification Code. * - * 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 + fun result(): Result = result.getRequired("result") - companion object { + /** + * 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 - /** Canadian Dollar (CAD) */ - @JvmField val CAD = of("CAD") + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - /** Swiss Franc (CHF) */ - @JvmField val CHF = of("CHF") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** Euro (EUR) */ - @JvmField val EUR = of("EUR") + fun toBuilder() = Builder().from(this) - /** British Pound (GBP) */ - @JvmField val GBP = of("GBP") + companion object { - /** Japanese Yen (JPY) */ - @JvmField val JPY = of("JPY") + /** + * Returns a mutable builder for constructing an instance of + * [CardVerificationCode]. + * + * The following fields are required: + * ```java + * .result() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - /** US Dollar (USD) */ - @JvmField val USD = of("USD") + /** A builder for [CardVerificationCode]. */ + class Builder internal constructor() { - @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) - } + private var result: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() - /** An enum containing [Currency]'s known values. */ - enum class Known { - /** Canadian Dollar (CAD) */ - CAD, - /** Swiss Franc (CHF) */ - CHF, - /** Euro (EUR) */ - EUR, - /** British Pound (GBP) */ - GBP, - /** Japanese Yen (JPY) */ - JPY, - /** US Dollar (USD) */ - USD, - } + @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)) - /** - * 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 { - /** Canadian Dollar (CAD) */ - CAD, - /** Swiss Franc (CHF) */ - CHF, - /** Euro (EUR) */ - EUR, - /** British Pound (GBP) */ - GBP, - /** Japanese Yen (JPY) */ - JPY, - /** US Dollar (USD) */ - USD, /** - * An enum member indicating that [Currency] was instantiated with an - * unknown value. + * 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. */ - _UNKNOWN, - } + fun result(result: JsonField) = apply { this.result = result } - /** - * 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) { - CAD -> Value.CAD - CHF -> Value.CHF - EUR -> Value.EUR - GBP -> Value.GBP - JPY -> Value.JPY - USD -> Value.USD - 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) { - CAD -> Known.CAD - CHF -> Known.CHF - EUR -> Known.EUR - GBP -> Known.GBP - JPY -> Known.JPY - USD -> Known.USD - else -> throw IncreaseInvalidDataException("Unknown Currency: $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 [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(): Currency = apply { + fun validate(): CardVerificationCode = apply { if (validated) { return@apply } - known() + result().validate() validated = true } @@ -19956,610 +20110,536 @@ 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 - } + internal fun validity(): Int = (result.asKnown().getOrNull()?.validity() ?: 0) - return /* spotless:off */ other is Currency && value == other.value /* spotless:on */ - } + /** The result of verifying the Card Verification Code. */ + class Result + @JsonCreator + private constructor(private val value: JsonField) : Enum { - override fun hashCode() = value.hashCode() + /** + * 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 toString() = value.toString() - } + companion object { - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * No card verification code was provided in the authorization request. + */ + @JvmField val NOT_CHECKED = of("not_checked") - return /* spotless:off */ other is Cashback && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** The card verification code matched the one on file. */ + @JvmField val MATCH = of("match") - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } - /* spotless:on */ + /** The card verification code did not match the one on file. */ + @JvmField val NO_MATCH = of("no_match") - override fun hashCode(): Int = hashCode + @JvmStatic fun of(value: String) = Result(JsonField.of(value)) + } - override fun toString() = - "Cashback{amount=$amount, currency=$currency, additionalProperties=$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, + } - /** - * 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 { + /** + * 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 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, 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 + } - 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) { + NOT_CHECKED -> Known.NOT_CHECKED + MATCH -> Known.MATCH + NO_MATCH -> Known.NO_MATCH + else -> throw IncreaseInvalidDataException("Unknown Result: $value") + } - /** Canadian Dollar (CAD) */ - @JvmField val CAD = of("CAD") + /** + * 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") + } - /** Swiss Franc (CHF) */ - @JvmField val CHF = of("CHF") + private var validated: Boolean = false - /** Euro (EUR) */ - @JvmField val EUR = of("EUR") + fun validate(): Result = apply { + if (validated) { + return@apply + } - /** British Pound (GBP) */ - @JvmField val GBP = of("GBP") + known() + validated = true + } - /** Japanese Yen (JPY) */ - @JvmField val JPY = of("JPY") + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** US Dollar (USD) */ - @JvmField val USD = of("USD") + /** + * 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 - @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** An enum containing [Currency]'s known values. */ - enum class Known { - /** Canadian Dollar (CAD) */ - CAD, - /** Swiss Franc (CHF) */ - CHF, - /** Euro (EUR) */ - EUR, - /** British Pound (GBP) */ - GBP, - /** Japanese Yen (JPY) */ - JPY, - /** US Dollar (USD) */ - USD, - } + return /* spotless:off */ other is Result && value == other.value /* spotless:on */ + } - /** - * 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 { - /** Canadian Dollar (CAD) */ - CAD, - /** Swiss Franc (CHF) */ - CHF, - /** Euro (EUR) */ - EUR, - /** British Pound (GBP) */ - GBP, - /** Japanese Yen (JPY) */ - JPY, - /** US Dollar (USD) */ - USD, - /** - * An enum member indicating that [Currency] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } + override fun hashCode() = value.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) { - CAD -> Value.CAD - CHF -> Value.CHF - EUR -> Value.EUR - GBP -> Value.GBP - JPY -> Value.JPY - USD -> Value.USD - else -> Value._UNKNOWN + override fun toString() = value.toString() } - /** - * 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) { - CAD -> Known.CAD - CHF -> Known.CHF - EUR -> Known.EUR - GBP -> Known.GBP - JPY -> Known.JPY - USD -> Known.USD - else -> throw IncreaseInvalidDataException("Unknown Currency: $value") - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return 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") + return /* spotless:off */ other is CardVerificationCode && result == other.result && additionalProperties == other.additionalProperties /* spotless:on */ } - private var validated: Boolean = false + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(result, additionalProperties) } + /* spotless:on */ - fun validate(): Currency = apply { - if (validated) { - return@apply - } + override fun hashCode(): Int = hashCode - known() - validated = true + override fun toString() = + "CardVerificationCode{result=$result, additionalProperties=$additionalProperties}" } - 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. + * Cardholder address provided in the authorization request and the address on file + * we verified it against. */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Currency && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** Interchange assessed as a part of this transaciton. */ - class Interchange - private constructor( - private val amount: JsonField, - private val code: JsonField, - private val currency: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator + class CardholderAddress 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 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") - - /** - * 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 - * 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 [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]. - * - * 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) + private val actualLine1: JsonField, + private val actualPostalCode: JsonField, + private val providedLine1: JsonField, + private val providedPostalCode: JsonField, + private val result: JsonField, + private val additionalProperties: MutableMap, + ) { - companion object { + @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 a mutable builder for constructing an instance of [Interchange]. + * Line 1 of the address on file for the cardholder. * - * The following fields are required: - * ```java - * .amount() - * .code() - * .currency() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** 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(interchange: Interchange) = apply { - amount = interchange.amount - code = interchange.code - currency = interchange.currency - additionalProperties = interchange.additionalProperties.toMutableMap() - } - - /** - * 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). */ - fun amount(amount: String) = amount(JsonField.of(amount)) + fun actualLine1(): Optional = actualLine1.getOptional("actual_line1") /** - * Sets [Builder.amount] to an arbitrary JSON value. + * The postal code of the address on file for the cardholder. * - * 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. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ - 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()) + fun actualPostalCode(): Optional = + actualPostalCode.getOptional("actual_postal_code") /** - * Sets [Builder.code] to an arbitrary JSON value. + * The cardholder address line 1 provided for verification in the authorization + * request. * - * 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. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ - fun code(code: JsonField) = apply { this.code = code } + fun providedLine1(): Optional = + providedLine1.getOptional("provided_line1") /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - * interchange reimbursement. + * 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 currency(currency: Currency) = currency(JsonField.of(currency)) + fun providedPostalCode(): Optional = + providedPostalCode.getOptional("provided_postal_code") /** - * Sets [Builder.currency] to an arbitrary JSON value. + * The address verification result returned to the card network. * - * 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. + * @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: 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 result(): Result = result.getRequired("result") - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** + * 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 an immutable instance of [Interchange]. + * Returns the raw JSON value of [actualPostalCode]. * - * Further updates to this [Builder] will not mutate the returned instance. + * 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]. * - * The following fields are required: - * ```java - * .amount() - * .code() - * .currency() - * ``` + * 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]. * - * @throws IllegalStateException if any required field is unset. + * Unlike [providedPostalCode], this method doesn't throw if the JSON field has + * an unexpected type. */ - fun build(): Interchange = - Interchange( - checkRequired("amount", amount), - checkRequired("code", code), - checkRequired("currency", currency), - additionalProperties.toMutableMap(), - ) - } + @JsonProperty("provided_postal_code") + @ExcludeMissing + fun _providedPostalCode(): JsonField = providedPostalCode - private var validated: Boolean = false + /** + * 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 - fun validate(): Interchange = apply { - if (validated) { - return@apply + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) } - amount() - code() - currency().validate() - 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) + + companion object { + + /** + * 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() } - /** - * 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 (code.asKnown().isPresent) 1 else 0) + - (currency.asKnown().getOrNull()?.validity() ?: 0) + /** A builder for [CardholderAddress]. */ + class Builder internal constructor() { - /** - * 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 { + 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 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(cardholderAddress: CardholderAddress) = apply { + actualLine1 = cardholderAddress.actualLine1 + actualPostalCode = cardholderAddress.actualPostalCode + providedLine1 = cardholderAddress.providedLine1 + providedPostalCode = cardholderAddress.providedPostalCode + result = cardholderAddress.result + additionalProperties = + cardholderAddress.additionalProperties.toMutableMap() + } - companion object { + /** Line 1 of the address on file for the cardholder. */ + fun actualLine1(actualLine1: String?) = + actualLine1(JsonField.ofNullable(actualLine1)) - /** Canadian Dollar (CAD) */ - @JvmField val CAD = of("CAD") + /** + * Alias for calling [Builder.actualLine1] with `actualLine1.orElse(null)`. + */ + fun actualLine1(actualLine1: Optional) = + actualLine1(actualLine1.getOrNull()) - /** Swiss Franc (CHF) */ - @JvmField val CHF = of("CHF") + /** + * 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 + } - /** Euro (EUR) */ - @JvmField val EUR = of("EUR") + /** The postal code of the address on file for the cardholder. */ + fun actualPostalCode(actualPostalCode: String?) = + actualPostalCode(JsonField.ofNullable(actualPostalCode)) - /** British Pound (GBP) */ - @JvmField val GBP = of("GBP") + /** + * Alias for calling [Builder.actualPostalCode] with + * `actualPostalCode.orElse(null)`. + */ + fun actualPostalCode(actualPostalCode: Optional) = + actualPostalCode(actualPostalCode.getOrNull()) - /** Japanese Yen (JPY) */ - @JvmField val JPY = of("JPY") + /** + * 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 + } - /** US Dollar (USD) */ - @JvmField val USD = of("USD") + /** + * The cardholder address line 1 provided for verification in the + * authorization request. + */ + fun providedLine1(providedLine1: String?) = + providedLine1(JsonField.ofNullable(providedLine1)) - @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) - } + /** + * Alias for calling [Builder.providedLine1] with + * `providedLine1.orElse(null)`. + */ + fun providedLine1(providedLine1: Optional) = + providedLine1(providedLine1.getOrNull()) - /** An enum containing [Currency]'s known values. */ - enum class Known { - /** Canadian Dollar (CAD) */ - CAD, - /** Swiss Franc (CHF) */ - CHF, - /** Euro (EUR) */ - EUR, - /** British Pound (GBP) */ - GBP, - /** Japanese Yen (JPY) */ - JPY, - /** US Dollar (USD) */ - USD, - } + /** + * 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 + } - /** - * 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 { - /** Canadian Dollar (CAD) */ - CAD, - /** Swiss Franc (CHF) */ - CHF, - /** Euro (EUR) */ - EUR, - /** British Pound (GBP) */ - GBP, - /** Japanese Yen (JPY) */ - JPY, - /** US Dollar (USD) */ - USD, /** - * An enum member indicating that [Currency] was instantiated with an - * unknown value. + * The postal code provided for verification in the authorization request. */ - _UNKNOWN, - } + fun providedPostalCode(providedPostalCode: String?) = + providedPostalCode(JsonField.ofNullable(providedPostalCode)) - /** - * 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) { - CAD -> Value.CAD - CHF -> Value.CHF - EUR -> Value.EUR - GBP -> Value.GBP - JPY -> Value.JPY - USD -> Value.USD - else -> Value._UNKNOWN + /** + * 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 } - /** - * 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) { - CAD -> Known.CAD - CHF -> Known.CHF - EUR -> Known.EUR - GBP -> Known.GBP - JPY -> Known.JPY - USD -> Known.USD - else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + /** 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() + 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 [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(): Currency = apply { + fun validate(): CardholderAddress = apply { if (validated) { return@apply } - known() + actualLine1() + actualPostalCode() + providedLine1() + providedPostalCode() + result().validate() validated = true } @@ -20578,948 +20658,889 @@ 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 - } + 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) - return /* spotless:off */ other is Currency && value == other.value /* spotless:on */ - } + /** The address verification result returned to the card network. */ + class Result + @JsonCreator + private constructor(private val value: JsonField) : Enum { - override fun hashCode() = value.hashCode() + /** + * 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 toString() = value.toString() - } + companion object { - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** No address was provided in the authorization request. */ + @JvmField val NOT_CHECKED = of("not_checked") - return /* spotless:off */ other is Interchange && amount == other.amount && code == other.code && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** Postal code matches, but the street address was not verified. */ + @JvmField + val POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED = + of("postal_code_match_address_not_checked") - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, code, currency, additionalProperties) } - /* spotless:on */ + /** Postal code matches, but the street address does not match. */ + @JvmField + val POSTAL_CODE_MATCH_ADDRESS_NO_MATCH = + of("postal_code_match_address_no_match") - override fun hashCode(): Int = hashCode + /** Postal code does not match, but the street address matches. */ + @JvmField + val POSTAL_CODE_NO_MATCH_ADDRESS_MATCH = + of("postal_code_no_match_address_match") - override fun toString() = - "Interchange{amount=$amount, code=$code, currency=$currency, additionalProperties=$additionalProperties}" - } + /** Postal code and street address match. */ + @JvmField val MATCH = of("match") - /** Network-specific identifiers for this refund. */ - class NetworkIdentifiers - private constructor( - private val acquirerBusinessId: JsonField, - private val acquirerReferenceNumber: JsonField, - private val transactionId: JsonField, - private val additionalProperties: MutableMap, - ) { + /** Postal code and street address do not match. */ + @JvmField val NO_MATCH = of("no_match") - @JsonCreator - private constructor( - @JsonProperty("acquirer_business_id") - @ExcludeMissing - acquirerBusinessId: JsonField = JsonMissing.of(), - @JsonProperty("acquirer_reference_number") - @ExcludeMissing - acquirerReferenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("transaction_id") - @ExcludeMissing - transactionId: JsonField = JsonMissing.of(), - ) : this(acquirerBusinessId, acquirerReferenceNumber, transactionId, mutableMapOf()) + @JvmStatic fun of(value: String) = Result(JsonField.of(value)) + } - /** - * 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") - - /** - * 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 [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) - } + /** An enum containing [Result]'s known values. */ + enum class Known { + /** No address was provided in the authorization request. */ + NOT_CHECKED, + /** Postal code matches, but the street address was not verified. */ + POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED, + /** Postal code matches, but the street address does not match. */ + POSTAL_CODE_MATCH_ADDRESS_NO_MATCH, + /** Postal code does not match, but the street address matches. */ + POSTAL_CODE_NO_MATCH_ADDRESS_MATCH, + /** Postal code and street address match. */ + MATCH, + /** Postal code and street address do not match. */ + NO_MATCH, + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** + * 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 was provided in the authorization request. */ + NOT_CHECKED, + /** Postal code matches, but the street address was not verified. */ + POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED, + /** Postal code matches, but the street address does not match. */ + POSTAL_CODE_MATCH_ADDRESS_NO_MATCH, + /** Postal code does not match, but the street address matches. */ + POSTAL_CODE_NO_MATCH_ADDRESS_MATCH, + /** Postal code and street address match. */ + MATCH, + /** Postal code and street address do not match. */ + NO_MATCH, + /** + * An enum member indicating that [Result] 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) { + NOT_CHECKED -> Value.NOT_CHECKED + POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED -> + Value.POSTAL_CODE_MATCH_ADDRESS_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 + 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) { + NOT_CHECKED -> Known.NOT_CHECKED + POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED -> + Known.POSTAL_CODE_MATCH_ADDRESS_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 + else -> throw IncreaseInvalidDataException("Unknown Result: $value") + } - /** - * Returns a mutable builder for constructing an instance of - * [NetworkIdentifiers]. - * - * The following fields are required: - * ```java - * .acquirerBusinessId() - * .acquirerReferenceNumber() - * .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 acquirerBusinessId: JsonField? = null - private var acquirerReferenceNumber: JsonField? = null - private var transactionId: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + fun validate(): Result = apply { + if (validated) { + return@apply + } - @JvmSynthetic - internal fun from(networkIdentifiers: NetworkIdentifiers) = apply { - acquirerBusinessId = networkIdentifiers.acquirerBusinessId - acquirerReferenceNumber = networkIdentifiers.acquirerReferenceNumber - transactionId = networkIdentifiers.transactionId - additionalProperties = - networkIdentifiers.additionalProperties.toMutableMap() - } + known() + validated = true + } - /** - * A network assigned business ID that identifies the acquirer that processed - * this transaction. - */ - fun acquirerBusinessId(acquirerBusinessId: String) = - acquirerBusinessId(JsonField.of(acquirerBusinessId)) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * 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 - } + /** + * 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 globally unique identifier for this settlement. */ - fun acquirerReferenceNumber(acquirerReferenceNumber: String) = - acquirerReferenceNumber(JsonField.of(acquirerReferenceNumber)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * 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 + return /* spotless:off */ other is Result && value == other.value /* spotless:on */ } - /** - * 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 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) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + return /* spotless:off */ other is CardholderAddress && actualLine1 == other.actualLine1 && actualPostalCode == other.actualPostalCode && providedLine1 == other.providedLine1 && providedPostalCode == other.providedPostalCode && result == other.result && additionalProperties == other.additionalProperties /* spotless:on */ } - /** - * 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() - * .transactionId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): NetworkIdentifiers = - NetworkIdentifiers( - checkRequired("acquirerBusinessId", acquirerBusinessId), - checkRequired("acquirerReferenceNumber", acquirerReferenceNumber), - checkRequired("transactionId", transactionId), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(actualLine1, actualPostalCode, providedLine1, providedPostalCode, result, additionalProperties) } + /* spotless:on */ - fun validate(): NetworkIdentifiers = apply { - if (validated) { - return@apply - } + override fun hashCode(): Int = hashCode - acquirerBusinessId() - acquirerReferenceNumber() - transactionId() - validated = true + override fun toString() = + "CardholderAddress{actualLine1=$actualLine1, actualPostalCode=$actualPostalCode, providedLine1=$providedLine1, providedPostalCode=$providedPostalCode, result=$result, additionalProperties=$additionalProperties}" } - 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 (transactionId.asKnown().isPresent) 1 else 0) - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is NetworkIdentifiers && acquirerBusinessId == other.acquirerBusinessId && acquirerReferenceNumber == other.acquirerReferenceNumber && transactionId == other.transactionId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Verification && cardVerificationCode == other.cardVerificationCode && cardholderAddress == other.cardholderAddress && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(acquirerBusinessId, acquirerReferenceNumber, transactionId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cardVerificationCode, cardholderAddress, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NetworkIdentifiers{acquirerBusinessId=$acquirerBusinessId, acquirerReferenceNumber=$acquirerReferenceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}" + "Verification{cardVerificationCode=$cardVerificationCode, cardholderAddress=$cardholderAddress, additionalProperties=$additionalProperties}" } - /** - * Additional details about the card purchase, such as tax and industry-specific fields. - */ - class PurchaseDetails - 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(), - ) - - /** - * 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") - - /** - * 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") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * 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") + return /* spotless:off */ other is CardDecline && id == other.id && actioner == other.actioner && additionalAmounts == other.additionalAmounts && amount == other.amount && cardPaymentId == other.cardPaymentId && currency == other.currency && declinedTransactionId == other.declinedTransactionId && 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 && realTimeDecisionReason == other.realTimeDecisionReason && reason == other.reason && terminalId == other.terminalId && verification == other.verification && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * 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") + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, actioner, additionalAmounts, amount, cardPaymentId, currency, declinedTransactionId, digitalWalletTokenId, direction, merchantAcceptorId, merchantCategoryCode, merchantCity, merchantCountry, merchantDescriptor, merchantPostalCode, merchantState, networkDetails, networkIdentifiers, networkRiskScore, physicalCardId, presentmentAmount, presentmentCurrency, processingCategory, realTimeDecisionId, realTimeDecisionReason, reason, terminalId, verification, additionalProperties) } + /* spotless:on */ - /** - * 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") + override fun hashCode(): Int = hashCode - /** - * 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") + override fun toString() = + "CardDecline{id=$id, actioner=$actioner, additionalAmounts=$additionalAmounts, amount=$amount, cardPaymentId=$cardPaymentId, currency=$currency, declinedTransactionId=$declinedTransactionId, 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, realTimeDecisionReason=$realTimeDecisionReason, reason=$reason, terminalId=$terminalId, verification=$verification, additionalProperties=$additionalProperties}" + } - /** - * 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") + /** + * 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 + 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, + ) { - /** - * 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") + @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("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("updated_authorization_amount") + @ExcludeMissing + updatedAuthorizationAmount: JsonField = JsonMissing.of(), + ) : this( + id, + cardAuthorizationId, + currency, + network, + networkIdentifiers, + pendingTransactionId, + 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") + + /** + * 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 + + /** + * 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 + + /** + * 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 [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 + + /** + * 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 [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 + + @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 format of the purchase identifier. + * Returns a mutable builder for constructing an instance of [CardFuelConfirmation]. * - * @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() + * .cardAuthorizationId() + * .currency() + * .network() + * .networkIdentifiers() + * .pendingTransactionId() + * .type() + * .updatedAuthorizationAmount() + * ``` */ - fun purchaseIdentifierFormat(): Optional = - purchaseIdentifierFormat.getOptional("purchase_identifier_format") + @JvmStatic fun builder() = Builder() + } + + /** A builder for [CardFuelConfirmation]. */ + class Builder internal constructor() { + + 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() + + @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() + } + + /** The Card Fuel Confirmation identifier. */ + fun id(id: String) = id(JsonField.of(id)) /** - * Fields specific to travel. + * Sets [Builder.id] 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.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 travel(): Optional = travel.getOptional("travel") + fun id(id: JsonField) = apply { this.id = id } + + /** The identifier for the Card Authorization this updates. */ + fun cardAuthorizationId(cardAuthorizationId: String) = + cardAuthorizationId(JsonField.of(cardAuthorizationId)) /** - * Returns the raw JSON value of [carRental]. + * Sets [Builder.cardAuthorizationId] to an arbitrary JSON value. * - * Unlike [carRental], this method doesn't throw if the JSON field has an unexpected - * type. + * 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. */ - @JsonProperty("car_rental") - @ExcludeMissing - fun _carRental(): JsonField = carRental + fun cardAuthorizationId(cardAuthorizationId: JsonField) = apply { + this.cardAuthorizationId = cardAuthorizationId + } /** - * Returns the raw JSON value of [customerReferenceIdentifier]. - * - * Unlike [customerReferenceIdentifier], 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 increment's + * currency. */ - @JsonProperty("customer_reference_identifier") - @ExcludeMissing - fun _customerReferenceIdentifier(): JsonField = customerReferenceIdentifier + fun currency(currency: Currency) = currency(JsonField.of(currency)) /** - * Returns the raw JSON value of [localTaxAmount]. + * Sets [Builder.currency] to an arbitrary JSON value. * - * Unlike [localTaxAmount], this method doesn't throw if the JSON field has an - * unexpected type. + * 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. */ - @JsonProperty("local_tax_amount") - @ExcludeMissing - fun _localTaxAmount(): JsonField = localTaxAmount + fun currency(currency: JsonField) = apply { this.currency = currency } + + /** The card network used to process this card authorization. */ + fun network(network: Network) = network(JsonField.of(network)) /** - * Returns the raw JSON value of [localTaxCurrency]. + * Sets [Builder.network] to an arbitrary JSON value. * - * Unlike [localTaxCurrency], this method doesn't throw if the JSON field has an - * unexpected type. + * 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. */ - @JsonProperty("local_tax_currency") - @ExcludeMissing - fun _localTaxCurrency(): JsonField = localTaxCurrency + fun network(network: JsonField) = apply { this.network = network } + + /** Network-specific identifiers for a specific request or transaction. */ + fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) = + networkIdentifiers(JsonField.of(networkIdentifiers)) /** - * Returns the raw JSON value of [lodging]. + * Sets [Builder.networkIdentifiers] to an arbitrary JSON value. * - * Unlike [lodging], this method doesn't throw if the JSON field has an unexpected - * type. + * 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. */ - @JsonProperty("lodging") - @ExcludeMissing - fun _lodging(): JsonField = lodging + fun networkIdentifiers(networkIdentifiers: JsonField) = apply { + this.networkIdentifiers = networkIdentifiers + } /** - * Returns the raw JSON value of [nationalTaxAmount]. - * - * Unlike [nationalTaxAmount], this method doesn't throw if the JSON field has an - * unexpected type. + * The identifier of the Pending Transaction associated with this Card Fuel + * Confirmation. */ - @JsonProperty("national_tax_amount") - @ExcludeMissing - fun _nationalTaxAmount(): JsonField = nationalTaxAmount + fun pendingTransactionId(pendingTransactionId: String?) = + pendingTransactionId(JsonField.ofNullable(pendingTransactionId)) /** - * Returns the raw JSON value of [nationalTaxCurrency]. - * - * Unlike [nationalTaxCurrency], this method doesn't throw if the JSON field has an - * unexpected type. + * Alias for calling [Builder.pendingTransactionId] with + * `pendingTransactionId.orElse(null)`. */ - @JsonProperty("national_tax_currency") - @ExcludeMissing - fun _nationalTaxCurrency(): JsonField = nationalTaxCurrency + fun pendingTransactionId(pendingTransactionId: Optional) = + pendingTransactionId(pendingTransactionId.getOrNull()) /** - * Returns the raw JSON value of [purchaseIdentifier]. + * Sets [Builder.pendingTransactionId] to an arbitrary JSON value. * - * Unlike [purchaseIdentifier], this method doesn't throw if the JSON field has an - * unexpected type. + * 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. */ - @JsonProperty("purchase_identifier") - @ExcludeMissing - fun _purchaseIdentifier(): JsonField = purchaseIdentifier + fun pendingTransactionId(pendingTransactionId: JsonField) = apply { + this.pendingTransactionId = pendingTransactionId + } /** - * Returns the raw JSON value of [purchaseIdentifierFormat]. + * 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)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. * - * Unlike [purchaseIdentifierFormat], 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("purchase_identifier_format") - @ExcludeMissing - fun _purchaseIdentifierFormat(): JsonField = - purchaseIdentifierFormat + fun type(type: JsonField) = apply { this.type = type } /** - * Returns the raw JSON value of [travel]. + * 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)) + + /** + * Sets [Builder.updatedAuthorizationAmount] to an arbitrary JSON value. * - * Unlike [travel], this method doesn't throw if the JSON field has an unexpected - * type. + * 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. */ - @JsonProperty("travel") @ExcludeMissing fun _travel(): JsonField = travel + fun updatedAuthorizationAmount(updatedAuthorizationAmount: JsonField) = + apply { + this.updatedAuthorizationAmount = updatedAuthorizationAmount + } - @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 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 [PurchaseDetails]. - * - * The following fields are required: - * ```java - * .carRental() - * .customerReferenceIdentifier() - * .localTaxAmount() - * .localTaxCurrency() - * .lodging() - * .nationalTaxAmount() - * .nationalTaxCurrency() - * .purchaseIdentifier() - * .purchaseIdentifierFormat() - * .travel() - * ``` - */ - @JvmStatic fun builder() = Builder() + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) } - /** 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() + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - @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() - } + /** + * 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() + * ``` + * + * @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("type", type), + checkRequired("updatedAuthorizationAmount", updatedAuthorizationAmount), + additionalProperties.toMutableMap(), + ) + } - /** Fields specific to car rentals. */ - fun carRental(carRental: CarRental?) = - carRental(JsonField.ofNullable(carRental)) + private var validated: Boolean = false - /** Alias for calling [Builder.carRental] with `carRental.orElse(null)`. */ - fun carRental(carRental: Optional) = carRental(carRental.getOrNull()) + fun validate(): CardFuelConfirmation = apply { + if (validated) { + return@apply + } - /** - * 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)) - - /** - * Alias for [Builder.localTaxAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun localTaxAmount(localTaxAmount: Long) = - localTaxAmount(localTaxAmount as Long?) - - /** - * Alias for calling [Builder.localTaxAmount] with - * `localTaxAmount.orElse(null)`. - */ - fun localTaxAmount(localTaxAmount: Optional) = - localTaxAmount(localTaxAmount.getOrNull()) - - /** - * 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 - } - - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax - * assessed. - */ - fun localTaxCurrency(localTaxCurrency: String?) = - localTaxCurrency(JsonField.ofNullable(localTaxCurrency)) - - /** - * Alias for calling [Builder.localTaxCurrency] with - * `localTaxCurrency.orElse(null)`. - */ - fun localTaxCurrency(localTaxCurrency: Optional) = - localTaxCurrency(localTaxCurrency.getOrNull()) - - /** - * 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?) + id() + cardAuthorizationId() + currency().validate() + network().validate() + networkIdentifiers().validate() + pendingTransactionId() + type().validate() + updatedAuthorizationAmount() + validated = true + } - /** - * Alias for calling [Builder.nationalTaxAmount] with - * `nationalTaxAmount.orElse(null)`. - */ - fun nationalTaxAmount(nationalTaxAmount: Optional) = - nationalTaxAmount(nationalTaxAmount.getOrNull()) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * 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 - } + /** + * 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 local tax - * assessed. - */ - fun nationalTaxCurrency(nationalTaxCurrency: String?) = - nationalTaxCurrency(JsonField.ofNullable(nationalTaxCurrency)) + /** + * 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 { - /** - * Alias for calling [Builder.nationalTaxCurrency] with - * `nationalTaxCurrency.orElse(null)`. - */ - fun nationalTaxCurrency(nationalTaxCurrency: Optional) = - nationalTaxCurrency(nationalTaxCurrency.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.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 - } + companion object { - /** - * An identifier from the merchant for the purchase to the issuer and - * cardholder. - */ - fun purchaseIdentifier(purchaseIdentifier: String?) = - purchaseIdentifier(JsonField.ofNullable(purchaseIdentifier)) + /** Canadian Dollar (CAD) */ + @JvmField val CAD = of("CAD") - /** - * Alias for calling [Builder.purchaseIdentifier] with - * `purchaseIdentifier.orElse(null)`. - */ - fun purchaseIdentifier(purchaseIdentifier: Optional) = - purchaseIdentifier(purchaseIdentifier.getOrNull()) + /** Swiss Franc (CHF) */ + @JvmField val CHF = of("CHF") - /** - * 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 - } + /** Euro (EUR) */ + @JvmField val EUR = of("EUR") - /** The format of the purchase identifier. */ - fun purchaseIdentifierFormat( - purchaseIdentifierFormat: PurchaseIdentifierFormat? - ) = purchaseIdentifierFormat(JsonField.ofNullable(purchaseIdentifierFormat)) + /** British Pound (GBP) */ + @JvmField val GBP = of("GBP") - /** - * Alias for calling [Builder.purchaseIdentifierFormat] with - * `purchaseIdentifierFormat.orElse(null)`. - */ - fun purchaseIdentifierFormat( - purchaseIdentifierFormat: Optional - ) = purchaseIdentifierFormat(purchaseIdentifierFormat.getOrNull()) + /** Japanese Yen (JPY) */ + @JvmField val JPY = of("JPY") - /** - * 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 } + /** US Dollar (USD) */ + @JvmField val USD = of("USD") - /** Fields specific to travel. */ - fun travel(travel: Travel?) = travel(JsonField.ofNullable(travel)) + @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) + } - /** Alias for calling [Builder.travel] with `travel.orElse(null)`. */ - fun travel(travel: Optional) = travel(travel.getOrNull()) + /** An enum containing [Currency]'s known values. */ + enum class Known { + /** Canadian Dollar (CAD) */ + CAD, + /** Swiss Franc (CHF) */ + CHF, + /** Euro (EUR) */ + EUR, + /** British Pound (GBP) */ + GBP, + /** Japanese Yen (JPY) */ + JPY, + /** 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 { + /** Canadian Dollar (CAD) */ + CAD, + /** Swiss Franc (CHF) */ + CHF, + /** Euro (EUR) */ + EUR, + /** British Pound (GBP) */ + GBP, + /** Japanese Yen (JPY) */ + JPY, + /** US Dollar (USD) */ + USD, /** - * 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. + * An enum member indicating that [Currency] was instantiated with an unknown + * value. */ - fun travel(travel: JsonField) = apply { this.travel = travel } - - 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) { + CAD -> Value.CAD + CHF -> Value.CHF + EUR -> Value.EUR + GBP -> Value.GBP + JPY -> Value.JPY + 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) { + CAD -> Known.CAD + CHF -> Known.CHF + EUR -> Known.EUR + GBP -> Known.GBP + JPY -> Known.JPY + 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 [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(), - ) - } - private var validated: Boolean = false - fun validate(): PurchaseDetails = apply { + fun validate(): Currency = 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() } + known() validated = true } @@ -21537,1831 +21558,2193 @@ private constructor( * * 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) + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - /** Fields specific to car rentals. */ - class CarRental - 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, - ) { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @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(), - ) + return /* spotless:off */ other is Currency && value == other.value /* spotless:on */ + } - /** - * 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") + override fun hashCode() = value.hashCode() - /** - * 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") + override fun toString() = value.toString() + } - /** - * 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 card network used to process this card authorization. */ + class Network @JsonCreator private constructor(private val value: JsonField) : + Enum { - /** - * 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") + /** + * 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 - /** - * 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") + companion object { - /** - * 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") + /** Visa */ + @JvmField val VISA = of("visa") - /** - * 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") + @JvmStatic fun of(value: String) = Network(JsonField.of(value)) + } - /** - * 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") + /** An enum containing [Network]'s known values. */ + enum class Known { + /** Visa */ + VISA + } + /** + * 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, /** - * 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). + * An enum member indicating that [Network] was instantiated with an unknown + * value. */ - fun insuranceChargesAmount(): Optional = - insuranceChargesAmount.getOptional("insurance_charges_amount") + _UNKNOWN, + } - /** - * 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") + /** + * 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 + else -> Value._UNKNOWN + } - /** - * 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") + /** + * 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 + else -> throw IncreaseInvalidDataException("Unknown Network: $value") + } - /** - * 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") + /** + * 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 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" - ) + private var validated: Boolean = false - /** - * 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") + fun validate(): Network = apply { + if (validated) { + return@apply + } - /** - * 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") + known() + validated = true + } - /** - * 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") + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * 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 + /** + * 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 [checkoutDate]. - * - * Unlike [checkoutDate], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("checkout_date") - @ExcludeMissing - fun _checkoutDate(): JsonField = checkoutDate + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * 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") + return /* spotless:off */ other is Network && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Network-specific identifiers for a specific request or transaction. */ + class NetworkIdentifiers + private constructor( + private val retrievalReferenceNumber: JsonField, + private val traceNumber: JsonField, + private val transactionId: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("retrieval_reference_number") @ExcludeMissing - fun _dailyRentalRateAmount(): JsonField = dailyRentalRateAmount + retrievalReferenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("trace_number") + @ExcludeMissing + traceNumber: JsonField = JsonMissing.of(), + @JsonProperty("transaction_id") + @ExcludeMissing + transactionId: JsonField = JsonMissing.of(), + ) : this(retrievalReferenceNumber, traceNumber, transactionId, mutableMapOf()) + + /** + * 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 [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 the raw JSON value of [dailyRentalRateCurrency]. + * Returns a mutable builder for constructing an instance of + * [NetworkIdentifiers]. * - * Unlike [dailyRentalRateCurrency], this method doesn't throw if the JSON field - * has an unexpected type. + * The following fields are required: + * ```java + * .retrievalReferenceNumber() + * .traceNumber() + * .transactionId() + * ``` */ - @JsonProperty("daily_rental_rate_currency") - @ExcludeMissing - fun _dailyRentalRateCurrency(): JsonField = dailyRentalRateCurrency + @JvmStatic fun builder() = Builder() + } + + /** A builder for [NetworkIdentifiers]. */ + class Builder internal constructor() { + + 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 { + retrievalReferenceNumber = networkIdentifiers.retrievalReferenceNumber + traceNumber = networkIdentifiers.traceNumber + transactionId = networkIdentifiers.transactionId + additionalProperties = + networkIdentifiers.additionalProperties.toMutableMap() + } /** - * Returns the raw JSON value of [daysRented]. - * - * Unlike [daysRented], this method doesn't throw if the JSON field has an - * unexpected type. + * 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. */ - @JsonProperty("days_rented") - @ExcludeMissing - fun _daysRented(): JsonField = daysRented + fun retrievalReferenceNumber(retrievalReferenceNumber: String?) = + retrievalReferenceNumber(JsonField.ofNullable(retrievalReferenceNumber)) /** - * Returns the raw JSON value of [extraCharges]. - * - * Unlike [extraCharges], this method doesn't throw if the JSON field has an - * unexpected type. + * Alias for calling [Builder.retrievalReferenceNumber] with + * `retrievalReferenceNumber.orElse(null)`. */ - @JsonProperty("extra_charges") - @ExcludeMissing - fun _extraCharges(): JsonField = extraCharges + fun retrievalReferenceNumber(retrievalReferenceNumber: Optional) = + retrievalReferenceNumber(retrievalReferenceNumber.getOrNull()) /** - * Returns the raw JSON value of [fuelChargesAmount]. + * Sets [Builder.retrievalReferenceNumber] to an arbitrary JSON value. * - * Unlike [fuelChargesAmount], this method doesn't throw if the JSON field has - * an unexpected type. + * 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. */ - @JsonProperty("fuel_charges_amount") - @ExcludeMissing - fun _fuelChargesAmount(): JsonField = fuelChargesAmount + fun retrievalReferenceNumber(retrievalReferenceNumber: JsonField) = + apply { + this.retrievalReferenceNumber = retrievalReferenceNumber + } /** - * Returns the raw JSON value of [fuelChargesCurrency]. - * - * Unlike [fuelChargesCurrency], this method doesn't throw if the JSON field has - * an unexpected type. + * A counter used to verify an individual authorization. Expected to be unique + * per acquirer within a window of time. */ - @JsonProperty("fuel_charges_currency") - @ExcludeMissing - fun _fuelChargesCurrency(): JsonField = fuelChargesCurrency + fun traceNumber(traceNumber: String?) = + traceNumber(JsonField.ofNullable(traceNumber)) + + /** Alias for calling [Builder.traceNumber] with `traceNumber.orElse(null)`. */ + fun traceNumber(traceNumber: Optional) = + traceNumber(traceNumber.getOrNull()) /** - * Returns the raw JSON value of [insuranceChargesAmount]. + * Sets [Builder.traceNumber] to an arbitrary JSON value. * - * Unlike [insuranceChargesAmount], this method doesn't throw if the JSON field - * has an unexpected type. + * 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. */ - @JsonProperty("insurance_charges_amount") - @ExcludeMissing - fun _insuranceChargesAmount(): JsonField = insuranceChargesAmount + fun traceNumber(traceNumber: JsonField) = apply { + this.traceNumber = traceNumber + } /** - * Returns the raw JSON value of [insuranceChargesCurrency]. - * - * Unlike [insuranceChargesCurrency], this method doesn't throw if the JSON - * field has an unexpected type. + * A globally unique transaction identifier provided by the card network, used + * across multiple life-cycle requests. */ - @JsonProperty("insurance_charges_currency") - @ExcludeMissing - fun _insuranceChargesCurrency(): JsonField = insuranceChargesCurrency + fun transactionId(transactionId: String?) = + transactionId(JsonField.ofNullable(transactionId)) /** - * Returns the raw JSON value of [noShowIndicator]. - * - * Unlike [noShowIndicator], this method doesn't throw if the JSON field has an - * unexpected type. + * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`. */ - @JsonProperty("no_show_indicator") - @ExcludeMissing - fun _noShowIndicator(): JsonField = noShowIndicator + fun transactionId(transactionId: Optional) = + transactionId(transactionId.getOrNull()) /** - * Returns the raw JSON value of [oneWayDropOffChargesAmount]. + * Sets [Builder.transactionId] to an arbitrary JSON value. * - * Unlike [oneWayDropOffChargesAmount], 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("one_way_drop_off_charges_amount") - @ExcludeMissing - fun _oneWayDropOffChargesAmount(): JsonField = oneWayDropOffChargesAmount + fun transactionId(transactionId: JsonField) = apply { + this.transactionId = transactionId + } - /** - * 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 + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * 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 + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * 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 + 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 the raw JSON value of [weeklyRentalRateCurrency]. + * Returns an immutable instance of [NetworkIdentifiers]. * - * Unlike [weeklyRentalRateCurrency], this method doesn't throw if the JSON - * field has an unexpected type. + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .retrievalReferenceNumber() + * .traceNumber() + * .transactionId() + * ``` + * + * @throws IllegalStateException if any required field is unset. */ - @JsonProperty("weekly_rental_rate_currency") - @ExcludeMissing - fun _weeklyRentalRateCurrency(): JsonField = weeklyRentalRateCurrency + fun build(): NetworkIdentifiers = + NetworkIdentifiers( + checkRequired("retrievalReferenceNumber", retrievalReferenceNumber), + checkRequired("traceNumber", traceNumber), + checkRequired("transactionId", transactionId), + additionalProperties.toMutableMap(), + ) + } - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) + private var validated: Boolean = false + + fun validate(): NetworkIdentifiers = apply { + if (validated) { + return@apply } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + retrievalReferenceNumber() + traceNumber() + transactionId() + validated = true + } - fun toBuilder() = Builder().from(this) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - companion object { + /** + * 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 (retrievalReferenceNumber.asKnown().isPresent) 1 else 0) + + (if (traceNumber.asKnown().isPresent) 1 else 0) + + (if (transactionId.asKnown().isPresent) 1 else 0) - /** - * 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() + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - /** A builder for [CarRental]. */ - class Builder internal constructor() { + return /* spotless:off */ other is NetworkIdentifiers && retrievalReferenceNumber == other.retrievalReferenceNumber && traceNumber == other.traceNumber && transactionId == other.transactionId && additionalProperties == other.additionalProperties /* spotless:on */ + } - 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() + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(retrievalReferenceNumber, traceNumber, transactionId, additionalProperties) } + /* spotless:on */ - @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() - } + override fun hashCode(): Int = hashCode - /** Code indicating the vehicle's class. */ - fun carClassCode(carClassCode: String?) = - carClassCode(JsonField.ofNullable(carClassCode)) + override fun toString() = + "NetworkIdentifiers{retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}" + } - /** - * Alias for calling [Builder.carClassCode] with - * `carClassCode.orElse(null)`. - */ - fun carClassCode(carClassCode: Optional) = - carClassCode(carClassCode.getOrNull()) + /** + * A constant representing the object's type. For this resource it will always be + * `card_fuel_confirmation`. + */ + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { - /** - * 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 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 - /** - * 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)) + companion object { - /** - * Alias for calling [Builder.checkoutDate] with - * `checkoutDate.orElse(null)`. - */ - fun checkoutDate(checkoutDate: Optional) = - checkoutDate(checkoutDate.getOrNull()) + @JvmField val CARD_FUEL_CONFIRMATION = of("card_fuel_confirmation") - /** - * 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 - } + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } - /** Daily rate being charged for the vehicle. */ - fun dailyRentalRateAmount(dailyRentalRateAmount: Long?) = - dailyRentalRateAmount(JsonField.ofNullable(dailyRentalRateAmount)) + /** An enum containing [Type]'s known values. */ + enum class Known { + CARD_FUEL_CONFIRMATION + } - /** - * Alias for [Builder.dailyRentalRateAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun dailyRentalRateAmount(dailyRentalRateAmount: Long) = - dailyRentalRateAmount(dailyRentalRateAmount as Long?) + /** + * 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_FUEL_CONFIRMATION, + /** + * An enum member indicating that [Type] was instantiated with an unknown value. + */ + _UNKNOWN, + } - /** - * Alias for calling [Builder.dailyRentalRateAmount] with - * `dailyRentalRateAmount.orElse(null)`. - */ - fun dailyRentalRateAmount(dailyRentalRateAmount: Optional) = - dailyRentalRateAmount(dailyRentalRateAmount.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) { + CARD_FUEL_CONFIRMATION -> Value.CARD_FUEL_CONFIRMATION + else -> Value._UNKNOWN + } - /** - * 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 - } + /** + * 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_FUEL_CONFIRMATION -> Known.CARD_FUEL_CONFIRMATION + else -> throw IncreaseInvalidDataException("Unknown Type: $value") + } - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily - * rental rate. - */ - fun dailyRentalRateCurrency(dailyRentalRateCurrency: String?) = - dailyRentalRateCurrency(JsonField.ofNullable(dailyRentalRateCurrency)) + /** + * 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.dailyRentalRateCurrency] with - * `dailyRentalRateCurrency.orElse(null)`. - */ - fun dailyRentalRateCurrency(dailyRentalRateCurrency: Optional) = - dailyRentalRateCurrency(dailyRentalRateCurrency.getOrNull()) + private var validated: Boolean = false - /** - * 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 - } + fun validate(): Type = apply { + if (validated) { + return@apply + } - /** Number of days the vehicle was rented. */ - fun daysRented(daysRented: Long?) = - daysRented(JsonField.ofNullable(daysRented)) + known() + validated = true + } - /** - * Alias for [Builder.daysRented]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun daysRented(daysRented: Long) = daysRented(daysRented as Long?) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * Alias for calling [Builder.daysRented] with `daysRented.orElse(null)`. - */ - fun daysRented(daysRented: Optional) = - daysRented(daysRented.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.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 - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** Additional charges (gas, late fee, etc.) being billed. */ - fun extraCharges(extraCharges: ExtraCharges?) = - extraCharges(JsonField.ofNullable(extraCharges)) + return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + } - /** - * Alias for calling [Builder.extraCharges] with - * `extraCharges.orElse(null)`. - */ - fun extraCharges(extraCharges: Optional) = - extraCharges(extraCharges.getOrNull()) + override fun hashCode() = value.hashCode() - /** - * 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 - } + override fun toString() = value.toString() + } - /** Fuel charges for the vehicle. */ - fun fuelChargesAmount(fuelChargesAmount: Long?) = - fuelChargesAmount(JsonField.ofNullable(fuelChargesAmount)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Alias for [Builder.fuelChargesAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun fuelChargesAmount(fuelChargesAmount: Long) = - fuelChargesAmount(fuelChargesAmount as Long?) + return /* spotless:off */ other is CardFuelConfirmation && id == other.id && cardAuthorizationId == other.cardAuthorizationId && currency == other.currency && network == other.network && networkIdentifiers == other.networkIdentifiers && pendingTransactionId == other.pendingTransactionId && type == other.type && updatedAuthorizationAmount == other.updatedAuthorizationAmount && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * Alias for calling [Builder.fuelChargesAmount] with - * `fuelChargesAmount.orElse(null)`. - */ - fun fuelChargesAmount(fuelChargesAmount: Optional) = - fuelChargesAmount(fuelChargesAmount.getOrNull()) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, cardAuthorizationId, currency, network, networkIdentifiers, pendingTransactionId, type, updatedAuthorizationAmount, additionalProperties) } + /* spotless:on */ - /** - * 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 - } + override fun hashCode(): Int = hashCode - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fuel - * charges assessed. - */ - fun fuelChargesCurrency(fuelChargesCurrency: String?) = - fuelChargesCurrency(JsonField.ofNullable(fuelChargesCurrency)) + override fun toString() = + "CardFuelConfirmation{id=$id, cardAuthorizationId=$cardAuthorizationId, currency=$currency, network=$network, networkIdentifiers=$networkIdentifiers, pendingTransactionId=$pendingTransactionId, type=$type, updatedAuthorizationAmount=$updatedAuthorizationAmount, additionalProperties=$additionalProperties}" + } - /** - * Alias for calling [Builder.fuelChargesCurrency] with - * `fuelChargesCurrency.orElse(null)`. - */ - fun fuelChargesCurrency(fuelChargesCurrency: Optional) = - fuelChargesCurrency(fuelChargesCurrency.getOrNull()) + /** + * A Card Increment object. This field will be present in the JSON response if and only if + * `category` is equal to `card_increment`. Card Increments increase the pending amount of + * an authorized transaction. + */ + class CardIncrement + private constructor( + private val id: JsonField, + private val actioner: JsonField, + private val additionalAmounts: JsonField, + private val amount: JsonField, + private val cardAuthorizationId: JsonField, + private val currency: JsonField, + private val network: JsonField, + private val networkIdentifiers: JsonField, + private val networkRiskScore: JsonField, + private val pendingTransactionId: JsonField, + private val presentmentAmount: JsonField, + private val presentmentCurrency: JsonField, + private val realTimeDecisionId: JsonField, + private val type: JsonField, + private val updatedAuthorizationAmount: JsonField, + private val additionalProperties: MutableMap, + ) { - /** - * 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 - } + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("actioner") + @ExcludeMissing + actioner: JsonField = JsonMissing.of(), + @JsonProperty("additional_amounts") + @ExcludeMissing + additionalAmounts: JsonField = JsonMissing.of(), + @JsonProperty("amount") @ExcludeMissing amount: 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("network_risk_score") + @ExcludeMissing + networkRiskScore: JsonField = JsonMissing.of(), + @JsonProperty("pending_transaction_id") + @ExcludeMissing + pendingTransactionId: JsonField = JsonMissing.of(), + @JsonProperty("presentment_amount") + @ExcludeMissing + presentmentAmount: JsonField = JsonMissing.of(), + @JsonProperty("presentment_currency") + @ExcludeMissing + presentmentCurrency: JsonField = JsonMissing.of(), + @JsonProperty("real_time_decision_id") + @ExcludeMissing + realTimeDecisionId: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("updated_authorization_amount") + @ExcludeMissing + updatedAuthorizationAmount: JsonField = JsonMissing.of(), + ) : this( + id, + actioner, + additionalAmounts, + amount, + cardAuthorizationId, + currency, + network, + networkIdentifiers, + networkRiskScore, + pendingTransactionId, + presentmentAmount, + presentmentCurrency, + realTimeDecisionId, + type, + updatedAuthorizationAmount, + mutableMapOf(), + ) - /** Any insurance being charged for the vehicle. */ - fun insuranceChargesAmount(insuranceChargesAmount: Long?) = - insuranceChargesAmount(JsonField.ofNullable(insuranceChargesAmount)) + /** + * The Card Increment 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 [Builder.insuranceChargesAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun insuranceChargesAmount(insuranceChargesAmount: Long) = - insuranceChargesAmount(insuranceChargesAmount as Long?) + /** + * Whether this authorization was approved by Increase, the card network through + * stand-in processing, or the user through a real-time decision. + * + * @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 actioner(): Actioner = actioner.getRequired("actioner") - /** - * Alias for calling [Builder.insuranceChargesAmount] with - * `insuranceChargesAmount.orElse(null)`. - */ - fun insuranceChargesAmount(insuranceChargesAmount: Optional) = - insuranceChargesAmount(insuranceChargesAmount.getOrNull()) + /** + * 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") - /** - * 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 - } + /** + * The amount of this increment 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 - * insurance charges assessed. - */ - fun insuranceChargesCurrency(insuranceChargesCurrency: String?) = - insuranceChargesCurrency(JsonField.ofNullable(insuranceChargesCurrency)) + /** + * The identifier for the Card Authorization this increments. + * + * @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") - /** - * Alias for calling [Builder.insuranceChargesCurrency] with - * `insuranceChargesCurrency.orElse(null)`. - */ - fun insuranceChargesCurrency(insuranceChargesCurrency: Optional) = - insuranceChargesCurrency(insuranceChargesCurrency.getOrNull()) + /** + * 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") - /** - * 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 - } + /** + * 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") - /** - * 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)) + /** + * 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") - /** - * Alias for calling [Builder.noShowIndicator] with - * `noShowIndicator.orElse(null)`. - */ - fun noShowIndicator(noShowIndicator: Optional) = - noShowIndicator(noShowIndicator.getOrNull()) + /** + * 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. + * + * @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") - /** - * 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 - } + /** + * The identifier of the Pending Transaction associated with this Card Increment. + * + * @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") - /** - * Charges for returning the vehicle at a different location than where it - * was picked up. - */ - fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Long?) = - oneWayDropOffChargesAmount( - JsonField.ofNullable(oneWayDropOffChargesAmount) - ) + /** + * The amount of this increment 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") - /** - * Alias for [Builder.oneWayDropOffChargesAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Long) = - oneWayDropOffChargesAmount(oneWayDropOffChargesAmount as Long?) + /** + * 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") - /** - * Alias for calling [Builder.oneWayDropOffChargesAmount] with - * `oneWayDropOffChargesAmount.orElse(null)`. - */ - fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Optional) = - oneWayDropOffChargesAmount(oneWayDropOffChargesAmount.getOrNull()) + /** + * The identifier of the Real-Time Decision sent to approve or decline this incremental + * authorization. + * + * @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") - /** - * 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 } + /** + * A constant representing the object's type. For this resource it will always be + * `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 type(): Type = type.getRequired("type") - /** - * 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 updated authorization amount after this increment, 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.oneWayDropOffChargesCurrency] with - * `oneWayDropOffChargesCurrency.orElse(null)`. - */ - fun oneWayDropOffChargesCurrency( - oneWayDropOffChargesCurrency: Optional - ) = oneWayDropOffChargesCurrency(oneWayDropOffChargesCurrency.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.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 - } + /** + * Returns the raw JSON value of [actioner]. + * + * Unlike [actioner], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("actioner") + @ExcludeMissing + fun _actioner(): JsonField = actioner - /** Name of the person renting the vehicle. */ - fun renterName(renterName: String?) = - renterName(JsonField.ofNullable(renterName)) + /** + * 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 - /** - * Alias for calling [Builder.renterName] with `renterName.orElse(null)`. - */ - fun renterName(renterName: Optional) = - renterName(renterName.getOrNull()) + /** + * 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 - /** - * 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 [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 - /** Weekly rate being charged for the vehicle. */ - fun weeklyRentalRateAmount(weeklyRentalRateAmount: Long?) = - weeklyRentalRateAmount(JsonField.ofNullable(weeklyRentalRateAmount)) + /** + * 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 [Builder.weeklyRentalRateAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun weeklyRentalRateAmount(weeklyRentalRateAmount: Long) = - weeklyRentalRateAmount(weeklyRentalRateAmount as Long?) + /** + * 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.weeklyRentalRateAmount] with - * `weeklyRentalRateAmount.orElse(null)`. - */ - fun weeklyRentalRateAmount(weeklyRentalRateAmount: Optional) = - weeklyRentalRateAmount(weeklyRentalRateAmount.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.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 [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 - /** - * 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 [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 - /** - * Alias for calling [Builder.weeklyRentalRateCurrency] with - * `weeklyRentalRateCurrency.orElse(null)`. - */ - fun weeklyRentalRateCurrency(weeklyRentalRateCurrency: Optional) = - weeklyRentalRateCurrency(weeklyRentalRateCurrency.getOrNull()) + /** + * 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 - /** - * 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 [presentmentCurrency]. + * + * Unlike [presentmentCurrency], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("presentment_currency") + @ExcludeMissing + fun _presentmentCurrency(): JsonField = presentmentCurrency - fun additionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** + * 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 - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, 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 - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } + /** + * 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 - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** - * 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(), - ) - } + fun toBuilder() = Builder().from(this) - private var validated: Boolean = false + companion object { - fun validate(): CarRental = apply { - if (validated) { - return@apply - } + /** + * Returns a mutable builder for constructing an instance of [CardIncrement]. + * + * The following fields are required: + * ```java + * .id() + * .actioner() + * .additionalAmounts() + * .amount() + * .cardAuthorizationId() + * .currency() + * .network() + * .networkIdentifiers() + * .networkRiskScore() + * .pendingTransactionId() + * .presentmentAmount() + * .presentmentCurrency() + * .realTimeDecisionId() + * .type() + * .updatedAuthorizationAmount() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - carClassCode() - checkoutDate() - dailyRentalRateAmount() - dailyRentalRateCurrency() - daysRented() - extraCharges().ifPresent { it.validate() } - fuelChargesAmount() - fuelChargesCurrency() - insuranceChargesAmount() - insuranceChargesCurrency() - noShowIndicator().ifPresent { it.validate() } - oneWayDropOffChargesAmount() - oneWayDropOffChargesCurrency() - renterName() - weeklyRentalRateAmount() - weeklyRentalRateCurrency() - validated = true - } + /** A builder for [CardIncrement]. */ + class Builder internal constructor() { - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + private var id: JsonField? = null + private var actioner: JsonField? = null + private var additionalAmounts: JsonField? = null + private var amount: JsonField? = null + private var cardAuthorizationId: JsonField? = null + private var currency: JsonField? = null + private var network: JsonField? = null + private var networkIdentifiers: JsonField? = null + private var networkRiskScore: JsonField? = null + private var pendingTransactionId: JsonField? = null + private var presentmentAmount: JsonField? = null + private var presentmentCurrency: JsonField? = null + private var realTimeDecisionId: JsonField? = null + private var type: JsonField? = null + private var updatedAuthorizationAmount: 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 (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) + @JvmSynthetic + internal fun from(cardIncrement: CardIncrement) = apply { + id = cardIncrement.id + actioner = cardIncrement.actioner + additionalAmounts = cardIncrement.additionalAmounts + amount = cardIncrement.amount + cardAuthorizationId = cardIncrement.cardAuthorizationId + currency = cardIncrement.currency + network = cardIncrement.network + networkIdentifiers = cardIncrement.networkIdentifiers + networkRiskScore = cardIncrement.networkRiskScore + pendingTransactionId = cardIncrement.pendingTransactionId + presentmentAmount = cardIncrement.presentmentAmount + presentmentCurrency = cardIncrement.presentmentCurrency + realTimeDecisionId = cardIncrement.realTimeDecisionId + type = cardIncrement.type + updatedAuthorizationAmount = cardIncrement.updatedAuthorizationAmount + additionalProperties = cardIncrement.additionalProperties.toMutableMap() + } - /** Additional charges (gas, late fee, etc.) being billed. */ - class ExtraCharges - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** The Card Increment identifier. */ + fun id(id: String) = id(JsonField.of(id)) - /** - * 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.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 } - companion object { + /** + * Whether this authorization was approved by Increase, the card network through + * stand-in processing, or the user through a real-time decision. + */ + fun actioner(actioner: Actioner) = actioner(JsonField.of(actioner)) - /** No extra charge */ - @JvmField val NO_EXTRA_CHARGE = of("no_extra_charge") + /** + * Sets [Builder.actioner] to an arbitrary JSON value. + * + * You should usually call [Builder.actioner] with a well-typed [Actioner] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun actioner(actioner: JsonField) = apply { this.actioner = actioner } - /** Gas */ - @JvmField val GAS = of("gas") + /** + * 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)) - /** Extra mileage */ - @JvmField val EXTRA_MILEAGE = of("extra_mileage") + /** + * 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 + } - /** Late return */ - @JvmField val LATE_RETURN = of("late_return") + /** + * The amount of this increment in the minor unit of the transaction's currency. For + * dollars, for example, this is cents. + */ + fun amount(amount: Long) = amount(JsonField.of(amount)) - /** One way service fee */ - @JvmField val ONE_WAY_SERVICE_FEE = of("one_way_service_fee") + /** + * 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 } - /** Parking violation */ - @JvmField val PARKING_VIOLATION = of("parking_violation") + /** The identifier for the Card Authorization this increments. */ + fun cardAuthorizationId(cardAuthorizationId: String) = + cardAuthorizationId(JsonField.of(cardAuthorizationId)) - @JvmStatic fun of(value: String) = ExtraCharges(JsonField.of(value)) - } + /** + * 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 + } - /** 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, - } + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the increment's + * currency. + */ + fun currency(currency: Currency) = currency(JsonField.of(currency)) - /** - * 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, - } + /** + * 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, 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 - } + /** The card network used to process this card authorization. */ + fun network(network: Network) = network(JsonField.of(network)) - /** - * 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" - ) - } + /** + * 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 } - /** - * 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") - } + /** Network-specific identifiers for a specific request or transaction. */ + fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) = + networkIdentifiers(JsonField.of(networkIdentifiers)) - private var validated: Boolean = false + /** + * 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 + } - fun validate(): ExtraCharges = apply { - if (validated) { - return@apply - } + /** + * 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. + */ + fun networkRiskScore(networkRiskScore: Long?) = + networkRiskScore(JsonField.ofNullable(networkRiskScore)) - known() - validated = true - } + /** + * Alias for [Builder.networkRiskScore]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun networkRiskScore(networkRiskScore: Long) = + networkRiskScore(networkRiskScore as Long?) - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * Alias for calling [Builder.networkRiskScore] with + * `networkRiskScore.orElse(null)`. + */ + fun networkRiskScore(networkRiskScore: Optional) = + networkRiskScore(networkRiskScore.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.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 + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * The identifier of the Pending Transaction associated with this Card Increment. + */ + fun pendingTransactionId(pendingTransactionId: String?) = + pendingTransactionId(JsonField.ofNullable(pendingTransactionId)) - return /* spotless:off */ other is ExtraCharges && value == other.value /* spotless:on */ - } + /** + * Alias for calling [Builder.pendingTransactionId] with + * `pendingTransactionId.orElse(null)`. + */ + fun pendingTransactionId(pendingTransactionId: Optional) = + pendingTransactionId(pendingTransactionId.getOrNull()) - override fun hashCode() = value.hashCode() + /** + * 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 + } - override fun toString() = value.toString() - } + /** + * The amount of this increment in the minor unit of the transaction's presentment + * currency. + */ + fun presentmentAmount(presentmentAmount: Long) = + presentmentAmount(JsonField.of(presentmentAmount)) - /** - * 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 - private constructor(private val value: JsonField) : Enum { + /** + * 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 + } - /** - * 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 + } - /** Not applicable */ - @JvmField val NOT_APPLICABLE = of("not_applicable") + /** + * The identifier of the Real-Time Decision sent to approve or decline this + * incremental authorization. + */ + fun realTimeDecisionId(realTimeDecisionId: String?) = + realTimeDecisionId(JsonField.ofNullable(realTimeDecisionId)) - /** No show for specialized vehicle */ - @JvmField - val NO_SHOW_FOR_SPECIALIZED_VEHICLE = - of("no_show_for_specialized_vehicle") + /** + * Alias for calling [Builder.realTimeDecisionId] with + * `realTimeDecisionId.orElse(null)`. + */ + fun realTimeDecisionId(realTimeDecisionId: Optional) = + realTimeDecisionId(realTimeDecisionId.getOrNull()) - @JvmStatic fun of(value: String) = NoShowIndicator(JsonField.of(value)) - } + /** + * 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 + } - /** An enum containing [NoShowIndicator]'s known values. */ - enum class Known { - /** Not applicable */ - NOT_APPLICABLE, - /** No show for specialized vehicle */ - NO_SHOW_FOR_SPECIALIZED_VEHICLE, - } + /** + * A constant representing the object's type. For this resource it will always be + * `card_increment`. + */ + fun type(type: Type) = type(JsonField.of(type)) - /** - * 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.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 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 updated authorization amount after this increment, in the minor unit of the + * transaction's currency. For dollars, for example, this is cents. + */ + fun updatedAuthorizationAmount(updatedAuthorizationAmount: Long) = + updatedAuthorizationAmount(JsonField.of(updatedAuthorizationAmount)) - /** - * 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" - ) - } + /** + * 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 + } - /** - * 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 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(): NoShowIndicator = 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. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + /** + * Returns an immutable instance of [CardIncrement]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .actioner() + * .additionalAmounts() + * .amount() + * .cardAuthorizationId() + * .currency() + * .network() + * .networkIdentifiers() + * .networkRiskScore() + * .pendingTransactionId() + * .presentmentAmount() + * .presentmentCurrency() + * .realTimeDecisionId() + * .type() + * .updatedAuthorizationAmount() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CardIncrement = + CardIncrement( + checkRequired("id", id), + checkRequired("actioner", actioner), + checkRequired("additionalAmounts", additionalAmounts), + checkRequired("amount", amount), + checkRequired("cardAuthorizationId", cardAuthorizationId), + checkRequired("currency", currency), + checkRequired("network", network), + checkRequired("networkIdentifiers", networkIdentifiers), + checkRequired("networkRiskScore", networkRiskScore), + checkRequired("pendingTransactionId", pendingTransactionId), + checkRequired("presentmentAmount", presentmentAmount), + checkRequired("presentmentCurrency", presentmentCurrency), + checkRequired("realTimeDecisionId", realTimeDecisionId), + checkRequired("type", type), + checkRequired("updatedAuthorizationAmount", updatedAuthorizationAmount), + additionalProperties.toMutableMap(), + ) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + private var validated: Boolean = false - return /* spotless:off */ other is NoShowIndicator && value == other.value /* spotless:on */ - } + fun validate(): CardIncrement = apply { + if (validated) { + return@apply + } - override fun hashCode() = value.hashCode() + id() + actioner().validate() + additionalAmounts().validate() + amount() + cardAuthorizationId() + currency().validate() + network().validate() + networkIdentifiers().validate() + networkRiskScore() + pendingTransactionId() + presentmentAmount() + presentmentCurrency() + realTimeDecisionId() + type().validate() + updatedAuthorizationAmount() + 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 (id.asKnown().isPresent) 1 else 0) + + (actioner.asKnown().getOrNull()?.validity() ?: 0) + + (additionalAmounts.asKnown().getOrNull()?.validity() ?: 0) + + (if (amount.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 (networkRiskScore.asKnown().isPresent) 1 else 0) + + (if (pendingTransactionId.asKnown().isPresent) 1 else 0) + + (if (presentmentAmount.asKnown().isPresent) 1 else 0) + + (if (presentmentCurrency.asKnown().isPresent) 1 else 0) + + (if (realTimeDecisionId.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (updatedAuthorizationAmount.asKnown().isPresent) 1 else 0) - return /* spotless:off */ 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 /* spotless:on */ - } + /** + * Whether this authorization was approved by Increase, the card network through + * stand-in processing, or the user through a real-time decision. + */ + class Actioner @JsonCreator private constructor(private val value: JsonField) : + Enum { - /* spotless:off */ - 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) } - /* spotless:on */ + /** + * 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() = - "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}" - } + /** This object was actioned by the user through a real-time decision. */ + @JvmField val USER = of("user") - /** Fields specific to lodging. */ - class Lodging - 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, - ) { + /** This object was actioned by Increase without user intervention. */ + @JvmField val INCREASE = of("increase") - @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") - @ExcludeMissing - folioCashAdvancesAmount: JsonField = JsonMissing.of(), - @JsonProperty("folio_cash_advances_currency") - @ExcludeMissing - folioCashAdvancesCurrency: JsonField = JsonMissing.of(), - @JsonProperty("food_beverage_charges_amount") - @ExcludeMissing - foodBeverageChargesAmount: JsonField = JsonMissing.of(), - @JsonProperty("food_beverage_charges_currency") - @ExcludeMissing - foodBeverageChargesCurrency: 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") - @ExcludeMissing - 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( - checkInDate, - dailyRoomRateAmount, - dailyRoomRateCurrency, - extraCharges, - folioCashAdvancesAmount, - folioCashAdvancesCurrency, - foodBeverageChargesAmount, - foodBeverageChargesCurrency, - noShowIndicator, - prepaidExpensesAmount, - prepaidExpensesCurrency, - roomNights, - totalRoomTaxAmount, - totalRoomTaxCurrency, - totalTaxAmount, - totalTaxCurrency, - mutableMapOf(), - ) + /** This object was actioned by the network, through stand-in processing. */ + @JvmField val NETWORK = of("network") - /** - * 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") + @JvmStatic fun of(value: String) = Actioner(JsonField.of(value)) + } - /** - * 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") + /** An enum containing [Actioner]'s known values. */ + enum class Known { + /** This object was actioned by the user through a real-time decision. */ + USER, + /** This object was actioned by Increase without user intervention. */ + INCREASE, + /** This object was actioned by the network, through stand-in processing. */ + NETWORK, + } + /** + * An enum containing [Actioner]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Actioner] 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 { + /** This object was actioned by the user through a real-time decision. */ + USER, + /** This object was actioned by Increase without user intervention. */ + INCREASE, + /** This object was actioned by the network, through stand-in processing. */ + NETWORK, /** - * 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). + * An enum member indicating that [Actioner] was instantiated with an unknown + * value. */ - fun dailyRoomRateCurrency(): Optional = - dailyRoomRateCurrency.getOptional("daily_room_rate_currency") + _UNKNOWN, + } - /** - * 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") + /** + * 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) { + USER -> Value.USER + INCREASE -> Value.INCREASE + NETWORK -> Value.NETWORK + else -> Value._UNKNOWN + } - /** - * 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 folioCashAdvancesAmount(): Optional = - folioCashAdvancesAmount.getOptional("folio_cash_advances_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) { + USER -> Known.USER + INCREASE -> Known.INCREASE + NETWORK -> Known.NETWORK + else -> throw IncreaseInvalidDataException("Unknown Actioner: $value") + } - /** - * 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 folioCashAdvancesCurrency(): Optional = - folioCashAdvancesCurrency.getOptional("folio_cash_advances_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") + } - /** - * 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 foodBeverageChargesAmount(): Optional = - foodBeverageChargesAmount.getOptional("food_beverage_charges_amount") + private var validated: Boolean = false - /** - * 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 foodBeverageChargesCurrency(): Optional = - foodBeverageChargesCurrency.getOptional("food_beverage_charges_currency") + fun validate(): Actioner = apply { + if (validated) { + return@apply + } - /** - * 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 noShowIndicator(): Optional = - noShowIndicator.getOptional("no_show_indicator") + known() + validated = true + } - /** - * 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 prepaidExpensesAmount(): Optional = - prepaidExpensesAmount.getOptional("prepaid_expenses_amount") + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * 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 prepaidExpensesCurrency(): Optional = - prepaidExpensesCurrency.getOptional("prepaid_expenses_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 (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Actioner && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * 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 + private constructor( + private val clinic: JsonField, + private val dental: 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("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, + 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 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 [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 { /** - * Number of nights the room was rented. + * Returns a mutable builder for constructing an instance of + * [AdditionalAmounts]. * - * @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 + * .clinic() + * .dental() + * .prescription() + * .surcharge() + * .totalCumulative() + * .totalHealthcare() + * .transit() + * .unknown() + * .vision() + * ``` */ - fun roomNights(): Optional = roomNights.getOptional("room_nights") + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AdditionalAmounts]. */ + class Builder internal constructor() { + + private var clinic: JsonField? = null + private var dental: 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 + 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()) /** - * Total room tax being charged. + * Sets [Builder.clinic] 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.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 totalRoomTaxAmount(): Optional = - totalRoomTaxAmount.getOptional("total_room_tax_amount") + 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()) /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total - * room tax. + * Sets [Builder.dental] 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.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 totalRoomTaxCurrency(): Optional = - totalRoomTaxCurrency.getOptional("total_room_tax_currency") + fun dental(dental: JsonField) = apply { this.dental = dental } /** - * 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). + * The part of this transaction amount that was for healthcare prescriptions. */ - fun totalTaxAmount(): Optional = - totalTaxAmount.getOptional("total_tax_amount") + fun prescription(prescription: Prescription?) = + prescription(JsonField.ofNullable(prescription)) /** - * 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). + * Alias for calling [Builder.prescription] with `prescription.orElse(null)`. */ - fun totalTaxCurrency(): Optional = - totalTaxCurrency.getOptional("total_tax_currency") + fun prescription(prescription: Optional) = + prescription(prescription.getOrNull()) /** - * Returns the raw JSON value of [checkInDate]. + * Sets [Builder.prescription] to an arbitrary JSON value. * - * Unlike [checkInDate], this method doesn't throw if the JSON field has an - * unexpected type. + * You should usually call [Builder.prescription] with a well-typed + * [Prescription] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. */ - @JsonProperty("check_in_date") - @ExcludeMissing - fun _checkInDate(): JsonField = checkInDate + fun prescription(prescription: JsonField) = apply { + this.prescription = prescription + } + + /** The surcharge amount charged for this transaction by the merchant. */ + fun surcharge(surcharge: Surcharge?) = + surcharge(JsonField.ofNullable(surcharge)) + + /** Alias for calling [Builder.surcharge] with `surcharge.orElse(null)`. */ + fun surcharge(surcharge: Optional) = surcharge(surcharge.getOrNull()) /** - * Returns the raw JSON value of [dailyRoomRateAmount]. + * Sets [Builder.surcharge] to an arbitrary JSON value. * - * Unlike [dailyRoomRateAmount], this method doesn't throw if the JSON field has - * an unexpected type. + * You should usually call [Builder.surcharge] with a well-typed [Surcharge] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ - @JsonProperty("daily_room_rate_amount") - @ExcludeMissing - fun _dailyRoomRateAmount(): JsonField = dailyRoomRateAmount + fun surcharge(surcharge: JsonField) = apply { + this.surcharge = surcharge + } /** - * Returns the raw JSON value of [dailyRoomRateCurrency]. - * - * Unlike [dailyRoomRateCurrency], this method doesn't throw if the JSON field - * has an unexpected type. + * The total amount of a series of incremental authorizations, optionally + * provided. */ - @JsonProperty("daily_room_rate_currency") - @ExcludeMissing - fun _dailyRoomRateCurrency(): JsonField = dailyRoomRateCurrency + fun totalCumulative(totalCumulative: TotalCumulative?) = + totalCumulative(JsonField.ofNullable(totalCumulative)) /** - * Returns the raw JSON value of [extraCharges]. - * - * Unlike [extraCharges], this method doesn't throw if the JSON field has an - * unexpected type. + * Alias for calling [Builder.totalCumulative] with + * `totalCumulative.orElse(null)`. */ - @JsonProperty("extra_charges") - @ExcludeMissing - fun _extraCharges(): JsonField = extraCharges + fun totalCumulative(totalCumulative: Optional) = + totalCumulative(totalCumulative.getOrNull()) /** - * Returns the raw JSON value of [folioCashAdvancesAmount]. + * Sets [Builder.totalCumulative] to an arbitrary JSON value. * - * Unlike [folioCashAdvancesAmount], this method doesn't throw if the JSON field - * has an unexpected type. + * You should usually call [Builder.totalCumulative] with a well-typed + * [TotalCumulative] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - @JsonProperty("folio_cash_advances_amount") - @ExcludeMissing - fun _folioCashAdvancesAmount(): JsonField = folioCashAdvancesAmount + fun totalCumulative(totalCumulative: JsonField) = apply { + this.totalCumulative = totalCumulative + } + + /** The total amount of healthcare-related additional amounts. */ + fun totalHealthcare(totalHealthcare: TotalHealthcare?) = + totalHealthcare(JsonField.ofNullable(totalHealthcare)) /** - * Returns the raw JSON value of [folioCashAdvancesCurrency]. - * - * Unlike [folioCashAdvancesCurrency], this method doesn't throw if the JSON - * field has an unexpected type. + * Alias for calling [Builder.totalHealthcare] with + * `totalHealthcare.orElse(null)`. */ - @JsonProperty("folio_cash_advances_currency") - @ExcludeMissing - fun _folioCashAdvancesCurrency(): JsonField = folioCashAdvancesCurrency + fun totalHealthcare(totalHealthcare: Optional) = + totalHealthcare(totalHealthcare.getOrNull()) /** - * Returns the raw JSON value of [foodBeverageChargesAmount]. + * Sets [Builder.totalHealthcare] to an arbitrary JSON value. * - * Unlike [foodBeverageChargesAmount], this method doesn't throw if the JSON - * field has an unexpected type. + * You should usually call [Builder.totalHealthcare] with a well-typed + * [TotalHealthcare] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - @JsonProperty("food_beverage_charges_amount") - @ExcludeMissing - fun _foodBeverageChargesAmount(): JsonField = foodBeverageChargesAmount + fun totalHealthcare(totalHealthcare: JsonField) = apply { + this.totalHealthcare = totalHealthcare + } /** - * Returns the raw JSON value of [foodBeverageChargesCurrency]. - * - * Unlike [foodBeverageChargesCurrency], this method doesn't throw if the JSON - * field has an unexpected type. + * The part of this transaction amount that was for transit-related services. */ - @JsonProperty("food_beverage_charges_currency") - @ExcludeMissing - fun _foodBeverageChargesCurrency(): JsonField = - foodBeverageChargesCurrency + fun transit(transit: Transit?) = transit(JsonField.ofNullable(transit)) + + /** Alias for calling [Builder.transit] with `transit.orElse(null)`. */ + fun transit(transit: Optional) = transit(transit.getOrNull()) /** - * Returns the raw JSON value of [noShowIndicator]. + * Sets [Builder.transit] to an arbitrary JSON value. * - * Unlike [noShowIndicator], this method doesn't throw if the JSON field has an - * unexpected type. + * You should usually call [Builder.transit] with a well-typed [Transit] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - @JsonProperty("no_show_indicator") - @ExcludeMissing - fun _noShowIndicator(): JsonField = noShowIndicator + fun transit(transit: JsonField) = apply { this.transit = transit } + + /** An unknown additional amount. */ + fun unknown(unknown: Unknown?) = unknown(JsonField.ofNullable(unknown)) + + /** Alias for calling [Builder.unknown] with `unknown.orElse(null)`. */ + fun unknown(unknown: Optional) = unknown(unknown.getOrNull()) /** - * Returns the raw JSON value of [prepaidExpensesAmount]. + * Sets [Builder.unknown] to an arbitrary JSON value. * - * Unlike [prepaidExpensesAmount], this method doesn't throw if the JSON field - * has an unexpected type. + * You should usually call [Builder.unknown] with a well-typed [Unknown] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - @JsonProperty("prepaid_expenses_amount") - @ExcludeMissing - fun _prepaidExpensesAmount(): JsonField = prepaidExpensesAmount + fun unknown(unknown: JsonField) = apply { this.unknown = unknown } + + /** The part of this transaction amount that was for vision-related services. */ + fun vision(vision: Vision?) = vision(JsonField.ofNullable(vision)) + + /** Alias for calling [Builder.vision] with `vision.orElse(null)`. */ + fun vision(vision: Optional) = vision(vision.getOrNull()) /** - * Returns the raw JSON value of [prepaidExpensesCurrency]. + * Sets [Builder.vision] to an arbitrary JSON value. * - * Unlike [prepaidExpensesCurrency], this method doesn't throw if the JSON field - * has an unexpected type. + * You should usually call [Builder.vision] with a well-typed [Vision] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - @JsonProperty("prepaid_expenses_currency") - @ExcludeMissing - fun _prepaidExpensesCurrency(): JsonField = prepaidExpensesCurrency + fun vision(vision: JsonField) = apply { this.vision = vision } + + 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 the raw JSON value of [roomNights]. + * Returns an immutable instance of [AdditionalAmounts]. * - * Unlike [roomNights], this method doesn't throw if the JSON field has an - * unexpected type. + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .clinic() + * .dental() + * .prescription() + * .surcharge() + * .totalCumulative() + * .totalHealthcare() + * .transit() + * .unknown() + * .vision() + * ``` + * + * @throws IllegalStateException if any required field is unset. */ - @JsonProperty("room_nights") - @ExcludeMissing - fun _roomNights(): JsonField = roomNights + fun build(): AdditionalAmounts = + AdditionalAmounts( + checkRequired("clinic", clinic), + checkRequired("dental", dental), + checkRequired("prescription", prescription), + checkRequired("surcharge", surcharge), + checkRequired("totalCumulative", totalCumulative), + checkRequired("totalHealthcare", totalHealthcare), + checkRequired("transit", transit), + checkRequired("unknown", unknown), + checkRequired("vision", vision), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): AdditionalAmounts = apply { + if (validated) { + return@apply + } + + clinic().ifPresent { it.validate() } + dental().ifPresent { it.validate() } + prescription().ifPresent { it.validate() } + surcharge().ifPresent { it.validate() } + totalCumulative().ifPresent { it.validate() } + totalHealthcare().ifPresent { it.validate() } + transit().ifPresent { it.validate() } + unknown().ifPresent { it.validate() } + vision().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 = + (clinic.asKnown().getOrNull()?.validity() ?: 0) + + (dental.asKnown().getOrNull()?.validity() ?: 0) + + (prescription.asKnown().getOrNull()?.validity() ?: 0) + + (surcharge.asKnown().getOrNull()?.validity() ?: 0) + + (totalCumulative.asKnown().getOrNull()?.validity() ?: 0) + + (totalHealthcare.asKnown().getOrNull()?.validity() ?: 0) + + (transit.asKnown().getOrNull()?.validity() ?: 0) + + (unknown.asKnown().getOrNull()?.validity() ?: 0) + + (vision.asKnown().getOrNull()?.validity() ?: 0) + + /** The part of this transaction amount that was for clinic-related services. */ + class Clinic + 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()) /** - * Returns the raw JSON value of [totalRoomTaxAmount]. + * The amount in minor units of the `currency` field. * - * Unlike [totalRoomTaxAmount], this method doesn't throw if the JSON field has - * an unexpected type. + * @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). */ - @JsonProperty("total_room_tax_amount") - @ExcludeMissing - fun _totalRoomTaxAmount(): JsonField = totalRoomTaxAmount + fun amount(): Long = amount.getRequired("amount") /** - * Returns the raw JSON value of [totalRoomTaxCurrency]. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. * - * Unlike [totalRoomTaxCurrency], this method doesn't throw if the JSON field - * has an unexpected type. + * @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). */ - @JsonProperty("total_room_tax_currency") - @ExcludeMissing - fun _totalRoomTaxCurrency(): JsonField = totalRoomTaxCurrency + fun currency(): String = currency.getRequired("currency") /** - * Returns the raw JSON value of [totalTaxAmount]. + * Returns the raw JSON value of [amount]. * - * Unlike [totalTaxAmount], this method doesn't throw if the JSON field has an + * Unlike [amount], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("total_tax_amount") - @ExcludeMissing - fun _totalTaxAmount(): JsonField = totalTaxAmount + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount /** - * Returns the raw JSON value of [totalTaxCurrency]. + * Returns the raw JSON value of [currency]. * - * Unlike [totalTaxCurrency], this method doesn't throw if the JSON field has an + * Unlike [currency], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("total_tax_currency") + @JsonProperty("currency") @ExcludeMissing - fun _totalTaxCurrency(): JsonField = totalTaxCurrency + fun _currency(): JsonField = currency @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -23378,509 +23761,493 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [Lodging]. + * Returns a mutable builder for constructing an instance of [Clinic]. * * The following fields are required: * ```java - * .checkInDate() - * .dailyRoomRateAmount() - * .dailyRoomRateCurrency() - * .extraCharges() - * .folioCashAdvancesAmount() - * .folioCashAdvancesCurrency() - * .foodBeverageChargesAmount() - * .foodBeverageChargesCurrency() - * .noShowIndicator() - * .prepaidExpensesAmount() - * .prepaidExpensesCurrency() - * .roomNights() - * .totalRoomTaxAmount() - * .totalRoomTaxCurrency() - * .totalTaxAmount() - * .totalTaxCurrency() + * .amount() + * .currency() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [Lodging]. */ + /** A builder for [Clinic]. */ 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 amount: JsonField? = null + private var currency: 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 + internal fun from(clinic: Clinic) = apply { + amount = clinic.amount + currency = clinic.currency + additionalProperties = clinic.additionalProperties.toMutableMap() } - /** Daily rate being charged for the room. */ - fun dailyRoomRateAmount(dailyRoomRateAmount: Long?) = - dailyRoomRateAmount(JsonField.ofNullable(dailyRoomRateAmount)) + /** The amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) /** - * Alias for [Builder.dailyRoomRateAmount]. + * Sets [Builder.amount] to an arbitrary JSON value. * - * This unboxed primitive overload exists for backwards compatibility. + * 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 dailyRoomRateAmount(dailyRoomRateAmount: Long) = - dailyRoomRateAmount(dailyRoomRateAmount as Long?) + fun amount(amount: JsonField) = apply { this.amount = amount } /** - * Alias for calling [Builder.dailyRoomRateAmount] with - * `dailyRoomRateAmount.orElse(null)`. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. */ - fun dailyRoomRateAmount(dailyRoomRateAmount: Optional) = - dailyRoomRateAmount(dailyRoomRateAmount.getOrNull()) + fun currency(currency: String) = currency(JsonField.of(currency)) /** - * Sets [Builder.dailyRoomRateAmount] to an arbitrary JSON value. + * Sets [Builder.currency] 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. + * You should usually call [Builder.currency] with a well-typed [String] + * 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 currency(currency: JsonField) = apply { + this.currency = currency } - /** - * 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) = + fun additionalProperties(additionalProperties: Map) = apply { - this.dailyRoomRateCurrency = dailyRoomRateCurrency + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) } - /** Additional charges (phone, late check-out, etc.) being billed. */ - fun extraCharges(extraCharges: ExtraCharges?) = - extraCharges(JsonField.ofNullable(extraCharges)) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * Alias for calling [Builder.extraCharges] with - * `extraCharges.orElse(null)`. - */ - fun extraCharges(extraCharges: Optional) = - extraCharges(extraCharges.getOrNull()) + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } - /** - * 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 removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) } - /** Folio cash advances for the room. */ - fun folioCashAdvancesAmount(folioCashAdvancesAmount: Long?) = - folioCashAdvancesAmount(JsonField.ofNullable(folioCashAdvancesAmount)) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } /** - * Alias for [Builder.folioCashAdvancesAmount]. + * Returns an immutable instance of [Clinic]. * - * This unboxed primitive overload exists for backwards compatibility. + * 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 folioCashAdvancesAmount(folioCashAdvancesAmount: Long) = - folioCashAdvancesAmount(folioCashAdvancesAmount as Long?) + fun build(): Clinic = + Clinic( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } - /** - * Alias for calling [Builder.folioCashAdvancesAmount] with - * `folioCashAdvancesAmount.orElse(null)`. - */ - fun folioCashAdvancesAmount(folioCashAdvancesAmount: Optional) = - folioCashAdvancesAmount(folioCashAdvancesAmount.getOrNull()) + private var validated: Boolean = false - /** - * Sets [Builder.folioCashAdvancesAmount] 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. - */ - fun folioCashAdvancesAmount(folioCashAdvancesAmount: JsonField) = - apply { - this.folioCashAdvancesAmount = folioCashAdvancesAmount - } + fun validate(): Clinic = apply { + if (validated) { + return@apply + } - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the folio - * cash advances. - */ - fun folioCashAdvancesCurrency(folioCashAdvancesCurrency: String?) = - folioCashAdvancesCurrency( - JsonField.ofNullable(folioCashAdvancesCurrency) - ) + amount() + currency() + validated = true + } - /** - * Alias for calling [Builder.folioCashAdvancesCurrency] with - * `folioCashAdvancesCurrency.orElse(null)`. - */ - fun folioCashAdvancesCurrency(folioCashAdvancesCurrency: Optional) = - folioCashAdvancesCurrency(folioCashAdvancesCurrency.getOrNull()) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * Sets [Builder.folioCashAdvancesCurrency] 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. - */ - fun folioCashAdvancesCurrency( - folioCashAdvancesCurrency: JsonField - ) = apply { this.folioCashAdvancesCurrency = folioCashAdvancesCurrency } + /** + * 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 (currency.asKnown().isPresent) 1 else 0) - /** Food and beverage charges for the room. */ - fun foodBeverageChargesAmount(foodBeverageChargesAmount: Long?) = - foodBeverageChargesAmount( - JsonField.ofNullable(foodBeverageChargesAmount) - ) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Alias for [Builder.foodBeverageChargesAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun foodBeverageChargesAmount(foodBeverageChargesAmount: Long) = - foodBeverageChargesAmount(foodBeverageChargesAmount as Long?) + return /* spotless:off */ other is Clinic && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * Alias for calling [Builder.foodBeverageChargesAmount] with - * `foodBeverageChargesAmount.orElse(null)`. - */ - fun foodBeverageChargesAmount(foodBeverageChargesAmount: Optional) = - foodBeverageChargesAmount(foodBeverageChargesAmount.getOrNull()) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ - /** - * Sets [Builder.foodBeverageChargesAmount] 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. - */ - fun foodBeverageChargesAmount(foodBeverageChargesAmount: JsonField) = - apply { - this.foodBeverageChargesAmount = foodBeverageChargesAmount - } + override fun hashCode(): Int = hashCode - /** - * 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) - ) + override fun toString() = + "Clinic{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } - /** - * Alias for calling [Builder.foodBeverageChargesCurrency] with - * `foodBeverageChargesCurrency.orElse(null)`. - */ - fun foodBeverageChargesCurrency( - foodBeverageChargesCurrency: Optional - ) = foodBeverageChargesCurrency(foodBeverageChargesCurrency.getOrNull()) + /** The part of this transaction amount that was for dental-related services. */ + class Dental + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { - /** - * Sets [Builder.foodBeverageChargesCurrency] to an arbitrary JSON 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 foodBeverageChargesCurrency( - foodBeverageChargesCurrency: JsonField - ) = apply { this.foodBeverageChargesCurrency = foodBeverageChargesCurrency } + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) - /** - * Indicator that the cardholder is being billed for a reserved room that - * was not actually used. - */ - fun noShowIndicator(noShowIndicator: NoShowIndicator?) = - noShowIndicator(JsonField.ofNullable(noShowIndicator)) + /** + * The amount in minor units of the `currency` field. + * + * @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") - /** - * Alias for calling [Builder.noShowIndicator] with - * `noShowIndicator.orElse(null)`. - */ - fun noShowIndicator(noShowIndicator: Optional) = - noShowIndicator(noShowIndicator.getOrNull()) + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount'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(): String = currency.getRequired("currency") - /** - * 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 - } + /** + * 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 - /** Prepaid expenses being charged for the room. */ - fun prepaidExpensesAmount(prepaidExpensesAmount: Long?) = - prepaidExpensesAmount(JsonField.ofNullable(prepaidExpensesAmount)) + /** + * 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 [Builder.prepaidExpensesAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun prepaidExpensesAmount(prepaidExpensesAmount: Long) = - prepaidExpensesAmount(prepaidExpensesAmount as Long?) + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - /** - * Alias for calling [Builder.prepaidExpensesAmount] with - * `prepaidExpensesAmount.orElse(null)`. - */ - fun prepaidExpensesAmount(prepaidExpensesAmount: Optional) = - prepaidExpensesAmount(prepaidExpensesAmount.getOrNull()) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { /** - * Sets [Builder.prepaidExpensesAmount] to an arbitrary JSON value. + * Returns a mutable builder for constructing an instance of [Dental]. * - * 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. + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` */ - fun prepaidExpensesAmount(prepaidExpensesAmount: JsonField) = apply { - this.prepaidExpensesAmount = prepaidExpensesAmount - } + @JvmStatic fun builder() = Builder() + } - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - * prepaid expenses. - */ - fun prepaidExpensesCurrency(prepaidExpensesCurrency: String?) = - prepaidExpensesCurrency(JsonField.ofNullable(prepaidExpensesCurrency)) + /** A builder for [Dental]. */ + class Builder internal constructor() { - /** - * Alias for calling [Builder.prepaidExpensesCurrency] with - * `prepaidExpensesCurrency.orElse(null)`. - */ - fun prepaidExpensesCurrency(prepaidExpensesCurrency: Optional) = - prepaidExpensesCurrency(prepaidExpensesCurrency.getOrNull()) + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() - /** - * Sets [Builder.prepaidExpensesCurrency] 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. - */ - fun prepaidExpensesCurrency(prepaidExpensesCurrency: JsonField) = - apply { - this.prepaidExpensesCurrency = prepaidExpensesCurrency - } + @JvmSynthetic + internal fun from(dental: Dental) = apply { + amount = dental.amount + currency = dental.currency + additionalProperties = dental.additionalProperties.toMutableMap() + } - /** Number of nights the room was rented. */ - fun roomNights(roomNights: Long?) = - roomNights(JsonField.ofNullable(roomNights)) + /** The amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) /** - * Alias for [Builder.roomNights]. + * Sets [Builder.amount] to an arbitrary JSON value. * - * This unboxed primitive overload exists for backwards compatibility. + * 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 roomNights(roomNights: Long) = roomNights(roomNights as Long?) + fun amount(amount: JsonField) = apply { this.amount = amount } /** - * Alias for calling [Builder.roomNights] with `roomNights.orElse(null)`. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. */ - fun roomNights(roomNights: Optional) = - roomNights(roomNights.getOrNull()) + fun currency(currency: String) = currency(JsonField.of(currency)) /** - * Sets [Builder.roomNights] to an arbitrary JSON value. + * Sets [Builder.currency] to an arbitrary JSON value. * - * You should usually call [Builder.roomNights] with a well-typed [Long] + * You should usually call [Builder.currency] 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 currency(currency: JsonField) = apply { + this.currency = currency } - /** Total room tax being charged. */ - fun totalRoomTaxAmount(totalRoomTaxAmount: Long?) = - totalRoomTaxAmount(JsonField.ofNullable(totalRoomTaxAmount)) + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * Alias for [Builder.totalRoomTaxAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun totalRoomTaxAmount(totalRoomTaxAmount: Long) = - totalRoomTaxAmount(totalRoomTaxAmount as Long?) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * Alias for calling [Builder.totalRoomTaxAmount] with - * `totalRoomTaxAmount.orElse(null)`. - */ - fun totalRoomTaxAmount(totalRoomTaxAmount: Optional) = - totalRoomTaxAmount(totalRoomTaxAmount.getOrNull()) + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } - /** - * 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 + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) } - /** - * 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()) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } /** - * Sets [Builder.totalRoomTaxCurrency] to an arbitrary JSON value. + * Returns an immutable instance of [Dental]. * - * 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. + * 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 totalRoomTaxCurrency(totalRoomTaxCurrency: JsonField) = apply { - this.totalRoomTaxCurrency = totalRoomTaxCurrency - } + fun build(): Dental = + Dental( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } - /** Total tax being charged for the room. */ - fun totalTaxAmount(totalTaxAmount: Long?) = - totalTaxAmount(JsonField.ofNullable(totalTaxAmount)) + private var validated: Boolean = false - /** - * Alias for [Builder.totalTaxAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun totalTaxAmount(totalTaxAmount: Long) = - totalTaxAmount(totalTaxAmount as Long?) + fun validate(): Dental = apply { + if (validated) { + return@apply + } - /** - * Alias for calling [Builder.totalTaxAmount] with - * `totalTaxAmount.orElse(null)`. - */ - fun totalTaxAmount(totalTaxAmount: Optional) = - totalTaxAmount(totalTaxAmount.getOrNull()) + amount() + currency() + validated = true + } - /** - * Sets [Builder.totalTaxAmount] to an arbitrary JSON 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 (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Dental && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Dental{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** The part of this transaction amount that was for healthcare prescriptions. */ + class Prescription + 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 amount in minor units of the `currency` field. + * + * @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 + * additional amount'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(): String = 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 [Prescription]. * - * 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. + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` */ - fun totalTaxAmount(totalTaxAmount: JsonField) = apply { - this.totalTaxAmount = totalTaxAmount + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Prescription]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(prescription: Prescription) = apply { + amount = prescription.amount + currency = prescription.currency + additionalProperties = prescription.additionalProperties.toMutableMap() } + /** The amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) + /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total - * tax assessed. + * 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 totalTaxCurrency(totalTaxCurrency: String?) = - totalTaxCurrency(JsonField.ofNullable(totalTaxCurrency)) + fun amount(amount: JsonField) = apply { this.amount = amount } /** - * Alias for calling [Builder.totalTaxCurrency] with - * `totalTaxCurrency.orElse(null)`. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. */ - fun totalTaxCurrency(totalTaxCurrency: Optional) = - totalTaxCurrency(totalTaxCurrency.getOrNull()) + fun currency(currency: String) = currency(JsonField.of(currency)) /** - * Sets [Builder.totalTaxCurrency] to an arbitrary JSON value. + * Sets [Builder.currency] 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.currency] 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 currency(currency: JsonField) = apply { + this.currency = currency } fun additionalProperties(additionalProperties: Map) = @@ -23906,86 +24273,35 @@ private constructor( } /** - * Returns an immutable instance of [Lodging]. + * Returns an immutable instance of [Prescription]. * * 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() + * .amount() + * .currency() * ``` * * @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), + fun build(): Prescription = + Prescription( + checkRequired("amount", amount), + checkRequired("currency", currency), additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): Lodging = apply { + fun validate(): Prescription = 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() + amount() + currency() validated = true } @@ -24005,522 +24321,644 @@ 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) + (if (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) - /** Additional charges (phone, late check-out, etc.) being billed. */ - class ExtraCharges - @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 /* spotless:off */ other is Prescription && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } - companion object { + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ - /** No extra charge */ - @JvmField val NO_EXTRA_CHARGE = of("no_extra_charge") + override fun hashCode(): Int = hashCode - /** Restaurant */ - @JvmField val RESTAURANT = of("restaurant") + override fun toString() = + "Prescription{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } - /** Gift shop */ - @JvmField val GIFT_SHOP = of("gift_shop") + /** The surcharge amount charged for this transaction by the merchant. */ + class Surcharge + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { - /** Mini bar */ - @JvmField val MINI_BAR = of("mini_bar") + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) - /** Telephone */ - @JvmField val TELEPHONE = of("telephone") + /** + * The amount in minor units of the `currency` field. + * + * @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") - /** Other */ - @JvmField val OTHER = of("other") + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount'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(): String = currency.getRequired("currency") - /** Laundry */ - @JvmField val LAUNDRY = of("laundry") + /** + * 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 - @JvmStatic fun of(value: String) = ExtraCharges(JsonField.of(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 - /** 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, - } + @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 { /** - * An enum containing [ExtraCharges]'s known values, as well as an - * [_UNKNOWN] member. + * Returns a mutable builder for constructing an instance of [Surcharge]. * - * 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. + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` */ - 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, + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Surcharge]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(surcharge: Surcharge) = apply { + amount = surcharge.amount + currency = surcharge.currency + additionalProperties = surcharge.additionalProperties.toMutableMap() } + /** The amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) + /** - * 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.amount] 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.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 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 amount(amount: JsonField) = apply { this.amount = 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. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. */ - 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 currency(currency: String) = currency(JsonField.of(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. + * Sets [Builder.currency] 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.currency] 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") + fun currency(currency: JsonField) = apply { + this.currency = currency + } + + 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(): ExtraCharges = 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 [Surcharge]. * - * Used for best match union deserialization. + * 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. */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + fun build(): Surcharge = + Surcharge( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + private var validated: Boolean = false - return /* spotless:off */ other is ExtraCharges && value == other.value /* spotless:on */ + fun validate(): Surcharge = apply { + if (validated) { + return@apply } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() + amount() + currency() + validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + /** - * Indicator that the cardholder is being billed for a reserved room that was - * not actually used. + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. */ - class NoShowIndicator - @JsonCreator - private constructor(private val value: JsonField) : Enum { + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) - /** - * 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 /* spotless:off */ other is Surcharge && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** Not applicable */ - @JvmField val NOT_APPLICABLE = of("not_applicable") + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ - /** No show */ - @JvmField val NO_SHOW = of("no_show") + override fun hashCode(): Int = hashCode - @JvmStatic fun of(value: String) = NoShowIndicator(JsonField.of(value)) - } + override fun toString() = + "Surcharge{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } - /** An enum containing [NoShowIndicator]'s known values. */ - enum class Known { - /** Not applicable */ - NOT_APPLICABLE, - /** No show */ - NO_SHOW, - } + /** + * The total amount of a series of incremental authorizations, optionally provided. + */ + class TotalCumulative + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { - /** - * 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. + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) + + /** + * The amount in minor units of the `currency` field. + * + * @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 + * additional amount'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(): String = 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 + * [TotalCumulative]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` */ - enum class Value { - /** Not applicable */ - NOT_APPLICABLE, - /** No show */ - NO_SHOW, - /** - * An enum member indicating that [NoShowIndicator] was instantiated - * with an unknown value. - */ - _UNKNOWN, + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TotalCumulative]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(totalCumulative: TotalCumulative) = apply { + amount = totalCumulative.amount + currency = totalCumulative.currency + additionalProperties = + totalCumulative.additionalProperties.toMutableMap() } + /** The amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) + /** - * 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.amount] 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.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 value(): Value = - when (this) { - NOT_APPLICABLE -> Value.NOT_APPLICABLE - NO_SHOW -> Value.NO_SHOW - else -> Value._UNKNOWN - } + fun amount(amount: JsonField) = apply { this.amount = 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. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. */ - fun known(): Known = - when (this) { - NOT_APPLICABLE -> Known.NOT_APPLICABLE - NO_SHOW -> Known.NO_SHOW - else -> - throw IncreaseInvalidDataException( - "Unknown NoShowIndicator: $value" - ) - } + fun currency(currency: String) = currency(JsonField.of(currency)) /** - * Returns this class instance's primitive wire representation. + * Sets [Builder.currency] to an arbitrary JSON 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. + * You should usually call [Builder.currency] 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") + fun currency(currency: JsonField) = apply { + this.currency = currency + } + + 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(): NoShowIndicator = 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 [TotalCumulative]. * - * Used for best match union deserialization. + * 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. */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + fun build(): TotalCumulative = + TotalCumulative( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + private var validated: Boolean = false - return /* spotless:off */ other is NoShowIndicator && value == other.value /* spotless:on */ + fun validate(): TotalCumulative = apply { + if (validated) { + return@apply } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ 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 /* spotless:on */ + return /* spotless:off */ other is TotalCumulative && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - 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) } + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } /* spotless:on */ 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}" + "TotalCumulative{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" } - /** The format of the purchase identifier. */ - class PurchaseIdentifierFormat - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** The total amount of healthcare-related additional amounts. */ + class TotalHealthcare + 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()) /** - * Returns this class instance's raw value. + * The amount in minor units of the `currency` field. * - * 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 + fun amount(): Long = amount.getRequired("amount") - companion object { + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount'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(): String = currency.getRequired("currency") - /** Free text */ - @JvmField val FREE_TEXT = of("free_text") + /** + * 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 - /** Order number */ - @JvmField val ORDER_NUMBER = of("order_number") + /** + * 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 - /** Rental agreement number */ - @JvmField val RENTAL_AGREEMENT_NUMBER = of("rental_agreement_number") + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - /** Hotel folio number */ - @JvmField val HOTEL_FOLIO_NUMBER = of("hotel_folio_number") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** Invoice number */ - @JvmField val INVOICE_NUMBER = of("invoice_number") + fun toBuilder() = Builder().from(this) - @JvmStatic - fun of(value: String) = PurchaseIdentifierFormat(JsonField.of(value)) - } + companion object { - /** 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 a mutable builder for constructing an instance of + * [TotalHealthcare]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() } - /** - * 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, + /** A builder for [TotalHealthcare]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(totalHealthcare: TotalHealthcare) = apply { + amount = totalHealthcare.amount + currency = totalHealthcare.currency + additionalProperties = + totalHealthcare.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) + /** - * An enum member indicating that [PurchaseIdentifierFormat] was - * instantiated with an unknown value. + * 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. */ - _UNKNOWN, - } + fun amount(amount: JsonField) = apply { this.amount = 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) { - 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 + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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) { - 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" - ) + 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 [TotalHealthcare]. + * + * 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(): TotalHealthcare = + TotalHealthcare( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + private var validated: Boolean = false - fun validate(): PurchaseIdentifierFormat = apply { + fun validate(): TotalHealthcare = apply { if (validated) { return@apply } - known() + amount() + currency() validated = true } @@ -24539,323 +24977,516 @@ 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 (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is PurchaseIdentifierFormat && value == other.value /* spotless:on */ + return /* spotless:off */ other is TotalHealthcare && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } - override fun hashCode() = value.hashCode() + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ - override fun toString() = value.toString() + override fun hashCode(): Int = hashCode + + override fun toString() = + "TotalHealthcare{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" } - /** Fields specific to travel. */ - class Travel + /** The part of this transaction amount that was for transit-related services. */ + class Transit 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 amount: JsonField, + private val currency: JsonField, private val additionalProperties: MutableMap, ) { @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") + @JsonProperty("amount") @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") + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing - tripLegs: JsonField> = JsonMissing.of(), - ) : this( - ancillary, - computerizedReservationSystem, - creditReasonIndicator, - departureDate, - originationCityAirportCode, - passengerName, - restrictedTicketIndicator, - ticketChangeIndicator, - ticketNumber, - travelAgencyCode, - travelAgencyName, - tripLegs, - mutableMapOf(), - ) + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) /** - * Ancillary purchases in addition to the airfare. + * The amount in minor units of the `currency` field. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). */ - fun ancillary(): Optional = ancillary.getOptional("ancillary") + fun amount(): Long = amount.getRequired("amount") /** - * Indicates the computerized reservation system used to book the ticket. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). */ - fun computerizedReservationSystem(): Optional = - computerizedReservationSystem.getOptional("computerized_reservation_system") + fun currency(): String = currency.getRequired("currency") /** - * Indicates the reason for a credit to the cardholder. + * 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). + * Unlike [amount], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun creditReasonIndicator(): Optional = - creditReasonIndicator.getOptional("credit_reason_indicator") + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount /** - * Date of departure. + * 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 departureDate(): Optional = - departureDate.getOptional("departure_date") + @JsonProperty("currency") + @ExcludeMissing + fun _currency(): JsonField = currency - /** - * 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") + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - /** - * 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") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** - * 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") + fun toBuilder() = Builder().from(this) - /** - * 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") + companion object { - /** - * 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") + /** + * Returns a mutable builder for constructing an instance of [Transit]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Transit]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(transit: Transit) = apply { + amount = transit.amount + currency = transit.currency + additionalProperties = transit.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [Transit]. + * + * 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(): Transit = + Transit( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Transit = apply { + if (validated) { + return@apply + } + + amount() + currency() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } /** - * Code for the travel agency if the ticket was issued by a travel agency. + * 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 travelAgencyCode(): Optional = - travelAgencyCode.getOptional("travel_agency_code") + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Transit && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Transit{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** An unknown additional amount. */ + class Unknown + 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()) /** - * Name of the travel agency if the ticket was issued by a travel agency. + * The amount in minor units of the `currency` field. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). */ - fun travelAgencyName(): Optional = - travelAgencyName.getOptional("travel_agency_name") + fun amount(): Long = amount.getRequired("amount") /** - * Fields specific to each leg of the journey. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). */ - fun tripLegs(): Optional> = tripLegs.getOptional("trip_legs") + fun currency(): String = currency.getRequired("currency") /** - * Returns the raw JSON value of [ancillary]. + * Returns the raw JSON value of [amount]. * - * Unlike [ancillary], this method doesn't throw if the JSON field has an + * Unlike [amount], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("ancillary") - @ExcludeMissing - fun _ancillary(): JsonField = ancillary + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount /** - * Returns the raw JSON value of [computerizedReservationSystem]. + * Returns the raw JSON value of [currency]. * - * Unlike [computerizedReservationSystem], 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("computerized_reservation_system") + @JsonProperty("currency") @ExcludeMissing - fun _computerizedReservationSystem(): JsonField = - computerizedReservationSystem + fun _currency(): JsonField = currency - /** - * 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 + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - /** - * 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") + @JsonAnyGetter @ExcludeMissing - fun _departureDate(): JsonField = departureDate + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** - * 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 toBuilder() = Builder().from(this) - /** - * 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 + companion object { - /** - * 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 a mutable builder for constructing an instance of [Unknown]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Unknown]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(unknown: Unknown) = apply { + amount = unknown.amount + currency = unknown.currency + additionalProperties = unknown.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [Unknown]. + * + * 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(): Unknown = + Unknown( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Unknown = apply { + if (validated) { + return@apply + } + + amount() + currency() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } /** - * Returns the raw JSON value of [ticketChangeIndicator]. + * Returns a score indicating how many valid values are contained in this object + * recursively. * - * Unlike [ticketChangeIndicator], this method doesn't throw if the JSON field - * has an unexpected type. + * Used for best match union deserialization. */ - @JsonProperty("ticket_change_indicator") - @ExcludeMissing - fun _ticketChangeIndicator(): JsonField = - ticketChangeIndicator + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Unknown && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Unknown{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** The part of this transaction amount that was for vision-related services. */ + class Vision + 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()) /** - * Returns the raw JSON value of [ticketNumber]. + * The amount in minor units of the `currency` field. * - * Unlike [ticketNumber], this method doesn't throw if the JSON field has an - * unexpected type. + * @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). */ - @JsonProperty("ticket_number") - @ExcludeMissing - fun _ticketNumber(): JsonField = ticketNumber + fun amount(): Long = amount.getRequired("amount") /** - * Returns the raw JSON value of [travelAgencyCode]. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. * - * Unlike [travelAgencyCode], this method doesn't throw if the JSON field has an - * unexpected type. + * @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). */ - @JsonProperty("travel_agency_code") - @ExcludeMissing - fun _travelAgencyCode(): JsonField = travelAgencyCode + fun currency(): String = currency.getRequired("currency") /** - * Returns the raw JSON value of [travelAgencyName]. + * Returns the raw JSON value of [amount]. * - * Unlike [travelAgencyName], this method doesn't throw if the JSON field has an + * Unlike [amount], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("travel_agency_name") - @ExcludeMissing - fun _travelAgencyName(): JsonField = travelAgencyName + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount /** - * Returns the raw JSON value of [tripLegs]. + * Returns the raw JSON value of [currency]. * - * Unlike [tripLegs], this method doesn't throw if the JSON field has an + * Unlike [currency], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("trip_legs") + @JsonProperty("currency") @ExcludeMissing - fun _tripLegs(): JsonField> = tripLegs + fun _currency(): JsonField = currency @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -24872,448 +25503,113 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [Travel]. + * Returns a mutable builder for constructing an instance of [Vision]. * * The following fields are required: * ```java - * .ancillary() - * .computerizedReservationSystem() - * .creditReasonIndicator() - * .departureDate() - * .originationCityAirportCode() - * .passengerName() - * .restrictedTicketIndicator() - * .ticketChangeIndicator() - * .ticketNumber() - * .travelAgencyCode() - * .travelAgencyName() - * .tripLegs() + * .amount() + * .currency() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [Travel]. */ + /** A builder for [Vision]. */ 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 amount: JsonField? = null + private var currency: 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(vision: Vision) = apply { + amount = vision.amount + currency = vision.currency + additionalProperties = vision.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()) + /** The amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) /** - * Sets [Builder.ancillary] to an arbitrary JSON value. + * Sets [Builder.amount] 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 + * 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 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) - ) + fun amount(amount: JsonField) = apply { this.amount = amount } /** - * Alias for calling [Builder.computerizedReservationSystem] with - * `computerizedReservationSystem.orElse(null)`. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. */ - fun computerizedReservationSystem( - computerizedReservationSystem: Optional - ) = computerizedReservationSystem(computerizedReservationSystem.getOrNull()) + fun currency(currency: String) = currency(JsonField.of(currency)) /** - * Sets [Builder.computerizedReservationSystem] to an arbitrary JSON value. + * Sets [Builder.currency] 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.currency] 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 + fun currency(currency: JsonField) = apply { + this.currency = currency } - /** Indicates the reason for a credit to the cardholder. */ - fun creditReasonIndicator(creditReasonIndicator: CreditReasonIndicator?) = - creditReasonIndicator(JsonField.ofNullable(creditReasonIndicator)) + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * Alias for calling [Builder.creditReasonIndicator] with - * `creditReasonIndicator.orElse(null)`. - */ - fun creditReasonIndicator( - creditReasonIndicator: Optional - ) = creditReasonIndicator(creditReasonIndicator.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.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. */ - fun restrictedTicketIndicator( - restrictedTicketIndicator: RestrictedTicketIndicator? - ) = - restrictedTicketIndicator( - JsonField.ofNullable(restrictedTicketIndicator) - ) - - /** - * Alias for calling [Builder.restrictedTicketIndicator] with - * `restrictedTicketIndicator.orElse(null)`. - */ - fun restrictedTicketIndicator( - restrictedTicketIndicator: Optional - ) = restrictedTicketIndicator(restrictedTicketIndicator.getOrNull()) - - /** - * 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 } - - /** Indicates why a ticket was changed. */ - fun ticketChangeIndicator(ticketChangeIndicator: TicketChangeIndicator?) = - ticketChangeIndicator(JsonField.ofNullable(ticketChangeIndicator)) - - /** - * Alias for calling [Builder.ticketChangeIndicator] with - * `ticketChangeIndicator.orElse(null)`. - */ - fun ticketChangeIndicator( - ticketChangeIndicator: Optional - ) = ticketChangeIndicator(ticketChangeIndicator.getOrNull()) - - /** - * 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 } - - /** Ticket number. */ - fun ticketNumber(ticketNumber: String?) = - ticketNumber(JsonField.ofNullable(ticketNumber)) - - /** - * Alias for calling [Builder.ticketNumber] with - * `ticketNumber.orElse(null)`. - */ - fun ticketNumber(ticketNumber: Optional) = - ticketNumber(ticketNumber.getOrNull()) - - /** - * 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 - } - - /** - * Code for the travel agency if the ticket was issued by a travel agency. - */ - fun travelAgencyCode(travelAgencyCode: String?) = - travelAgencyCode(JsonField.ofNullable(travelAgencyCode)) - - /** - * Alias for calling [Builder.travelAgencyCode] with - * `travelAgencyCode.orElse(null)`. - */ - fun travelAgencyCode(travelAgencyCode: Optional) = - travelAgencyCode(travelAgencyCode.getOrNull()) - - /** - * 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 - } - - /** - * Name of the travel agency if the ticket was issued by a travel agency. - */ - fun travelAgencyName(travelAgencyName: String?) = - travelAgencyName(JsonField.ofNullable(travelAgencyName)) - - /** - * Alias for calling [Builder.travelAgencyName] with - * `travelAgencyName.orElse(null)`. - */ - fun travelAgencyName(travelAgencyName: Optional) = - travelAgencyName(travelAgencyName.getOrNull()) - - /** - * 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 - } - - /** 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()) - - /** - * 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() } - } - - /** - * 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) - } - } - - 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 [Travel]. + * Returns an immutable instance of [Vision]. * * 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() + * .amount() + * .currency() * ``` * * @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() }, + fun build(): Vision = + Vision( + checkRequired("amount", amount), + checkRequired("currency", currency), additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): Travel = apply { + fun validate(): Vision = 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() } } + amount() + currency() validated = true } @@ -25333,2386 +25629,2184 @@ private constructor( */ @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) + (if (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) - /** Ancillary purchases in addition to the airfare. */ - class Ancillary - 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, - ) { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @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(), - ) + return /* spotless:off */ other is Vision && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * 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" - ) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ - /** - * 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") + override fun hashCode(): Int = hashCode - /** - * 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") + override fun toString() = + "Vision{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } - /** - * 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") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * 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") + return /* spotless:off */ other is AdditionalAmounts && clinic == other.clinic && dental == other.dental && prescription == other.prescription && surcharge == other.surcharge && totalCumulative == other.totalCumulative && totalHealthcare == other.totalHealthcare && transit == other.transit && unknown == other.unknown && vision == other.vision && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * 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 + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(clinic, dental, prescription, surcharge, totalCumulative, totalHealthcare, transit, unknown, vision, additionalProperties) } + /* spotless:on */ - /** - * 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 + override fun hashCode(): Int = hashCode - /** - * 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 + override fun toString() = + "AdditionalAmounts{clinic=$clinic, dental=$dental, prescription=$prescription, surcharge=$surcharge, totalCumulative=$totalCumulative, totalHealthcare=$totalHealthcare, transit=$transit, unknown=$unknown, vision=$vision, additionalProperties=$additionalProperties}" + } - /** - * 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 + /** + * 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 { - /** - * 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 + /** + * 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) + /** Canadian Dollar (CAD) */ + @JvmField val CAD = of("CAD") - fun toBuilder() = Builder().from(this) + /** Swiss Franc (CHF) */ + @JvmField val CHF = of("CHF") - companion object { + /** Euro (EUR) */ + @JvmField val EUR = of("EUR") - /** - * 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() - } + /** British Pound (GBP) */ + @JvmField val GBP = of("GBP") - /** A builder for [Ancillary]. */ - class Builder internal constructor() { + /** Japanese Yen (JPY) */ + @JvmField val JPY = of("JPY") - 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() + /** US Dollar (USD) */ + @JvmField val USD = of("USD") - @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() - } + @JvmStatic fun of(value: String) = Currency(JsonField.of(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) - ) + /** An enum containing [Currency]'s known values. */ + enum class Known { + /** Canadian Dollar (CAD) */ + CAD, + /** Swiss Franc (CHF) */ + CHF, + /** Euro (EUR) */ + EUR, + /** British Pound (GBP) */ + GBP, + /** Japanese Yen (JPY) */ + JPY, + /** US Dollar (USD) */ + USD, + } - /** - * Alias for calling [Builder.connectedTicketDocumentNumber] with - * `connectedTicketDocumentNumber.orElse(null)`. - */ - fun connectedTicketDocumentNumber( - connectedTicketDocumentNumber: Optional - ) = - connectedTicketDocumentNumber( - connectedTicketDocumentNumber.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 { + /** Canadian Dollar (CAD) */ + CAD, + /** Swiss Franc (CHF) */ + CHF, + /** Euro (EUR) */ + EUR, + /** British Pound (GBP) */ + GBP, + /** Japanese Yen (JPY) */ + JPY, + /** US Dollar (USD) */ + USD, + /** + * An enum member indicating that [Currency] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } - /** - * 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 - } + /** + * 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) { + CAD -> Value.CAD + CHF -> Value.CHF + EUR -> Value.EUR + GBP -> Value.GBP + JPY -> Value.JPY + USD -> Value.USD + else -> Value._UNKNOWN + } - /** Indicates the reason for a credit to the cardholder. */ - fun creditReasonIndicator( - creditReasonIndicator: CreditReasonIndicator? - ) = creditReasonIndicator(JsonField.ofNullable(creditReasonIndicator)) + /** + * 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) { + CAD -> Known.CAD + CHF -> Known.CHF + EUR -> Known.EUR + GBP -> Known.GBP + JPY -> Known.JPY + USD -> Known.USD + else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + } - /** - * Alias for calling [Builder.creditReasonIndicator] with - * `creditReasonIndicator.orElse(null)`. - */ - fun creditReasonIndicator( - creditReasonIndicator: Optional - ) = creditReasonIndicator(creditReasonIndicator.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.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 } + private var validated: Boolean = false - /** Name of the passenger or description of the ancillary purchase. */ - fun passengerNameOrDescription(passengerNameOrDescription: String?) = - passengerNameOrDescription( - JsonField.ofNullable(passengerNameOrDescription) - ) + fun validate(): Currency = apply { + if (validated) { + return@apply + } - /** - * Alias for calling [Builder.passengerNameOrDescription] with - * `passengerNameOrDescription.orElse(null)`. - */ - fun passengerNameOrDescription( - passengerNameOrDescription: Optional - ) = passengerNameOrDescription(passengerNameOrDescription.getOrNull()) + known() + validated = true + } - /** - * 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 - } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** Additional travel charges, such as baggage fees. */ - fun services(services: List) = services(JsonField.of(services)) + /** + * 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.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() } - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * 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) - } - } + return /* spotless:off */ other is Currency && value == other.value /* spotless:on */ + } - /** Ticket document number. */ - fun ticketDocumentNumber(ticketDocumentNumber: String?) = - ticketDocumentNumber(JsonField.ofNullable(ticketDocumentNumber)) + override fun hashCode() = value.hashCode() - /** - * Alias for calling [Builder.ticketDocumentNumber] with - * `ticketDocumentNumber.orElse(null)`. - */ - fun ticketDocumentNumber(ticketDocumentNumber: Optional) = - ticketDocumentNumber(ticketDocumentNumber.getOrNull()) + override fun toString() = value.toString() + } - /** - * 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 - } + /** The card network used to process this card authorization. */ + class Network @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) } + /** Visa */ + @JvmField val VISA = of("visa") - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + @JvmStatic fun of(value: String) = Network(JsonField.of(value)) + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** An enum containing [Network]'s known values. */ + enum class Known { + /** Visa */ + VISA + } - /** - * 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(), - ) - } + /** + * 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, + /** + * An enum member indicating that [Network] was instantiated with an unknown + * value. + */ + _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) { + VISA -> Value.VISA + else -> Value._UNKNOWN + } - fun validate(): Ancillary = 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) { + VISA -> Known.VISA + else -> throw IncreaseInvalidDataException("Unknown Network: $value") + } - connectedTicketDocumentNumber() - creditReasonIndicator().ifPresent { it.validate() } - passengerNameOrDescription() - services().forEach { it.validate() } - ticketDocumentNumber() - 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 (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) + fun validate(): Network = apply { + if (validated) { + return@apply + } - /** Indicates the reason for a credit to the cardholder. */ - class CreditReasonIndicator - @JsonCreator - private constructor(private val value: JsonField) : Enum { + known() + validated = 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 + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - companion object { + /** + * 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 - /** No credit */ - @JvmField val NO_CREDIT = of("no_credit") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** Passenger transport ancillary purchase cancellation */ - @JvmField - val PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = - of("passenger_transport_ancillary_purchase_cancellation") + return /* spotless:off */ other is Network && value == other.value /* spotless:on */ + } - /** - * 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 hashCode() = value.hashCode() - /** Other */ - @JvmField val OTHER = of("other") + override fun toString() = value.toString() + } - @JvmStatic - fun of(value: String) = CreditReasonIndicator(JsonField.of(value)) - } + /** Network-specific identifiers for a specific request or transaction. */ + class NetworkIdentifiers + private constructor( + private val retrievalReferenceNumber: JsonField, + private val traceNumber: JsonField, + private val transactionId: JsonField, + private val additionalProperties: MutableMap, + ) { - /** 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, - } + @JsonCreator + private constructor( + @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(retrievalReferenceNumber, traceNumber, transactionId, mutableMapOf()) - /** - * 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, - } + /** + * 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") - /** - * 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 - } + /** + * 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") - /** - * 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" - ) - } + /** + * 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 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 [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 - private var validated: Boolean = false + /** + * 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 - fun validate(): CreditReasonIndicator = apply { - if (validated) { - return@apply - } + /** + * 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 - known() - validated = true - } + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(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 toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + companion object { - return /* spotless:off */ other is CreditReasonIndicator && value == other.value /* spotless:on */ - } + /** + * Returns a mutable builder for constructing an instance of + * [NetworkIdentifiers]. + * + * The following fields are required: + * ```java + * .retrievalReferenceNumber() + * .traceNumber() + * .transactionId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - override fun hashCode() = value.hashCode() + /** A builder for [NetworkIdentifiers]. */ + class Builder internal constructor() { - override fun toString() = value.toString() - } + private var retrievalReferenceNumber: JsonField? = null + private var traceNumber: JsonField? = null + private var transactionId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - class Service - private constructor( - private val category: JsonField, - private val subCategory: JsonField, - private val additionalProperties: MutableMap, - ) { + @JvmSynthetic + internal fun from(networkIdentifiers: NetworkIdentifiers) = apply { + retrievalReferenceNumber = networkIdentifiers.retrievalReferenceNumber + traceNumber = networkIdentifiers.traceNumber + transactionId = networkIdentifiers.transactionId + additionalProperties = + networkIdentifiers.additionalProperties.toMutableMap() + } - @JsonCreator - private constructor( - @JsonProperty("category") - @ExcludeMissing - category: JsonField = JsonMissing.of(), - @JsonProperty("sub_category") - @ExcludeMissing - subCategory: JsonField = JsonMissing.of(), - ) : this(category, subCategory, mutableMapOf()) + /** + * 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)) - /** - * 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") + /** + * Alias for calling [Builder.retrievalReferenceNumber] with + * `retrievalReferenceNumber.orElse(null)`. + */ + fun retrievalReferenceNumber(retrievalReferenceNumber: Optional) = + retrievalReferenceNumber(retrievalReferenceNumber.getOrNull()) - /** - * 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") + /** + * 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 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 + /** + * 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 [subCategory]. - * - * Unlike [subCategory], this method doesn't throw if the JSON field has - * an unexpected type. - */ - @JsonProperty("sub_category") - @ExcludeMissing - fun _subCategory(): JsonField = subCategory + /** Alias for calling [Builder.traceNumber] with `traceNumber.orElse(null)`. */ + fun traceNumber(traceNumber: Optional) = + traceNumber(traceNumber.getOrNull()) - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** + * 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 + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** + * 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 toBuilder() = Builder().from(this) + /** + * 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 + } - /** - * Returns a mutable builder for constructing an instance of - * [Service]. - * - * The following fields are required: - * ```java - * .category() - * .subCategory() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** A builder for [Service]. */ - class Builder internal constructor() { + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - private var category: JsonField? = null - private var subCategory: JsonField? = null - private var additionalProperties: MutableMap = - mutableMapOf() + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - @JvmSynthetic - internal fun from(service: Service) = apply { - category = service.category - subCategory = service.subCategory - additionalProperties = - service.additionalProperties.toMutableMap() - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** Category of the ancillary service. */ - fun category(category: Category?) = - category(JsonField.ofNullable(category)) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * Alias for calling [Builder.category] with - * `category.orElse(null)`. - */ - fun category(category: Optional) = - category(category.getOrNull()) + /** + * Returns an immutable instance of [NetworkIdentifiers]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .retrievalReferenceNumber() + * .traceNumber() + * .transactionId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): NetworkIdentifiers = + NetworkIdentifiers( + checkRequired("retrievalReferenceNumber", retrievalReferenceNumber), + checkRequired("traceNumber", traceNumber), + checkRequired("transactionId", transactionId), + additionalProperties.toMutableMap(), + ) + } - /** - * 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 - } + private var validated: Boolean = false - /** Sub-category of the ancillary service, free-form. */ - fun subCategory(subCategory: String?) = - subCategory(JsonField.ofNullable(subCategory)) + fun validate(): NetworkIdentifiers = apply { + if (validated) { + return@apply + } - /** - * Alias for calling [Builder.subCategory] with - * `subCategory.orElse(null)`. - */ - fun subCategory(subCategory: Optional) = - subCategory(subCategory.getOrNull()) + retrievalReferenceNumber() + traceNumber() + transactionId() + validated = true + } - /** - * 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 - } + 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 (retrievalReferenceNumber.asKnown().isPresent) 1 else 0) + + (if (traceNumber.asKnown().isPresent) 1 else 0) + + (if (transactionId.asKnown().isPresent) 1 else 0) - 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 /* spotless:off */ other is NetworkIdentifiers && retrievalReferenceNumber == other.retrievalReferenceNumber && traceNumber == other.traceNumber && transactionId == other.transactionId && additionalProperties == other.additionalProperties /* spotless:on */ + } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(retrievalReferenceNumber, traceNumber, transactionId, additionalProperties) } + /* spotless:on */ - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + override fun hashCode(): Int = hashCode - /** - * 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(), - ) - } + override fun toString() = + "NetworkIdentifiers{retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}" + } - private var validated: Boolean = false + /** + * A constant representing the object's type. For this resource it will always be + * `card_increment`. + */ + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { - fun validate(): Service = 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 - category().ifPresent { it.validate() } - subCategory() - validated = true - } + companion object { - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + @JvmField val CARD_INCREMENT = of("card_increment") - /** - * 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) + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } - /** Category of the ancillary service. */ - class Category - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** An enum containing [Type]'s known values. */ + enum class Known { + CARD_INCREMENT + } - /** - * 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 [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_INCREMENT, + /** + * An enum member indicating that [Type] 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) { + CARD_INCREMENT -> Value.CARD_INCREMENT + else -> Value._UNKNOWN + } - /** None */ - @JvmField val NONE = of("none") + /** + * 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_INCREMENT -> Known.CARD_INCREMENT + else -> throw IncreaseInvalidDataException("Unknown Type: $value") + } - /** Bundled service */ - @JvmField val BUNDLED_SERVICE = of("bundled_service") + /** + * 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") + } - /** Baggage fee */ - @JvmField val BAGGAGE_FEE = of("baggage_fee") + private var validated: Boolean = false - /** Change fee */ - @JvmField val CHANGE_FEE = of("change_fee") + fun validate(): Type = apply { + if (validated) { + return@apply + } - /** Cargo */ - @JvmField val CARGO = of("cargo") + known() + validated = true + } - /** Carbon offset */ - @JvmField val CARBON_OFFSET = of("carbon_offset") + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** Frequent flyer */ - @JvmField val FREQUENT_FLYER = of("frequent_flyer") + /** + * 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 - /** Gift card */ - @JvmField val GIFT_CARD = of("gift_card") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** Ground transport */ - @JvmField val GROUND_TRANSPORT = of("ground_transport") + return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + } - /** In-flight entertainment */ - @JvmField - val IN_FLIGHT_ENTERTAINMENT = of("in_flight_entertainment") + override fun hashCode() = value.hashCode() - /** Lounge */ - @JvmField val LOUNGE = of("lounge") + override fun toString() = value.toString() + } - /** Medical */ - @JvmField val MEDICAL = of("medical") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** Meal beverage */ - @JvmField val MEAL_BEVERAGE = of("meal_beverage") + return /* spotless:off */ other is CardIncrement && id == other.id && actioner == other.actioner && additionalAmounts == other.additionalAmounts && amount == other.amount && cardAuthorizationId == other.cardAuthorizationId && currency == other.currency && network == other.network && networkIdentifiers == other.networkIdentifiers && networkRiskScore == other.networkRiskScore && pendingTransactionId == other.pendingTransactionId && presentmentAmount == other.presentmentAmount && presentmentCurrency == other.presentmentCurrency && realTimeDecisionId == other.realTimeDecisionId && type == other.type && updatedAuthorizationAmount == other.updatedAuthorizationAmount && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** Other */ - @JvmField val OTHER = of("other") + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, actioner, additionalAmounts, amount, cardAuthorizationId, currency, network, networkIdentifiers, networkRiskScore, pendingTransactionId, presentmentAmount, presentmentCurrency, realTimeDecisionId, type, updatedAuthorizationAmount, additionalProperties) } + /* spotless:on */ - /** Passenger assist fee */ - @JvmField val PASSENGER_ASSIST_FEE = of("passenger_assist_fee") + override fun hashCode(): Int = hashCode - /** Pets */ - @JvmField val PETS = of("pets") + 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}" + } - /** Seat fees */ - @JvmField val SEAT_FEES = of("seat_fees") + /** + * 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 + 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, + ) { - /** Standby */ - @JvmField val STANDBY = of("standby") + @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(), + ) - /** Service fee */ - @JvmField val SERVICE_FEE = of("service_fee") + /** + * 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") - /** Store */ - @JvmField val STORE = of("store") + /** + * 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") - /** Travel service */ - @JvmField val TRAVEL_SERVICE = of("travel_service") + /** + * 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") - /** Unaccompanied travel */ - @JvmField val UNACCOMPANIED_TRAVEL = of("unaccompanied_travel") + /** + * 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") - /** Upgrades */ - @JvmField val UPGRADES = of("upgrades") + /** + * 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") - /** Wi-fi */ - @JvmField val WIFI = of("wifi") + /** + * Interchange assessed as a part of this transaciton. + * + * @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") - @JvmStatic fun of(value: String) = Category(JsonField.of(value)) - } + /** + * 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") - /** 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, - } + /** + * 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") - /** - * 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, - } + /** + * 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") - /** - * 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 - } + /** + * 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") - /** - * 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" - ) - } + /** + * 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 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 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") - private var validated: Boolean = false + /** + * 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") - fun validate(): Category = apply { - if (validated) { - return@apply - } + /** + * 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") - known() - validated = true - } + /** + * 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 isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * 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") - /** - * 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 + /** + * 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") - 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 /* spotless:off */ other is Category && value == other.value /* spotless:on */ - } + /** + * 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 /* spotless:off */ other is Service && category == other.category && subCategory == other.subCategory && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * 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 - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(category, subCategory, additionalProperties) } - /* spotless:on */ + /** + * 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() = - "Service{category=$category, subCategory=$subCategory, 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 - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * 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 - return /* spotless:off */ other is Ancillary && connectedTicketDocumentNumber == other.connectedTicketDocumentNumber && creditReasonIndicator == other.creditReasonIndicator && passengerNameOrDescription == other.passengerNameOrDescription && services == other.services && ticketDocumentNumber == other.ticketDocumentNumber && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * 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 - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(connectedTicketDocumentNumber, creditReasonIndicator, passengerNameOrDescription, services, ticketDocumentNumber, additionalProperties) } - /* spotless:on */ + /** + * 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 - override fun hashCode(): Int = hashCode + /** + * 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 - override fun toString() = - "Ancillary{connectedTicketDocumentNumber=$connectedTicketDocumentNumber, creditReasonIndicator=$creditReasonIndicator, passengerNameOrDescription=$passengerNameOrDescription, services=$services, ticketDocumentNumber=$ticketDocumentNumber, additionalProperties=$additionalProperties}" - } + /** + * 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 - /** Indicates the reason for a credit to the cardholder. */ - class CreditReasonIndicator - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** + * 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 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 [networkIdentifiers]. + * + * Unlike [networkIdentifiers], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("network_identifiers") + @ExcludeMissing + fun _networkIdentifiers(): JsonField = networkIdentifiers - companion object { + /** + * 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 - /** No credit */ - @JvmField val NO_CREDIT = of("no_credit") + /** + * 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 - /** Passenger transport ancillary purchase cancellation */ - @JvmField - val PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = - of("passenger_transport_ancillary_purchase_cancellation") + /** + * 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 - /** - * 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 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 - /** Airline ticket cancellation */ - @JvmField - val AIRLINE_TICKET_CANCELLATION = of("airline_ticket_cancellation") + /** + * 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 - /** Other */ - @JvmField val OTHER = of("other") + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - /** Partial refund of airline ticket */ - @JvmField - val PARTIAL_REFUND_OF_AIRLINE_TICKET = - of("partial_refund_of_airline_ticket") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - @JvmStatic - fun of(value: String) = CreditReasonIndicator(JsonField.of(value)) - } + fun toBuilder() = Builder().from(this) - /** 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, - } + companion object { - /** - * 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") - } + /** + * 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() + } - private var validated: Boolean = false + /** A builder for [CardRefund]. */ + class Builder internal constructor() { - fun validate(): CreditReasonIndicator = apply { - if (validated) { - return@apply - } + 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() - known() - validated = true - } + @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() + } - 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 (value() == Value._UNKNOWN) 0 else 1 + /** + * 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 /* spotless:off */ other is CreditReasonIndicator && value == other.value /* spotless:on */ - } + /** + * 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 } - override fun hashCode() = value.hashCode() + /** The ID of the Card Payment this transaction belongs to. */ + fun cardPaymentId(cardPaymentId: String) = + cardPaymentId(JsonField.of(cardPaymentId)) - override fun toString() = value.toString() - } + /** + * 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 + } - /** Indicates whether this ticket is non-refundable. */ - class RestrictedTicketIndicator - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** + * Cashback debited for this transaction, if eligible. Cashback is paid out in + * aggregate, monthly. + */ + fun cashback(cashback: Cashback?) = cashback(JsonField.ofNullable(cashback)) - /** - * 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.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 } - /** No restrictions */ - @JvmField val NO_RESTRICTIONS = of("no_restrictions") + /** + * 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)) - /** Restricted non-refundable ticket */ - @JvmField - val RESTRICTED_NON_REFUNDABLE_TICKET = - of("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 } - @JvmStatic - fun of(value: String) = RestrictedTicketIndicator(JsonField.of(value)) - } + /** Interchange assessed as a part of this transaciton. */ + fun interchange(interchange: Interchange?) = + interchange(JsonField.ofNullable(interchange)) - /** 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.interchange] with `interchange.orElse(null)`. */ + fun interchange(interchange: Optional) = + interchange(interchange.getOrNull()) - /** - * 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, - } + /** + * 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 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 - } + /** + * The merchant identifier (commonly abbreviated as MID) of the merchant the card is + * transacting with. + */ + fun merchantAcceptorId(merchantAcceptorId: String) = + merchantAcceptorId(JsonField.of(merchantAcceptorId)) - /** - * 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" - ) - } + /** + * 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 + } - /** - * 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 4-digit MCC describing the merchant's business. */ + fun merchantCategoryCode(merchantCategoryCode: String) = + merchantCategoryCode(JsonField.of(merchantCategoryCode)) - private var validated: Boolean = false + /** + * 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 + } - fun validate(): RestrictedTicketIndicator = apply { - if (validated) { - return@apply - } + /** The city the merchant resides in. */ + fun merchantCity(merchantCity: String) = merchantCity(JsonField.of(merchantCity)) - known() - validated = true - } + /** + * 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 isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** The country the merchant resides in. */ + fun merchantCountry(merchantCountry: String) = + merchantCountry(JsonField.of(merchantCountry)) - /** - * 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.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 + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** The name of the merchant. */ + fun merchantName(merchantName: String) = merchantName(JsonField.of(merchantName)) - return /* spotless:off */ other is RestrictedTicketIndicator && value == other.value /* spotless:on */ - } + /** + * 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 + } - override fun hashCode() = value.hashCode() + /** + * 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 toString() = value.toString() - } + /** + * Alias for calling [Builder.merchantPostalCode] with + * `merchantPostalCode.orElse(null)`. + */ + fun merchantPostalCode(merchantPostalCode: Optional) = + merchantPostalCode(merchantPostalCode.getOrNull()) - /** Indicates why a ticket was changed. */ - class TicketChangeIndicator - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** + * 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 + } - /** - * 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 state the merchant resides in. */ + fun merchantState(merchantState: String?) = + merchantState(JsonField.ofNullable(merchantState)) - companion object { + /** Alias for calling [Builder.merchantState] with `merchantState.orElse(null)`. */ + fun merchantState(merchantState: Optional) = + merchantState(merchantState.getOrNull()) - /** None */ - @JvmField val NONE = of("none") + /** + * 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 + } - /** Change to existing ticket */ - @JvmField - val CHANGE_TO_EXISTING_TICKET = of("change_to_existing_ticket") + /** Network-specific identifiers for this refund. */ + fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) = + networkIdentifiers(JsonField.of(networkIdentifiers)) - /** New ticket */ - @JvmField val NEW_TICKET = of("new_ticket") - - @JvmStatic - fun of(value: String) = TicketChangeIndicator(JsonField.of(value)) - } + /** + * 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 + } - /** An enum containing [TicketChangeIndicator]'s known values. */ - enum class Known { - /** None */ - NONE, - /** Change to existing ticket */ - CHANGE_TO_EXISTING_TICKET, - /** New ticket */ - NEW_TICKET, - } + /** The amount in the minor unit of the transaction's presentment currency. */ + fun presentmentAmount(presentmentAmount: Long) = + presentmentAmount(JsonField.of(presentmentAmount)) - /** - * 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, - } + /** + * 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 + } - /** - * 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 - } + /** + * 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)) - /** - * 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" - ) - } + /** + * 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 + } - /** - * 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") - } + /** + * Additional details about the card purchase, such as tax and industry-specific + * fields. + */ + fun purchaseDetails(purchaseDetails: PurchaseDetails?) = + purchaseDetails(JsonField.ofNullable(purchaseDetails)) - private var validated: Boolean = false + /** + * Alias for calling [Builder.purchaseDetails] with `purchaseDetails.orElse(null)`. + */ + fun purchaseDetails(purchaseDetails: Optional) = + purchaseDetails(purchaseDetails.getOrNull()) - fun validate(): TicketChangeIndicator = apply { - if (validated) { - return@apply - } + /** + * 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 + } - known() - validated = true - } + /** The identifier of the Transaction associated with this Transaction. */ + fun transactionId(transactionId: String) = + transactionId(JsonField.of(transactionId)) - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * 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 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 constant representing the object's type. For this resource it will always be + * `card_refund`. + */ + fun type(type: Type) = type(JsonField.of(type)) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * 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 } - return /* spotless:off */ other is TicketChangeIndicator && value == other.value /* spotless:on */ - } + 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) } - class TripLeg - 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, - ) { + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - @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(), - ) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * 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") + /** + * 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(), + ) + } - /** - * 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") + private var validated: Boolean = false - /** - * 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") + fun validate(): CardRefund = apply { + if (validated) { + return@apply + } - /** - * 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") + 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 + } - /** - * 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") + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * 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 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) - /** - * 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 + /** + * Cashback debited for this transaction, if eligible. Cashback is paid out in + * aggregate, monthly. + */ + class Cashback + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { - /** - * 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 + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) - /** - * 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 + /** + * 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 [flightNumber]. - * - * Unlike [flightNumber], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("flight_number") - @ExcludeMissing - fun _flightNumber(): JsonField = flightNumber + /** + * 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 [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 [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 [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) + /** + * 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 - fun toBuilder() = Builder().from(this) + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - companion object { + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(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 toBuilder() = Builder().from(this) - /** A builder for [TripLeg]. */ - class Builder internal constructor() { + companion object { - 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 a mutable builder for constructing an instance of [Cashback]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - @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() - } + /** A builder for [Cashback]. */ + class Builder internal constructor() { - /** Carrier code (e.g., United Airlines, Jet Blue, etc.). */ - fun carrierCode(carrierCode: String?) = - carrierCode(JsonField.ofNullable(carrierCode)) + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** - * Alias for calling [Builder.carrierCode] with - * `carrierCode.orElse(null)`. - */ - fun carrierCode(carrierCode: Optional) = - carrierCode(carrierCode.getOrNull()) + @JvmSynthetic + internal fun from(cashback: Cashback) = apply { + amount = cashback.amount + currency = cashback.currency + additionalProperties = cashback.additionalProperties.toMutableMap() + } - /** - * 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 - } + /** + * 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)) - /** Code for the destination city or airport. */ - fun destinationCityAirportCode(destinationCityAirportCode: String?) = - destinationCityAirportCode( - JsonField.ofNullable(destinationCityAirportCode) - ) + /** + * 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 } - /** - * Alias for calling [Builder.destinationCityAirportCode] with - * `destinationCityAirportCode.orElse(null)`. - */ - fun destinationCityAirportCode( - destinationCityAirportCode: Optional - ) = destinationCityAirportCode(destinationCityAirportCode.getOrNull()) + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the cashback. + */ + fun currency(currency: Currency) = currency(JsonField.of(currency)) - /** - * 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 - } + /** + * 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 } - /** Fare basis code. */ - fun fareBasisCode(fareBasisCode: String?) = - fareBasisCode(JsonField.ofNullable(fareBasisCode)) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * Alias for calling [Builder.fareBasisCode] with - * `fareBasisCode.orElse(null)`. - */ - fun fareBasisCode(fareBasisCode: Optional) = - fareBasisCode(fareBasisCode.getOrNull()) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * 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 - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** Flight number. */ - fun flightNumber(flightNumber: String?) = - flightNumber(JsonField.ofNullable(flightNumber)) + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * Alias for calling [Builder.flightNumber] with - * `flightNumber.orElse(null)`. - */ - fun flightNumber(flightNumber: Optional) = - flightNumber(flightNumber.getOrNull()) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * 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 - } + /** + * 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(), + ) + } - /** Service class (e.g., first class, business class, etc.). */ - fun serviceClass(serviceClass: String?) = - serviceClass(JsonField.ofNullable(serviceClass)) + private var validated: Boolean = false - /** - * Alias for calling [Builder.serviceClass] with - * `serviceClass.orElse(null)`. - */ - fun serviceClass(serviceClass: Optional) = - serviceClass(serviceClass.getOrNull()) + fun validate(): Cashback = apply { + if (validated) { + return@apply + } - /** - * 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 - } + amount() + currency().validate() + validated = true + } - /** Indicates whether a stopover is allowed on this ticket. */ - fun stopOverCode(stopOverCode: StopOverCode?) = - stopOverCode(JsonField.ofNullable(stopOverCode)) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * Alias for calling [Builder.stopOverCode] with - * `stopOverCode.orElse(null)`. - */ - fun stopOverCode(stopOverCode: Optional) = - stopOverCode(stopOverCode.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 (amount.asKnown().isPresent) 1 else 0) + + (currency.asKnown().getOrNull()?.validity() ?: 0) - /** - * 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 - } + /** The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the cashback. */ + class Currency + @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) } + /** Canadian Dollar (CAD) */ + @JvmField val CAD = of("CAD") - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** Swiss Franc (CHF) */ + @JvmField val CHF = of("CHF") - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** Euro (EUR) */ + @JvmField val EUR = of("EUR") - /** - * 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(), - ) - } + /** British Pound (GBP) */ + @JvmField val GBP = of("GBP") - private var validated: Boolean = false + /** Japanese Yen (JPY) */ + @JvmField val JPY = of("JPY") - fun validate(): TripLeg = apply { - if (validated) { - return@apply - } + /** US Dollar (USD) */ + @JvmField val USD = of("USD") - carrierCode() - destinationCityAirportCode() - fareBasisCode() - flightNumber() - serviceClass() - stopOverCode().ifPresent { it.validate() } - validated = true - } + @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) + } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** An enum containing [Currency]'s known values. */ + enum class Known { + /** Canadian Dollar (CAD) */ + CAD, + /** Swiss Franc (CHF) */ + CHF, + /** Euro (EUR) */ + EUR, + /** British Pound (GBP) */ + GBP, + /** Japanese Yen (JPY) */ + JPY, + /** 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 { + /** Canadian Dollar (CAD) */ + CAD, + /** Swiss Franc (CHF) */ + CHF, + /** Euro (EUR) */ + EUR, + /** British Pound (GBP) */ + GBP, + /** Japanese Yen (JPY) */ + JPY, + /** US Dollar (USD) */ + USD, /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. + * An enum member indicating that [Currency] was instantiated with an + * unknown value. */ - @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 { + _UNKNOWN, + } - /** None */ - @JvmField val NONE = of("none") + /** + * 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) { + CAD -> Value.CAD + CHF -> Value.CHF + EUR -> Value.EUR + GBP -> Value.GBP + JPY -> Value.JPY + USD -> Value.USD + else -> Value._UNKNOWN + } - /** Stop over allowed */ - @JvmField val STOP_OVER_ALLOWED = of("stop_over_allowed") + /** + * 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) { + CAD -> Known.CAD + CHF -> Known.CHF + EUR -> Known.EUR + GBP -> Known.GBP + JPY -> Known.JPY + USD -> Known.USD + else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + } - /** 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 /* spotless:off */ other is StopOverCode && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - 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 /* spotless:off */ other is TripLeg && carrierCode == other.carrierCode && destinationCityAirportCode == other.destinationCityAirportCode && fareBasisCode == other.fareBasisCode && flightNumber == other.flightNumber && serviceClass == other.serviceClass && stopOverCode == other.stopOverCode && additionalProperties == other.additionalProperties /* spotless:on */ + fun validate(): Currency = apply { + if (validated) { + return@apply } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(carrierCode, destinationCityAirportCode, fareBasisCode, flightNumber, serviceClass, stopOverCode, additionalProperties) } - /* spotless:on */ + 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 /* spotless:off */ 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 /* spotless:on */ + return /* spotless:off */ other is Currency && value == other.value /* spotless:on */ } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(ancillary, computerizedReservationSystem, creditReasonIndicator, departureDate, originationCityAirportCode, passengerName, restrictedTicketIndicator, ticketChangeIndicator, ticketNumber, travelAgencyCode, travelAgencyName, tripLegs, additionalProperties) } - /* spotless:on */ - - 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 { @@ -27720,24 +27814,24 @@ private constructor( return true } - return /* spotless:off */ 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 /* spotless:on */ + return /* spotless:off */ other is Cashback && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(carRental, customerReferenceIdentifier, localTaxAmount, localTaxCurrency, lodging, nationalTaxAmount, nationalTaxCurrency, purchaseIdentifier, purchaseIdentifierFormat, travel, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } /* spotless:on */ 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}" + "Cashback{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" } /** - * A constant representing the object's type. For this resource it will always be - * `card_refund`. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's + * settlement currency. */ - class Type @JsonCreator private constructor(private val value: JsonField) : + class Currency @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -27752,29 +27846,68 @@ private constructor( companion object { - @JvmField val CARD_REFUND = of("card_refund") + /** Canadian Dollar (CAD) */ + @JvmField val CAD = of("CAD") - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + /** Swiss Franc (CHF) */ + @JvmField val CHF = of("CHF") + + /** Euro (EUR) */ + @JvmField val EUR = of("EUR") + + /** British Pound (GBP) */ + @JvmField val GBP = of("GBP") + + /** Japanese Yen (JPY) */ + @JvmField val JPY = of("JPY") + + /** US Dollar (USD) */ + @JvmField val USD = of("USD") + + @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) } - /** An enum containing [Type]'s known values. */ + /** An enum containing [Currency]'s known values. */ enum class Known { - CARD_REFUND + /** Canadian Dollar (CAD) */ + CAD, + /** Swiss Franc (CHF) */ + CHF, + /** Euro (EUR) */ + EUR, + /** British Pound (GBP) */ + GBP, + /** Japanese Yen (JPY) */ + JPY, + /** US Dollar (USD) */ + USD, } /** - * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [Type] can contain an unknown value in a couple of cases: + * 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 { - CARD_REFUND, + /** Canadian Dollar (CAD) */ + CAD, + /** Swiss Franc (CHF) */ + CHF, + /** Euro (EUR) */ + EUR, + /** British Pound (GBP) */ + GBP, + /** Japanese Yen (JPY) */ + JPY, + /** US Dollar (USD) */ + USD, /** - * An enum member indicating that [Type] was instantiated with an unknown value. + * An enum member indicating that [Currency] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -27788,7 +27921,12 @@ private constructor( */ fun value(): Value = when (this) { - CARD_REFUND -> Value.CARD_REFUND + CAD -> Value.CAD + CHF -> Value.CHF + EUR -> Value.EUR + GBP -> Value.GBP + JPY -> Value.JPY + USD -> Value.USD else -> Value._UNKNOWN } @@ -27803,8 +27941,13 @@ private constructor( */ fun known(): Known = when (this) { - CARD_REFUND -> Known.CARD_REFUND - else -> throw IncreaseInvalidDataException("Unknown Type: $value") + CAD -> Known.CAD + CHF -> Known.CHF + EUR -> Known.EUR + GBP -> Known.GBP + JPY -> Known.JPY + USD -> Known.USD + else -> throw IncreaseInvalidDataException("Unknown Currency: $value") } /** @@ -27823,7 +27966,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Type = apply { + fun validate(): Currency = apply { if (validated) { return@apply } @@ -27853,7 +27996,7 @@ private constructor( return true } - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + return /* spotless:off */ other is Currency && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -27861,1326 +28004,1360 @@ private constructor( override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** Interchange assessed as a part of this transaciton. */ + class Interchange + private constructor( + private val amount: JsonField, + private val code: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { - return /* spotless:off */ 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 /* spotless:on */ - } + @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()) - /* spotless:off */ - 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) } - /* spotless:on */ + /** + * 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") - override fun hashCode(): Int = hashCode + /** + * 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") - 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}" - } + /** + * 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 + * unexpected value). + */ + fun currency(): Currency = currency.getRequired("currency") - /** - * A Card Reversal object. This field will be present in the JSON response if and only if - * `category` is equal to `card_reversal`. Card Reversals cancel parts of or the entirety of - * an existing Card Authorization. - */ - class CardReversal - private constructor( - private val id: JsonField, - private val cardAuthorizationId: JsonField, - private val currency: 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 network: JsonField, - private val networkIdentifiers: JsonField, - private val pendingTransactionId: JsonField, - private val presentmentCurrency: JsonField, - private val reversalAmount: JsonField, - private val reversalPresentmentAmount: JsonField, - private val reversalReason: JsonField, - private val terminalId: JsonField, - private val type: JsonField, - private val updatedAuthorizationAmount: JsonField, - private val updatedAuthorizationPresentmentAmount: JsonField, - private val additionalProperties: MutableMap, - ) { + /** + * 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 - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("card_authorization_id") - @ExcludeMissing - cardAuthorizationId: JsonField = JsonMissing.of(), + /** + * 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]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected + * type. + */ @JsonProperty("currency") @ExcludeMissing - currency: 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") - @ExcludeMissing - network: JsonField = JsonMissing.of(), - @JsonProperty("network_identifiers") - @ExcludeMissing - networkIdentifiers: JsonField = JsonMissing.of(), - @JsonProperty("pending_transaction_id") - @ExcludeMissing - pendingTransactionId: JsonField = JsonMissing.of(), - @JsonProperty("presentment_currency") - @ExcludeMissing - presentmentCurrency: JsonField = JsonMissing.of(), - @JsonProperty("reversal_amount") - @ExcludeMissing - reversalAmount: JsonField = JsonMissing.of(), - @JsonProperty("reversal_presentment_amount") - @ExcludeMissing - reversalPresentmentAmount: JsonField = JsonMissing.of(), - @JsonProperty("reversal_reason") - @ExcludeMissing - reversalReason: JsonField = JsonMissing.of(), - @JsonProperty("terminal_id") - @ExcludeMissing - terminalId: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - @JsonProperty("updated_authorization_amount") - @ExcludeMissing - updatedAuthorizationAmount: JsonField = JsonMissing.of(), - @JsonProperty("updated_authorization_presentment_amount") - @ExcludeMissing - updatedAuthorizationPresentmentAmount: JsonField = JsonMissing.of(), - ) : this( - id, - cardAuthorizationId, - currency, - merchantAcceptorId, - merchantCategoryCode, - merchantCity, - merchantCountry, - merchantDescriptor, - merchantPostalCode, - merchantState, - network, - networkIdentifiers, - pendingTransactionId, - presentmentCurrency, - reversalAmount, - reversalPresentmentAmount, - reversalReason, - terminalId, - type, - updatedAuthorizationAmount, - updatedAuthorizationPresentmentAmount, - mutableMapOf(), - ) + fun _currency(): JsonField = currency - /** - * The Card Reversal 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") + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - /** - * 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") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** - * 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") + fun toBuilder() = Builder().from(this) - /** - * 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") + companion object { - /** - * 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") + /** + * Returns a mutable builder for constructing an instance of [Interchange]. + * + * The following fields are required: + * ```java + * .amount() + * .code() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - /** - * 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") + /** A builder for [Interchange]. */ + class Builder internal constructor() { - /** - * The country 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 merchantCountry(): Optional = - merchantCountry.getOptional("merchant_country") + private var amount: JsonField? = null + private var code: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** - * 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") + @JvmSynthetic + internal fun from(interchange: Interchange) = apply { + amount = interchange.amount + code = interchange.code + currency = interchange.currency + additionalProperties = interchange.additionalProperties.toMutableMap() + } - /** - * 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 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)) - /** - * 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") + /** + * 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 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") + /** The card network specific interchange code. */ + fun code(code: String?) = code(JsonField.ofNullable(code)) - /** - * 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") + /** Alias for calling [Builder.code] with `code.orElse(null)`. */ + fun code(code: Optional) = code(code.getOrNull()) - /** - * The identifier of the Pending Transaction associated with this Card Reversal. - * - * @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") + /** + * 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 reversal'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") + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * interchange reimbursement. + */ + fun currency(currency: Currency) = currency(JsonField.of(currency)) - /** - * The amount of this reversal 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 reversalAmount(): Long = reversalAmount.getRequired("reversal_amount") + /** + * 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 amount of this reversal in the minor unit of the transaction's presentment - * 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 reversalPresentmentAmount(): Long = - reversalPresentmentAmount.getRequired("reversal_presentment_amount") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * Why this reversal was initiated. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun reversalReason(): Optional = - reversalReason.getOptional("reversal_reason") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * 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 putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** - * A constant representing the object's type. For this resource it will always be - * `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 type(): Type = type.getRequired("type") + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * The amount left pending on the Card Authorization 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") + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * The amount left pending on the Card Authorization in the minor unit of the - * transaction's presentment 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 updatedAuthorizationPresentmentAmount(): Long = - updatedAuthorizationPresentmentAmount.getRequired( - "updated_authorization_presentment_amount" - ) + /** + * 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(), + ) + } - /** - * 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 var validated: Boolean = false - /** - * 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 + fun validate(): Interchange = apply { + if (validated) { + return@apply + } - /** - * 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 + amount() + code() + currency().validate() + validated = true + } - /** - * 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 + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * 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 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 (code.asKnown().isPresent) 1 else 0) + + (currency.asKnown().getOrNull()?.validity() ?: 0) - /** - * 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 + /** + * 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 { - /** - * 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 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 [merchantDescriptor]. - * - * Unlike [merchantDescriptor], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("merchant_descriptor") - @ExcludeMissing - fun _merchantDescriptor(): JsonField = merchantDescriptor + companion object { - /** - * 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 + /** Canadian Dollar (CAD) */ + @JvmField val CAD = of("CAD") - /** - * 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 + /** Swiss Franc (CHF) */ + @JvmField val CHF = of("CHF") - /** - * 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 + /** Euro (EUR) */ + @JvmField val EUR = of("EUR") - /** - * 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 + /** British Pound (GBP) */ + @JvmField val GBP = of("GBP") - /** - * 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 + /** Japanese Yen (JPY) */ + @JvmField val JPY = of("JPY") - /** - * 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 + /** US Dollar (USD) */ + @JvmField val USD = of("USD") - /** - * Returns the raw JSON value of [reversalAmount]. - * - * Unlike [reversalAmount], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("reversal_amount") - @ExcludeMissing - fun _reversalAmount(): JsonField = reversalAmount + @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) + } - /** - * Returns the raw JSON value of [reversalPresentmentAmount]. - * - * Unlike [reversalPresentmentAmount], this method doesn't throw if the JSON field has - * an unexpected type. - */ - @JsonProperty("reversal_presentment_amount") - @ExcludeMissing - fun _reversalPresentmentAmount(): JsonField = reversalPresentmentAmount + /** An enum containing [Currency]'s known values. */ + enum class Known { + /** Canadian Dollar (CAD) */ + CAD, + /** Swiss Franc (CHF) */ + CHF, + /** Euro (EUR) */ + EUR, + /** British Pound (GBP) */ + GBP, + /** Japanese Yen (JPY) */ + JPY, + /** US Dollar (USD) */ + USD, + } - /** - * Returns the raw JSON value of [reversalReason]. - * - * Unlike [reversalReason], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("reversal_reason") - @ExcludeMissing - fun _reversalReason(): JsonField = reversalReason + /** + * 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 { + /** Canadian Dollar (CAD) */ + CAD, + /** Swiss Franc (CHF) */ + CHF, + /** Euro (EUR) */ + EUR, + /** British Pound (GBP) */ + GBP, + /** Japanese Yen (JPY) */ + JPY, + /** US Dollar (USD) */ + USD, + /** + * An enum member indicating that [Currency] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** - * 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 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) { + CAD -> Value.CAD + CHF -> Value.CHF + EUR -> Value.EUR + GBP -> Value.GBP + JPY -> Value.JPY + USD -> Value.USD + else -> Value._UNKNOWN + } - /** - * 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 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) { + CAD -> Known.CAD + CHF -> Known.CHF + EUR -> Known.EUR + GBP -> Known.GBP + JPY -> Known.JPY + USD -> Known.USD + else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + } - /** - * 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 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 [updatedAuthorizationPresentmentAmount]. - * - * Unlike [updatedAuthorizationPresentmentAmount], this method doesn't throw if the JSON - * field has an unexpected type. - */ - @JsonProperty("updated_authorization_presentment_amount") - @ExcludeMissing - fun _updatedAuthorizationPresentmentAmount(): JsonField = - updatedAuthorizationPresentmentAmount + 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) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - companion object { + /** + * 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 mutable builder for constructing an instance of [CardReversal]. - * - * The following fields are required: - * ```java - * .id() - * .cardAuthorizationId() - * .currency() - * .merchantAcceptorId() - * .merchantCategoryCode() - * .merchantCity() - * .merchantCountry() - * .merchantDescriptor() - * .merchantPostalCode() - * .merchantState() - * .network() - * .networkIdentifiers() - * .pendingTransactionId() - * .presentmentCurrency() - * .reversalAmount() - * .reversalPresentmentAmount() - * .reversalReason() - * .terminalId() - * .type() - * .updatedAuthorizationAmount() - * .updatedAuthorizationPresentmentAmount() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** A builder for [CardReversal]. */ - class Builder internal constructor() { + return /* spotless:off */ other is Currency && value == other.value /* spotless:on */ + } - private var id: JsonField? = null - private var cardAuthorizationId: JsonField? = null - private var currency: 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 network: JsonField? = null - private var networkIdentifiers: JsonField? = null - private var pendingTransactionId: JsonField? = null - private var presentmentCurrency: JsonField? = null - private var reversalAmount: JsonField? = null - private var reversalPresentmentAmount: JsonField? = null - private var reversalReason: JsonField? = null - private var terminalId: JsonField? = null - private var type: JsonField? = null - private var updatedAuthorizationAmount: JsonField? = null - private var updatedAuthorizationPresentmentAmount: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + override fun hashCode() = value.hashCode() - @JvmSynthetic - internal fun from(cardReversal: CardReversal) = apply { - id = cardReversal.id - cardAuthorizationId = cardReversal.cardAuthorizationId - currency = cardReversal.currency - merchantAcceptorId = cardReversal.merchantAcceptorId - merchantCategoryCode = cardReversal.merchantCategoryCode - merchantCity = cardReversal.merchantCity - merchantCountry = cardReversal.merchantCountry - merchantDescriptor = cardReversal.merchantDescriptor - merchantPostalCode = cardReversal.merchantPostalCode - merchantState = cardReversal.merchantState - network = cardReversal.network - networkIdentifiers = cardReversal.networkIdentifiers - pendingTransactionId = cardReversal.pendingTransactionId - presentmentCurrency = cardReversal.presentmentCurrency - reversalAmount = cardReversal.reversalAmount - reversalPresentmentAmount = cardReversal.reversalPresentmentAmount - reversalReason = cardReversal.reversalReason - terminalId = cardReversal.terminalId - type = cardReversal.type - updatedAuthorizationAmount = cardReversal.updatedAuthorizationAmount - updatedAuthorizationPresentmentAmount = - cardReversal.updatedAuthorizationPresentmentAmount - additionalProperties = cardReversal.additionalProperties.toMutableMap() + override fun toString() = value.toString() } - /** The Card Reversal identifier. */ - fun id(id: String) = id(JsonField.of(id)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * 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 } + return /* spotless:off */ other is Interchange && amount == other.amount && code == other.code && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** The identifier for the Card Authorization this reverses. */ - fun cardAuthorizationId(cardAuthorizationId: String) = - cardAuthorizationId(JsonField.of(cardAuthorizationId)) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, code, currency, additionalProperties) } + /* spotless:on */ - /** - * 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 - } + override fun hashCode(): Int = hashCode - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the reversal's - * currency. - */ - fun currency(currency: Currency) = currency(JsonField.of(currency)) + override fun toString() = + "Interchange{amount=$amount, code=$code, currency=$currency, additionalProperties=$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 } + /** Network-specific identifiers for this refund. */ + class NetworkIdentifiers + private constructor( + private val acquirerBusinessId: JsonField, + private val acquirerReferenceNumber: JsonField, + private val transactionId: JsonField, + private val additionalProperties: MutableMap, + ) { - /** - * The merchant identifier (commonly abbreviated as MID) of the merchant the card is - * transacting with. - */ - fun merchantAcceptorId(merchantAcceptorId: String) = - merchantAcceptorId(JsonField.of(merchantAcceptorId)) + @JsonCreator + private constructor( + @JsonProperty("acquirer_business_id") + @ExcludeMissing + acquirerBusinessId: JsonField = JsonMissing.of(), + @JsonProperty("acquirer_reference_number") + @ExcludeMissing + acquirerReferenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("transaction_id") + @ExcludeMissing + transactionId: JsonField = JsonMissing.of(), + ) : this(acquirerBusinessId, acquirerReferenceNumber, transactionId, mutableMapOf()) /** - * Sets [Builder.merchantAcceptorId] to an arbitrary JSON value. + * A network assigned business ID that identifies the acquirer that processed this + * transaction. * - * 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. + * @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(merchantCategoryCode: String) = - merchantCategoryCode(JsonField.of(merchantCategoryCode)) + fun acquirerBusinessId(): String = + acquirerBusinessId.getRequired("acquirer_business_id") /** - * Sets [Builder.merchantCategoryCode] to an arbitrary JSON value. + * A globally unique identifier for this settlement. * - * 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. + * @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(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()) + fun acquirerReferenceNumber(): String = + acquirerReferenceNumber.getRequired("acquirer_reference_number") /** - * Sets [Builder.merchantCity] to an arbitrary JSON value. + * A globally unique transaction identifier provided by the card network, used + * across multiple life-cycle requests. * - * 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. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ - fun merchantCity(merchantCity: JsonField) = apply { - this.merchantCity = merchantCity - } - - /** The country the merchant resides in. */ - fun merchantCountry(merchantCountry: String?) = - merchantCountry(JsonField.ofNullable(merchantCountry)) + fun transactionId(): Optional = transactionId.getOptional("transaction_id") /** - * Alias for calling [Builder.merchantCountry] with `merchantCountry.orElse(null)`. + * Returns the raw JSON value of [acquirerBusinessId]. + * + * Unlike [acquirerBusinessId], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun merchantCountry(merchantCountry: Optional) = - merchantCountry(merchantCountry.getOrNull()) + @JsonProperty("acquirer_business_id") + @ExcludeMissing + fun _acquirerBusinessId(): JsonField = acquirerBusinessId /** - * Sets [Builder.merchantCountry] to an arbitrary JSON value. + * Returns the raw JSON value of [acquirerReferenceNumber]. * - * 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. + * Unlike [acquirerReferenceNumber], this method doesn't throw if the JSON field has + * an unexpected type. */ - 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)) + @JsonProperty("acquirer_reference_number") + @ExcludeMissing + fun _acquirerReferenceNumber(): JsonField = acquirerReferenceNumber /** - * Sets [Builder.merchantDescriptor] to an arbitrary JSON value. + * Returns the raw JSON value of [transactionId]. * - * 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. + * Unlike [transactionId], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun merchantDescriptor(merchantDescriptor: JsonField) = apply { - this.merchantDescriptor = merchantDescriptor + @JsonProperty("transaction_id") + @ExcludeMissing + fun _transactionId(): JsonField = transactionId + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) } - /** - * 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)) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** - * Alias for calling [Builder.merchantPostalCode] with - * `merchantPostalCode.orElse(null)`. - */ - fun merchantPostalCode(merchantPostalCode: Optional) = - merchantPostalCode(merchantPostalCode.getOrNull()) + fun toBuilder() = Builder().from(this) - /** - * 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 + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [NetworkIdentifiers]. + * + * The following fields are required: + * ```java + * .acquirerBusinessId() + * .acquirerReferenceNumber() + * .transactionId() + * ``` + */ + @JvmStatic fun builder() = Builder() } - /** The state the merchant resides in. */ - fun merchantState(merchantState: String?) = - merchantState(JsonField.ofNullable(merchantState)) + /** A builder for [NetworkIdentifiers]. */ + class Builder internal constructor() { - /** Alias for calling [Builder.merchantState] with `merchantState.orElse(null)`. */ - fun merchantState(merchantState: Optional) = - merchantState(merchantState.getOrNull()) + private var acquirerBusinessId: JsonField? = null + private var acquirerReferenceNumber: JsonField? = null + private var transactionId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** - * 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 - } + @JvmSynthetic + internal fun from(networkIdentifiers: NetworkIdentifiers) = apply { + acquirerBusinessId = networkIdentifiers.acquirerBusinessId + acquirerReferenceNumber = networkIdentifiers.acquirerReferenceNumber + transactionId = networkIdentifiers.transactionId + additionalProperties = + networkIdentifiers.additionalProperties.toMutableMap() + } - /** The card network used to process this card authorization. */ - fun network(network: Network) = network(JsonField.of(network)) + /** + * A network assigned business ID that identifies the acquirer that processed + * this transaction. + */ + fun acquirerBusinessId(acquirerBusinessId: String) = + acquirerBusinessId(JsonField.of(acquirerBusinessId)) - /** - * 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.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 + } - /** Network-specific identifiers for a specific request or transaction. */ - fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) = - networkIdentifiers(JsonField.of(networkIdentifiers)) + /** A globally unique identifier for this settlement. */ + fun acquirerReferenceNumber(acquirerReferenceNumber: String) = + acquirerReferenceNumber(JsonField.of(acquirerReferenceNumber)) - /** - * 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.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 identifier of the Pending Transaction associated with this Card Reversal. */ - fun pendingTransactionId(pendingTransactionId: String?) = - pendingTransactionId(JsonField.ofNullable(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)) - /** - * Alias for calling [Builder.pendingTransactionId] with - * `pendingTransactionId.orElse(null)`. - */ - fun pendingTransactionId(pendingTransactionId: Optional) = - pendingTransactionId(pendingTransactionId.getOrNull()) + /** + * 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() + * .transactionId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): NetworkIdentifiers = + NetworkIdentifiers( + checkRequired("acquirerBusinessId", acquirerBusinessId), + checkRequired("acquirerReferenceNumber", acquirerReferenceNumber), + checkRequired("transactionId", transactionId), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): NetworkIdentifiers = apply { + if (validated) { + return@apply + } + + acquirerBusinessId() + acquirerReferenceNumber() + transactionId() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } /** - * Sets [Builder.pendingTransactionId] to an arbitrary JSON value. + * Returns a score indicating how many valid values are contained in this object + * recursively. * - * 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. + * Used for best match union deserialization. */ - fun pendingTransactionId(pendingTransactionId: JsonField) = apply { - this.pendingTransactionId = pendingTransactionId + @JvmSynthetic + internal fun validity(): Int = + (if (acquirerBusinessId.asKnown().isPresent) 1 else 0) + + (if (acquirerReferenceNumber.asKnown().isPresent) 1 else 0) + + (if (transactionId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is NetworkIdentifiers && acquirerBusinessId == other.acquirerBusinessId && acquirerReferenceNumber == other.acquirerReferenceNumber && transactionId == other.transactionId && additionalProperties == other.additionalProperties /* spotless:on */ } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(acquirerBusinessId, acquirerReferenceNumber, transactionId, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "NetworkIdentifiers{acquirerBusinessId=$acquirerBusinessId, acquirerReferenceNumber=$acquirerReferenceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}" + } + + /** + * Additional details about the card purchase, such as tax and industry-specific fields. + */ + class PurchaseDetails + 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(), + ) + /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the reversal's - * presentment currency. + * 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 presentmentCurrency(presentmentCurrency: String) = - presentmentCurrency(JsonField.of(presentmentCurrency)) + fun carRental(): Optional = carRental.getOptional("car_rental") /** - * Sets [Builder.presentmentCurrency] to an arbitrary JSON value. + * An identifier from the merchant for the customer or consumer. * - * 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. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ - fun presentmentCurrency(presentmentCurrency: JsonField) = apply { - this.presentmentCurrency = presentmentCurrency - } + fun customerReferenceIdentifier(): Optional = + customerReferenceIdentifier.getOptional("customer_reference_identifier") /** - * The amount of this reversal in the minor unit of the transaction's currency. For - * dollars, for example, this is cents. + * 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 reversalAmount(reversalAmount: Long) = - reversalAmount(JsonField.of(reversalAmount)) + fun localTaxAmount(): Optional = + localTaxAmount.getOptional("local_tax_amount") /** - * Sets [Builder.reversalAmount] to an arbitrary JSON value. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax + * assessed. * - * You should usually call [Builder.reversalAmount] 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 reversalAmount(reversalAmount: JsonField) = apply { - this.reversalAmount = reversalAmount - } + fun localTaxCurrency(): Optional = + localTaxCurrency.getOptional("local_tax_currency") /** - * The amount of this reversal in the minor unit of the transaction's presentment - * currency. For dollars, for example, this is cents. + * 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 reversalPresentmentAmount(reversalPresentmentAmount: Long) = - reversalPresentmentAmount(JsonField.of(reversalPresentmentAmount)) + fun lodging(): Optional = lodging.getOptional("lodging") /** - * Sets [Builder.reversalPresentmentAmount] to an arbitrary JSON value. + * The national tax amount in minor units. * - * You should usually call [Builder.reversalPresentmentAmount] 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 reversalPresentmentAmount(reversalPresentmentAmount: JsonField) = apply { - this.reversalPresentmentAmount = reversalPresentmentAmount - } - - /** Why this reversal was initiated. */ - fun reversalReason(reversalReason: ReversalReason?) = - reversalReason(JsonField.ofNullable(reversalReason)) + fun nationalTaxAmount(): Optional = + nationalTaxAmount.getOptional("national_tax_amount") /** - * Alias for calling [Builder.reversalReason] with `reversalReason.orElse(null)`. + * 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 reversalReason(reversalReason: Optional) = - reversalReason(reversalReason.getOrNull()) + fun nationalTaxCurrency(): Optional = + nationalTaxCurrency.getOptional("national_tax_currency") /** - * Sets [Builder.reversalReason] to an arbitrary JSON value. + * An identifier from the merchant for the purchase to the issuer and cardholder. * - * You should usually call [Builder.reversalReason] with a well-typed - * [ReversalReason] 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 reversalReason(reversalReason: JsonField) = apply { - this.reversalReason = reversalReason - } + fun purchaseIdentifier(): Optional = + purchaseIdentifier.getOptional("purchase_identifier") /** - * The terminal identifier (commonly abbreviated as TID) of the terminal the card is - * transacting with. + * 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 terminalId(terminalId: String?) = terminalId(JsonField.ofNullable(terminalId)) + fun purchaseIdentifierFormat(): Optional = + purchaseIdentifierFormat.getOptional("purchase_identifier_format") - /** Alias for calling [Builder.terminalId] with `terminalId.orElse(null)`. */ - fun terminalId(terminalId: Optional) = terminalId(terminalId.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.terminalId] to an arbitrary JSON value. + * Returns the raw JSON value of [carRental]. * - * 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. + * Unlike [carRental], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun terminalId(terminalId: JsonField) = apply { - this.terminalId = terminalId - } + @JsonProperty("car_rental") + @ExcludeMissing + fun _carRental(): JsonField = carRental /** - * A constant representing the object's type. For this resource it will always be - * `card_reversal`. + * Returns the raw JSON value of [customerReferenceIdentifier]. + * + * Unlike [customerReferenceIdentifier], this method doesn't throw if the JSON field + * has an unexpected type. */ - fun type(type: Type) = type(JsonField.of(type)) + @JsonProperty("customer_reference_identifier") + @ExcludeMissing + fun _customerReferenceIdentifier(): JsonField = customerReferenceIdentifier /** - * Sets [Builder.type] to an arbitrary JSON value. + * Returns the raw JSON value of [localTaxAmount]. * - * 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. + * Unlike [localTaxAmount], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun type(type: JsonField) = apply { this.type = type } + @JsonProperty("local_tax_amount") + @ExcludeMissing + fun _localTaxAmount(): JsonField = localTaxAmount /** - * The amount left pending on the Card Authorization in the minor unit of the - * transaction's currency. For dollars, for example, this is cents. + * Returns the raw JSON value of [localTaxCurrency]. + * + * Unlike [localTaxCurrency], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun updatedAuthorizationAmount(updatedAuthorizationAmount: Long) = - updatedAuthorizationAmount(JsonField.of(updatedAuthorizationAmount)) + @JsonProperty("local_tax_currency") + @ExcludeMissing + fun _localTaxCurrency(): JsonField = localTaxCurrency /** - * Sets [Builder.updatedAuthorizationAmount] to an arbitrary JSON value. + * Returns the raw JSON value of [lodging]. * - * 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. + * Unlike [lodging], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun updatedAuthorizationAmount(updatedAuthorizationAmount: JsonField) = - apply { - this.updatedAuthorizationAmount = updatedAuthorizationAmount - } + @JsonProperty("lodging") + @ExcludeMissing + fun _lodging(): JsonField = lodging /** - * The amount left pending on the Card Authorization in the minor unit of the - * transaction's presentment currency. For dollars, for example, this is cents. + * Returns the raw JSON value of [nationalTaxAmount]. + * + * Unlike [nationalTaxAmount], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun updatedAuthorizationPresentmentAmount( - updatedAuthorizationPresentmentAmount: Long - ) = - updatedAuthorizationPresentmentAmount( - JsonField.of(updatedAuthorizationPresentmentAmount) - ) + @JsonProperty("national_tax_amount") + @ExcludeMissing + fun _nationalTaxAmount(): JsonField = nationalTaxAmount /** - * Sets [Builder.updatedAuthorizationPresentmentAmount] to an arbitrary JSON value. + * Returns the raw JSON value of [nationalTaxCurrency]. * - * You should usually call [Builder.updatedAuthorizationPresentmentAmount] with a - * well-typed [Long] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. + * Unlike [nationalTaxCurrency], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun updatedAuthorizationPresentmentAmount( - updatedAuthorizationPresentmentAmount: JsonField - ) = apply { - this.updatedAuthorizationPresentmentAmount = - updatedAuthorizationPresentmentAmount - } + @JsonProperty("national_tax_currency") + @ExcludeMissing + fun _nationalTaxCurrency(): JsonField = nationalTaxCurrency - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** + * 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 putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** + * 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 putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + /** + * 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 removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** - * Returns an immutable instance of [CardReversal]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .cardAuthorizationId() - * .currency() - * .merchantAcceptorId() - * .merchantCategoryCode() - * .merchantCity() - * .merchantCountry() - * .merchantDescriptor() - * .merchantPostalCode() - * .merchantState() - * .network() - * .networkIdentifiers() - * .pendingTransactionId() - * .presentmentCurrency() - * .reversalAmount() - * .reversalPresentmentAmount() - * .reversalReason() - * .terminalId() - * .type() - * .updatedAuthorizationAmount() - * .updatedAuthorizationPresentmentAmount() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CardReversal = - CardReversal( - checkRequired("id", id), - checkRequired("cardAuthorizationId", cardAuthorizationId), - checkRequired("currency", currency), - checkRequired("merchantAcceptorId", merchantAcceptorId), - checkRequired("merchantCategoryCode", merchantCategoryCode), - checkRequired("merchantCity", merchantCity), - checkRequired("merchantCountry", merchantCountry), - checkRequired("merchantDescriptor", merchantDescriptor), - checkRequired("merchantPostalCode", merchantPostalCode), - checkRequired("merchantState", merchantState), - checkRequired("network", network), - checkRequired("networkIdentifiers", networkIdentifiers), - checkRequired("pendingTransactionId", pendingTransactionId), - checkRequired("presentmentCurrency", presentmentCurrency), - checkRequired("reversalAmount", reversalAmount), - checkRequired("reversalPresentmentAmount", reversalPresentmentAmount), - checkRequired("reversalReason", reversalReason), - checkRequired("terminalId", terminalId), - checkRequired("type", type), - checkRequired("updatedAuthorizationAmount", updatedAuthorizationAmount), - checkRequired( - "updatedAuthorizationPresentmentAmount", - updatedAuthorizationPresentmentAmount, - ), - additionalProperties.toMutableMap(), - ) - } + fun toBuilder() = Builder().from(this) - private var validated: Boolean = false + companion object { - fun validate(): CardReversal = apply { - if (validated) { - return@apply + /** + * 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() } - id() - cardAuthorizationId() - currency().validate() - merchantAcceptorId() - merchantCategoryCode() - merchantCity() - merchantCountry() - merchantDescriptor() - merchantPostalCode() - merchantState() - network().validate() - networkIdentifiers().validate() - pendingTransactionId() - presentmentCurrency() - reversalAmount() - reversalPresentmentAmount() - reversalReason().ifPresent { it.validate() } - terminalId() - type().validate() - updatedAuthorizationAmount() - updatedAuthorizationPresentmentAmount() - validated = true - } + /** A builder for [PurchaseDetails]. */ + class Builder internal constructor() { - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + 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 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 (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) + - (network.asKnown().getOrNull()?.validity() ?: 0) + - (networkIdentifiers.asKnown().getOrNull()?.validity() ?: 0) + - (if (pendingTransactionId.asKnown().isPresent) 1 else 0) + - (if (presentmentCurrency.asKnown().isPresent) 1 else 0) + - (if (reversalAmount.asKnown().isPresent) 1 else 0) + - (if (reversalPresentmentAmount.asKnown().isPresent) 1 else 0) + - (reversalReason.asKnown().getOrNull()?.validity() ?: 0) + - (if (terminalId.asKnown().isPresent) 1 else 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) + - (if (updatedAuthorizationAmount.asKnown().isPresent) 1 else 0) + - (if (updatedAuthorizationPresentmentAmount.asKnown().isPresent) 1 else 0) + @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() + } - /** - * 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 { + /** Fields specific to car rentals. */ + fun carRental(carRental: CarRental?) = + carRental(JsonField.ofNullable(carRental)) - /** - * 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.carRental] with `carRental.orElse(null)`. */ + fun carRental(carRental: Optional) = carRental(carRental.getOrNull()) - companion object { + /** + * 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 + } - /** Canadian Dollar (CAD) */ - @JvmField val CAD = of("CAD") + /** An identifier from the merchant for the customer or consumer. */ + fun customerReferenceIdentifier(customerReferenceIdentifier: String?) = + customerReferenceIdentifier( + JsonField.ofNullable(customerReferenceIdentifier) + ) - /** Swiss Franc (CHF) */ - @JvmField val CHF = of("CHF") + /** + * Alias for calling [Builder.customerReferenceIdentifier] with + * `customerReferenceIdentifier.orElse(null)`. + */ + fun customerReferenceIdentifier(customerReferenceIdentifier: Optional) = + customerReferenceIdentifier(customerReferenceIdentifier.getOrNull()) - /** Euro (EUR) */ - @JvmField val EUR = of("EUR") + /** + * 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 } - /** British Pound (GBP) */ - @JvmField val GBP = of("GBP") + /** The state or provincial tax amount in minor units. */ + fun localTaxAmount(localTaxAmount: Long?) = + localTaxAmount(JsonField.ofNullable(localTaxAmount)) - /** Japanese Yen (JPY) */ - @JvmField val JPY = of("JPY") + /** + * Alias for [Builder.localTaxAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun localTaxAmount(localTaxAmount: Long) = + localTaxAmount(localTaxAmount as Long?) - /** US Dollar (USD) */ - @JvmField val USD = of("USD") + /** + * Alias for calling [Builder.localTaxAmount] with + * `localTaxAmount.orElse(null)`. + */ + fun localTaxAmount(localTaxAmount: Optional) = + localTaxAmount(localTaxAmount.getOrNull()) - @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) - } + /** + * 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 + } - /** An enum containing [Currency]'s known values. */ - enum class Known { - /** Canadian Dollar (CAD) */ - CAD, - /** Swiss Franc (CHF) */ - CHF, - /** Euro (EUR) */ - EUR, - /** British Pound (GBP) */ - GBP, - /** Japanese Yen (JPY) */ - JPY, - /** US Dollar (USD) */ - USD, - } + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax + * assessed. + */ + fun localTaxCurrency(localTaxCurrency: String?) = + localTaxCurrency(JsonField.ofNullable(localTaxCurrency)) - /** - * 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 { - /** Canadian Dollar (CAD) */ - CAD, - /** Swiss Franc (CHF) */ - CHF, - /** Euro (EUR) */ - EUR, - /** British Pound (GBP) */ - GBP, - /** Japanese Yen (JPY) */ - JPY, - /** US Dollar (USD) */ - USD, /** - * An enum member indicating that [Currency] was instantiated with an unknown - * value. + * Alias for calling [Builder.localTaxCurrency] with + * `localTaxCurrency.orElse(null)`. */ - _UNKNOWN, - } + fun localTaxCurrency(localTaxCurrency: Optional) = + localTaxCurrency(localTaxCurrency.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) { - CAD -> Value.CAD - CHF -> Value.CHF - EUR -> Value.EUR - GBP -> Value.GBP - JPY -> Value.JPY - USD -> Value.USD - else -> Value._UNKNOWN + /** + * 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 } - /** - * 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) { - CAD -> Known.CAD - CHF -> Known.CHF - EUR -> Known.EUR - GBP -> Known.GBP - JPY -> Known.JPY - USD -> Known.USD - else -> throw IncreaseInvalidDataException("Unknown Currency: $value") + /** 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 } - /** - * 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 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 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 [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(), + ) + } + private var validated: Boolean = false - fun validate(): Currency = apply { + fun validate(): PurchaseDetails = apply { if (validated) { return@apply } - known() + carRental().ifPresent { it.validate() } + customerReferenceIdentifier() + localTaxAmount() + localTaxCurrency() + lodging().ifPresent { it.validate() } + nationalTaxAmount() + nationalTaxCurrency() + purchaseIdentifier() + purchaseIdentifierFormat().ifPresent { it.validate() } + travel().ifPresent { it.validate() } validated = true } @@ -29198,4237 +29375,14800 @@ 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 /* spotless:off */ other is Currency && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() + @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() = 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") - - @JvmStatic fun of(value: String) = Network(JsonField.of(value)) - } + /** Fields specific to car rentals. */ + class CarRental + 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, + ) { - /** An enum containing [Network]'s known values. */ - enum class Known { - /** Visa */ - VISA - } + @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(), + ) - /** - * 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, /** - * An enum member indicating that [Network] was instantiated with an unknown - * value. + * 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). */ - _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 - 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 - else -> throw IncreaseInvalidDataException("Unknown Network: $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(): Network = 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 /* spotless:off */ other is Network && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** Network-specific identifiers for a specific request or transaction. */ - class NetworkIdentifiers - private constructor( - private val retrievalReferenceNumber: JsonField, - private val traceNumber: JsonField, - private val transactionId: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @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(retrievalReferenceNumber, traceNumber, transactionId, mutableMapOf()) - - /** - * 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 [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) - } + fun carClassCode(): Optional = + carClassCode.getOptional("car_class_code") - @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. + * + * @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 toBuilder() = Builder().from(this) + /** + * 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") - companion object { + /** + * 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") /** - * Returns a mutable builder for constructing an instance of - * [NetworkIdentifiers]. + * Number of days the vehicle was rented. * - * The following fields are required: - * ```java - * .retrievalReferenceNumber() - * .traceNumber() - * .transactionId() - * ``` + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ - @JvmStatic fun builder() = Builder() - } + fun daysRented(): Optional = daysRented.getOptional("days_rented") - /** A builder for [NetworkIdentifiers]. */ - class Builder internal constructor() { + /** + * 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") - private var retrievalReferenceNumber: JsonField? = null - private var traceNumber: JsonField? = null - private var transactionId: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** + * 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") - @JvmSynthetic - internal fun from(networkIdentifiers: NetworkIdentifiers) = apply { - retrievalReferenceNumber = networkIdentifiers.retrievalReferenceNumber - traceNumber = networkIdentifiers.traceNumber - transactionId = networkIdentifiers.transactionId - additionalProperties = - networkIdentifiers.additionalProperties.toMutableMap() - } + /** + * 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") /** - * 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. + * 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 retrievalReferenceNumber(retrievalReferenceNumber: String?) = - retrievalReferenceNumber(JsonField.ofNullable(retrievalReferenceNumber)) + fun insuranceChargesAmount(): Optional = + insuranceChargesAmount.getOptional("insurance_charges_amount") /** - * Alias for calling [Builder.retrievalReferenceNumber] with - * `retrievalReferenceNumber.orElse(null)`. + * 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 retrievalReferenceNumber(retrievalReferenceNumber: Optional) = - retrievalReferenceNumber(retrievalReferenceNumber.getOrNull()) + fun insuranceChargesCurrency(): Optional = + insuranceChargesCurrency.getOptional("insurance_charges_currency") /** - * Sets [Builder.retrievalReferenceNumber] to an arbitrary JSON value. + * An indicator that the cardholder is being billed for a reserved vehicle that + * was not actually rented (that is, a "no-show" charge). * - * 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. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ - fun retrievalReferenceNumber(retrievalReferenceNumber: JsonField) = - apply { - this.retrievalReferenceNumber = retrievalReferenceNumber - } + fun noShowIndicator(): Optional = + noShowIndicator.getOptional("no_show_indicator") /** - * A counter used to verify an individual authorization. Expected to be unique - * per acquirer within a window of time. + * 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 traceNumber(traceNumber: String?) = - traceNumber(JsonField.ofNullable(traceNumber)) + fun oneWayDropOffChargesAmount(): Optional = + oneWayDropOffChargesAmount.getOptional("one_way_drop_off_charges_amount") - /** Alias for calling [Builder.traceNumber] with `traceNumber.orElse(null)`. */ - fun traceNumber(traceNumber: Optional) = - traceNumber(traceNumber.getOrNull()) + /** + * 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" + ) /** - * Sets [Builder.traceNumber] to an arbitrary JSON value. + * Name of the person renting the vehicle. * - * 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. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ - fun traceNumber(traceNumber: JsonField) = apply { - this.traceNumber = traceNumber - } + fun renterName(): Optional = renterName.getOptional("renter_name") /** - * A globally unique transaction identifier provided by the card network, used - * across multiple life-cycle requests. + * 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 transactionId(transactionId: String?) = - transactionId(JsonField.ofNullable(transactionId)) + fun weeklyRentalRateAmount(): Optional = + weeklyRentalRateAmount.getOptional("weekly_rental_rate_amount") /** - * Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`. + * 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 transactionId(transactionId: Optional) = - transactionId(transactionId.getOrNull()) + fun weeklyRentalRateCurrency(): Optional = + weeklyRentalRateCurrency.getOptional("weekly_rental_rate_currency") /** - * Sets [Builder.transactionId] to an arbitrary JSON value. + * Returns the raw JSON value of [carClassCode]. * - * 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. + * Unlike [carClassCode], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun transactionId(transactionId: JsonField) = apply { - this.transactionId = transactionId - } + @JsonProperty("car_class_code") + @ExcludeMissing + fun _carClassCode(): JsonField = carClassCode - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** + * 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 - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, 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 - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + /** + * 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 - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** + * 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 - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** + * 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 /** - * Returns an immutable instance of [NetworkIdentifiers]. + * Returns the raw JSON value of [fuelChargesAmount]. * - * Further updates to this [Builder] will not mutate the returned instance. + * Unlike [fuelChargesAmount], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("fuel_charges_amount") + @ExcludeMissing + fun _fuelChargesAmount(): JsonField = fuelChargesAmount + + /** + * Returns the raw JSON value of [fuelChargesCurrency]. * - * The following fields are required: - * ```java - * .retrievalReferenceNumber() - * .traceNumber() - * .transactionId() - * ``` + * Unlike [fuelChargesCurrency], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("fuel_charges_currency") + @ExcludeMissing + fun _fuelChargesCurrency(): JsonField = fuelChargesCurrency + + /** + * Returns the raw JSON value of [insuranceChargesAmount]. * - * @throws IllegalStateException if any required field is unset. + * Unlike [insuranceChargesAmount], this method doesn't throw if the JSON field + * has an unexpected type. */ - fun build(): NetworkIdentifiers = - NetworkIdentifiers( - checkRequired("retrievalReferenceNumber", retrievalReferenceNumber), - checkRequired("traceNumber", traceNumber), - checkRequired("transactionId", transactionId), - additionalProperties.toMutableMap(), - ) - } + @JsonProperty("insurance_charges_amount") + @ExcludeMissing + fun _insuranceChargesAmount(): JsonField = insuranceChargesAmount - private var validated: Boolean = false + /** + * 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 validate(): NetworkIdentifiers = apply { - if (validated) { - return@apply - } + /** + * 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 - retrievalReferenceNumber() - traceNumber() - transactionId() - validated = true - } + /** + * 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") + @ExcludeMissing + fun _oneWayDropOffChargesAmount(): JsonField = oneWayDropOffChargesAmount - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * 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 - /** - * 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 (retrievalReferenceNumber.asKnown().isPresent) 1 else 0) + - (if (traceNumber.asKnown().isPresent) 1 else 0) + - (if (transactionId.asKnown().isPresent) 1 else 0) + /** + * 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 equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * 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 - return /* spotless:off */ other is NetworkIdentifiers && retrievalReferenceNumber == other.retrievalReferenceNumber && traceNumber == other.traceNumber && transactionId == other.transactionId && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * 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 - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(retrievalReferenceNumber, traceNumber, transactionId, additionalProperties) } - /* spotless:on */ + @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() = - "NetworkIdentifiers{retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}" - } + fun toBuilder() = Builder().from(this) - /** Why this reversal was initiated. */ - class ReversalReason - @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 + /** + * 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() + } - companion object { + /** A builder for [CarRental]. */ + class Builder internal constructor() { - /** The Card Reversal was initiated at the customer's request. */ - @JvmField val REVERSED_BY_CUSTOMER = of("reversed_by_customer") + 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() - /** The Card Reversal was initiated by the network or acquirer. */ - @JvmField - val REVERSED_BY_NETWORK_OR_ACQUIRER = of("reversed_by_network_or_acquirer") + @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() + } - /** The Card Reversal was initiated by the point of sale device. */ - @JvmField val REVERSED_BY_POINT_OF_SALE = of("reversed_by_point_of_sale") + /** Code indicating the vehicle's class. */ + fun carClassCode(carClassCode: String?) = + carClassCode(JsonField.ofNullable(carClassCode)) - /** The Card Reversal was a partial reversal, for any reason. */ - @JvmField val PARTIAL_REVERSAL = of("partial_reversal") + /** + * Alias for calling [Builder.carClassCode] with + * `carClassCode.orElse(null)`. + */ + fun carClassCode(carClassCode: Optional) = + carClassCode(carClassCode.getOrNull()) - @JvmStatic fun of(value: String) = ReversalReason(JsonField.of(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 + } - /** 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, - } + /** + * 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)) - /** - * 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, - } + /** + * Alias for calling [Builder.checkoutDate] with + * `checkoutDate.orElse(null)`. + */ + fun checkoutDate(checkoutDate: Optional) = + checkoutDate(checkoutDate.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) { - 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 - } + /** + * 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 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") - } + /** Daily rate being charged for the vehicle. */ + fun dailyRentalRateAmount(dailyRentalRateAmount: Long?) = + dailyRentalRateAmount(JsonField.ofNullable(dailyRentalRateAmount)) - /** - * 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 [Builder.dailyRentalRateAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun dailyRentalRateAmount(dailyRentalRateAmount: Long) = + dailyRentalRateAmount(dailyRentalRateAmount as Long?) - private var validated: Boolean = false + /** + * Alias for calling [Builder.dailyRentalRateAmount] with + * `dailyRentalRateAmount.orElse(null)`. + */ + fun dailyRentalRateAmount(dailyRentalRateAmount: Optional) = + dailyRentalRateAmount(dailyRentalRateAmount.getOrNull()) - fun validate(): ReversalReason = apply { - if (validated) { - return@apply - } + /** + * 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 + } - known() - validated = true - } + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily + * rental rate. + */ + fun dailyRentalRateCurrency(dailyRentalRateCurrency: String?) = + dailyRentalRateCurrency(JsonField.ofNullable(dailyRentalRateCurrency)) - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * Alias for calling [Builder.dailyRentalRateCurrency] with + * `dailyRentalRateCurrency.orElse(null)`. + */ + fun dailyRentalRateCurrency(dailyRentalRateCurrency: Optional) = + dailyRentalRateCurrency(dailyRentalRateCurrency.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.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 + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** Number of days the vehicle was rented. */ + fun daysRented(daysRented: Long?) = + daysRented(JsonField.ofNullable(daysRented)) - return /* spotless:off */ other is ReversalReason && value == other.value /* spotless:on */ - } + /** + * Alias for [Builder.daysRented]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun daysRented(daysRented: Long) = daysRented(daysRented as Long?) - override fun hashCode() = value.hashCode() + /** + * Alias for calling [Builder.daysRented] with `daysRented.orElse(null)`. + */ + fun daysRented(daysRented: Optional) = + daysRented(daysRented.getOrNull()) - override fun toString() = value.toString() - } + /** + * 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 + } - /** - * A constant representing the object's type. For this resource it will always be - * `card_reversal`. - */ - class Type @JsonCreator private constructor(private val value: JsonField) : - Enum { + /** Additional charges (gas, late fee, etc.) being billed. */ + fun extraCharges(extraCharges: ExtraCharges?) = + extraCharges(JsonField.ofNullable(extraCharges)) - /** - * 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.extraCharges] with + * `extraCharges.orElse(null)`. + */ + fun extraCharges(extraCharges: Optional) = + extraCharges(extraCharges.getOrNull()) - companion object { + /** + * 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 + } - @JvmField val CARD_REVERSAL = of("card_reversal") + /** Fuel charges for the vehicle. */ + fun fuelChargesAmount(fuelChargesAmount: Long?) = + fuelChargesAmount(JsonField.ofNullable(fuelChargesAmount)) - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } + /** + * Alias for [Builder.fuelChargesAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun fuelChargesAmount(fuelChargesAmount: Long) = + fuelChargesAmount(fuelChargesAmount as Long?) - /** An enum containing [Type]'s known values. */ - enum class Known { - CARD_REVERSAL - } + /** + * Alias for calling [Builder.fuelChargesAmount] with + * `fuelChargesAmount.orElse(null)`. + */ + fun fuelChargesAmount(fuelChargesAmount: Optional) = + fuelChargesAmount(fuelChargesAmount.getOrNull()) - /** - * 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_REVERSAL, - /** - * An enum member indicating that [Type] was instantiated with an unknown value. - */ - _UNKNOWN, - } + /** + * 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 + } - /** - * 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_REVERSAL -> Value.CARD_REVERSAL - else -> Value._UNKNOWN - } + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fuel + * charges assessed. + */ + fun fuelChargesCurrency(fuelChargesCurrency: String?) = + fuelChargesCurrency(JsonField.ofNullable(fuelChargesCurrency)) - /** - * 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_REVERSAL -> Known.CARD_REVERSAL - else -> throw IncreaseInvalidDataException("Unknown Type: $value") - } + /** + * Alias for calling [Builder.fuelChargesCurrency] with + * `fuelChargesCurrency.orElse(null)`. + */ + fun fuelChargesCurrency(fuelChargesCurrency: Optional) = + fuelChargesCurrency(fuelChargesCurrency.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.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(): Type = 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?) - known() - 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 (value() == Value._UNKNOWN) 0 else 1 + /** + * 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 /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } + /** + * 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 hashCode() = value.hashCode() + /** + * 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 toString() = value.toString() - } + /** + * Alias for calling [Builder.noShowIndicator] with + * `noShowIndicator.orElse(null)`. + */ + fun noShowIndicator(noShowIndicator: Optional) = + noShowIndicator(noShowIndicator.getOrNull()) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * 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 + } - return /* spotless:off */ other is CardReversal && id == other.id && cardAuthorizationId == other.cardAuthorizationId && currency == other.currency && merchantAcceptorId == other.merchantAcceptorId && merchantCategoryCode == other.merchantCategoryCode && merchantCity == other.merchantCity && merchantCountry == other.merchantCountry && merchantDescriptor == other.merchantDescriptor && merchantPostalCode == other.merchantPostalCode && merchantState == other.merchantState && network == other.network && networkIdentifiers == other.networkIdentifiers && pendingTransactionId == other.pendingTransactionId && presentmentCurrency == other.presentmentCurrency && reversalAmount == other.reversalAmount && reversalPresentmentAmount == other.reversalPresentmentAmount && reversalReason == other.reversalReason && terminalId == other.terminalId && type == other.type && updatedAuthorizationAmount == other.updatedAuthorizationAmount && updatedAuthorizationPresentmentAmount == other.updatedAuthorizationPresentmentAmount && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * Charges for returning the vehicle at a different location than where it + * was picked up. + */ + fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Long?) = + oneWayDropOffChargesAmount( + JsonField.ofNullable(oneWayDropOffChargesAmount) + ) - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, cardAuthorizationId, currency, merchantAcceptorId, merchantCategoryCode, merchantCity, merchantCountry, merchantDescriptor, merchantPostalCode, merchantState, network, networkIdentifiers, pendingTransactionId, presentmentCurrency, reversalAmount, reversalPresentmentAmount, reversalReason, terminalId, type, updatedAuthorizationAmount, updatedAuthorizationPresentmentAmount, additionalProperties) } - /* spotless:on */ + /** + * Alias for [Builder.oneWayDropOffChargesAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Long) = + oneWayDropOffChargesAmount(oneWayDropOffChargesAmount as Long?) - override fun hashCode(): Int = hashCode + /** + * Alias for calling [Builder.oneWayDropOffChargesAmount] with + * `oneWayDropOffChargesAmount.orElse(null)`. + */ + fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Optional) = + oneWayDropOffChargesAmount(oneWayDropOffChargesAmount.getOrNull()) - 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}" - } + /** + * 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 } - /** - * A Card Settlement object. This field will be present in the JSON response if and only if - * `category` is equal to `card_settlement`. Card Settlements are card transactions that - * have cleared and settled. While a settlement is usually preceded by an authorization, an - * acquirer can also directly clear a transaction without first authorizing it. - */ - class CardSettlement - private constructor( - private val id: JsonField, - private val amount: JsonField, - private val cardAuthorization: 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 pendingTransactionId: 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, - ) { + /** + * 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) + ) - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - @JsonProperty("card_authorization") - @ExcludeMissing - cardAuthorization: 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("pending_transaction_id") - @ExcludeMissing - pendingTransactionId: 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, - cardAuthorization, - cardPaymentId, - cashback, - currency, - interchange, - merchantAcceptorId, - merchantCategoryCode, - merchantCity, - merchantCountry, - merchantName, - merchantPostalCode, - merchantState, - networkIdentifiers, - pendingTransactionId, - presentmentAmount, - presentmentCurrency, - purchaseDetails, - transactionId, - type, - mutableMapOf(), - ) + /** + * Alias for calling [Builder.oneWayDropOffChargesCurrency] with + * `oneWayDropOffChargesCurrency.orElse(null)`. + */ + fun oneWayDropOffChargesCurrency( + oneWayDropOffChargesCurrency: Optional + ) = oneWayDropOffChargesCurrency(oneWayDropOffChargesCurrency.getOrNull()) - /** - * The Card Settlement 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") + /** + * 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 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") + /** Name of the person renting the vehicle. */ + fun renterName(renterName: String?) = + renterName(JsonField.ofNullable(renterName)) - /** - * The Card Authorization that was created prior to this Card Settlement, if one exists. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun cardAuthorization(): Optional = - cardAuthorization.getOptional("card_authorization") + /** + * Alias for calling [Builder.renterName] with `renterName.orElse(null)`. + */ + fun renterName(renterName: Optional) = + renterName(renterName.getOrNull()) - /** - * 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") + /** + * 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 + } - /** - * Cashback earned on 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") + /** Weekly rate being charged for the vehicle. */ + fun weeklyRentalRateAmount(weeklyRentalRateAmount: Long?) = + weeklyRentalRateAmount(JsonField.ofNullable(weeklyRentalRateAmount)) - /** - * 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). + /** + * Alias for [Builder.weeklyRentalRateAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun weeklyRentalRateAmount(weeklyRentalRateAmount: Long) = + weeklyRentalRateAmount(weeklyRentalRateAmount as Long?) + + /** + * Alias for calling [Builder.weeklyRentalRateAmount] with + * `weeklyRentalRateAmount.orElse(null)`. + */ + fun weeklyRentalRateAmount(weeklyRentalRateAmount: Optional) = + weeklyRentalRateAmount(weeklyRentalRateAmount.getOrNull()) + + /** + * 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 + } + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * weekly rental rate. + */ + fun weeklyRentalRateCurrency(weeklyRentalRateCurrency: String?) = + weeklyRentalRateCurrency(JsonField.ofNullable(weeklyRentalRateCurrency)) + + /** + * Alias for calling [Builder.weeklyRentalRateCurrency] with + * `weeklyRentalRateCurrency.orElse(null)`. + */ + fun weeklyRentalRateCurrency(weeklyRentalRateCurrency: Optional) = + weeklyRentalRateCurrency(weeklyRentalRateCurrency.getOrNull()) + + /** + * 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 + } + + 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 [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(), + ) + } + + private var validated: Boolean = false + + fun validate(): CarRental = apply { + if (validated) { + return@apply + } + + 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 score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @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) + + /** Additional charges (gas, late fee, etc.) being billed. */ + class ExtraCharges + @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 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, + } + + /** + * 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 + } + + /** + * 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") + } + + private var validated: Boolean = false + + fun validate(): ExtraCharges = 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 /* spotless:off */ other is ExtraCharges && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * 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 + 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 { + + /** 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") + + @JvmStatic fun of(value: String) = NoShowIndicator(JsonField.of(value)) + } + + /** An enum containing [NoShowIndicator]'s known values. */ + enum class Known { + /** Not applicable */ + NOT_APPLICABLE, + /** No show for specialized vehicle */ + NO_SHOW_FOR_SPECIALIZED_VEHICLE, + } + + /** + * 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, + } + + /** + * 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 + } + + /** + * 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 + } + + return /* spotless:off */ other is NoShowIndicator && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ 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 /* spotless:on */ + } + + /* spotless:off */ + 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) } + /* spotless:on */ + + 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}" + } + + /** Fields specific to lodging. */ + class Lodging + 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") + @ExcludeMissing + folioCashAdvancesAmount: JsonField = JsonMissing.of(), + @JsonProperty("folio_cash_advances_currency") + @ExcludeMissing + folioCashAdvancesCurrency: JsonField = JsonMissing.of(), + @JsonProperty("food_beverage_charges_amount") + @ExcludeMissing + foodBeverageChargesAmount: JsonField = JsonMissing.of(), + @JsonProperty("food_beverage_charges_currency") + @ExcludeMissing + foodBeverageChargesCurrency: 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") + @ExcludeMissing + 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( + checkInDate, + dailyRoomRateAmount, + dailyRoomRateCurrency, + extraCharges, + folioCashAdvancesAmount, + folioCashAdvancesCurrency, + foodBeverageChargesAmount, + foodBeverageChargesCurrency, + noShowIndicator, + prepaidExpensesAmount, + prepaidExpensesCurrency, + roomNights, + totalRoomTaxAmount, + totalRoomTaxCurrency, + totalTaxAmount, + totalTaxCurrency, + 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. + * + * @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") + + /** + * 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 folioCashAdvancesCurrency(): Optional = + folioCashAdvancesCurrency.getOptional("folio_cash_advances_currency") + + /** + * 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 foodBeverageChargesAmount(): Optional = + foodBeverageChargesAmount.getOptional("food_beverage_charges_amount") + + /** + * 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 foodBeverageChargesCurrency(): Optional = + foodBeverageChargesCurrency.getOptional("food_beverage_charges_currency") + + /** + * 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 noShowIndicator(): Optional = + noShowIndicator.getOptional("no_show_indicator") + + /** + * 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 prepaidExpensesAmount(): Optional = + prepaidExpensesAmount.getOptional("prepaid_expenses_amount") + + /** + * 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 prepaidExpensesCurrency(): Optional = + prepaidExpensesCurrency.getOptional("prepaid_expenses_currency") + + /** + * 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 roomNights(): Optional = roomNights.getOptional("room_nights") + + /** + * 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 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("check_in_date") + @ExcludeMissing + fun _checkInDate(): JsonField = checkInDate + + /** + * Returns the raw JSON value of [dailyRoomRateAmount]. + * + * Unlike [dailyRoomRateAmount], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("daily_room_rate_amount") + @ExcludeMissing + fun _dailyRoomRateAmount(): JsonField = dailyRoomRateAmount + + /** + * Returns the raw JSON value of [dailyRoomRateCurrency]. + * + * Unlike [dailyRoomRateCurrency], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("daily_room_rate_currency") + @ExcludeMissing + fun _dailyRoomRateCurrency(): JsonField = dailyRoomRateCurrency + + /** + * 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 + + /** + * 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") + @ExcludeMissing + fun _foodBeverageChargesAmount(): JsonField = foodBeverageChargesAmount + + /** + * Returns the raw JSON value of [foodBeverageChargesCurrency]. + * + * Unlike [foodBeverageChargesCurrency], this method doesn't throw if the JSON + * field has an unexpected type. + */ + @JsonProperty("food_beverage_charges_currency") + @ExcludeMissing + fun _foodBeverageChargesCurrency(): JsonField = + foodBeverageChargesCurrency + + /** + * 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 the raw JSON value of [prepaidExpensesAmount]. + * + * 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. + */ + @JsonProperty("prepaid_expenses_currency") + @ExcludeMissing + fun _prepaidExpensesCurrency(): JsonField = prepaidExpensesCurrency + + /** + * Returns the raw JSON value of [roomNights]. + * + * Unlike [roomNights], 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") + @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("total_tax_amount") + @ExcludeMissing + 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) { + 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 [Lodging]. + * + * The following fields are required: + * ```java + * .checkInDate() + * .dailyRoomRateAmount() + * .dailyRoomRateCurrency() + * .extraCharges() + * .folioCashAdvancesAmount() + * .folioCashAdvancesCurrency() + * .foodBeverageChargesAmount() + * .foodBeverageChargesCurrency() + * .noShowIndicator() + * .prepaidExpensesAmount() + * .prepaidExpensesCurrency() + * .roomNights() + * .totalRoomTaxAmount() + * .totalRoomTaxCurrency() + * .totalTaxAmount() + * .totalTaxCurrency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Lodging]. */ + 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 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 + } + + /** Additional charges (phone, late check-out, etc.) being billed. */ + fun extraCharges(extraCharges: ExtraCharges?) = + extraCharges(JsonField.ofNullable(extraCharges)) + + /** + * Alias for calling [Builder.extraCharges] with + * `extraCharges.orElse(null)`. + */ + fun extraCharges(extraCharges: Optional) = + extraCharges(extraCharges.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 + } + + /** 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. + */ + fun folioCashAdvancesAmount(folioCashAdvancesAmount: Long) = + folioCashAdvancesAmount(folioCashAdvancesAmount as Long?) + + /** + * Alias for calling [Builder.folioCashAdvancesAmount] with + * `folioCashAdvancesAmount.orElse(null)`. + */ + fun folioCashAdvancesAmount(folioCashAdvancesAmount: Optional) = + folioCashAdvancesAmount(folioCashAdvancesAmount.getOrNull()) + + /** + * Sets [Builder.folioCashAdvancesAmount] 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. + */ + fun folioCashAdvancesAmount(folioCashAdvancesAmount: JsonField) = + apply { + this.folioCashAdvancesAmount = folioCashAdvancesAmount + } + + /** + * 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.folioCashAdvancesCurrency] with + * `folioCashAdvancesCurrency.orElse(null)`. + */ + fun folioCashAdvancesCurrency(folioCashAdvancesCurrency: Optional) = + folioCashAdvancesCurrency(folioCashAdvancesCurrency.getOrNull()) + + /** + * Sets [Builder.folioCashAdvancesCurrency] 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. + */ + fun folioCashAdvancesCurrency( + folioCashAdvancesCurrency: JsonField + ) = apply { this.folioCashAdvancesCurrency = folioCashAdvancesCurrency } + + /** Food and beverage charges for the room. */ + fun foodBeverageChargesAmount(foodBeverageChargesAmount: Long?) = + foodBeverageChargesAmount( + JsonField.ofNullable(foodBeverageChargesAmount) + ) + + /** + * Alias for [Builder.foodBeverageChargesAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun foodBeverageChargesAmount(foodBeverageChargesAmount: Long) = + foodBeverageChargesAmount(foodBeverageChargesAmount as Long?) + + /** + * 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.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 foodBeverageChargesAmount(foodBeverageChargesAmount: JsonField) = + apply { + this.foodBeverageChargesAmount = foodBeverageChargesAmount + } + + /** + * 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.foodBeverageChargesCurrency] with + * `foodBeverageChargesCurrency.orElse(null)`. + */ + fun foodBeverageChargesCurrency( + foodBeverageChargesCurrency: Optional + ) = foodBeverageChargesCurrency(foodBeverageChargesCurrency.getOrNull()) + + /** + * Sets [Builder.foodBeverageChargesCurrency] to an arbitrary JSON 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 foodBeverageChargesCurrency( + foodBeverageChargesCurrency: JsonField + ) = apply { this.foodBeverageChargesCurrency = foodBeverageChargesCurrency } + + /** + * Indicator that the cardholder is being billed for a reserved room that + * was not actually used. + */ + fun noShowIndicator(noShowIndicator: NoShowIndicator?) = + noShowIndicator(JsonField.ofNullable(noShowIndicator)) + + /** + * Alias for calling [Builder.noShowIndicator] with + * `noShowIndicator.orElse(null)`. + */ + fun noShowIndicator(noShowIndicator: Optional) = + noShowIndicator(noShowIndicator.getOrNull()) + + /** + * 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 + } + + /** 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?) + + /** + * Alias for calling [Builder.prepaidExpensesAmount] with + * `prepaidExpensesAmount.orElse(null)`. + */ + fun prepaidExpensesAmount(prepaidExpensesAmount: Optional) = + prepaidExpensesAmount(prepaidExpensesAmount.getOrNull()) + + /** + * Sets [Builder.prepaidExpensesAmount] 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. + */ + fun prepaidExpensesAmount(prepaidExpensesAmount: JsonField) = apply { + this.prepaidExpensesAmount = prepaidExpensesAmount + } + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * prepaid expenses. + */ + fun prepaidExpensesCurrency(prepaidExpensesCurrency: String?) = + prepaidExpensesCurrency(JsonField.ofNullable(prepaidExpensesCurrency)) + + /** + * Alias for calling [Builder.prepaidExpensesCurrency] with + * `prepaidExpensesCurrency.orElse(null)`. + */ + fun prepaidExpensesCurrency(prepaidExpensesCurrency: Optional) = + prepaidExpensesCurrency(prepaidExpensesCurrency.getOrNull()) + + /** + * Sets [Builder.prepaidExpensesCurrency] 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. + */ + fun prepaidExpensesCurrency(prepaidExpensesCurrency: JsonField) = + apply { + this.prepaidExpensesCurrency = prepaidExpensesCurrency + } + + /** Number of nights the room was rented. */ + fun roomNights(roomNights: Long?) = + roomNights(JsonField.ofNullable(roomNights)) + + /** + * Alias for [Builder.roomNights]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun roomNights(roomNights: Long) = roomNights(roomNights as Long?) + + /** + * 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.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)) + + /** + * 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 + } + + /** 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 { + 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 [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 + } + + checkInDate() + dailyRoomRateAmount() + dailyRoomRateCurrency() + extraCharges().ifPresent { it.validate() } + folioCashAdvancesAmount() + folioCashAdvancesCurrency() + foodBeverageChargesAmount() + foodBeverageChargesCurrency() + noShowIndicator().ifPresent { it.validate() } + prepaidExpensesAmount() + prepaidExpensesCurrency() + roomNights() + totalRoomTaxAmount() + totalRoomTaxCurrency() + totalTaxAmount() + totalTaxCurrency() + 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 (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) + + /** Additional charges (phone, late check-out, etc.) being billed. */ + class ExtraCharges + @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 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") + + /** Laundry */ + @JvmField val LAUNDRY = of("laundry") + + @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, + /** 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, + /** + * An enum member indicating that [ExtraCharges] 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_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 + } + + /** + * 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" + ) + } + + /** + * 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(): ExtraCharges = 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 /* spotless:off */ other is ExtraCharges && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * 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 { + + /** + * 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 { + + /** Not applicable */ + @JvmField val NOT_APPLICABLE = of("not_applicable") + + /** No show */ + @JvmField val NO_SHOW = of("no_show") + + @JvmStatic fun of(value: String) = NoShowIndicator(JsonField.of(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, + /** + * An enum member indicating that [NoShowIndicator] 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_APPLICABLE -> Value.NOT_APPLICABLE + NO_SHOW -> Value.NO_SHOW + 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_APPLICABLE -> Known.NOT_APPLICABLE + NO_SHOW -> Known.NO_SHOW + 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 + } + + return /* spotless:off */ other is NoShowIndicator && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ 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 /* spotless:on */ + } + + /* spotless:off */ + 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) } + /* spotless:on */ + + 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}" + } + + /** 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 /* spotless:off */ other is PurchaseIdentifierFormat && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Fields specific to travel. */ + class Travel + 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, + ) { + + @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(), + ) + + /** + * 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") + + /** + * 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") + + /** + * 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 + + /** + * 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 + + /** + * 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 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 + + /** + * 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 + + @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. */ + fun restrictedTicketIndicator( + restrictedTicketIndicator: RestrictedTicketIndicator? + ) = + restrictedTicketIndicator( + JsonField.ofNullable(restrictedTicketIndicator) + ) + + /** + * Alias for calling [Builder.restrictedTicketIndicator] with + * `restrictedTicketIndicator.orElse(null)`. + */ + fun restrictedTicketIndicator( + restrictedTicketIndicator: Optional + ) = restrictedTicketIndicator(restrictedTicketIndicator.getOrNull()) + + /** + * 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 } + + /** Indicates why a ticket was changed. */ + fun ticketChangeIndicator(ticketChangeIndicator: TicketChangeIndicator?) = + ticketChangeIndicator(JsonField.ofNullable(ticketChangeIndicator)) + + /** + * Alias for calling [Builder.ticketChangeIndicator] with + * `ticketChangeIndicator.orElse(null)`. + */ + fun ticketChangeIndicator( + ticketChangeIndicator: Optional + ) = ticketChangeIndicator(ticketChangeIndicator.getOrNull()) + + /** + * 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 } + + /** Ticket number. */ + fun ticketNumber(ticketNumber: String?) = + ticketNumber(JsonField.ofNullable(ticketNumber)) + + /** + * Alias for calling [Builder.ticketNumber] with + * `ticketNumber.orElse(null)`. + */ + fun ticketNumber(ticketNumber: Optional) = + ticketNumber(ticketNumber.getOrNull()) + + /** + * 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 + } + + /** + * Code for the travel agency if the ticket was issued by a travel agency. + */ + fun travelAgencyCode(travelAgencyCode: String?) = + travelAgencyCode(JsonField.ofNullable(travelAgencyCode)) + + /** + * Alias for calling [Builder.travelAgencyCode] with + * `travelAgencyCode.orElse(null)`. + */ + fun travelAgencyCode(travelAgencyCode: Optional) = + travelAgencyCode(travelAgencyCode.getOrNull()) + + /** + * 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 + } + + /** + * Name of the travel agency if the ticket was issued by a travel agency. + */ + fun travelAgencyName(travelAgencyName: String?) = + travelAgencyName(JsonField.ofNullable(travelAgencyName)) + + /** + * Alias for calling [Builder.travelAgencyName] with + * `travelAgencyName.orElse(null)`. + */ + fun travelAgencyName(travelAgencyName: Optional) = + travelAgencyName(travelAgencyName.getOrNull()) + + /** + * 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 + } + + /** 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()) + + /** + * 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() } + } + + /** + * 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) + } + } + + 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 [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 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 + 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") + + /** + * 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") + + /** + * 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 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 + + /** + * 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 [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 + + /** + * 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 + + /** + * 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 + + @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) + } + } + + /** Ticket document number. */ + fun ticketDocumentNumber(ticketDocumentNumber: String?) = + ticketDocumentNumber(JsonField.ofNullable(ticketDocumentNumber)) + + /** + * Alias for calling [Builder.ticketDocumentNumber] with + * `ticketDocumentNumber.orElse(null)`. + */ + fun ticketDocumentNumber(ticketDocumentNumber: Optional) = + ticketDocumentNumber(ticketDocumentNumber.getOrNull()) + + /** + * 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) + } + + 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 [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 { + if (validated) { + return@apply + } + + connectedTicketDocumentNumber() + creditReasonIndicator().ifPresent { it.validate() } + passengerNameOrDescription() + services().forEach { it.validate() } + ticketDocumentNumber() + 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 (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 { + + /** + * 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" + ) + + /** Other */ + @JvmField val OTHER = of("other") + + @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, + /** Other */ + OTHER, + } + + /** + * 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, + } + + /** + * 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" + ) + } + + /** + * 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 /* spotless:off */ other is CreditReasonIndicator && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class Service + private constructor( + private val category: JsonField, + private val subCategory: 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()) + + /** + * 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 + + @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 + * [Service]. + * + * The following fields are required: + * ```java + * .category() + * .subCategory() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Service]. */ + class Builder internal constructor() { + + private var category: JsonField? = null + private var subCategory: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(service: Service) = apply { + category = service.category + subCategory = service.subCategory + additionalProperties = + service.additionalProperties.toMutableMap() + } + + /** Category of the ancillary service. */ + fun category(category: Category?) = + category(JsonField.ofNullable(category)) + + /** + * Alias for calling [Builder.category] with + * `category.orElse(null)`. + */ + fun category(category: Optional) = + category(category.getOrNull()) + + /** + * 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 + } + + /** Sub-category of the ancillary service, free-form. */ + fun subCategory(subCategory: String?) = + subCategory(JsonField.ofNullable(subCategory)) + + /** + * Alias for calling [Builder.subCategory] with + * `subCategory.orElse(null)`. + */ + fun subCategory(subCategory: Optional) = + subCategory(subCategory.getOrNull()) + + /** + * 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 + } + + 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 [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 + } + + category().ifPresent { it.validate() } + subCategory() + 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) + + (if (subCategory.asKnown().isPresent) 1 else 0) + + /** Category of the ancillary service. */ + 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 { + + /** None */ + @JvmField val NONE = of("none") + + /** Bundled service */ + @JvmField val BUNDLED_SERVICE = of("bundled_service") + + /** Baggage fee */ + @JvmField val BAGGAGE_FEE = of("baggage_fee") + + /** Change fee */ + @JvmField val CHANGE_FEE = of("change_fee") + + /** Cargo */ + @JvmField val CARGO = of("cargo") + + /** Carbon offset */ + @JvmField val CARBON_OFFSET = of("carbon_offset") + + /** Frequent flyer */ + @JvmField val FREQUENT_FLYER = of("frequent_flyer") + + /** Gift card */ + @JvmField val GIFT_CARD = of("gift_card") + + /** Ground transport */ + @JvmField val GROUND_TRANSPORT = of("ground_transport") + + /** In-flight entertainment */ + @JvmField + val IN_FLIGHT_ENTERTAINMENT = of("in_flight_entertainment") + + /** Lounge */ + @JvmField val LOUNGE = of("lounge") + + /** Medical */ + @JvmField val MEDICAL = of("medical") + + /** Meal beverage */ + @JvmField val MEAL_BEVERAGE = of("meal_beverage") + + /** Other */ + @JvmField val OTHER = of("other") + + /** Passenger assist fee */ + @JvmField val PASSENGER_ASSIST_FEE = of("passenger_assist_fee") + + /** Pets */ + @JvmField val PETS = of("pets") + + /** Seat fees */ + @JvmField val SEAT_FEES = of("seat_fees") + + /** Standby */ + @JvmField val STANDBY = of("standby") + + /** Service fee */ + @JvmField val SERVICE_FEE = of("service_fee") + + /** Store */ + @JvmField val STORE = of("store") + + /** Travel service */ + @JvmField val TRAVEL_SERVICE = of("travel_service") + + /** Unaccompanied travel */ + @JvmField val UNACCOMPANIED_TRAVEL = of("unaccompanied_travel") + + /** Upgrades */ + @JvmField val UPGRADES = of("upgrades") + + /** 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 [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 /* spotless:off */ other is Category && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Service && category == other.category && subCategory == other.subCategory && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(category, subCategory, additionalProperties) } + /* spotless:on */ + + 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 /* spotless:off */ other is Ancillary && connectedTicketDocumentNumber == other.connectedTicketDocumentNumber && creditReasonIndicator == other.creditReasonIndicator && passengerNameOrDescription == other.passengerNameOrDescription && services == other.services && ticketDocumentNumber == other.ticketDocumentNumber && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(connectedTicketDocumentNumber, creditReasonIndicator, passengerNameOrDescription, services, ticketDocumentNumber, additionalProperties) } + /* spotless:on */ + + 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 /* spotless:off */ other is CreditReasonIndicator && value == other.value /* spotless:on */ + } + + 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 /* spotless:off */ other is RestrictedTicketIndicator && value == other.value /* spotless:on */ + } + + 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 /* spotless:off */ other is TicketChangeIndicator && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class TripLeg + 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 /* spotless:off */ other is StopOverCode && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is TripLeg && carrierCode == other.carrierCode && destinationCityAirportCode == other.destinationCityAirportCode && fareBasisCode == other.fareBasisCode && flightNumber == other.flightNumber && serviceClass == other.serviceClass && stopOverCode == other.stopOverCode && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(carrierCode, destinationCityAirportCode, fareBasisCode, flightNumber, serviceClass, stopOverCode, additionalProperties) } + /* spotless:on */ + + 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 /* spotless:off */ 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 /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(ancillary, computerizedReservationSystem, creditReasonIndicator, departureDate, originationCityAirportCode, passengerName, restrictedTicketIndicator, ticketChangeIndicator, ticketNumber, travelAgencyCode, travelAgencyName, tripLegs, additionalProperties) } + /* spotless:on */ + + 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 /* spotless:off */ 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 /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(carRental, customerReferenceIdentifier, localTaxAmount, localTaxCurrency, lodging, nationalTaxAmount, nationalTaxCurrency, purchaseIdentifier, purchaseIdentifierFormat, travel, additionalProperties) } + /* spotless:on */ + + 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}" + } + + /** + * 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 /* spotless:off */ other is Type && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ 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 /* spotless:on */ + } + + /* spotless:off */ + 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) } + /* spotless:on */ + + 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}" + } + + /** + * A Card Reversal object. This field will be present in the JSON response if and only if + * `category` is equal to `card_reversal`. Card Reversals cancel parts of or the entirety of + * an existing Card Authorization. + */ + class CardReversal + private constructor( + private val id: JsonField, + private val cardAuthorizationId: JsonField, + private val currency: 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 network: JsonField, + private val networkIdentifiers: JsonField, + private val pendingTransactionId: JsonField, + private val presentmentCurrency: JsonField, + private val reversalAmount: JsonField, + private val reversalPresentmentAmount: JsonField, + private val reversalReason: JsonField, + private val terminalId: JsonField, + private val type: JsonField, + private val updatedAuthorizationAmount: JsonField, + private val updatedAuthorizationPresentmentAmount: 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("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") + @ExcludeMissing + network: JsonField = JsonMissing.of(), + @JsonProperty("network_identifiers") + @ExcludeMissing + networkIdentifiers: JsonField = JsonMissing.of(), + @JsonProperty("pending_transaction_id") + @ExcludeMissing + pendingTransactionId: JsonField = JsonMissing.of(), + @JsonProperty("presentment_currency") + @ExcludeMissing + presentmentCurrency: JsonField = JsonMissing.of(), + @JsonProperty("reversal_amount") + @ExcludeMissing + reversalAmount: JsonField = JsonMissing.of(), + @JsonProperty("reversal_presentment_amount") + @ExcludeMissing + reversalPresentmentAmount: JsonField = JsonMissing.of(), + @JsonProperty("reversal_reason") + @ExcludeMissing + reversalReason: JsonField = JsonMissing.of(), + @JsonProperty("terminal_id") + @ExcludeMissing + terminalId: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("updated_authorization_amount") + @ExcludeMissing + updatedAuthorizationAmount: JsonField = JsonMissing.of(), + @JsonProperty("updated_authorization_presentment_amount") + @ExcludeMissing + updatedAuthorizationPresentmentAmount: JsonField = JsonMissing.of(), + ) : this( + id, + cardAuthorizationId, + currency, + merchantAcceptorId, + merchantCategoryCode, + merchantCity, + merchantCountry, + merchantDescriptor, + merchantPostalCode, + merchantState, + network, + networkIdentifiers, + pendingTransactionId, + presentmentCurrency, + reversalAmount, + reversalPresentmentAmount, + reversalReason, + terminalId, + type, + updatedAuthorizationAmount, + updatedAuthorizationPresentmentAmount, + mutableMapOf(), + ) + + /** + * The Card Reversal 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 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") + + /** + * 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") + + /** + * 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 (e.g. + * if the server responded with an unexpected value). + */ + fun merchantCountry(): Optional = + merchantCountry.getOptional("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") + + /** + * 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 Reversal. + * + * @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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the reversal'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") + + /** + * The amount of this reversal 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 reversalAmount(): Long = reversalAmount.getRequired("reversal_amount") + + /** + * The amount of this reversal in the minor unit of the transaction's presentment + * 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 reversalPresentmentAmount(): Long = + reversalPresentmentAmount.getRequired("reversal_presentment_amount") + + /** + * Why this reversal was initiated. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun reversalReason(): Optional = + reversalReason.getOptional("reversal_reason") + + /** + * 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_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 type(): Type = type.getRequired("type") + + /** + * The amount left pending on the Card Authorization 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") + + /** + * The amount left pending on the Card Authorization in the minor unit of the + * transaction's presentment 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 updatedAuthorizationPresentmentAmount(): Long = + updatedAuthorizationPresentmentAmount.getRequired( + "updated_authorization_presentment_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 + + /** + * 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 [network]. + * + * Unlike [network], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("network") @ExcludeMissing fun _network(): JsonField = network + + /** + * 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 [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 + + /** + * 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 [reversalAmount]. + * + * Unlike [reversalAmount], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("reversal_amount") + @ExcludeMissing + fun _reversalAmount(): JsonField = reversalAmount + + /** + * Returns the raw JSON value of [reversalPresentmentAmount]. + * + * Unlike [reversalPresentmentAmount], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("reversal_presentment_amount") + @ExcludeMissing + fun _reversalPresentmentAmount(): JsonField = reversalPresentmentAmount + + /** + * Returns the raw JSON value of [reversalReason]. + * + * Unlike [reversalReason], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("reversal_reason") + @ExcludeMissing + fun _reversalReason(): JsonField = reversalReason + + /** + * 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 [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 the raw JSON value of [updatedAuthorizationPresentmentAmount]. + * + * Unlike [updatedAuthorizationPresentmentAmount], this method doesn't throw if the JSON + * field has an unexpected type. + */ + @JsonProperty("updated_authorization_presentment_amount") + @ExcludeMissing + fun _updatedAuthorizationPresentmentAmount(): JsonField = + updatedAuthorizationPresentmentAmount + + @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 [CardReversal]. + * + * The following fields are required: + * ```java + * .id() + * .cardAuthorizationId() + * .currency() + * .merchantAcceptorId() + * .merchantCategoryCode() + * .merchantCity() + * .merchantCountry() + * .merchantDescriptor() + * .merchantPostalCode() + * .merchantState() + * .network() + * .networkIdentifiers() + * .pendingTransactionId() + * .presentmentCurrency() + * .reversalAmount() + * .reversalPresentmentAmount() + * .reversalReason() + * .terminalId() + * .type() + * .updatedAuthorizationAmount() + * .updatedAuthorizationPresentmentAmount() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [CardReversal]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var cardAuthorizationId: JsonField? = null + private var currency: 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 network: JsonField? = null + private var networkIdentifiers: JsonField? = null + private var pendingTransactionId: JsonField? = null + private var presentmentCurrency: JsonField? = null + private var reversalAmount: JsonField? = null + private var reversalPresentmentAmount: JsonField? = null + private var reversalReason: JsonField? = null + private var terminalId: JsonField? = null + private var type: JsonField? = null + private var updatedAuthorizationAmount: JsonField? = null + private var updatedAuthorizationPresentmentAmount: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(cardReversal: CardReversal) = apply { + id = cardReversal.id + cardAuthorizationId = cardReversal.cardAuthorizationId + currency = cardReversal.currency + merchantAcceptorId = cardReversal.merchantAcceptorId + merchantCategoryCode = cardReversal.merchantCategoryCode + merchantCity = cardReversal.merchantCity + merchantCountry = cardReversal.merchantCountry + merchantDescriptor = cardReversal.merchantDescriptor + merchantPostalCode = cardReversal.merchantPostalCode + merchantState = cardReversal.merchantState + network = cardReversal.network + networkIdentifiers = cardReversal.networkIdentifiers + pendingTransactionId = cardReversal.pendingTransactionId + presentmentCurrency = cardReversal.presentmentCurrency + reversalAmount = cardReversal.reversalAmount + reversalPresentmentAmount = cardReversal.reversalPresentmentAmount + reversalReason = cardReversal.reversalReason + terminalId = cardReversal.terminalId + type = cardReversal.type + updatedAuthorizationAmount = cardReversal.updatedAuthorizationAmount + updatedAuthorizationPresentmentAmount = + cardReversal.updatedAuthorizationPresentmentAmount + additionalProperties = cardReversal.additionalProperties.toMutableMap() + } + + /** The Card Reversal 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 identifier for the Card Authorization this reverses. */ + fun cardAuthorizationId(cardAuthorizationId: String) = + cardAuthorizationId(JsonField.of(cardAuthorizationId)) + + /** + * 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 + } + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the reversal'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 } + + /** + * 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.ofNullable(merchantCountry)) + + /** + * Alias for calling [Builder.merchantCountry] with `merchantCountry.orElse(null)`. + */ + fun merchantCountry(merchantCountry: Optional) = + merchantCountry(merchantCountry.getOrNull()) + + /** + * 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 + } + + /** The card network used to process this card authorization. */ + fun network(network: Network) = network(JsonField.of(network)) + + /** + * 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 } + + /** 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 identifier of the Pending Transaction associated with this Card Reversal. */ + fun pendingTransactionId(pendingTransactionId: String?) = + pendingTransactionId(JsonField.ofNullable(pendingTransactionId)) + + /** + * Alias for calling [Builder.pendingTransactionId] with + * `pendingTransactionId.orElse(null)`. + */ + fun pendingTransactionId(pendingTransactionId: Optional) = + pendingTransactionId(pendingTransactionId.getOrNull()) + + /** + * 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 + } + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the reversal'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 + } + + /** + * The amount of this reversal in the minor unit of the transaction's currency. For + * dollars, for example, this is cents. + */ + fun reversalAmount(reversalAmount: Long) = + reversalAmount(JsonField.of(reversalAmount)) + + /** + * Sets [Builder.reversalAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.reversalAmount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun reversalAmount(reversalAmount: JsonField) = apply { + this.reversalAmount = reversalAmount + } + + /** + * The amount of this reversal in the minor unit of the transaction's presentment + * currency. For dollars, for example, this is cents. + */ + fun reversalPresentmentAmount(reversalPresentmentAmount: Long) = + reversalPresentmentAmount(JsonField.of(reversalPresentmentAmount)) + + /** + * Sets [Builder.reversalPresentmentAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.reversalPresentmentAmount] with a well-typed + * [Long] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun reversalPresentmentAmount(reversalPresentmentAmount: JsonField) = apply { + this.reversalPresentmentAmount = reversalPresentmentAmount + } + + /** Why this reversal was initiated. */ + fun reversalReason(reversalReason: ReversalReason?) = + reversalReason(JsonField.ofNullable(reversalReason)) + + /** + * Alias for calling [Builder.reversalReason] with `reversalReason.orElse(null)`. + */ + fun reversalReason(reversalReason: Optional) = + reversalReason(reversalReason.getOrNull()) + + /** + * Sets [Builder.reversalReason] to an arbitrary JSON value. + * + * You should usually call [Builder.reversalReason] with a well-typed + * [ReversalReason] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun reversalReason(reversalReason: JsonField) = apply { + this.reversalReason = reversalReason + } + + /** + * 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_reversal`. + */ + 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 } + + /** + * The amount left pending on the Card Authorization in the minor unit of the + * transaction's currency. For dollars, for example, this is cents. + */ + fun updatedAuthorizationAmount(updatedAuthorizationAmount: Long) = + updatedAuthorizationAmount(JsonField.of(updatedAuthorizationAmount)) + + /** + * 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 + } + + /** + * The amount left pending on the Card Authorization in the minor unit of the + * transaction's presentment currency. For dollars, for example, this is cents. + */ + fun updatedAuthorizationPresentmentAmount( + updatedAuthorizationPresentmentAmount: Long + ) = + updatedAuthorizationPresentmentAmount( + JsonField.of(updatedAuthorizationPresentmentAmount) + ) + + /** + * Sets [Builder.updatedAuthorizationPresentmentAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.updatedAuthorizationPresentmentAmount] with a + * well-typed [Long] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun updatedAuthorizationPresentmentAmount( + updatedAuthorizationPresentmentAmount: JsonField + ) = apply { + this.updatedAuthorizationPresentmentAmount = + updatedAuthorizationPresentmentAmount + } + + 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 [CardReversal]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .cardAuthorizationId() + * .currency() + * .merchantAcceptorId() + * .merchantCategoryCode() + * .merchantCity() + * .merchantCountry() + * .merchantDescriptor() + * .merchantPostalCode() + * .merchantState() + * .network() + * .networkIdentifiers() + * .pendingTransactionId() + * .presentmentCurrency() + * .reversalAmount() + * .reversalPresentmentAmount() + * .reversalReason() + * .terminalId() + * .type() + * .updatedAuthorizationAmount() + * .updatedAuthorizationPresentmentAmount() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CardReversal = + CardReversal( + checkRequired("id", id), + checkRequired("cardAuthorizationId", cardAuthorizationId), + checkRequired("currency", currency), + checkRequired("merchantAcceptorId", merchantAcceptorId), + checkRequired("merchantCategoryCode", merchantCategoryCode), + checkRequired("merchantCity", merchantCity), + checkRequired("merchantCountry", merchantCountry), + checkRequired("merchantDescriptor", merchantDescriptor), + checkRequired("merchantPostalCode", merchantPostalCode), + checkRequired("merchantState", merchantState), + checkRequired("network", network), + checkRequired("networkIdentifiers", networkIdentifiers), + checkRequired("pendingTransactionId", pendingTransactionId), + checkRequired("presentmentCurrency", presentmentCurrency), + checkRequired("reversalAmount", reversalAmount), + checkRequired("reversalPresentmentAmount", reversalPresentmentAmount), + checkRequired("reversalReason", reversalReason), + checkRequired("terminalId", terminalId), + checkRequired("type", type), + checkRequired("updatedAuthorizationAmount", updatedAuthorizationAmount), + checkRequired( + "updatedAuthorizationPresentmentAmount", + updatedAuthorizationPresentmentAmount, + ), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): CardReversal = apply { + if (validated) { + return@apply + } + + id() + cardAuthorizationId() + currency().validate() + merchantAcceptorId() + merchantCategoryCode() + merchantCity() + merchantCountry() + merchantDescriptor() + merchantPostalCode() + merchantState() + network().validate() + networkIdentifiers().validate() + pendingTransactionId() + presentmentCurrency() + reversalAmount() + reversalPresentmentAmount() + reversalReason().ifPresent { it.validate() } + terminalId() + type().validate() + updatedAuthorizationAmount() + updatedAuthorizationPresentmentAmount() + 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) + + (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) + + (network.asKnown().getOrNull()?.validity() ?: 0) + + (networkIdentifiers.asKnown().getOrNull()?.validity() ?: 0) + + (if (pendingTransactionId.asKnown().isPresent) 1 else 0) + + (if (presentmentCurrency.asKnown().isPresent) 1 else 0) + + (if (reversalAmount.asKnown().isPresent) 1 else 0) + + (if (reversalPresentmentAmount.asKnown().isPresent) 1 else 0) + + (reversalReason.asKnown().getOrNull()?.validity() ?: 0) + + (if (terminalId.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (updatedAuthorizationAmount.asKnown().isPresent) 1 else 0) + + (if (updatedAuthorizationPresentmentAmount.asKnown().isPresent) 1 else 0) + + /** + * 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 { + + /** + * 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 { + + /** Canadian Dollar (CAD) */ + @JvmField val CAD = of("CAD") + + /** Swiss Franc (CHF) */ + @JvmField val CHF = of("CHF") + + /** Euro (EUR) */ + @JvmField val EUR = of("EUR") + + /** British Pound (GBP) */ + @JvmField val GBP = of("GBP") + + /** Japanese Yen (JPY) */ + @JvmField val JPY = of("JPY") + + /** 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 { + /** Canadian Dollar (CAD) */ + CAD, + /** Swiss Franc (CHF) */ + CHF, + /** Euro (EUR) */ + EUR, + /** British Pound (GBP) */ + GBP, + /** Japanese Yen (JPY) */ + JPY, + /** 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 { + /** Canadian Dollar (CAD) */ + CAD, + /** Swiss Franc (CHF) */ + CHF, + /** Euro (EUR) */ + EUR, + /** British Pound (GBP) */ + GBP, + /** Japanese Yen (JPY) */ + JPY, + /** 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) { + CAD -> Value.CAD + CHF -> Value.CHF + EUR -> Value.EUR + GBP -> Value.GBP + JPY -> Value.JPY + 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) { + CAD -> Known.CAD + CHF -> Known.CHF + EUR -> Known.EUR + GBP -> Known.GBP + JPY -> Known.JPY + 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 /* spotless:off */ other is Currency && value == other.value /* spotless:on */ + } + + 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") + + @JvmStatic fun of(value: String) = Network(JsonField.of(value)) + } + + /** An enum containing [Network]'s known values. */ + enum class Known { + /** Visa */ + VISA + } + + /** + * 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, + /** + * An enum member indicating that [Network] 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 + 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 + else -> throw IncreaseInvalidDataException("Unknown Network: $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(): Network = 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 /* spotless:off */ other is Network && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Network-specific identifiers for a specific request or transaction. */ + class NetworkIdentifiers + private constructor( + private val retrievalReferenceNumber: JsonField, + private val traceNumber: JsonField, + private val transactionId: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @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(retrievalReferenceNumber, traceNumber, transactionId, mutableMapOf()) + + /** + * 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 [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 + * .retrievalReferenceNumber() + * .traceNumber() + * .transactionId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [NetworkIdentifiers]. */ + class Builder internal constructor() { + + 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 { + retrievalReferenceNumber = networkIdentifiers.retrievalReferenceNumber + traceNumber = networkIdentifiers.traceNumber + transactionId = networkIdentifiers.transactionId + additionalProperties = + networkIdentifiers.additionalProperties.toMutableMap() + } + + /** + * 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 + * .retrievalReferenceNumber() + * .traceNumber() + * .transactionId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): NetworkIdentifiers = + NetworkIdentifiers( + checkRequired("retrievalReferenceNumber", retrievalReferenceNumber), + checkRequired("traceNumber", traceNumber), + checkRequired("transactionId", transactionId), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): NetworkIdentifiers = apply { + if (validated) { + return@apply + } + + 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 (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 /* spotless:off */ other is NetworkIdentifiers && retrievalReferenceNumber == other.retrievalReferenceNumber && traceNumber == other.traceNumber && transactionId == other.transactionId && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(retrievalReferenceNumber, traceNumber, transactionId, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "NetworkIdentifiers{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 /* spotless:off */ other is ReversalReason && value == other.value /* spotless:on */ + } + + 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_reversal`. + */ + 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_REVERSAL = of("card_reversal") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + CARD_REVERSAL + } + + /** + * 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_REVERSAL, + /** + * 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_REVERSAL -> Value.CARD_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) { + CARD_REVERSAL -> Known.CARD_REVERSAL + 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 /* spotless:off */ other is Type && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is CardReversal && id == other.id && cardAuthorizationId == other.cardAuthorizationId && currency == other.currency && merchantAcceptorId == other.merchantAcceptorId && merchantCategoryCode == other.merchantCategoryCode && merchantCity == other.merchantCity && merchantCountry == other.merchantCountry && merchantDescriptor == other.merchantDescriptor && merchantPostalCode == other.merchantPostalCode && merchantState == other.merchantState && network == other.network && networkIdentifiers == other.networkIdentifiers && pendingTransactionId == other.pendingTransactionId && presentmentCurrency == other.presentmentCurrency && reversalAmount == other.reversalAmount && reversalPresentmentAmount == other.reversalPresentmentAmount && reversalReason == other.reversalReason && terminalId == other.terminalId && type == other.type && updatedAuthorizationAmount == other.updatedAuthorizationAmount && updatedAuthorizationPresentmentAmount == other.updatedAuthorizationPresentmentAmount && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, cardAuthorizationId, currency, merchantAcceptorId, merchantCategoryCode, merchantCity, merchantCountry, merchantDescriptor, merchantPostalCode, merchantState, network, networkIdentifiers, pendingTransactionId, presentmentCurrency, reversalAmount, reversalPresentmentAmount, reversalReason, terminalId, type, updatedAuthorizationAmount, updatedAuthorizationPresentmentAmount, additionalProperties) } + /* spotless:on */ + + 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}" + } + + /** + * A Card Settlement object. This field will be present in the JSON response if and only if + * `category` is equal to `card_settlement`. Card Settlements are card transactions that + * have cleared and settled. While a settlement is usually preceded by an authorization, an + * acquirer can also directly clear a transaction without first authorizing it. + */ + class CardSettlement + private constructor( + private val id: JsonField, + private val amount: JsonField, + private val cardAuthorization: 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 pendingTransactionId: 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, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), + @JsonProperty("card_authorization") + @ExcludeMissing + cardAuthorization: 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("pending_transaction_id") + @ExcludeMissing + pendingTransactionId: 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, + cardAuthorization, + cardPaymentId, + cashback, + currency, + interchange, + merchantAcceptorId, + merchantCategoryCode, + merchantCity, + merchantCountry, + merchantName, + merchantPostalCode, + merchantState, + networkIdentifiers, + pendingTransactionId, + presentmentAmount, + presentmentCurrency, + purchaseDetails, + transactionId, + type, + mutableMapOf(), + ) + + /** + * The Card Settlement 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 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") + + /** + * The Card Authorization that was created prior to this Card Settlement, if one exists. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun cardAuthorization(): Optional = + cardAuthorization.getOptional("card_authorization") + + /** + * 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") + + /** + * Cashback earned on 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 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") + + /** + * 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 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 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") + + /** + * 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") + + /** + * 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 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") + + /** + * 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") + + /** + * 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") + + /** + * 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") + + /** + * The identifier of the Pending Transaction associated with this Transaction. + * + * @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 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") + + /** + * 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") + + /** + * 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") + + /** + * 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") + + /** + * A constant representing the object's type. For this resource it will always be + * `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 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 + + /** + * Returns the raw JSON value of [cardAuthorization]. + * + * Unlike [cardAuthorization], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("card_authorization") + @ExcludeMissing + fun _cardAuthorization(): JsonField = cardAuthorization + + /** + * 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 [cashback]. + * + * Unlike [cashback], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("cashback") + @ExcludeMissing + fun _cashback(): JsonField = cashback + + /** + * 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 [interchange]. + * + * Unlike [interchange], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("interchange") + @ExcludeMissing + fun _interchange(): JsonField = interchange + + /** + * 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 [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 [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 + + /** + * 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 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 [CardSettlement]. + * + * The following fields are required: + * ```java + * .id() + * .amount() + * .cardAuthorization() + * .cardPaymentId() + * .cashback() + * .currency() + * .interchange() + * .merchantAcceptorId() + * .merchantCategoryCode() + * .merchantCity() + * .merchantCountry() + * .merchantName() + * .merchantPostalCode() + * .merchantState() + * .networkIdentifiers() + * .pendingTransactionId() + * .presentmentAmount() + * .presentmentCurrency() + * .purchaseDetails() + * .transactionId() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [CardSettlement]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var amount: JsonField? = null + private var cardAuthorization: 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 pendingTransactionId: 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() + + @JvmSynthetic + internal fun from(cardSettlement: CardSettlement) = apply { + id = cardSettlement.id + amount = cardSettlement.amount + cardAuthorization = cardSettlement.cardAuthorization + cardPaymentId = cardSettlement.cardPaymentId + cashback = cardSettlement.cashback + currency = cardSettlement.currency + interchange = cardSettlement.interchange + merchantAcceptorId = cardSettlement.merchantAcceptorId + merchantCategoryCode = cardSettlement.merchantCategoryCode + merchantCity = cardSettlement.merchantCity + merchantCountry = cardSettlement.merchantCountry + merchantName = cardSettlement.merchantName + merchantPostalCode = cardSettlement.merchantPostalCode + merchantState = cardSettlement.merchantState + networkIdentifiers = cardSettlement.networkIdentifiers + pendingTransactionId = cardSettlement.pendingTransactionId + presentmentAmount = cardSettlement.presentmentAmount + presentmentCurrency = cardSettlement.presentmentCurrency + purchaseDetails = cardSettlement.purchaseDetails + transactionId = cardSettlement.transactionId + type = cardSettlement.type + additionalProperties = cardSettlement.additionalProperties.toMutableMap() + } + + /** The Card Settlement 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 Card Authorization that was created prior to this Card Settlement, if one + * exists. + */ + fun cardAuthorization(cardAuthorization: String?) = + cardAuthorization(JsonField.ofNullable(cardAuthorization)) + + /** + * Alias for calling [Builder.cardAuthorization] with + * `cardAuthorization.orElse(null)`. + */ + fun cardAuthorization(cardAuthorization: Optional) = + cardAuthorization(cardAuthorization.getOrNull()) + + /** + * Sets [Builder.cardAuthorization] to an arbitrary JSON value. + * + * You should usually call [Builder.cardAuthorization] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun cardAuthorization(cardAuthorization: JsonField) = apply { + this.cardAuthorization = cardAuthorization + } + + /** 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 earned on 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 identifier of the Pending Transaction associated with this Transaction. */ + fun pendingTransactionId(pendingTransactionId: String?) = + pendingTransactionId(JsonField.ofNullable(pendingTransactionId)) + + /** + * Alias for calling [Builder.pendingTransactionId] with + * `pendingTransactionId.orElse(null)`. + */ + fun pendingTransactionId(pendingTransactionId: Optional) = + pendingTransactionId(pendingTransactionId.getOrNull()) + + /** + * 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 + } + + /** 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)) + + /** + * Alias for calling [Builder.purchaseDetails] with `purchaseDetails.orElse(null)`. + */ + fun purchaseDetails(purchaseDetails: Optional) = + purchaseDetails(purchaseDetails.getOrNull()) + + /** + * 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 + } + + /** 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. + * + * 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 + } + + /** + * A constant representing the object's type. For this resource it will always be + * `card_settlement`. + */ + 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 } + + 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 [CardSettlement]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .amount() + * .cardAuthorization() + * .cardPaymentId() + * .cashback() + * .currency() + * .interchange() + * .merchantAcceptorId() + * .merchantCategoryCode() + * .merchantCity() + * .merchantCountry() + * .merchantName() + * .merchantPostalCode() + * .merchantState() + * .networkIdentifiers() + * .pendingTransactionId() + * .presentmentAmount() + * .presentmentCurrency() + * .purchaseDetails() + * .transactionId() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CardSettlement = + CardSettlement( + checkRequired("id", id), + checkRequired("amount", amount), + checkRequired("cardAuthorization", cardAuthorization), + 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("pendingTransactionId", pendingTransactionId), + checkRequired("presentmentAmount", presentmentAmount), + checkRequired("presentmentCurrency", presentmentCurrency), + checkRequired("purchaseDetails", purchaseDetails), + checkRequired("transactionId", transactionId), + checkRequired("type", type), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): CardSettlement = apply { + if (validated) { + return@apply + } + + id() + amount() + cardAuthorization() + cardPaymentId() + cashback().ifPresent { it.validate() } + currency().validate() + interchange().ifPresent { it.validate() } + merchantAcceptorId() + merchantCategoryCode() + merchantCity() + merchantCountry() + merchantName() + merchantPostalCode() + merchantState() + networkIdentifiers().validate() + pendingTransactionId() + presentmentAmount() + presentmentCurrency() + purchaseDetails().ifPresent { 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 (cardAuthorization.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 (pendingTransactionId.asKnown().isPresent) 1 else 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) + + /** + * Cashback earned on this transaction, if eligible. Cashback is paid out in aggregate, + * monthly. + */ + class Cashback + 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(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 + } + + 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) + + (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 { + + /** Canadian Dollar (CAD) */ + @JvmField val CAD = of("CAD") + + /** Swiss Franc (CHF) */ + @JvmField val CHF = of("CHF") + + /** Euro (EUR) */ + @JvmField val EUR = of("EUR") + + /** British Pound (GBP) */ + @JvmField val GBP = of("GBP") + + /** Japanese Yen (JPY) */ + @JvmField val JPY = of("JPY") + + /** 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 { + /** Canadian Dollar (CAD) */ + CAD, + /** Swiss Franc (CHF) */ + CHF, + /** Euro (EUR) */ + EUR, + /** British Pound (GBP) */ + GBP, + /** Japanese Yen (JPY) */ + JPY, + /** 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 { + /** Canadian Dollar (CAD) */ + CAD, + /** Swiss Franc (CHF) */ + CHF, + /** Euro (EUR) */ + EUR, + /** British Pound (GBP) */ + GBP, + /** Japanese Yen (JPY) */ + JPY, + /** 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) { + CAD -> Value.CAD + CHF -> Value.CHF + EUR -> Value.EUR + GBP -> Value.GBP + JPY -> Value.JPY + 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) { + CAD -> Known.CAD + CHF -> Known.CHF + EUR -> Known.EUR + GBP -> Known.GBP + JPY -> Known.JPY + 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 /* spotless:off */ other is Currency && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Cashback && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Cashback{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** + * 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 { + + /** + * 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 { + + /** Canadian Dollar (CAD) */ + @JvmField val CAD = of("CAD") + + /** Swiss Franc (CHF) */ + @JvmField val CHF = of("CHF") + + /** Euro (EUR) */ + @JvmField val EUR = of("EUR") + + /** British Pound (GBP) */ + @JvmField val GBP = of("GBP") + + /** Japanese Yen (JPY) */ + @JvmField val JPY = of("JPY") + + /** 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 { + /** Canadian Dollar (CAD) */ + CAD, + /** Swiss Franc (CHF) */ + CHF, + /** Euro (EUR) */ + EUR, + /** British Pound (GBP) */ + GBP, + /** Japanese Yen (JPY) */ + JPY, + /** 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 { + /** Canadian Dollar (CAD) */ + CAD, + /** Swiss Franc (CHF) */ + CHF, + /** Euro (EUR) */ + EUR, + /** British Pound (GBP) */ + GBP, + /** Japanese Yen (JPY) */ + JPY, + /** 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) { + CAD -> Value.CAD + CHF -> Value.CHF + EUR -> Value.EUR + GBP -> Value.GBP + JPY -> Value.JPY + 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) { + CAD -> Known.CAD + CHF -> Known.CHF + EUR -> Known.EUR + GBP -> Known.GBP + JPY -> Known.JPY + 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 /* spotless:off */ other is Currency && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Interchange assessed as a part of this transaction. */ + class Interchange + 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 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") + + /** + * 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 + * 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 [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]. + * + * 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 [Interchange]. + * + * The following fields are required: + * ```java + * .amount() + * .code() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** 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(interchange: Interchange) = apply { + amount = interchange.amount + code = interchange.code + currency = interchange.currency + additionalProperties = interchange.additionalProperties.toMutableMap() + } + + /** + * 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.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 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()) + + /** + * 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)) + + /** + * 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 [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(), + ) + } + + private var validated: Boolean = false + + fun validate(): Interchange = apply { + if (validated) { + return@apply + } + + amount() + code() + currency().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 (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 interchange + * 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 { + + /** Canadian Dollar (CAD) */ + @JvmField val CAD = of("CAD") + + /** Swiss Franc (CHF) */ + @JvmField val CHF = of("CHF") + + /** Euro (EUR) */ + @JvmField val EUR = of("EUR") + + /** British Pound (GBP) */ + @JvmField val GBP = of("GBP") + + /** Japanese Yen (JPY) */ + @JvmField val JPY = of("JPY") + + /** 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 { + /** Canadian Dollar (CAD) */ + CAD, + /** Swiss Franc (CHF) */ + CHF, + /** Euro (EUR) */ + EUR, + /** British Pound (GBP) */ + GBP, + /** Japanese Yen (JPY) */ + JPY, + /** 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 { + /** Canadian Dollar (CAD) */ + CAD, + /** Swiss Franc (CHF) */ + CHF, + /** Euro (EUR) */ + EUR, + /** British Pound (GBP) */ + GBP, + /** Japanese Yen (JPY) */ + JPY, + /** 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) { + CAD -> Value.CAD + CHF -> Value.CHF + EUR -> Value.EUR + GBP -> Value.GBP + JPY -> Value.JPY + 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) { + CAD -> Known.CAD + CHF -> Known.CHF + EUR -> Known.EUR + GBP -> Known.GBP + JPY -> Known.JPY + 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 /* spotless:off */ other is Currency && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Interchange && amount == other.amount && code == other.code && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, code, currency, additionalProperties) } + /* spotless:on */ + + 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 + private constructor( + private val acquirerBusinessId: JsonField, + private val acquirerReferenceNumber: 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("transaction_id") + @ExcludeMissing + transactionId: JsonField = JsonMissing.of(), + ) : this(acquirerBusinessId, acquirerReferenceNumber, 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") + + /** + * 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 [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() + * .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 transactionId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(networkIdentifiers: NetworkIdentifiers) = apply { + acquirerBusinessId = networkIdentifiers.acquirerBusinessId + acquirerReferenceNumber = networkIdentifiers.acquirerReferenceNumber + 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 + } + + /** + * 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() + * .transactionId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): NetworkIdentifiers = + NetworkIdentifiers( + checkRequired("acquirerBusinessId", acquirerBusinessId), + checkRequired("acquirerReferenceNumber", acquirerReferenceNumber), + checkRequired("transactionId", transactionId), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): NetworkIdentifiers = apply { + if (validated) { + return@apply + } + + acquirerBusinessId() + acquirerReferenceNumber() + 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 (transactionId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is NetworkIdentifiers && acquirerBusinessId == other.acquirerBusinessId && acquirerReferenceNumber == other.acquirerReferenceNumber && transactionId == other.transactionId && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(acquirerBusinessId, acquirerReferenceNumber, transactionId, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "NetworkIdentifiers{acquirerBusinessId=$acquirerBusinessId, acquirerReferenceNumber=$acquirerReferenceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}" + } + + /** + * Additional details about the card purchase, such as tax and industry-specific fields. */ - fun currency(): Currency = currency.getRequired("currency") + class PurchaseDetails + 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(), + ) + + /** + * 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") + + /** + * 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") + + /** + * 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 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") + + /** + * 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 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") + + /** + * 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") + + /** + * 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") + + /** + * 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") + + /** + * 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 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 + + /** + * 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 + + /** + * 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 + + /** + * 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 + + /** + * 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 + + @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)) + + /** + * Alias for [Builder.localTaxAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun localTaxAmount(localTaxAmount: Long) = + localTaxAmount(localTaxAmount as Long?) + + /** + * Alias for calling [Builder.localTaxAmount] with + * `localTaxAmount.orElse(null)`. + */ + fun localTaxAmount(localTaxAmount: Optional) = + localTaxAmount(localTaxAmount.getOrNull()) + + /** + * 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 + } + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax + * assessed. + */ + fun localTaxCurrency(localTaxCurrency: String?) = + localTaxCurrency(JsonField.ofNullable(localTaxCurrency)) + + /** + * Alias for calling [Builder.localTaxCurrency] with + * `localTaxCurrency.orElse(null)`. + */ + fun localTaxCurrency(localTaxCurrency: Optional) = + localTaxCurrency(localTaxCurrency.getOrNull()) + + /** + * 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()) - /** - * 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") + /** + * 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 } - /** - * 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") + /** Fields specific to travel. */ + fun travel(travel: Travel?) = travel(JsonField.ofNullable(travel)) - /** - * 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") + /** Alias for calling [Builder.travel] with `travel.orElse(null)`. */ + fun travel(travel: Optional) = travel(travel.getOrNull()) - /** - * 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") + /** + * 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 } - /** - * 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 additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(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 putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, 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") + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** - * 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") + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * 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 removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * The identifier of the Pending Transaction associated with this Transaction. - * - * @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") + /** + * 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(), + ) + } - /** - * 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") + private var validated: Boolean = false - /** - * 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 validate(): PurchaseDetails = apply { + if (validated) { + return@apply + } - /** - * 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") + 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 + } + + /** + * 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 car rentals. */ + class CarRental + 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" + ) + + /** + * 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") + + /** + * 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") + + /** + * 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") + + /** + * 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 + + /** + * 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 + + /** + * 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 + + /** + * 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 - /** - * 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 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 - /** - * A constant representing the object's type. For this resource it will always be - * `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 type(): Type = type.getRequired("type") + /** + * 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 - /** - * 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 [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 - /** - * 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 [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 - /** - * Returns the raw JSON value of [cardAuthorization]. - * - * Unlike [cardAuthorization], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("card_authorization") - @ExcludeMissing - fun _cardAuthorization(): JsonField = cardAuthorization + /** + * 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 - /** - * 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 [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 - /** - * 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 + /** + * 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 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 [oneWayDropOffChargesAmount]. + * + * Unlike [oneWayDropOffChargesAmount], this method doesn't throw if the JSON + * field has an unexpected type. + */ + @JsonProperty("one_way_drop_off_charges_amount") + @ExcludeMissing + fun _oneWayDropOffChargesAmount(): JsonField = oneWayDropOffChargesAmount - /** - * 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 + /** + * 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 - /** - * 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 [renterName]. + * + * Unlike [renterName], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("renter_name") + @ExcludeMissing + fun _renterName(): JsonField = renterName - /** - * 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 [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 - /** - * 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 [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 - /** - * 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 + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, 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 + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** - * 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 + fun toBuilder() = Builder().from(this) - /** - * 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 + companion object { - /** - * 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 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 [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 builder for [CarRental]. */ + class Builder internal constructor() { - /** - * 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 + 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 [presentmentCurrency]. - * - * Unlike [presentmentCurrency], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("presentment_currency") - @ExcludeMissing - fun _presentmentCurrency(): JsonField = presentmentCurrency + @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 [purchaseDetails]. - * - * Unlike [purchaseDetails], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("purchase_details") - @ExcludeMissing - fun _purchaseDetails(): JsonField = purchaseDetails + /** 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()) - /** - * 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 + /** + * 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 + } - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, 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. + */ + fun checkoutDate(checkoutDate: LocalDate?) = + checkoutDate(JsonField.ofNullable(checkoutDate)) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** + * Alias for calling [Builder.checkoutDate] with + * `checkoutDate.orElse(null)`. + */ + fun checkoutDate(checkoutDate: Optional) = + checkoutDate(checkoutDate.getOrNull()) - fun toBuilder() = Builder().from(this) + /** + * 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 + } - companion object { + /** Daily rate being charged for the vehicle. */ + fun dailyRentalRateAmount(dailyRentalRateAmount: Long?) = + dailyRentalRateAmount(JsonField.ofNullable(dailyRentalRateAmount)) - /** - * Returns a mutable builder for constructing an instance of [CardSettlement]. - * - * The following fields are required: - * ```java - * .id() - * .amount() - * .cardAuthorization() - * .cardPaymentId() - * .cashback() - * .currency() - * .interchange() - * .merchantAcceptorId() - * .merchantCategoryCode() - * .merchantCity() - * .merchantCountry() - * .merchantName() - * .merchantPostalCode() - * .merchantState() - * .networkIdentifiers() - * .pendingTransactionId() - * .presentmentAmount() - * .presentmentCurrency() - * .purchaseDetails() - * .transactionId() - * .type() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + /** + * Alias for [Builder.dailyRentalRateAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun dailyRentalRateAmount(dailyRentalRateAmount: Long) = + dailyRentalRateAmount(dailyRentalRateAmount as Long?) - /** A builder for [CardSettlement]. */ - class Builder internal constructor() { + /** + * Alias for calling [Builder.dailyRentalRateAmount] with + * `dailyRentalRateAmount.orElse(null)`. + */ + fun dailyRentalRateAmount(dailyRentalRateAmount: Optional) = + dailyRentalRateAmount(dailyRentalRateAmount.getOrNull()) - private var id: JsonField? = null - private var amount: JsonField? = null - private var cardAuthorization: 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 pendingTransactionId: 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() + /** + * 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(cardSettlement: CardSettlement) = apply { - id = cardSettlement.id - amount = cardSettlement.amount - cardAuthorization = cardSettlement.cardAuthorization - cardPaymentId = cardSettlement.cardPaymentId - cashback = cardSettlement.cashback - currency = cardSettlement.currency - interchange = cardSettlement.interchange - merchantAcceptorId = cardSettlement.merchantAcceptorId - merchantCategoryCode = cardSettlement.merchantCategoryCode - merchantCity = cardSettlement.merchantCity - merchantCountry = cardSettlement.merchantCountry - merchantName = cardSettlement.merchantName - merchantPostalCode = cardSettlement.merchantPostalCode - merchantState = cardSettlement.merchantState - networkIdentifiers = cardSettlement.networkIdentifiers - pendingTransactionId = cardSettlement.pendingTransactionId - presentmentAmount = cardSettlement.presentmentAmount - presentmentCurrency = cardSettlement.presentmentCurrency - purchaseDetails = cardSettlement.purchaseDetails - transactionId = cardSettlement.transactionId - type = cardSettlement.type - additionalProperties = cardSettlement.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)) - /** The Card Settlement identifier. */ - fun id(id: String) = id(JsonField.of(id)) + /** + * Alias for calling [Builder.dailyRentalRateCurrency] with + * `dailyRentalRateCurrency.orElse(null)`. + */ + fun dailyRentalRateCurrency(dailyRentalRateCurrency: Optional) = + dailyRentalRateCurrency(dailyRentalRateCurrency.getOrNull()) - /** - * 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 } + /** + * 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 + } - /** - * 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)) + /** Number of days the vehicle was rented. */ + fun daysRented(daysRented: Long?) = + daysRented(JsonField.ofNullable(daysRented)) - /** - * 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 } + /** + * Alias for [Builder.daysRented]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun daysRented(daysRented: Long) = daysRented(daysRented as Long?) - /** - * The Card Authorization that was created prior to this Card Settlement, if one - * exists. - */ - fun cardAuthorization(cardAuthorization: String?) = - cardAuthorization(JsonField.ofNullable(cardAuthorization)) + /** + * Alias for calling [Builder.daysRented] with `daysRented.orElse(null)`. + */ + fun daysRented(daysRented: Optional) = + daysRented(daysRented.getOrNull()) - /** - * Alias for calling [Builder.cardAuthorization] with - * `cardAuthorization.orElse(null)`. - */ - fun cardAuthorization(cardAuthorization: Optional) = - cardAuthorization(cardAuthorization.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.cardAuthorization] to an arbitrary JSON value. - * - * You should usually call [Builder.cardAuthorization] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun cardAuthorization(cardAuthorization: JsonField) = apply { - this.cardAuthorization = cardAuthorization - } + /** Additional charges (gas, late fee, etc.) being billed. */ + fun extraCharges(extraCharges: ExtraCharges?) = + extraCharges(JsonField.ofNullable(extraCharges)) - /** The ID of the Card Payment this transaction belongs to. */ - fun cardPaymentId(cardPaymentId: String) = - cardPaymentId(JsonField.of(cardPaymentId)) + /** + * Alias for calling [Builder.extraCharges] with + * `extraCharges.orElse(null)`. + */ + fun extraCharges(extraCharges: Optional) = + extraCharges(extraCharges.getOrNull()) - /** - * 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 - } + /** + * 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 + } - /** - * Cashback earned on this transaction, if eligible. Cashback is paid out in - * aggregate, monthly. - */ - fun cashback(cashback: Cashback?) = cashback(JsonField.ofNullable(cashback)) + /** Fuel charges for the vehicle. */ + fun fuelChargesAmount(fuelChargesAmount: Long?) = + fuelChargesAmount(JsonField.ofNullable(fuelChargesAmount)) - /** Alias for calling [Builder.cashback] with `cashback.orElse(null)`. */ - fun cashback(cashback: Optional) = cashback(cashback.getOrNull()) + /** + * Alias for [Builder.fuelChargesAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun fuelChargesAmount(fuelChargesAmount: Long) = + fuelChargesAmount(fuelChargesAmount as Long?) - /** - * 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 } + /** + * Alias for calling [Builder.fuelChargesAmount] with + * `fuelChargesAmount.orElse(null)`. + */ + fun fuelChargesAmount(fuelChargesAmount: Optional) = + fuelChargesAmount(fuelChargesAmount.getOrNull()) - /** - * 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.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 + } - /** - * 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fuel + * charges assessed. + */ + fun fuelChargesCurrency(fuelChargesCurrency: String?) = + fuelChargesCurrency(JsonField.ofNullable(fuelChargesCurrency)) - /** Interchange assessed as a part of this transaction. */ - fun interchange(interchange: Interchange?) = - interchange(JsonField.ofNullable(interchange)) + /** + * Alias for calling [Builder.fuelChargesCurrency] with + * `fuelChargesCurrency.orElse(null)`. + */ + fun fuelChargesCurrency(fuelChargesCurrency: Optional) = + fuelChargesCurrency(fuelChargesCurrency.getOrNull()) - /** Alias for calling [Builder.interchange] with `interchange.orElse(null)`. */ - fun interchange(interchange: Optional) = - interchange(interchange.getOrNull()) + /** + * 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 + } - /** - * 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 - } + /** Any insurance being charged for the vehicle. */ + fun insuranceChargesAmount(insuranceChargesAmount: Long?) = + insuranceChargesAmount(JsonField.ofNullable(insuranceChargesAmount)) - /** - * The merchant identifier (commonly abbreviated as MID) of the merchant the card is - * transacting with. - */ - fun merchantAcceptorId(merchantAcceptorId: String) = - merchantAcceptorId(JsonField.of(merchantAcceptorId)) + /** + * Alias for [Builder.insuranceChargesAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun insuranceChargesAmount(insuranceChargesAmount: Long) = + insuranceChargesAmount(insuranceChargesAmount as Long?) - /** - * 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.insuranceChargesAmount] with + * `insuranceChargesAmount.orElse(null)`. + */ + fun insuranceChargesAmount(insuranceChargesAmount: Optional) = + insuranceChargesAmount(insuranceChargesAmount.getOrNull()) - /** The 4-digit MCC describing the merchant's business. */ - fun merchantCategoryCode(merchantCategoryCode: String) = - merchantCategoryCode(JsonField.of(merchantCategoryCode)) + /** + * 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 + } - /** - * 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 + * insurance charges assessed. + */ + fun insuranceChargesCurrency(insuranceChargesCurrency: String?) = + insuranceChargesCurrency(JsonField.ofNullable(insuranceChargesCurrency)) - /** The city the merchant resides in. */ - fun merchantCity(merchantCity: String) = merchantCity(JsonField.of(merchantCity)) + /** + * Alias for calling [Builder.insuranceChargesCurrency] with + * `insuranceChargesCurrency.orElse(null)`. + */ + fun insuranceChargesCurrency(insuranceChargesCurrency: Optional) = + insuranceChargesCurrency(insuranceChargesCurrency.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 - } + /** + * 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 + } - /** The country the merchant resides in. */ - fun merchantCountry(merchantCountry: String) = - merchantCountry(JsonField.of(merchantCountry)) + /** + * 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)) - /** - * 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 - } + /** + * Alias for calling [Builder.noShowIndicator] with + * `noShowIndicator.orElse(null)`. + */ + fun noShowIndicator(noShowIndicator: Optional) = + noShowIndicator(noShowIndicator.getOrNull()) - /** The name of the merchant. */ - fun merchantName(merchantName: String) = merchantName(JsonField.of(merchantName)) + /** + * 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 + } - /** - * 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 - } + /** + * Charges for returning the vehicle at a different location than where it + * was picked up. + */ + fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Long?) = + oneWayDropOffChargesAmount( + JsonField.ofNullable(oneWayDropOffChargesAmount) + ) - /** - * 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 [Builder.oneWayDropOffChargesAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Long) = + oneWayDropOffChargesAmount(oneWayDropOffChargesAmount as Long?) - /** - * Alias for calling [Builder.merchantPostalCode] with - * `merchantPostalCode.orElse(null)`. - */ - fun merchantPostalCode(merchantPostalCode: Optional) = - merchantPostalCode(merchantPostalCode.getOrNull()) + /** + * Alias for calling [Builder.oneWayDropOffChargesAmount] with + * `oneWayDropOffChargesAmount.orElse(null)`. + */ + fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Optional) = + oneWayDropOffChargesAmount(oneWayDropOffChargesAmount.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 - } + /** + * 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 the merchant resides in. */ - fun merchantState(merchantState: String?) = - merchantState(JsonField.ofNullable(merchantState)) + /** + * 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) + ) - /** Alias for calling [Builder.merchantState] with `merchantState.orElse(null)`. */ - fun merchantState(merchantState: Optional) = - merchantState(merchantState.getOrNull()) + /** + * Alias for calling [Builder.oneWayDropOffChargesCurrency] with + * `oneWayDropOffChargesCurrency.orElse(null)`. + */ + fun oneWayDropOffChargesCurrency( + oneWayDropOffChargesCurrency: Optional + ) = oneWayDropOffChargesCurrency(oneWayDropOffChargesCurrency.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 - } + /** + * 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 + } - /** Network-specific identifiers for this refund. */ - fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) = - networkIdentifiers(JsonField.of(networkIdentifiers)) + /** Name of the person renting the vehicle. */ + fun renterName(renterName: String?) = + renterName(JsonField.ofNullable(renterName)) - /** - * 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 - } + /** + * Alias for calling [Builder.renterName] with `renterName.orElse(null)`. + */ + fun renterName(renterName: Optional) = + renterName(renterName.getOrNull()) - /** The identifier of the Pending Transaction associated with this Transaction. */ - fun pendingTransactionId(pendingTransactionId: String?) = - pendingTransactionId(JsonField.ofNullable(pendingTransactionId)) + /** + * 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 + } - /** - * Alias for calling [Builder.pendingTransactionId] with - * `pendingTransactionId.orElse(null)`. - */ - fun pendingTransactionId(pendingTransactionId: Optional) = - pendingTransactionId(pendingTransactionId.getOrNull()) + /** Weekly rate being charged for the vehicle. */ + fun weeklyRentalRateAmount(weeklyRentalRateAmount: Long?) = + weeklyRentalRateAmount(JsonField.ofNullable(weeklyRentalRateAmount)) - /** - * 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 - } + /** + * Alias for [Builder.weeklyRentalRateAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun weeklyRentalRateAmount(weeklyRentalRateAmount: Long) = + weeklyRentalRateAmount(weeklyRentalRateAmount as Long?) - /** The amount in the minor unit of the transaction's presentment currency. */ - fun presentmentAmount(presentmentAmount: Long) = - presentmentAmount(JsonField.of(presentmentAmount)) + /** + * Alias for calling [Builder.weeklyRentalRateAmount] with + * `weeklyRentalRateAmount.orElse(null)`. + */ + fun weeklyRentalRateAmount(weeklyRentalRateAmount: Optional) = + weeklyRentalRateAmount(weeklyRentalRateAmount.getOrNull()) - /** - * 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 - } + /** + * 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 + } - /** - * 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)) + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * weekly rental rate. + */ + fun weeklyRentalRateCurrency(weeklyRentalRateCurrency: String?) = + weeklyRentalRateCurrency(JsonField.ofNullable(weeklyRentalRateCurrency)) - /** - * 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 - } + /** + * Alias for calling [Builder.weeklyRentalRateCurrency] with + * `weeklyRentalRateCurrency.orElse(null)`. + */ + fun weeklyRentalRateCurrency(weeklyRentalRateCurrency: Optional) = + weeklyRentalRateCurrency(weeklyRentalRateCurrency.getOrNull()) - /** - * Additional details about the card purchase, such as tax and industry-specific - * fields. - */ - fun purchaseDetails(purchaseDetails: PurchaseDetails?) = - purchaseDetails(JsonField.ofNullable(purchaseDetails)) + /** + * 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 + } - /** - * Alias for calling [Builder.purchaseDetails] with `purchaseDetails.orElse(null)`. - */ - fun purchaseDetails(purchaseDetails: Optional) = - purchaseDetails(purchaseDetails.getOrNull()) + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * 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 - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** The identifier of the Transaction associated with this Transaction. */ - fun transactionId(transactionId: String) = - transactionId(JsonField.of(transactionId)) + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } - /** - * 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 removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * A constant representing the object's type. For this resource it will always be - * `card_settlement`. - */ - fun type(type: Type) = type(JsonField.of(type)) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * 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 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(), + ) + } - 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(): CarRental = apply { + if (validated) { + return@apply + } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + 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 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. + * + * Used for best match union deserialization. + */ + @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) - /** - * Returns an immutable instance of [CardSettlement]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .amount() - * .cardAuthorization() - * .cardPaymentId() - * .cashback() - * .currency() - * .interchange() - * .merchantAcceptorId() - * .merchantCategoryCode() - * .merchantCity() - * .merchantCountry() - * .merchantName() - * .merchantPostalCode() - * .merchantState() - * .networkIdentifiers() - * .pendingTransactionId() - * .presentmentAmount() - * .presentmentCurrency() - * .purchaseDetails() - * .transactionId() - * .type() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CardSettlement = - CardSettlement( - checkRequired("id", id), - checkRequired("amount", amount), - checkRequired("cardAuthorization", cardAuthorization), - 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("pendingTransactionId", pendingTransactionId), - checkRequired("presentmentAmount", presentmentAmount), - checkRequired("presentmentCurrency", presentmentCurrency), - checkRequired("purchaseDetails", purchaseDetails), - checkRequired("transactionId", transactionId), - checkRequired("type", type), - additionalProperties.toMutableMap(), - ) - } + /** Additional charges (gas, late fee, etc.) being billed. */ + class ExtraCharges + @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(): CardSettlement = apply { - if (validated) { - return@apply - } + companion object { - id() - amount() - cardAuthorization() - cardPaymentId() - cashback().ifPresent { it.validate() } - currency().validate() - interchange().ifPresent { it.validate() } - merchantAcceptorId() - merchantCategoryCode() - merchantCity() - merchantCountry() - merchantName() - merchantPostalCode() - merchantState() - networkIdentifiers().validate() - pendingTransactionId() - presentmentAmount() - presentmentCurrency() - purchaseDetails().ifPresent { it.validate() } - transactionId() - type().validate() - validated = true - } + /** No extra charge */ + @JvmField val NO_EXTRA_CHARGE = of("no_extra_charge") - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** Gas */ + @JvmField val GAS = of("gas") - /** - * 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 (cardAuthorization.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 (pendingTransactionId.asKnown().isPresent) 1 else 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) + /** Extra mileage */ + @JvmField val EXTRA_MILEAGE = of("extra_mileage") - /** - * Cashback earned on this transaction, if eligible. Cashback is paid out in aggregate, - * monthly. - */ - class Cashback - private constructor( - private val amount: JsonField, - private val currency: JsonField, - private val additionalProperties: MutableMap, - ) { + /** Late return */ + @JvmField val LATE_RETURN = of("late_return") - @JsonCreator - private constructor( - @JsonProperty("amount") - @ExcludeMissing - amount: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - currency: JsonField = JsonMissing.of(), - ) : this(amount, currency, mutableMapOf()) + /** One way service fee */ + @JvmField val ONE_WAY_SERVICE_FEE = of("one_way_service_fee") - /** - * 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") + /** 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, + } - /** - * 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 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 + } - /** - * 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 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 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 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(): ExtraCharges = 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 [Cashback]. - * - * The following fields are required: - * ```java - * .amount() - * .currency() - * ``` - */ - @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 [Cashback]. */ - class Builder internal constructor() { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - private var amount: JsonField? = null - private var currency: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + return /* spotless:off */ other is ExtraCharges && value == other.value /* spotless:on */ + } - @JvmSynthetic - internal fun from(cashback: Cashback) = apply { - amount = cashback.amount - currency = cashback.currency - additionalProperties = cashback.additionalProperties.toMutableMap() + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } /** - * 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). + * An indicator that the cardholder is being billed for a reserved vehicle that + * was not actually rented (that is, a "no-show" charge). */ - fun amount(amount: String) = amount(JsonField.of(amount)) + class NoShowIndicator + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** - * 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 } + /** + * 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 cashback. - */ - 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 } + /** Not applicable */ + @JvmField val NOT_APPLICABLE = of("not_applicable") - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** No show for specialized vehicle */ + @JvmField + val NO_SHOW_FOR_SPECIALIZED_VEHICLE = + of("no_show_for_specialized_vehicle") - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + @JvmStatic fun of(value: String) = NoShowIndicator(JsonField.of(value)) + } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(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 removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** + * 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 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) { + NOT_APPLICABLE -> Value.NOT_APPLICABLE + NO_SHOW_FOR_SPECIALIZED_VEHICLE -> + Value.NO_SHOW_FOR_SPECIALIZED_VEHICLE + else -> Value._UNKNOWN + } - /** - * 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(), - ) - } + /** + * 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" + ) + } - 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(): Cashback = apply { - if (validated) { - return@apply - } + private var validated: Boolean = false - amount() - currency().validate() - validated = true - } + fun validate(): NoShowIndicator = 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 (amount.asKnown().isPresent) 1 else 0) + - (currency.asKnown().getOrNull()?.validity() ?: 0) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** 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 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 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 /* spotless:off */ other is NoShowIndicator && value == other.value /* spotless:on */ + } - /** Canadian Dollar (CAD) */ - @JvmField val CAD = of("CAD") + override fun hashCode() = value.hashCode() - /** Swiss Franc (CHF) */ - @JvmField val CHF = of("CHF") + override fun toString() = value.toString() + } - /** Euro (EUR) */ - @JvmField val EUR = of("EUR") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** British Pound (GBP) */ - @JvmField val GBP = of("GBP") + return /* spotless:off */ 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 /* spotless:on */ + } - /** Japanese Yen (JPY) */ - @JvmField val JPY = of("JPY") + /* spotless:off */ + 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) } + /* spotless:on */ - /** US Dollar (USD) */ - @JvmField val USD = of("USD") + override fun hashCode(): Int = hashCode - @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) - } + 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}" + } - /** An enum containing [Currency]'s known values. */ - enum class Known { - /** Canadian Dollar (CAD) */ - CAD, - /** Swiss Franc (CHF) */ - CHF, - /** Euro (EUR) */ - EUR, - /** British Pound (GBP) */ - GBP, - /** Japanese Yen (JPY) */ - JPY, - /** US Dollar (USD) */ - USD, - } + /** Fields specific to lodging. */ + class Lodging + 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") + @ExcludeMissing + folioCashAdvancesAmount: JsonField = JsonMissing.of(), + @JsonProperty("folio_cash_advances_currency") + @ExcludeMissing + folioCashAdvancesCurrency: JsonField = JsonMissing.of(), + @JsonProperty("food_beverage_charges_amount") + @ExcludeMissing + foodBeverageChargesAmount: JsonField = JsonMissing.of(), + @JsonProperty("food_beverage_charges_currency") + @ExcludeMissing + foodBeverageChargesCurrency: 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") + @ExcludeMissing + 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( + checkInDate, + dailyRoomRateAmount, + dailyRoomRateCurrency, + extraCharges, + folioCashAdvancesAmount, + folioCashAdvancesCurrency, + foodBeverageChargesAmount, + foodBeverageChargesCurrency, + noShowIndicator, + prepaidExpensesAmount, + prepaidExpensesCurrency, + roomNights, + totalRoomTaxAmount, + totalRoomTaxCurrency, + totalTaxAmount, + totalTaxCurrency, + 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") /** - * An enum containing [Currency]'s known values, as well as an [_UNKNOWN] - * member. + * Daily rate being charged for the room. * - * 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 { - /** Canadian Dollar (CAD) */ - CAD, - /** Swiss Franc (CHF) */ - CHF, - /** Euro (EUR) */ - EUR, - /** British Pound (GBP) */ - GBP, - /** Japanese Yen (JPY) */ - JPY, - /** US Dollar (USD) */ - USD, - /** - * An enum member indicating that [Currency] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } + fun dailyRoomRateAmount(): Optional = + dailyRoomRateAmount.getOptional("daily_room_rate_amount") /** - * 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 daily + * room rate. * - * 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) { - CAD -> Value.CAD - CHF -> Value.CHF - EUR -> Value.EUR - GBP -> Value.GBP - JPY -> Value.JPY - USD -> Value.USD - else -> Value._UNKNOWN - } + fun dailyRoomRateCurrency(): Optional = + dailyRoomRateCurrency.getOptional("daily_room_rate_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. + * Additional charges (phone, late check-out, etc.) being billed. * - * @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) { - CAD -> Known.CAD - CHF -> Known.CHF - EUR -> Known.EUR - GBP -> Known.GBP - JPY -> Known.JPY - USD -> Known.USD - else -> throw IncreaseInvalidDataException("Unknown Currency: $value") - } + fun extraCharges(): Optional = + extraCharges.getOptional("extra_charges") /** - * 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. + * Folio cash advances for the room. * - * @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(): Currency = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + fun folioCashAdvancesAmount(): Optional = + folioCashAdvancesAmount.getOptional("folio_cash_advances_amount") /** - * Returns a score indicating how many valid values are contained in this object - * recursively. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the folio + * cash advances. * - * 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 /* spotless:off */ other is Currency && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Cashback && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Cashback{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" - } - - /** - * 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 { - - /** - * 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 { - - /** Canadian Dollar (CAD) */ - @JvmField val CAD = of("CAD") - - /** Swiss Franc (CHF) */ - @JvmField val CHF = of("CHF") - - /** Euro (EUR) */ - @JvmField val EUR = of("EUR") - - /** British Pound (GBP) */ - @JvmField val GBP = of("GBP") - - /** Japanese Yen (JPY) */ - @JvmField val JPY = of("JPY") - - /** 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 { - /** Canadian Dollar (CAD) */ - CAD, - /** Swiss Franc (CHF) */ - CHF, - /** Euro (EUR) */ - EUR, - /** British Pound (GBP) */ - GBP, - /** Japanese Yen (JPY) */ - JPY, - /** US Dollar (USD) */ - USD, - } + fun folioCashAdvancesCurrency(): Optional = + folioCashAdvancesCurrency.getOptional("folio_cash_advances_currency") - /** - * 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 { - /** Canadian Dollar (CAD) */ - CAD, - /** Swiss Franc (CHF) */ - CHF, - /** Euro (EUR) */ - EUR, - /** British Pound (GBP) */ - GBP, - /** Japanese Yen (JPY) */ - JPY, - /** US Dollar (USD) */ - USD, /** - * An enum member indicating that [Currency] was instantiated with an unknown - * value. + * 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). */ - _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) { - CAD -> Value.CAD - CHF -> Value.CHF - EUR -> Value.EUR - GBP -> Value.GBP - JPY -> Value.JPY - 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) { - CAD -> Known.CAD - CHF -> Known.CHF - EUR -> Known.EUR - GBP -> Known.GBP - JPY -> Known.JPY - 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 foodBeverageChargesAmount(): Optional = + foodBeverageChargesAmount.getOptional("food_beverage_charges_amount") - fun validate(): Currency = apply { - if (validated) { - return@apply - } + /** + * 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 foodBeverageChargesCurrency(): Optional = + foodBeverageChargesCurrency.getOptional("food_beverage_charges_currency") - known() - validated = true - } + /** + * 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 noShowIndicator(): Optional = + noShowIndicator.getOptional("no_show_indicator") - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * 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 prepaidExpensesAmount(): Optional = + prepaidExpensesAmount.getOptional("prepaid_expenses_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 + /** + * 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 prepaidExpensesCurrency(): Optional = + prepaidExpensesCurrency.getOptional("prepaid_expenses_currency") - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * 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 roomNights(): Optional = roomNights.getOptional("room_nights") - return /* spotless:off */ other is Currency && value == other.value /* spotless:on */ - } + /** + * 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 totalRoomTaxAmount(): Optional = + totalRoomTaxAmount.getOptional("total_room_tax_amount") - override fun hashCode() = value.hashCode() + /** + * 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") - override fun toString() = value.toString() - } + /** + * 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") - /** Interchange assessed as a part of this transaction. */ - class Interchange - private constructor( - private val amount: JsonField, - private val code: JsonField, - private val currency: JsonField, - private val additionalProperties: MutableMap, - ) { + /** + * 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") - @JsonCreator - private constructor( - @JsonProperty("amount") - @ExcludeMissing - amount: JsonField = JsonMissing.of(), - @JsonProperty("code") - @ExcludeMissing - code: JsonField = JsonMissing.of(), - @JsonProperty("currency") + /** + * Returns the raw JSON value of [checkInDate]. + * + * Unlike [checkInDate], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("check_in_date") @ExcludeMissing - currency: JsonField = JsonMissing.of(), - ) : this(amount, code, currency, mutableMapOf()) - - /** - * 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") - - /** - * 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 - * 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 [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]. - * - * Unlike [currency], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("currency") - @ExcludeMissing - fun _currency(): JsonField = currency + fun _checkInDate(): JsonField = checkInDate - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** + * Returns the raw JSON value of [dailyRoomRateAmount]. + * + * Unlike [dailyRoomRateAmount], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("daily_room_rate_amount") + @ExcludeMissing + fun _dailyRoomRateAmount(): JsonField = dailyRoomRateAmount - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** + * Returns the raw JSON value of [dailyRoomRateCurrency]. + * + * Unlike [dailyRoomRateCurrency], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("daily_room_rate_currency") + @ExcludeMissing + fun _dailyRoomRateCurrency(): JsonField = dailyRoomRateCurrency - fun toBuilder() = Builder().from(this) + /** + * 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 - companion object { + /** + * 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 a mutable builder for constructing an instance of [Interchange]. + * Returns the raw JSON value of [folioCashAdvancesCurrency]. * - * The following fields are required: - * ```java - * .amount() - * .code() - * .currency() - * ``` + * Unlike [folioCashAdvancesCurrency], this method doesn't throw if the JSON + * field has an unexpected type. */ - @JvmStatic fun builder() = Builder() - } + @JsonProperty("folio_cash_advances_currency") + @ExcludeMissing + fun _folioCashAdvancesCurrency(): JsonField = folioCashAdvancesCurrency - /** A builder for [Interchange]. */ - class Builder internal constructor() { + /** + * 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") + @ExcludeMissing + fun _foodBeverageChargesAmount(): JsonField = foodBeverageChargesAmount - private var amount: JsonField? = null - private var code: JsonField? = null - private var currency: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** + * Returns the raw JSON value of [foodBeverageChargesCurrency]. + * + * Unlike [foodBeverageChargesCurrency], this method doesn't throw if the JSON + * field has an unexpected type. + */ + @JsonProperty("food_beverage_charges_currency") + @ExcludeMissing + fun _foodBeverageChargesCurrency(): JsonField = + foodBeverageChargesCurrency - @JvmSynthetic - internal fun from(interchange: Interchange) = apply { - amount = interchange.amount - code = interchange.code - currency = interchange.currency - additionalProperties = interchange.additionalProperties.toMutableMap() - } + /** + * 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 /** - * 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 [prepaidExpensesAmount]. + * + * Unlike [prepaidExpensesAmount], this method doesn't throw if the JSON field + * has an unexpected type. */ - fun amount(amount: String) = amount(JsonField.of(amount)) + @JsonProperty("prepaid_expenses_amount") + @ExcludeMissing + fun _prepaidExpensesAmount(): JsonField = prepaidExpensesAmount /** - * Sets [Builder.amount] to an arbitrary JSON value. + * Returns the raw JSON value of [prepaidExpensesCurrency]. * - * 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. + * Unlike [prepaidExpensesCurrency], this method doesn't throw if the JSON field + * has an unexpected type. */ - fun amount(amount: JsonField) = apply { this.amount = amount } + @JsonProperty("prepaid_expenses_currency") + @ExcludeMissing + fun _prepaidExpensesCurrency(): JsonField = prepaidExpensesCurrency - /** The card network specific interchange code. */ - fun code(code: String?) = code(JsonField.ofNullable(code)) + /** + * Returns the raw JSON value of [roomNights]. + * + * Unlike [roomNights], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("room_nights") + @ExcludeMissing + fun _roomNights(): JsonField = roomNights - /** Alias for calling [Builder.code] with `code.orElse(null)`. */ - fun code(code: Optional) = code(code.getOrNull()) + /** + * 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") + @ExcludeMissing + fun _totalRoomTaxAmount(): JsonField = totalRoomTaxAmount /** - * Sets [Builder.code] to an arbitrary JSON value. + * Returns the raw JSON value of [totalRoomTaxCurrency]. * - * 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. + * Unlike [totalRoomTaxCurrency], this method doesn't throw if the JSON field + * has an unexpected type. */ - fun code(code: JsonField) = apply { this.code = code } + @JsonProperty("total_room_tax_currency") + @ExcludeMissing + fun _totalRoomTaxCurrency(): JsonField = totalRoomTaxCurrency /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - * interchange reimbursement. + * Returns the raw JSON value of [totalTaxAmount]. + * + * Unlike [totalTaxAmount], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun currency(currency: Currency) = currency(JsonField.of(currency)) + @JsonProperty("total_tax_amount") + @ExcludeMissing + fun _totalTaxAmount(): JsonField = totalTaxAmount /** - * Sets [Builder.currency] to an arbitrary JSON value. + * Returns the raw JSON value of [totalTaxCurrency]. * - * 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. + * Unlike [totalTaxCurrency], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun currency(currency: JsonField) = apply { this.currency = currency } + @JsonProperty("total_tax_currency") + @ExcludeMissing + fun _totalTaxCurrency(): JsonField = totalTaxCurrency - 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 toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Lodging]. + * + * The following fields are required: + * ```java + * .checkInDate() + * .dailyRoomRateAmount() + * .dailyRoomRateCurrency() + * .extraCharges() + * .folioCashAdvancesAmount() + * .folioCashAdvancesCurrency() + * .foodBeverageChargesAmount() + * .foodBeverageChargesCurrency() + * .noShowIndicator() + * .prepaidExpensesAmount() + * .prepaidExpensesCurrency() + * .roomNights() + * .totalRoomTaxAmount() + * .totalRoomTaxCurrency() + * .totalTaxAmount() + * .totalTaxCurrency() + * ``` + */ + @JvmStatic fun builder() = Builder() } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + /** A builder for [Lodging]. */ + 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 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() } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** Date the customer checked in. */ + fun checkInDate(checkInDate: LocalDate?) = + checkInDate(JsonField.ofNullable(checkInDate)) - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** + * Alias for calling [Builder.checkInDate] with `checkInDate.orElse(null)`. + */ + fun checkInDate(checkInDate: Optional) = + checkInDate(checkInDate.getOrNull()) - /** - * 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(), - ) - } + /** + * 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 + } - private var validated: Boolean = false + /** Daily rate being charged for the room. */ + fun dailyRoomRateAmount(dailyRoomRateAmount: Long?) = + dailyRoomRateAmount(JsonField.ofNullable(dailyRoomRateAmount)) - fun validate(): Interchange = apply { - if (validated) { - return@apply - } + /** + * Alias for [Builder.dailyRoomRateAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun dailyRoomRateAmount(dailyRoomRateAmount: Long) = + dailyRoomRateAmount(dailyRoomRateAmount as Long?) - amount() - code() - currency().validate() - validated = true - } + /** + * Alias for calling [Builder.dailyRoomRateAmount] with + * `dailyRoomRateAmount.orElse(null)`. + */ + fun dailyRoomRateAmount(dailyRoomRateAmount: Optional) = + dailyRoomRateAmount(dailyRoomRateAmount.getOrNull()) - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * 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 + } - /** - * 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 (code.asKnown().isPresent) 1 else 0) + - (currency.asKnown().getOrNull()?.validity() ?: 0) + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily + * room rate. + */ + fun dailyRoomRateCurrency(dailyRoomRateCurrency: String?) = + dailyRoomRateCurrency(JsonField.ofNullable(dailyRoomRateCurrency)) - /** - * 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 { + /** + * Alias for calling [Builder.dailyRoomRateCurrency] with + * `dailyRoomRateCurrency.orElse(null)`. + */ + fun dailyRoomRateCurrency(dailyRoomRateCurrency: Optional) = + dailyRoomRateCurrency(dailyRoomRateCurrency.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.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 + } - companion object { + /** Additional charges (phone, late check-out, etc.) being billed. */ + fun extraCharges(extraCharges: ExtraCharges?) = + extraCharges(JsonField.ofNullable(extraCharges)) - /** Canadian Dollar (CAD) */ - @JvmField val CAD = of("CAD") + /** + * Alias for calling [Builder.extraCharges] with + * `extraCharges.orElse(null)`. + */ + fun extraCharges(extraCharges: Optional) = + extraCharges(extraCharges.getOrNull()) - /** Swiss Franc (CHF) */ - @JvmField val CHF = of("CHF") + /** + * 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 + } - /** Euro (EUR) */ - @JvmField val EUR = of("EUR") + /** Folio cash advances for the room. */ + fun folioCashAdvancesAmount(folioCashAdvancesAmount: Long?) = + folioCashAdvancesAmount(JsonField.ofNullable(folioCashAdvancesAmount)) - /** British Pound (GBP) */ - @JvmField val GBP = of("GBP") + /** + * Alias for [Builder.folioCashAdvancesAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun folioCashAdvancesAmount(folioCashAdvancesAmount: Long) = + folioCashAdvancesAmount(folioCashAdvancesAmount as Long?) - /** Japanese Yen (JPY) */ - @JvmField val JPY = of("JPY") + /** + * Alias for calling [Builder.folioCashAdvancesAmount] with + * `folioCashAdvancesAmount.orElse(null)`. + */ + fun folioCashAdvancesAmount(folioCashAdvancesAmount: Optional) = + folioCashAdvancesAmount(folioCashAdvancesAmount.getOrNull()) - /** US Dollar (USD) */ - @JvmField val USD = of("USD") + /** + * Sets [Builder.folioCashAdvancesAmount] 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. + */ + fun folioCashAdvancesAmount(folioCashAdvancesAmount: JsonField) = + apply { + this.folioCashAdvancesAmount = folioCashAdvancesAmount + } - @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) - } + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the folio + * cash advances. + */ + fun folioCashAdvancesCurrency(folioCashAdvancesCurrency: String?) = + folioCashAdvancesCurrency( + JsonField.ofNullable(folioCashAdvancesCurrency) + ) - /** An enum containing [Currency]'s known values. */ - enum class Known { - /** Canadian Dollar (CAD) */ - CAD, - /** Swiss Franc (CHF) */ - CHF, - /** Euro (EUR) */ - EUR, - /** British Pound (GBP) */ - GBP, - /** Japanese Yen (JPY) */ - JPY, - /** US Dollar (USD) */ - USD, - } + /** + * Alias for calling [Builder.folioCashAdvancesCurrency] with + * `folioCashAdvancesCurrency.orElse(null)`. + */ + fun folioCashAdvancesCurrency(folioCashAdvancesCurrency: Optional) = + folioCashAdvancesCurrency(folioCashAdvancesCurrency.getOrNull()) + + /** + * Sets [Builder.folioCashAdvancesCurrency] 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. + */ + fun folioCashAdvancesCurrency( + folioCashAdvancesCurrency: JsonField + ) = apply { this.folioCashAdvancesCurrency = folioCashAdvancesCurrency } + + /** Food and beverage charges for the room. */ + fun foodBeverageChargesAmount(foodBeverageChargesAmount: Long?) = + foodBeverageChargesAmount( + JsonField.ofNullable(foodBeverageChargesAmount) + ) + + /** + * Alias for [Builder.foodBeverageChargesAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun foodBeverageChargesAmount(foodBeverageChargesAmount: Long) = + foodBeverageChargesAmount(foodBeverageChargesAmount as Long?) + + /** + * Alias for calling [Builder.foodBeverageChargesAmount] with + * `foodBeverageChargesAmount.orElse(null)`. + */ + fun foodBeverageChargesAmount(foodBeverageChargesAmount: Optional) = + foodBeverageChargesAmount(foodBeverageChargesAmount.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 { - /** Canadian Dollar (CAD) */ - CAD, - /** Swiss Franc (CHF) */ - CHF, - /** Euro (EUR) */ - EUR, - /** British Pound (GBP) */ - GBP, - /** Japanese Yen (JPY) */ - JPY, - /** US Dollar (USD) */ - USD, /** - * An enum member indicating that [Currency] was instantiated with an - * unknown value. + * Sets [Builder.foodBeverageChargesAmount] 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. */ - _UNKNOWN, - } + fun foodBeverageChargesAmount(foodBeverageChargesAmount: JsonField) = + apply { + this.foodBeverageChargesAmount = foodBeverageChargesAmount + } - /** - * 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) { - CAD -> Value.CAD - CHF -> Value.CHF - EUR -> Value.EUR - GBP -> Value.GBP - JPY -> Value.JPY - USD -> Value.USD - else -> Value._UNKNOWN - } + /** + * 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) + ) - /** - * 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) { - CAD -> Known.CAD - CHF -> Known.CHF - EUR -> Known.EUR - GBP -> Known.GBP - JPY -> Known.JPY - USD -> Known.USD - else -> throw IncreaseInvalidDataException("Unknown Currency: $value") - } + /** + * Alias for calling [Builder.foodBeverageChargesCurrency] with + * `foodBeverageChargesCurrency.orElse(null)`. + */ + fun foodBeverageChargesCurrency( + foodBeverageChargesCurrency: Optional + ) = foodBeverageChargesCurrency(foodBeverageChargesCurrency.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.foodBeverageChargesCurrency] to an arbitrary JSON 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 foodBeverageChargesCurrency( + foodBeverageChargesCurrency: JsonField + ) = apply { this.foodBeverageChargesCurrency = foodBeverageChargesCurrency } - private var validated: Boolean = false + /** + * Indicator that the cardholder is being billed for a reserved room that + * was not actually used. + */ + fun noShowIndicator(noShowIndicator: NoShowIndicator?) = + noShowIndicator(JsonField.ofNullable(noShowIndicator)) - fun validate(): Currency = apply { - if (validated) { - return@apply + /** + * Alias for calling [Builder.noShowIndicator] with + * `noShowIndicator.orElse(null)`. + */ + fun noShowIndicator(noShowIndicator: Optional) = + noShowIndicator(noShowIndicator.getOrNull()) + + /** + * 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 } - known() - validated = true - } + /** Prepaid expenses being charged for the room. */ + fun prepaidExpensesAmount(prepaidExpensesAmount: Long?) = + prepaidExpensesAmount(JsonField.ofNullable(prepaidExpensesAmount)) - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * Alias for [Builder.prepaidExpensesAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun prepaidExpensesAmount(prepaidExpensesAmount: Long) = + prepaidExpensesAmount(prepaidExpensesAmount as Long?) - /** - * 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.prepaidExpensesAmount] with + * `prepaidExpensesAmount.orElse(null)`. + */ + fun prepaidExpensesAmount(prepaidExpensesAmount: Optional) = + prepaidExpensesAmount(prepaidExpensesAmount.getOrNull()) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * Sets [Builder.prepaidExpensesAmount] 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. + */ + fun prepaidExpensesAmount(prepaidExpensesAmount: JsonField) = apply { + this.prepaidExpensesAmount = prepaidExpensesAmount } - return /* spotless:off */ other is Currency && value == other.value /* spotless:on */ - } + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * prepaid expenses. + */ + fun prepaidExpensesCurrency(prepaidExpensesCurrency: String?) = + prepaidExpensesCurrency(JsonField.ofNullable(prepaidExpensesCurrency)) - override fun hashCode() = value.hashCode() + /** + * Alias for calling [Builder.prepaidExpensesCurrency] with + * `prepaidExpensesCurrency.orElse(null)`. + */ + fun prepaidExpensesCurrency(prepaidExpensesCurrency: Optional) = + prepaidExpensesCurrency(prepaidExpensesCurrency.getOrNull()) - override fun toString() = value.toString() - } + /** + * Sets [Builder.prepaidExpensesCurrency] 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. + */ + fun prepaidExpensesCurrency(prepaidExpensesCurrency: JsonField) = + apply { + this.prepaidExpensesCurrency = prepaidExpensesCurrency + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** Number of nights the room was rented. */ + fun roomNights(roomNights: Long?) = + roomNights(JsonField.ofNullable(roomNights)) - return /* spotless:off */ other is Interchange && amount == other.amount && code == other.code && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * Alias for [Builder.roomNights]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun roomNights(roomNights: Long) = roomNights(roomNights as Long?) - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, code, currency, additionalProperties) } - /* spotless:on */ + /** + * Alias for calling [Builder.roomNights] with `roomNights.orElse(null)`. + */ + fun roomNights(roomNights: Optional) = + roomNights(roomNights.getOrNull()) - override fun hashCode(): Int = hashCode + /** + * 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 + } - override fun toString() = - "Interchange{amount=$amount, code=$code, currency=$currency, additionalProperties=$additionalProperties}" - } + /** Total room tax being charged. */ + fun totalRoomTaxAmount(totalRoomTaxAmount: Long?) = + totalRoomTaxAmount(JsonField.ofNullable(totalRoomTaxAmount)) - /** Network-specific identifiers for this refund. */ - class NetworkIdentifiers - private constructor( - private val acquirerBusinessId: JsonField, - private val acquirerReferenceNumber: JsonField, - private val transactionId: JsonField, - private val additionalProperties: MutableMap, - ) { + /** + * Alias for [Builder.totalRoomTaxAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun totalRoomTaxAmount(totalRoomTaxAmount: Long) = + totalRoomTaxAmount(totalRoomTaxAmount as Long?) - @JsonCreator - private constructor( - @JsonProperty("acquirer_business_id") - @ExcludeMissing - acquirerBusinessId: JsonField = JsonMissing.of(), - @JsonProperty("acquirer_reference_number") - @ExcludeMissing - acquirerReferenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("transaction_id") - @ExcludeMissing - transactionId: JsonField = JsonMissing.of(), - ) : this(acquirerBusinessId, acquirerReferenceNumber, transactionId, mutableMapOf()) + /** + * Alias for calling [Builder.totalRoomTaxAmount] with + * `totalRoomTaxAmount.orElse(null)`. + */ + fun totalRoomTaxAmount(totalRoomTaxAmount: Optional) = + totalRoomTaxAmount(totalRoomTaxAmount.getOrNull()) - /** - * 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") + /** + * 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 + } - /** - * 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total + * room tax. + */ + fun totalRoomTaxCurrency(totalRoomTaxCurrency: String?) = + totalRoomTaxCurrency(JsonField.ofNullable(totalRoomTaxCurrency)) - /** - * 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") + /** + * Alias for calling [Builder.totalRoomTaxCurrency] with + * `totalRoomTaxCurrency.orElse(null)`. + */ + fun totalRoomTaxCurrency(totalRoomTaxCurrency: Optional) = + totalRoomTaxCurrency(totalRoomTaxCurrency.getOrNull()) - /** - * 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 + /** + * 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 + } - /** - * 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 + /** Total tax being charged for the room. */ + fun totalTaxAmount(totalTaxAmount: Long?) = + totalTaxAmount(JsonField.ofNullable(totalTaxAmount)) - /** - * 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 [Builder.totalTaxAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun totalTaxAmount(totalTaxAmount: Long) = + totalTaxAmount(totalTaxAmount as Long?) - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** + * Alias for calling [Builder.totalTaxAmount] with + * `totalTaxAmount.orElse(null)`. + */ + fun totalTaxAmount(totalTaxAmount: Optional) = + totalTaxAmount(totalTaxAmount.getOrNull()) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** + * 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 + } - fun toBuilder() = Builder().from(this) + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total + * tax assessed. + */ + fun totalTaxCurrency(totalTaxCurrency: String?) = + totalTaxCurrency(JsonField.ofNullable(totalTaxCurrency)) - companion object { + /** + * Alias for calling [Builder.totalTaxCurrency] with + * `totalTaxCurrency.orElse(null)`. + */ + fun totalTaxCurrency(totalTaxCurrency: Optional) = + totalTaxCurrency(totalTaxCurrency.getOrNull()) - /** - * Returns a mutable builder for constructing an instance of - * [NetworkIdentifiers]. - * - * The following fields are required: - * ```java - * .acquirerBusinessId() - * .acquirerReferenceNumber() - * .transactionId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + /** + * 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 + } - /** A builder for [NetworkIdentifiers]. */ - class Builder internal constructor() { + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - private var acquirerBusinessId: JsonField? = null - private var acquirerReferenceNumber: JsonField? = null - private var transactionId: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - @JvmSynthetic - internal fun from(networkIdentifiers: NetworkIdentifiers) = apply { - acquirerBusinessId = networkIdentifiers.acquirerBusinessId - acquirerReferenceNumber = networkIdentifiers.acquirerReferenceNumber - transactionId = networkIdentifiers.transactionId - additionalProperties = - networkIdentifiers.additionalProperties.toMutableMap() - } + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } - /** - * A network assigned business ID that identifies the acquirer that processed - * this transaction. - */ - fun acquirerBusinessId(acquirerBusinessId: String) = - acquirerBusinessId(JsonField.of(acquirerBusinessId)) + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * 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 + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * 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(), + ) } - /** A globally unique identifier for this settlement. */ - fun acquirerReferenceNumber(acquirerReferenceNumber: String) = - acquirerReferenceNumber(JsonField.of(acquirerReferenceNumber)) + private var validated: Boolean = false - /** - * 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 + fun validate(): Lodging = apply { + if (validated) { + return@apply } - /** - * 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) + checkInDate() + dailyRoomRateAmount() + dailyRoomRateCurrency() + extraCharges().ifPresent { it.validate() } + folioCashAdvancesAmount() + folioCashAdvancesCurrency() + foodBeverageChargesAmount() + foodBeverageChargesCurrency() + noShowIndicator().ifPresent { it.validate() } + prepaidExpensesAmount() + prepaidExpensesCurrency() + roomNights() + totalRoomTaxAmount() + totalRoomTaxCurrency() + totalTaxAmount() + totalTaxCurrency() + validated = true } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false } - 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() - * .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("acquirerBusinessId", acquirerBusinessId), - checkRequired("acquirerReferenceNumber", acquirerReferenceNumber), - checkRequired("transactionId", transactionId), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): NetworkIdentifiers = apply { - if (validated) { - return@apply - } - - acquirerBusinessId() - acquirerReferenceNumber() - 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 (transactionId.asKnown().isPresent) 1 else 0) + @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) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** Additional charges (phone, late check-out, etc.) being billed. */ + class ExtraCharges + @JsonCreator + private constructor(private val value: JsonField) : Enum { - return /* spotless:off */ other is NetworkIdentifiers && acquirerBusinessId == other.acquirerBusinessId && acquirerReferenceNumber == other.acquirerReferenceNumber && transactionId == other.transactionId && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * 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 - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(acquirerBusinessId, acquirerReferenceNumber, transactionId, additionalProperties) } - /* spotless:on */ + companion object { - override fun hashCode(): Int = hashCode + /** No extra charge */ + @JvmField val NO_EXTRA_CHARGE = of("no_extra_charge") - override fun toString() = - "NetworkIdentifiers{acquirerBusinessId=$acquirerBusinessId, acquirerReferenceNumber=$acquirerReferenceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}" - } + /** Restaurant */ + @JvmField val RESTAURANT = of("restaurant") - /** - * Additional details about the card purchase, such as tax and industry-specific fields. - */ - class PurchaseDetails - 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, - ) { + /** Gift shop */ + @JvmField val GIFT_SHOP = of("gift_shop") - @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(), - ) + /** Mini bar */ + @JvmField val MINI_BAR = of("mini_bar") - /** - * 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") + /** Telephone */ + @JvmField val TELEPHONE = of("telephone") - /** - * 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") + /** Other */ + @JvmField val OTHER = of("other") - /** - * 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") + /** Laundry */ + @JvmField val LAUNDRY = of("laundry") - /** - * 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") + @JvmStatic fun of(value: String) = ExtraCharges(JsonField.of(value)) + } - /** - * 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") + /** 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, + } - /** - * 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") + /** + * 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, + /** + * An enum member indicating that [ExtraCharges] was instantiated with + * an unknown value. + */ + _UNKNOWN, + } - /** - * 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") + /** + * 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 + } - /** - * 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") + /** + * 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" + ) + } - /** - * 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") + /** + * 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") + } - /** - * 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") + private var validated: Boolean = false - /** - * 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 + fun validate(): ExtraCharges = apply { + if (validated) { + return@apply + } - /** - * 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 + known() + validated = true + } - /** - * 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 + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * 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 + /** + * 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 [lodging]. - * - * Unlike [lodging], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("lodging") - @ExcludeMissing - fun _lodging(): JsonField = lodging + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * 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 + return /* spotless:off */ other is ExtraCharges && value == other.value /* spotless:on */ + } - /** - * 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 + override fun hashCode() = value.hashCode() - /** - * 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 + override fun toString() = value.toString() + } - /** - * 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 + /** + * 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 { - /** - * 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 + /** + * 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) + /** Not applicable */ + @JvmField val NOT_APPLICABLE = of("not_applicable") - fun toBuilder() = Builder().from(this) + /** No show */ + @JvmField val NO_SHOW = of("no_show") - companion object { + @JvmStatic fun of(value: String) = NoShowIndicator(JsonField.of(value)) + } - /** - * 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() - } + /** An enum containing [NoShowIndicator]'s known values. */ + enum class Known { + /** Not applicable */ + NOT_APPLICABLE, + /** No show */ + NO_SHOW, + } - /** A builder for [PurchaseDetails]. */ - class Builder internal constructor() { + /** + * 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. + */ + _UNKNOWN, + } - 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 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 + } - @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() - } + /** + * 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" + ) + } - /** Fields specific to car rentals. */ - fun carRental(carRental: CarRental?) = - carRental(JsonField.ofNullable(carRental)) + /** + * 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.carRental] with `carRental.orElse(null)`. */ - fun carRental(carRental: Optional) = carRental(carRental.getOrNull()) + private var validated: Boolean = false - /** - * 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 - } + fun validate(): NoShowIndicator = apply { + if (validated) { + return@apply + } - /** An identifier from the merchant for the customer or consumer. */ - fun customerReferenceIdentifier(customerReferenceIdentifier: String?) = - customerReferenceIdentifier( - JsonField.ofNullable(customerReferenceIdentifier) - ) + known() + validated = true + } - /** - * Alias for calling [Builder.customerReferenceIdentifier] with - * `customerReferenceIdentifier.orElse(null)`. - */ - fun customerReferenceIdentifier(customerReferenceIdentifier: Optional) = - customerReferenceIdentifier(customerReferenceIdentifier.getOrNull()) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + 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 } + /** + * 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 state or provincial tax amount in minor units. */ - fun localTaxAmount(localTaxAmount: Long?) = - localTaxAmount(JsonField.ofNullable(localTaxAmount)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Alias for [Builder.localTaxAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun localTaxAmount(localTaxAmount: Long) = - localTaxAmount(localTaxAmount as Long?) + return /* spotless:off */ other is NoShowIndicator && value == other.value /* spotless:on */ + } - /** - * Alias for calling [Builder.localTaxAmount] with - * `localTaxAmount.orElse(null)`. - */ - fun localTaxAmount(localTaxAmount: Optional) = - localTaxAmount(localTaxAmount.getOrNull()) + override fun hashCode() = value.hashCode() - /** - * 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 toString() = value.toString() } - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax - * assessed. - */ - fun localTaxCurrency(localTaxCurrency: String?) = - localTaxCurrency(JsonField.ofNullable(localTaxCurrency)) - - /** - * Alias for calling [Builder.localTaxCurrency] with - * `localTaxCurrency.orElse(null)`. - */ - fun localTaxCurrency(localTaxCurrency: Optional) = - localTaxCurrency(localTaxCurrency.getOrNull()) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * 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 + return /* spotless:off */ 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 /* spotless:on */ } - /** Fields specific to lodging. */ - fun lodging(lodging: Lodging?) = lodging(JsonField.ofNullable(lodging)) + /* spotless:off */ + 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) } + /* spotless:on */ - /** Alias for calling [Builder.lodging] with `lodging.orElse(null)`. */ - fun lodging(lodging: Optional) = lodging(lodging.getOrNull()) + override fun hashCode(): Int = hashCode - /** - * 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 } + 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}" + } - /** The national tax amount in minor units. */ - fun nationalTaxAmount(nationalTaxAmount: Long?) = - nationalTaxAmount(JsonField.ofNullable(nationalTaxAmount)) + /** The format of the purchase identifier. */ + class PurchaseIdentifierFormat + @JsonCreator + private constructor(private val value: JsonField) : Enum { /** - * Alias for [Builder.nationalTaxAmount]. + * Returns this class instance's raw value. * - * This unboxed primitive overload exists for backwards compatibility. + * 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 nationalTaxAmount(nationalTaxAmount: Long) = - nationalTaxAmount(nationalTaxAmount as Long?) + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** - * Alias for calling [Builder.nationalTaxAmount] with - * `nationalTaxAmount.orElse(null)`. - */ - fun nationalTaxAmount(nationalTaxAmount: Optional) = - nationalTaxAmount(nationalTaxAmount.getOrNull()) + companion object { - /** - * 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 - } + /** Free text */ + @JvmField val FREE_TEXT = of("free_text") - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax - * assessed. - */ - fun nationalTaxCurrency(nationalTaxCurrency: String?) = - nationalTaxCurrency(JsonField.ofNullable(nationalTaxCurrency)) + /** Order number */ + @JvmField val ORDER_NUMBER = of("order_number") - /** - * Alias for calling [Builder.nationalTaxCurrency] with - * `nationalTaxCurrency.orElse(null)`. - */ - fun nationalTaxCurrency(nationalTaxCurrency: Optional) = - nationalTaxCurrency(nationalTaxCurrency.getOrNull()) + /** Rental agreement number */ + @JvmField val RENTAL_AGREEMENT_NUMBER = of("rental_agreement_number") - /** - * 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 - } + /** Hotel folio number */ + @JvmField val HOTEL_FOLIO_NUMBER = of("hotel_folio_number") - /** - * An identifier from the merchant for the purchase to the issuer and - * cardholder. - */ - fun purchaseIdentifier(purchaseIdentifier: String?) = - purchaseIdentifier(JsonField.ofNullable(purchaseIdentifier)) + /** Invoice number */ + @JvmField val INVOICE_NUMBER = of("invoice_number") - /** - * Alias for calling [Builder.purchaseIdentifier] with - * `purchaseIdentifier.orElse(null)`. - */ - fun purchaseIdentifier(purchaseIdentifier: Optional) = - purchaseIdentifier(purchaseIdentifier.getOrNull()) + @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, + } /** - * Sets [Builder.purchaseIdentifier] to an arbitrary JSON value. + * An enum containing [PurchaseIdentifierFormat]'s known values, as well as an + * [_UNKNOWN] member. * - * 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. + * 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. */ - fun purchaseIdentifier(purchaseIdentifier: JsonField) = apply { - this.purchaseIdentifier = purchaseIdentifier + 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, } - /** The format of the purchase identifier. */ - fun purchaseIdentifierFormat( - purchaseIdentifierFormat: PurchaseIdentifierFormat? - ) = purchaseIdentifierFormat(JsonField.ofNullable(purchaseIdentifierFormat)) - /** - * Alias for calling [Builder.purchaseIdentifierFormat] with - * `purchaseIdentifierFormat.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 purchaseIdentifierFormat( - purchaseIdentifierFormat: Optional - ) = purchaseIdentifierFormat(purchaseIdentifierFormat.getOrNull()) + 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 + } /** - * Sets [Builder.purchaseIdentifierFormat] to an arbitrary JSON 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. * - * 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. + * @throws IncreaseInvalidDataException if this class instance's value is a not + * a known member. */ - 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()) + 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" + ) + } /** - * Sets [Builder.travel] to an arbitrary JSON value. + * Returns this class instance's primitive wire representation. * - * 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. + * 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 travel(travel: JsonField) = apply { this.travel = travel } - - 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(): PurchaseIdentifierFormat = 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 [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() - * ``` + * 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(): 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(), - ) - } + @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(): PurchaseDetails = apply { - if (validated) { - return@apply + return /* spotless:off */ other is PurchaseIdentifierFormat && value == other.value /* spotless:on */ } - 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() = 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 = - (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() = value.toString() + } - /** Fields specific to car rentals. */ - class CarRental + /** Fields specific to travel. */ + class Travel 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 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("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") + @JsonProperty("ancillary") @ExcludeMissing - daysRented: JsonField = JsonMissing.of(), - @JsonProperty("extra_charges") + ancillary: JsonField = JsonMissing.of(), + @JsonProperty("computerized_reservation_system") @ExcludeMissing - extraCharges: JsonField = JsonMissing.of(), - @JsonProperty("fuel_charges_amount") + computerizedReservationSystem: JsonField = JsonMissing.of(), + @JsonProperty("credit_reason_indicator") @ExcludeMissing - fuelChargesAmount: JsonField = JsonMissing.of(), - @JsonProperty("fuel_charges_currency") + creditReasonIndicator: JsonField = JsonMissing.of(), + @JsonProperty("departure_date") @ExcludeMissing - fuelChargesCurrency: JsonField = JsonMissing.of(), - @JsonProperty("insurance_charges_amount") + departureDate: JsonField = JsonMissing.of(), + @JsonProperty("origination_city_airport_code") @ExcludeMissing - insuranceChargesAmount: JsonField = JsonMissing.of(), - @JsonProperty("insurance_charges_currency") + originationCityAirportCode: JsonField = JsonMissing.of(), + @JsonProperty("passenger_name") @ExcludeMissing - insuranceChargesCurrency: JsonField = JsonMissing.of(), - @JsonProperty("no_show_indicator") + passengerName: JsonField = JsonMissing.of(), + @JsonProperty("restricted_ticket_indicator") @ExcludeMissing - noShowIndicator: JsonField = JsonMissing.of(), - @JsonProperty("one_way_drop_off_charges_amount") + restrictedTicketIndicator: JsonField = + JsonMissing.of(), + @JsonProperty("ticket_change_indicator") @ExcludeMissing - oneWayDropOffChargesAmount: JsonField = JsonMissing.of(), - @JsonProperty("one_way_drop_off_charges_currency") + ticketChangeIndicator: JsonField = JsonMissing.of(), + @JsonProperty("ticket_number") @ExcludeMissing - oneWayDropOffChargesCurrency: JsonField = JsonMissing.of(), - @JsonProperty("renter_name") + ticketNumber: JsonField = JsonMissing.of(), + @JsonProperty("travel_agency_code") @ExcludeMissing - renterName: JsonField = JsonMissing.of(), - @JsonProperty("weekly_rental_rate_amount") + travelAgencyCode: JsonField = JsonMissing.of(), + @JsonProperty("travel_agency_name") @ExcludeMissing - weeklyRentalRateAmount: JsonField = JsonMissing.of(), - @JsonProperty("weekly_rental_rate_currency") + travelAgencyName: JsonField = JsonMissing.of(), + @JsonProperty("trip_legs") @ExcludeMissing - weeklyRentalRateCurrency: JsonField = JsonMissing.of(), + tripLegs: JsonField> = JsonMissing.of(), ) : this( - carClassCode, - checkoutDate, - dailyRentalRateAmount, - dailyRentalRateCurrency, - daysRented, - extraCharges, - fuelChargesAmount, - fuelChargesCurrency, - insuranceChargesAmount, - insuranceChargesCurrency, - noShowIndicator, - oneWayDropOffChargesAmount, - oneWayDropOffChargesCurrency, - renterName, - weeklyRentalRateAmount, - weeklyRentalRateCurrency, + ancillary, + computerizedReservationSystem, + creditReasonIndicator, + departureDate, + originationCityAirportCode, + passengerName, + restrictedTicketIndicator, + ticketChangeIndicator, + ticketNumber, + travelAgencyCode, + travelAgencyName, + tripLegs, 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. + * 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 daysRented(): Optional = daysRented.getOptional("days_rented") + fun ancillary(): Optional = ancillary.getOptional("ancillary") /** - * Additional charges (gas, late fee, etc.) being billed. + * 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 extraCharges(): Optional = - extraCharges.getOptional("extra_charges") + fun computerizedReservationSystem(): Optional = + computerizedReservationSystem.getOptional("computerized_reservation_system") /** - * Fuel charges for the vehicle. + * 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 fuelChargesAmount(): Optional = - fuelChargesAmount.getOptional("fuel_charges_amount") + fun creditReasonIndicator(): Optional = + creditReasonIndicator.getOptional("credit_reason_indicator") /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fuel - * charges assessed. + * Date of departure. * * @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 departureDate(): Optional = + departureDate.getOptional("departure_date") /** - * Any insurance being charged for the vehicle. + * 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 insuranceChargesAmount(): Optional = - insuranceChargesAmount.getOptional("insurance_charges_amount") + fun originationCityAirportCode(): Optional = + originationCityAirportCode.getOptional("origination_city_airport_code") /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the insurance - * charges assessed. + * 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 insuranceChargesCurrency(): Optional = - insuranceChargesCurrency.getOptional("insurance_charges_currency") + fun passengerName(): Optional = + passengerName.getOptional("passenger_name") /** - * An indicator that the cardholder is being billed for a reserved vehicle that - * was not actually rented (that is, a "no-show" charge). + * 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 noShowIndicator(): Optional = - noShowIndicator.getOptional("no_show_indicator") + fun restrictedTicketIndicator(): Optional = + restrictedTicketIndicator.getOptional("restricted_ticket_indicator") /** - * Charges for returning the vehicle at a different location than where it was - * picked up. + * 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 oneWayDropOffChargesAmount(): Optional = - oneWayDropOffChargesAmount.getOptional("one_way_drop_off_charges_amount") + fun ticketChangeIndicator(): Optional = + ticketChangeIndicator.getOptional("ticket_change_indicator") /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the one-way - * drop-off charges assessed. + * Ticket number. * * @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 ticketNumber(): Optional = ticketNumber.getOptional("ticket_number") /** - * Name of the person renting the vehicle. + * 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 renterName(): Optional = renterName.getOptional("renter_name") + fun travelAgencyCode(): Optional = + travelAgencyCode.getOptional("travel_agency_code") /** - * Weekly rate being charged for the vehicle. + * 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 weeklyRentalRateAmount(): Optional = - weeklyRentalRateAmount.getOptional("weekly_rental_rate_amount") + fun travelAgencyName(): Optional = + travelAgencyName.getOptional("travel_agency_name") /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the weekly - * rental rate. + * 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 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 tripLegs(): Optional> = tripLegs.getOptional("trip_legs") /** - * Returns the raw JSON value of [checkoutDate]. + * Returns the raw JSON value of [ancillary]. * - * Unlike [checkoutDate], 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("checkout_date") + @JsonProperty("ancillary") @ExcludeMissing - fun _checkoutDate(): JsonField = checkoutDate + fun _ancillary(): JsonField = ancillary /** - * Returns the raw JSON value of [dailyRentalRateAmount]. + * Returns the raw JSON value of [computerizedReservationSystem]. * - * Unlike [dailyRentalRateAmount], 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_rental_rate_amount") + @JsonProperty("computerized_reservation_system") @ExcludeMissing - fun _dailyRentalRateAmount(): JsonField = dailyRentalRateAmount + fun _computerizedReservationSystem(): JsonField = + computerizedReservationSystem /** - * Returns the raw JSON value of [dailyRentalRateCurrency]. + * Returns the raw JSON value of [creditReasonIndicator]. * - * Unlike [dailyRentalRateCurrency], 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_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("credit_reason_indicator") @ExcludeMissing - fun _daysRented(): JsonField = daysRented + 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 [fuelChargesAmount]. - * - * Unlike [fuelChargesAmount], this method doesn't throw if the JSON field has - * an unexpected type. - */ - @JsonProperty("fuel_charges_amount") + @JsonProperty("departure_date") @ExcludeMissing - fun _fuelChargesAmount(): JsonField = fuelChargesAmount + fun _departureDate(): JsonField = departureDate /** - * Returns the raw JSON value of [fuelChargesCurrency]. + * Returns the raw JSON value of [originationCityAirportCode]. * - * Unlike [fuelChargesCurrency], this method doesn't throw if the JSON field has - * an unexpected type. + * Unlike [originationCityAirportCode], this method doesn't throw if the JSON + * field has an unexpected type. */ - @JsonProperty("fuel_charges_currency") + @JsonProperty("origination_city_airport_code") @ExcludeMissing - fun _fuelChargesCurrency(): JsonField = fuelChargesCurrency + fun _originationCityAirportCode(): JsonField = + originationCityAirportCode /** - * Returns the raw JSON value of [insuranceChargesAmount]. + * Returns the raw JSON value of [passengerName]. * - * Unlike [insuranceChargesAmount], this method doesn't throw if the JSON field - * has an unexpected type. + * Unlike [passengerName], this method doesn't throw if the JSON field has an + * unexpected type. */ - @JsonProperty("insurance_charges_amount") + @JsonProperty("passenger_name") @ExcludeMissing - fun _insuranceChargesAmount(): JsonField = insuranceChargesAmount + fun _passengerName(): JsonField = passengerName /** - * Returns the raw JSON value of [insuranceChargesCurrency]. + * Returns the raw JSON value of [restrictedTicketIndicator]. * - * Unlike [insuranceChargesCurrency], this method doesn't throw if the JSON + * Unlike [restrictedTicketIndicator], this method doesn't throw if the JSON * field has an unexpected type. */ - @JsonProperty("insurance_charges_currency") - @ExcludeMissing - fun _insuranceChargesCurrency(): JsonField = insuranceChargesCurrency - - /** - * 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") + @JsonProperty("restricted_ticket_indicator") @ExcludeMissing - fun _noShowIndicator(): JsonField = noShowIndicator + fun _restrictedTicketIndicator(): JsonField = + restrictedTicketIndicator /** - * Returns the raw JSON value of [oneWayDropOffChargesAmount]. + * Returns the raw JSON value of [ticketChangeIndicator]. * - * Unlike [oneWayDropOffChargesAmount], this method doesn't throw if the JSON - * field has an unexpected type. + * Unlike [ticketChangeIndicator], this method doesn't throw if the JSON field + * has an unexpected type. */ - @JsonProperty("one_way_drop_off_charges_amount") + @JsonProperty("ticket_change_indicator") @ExcludeMissing - fun _oneWayDropOffChargesAmount(): JsonField = oneWayDropOffChargesAmount + fun _ticketChangeIndicator(): JsonField = + ticketChangeIndicator /** - * Returns the raw JSON value of [oneWayDropOffChargesCurrency]. + * Returns the raw JSON value of [ticketNumber]. * - * Unlike [oneWayDropOffChargesCurrency], this method doesn't throw if the JSON - * field has an unexpected type. + * Unlike [ticketNumber], this method doesn't throw if the JSON field has an + * unexpected type. */ - @JsonProperty("one_way_drop_off_charges_currency") + @JsonProperty("ticket_number") @ExcludeMissing - fun _oneWayDropOffChargesCurrency(): JsonField = - oneWayDropOffChargesCurrency + fun _ticketNumber(): JsonField = ticketNumber /** - * Returns the raw JSON value of [renterName]. + * Returns the raw JSON value of [travelAgencyCode]. * - * Unlike [renterName], this method doesn't throw if the JSON field has an + * Unlike [travelAgencyCode], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("renter_name") + @JsonProperty("travel_agency_code") @ExcludeMissing - fun _renterName(): JsonField = renterName + fun _travelAgencyCode(): JsonField = travelAgencyCode /** - * Returns the raw JSON value of [weeklyRentalRateAmount]. + * Returns the raw JSON value of [travelAgencyName]. * - * Unlike [weeklyRentalRateAmount], this method doesn't throw if the JSON field - * has an unexpected type. + * Unlike [travelAgencyName], this method doesn't throw if the JSON field has an + * unexpected type. */ - @JsonProperty("weekly_rental_rate_amount") + @JsonProperty("travel_agency_name") @ExcludeMissing - fun _weeklyRentalRateAmount(): JsonField = weeklyRentalRateAmount + fun _travelAgencyName(): JsonField = travelAgencyName /** - * Returns the raw JSON value of [weeklyRentalRateCurrency]. + * Returns the raw JSON value of [tripLegs]. * - * Unlike [weeklyRentalRateCurrency], this method doesn't throw if the JSON - * field has an unexpected type. + * Unlike [tripLegs], this method doesn't throw if the JSON field has an + * unexpected type. */ - @JsonProperty("weekly_rental_rate_currency") + @JsonProperty("trip_legs") @ExcludeMissing - fun _weeklyRentalRateCurrency(): JsonField = weeklyRentalRateCurrency + fun _tripLegs(): JsonField> = tripLegs @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -33445,506 +44185,356 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [CarRental]. + * Returns a mutable builder for constructing an instance of [Travel]. * * The following fields are required: * ```java - * .carClassCode() - * .checkoutDate() - * .dailyRentalRateAmount() - * .dailyRentalRateCurrency() - * .daysRented() - * .extraCharges() - * .fuelChargesAmount() - * .fuelChargesCurrency() - * .insuranceChargesAmount() - * .insuranceChargesCurrency() - * .noShowIndicator() - * .oneWayDropOffChargesAmount() - * .oneWayDropOffChargesCurrency() - * .renterName() - * .weeklyRentalRateAmount() - * .weeklyRentalRateCurrency() + * .ancillary() + * .computerizedReservationSystem() + * .creditReasonIndicator() + * .departureDate() + * .originationCityAirportCode() + * .passengerName() + * .restrictedTicketIndicator() + * .ticketChangeIndicator() + * .ticketNumber() + * .travelAgencyCode() + * .travelAgencyName() + * .tripLegs() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [CarRental]. */ + /** A builder for [Travel]. */ 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 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 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(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() + 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() } - /** Code indicating the vehicle's class. */ - fun carClassCode(carClassCode: String?) = - carClassCode(JsonField.ofNullable(carClassCode)) + /** Ancillary purchases in addition to the airfare. */ + fun ancillary(ancillary: Ancillary?) = + ancillary(JsonField.ofNullable(ancillary)) - /** - * Alias for calling [Builder.carClassCode] with - * `carClassCode.orElse(null)`. - */ - fun carClassCode(carClassCode: Optional) = - carClassCode(carClassCode.getOrNull()) + /** Alias for calling [Builder.ancillary] with `ancillary.orElse(null)`. */ + fun ancillary(ancillary: Optional) = + ancillary(ancillary.getOrNull()) /** - * Sets [Builder.carClassCode] to an arbitrary JSON value. + * Sets [Builder.ancillary] to an arbitrary JSON value. * - * You should usually call [Builder.carClassCode] with a well-typed [String] + * 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 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 checkoutDate(checkoutDate: JsonField) = apply { - this.checkoutDate = checkoutDate - } - - /** 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?) - - /** - * Alias for calling [Builder.dailyRentalRateAmount] with - * `dailyRentalRateAmount.orElse(null)`. - */ - fun dailyRentalRateAmount(dailyRentalRateAmount: Optional) = - dailyRentalRateAmount(dailyRentalRateAmount.getOrNull()) - - /** - * 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 + fun ancillary(ancillary: JsonField) = apply { + this.ancillary = ancillary } /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily - * rental rate. + * Indicates the computerized reservation system used to book the ticket. */ - fun dailyRentalRateCurrency(dailyRentalRateCurrency: String?) = - dailyRentalRateCurrency(JsonField.ofNullable(dailyRentalRateCurrency)) + fun computerizedReservationSystem(computerizedReservationSystem: String?) = + computerizedReservationSystem( + JsonField.ofNullable(computerizedReservationSystem) + ) /** - * Alias for calling [Builder.dailyRentalRateCurrency] with - * `dailyRentalRateCurrency.orElse(null)`. + * Alias for calling [Builder.computerizedReservationSystem] with + * `computerizedReservationSystem.orElse(null)`. */ - fun dailyRentalRateCurrency(dailyRentalRateCurrency: Optional) = - dailyRentalRateCurrency(dailyRentalRateCurrency.getOrNull()) + fun computerizedReservationSystem( + computerizedReservationSystem: Optional + ) = computerizedReservationSystem(computerizedReservationSystem.getOrNull()) /** - * Sets [Builder.dailyRentalRateCurrency] to an arbitrary JSON value. + * Sets [Builder.computerizedReservationSystem] to an arbitrary JSON value. * - * You should usually call [Builder.dailyRentalRateCurrency] with a + * 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 dailyRentalRateCurrency(dailyRentalRateCurrency: JsonField) = - apply { - this.dailyRentalRateCurrency = dailyRentalRateCurrency - } - - /** 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)) - - /** - * Alias for calling [Builder.extraCharges] with - * `extraCharges.orElse(null)`. - */ - fun extraCharges(extraCharges: Optional) = - extraCharges(extraCharges.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 + fun computerizedReservationSystem( + computerizedReservationSystem: JsonField + ) = apply { + this.computerizedReservationSystem = computerizedReservationSystem } - /** Fuel charges for the vehicle. */ - fun fuelChargesAmount(fuelChargesAmount: Long?) = - fuelChargesAmount(JsonField.ofNullable(fuelChargesAmount)) - - /** - * Alias for [Builder.fuelChargesAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun fuelChargesAmount(fuelChargesAmount: Long) = - fuelChargesAmount(fuelChargesAmount as Long?) + /** Indicates the reason for a credit to the cardholder. */ + fun creditReasonIndicator(creditReasonIndicator: CreditReasonIndicator?) = + creditReasonIndicator(JsonField.ofNullable(creditReasonIndicator)) /** - * Alias for calling [Builder.fuelChargesAmount] with - * `fuelChargesAmount.orElse(null)`. + * Alias for calling [Builder.creditReasonIndicator] with + * `creditReasonIndicator.orElse(null)`. */ - fun fuelChargesAmount(fuelChargesAmount: Optional) = - fuelChargesAmount(fuelChargesAmount.getOrNull()) + fun creditReasonIndicator( + creditReasonIndicator: Optional + ) = creditReasonIndicator(creditReasonIndicator.getOrNull()) /** - * Sets [Builder.fuelChargesAmount] to an arbitrary JSON value. + * Sets [Builder.creditReasonIndicator] 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.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 fuelChargesAmount(fuelChargesAmount: JsonField) = apply { - this.fuelChargesAmount = fuelChargesAmount - } + fun creditReasonIndicator( + creditReasonIndicator: JsonField + ) = apply { this.creditReasonIndicator = creditReasonIndicator } - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fuel - * charges assessed. - */ - fun fuelChargesCurrency(fuelChargesCurrency: String?) = - fuelChargesCurrency(JsonField.ofNullable(fuelChargesCurrency)) + /** Date of departure. */ + fun departureDate(departureDate: LocalDate?) = + departureDate(JsonField.ofNullable(departureDate)) /** - * Alias for calling [Builder.fuelChargesCurrency] with - * `fuelChargesCurrency.orElse(null)`. + * Alias for calling [Builder.departureDate] with + * `departureDate.orElse(null)`. */ - fun fuelChargesCurrency(fuelChargesCurrency: Optional) = - fuelChargesCurrency(fuelChargesCurrency.getOrNull()) + fun departureDate(departureDate: Optional) = + departureDate(departureDate.getOrNull()) /** - * Sets [Builder.fuelChargesCurrency] to an arbitrary JSON value. + * Sets [Builder.departureDate] 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.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 fuelChargesCurrency(fuelChargesCurrency: JsonField) = apply { - this.fuelChargesCurrency = fuelChargesCurrency + fun departureDate(departureDate: JsonField) = apply { + this.departureDate = departureDate } - /** Any insurance being charged for the vehicle. */ - fun insuranceChargesAmount(insuranceChargesAmount: Long?) = - insuranceChargesAmount(JsonField.ofNullable(insuranceChargesAmount)) - - /** - * Alias for [Builder.insuranceChargesAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun insuranceChargesAmount(insuranceChargesAmount: Long) = - insuranceChargesAmount(insuranceChargesAmount as Long?) - - /** - * Alias for calling [Builder.insuranceChargesAmount] with - * `insuranceChargesAmount.orElse(null)`. - */ - fun insuranceChargesAmount(insuranceChargesAmount: Optional) = - insuranceChargesAmount(insuranceChargesAmount.getOrNull()) - - /** - * 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 - } - - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - * insurance charges assessed. - */ - fun insuranceChargesCurrency(insuranceChargesCurrency: String?) = - insuranceChargesCurrency(JsonField.ofNullable(insuranceChargesCurrency)) + /** Code for the originating city or airport. */ + fun originationCityAirportCode(originationCityAirportCode: String?) = + originationCityAirportCode( + JsonField.ofNullable(originationCityAirportCode) + ) /** - * Alias for calling [Builder.insuranceChargesCurrency] with - * `insuranceChargesCurrency.orElse(null)`. + * Alias for calling [Builder.originationCityAirportCode] with + * `originationCityAirportCode.orElse(null)`. */ - fun insuranceChargesCurrency(insuranceChargesCurrency: Optional) = - insuranceChargesCurrency(insuranceChargesCurrency.getOrNull()) + fun originationCityAirportCode( + originationCityAirportCode: Optional + ) = originationCityAirportCode(originationCityAirportCode.getOrNull()) /** - * Sets [Builder.insuranceChargesCurrency] to an arbitrary JSON value. + * Sets [Builder.originationCityAirportCode] to an arbitrary JSON value. * - * You should usually call [Builder.insuranceChargesCurrency] 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 insuranceChargesCurrency(insuranceChargesCurrency: JsonField) = - apply { - this.insuranceChargesCurrency = insuranceChargesCurrency - } + fun originationCityAirportCode( + originationCityAirportCode: JsonField + ) = apply { this.originationCityAirportCode = originationCityAirportCode } - /** - * 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)) + /** 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 } - /** - * Charges for returning the vehicle at a different location than where it - * was picked up. - */ - fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Long?) = - oneWayDropOffChargesAmount( - JsonField.ofNullable(oneWayDropOffChargesAmount) + /** Indicates whether this ticket is non-refundable. */ + fun restrictedTicketIndicator( + restrictedTicketIndicator: RestrictedTicketIndicator? + ) = + restrictedTicketIndicator( + JsonField.ofNullable(restrictedTicketIndicator) ) /** - * Alias for [Builder.oneWayDropOffChargesAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Long) = - oneWayDropOffChargesAmount(oneWayDropOffChargesAmount as Long?) - - /** - * Alias for calling [Builder.oneWayDropOffChargesAmount] with - * `oneWayDropOffChargesAmount.orElse(null)`. + * Alias for calling [Builder.restrictedTicketIndicator] with + * `restrictedTicketIndicator.orElse(null)`. */ - fun oneWayDropOffChargesAmount(oneWayDropOffChargesAmount: Optional) = - oneWayDropOffChargesAmount(oneWayDropOffChargesAmount.getOrNull()) + fun restrictedTicketIndicator( + restrictedTicketIndicator: Optional + ) = restrictedTicketIndicator(restrictedTicketIndicator.getOrNull()) /** - * Sets [Builder.oneWayDropOffChargesAmount] to an arbitrary JSON value. + * Sets [Builder.restrictedTicketIndicator] 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.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 oneWayDropOffChargesAmount( - oneWayDropOffChargesAmount: JsonField - ) = apply { this.oneWayDropOffChargesAmount = oneWayDropOffChargesAmount } + fun restrictedTicketIndicator( + restrictedTicketIndicator: JsonField + ) = apply { this.restrictedTicketIndicator = restrictedTicketIndicator } - /** - * 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) - ) + /** Indicates why a ticket was changed. */ + fun ticketChangeIndicator(ticketChangeIndicator: TicketChangeIndicator?) = + ticketChangeIndicator(JsonField.ofNullable(ticketChangeIndicator)) /** - * Alias for calling [Builder.oneWayDropOffChargesCurrency] with - * `oneWayDropOffChargesCurrency.orElse(null)`. - */ - fun oneWayDropOffChargesCurrency( - oneWayDropOffChargesCurrency: Optional - ) = oneWayDropOffChargesCurrency(oneWayDropOffChargesCurrency.getOrNull()) + * Alias for calling [Builder.ticketChangeIndicator] with + * `ticketChangeIndicator.orElse(null)`. + */ + fun ticketChangeIndicator( + ticketChangeIndicator: Optional + ) = ticketChangeIndicator(ticketChangeIndicator.getOrNull()) /** - * Sets [Builder.oneWayDropOffChargesCurrency] to an arbitrary JSON value. + * Sets [Builder.ticketChangeIndicator] 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. + * 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 oneWayDropOffChargesCurrency( - oneWayDropOffChargesCurrency: JsonField - ) = apply { - this.oneWayDropOffChargesCurrency = oneWayDropOffChargesCurrency - } + fun ticketChangeIndicator( + ticketChangeIndicator: JsonField + ) = apply { this.ticketChangeIndicator = ticketChangeIndicator } - /** Name of the person renting the vehicle. */ - fun renterName(renterName: String?) = - renterName(JsonField.ofNullable(renterName)) + /** Ticket number. */ + fun ticketNumber(ticketNumber: String?) = + ticketNumber(JsonField.ofNullable(ticketNumber)) /** - * Alias for calling [Builder.renterName] with `renterName.orElse(null)`. + * Alias for calling [Builder.ticketNumber] with + * `ticketNumber.orElse(null)`. */ - fun renterName(renterName: Optional) = - renterName(renterName.getOrNull()) + fun ticketNumber(ticketNumber: Optional) = + ticketNumber(ticketNumber.getOrNull()) /** - * Sets [Builder.renterName] to an arbitrary JSON value. + * Sets [Builder.ticketNumber] to an arbitrary JSON value. * - * You should usually call [Builder.renterName] with a well-typed [String] + * 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 renterName(renterName: JsonField) = apply { - this.renterName = renterName + fun ticketNumber(ticketNumber: JsonField) = apply { + this.ticketNumber = ticketNumber } - /** Weekly rate being charged for the vehicle. */ - fun weeklyRentalRateAmount(weeklyRentalRateAmount: Long?) = - weeklyRentalRateAmount(JsonField.ofNullable(weeklyRentalRateAmount)) + /** + * Code for the travel agency if the ticket was issued by a travel agency. + */ + fun travelAgencyCode(travelAgencyCode: String?) = + travelAgencyCode(JsonField.ofNullable(travelAgencyCode)) /** - * Alias for [Builder.weeklyRentalRateAmount]. + * Alias for calling [Builder.travelAgencyCode] with + * `travelAgencyCode.orElse(null)`. + */ + fun travelAgencyCode(travelAgencyCode: Optional) = + travelAgencyCode(travelAgencyCode.getOrNull()) + + /** + * Sets [Builder.travelAgencyCode] to an arbitrary JSON value. * - * This unboxed primitive overload exists for backwards compatibility. + * 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 weeklyRentalRateAmount(weeklyRentalRateAmount: Long) = - weeklyRentalRateAmount(weeklyRentalRateAmount as Long?) + fun travelAgencyCode(travelAgencyCode: JsonField) = apply { + this.travelAgencyCode = travelAgencyCode + } /** - * Alias for calling [Builder.weeklyRentalRateAmount] with - * `weeklyRentalRateAmount.orElse(null)`. + * Name of the travel agency if the ticket was issued by a travel agency. */ - fun weeklyRentalRateAmount(weeklyRentalRateAmount: Optional) = - weeklyRentalRateAmount(weeklyRentalRateAmount.getOrNull()) + fun travelAgencyName(travelAgencyName: String?) = + travelAgencyName(JsonField.ofNullable(travelAgencyName)) /** - * 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. + * Alias for calling [Builder.travelAgencyName] with + * `travelAgencyName.orElse(null)`. */ - fun weeklyRentalRateAmount(weeklyRentalRateAmount: JsonField) = - apply { - this.weeklyRentalRateAmount = weeklyRentalRateAmount - } + fun travelAgencyName(travelAgencyName: Optional) = + travelAgencyName(travelAgencyName.getOrNull()) /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - * weekly rental rate. + * 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 weeklyRentalRateCurrency(weeklyRentalRateCurrency: String?) = - weeklyRentalRateCurrency(JsonField.ofNullable(weeklyRentalRateCurrency)) + fun travelAgencyName(travelAgencyName: JsonField) = apply { + this.travelAgencyName = travelAgencyName + } + + /** 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()) /** - * Alias for calling [Builder.weeklyRentalRateCurrency] with - * `weeklyRentalRateCurrency.orElse(null)`. + * 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 weeklyRentalRateCurrency(weeklyRentalRateCurrency: Optional) = - weeklyRentalRateCurrency(weeklyRentalRateCurrency.getOrNull()) + fun tripLegs(tripLegs: JsonField>) = apply { + this.tripLegs = tripLegs.map { it.toMutableList() } + } /** - * Sets [Builder.weeklyRentalRateCurrency] to an arbitrary JSON value. + * Adds a single [TripLeg] to [tripLegs]. * - * 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. + * @throws IllegalStateException if the field was previously set to a + * non-list. */ - fun weeklyRentalRateCurrency(weeklyRentalRateCurrency: JsonField) = - apply { - this.weeklyRentalRateCurrency = weeklyRentalRateCurrency - } + fun addTripLeg(tripLeg: TripLeg) = apply { + tripLegs = + (tripLegs ?: JsonField.of(mutableListOf())).also { + checkKnown("tripLegs", it).add(tripLeg) + } + } fun additionalProperties(additionalProperties: Map) = apply { @@ -33969,83 +44559,74 @@ private constructor( } /** - * Returns an immutable instance of [CarRental]. + * Returns an immutable instance of [Travel]. * * 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() + * .ancillary() + * .computerizedReservationSystem() + * .creditReasonIndicator() + * .departureDate() + * .originationCityAirportCode() + * .passengerName() + * .restrictedTicketIndicator() + * .ticketChangeIndicator() + * .ticketNumber() + * .travelAgencyCode() + * .travelAgencyName() + * .tripLegs() * ``` * * @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), + fun build(): Travel = + Travel( + checkRequired("ancillary", ancillary), checkRequired( - "oneWayDropOffChargesAmount", - oneWayDropOffChargesAmount, + "computerizedReservationSystem", + computerizedReservationSystem, ), + checkRequired("creditReasonIndicator", creditReasonIndicator), + checkRequired("departureDate", departureDate), checkRequired( - "oneWayDropOffChargesCurrency", - oneWayDropOffChargesCurrency, + "originationCityAirportCode", + originationCityAirportCode, ), - checkRequired("renterName", renterName), - checkRequired("weeklyRentalRateAmount", weeklyRentalRateAmount), - checkRequired("weeklyRentalRateCurrency", weeklyRentalRateCurrency), + 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(): CarRental = apply { + fun validate(): Travel = apply { if (validated) { return@apply } - carClassCode() - checkoutDate() - dailyRentalRateAmount() - dailyRentalRateCurrency() - daysRented() - extraCharges().ifPresent { it.validate() } - fuelChargesAmount() - fuelChargesCurrency() - insuranceChargesAmount() - insuranceChargesCurrency() - noShowIndicator().ifPresent { it.validate() } - oneWayDropOffChargesAmount() - oneWayDropOffChargesCurrency() - renterName() - weeklyRentalRateAmount() - weeklyRentalRateCurrency() + 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 } @@ -34065,172 +44646,420 @@ 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) + - (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) + (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 (gas, late fee, etc.) being billed. */ - class ExtraCharges - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** Ancillary purchases in addition to the airfare. */ + class Ancillary + 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 + 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") + + /** + * 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") + + /** + * 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 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 + + /** + * 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 [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 + + /** + * 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 + + /** + * 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 + + @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()) - 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 } - /** No extra charge */ - @JvmField val NO_EXTRA_CHARGE = of("no_extra_charge") + /** Name of the passenger or description of the ancillary purchase. */ + fun passengerNameOrDescription(passengerNameOrDescription: String?) = + passengerNameOrDescription( + JsonField.ofNullable(passengerNameOrDescription) + ) - /** Gas */ - @JvmField val GAS = of("gas") + /** + * Alias for calling [Builder.passengerNameOrDescription] with + * `passengerNameOrDescription.orElse(null)`. + */ + fun passengerNameOrDescription( + passengerNameOrDescription: Optional + ) = passengerNameOrDescription(passengerNameOrDescription.getOrNull()) - /** Extra mileage */ - @JvmField val EXTRA_MILEAGE = of("extra_mileage") + /** + * 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 + } - /** Late return */ - @JvmField val LATE_RETURN = of("late_return") + /** Additional travel charges, such as baggage fees. */ + fun services(services: List) = services(JsonField.of(services)) - /** One way service fee */ - @JvmField val ONE_WAY_SERVICE_FEE = of("one_way_service_fee") + /** + * 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() } + } - /** Parking violation */ - @JvmField val PARKING_VIOLATION = of("parking_violation") + /** + * 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) + } + } - @JvmStatic fun of(value: String) = ExtraCharges(JsonField.of(value)) - } + /** Ticket document number. */ + fun ticketDocumentNumber(ticketDocumentNumber: String?) = + ticketDocumentNumber(JsonField.ofNullable(ticketDocumentNumber)) - /** 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, - } + /** + * Alias for calling [Builder.ticketDocumentNumber] with + * `ticketDocumentNumber.orElse(null)`. + */ + fun ticketDocumentNumber(ticketDocumentNumber: Optional) = + ticketDocumentNumber(ticketDocumentNumber.getOrNull()) - /** - * 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. + * 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. */ - _UNKNOWN, - } + fun ticketDocumentNumber(ticketDocumentNumber: JsonField) = + apply { + this.ticketDocumentNumber = ticketDocumentNumber + } - /** - * 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 + 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_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" - ) + 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(): ExtraCharges = apply { + fun validate(): Ancillary = apply { if (validated) { return@apply } - known() + connectedTicketDocumentNumber() + creditReasonIndicator().ifPresent { it.validate() } + passengerNameOrDescription() + services().forEach { it.validate() } + ticketDocumentNumber() validated = true } @@ -34249,1256 +45078,1018 @@ 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 - } + 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) - return /* spotless:off */ other is ExtraCharges && value == other.value /* spotless:on */ - } + /** Indicates the reason for a credit to the cardholder. */ + class CreditReasonIndicator + @JsonCreator + private constructor(private val value: JsonField) : Enum { - override fun hashCode() = value.hashCode() + /** + * 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 toString() = value.toString() - } + companion object { - /** - * 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 - private constructor(private val value: JsonField) : Enum { + /** No credit */ + @JvmField val NO_CREDIT = of("no_credit") - /** - * 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 + /** Passenger transport ancillary purchase cancellation */ + @JvmField + val PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = + of("passenger_transport_ancillary_purchase_cancellation") - companion object { + /** + * 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" + ) - /** Not applicable */ - @JvmField val NOT_APPLICABLE = of("not_applicable") + /** Other */ + @JvmField val OTHER = of("other") - /** No show for specialized vehicle */ - @JvmField - val NO_SHOW_FOR_SPECIALIZED_VEHICLE = - of("no_show_for_specialized_vehicle") + @JvmStatic + fun of(value: String) = CreditReasonIndicator(JsonField.of(value)) + } - @JvmStatic fun of(value: String) = NoShowIndicator(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, + /** Other */ + OTHER, + } - /** An enum containing [NoShowIndicator]'s known values. */ - enum class Known { - /** Not applicable */ - NOT_APPLICABLE, - /** No show for specialized vehicle */ - NO_SHOW_FOR_SPECIALIZED_VEHICLE, - } + /** + * 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 [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. + * 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) { + 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, 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 - } + /** + * 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. - * - * 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") + } - /** - * 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(): NoShowIndicator = 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 /* spotless:off */ other is CreditReasonIndicator && value == other.value /* spotless:on */ } - return /* spotless:off */ other is NoShowIndicator && value == other.value /* spotless:on */ + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } - override fun hashCode() = value.hashCode() + class Service + 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()) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * 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") - return /* spotless:off */ 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 /* spotless:on */ - } + /** + * 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") - /* spotless:off */ - 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) } - /* spotless:on */ + /** + * 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 - override fun hashCode(): Int = hashCode + /** + * 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 - 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}" - } + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - /** Fields specific to lodging. */ - class Lodging - 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, - ) { + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - @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") - @ExcludeMissing - folioCashAdvancesAmount: JsonField = JsonMissing.of(), - @JsonProperty("folio_cash_advances_currency") - @ExcludeMissing - folioCashAdvancesCurrency: JsonField = JsonMissing.of(), - @JsonProperty("food_beverage_charges_amount") - @ExcludeMissing - foodBeverageChargesAmount: JsonField = JsonMissing.of(), - @JsonProperty("food_beverage_charges_currency") - @ExcludeMissing - foodBeverageChargesCurrency: 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") - @ExcludeMissing - 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( - checkInDate, - dailyRoomRateAmount, - dailyRoomRateCurrency, - extraCharges, - folioCashAdvancesAmount, - folioCashAdvancesCurrency, - foodBeverageChargesAmount, - foodBeverageChargesCurrency, - noShowIndicator, - prepaidExpensesAmount, - prepaidExpensesCurrency, - roomNights, - totalRoomTaxAmount, - totalRoomTaxCurrency, - totalTaxAmount, - totalTaxCurrency, - mutableMapOf(), - ) + fun toBuilder() = Builder().from(this) - /** - * 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") + companion object { - /** - * 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") + /** + * Returns a mutable builder for constructing an instance of + * [Service]. + * + * The following fields are required: + * ```java + * .category() + * .subCategory() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - /** - * 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") + /** A builder for [Service]. */ + class Builder internal constructor() { - /** - * 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") + private var category: JsonField? = null + private var subCategory: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() - /** - * 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 folioCashAdvancesAmount(): Optional = - folioCashAdvancesAmount.getOptional("folio_cash_advances_amount") + @JvmSynthetic + internal fun from(service: Service) = apply { + category = service.category + subCategory = service.subCategory + additionalProperties = + service.additionalProperties.toMutableMap() + } - /** - * 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 folioCashAdvancesCurrency(): Optional = - folioCashAdvancesCurrency.getOptional("folio_cash_advances_currency") + /** Category of the ancillary service. */ + fun category(category: Category?) = + category(JsonField.ofNullable(category)) - /** - * 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 foodBeverageChargesAmount(): Optional = - foodBeverageChargesAmount.getOptional("food_beverage_charges_amount") + /** + * Alias for calling [Builder.category] with + * `category.orElse(null)`. + */ + fun category(category: Optional) = + category(category.getOrNull()) - /** - * 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 foodBeverageChargesCurrency(): Optional = - foodBeverageChargesCurrency.getOptional("food_beverage_charges_currency") + /** + * 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 + } - /** - * 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 noShowIndicator(): Optional = - noShowIndicator.getOptional("no_show_indicator") + /** Sub-category of the ancillary service, free-form. */ + fun subCategory(subCategory: String?) = + subCategory(JsonField.ofNullable(subCategory)) - /** - * 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 prepaidExpensesAmount(): Optional = - prepaidExpensesAmount.getOptional("prepaid_expenses_amount") + /** + * Alias for calling [Builder.subCategory] with + * `subCategory.orElse(null)`. + */ + fun subCategory(subCategory: Optional) = + subCategory(subCategory.getOrNull()) - /** - * 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 prepaidExpensesCurrency(): Optional = - prepaidExpensesCurrency.getOptional("prepaid_expenses_currency") + /** + * 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 + } - /** - * 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 roomNights(): Optional = roomNights.getOptional("room_nights") + fun additionalProperties( + additionalProperties: Map + ) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * 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 totalRoomTaxAmount(): Optional = - totalRoomTaxAmount.getOptional("total_room_tax_amount") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * 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") + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } - /** - * 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") + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * 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") + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * Returns the raw JSON value of [checkInDate]. - * - * Unlike [checkInDate], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("check_in_date") - @ExcludeMissing - fun _checkInDate(): JsonField = checkInDate + /** + * 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 [dailyRoomRateAmount]. - * - * Unlike [dailyRoomRateAmount], this method doesn't throw if the JSON field has - * an unexpected type. - */ - @JsonProperty("daily_room_rate_amount") - @ExcludeMissing - fun _dailyRoomRateAmount(): JsonField = dailyRoomRateAmount + private var validated: Boolean = false - /** - * Returns the raw JSON value of [dailyRoomRateCurrency]. - * - * Unlike [dailyRoomRateCurrency], this method doesn't throw if the JSON field - * has an unexpected type. - */ - @JsonProperty("daily_room_rate_currency") - @ExcludeMissing - fun _dailyRoomRateCurrency(): JsonField = dailyRoomRateCurrency + fun validate(): Service = apply { + if (validated) { + return@apply + } - /** - * 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 + category().ifPresent { it.validate() } + subCategory() + validated = true + } - /** - * 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 + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * 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 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 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") - @ExcludeMissing - fun _foodBeverageChargesAmount(): JsonField = foodBeverageChargesAmount + /** Category of the ancillary service. */ + class Category + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** - * Returns the raw JSON value of [foodBeverageChargesCurrency]. - * - * Unlike [foodBeverageChargesCurrency], this method doesn't throw if the JSON - * field has an unexpected type. - */ - @JsonProperty("food_beverage_charges_currency") - @ExcludeMissing - fun _foodBeverageChargesCurrency(): JsonField = - foodBeverageChargesCurrency + /** + * 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 [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 + companion object { - /** - * Returns the raw JSON value of [prepaidExpensesAmount]. - * - * Unlike [prepaidExpensesAmount], this method doesn't throw if the JSON field - * has an unexpected type. - */ - @JsonProperty("prepaid_expenses_amount") - @ExcludeMissing - fun _prepaidExpensesAmount(): JsonField = prepaidExpensesAmount + /** None */ + @JvmField val NONE = of("none") - /** - * Returns the raw JSON value of [prepaidExpensesCurrency]. - * - * Unlike [prepaidExpensesCurrency], this method doesn't throw if the JSON field - * has an unexpected type. - */ - @JsonProperty("prepaid_expenses_currency") - @ExcludeMissing - fun _prepaidExpensesCurrency(): JsonField = prepaidExpensesCurrency + /** Bundled service */ + @JvmField val BUNDLED_SERVICE = of("bundled_service") - /** - * Returns the raw JSON value of [roomNights]. - * - * Unlike [roomNights], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("room_nights") - @ExcludeMissing - fun _roomNights(): JsonField = roomNights + /** Baggage fee */ + @JvmField val BAGGAGE_FEE = of("baggage_fee") - /** - * 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") - @ExcludeMissing - fun _totalRoomTaxAmount(): JsonField = totalRoomTaxAmount + /** Change fee */ + @JvmField val CHANGE_FEE = of("change_fee") - /** - * 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 + /** Cargo */ + @JvmField val CARGO = of("cargo") - /** - * 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") - @ExcludeMissing - fun _totalTaxAmount(): JsonField = totalTaxAmount + /** Carbon offset */ + @JvmField val CARBON_OFFSET = of("carbon_offset") - /** - * 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 + /** Frequent flyer */ + @JvmField val FREQUENT_FLYER = of("frequent_flyer") - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** Gift card */ + @JvmField val GIFT_CARD = of("gift_card") - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** Ground transport */ + @JvmField val GROUND_TRANSPORT = of("ground_transport") - fun toBuilder() = Builder().from(this) + /** In-flight entertainment */ + @JvmField + val IN_FLIGHT_ENTERTAINMENT = of("in_flight_entertainment") - companion object { + /** Lounge */ + @JvmField val LOUNGE = of("lounge") - /** - * Returns a mutable builder for constructing an instance of [Lodging]. - * - * The following fields are required: - * ```java - * .checkInDate() - * .dailyRoomRateAmount() - * .dailyRoomRateCurrency() - * .extraCharges() - * .folioCashAdvancesAmount() - * .folioCashAdvancesCurrency() - * .foodBeverageChargesAmount() - * .foodBeverageChargesCurrency() - * .noShowIndicator() - * .prepaidExpensesAmount() - * .prepaidExpensesCurrency() - * .roomNights() - * .totalRoomTaxAmount() - * .totalRoomTaxCurrency() - * .totalTaxAmount() - * .totalTaxCurrency() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + /** Medical */ + @JvmField val MEDICAL = of("medical") - /** A builder for [Lodging]. */ - class Builder internal constructor() { + /** Meal beverage */ + @JvmField val MEAL_BEVERAGE = of("meal_beverage") - 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() + /** Other */ + @JvmField val OTHER = of("other") - @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() - } + /** Passenger assist fee */ + @JvmField val PASSENGER_ASSIST_FEE = of("passenger_assist_fee") - /** Date the customer checked in. */ - fun checkInDate(checkInDate: LocalDate?) = - checkInDate(JsonField.ofNullable(checkInDate)) + /** Pets */ + @JvmField val PETS = of("pets") - /** - * Alias for calling [Builder.checkInDate] with `checkInDate.orElse(null)`. - */ - fun checkInDate(checkInDate: Optional) = - checkInDate(checkInDate.getOrNull()) + /** Seat fees */ + @JvmField val SEAT_FEES = of("seat_fees") - /** - * 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 - } + /** Standby */ + @JvmField val STANDBY = of("standby") - /** Daily rate being charged for the room. */ - fun dailyRoomRateAmount(dailyRoomRateAmount: Long?) = - dailyRoomRateAmount(JsonField.ofNullable(dailyRoomRateAmount)) + /** Service fee */ + @JvmField val SERVICE_FEE = of("service_fee") - /** - * Alias for [Builder.dailyRoomRateAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun dailyRoomRateAmount(dailyRoomRateAmount: Long) = - dailyRoomRateAmount(dailyRoomRateAmount as Long?) + /** Store */ + @JvmField val STORE = of("store") - /** - * Alias for calling [Builder.dailyRoomRateAmount] with - * `dailyRoomRateAmount.orElse(null)`. - */ - fun dailyRoomRateAmount(dailyRoomRateAmount: Optional) = - dailyRoomRateAmount(dailyRoomRateAmount.getOrNull()) + /** Travel service */ + @JvmField val TRAVEL_SERVICE = of("travel_service") - /** - * 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 - } + /** Unaccompanied travel */ + @JvmField val UNACCOMPANIED_TRAVEL = of("unaccompanied_travel") - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily - * room rate. - */ - fun dailyRoomRateCurrency(dailyRoomRateCurrency: String?) = - dailyRoomRateCurrency(JsonField.ofNullable(dailyRoomRateCurrency)) + /** Upgrades */ + @JvmField val UPGRADES = of("upgrades") - /** - * Alias for calling [Builder.dailyRoomRateCurrency] with - * `dailyRoomRateCurrency.orElse(null)`. - */ - fun dailyRoomRateCurrency(dailyRoomRateCurrency: Optional) = - dailyRoomRateCurrency(dailyRoomRateCurrency.getOrNull()) + /** Wi-fi */ + @JvmField val WIFI = of("wifi") - /** - * 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 - } + @JvmStatic fun of(value: String) = Category(JsonField.of(value)) + } - /** Additional charges (phone, late check-out, etc.) being billed. */ - fun extraCharges(extraCharges: ExtraCharges?) = - extraCharges(JsonField.ofNullable(extraCharges)) + /** 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, + } - /** - * Alias for calling [Builder.extraCharges] with - * `extraCharges.orElse(null)`. - */ - fun extraCharges(extraCharges: Optional) = - extraCharges(extraCharges.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 { + /** 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, + } - /** - * 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 - } + /** + * 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 + } - /** Folio cash advances for the room. */ - fun folioCashAdvancesAmount(folioCashAdvancesAmount: Long?) = - folioCashAdvancesAmount(JsonField.ofNullable(folioCashAdvancesAmount)) + /** + * 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" + ) + } - /** - * Alias for [Builder.folioCashAdvancesAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun folioCashAdvancesAmount(folioCashAdvancesAmount: Long) = - folioCashAdvancesAmount(folioCashAdvancesAmount as Long?) + /** + * 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.folioCashAdvancesAmount] with - * `folioCashAdvancesAmount.orElse(null)`. - */ - fun folioCashAdvancesAmount(folioCashAdvancesAmount: Optional) = - folioCashAdvancesAmount(folioCashAdvancesAmount.getOrNull()) + private var validated: Boolean = false - /** - * Sets [Builder.folioCashAdvancesAmount] 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. - */ - fun folioCashAdvancesAmount(folioCashAdvancesAmount: JsonField) = - apply { - this.folioCashAdvancesAmount = folioCashAdvancesAmount - } + fun validate(): Category = apply { + if (validated) { + return@apply + } - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the folio - * cash advances. - */ - fun folioCashAdvancesCurrency(folioCashAdvancesCurrency: String?) = - folioCashAdvancesCurrency( - JsonField.ofNullable(folioCashAdvancesCurrency) - ) + known() + validated = true + } - /** - * Alias for calling [Builder.folioCashAdvancesCurrency] with - * `folioCashAdvancesCurrency.orElse(null)`. - */ - fun folioCashAdvancesCurrency(folioCashAdvancesCurrency: Optional) = - folioCashAdvancesCurrency(folioCashAdvancesCurrency.getOrNull()) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * Sets [Builder.folioCashAdvancesCurrency] 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. - */ - fun folioCashAdvancesCurrency( - folioCashAdvancesCurrency: JsonField - ) = apply { this.folioCashAdvancesCurrency = folioCashAdvancesCurrency } + /** + * 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 - /** Food and beverage charges for the room. */ - fun foodBeverageChargesAmount(foodBeverageChargesAmount: Long?) = - foodBeverageChargesAmount( - JsonField.ofNullable(foodBeverageChargesAmount) - ) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Alias for [Builder.foodBeverageChargesAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun foodBeverageChargesAmount(foodBeverageChargesAmount: Long) = - foodBeverageChargesAmount(foodBeverageChargesAmount as Long?) + return /* spotless:off */ other is Category && value == other.value /* spotless:on */ + } - /** - * Alias for calling [Builder.foodBeverageChargesAmount] with - * `foodBeverageChargesAmount.orElse(null)`. - */ - fun foodBeverageChargesAmount(foodBeverageChargesAmount: Optional) = - foodBeverageChargesAmount(foodBeverageChargesAmount.getOrNull()) + override fun hashCode() = value.hashCode() - /** - * Sets [Builder.foodBeverageChargesAmount] 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. - */ - fun foodBeverageChargesAmount(foodBeverageChargesAmount: JsonField) = - apply { - this.foodBeverageChargesAmount = foodBeverageChargesAmount + override fun toString() = value.toString() } - /** - * 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.foodBeverageChargesCurrency] with - * `foodBeverageChargesCurrency.orElse(null)`. - */ - fun foodBeverageChargesCurrency( - foodBeverageChargesCurrency: Optional - ) = foodBeverageChargesCurrency(foodBeverageChargesCurrency.getOrNull()) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Sets [Builder.foodBeverageChargesCurrency] to an arbitrary JSON 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 foodBeverageChargesCurrency( - foodBeverageChargesCurrency: JsonField - ) = apply { this.foodBeverageChargesCurrency = foodBeverageChargesCurrency } + return /* spotless:off */ other is Service && category == other.category && subCategory == other.subCategory && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * Indicator that the cardholder is being billed for a reserved room that - * was not actually used. - */ - fun noShowIndicator(noShowIndicator: NoShowIndicator?) = - noShowIndicator(JsonField.ofNullable(noShowIndicator)) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(category, subCategory, additionalProperties) } + /* spotless:on */ - /** - * Alias for calling [Builder.noShowIndicator] with - * `noShowIndicator.orElse(null)`. - */ - fun noShowIndicator(noShowIndicator: Optional) = - noShowIndicator(noShowIndicator.getOrNull()) + override fun hashCode(): Int = hashCode - /** - * 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 + override fun toString() = + "Service{category=$category, subCategory=$subCategory, additionalProperties=$additionalProperties}" } - /** Prepaid expenses being charged for the room. */ - fun prepaidExpensesAmount(prepaidExpensesAmount: Long?) = - prepaidExpensesAmount(JsonField.ofNullable(prepaidExpensesAmount)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Alias for [Builder.prepaidExpensesAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun prepaidExpensesAmount(prepaidExpensesAmount: Long) = - prepaidExpensesAmount(prepaidExpensesAmount as Long?) + return /* spotless:off */ other is Ancillary && connectedTicketDocumentNumber == other.connectedTicketDocumentNumber && creditReasonIndicator == other.creditReasonIndicator && passengerNameOrDescription == other.passengerNameOrDescription && services == other.services && ticketDocumentNumber == other.ticketDocumentNumber && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * Alias for calling [Builder.prepaidExpensesAmount] with - * `prepaidExpensesAmount.orElse(null)`. - */ - fun prepaidExpensesAmount(prepaidExpensesAmount: Optional) = - prepaidExpensesAmount(prepaidExpensesAmount.getOrNull()) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(connectedTicketDocumentNumber, creditReasonIndicator, passengerNameOrDescription, services, ticketDocumentNumber, additionalProperties) } + /* spotless:on */ - /** - * Sets [Builder.prepaidExpensesAmount] 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. - */ - fun prepaidExpensesAmount(prepaidExpensesAmount: JsonField) = apply { - this.prepaidExpensesAmount = prepaidExpensesAmount - } + override fun hashCode(): Int = hashCode - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - * prepaid expenses. - */ - fun prepaidExpensesCurrency(prepaidExpensesCurrency: String?) = - prepaidExpensesCurrency(JsonField.ofNullable(prepaidExpensesCurrency)) + override fun toString() = + "Ancillary{connectedTicketDocumentNumber=$connectedTicketDocumentNumber, creditReasonIndicator=$creditReasonIndicator, passengerNameOrDescription=$passengerNameOrDescription, services=$services, ticketDocumentNumber=$ticketDocumentNumber, additionalProperties=$additionalProperties}" + } - /** - * Alias for calling [Builder.prepaidExpensesCurrency] with - * `prepaidExpensesCurrency.orElse(null)`. - */ - fun prepaidExpensesCurrency(prepaidExpensesCurrency: Optional) = - prepaidExpensesCurrency(prepaidExpensesCurrency.getOrNull()) + /** Indicates the reason for a credit to the cardholder. */ + class CreditReasonIndicator + @JsonCreator + private constructor(private val value: JsonField) : Enum { /** - * Sets [Builder.prepaidExpensesCurrency] to an arbitrary JSON value. + * Returns this class instance's raw 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. + * 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 prepaidExpensesCurrency(prepaidExpensesCurrency: JsonField) = - apply { - this.prepaidExpensesCurrency = prepaidExpensesCurrency - } + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** Number of nights the room was rented. */ - fun roomNights(roomNights: Long?) = - roomNights(JsonField.ofNullable(roomNights)) + companion object { - /** - * Alias for [Builder.roomNights]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun roomNights(roomNights: Long) = roomNights(roomNights as Long?) + /** No credit */ + @JvmField val NO_CREDIT = of("no_credit") - /** - * Alias for calling [Builder.roomNights] with `roomNights.orElse(null)`. - */ - fun roomNights(roomNights: Optional) = - roomNights(roomNights.getOrNull()) + /** Passenger transport ancillary purchase cancellation */ + @JvmField + val PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = + of("passenger_transport_ancillary_purchase_cancellation") - /** - * 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 - } + /** + * 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" + ) - /** Total room tax being charged. */ - fun totalRoomTaxAmount(totalRoomTaxAmount: Long?) = - totalRoomTaxAmount(JsonField.ofNullable(totalRoomTaxAmount)) + /** Airline ticket cancellation */ + @JvmField + val AIRLINE_TICKET_CANCELLATION = of("airline_ticket_cancellation") - /** - * Alias for [Builder.totalRoomTaxAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun totalRoomTaxAmount(totalRoomTaxAmount: Long) = - totalRoomTaxAmount(totalRoomTaxAmount as Long?) + /** Other */ + @JvmField val OTHER = of("other") - /** - * Alias for calling [Builder.totalRoomTaxAmount] with - * `totalRoomTaxAmount.orElse(null)`. - */ - fun totalRoomTaxAmount(totalRoomTaxAmount: Optional) = - totalRoomTaxAmount(totalRoomTaxAmount.getOrNull()) + /** Partial refund of airline ticket */ + @JvmField + val PARTIAL_REFUND_OF_AIRLINE_TICKET = + of("partial_refund_of_airline_ticket") - /** - * 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 + @JvmStatic + fun of(value: String) = CreditReasonIndicator(JsonField.of(value)) } - /** - * 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()) + /** 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, + } /** - * Sets [Builder.totalRoomTaxCurrency] to an arbitrary JSON value. + * An enum containing [CreditReasonIndicator]'s known values, as well as an + * [_UNKNOWN] member. * - * 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. + * 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 totalRoomTaxCurrency(totalRoomTaxCurrency: JsonField) = apply { - this.totalRoomTaxCurrency = totalRoomTaxCurrency + 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, } - /** Total tax being charged for the room. */ - fun totalTaxAmount(totalTaxAmount: Long?) = - totalTaxAmount(JsonField.ofNullable(totalTaxAmount)) - /** - * Alias for [Builder.totalTaxAmount]. + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. * - * 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)`. + * 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 totalTaxAmount(totalTaxAmount: Optional) = - totalTaxAmount(totalTaxAmount.getOrNull()) + 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.totalTaxAmount] to an arbitrary JSON value. + * Returns an enum member corresponding to this class instance's 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)`. + * 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 totalTaxCurrency(totalTaxCurrency: Optional) = - totalTaxCurrency(totalTaxCurrency.getOrNull()) + 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" + ) + } /** - * Sets [Builder.totalTaxCurrency] to an arbitrary JSON value. + * Returns this class instance's primitive wire representation. * - * 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. + * 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 totalTaxCurrency(totalTaxCurrency: JsonField) = apply { - this.totalTaxCurrency = totalTaxCurrency - } - - 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(): 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 [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() - * ``` + * 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(): 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(), - ) - } + @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(): Lodging = apply { - if (validated) { - return@apply + return /* spotless:off */ other is CreditReasonIndicator && value == other.value /* spotless:on */ } - checkInDate() - dailyRoomRateAmount() - dailyRoomRateCurrency() - extraCharges().ifPresent { it.validate() } - folioCashAdvancesAmount() - folioCashAdvancesCurrency() - foodBeverageChargesAmount() - foodBeverageChargesCurrency() - noShowIndicator().ifPresent { it.validate() } - prepaidExpensesAmount() - prepaidExpensesCurrency() - roomNights() - totalRoomTaxAmount() - totalRoomTaxCurrency() - totalTaxAmount() - totalTaxCurrency() - 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 (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) + override fun toString() = value.toString() + } - /** Additional charges (phone, late check-out, etc.) being billed. */ - class ExtraCharges + /** Indicates whether this ticket is non-refundable. */ + class RestrictedTicketIndicator @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -35515,77 +46106,45 @@ private constructor( 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") + /** No restrictions */ + @JvmField val NO_RESTRICTIONS = of("no_restrictions") - /** Laundry */ - @JvmField val LAUNDRY = of("laundry") + /** Restricted non-refundable ticket */ + @JvmField + val RESTRICTED_NON_REFUNDABLE_TICKET = + of("restricted_non_refundable_ticket") - @JvmStatic fun of(value: String) = ExtraCharges(JsonField.of(value)) + @JvmStatic + fun of(value: String) = RestrictedTicketIndicator(JsonField.of(value)) } - /** An enum containing [ExtraCharges]'s known values. */ + /** An enum containing [RestrictedTicketIndicator]'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, + /** No restrictions */ + NO_RESTRICTIONS, + /** Restricted non-refundable ticket */ + RESTRICTED_NON_REFUNDABLE_TICKET, } /** - * An enum containing [ExtraCharges]'s known values, as well as an - * [_UNKNOWN] member. + * An enum containing [RestrictedTicketIndicator]'s known values, as well as + * an [_UNKNOWN] member. * - * An instance of [ExtraCharges] can contain an unknown value in a couple of - * cases: + * 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 extra charge */ - NO_EXTRA_CHARGE, - /** Restaurant */ - RESTAURANT, - /** Gift shop */ - GIFT_SHOP, - /** Mini bar */ - MINI_BAR, - /** Telephone */ - TELEPHONE, - /** Other */ - OTHER, - /** Laundry */ - LAUNDRY, + /** No restrictions */ + NO_RESTRICTIONS, + /** Restricted non-refundable ticket */ + RESTRICTED_NON_REFUNDABLE_TICKET, /** - * An enum member indicating that [ExtraCharges] was instantiated with - * an unknown value. + * An enum member indicating that [RestrictedTicketIndicator] was + * instantiated with an unknown value. */ _UNKNOWN, } @@ -35599,13 +46158,9 @@ 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 + NO_RESTRICTIONS -> Value.NO_RESTRICTIONS + RESTRICTED_NON_REFUNDABLE_TICKET -> + Value.RESTRICTED_NON_REFUNDABLE_TICKET else -> Value._UNKNOWN } @@ -35620,16 +46175,12 @@ 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 + NO_RESTRICTIONS -> Known.NO_RESTRICTIONS + RESTRICTED_NON_REFUNDABLE_TICKET -> + Known.RESTRICTED_NON_REFUNDABLE_TICKET else -> throw IncreaseInvalidDataException( - "Unknown ExtraCharges: $value" + "Unknown RestrictedTicketIndicator: $value" ) } @@ -35649,7 +46200,7 @@ private constructor( private var validated: Boolean = false - fun validate(): ExtraCharges = apply { + fun validate(): RestrictedTicketIndicator = apply { if (validated) { return@apply } @@ -35680,7 +46231,7 @@ private constructor( return true } - return /* spotless:off */ other is ExtraCharges && value == other.value /* spotless:on */ + return /* spotless:off */ other is RestrictedTicketIndicator && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -35688,11 +46239,8 @@ private constructor( override fun toString() = value.toString() } - /** - * Indicator that the cardholder is being billed for a reserved room that was - * not actually used. - */ - class NoShowIndicator + /** Indicates why a ticket was changed. */ + class TicketChangeIndicator @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -35709,42 +46257,51 @@ private constructor( companion object { - /** Not applicable */ - @JvmField val NOT_APPLICABLE = of("not_applicable") + /** None */ + @JvmField val NONE = of("none") - /** No show */ - @JvmField val NO_SHOW = of("no_show") + /** Change to existing ticket */ + @JvmField + val CHANGE_TO_EXISTING_TICKET = of("change_to_existing_ticket") - @JvmStatic fun of(value: String) = NoShowIndicator(JsonField.of(value)) + /** New ticket */ + @JvmField val NEW_TICKET = of("new_ticket") + + @JvmStatic + fun of(value: String) = TicketChangeIndicator(JsonField.of(value)) } - /** An enum containing [NoShowIndicator]'s known values. */ + /** An enum containing [TicketChangeIndicator]'s known values. */ enum class Known { - /** Not applicable */ - NOT_APPLICABLE, - /** No show */ - NO_SHOW, + /** None */ + NONE, + /** Change to existing ticket */ + CHANGE_TO_EXISTING_TICKET, + /** New ticket */ + NEW_TICKET, } /** - * An enum containing [NoShowIndicator]'s known values, as well as an + * An enum containing [TicketChangeIndicator]'s known values, as well as an * [_UNKNOWN] member. * - * An instance of [NoShowIndicator] can contain an unknown value in a couple - * of cases: + * 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 { - /** Not applicable */ - NOT_APPLICABLE, - /** No show */ - NO_SHOW, + /** None */ + NONE, + /** Change to existing ticket */ + CHANGE_TO_EXISTING_TICKET, + /** New ticket */ + NEW_TICKET, /** - * An enum member indicating that [NoShowIndicator] was instantiated - * with an unknown value. + * An enum member indicating that [TicketChangeIndicator] was + * instantiated with an unknown value. */ _UNKNOWN, } @@ -35758,8 +46315,9 @@ private constructor( */ fun value(): Value = when (this) { - NOT_APPLICABLE -> Value.NOT_APPLICABLE - NO_SHOW -> Value.NO_SHOW + NONE -> Value.NONE + CHANGE_TO_EXISTING_TICKET -> Value.CHANGE_TO_EXISTING_TICKET + NEW_TICKET -> Value.NEW_TICKET else -> Value._UNKNOWN } @@ -35774,11 +46332,12 @@ private constructor( */ fun known(): Known = when (this) { - NOT_APPLICABLE -> Known.NOT_APPLICABLE - NO_SHOW -> Known.NO_SHOW + NONE -> Known.NONE + CHANGE_TO_EXISTING_TICKET -> Known.CHANGE_TO_EXISTING_TICKET + NEW_TICKET -> Known.NEW_TICKET else -> throw IncreaseInvalidDataException( - "Unknown NoShowIndicator: $value" + "Unknown TicketChangeIndicator: $value" ) } @@ -35798,7 +46357,7 @@ private constructor( private var validated: Boolean = false - fun validate(): NoShowIndicator = apply { + fun validate(): TicketChangeIndicator = apply { if (validated) { return@apply } @@ -35829,7 +46388,7 @@ private constructor( return true } - return /* spotless:off */ other is NoShowIndicator && value == other.value /* spotless:on */ + return /* spotless:off */ other is TicketChangeIndicator && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -35837,4780 +46396,4638 @@ private constructor( override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ 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 /* spotless:on */ - } - - /* spotless:off */ - 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) } - /* spotless:on */ - - 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}" - } + class TripLeg + 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 format of the purchase identifier. */ - class PurchaseIdentifierFormat - @JsonCreator - private constructor(private val value: JsonField) : Enum { + @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 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 + /** + * 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") - companion object { + /** + * 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") - /** Free text */ - @JvmField val FREE_TEXT = of("free_text") + /** + * 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") - /** Order number */ - @JvmField val ORDER_NUMBER = of("order_number") + /** + * 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") - /** Rental agreement number */ - @JvmField val RENTAL_AGREEMENT_NUMBER = of("rental_agreement_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") - /** Hotel folio number */ - @JvmField val HOTEL_FOLIO_NUMBER = of("hotel_folio_number") + /** + * 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") - /** Invoice number */ - @JvmField val INVOICE_NUMBER = of("invoice_number") + /** + * 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 - @JvmStatic - fun of(value: String) = PurchaseIdentifierFormat(JsonField.of(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 - /** 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 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 - /** - * 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. + * Returns the raw JSON value of [serviceClass]. + * + * Unlike [serviceClass], this method doesn't throw if the JSON field has an + * unexpected type. */ - _UNKNOWN, - } + @JsonProperty("service_class") + @ExcludeMissing + fun _serviceClass(): JsonField = serviceClass - /** - * 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 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 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" - ) + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + 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") - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - private var validated: Boolean = false + fun toBuilder() = Builder().from(this) - fun validate(): PurchaseIdentifierFormat = apply { - if (validated) { - return@apply + 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() } - known() - validated = true - } + /** A builder for [TripLeg]. */ + class Builder internal constructor() { - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + 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 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(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() + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** Carrier code (e.g., United Airlines, Jet Blue, etc.). */ + fun carrierCode(carrierCode: String?) = + carrierCode(JsonField.ofNullable(carrierCode)) - return /* spotless:off */ other is PurchaseIdentifierFormat && value == other.value /* spotless:on */ - } + /** + * Alias for calling [Builder.carrierCode] with + * `carrierCode.orElse(null)`. + */ + fun carrierCode(carrierCode: Optional) = + carrierCode(carrierCode.getOrNull()) - override fun hashCode() = value.hashCode() + /** + * 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 + } - override fun toString() = value.toString() - } + /** Code for the destination city or airport. */ + fun destinationCityAirportCode(destinationCityAirportCode: String?) = + destinationCityAirportCode( + JsonField.ofNullable(destinationCityAirportCode) + ) - /** Fields specific to travel. */ - class Travel - 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, - ) { + /** + * Alias for calling [Builder.destinationCityAirportCode] with + * `destinationCityAirportCode.orElse(null)`. + */ + fun destinationCityAirportCode( + destinationCityAirportCode: Optional + ) = destinationCityAirportCode(destinationCityAirportCode.getOrNull()) - @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(), - ) + /** + * 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 + } - /** - * 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") + /** Fare basis code. */ + fun fareBasisCode(fareBasisCode: String?) = + fareBasisCode(JsonField.ofNullable(fareBasisCode)) - /** - * 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") + /** + * Alias for calling [Builder.fareBasisCode] with + * `fareBasisCode.orElse(null)`. + */ + fun fareBasisCode(fareBasisCode: Optional) = + fareBasisCode(fareBasisCode.getOrNull()) - /** - * 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") + /** + * 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 + } - /** - * 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") + /** Flight number. */ + fun flightNumber(flightNumber: String?) = + flightNumber(JsonField.ofNullable(flightNumber)) - /** - * 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") + /** + * Alias for calling [Builder.flightNumber] with + * `flightNumber.orElse(null)`. + */ + fun flightNumber(flightNumber: Optional) = + flightNumber(flightNumber.getOrNull()) - /** - * 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") + /** + * 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 + } - /** - * 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") + /** Service class (e.g., first class, business class, etc.). */ + fun serviceClass(serviceClass: String?) = + serviceClass(JsonField.ofNullable(serviceClass)) - /** - * 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.serviceClass] with + * `serviceClass.orElse(null)`. + */ + fun serviceClass(serviceClass: Optional) = + serviceClass(serviceClass.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.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 + } - /** - * 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 whether a stopover is allowed on this ticket. */ + fun stopOverCode(stopOverCode: StopOverCode?) = + stopOverCode(JsonField.ofNullable(stopOverCode)) - /** - * 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.stopOverCode] with + * `stopOverCode.orElse(null)`. + */ + fun stopOverCode(stopOverCode: Optional) = + stopOverCode(stopOverCode.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.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 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 + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * 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 + 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 + } - /** - * 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 + carrierCode() + destinationCityAirportCode() + fareBasisCode() + flightNumber() + serviceClass() + stopOverCode().ifPresent { it.validate() } + validated = true + } - /** - * 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 + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * 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 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) - /** - * 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 + /** Indicates whether a stopover is allowed on this ticket. */ + class StopOverCode + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** - * 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 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 [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 + companion object { - /** - * 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 + /** None */ + @JvmField val NONE = of("none") - /** - * 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 + /** Stop over allowed */ + @JvmField val STOP_OVER_ALLOWED = of("stop_over_allowed") - /** - * 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 + /** Stop over not allowed */ + @JvmField val STOP_OVER_NOT_ALLOWED = of("stop_over_not_allowed") - /** - * 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 + @JvmStatic fun of(value: String) = StopOverCode(JsonField.of(value)) + } - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, 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, + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** + * 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, + } - 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) { + NONE -> Value.NONE + STOP_OVER_ALLOWED -> Value.STOP_OVER_ALLOWED + STOP_OVER_NOT_ALLOWED -> Value.STOP_OVER_NOT_ALLOWED + 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) { + 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 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 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 [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(): StopOverCode = 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() - } + known() + validated = true + } - /** Ancillary purchases in addition to the airfare. */ - fun ancillary(ancillary: Ancillary?) = - ancillary(JsonField.ofNullable(ancillary)) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** Alias for calling [Builder.ancillary] with `ancillary.orElse(null)`. */ - fun ancillary(ancillary: Optional) = - ancillary(ancillary.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.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 equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Indicates the computerized reservation system used to book the ticket. - */ - fun computerizedReservationSystem(computerizedReservationSystem: String?) = - computerizedReservationSystem( - JsonField.ofNullable(computerizedReservationSystem) - ) + return /* spotless:off */ other is StopOverCode && value == other.value /* spotless:on */ + } - /** - * Alias for calling [Builder.computerizedReservationSystem] with - * `computerizedReservationSystem.orElse(null)`. - */ - fun computerizedReservationSystem( - computerizedReservationSystem: Optional - ) = computerizedReservationSystem(computerizedReservationSystem.getOrNull()) + override fun hashCode() = value.hashCode() - /** - * 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 + override fun toString() = value.toString() } - /** Indicates the reason for a credit to the cardholder. */ - fun creditReasonIndicator(creditReasonIndicator: CreditReasonIndicator?) = - creditReasonIndicator(JsonField.ofNullable(creditReasonIndicator)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Alias for calling [Builder.creditReasonIndicator] with - * `creditReasonIndicator.orElse(null)`. - */ - fun creditReasonIndicator( - creditReasonIndicator: Optional - ) = creditReasonIndicator(creditReasonIndicator.getOrNull()) + return /* spotless:off */ other is TripLeg && carrierCode == other.carrierCode && destinationCityAirportCode == other.destinationCityAirportCode && fareBasisCode == other.fareBasisCode && flightNumber == other.flightNumber && serviceClass == other.serviceClass && stopOverCode == other.stopOverCode && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * 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 } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(carrierCode, destinationCityAirportCode, fareBasisCode, flightNumber, serviceClass, stopOverCode, additionalProperties) } + /* spotless:on */ - /** Date of departure. */ - fun departureDate(departureDate: LocalDate?) = - departureDate(JsonField.ofNullable(departureDate)) + override fun hashCode(): Int = hashCode - /** - * Alias for calling [Builder.departureDate] with - * `departureDate.orElse(null)`. - */ - fun departureDate(departureDate: Optional) = - departureDate(departureDate.getOrNull()) + override fun toString() = + "TripLeg{carrierCode=$carrierCode, destinationCityAirportCode=$destinationCityAirportCode, fareBasisCode=$fareBasisCode, flightNumber=$flightNumber, serviceClass=$serviceClass, stopOverCode=$stopOverCode, additionalProperties=$additionalProperties}" + } - /** - * 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 + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - /** Code for the originating city or airport. */ - fun originationCityAirportCode(originationCityAirportCode: String?) = - originationCityAirportCode( - JsonField.ofNullable(originationCityAirportCode) - ) + return /* spotless:off */ 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 /* spotless:on */ + } - /** - * Alias for calling [Builder.originationCityAirportCode] with - * `originationCityAirportCode.orElse(null)`. - */ - fun originationCityAirportCode( - originationCityAirportCode: Optional - ) = originationCityAirportCode(originationCityAirportCode.getOrNull()) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(ancillary, computerizedReservationSystem, creditReasonIndicator, departureDate, originationCityAirportCode, passengerName, restrictedTicketIndicator, ticketChangeIndicator, ticketNumber, travelAgencyCode, travelAgencyName, tripLegs, additionalProperties) } + /* spotless:on */ - /** - * 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 } + override fun hashCode(): Int = hashCode - /** Name of the passenger. */ - fun passengerName(passengerName: String?) = - passengerName(JsonField.ofNullable(passengerName)) + 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}" + } - /** - * Alias for calling [Builder.passengerName] with - * `passengerName.orElse(null)`. - */ - fun passengerName(passengerName: Optional) = - passengerName(passengerName.getOrNull()) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * 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 - } + return /* spotless:off */ 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 /* spotless:on */ + } - /** Indicates whether this ticket is non-refundable. */ - fun restrictedTicketIndicator( - restrictedTicketIndicator: RestrictedTicketIndicator? - ) = - restrictedTicketIndicator( - JsonField.ofNullable(restrictedTicketIndicator) - ) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(carRental, customerReferenceIdentifier, localTaxAmount, localTaxCurrency, lodging, nationalTaxAmount, nationalTaxCurrency, purchaseIdentifier, purchaseIdentifierFormat, travel, additionalProperties) } + /* spotless:on */ - /** - * Alias for calling [Builder.restrictedTicketIndicator] with - * `restrictedTicketIndicator.orElse(null)`. - */ - fun restrictedTicketIndicator( - restrictedTicketIndicator: Optional - ) = restrictedTicketIndicator(restrictedTicketIndicator.getOrNull()) + 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}" + } + + /** + * A constant representing the object's type. For this resource it will always be + * `card_settlement`. + */ + 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 - /** - * 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 } + companion object { - /** Indicates why a ticket was changed. */ - fun ticketChangeIndicator(ticketChangeIndicator: TicketChangeIndicator?) = - ticketChangeIndicator(JsonField.ofNullable(ticketChangeIndicator)) + @JvmField val CARD_SETTLEMENT = of("card_settlement") - /** - * Alias for calling [Builder.ticketChangeIndicator] with - * `ticketChangeIndicator.orElse(null)`. - */ - fun ticketChangeIndicator( - ticketChangeIndicator: Optional - ) = ticketChangeIndicator(ticketChangeIndicator.getOrNull()) + @JvmStatic fun of(value: String) = Type(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 [Type]'s known values. */ + enum class Known { + CARD_SETTLEMENT + } - /** Ticket number. */ - fun ticketNumber(ticketNumber: String?) = - ticketNumber(JsonField.ofNullable(ticketNumber)) + /** + * 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_SETTLEMENT, + /** + * An enum member indicating that [Type] 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) { + CARD_SETTLEMENT -> Value.CARD_SETTLEMENT + 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) { + CARD_SETTLEMENT -> Known.CARD_SETTLEMENT + else -> throw IncreaseInvalidDataException("Unknown Type: $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(): Type = 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 /* spotless:off */ other is Type && value == other.value /* spotless:on */ + } - /** - * 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() + } - 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 /* spotless:off */ other is CardSettlement && id == other.id && amount == other.amount && cardAuthorization == other.cardAuthorization && 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 && pendingTransactionId == other.pendingTransactionId && presentmentAmount == other.presentmentAmount && presentmentCurrency == other.presentmentCurrency && purchaseDetails == other.purchaseDetails && transactionId == other.transactionId && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ + } - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, amount, cardAuthorization, cardPaymentId, cashback, currency, interchange, merchantAcceptorId, merchantCategoryCode, merchantCity, merchantCountry, merchantName, merchantPostalCode, merchantState, networkIdentifiers, pendingTransactionId, presentmentAmount, presentmentCurrency, purchaseDetails, transactionId, type, additionalProperties) } + /* spotless:on */ - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + override fun hashCode(): Int = hashCode - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + 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, networkIdentifiers=$networkIdentifiers, pendingTransactionId=$pendingTransactionId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, purchaseDetails=$purchaseDetails, transactionId=$transactionId, type=$type, additionalProperties=$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(), - ) - } + /** + * An Inbound Card Validation object. This field will be present in the JSON response if and + * only if `category` is equal to `card_validation`. Inbound Card Validations are requests + * from a merchant to verify that a card number and optionally its address and/or Card + * Verification Value are valid. + */ + class CardValidation + private constructor( + private val id: JsonField, + private val actioner: JsonField, + private val additionalAmounts: 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 terminalId: JsonField, + private val type: JsonField, + private val verification: JsonField, + private val additionalProperties: MutableMap, + ) { - private var validated: Boolean = false + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("actioner") + @ExcludeMissing + actioner: JsonField = JsonMissing.of(), + @JsonProperty("additional_amounts") + @ExcludeMissing + additionalAmounts: 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("terminal_id") + @ExcludeMissing + terminalId: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("verification") + @ExcludeMissing + verification: JsonField = JsonMissing.of(), + ) : this( + id, + actioner, + additionalAmounts, + cardPaymentId, + currency, + digitalWalletTokenId, + merchantAcceptorId, + merchantCategoryCode, + merchantCity, + merchantCountry, + merchantDescriptor, + merchantPostalCode, + merchantState, + networkDetails, + networkIdentifiers, + networkRiskScore, + physicalCardId, + realTimeDecisionId, + terminalId, + type, + verification, + mutableMapOf(), + ) - fun validate(): Travel = apply { - if (validated) { - return@apply - } + /** + * The Card Validation 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") - 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 - } + /** + * Whether this authorization was approved by Increase, the card network through + * stand-in processing, or the user through a real-time decision. + * + * @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 actioner(): Actioner = actioner.getRequired("actioner") - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * 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") - /** - * 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) + /** + * 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 transaction'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") - /** Ancillary purchases in addition to the airfare. */ - class Ancillary - 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, - ) { + /** + * 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") - @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(), - ) + /** + * 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") - /** - * 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" - ) + /** + * 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") - /** - * 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") + /** + * 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") - /** - * 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") + /** + * 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") - /** - * 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") + /** + * 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") - /** - * 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") + /** + * 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") - /** - * 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 + /** + * 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") - /** - * 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 + /** + * 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. + * + * @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") - /** - * 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 + /** + * 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") - /** - * 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 + /** + * 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") - /** - * 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 + /** + * 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") - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** + * A constant representing the object's type. For this resource it will always be + * `inbound_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 type(): Type = type.getRequired("type") - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** + * 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") - fun toBuilder() = Builder().from(this) + /** + * 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 - companion object { + /** + * Returns the raw JSON value of [actioner]. + * + * Unlike [actioner], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("actioner") + @ExcludeMissing + fun _actioner(): JsonField = actioner - /** - * 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 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 - /** A builder for [Ancillary]. */ - class Builder internal constructor() { + /** + * 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 - 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() + /** + * 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 - @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 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 - /** - * 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) - ) + /** + * 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 - /** - * Alias for calling [Builder.connectedTicketDocumentNumber] with - * `connectedTicketDocumentNumber.orElse(null)`. - */ - fun connectedTicketDocumentNumber( - connectedTicketDocumentNumber: Optional - ) = - connectedTicketDocumentNumber( - connectedTicketDocumentNumber.getOrNull() - ) + /** + * 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 - /** - * 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 - } + /** + * 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 - /** Indicates the reason for a credit to the cardholder. */ - fun creditReasonIndicator( - creditReasonIndicator: CreditReasonIndicator? - ) = creditReasonIndicator(JsonField.ofNullable(creditReasonIndicator)) + /** + * 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.creditReasonIndicator] with - * `creditReasonIndicator.orElse(null)`. - */ - fun creditReasonIndicator( - creditReasonIndicator: Optional - ) = creditReasonIndicator(creditReasonIndicator.getOrNull()) + /** + * 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 - /** - * 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 } + /** + * 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 - /** Name of the passenger or description of the ancillary purchase. */ - fun passengerNameOrDescription(passengerNameOrDescription: String?) = - passengerNameOrDescription( - JsonField.ofNullable(passengerNameOrDescription) - ) + /** + * 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 - /** - * Alias for calling [Builder.passengerNameOrDescription] with - * `passengerNameOrDescription.orElse(null)`. - */ - fun passengerNameOrDescription( - passengerNameOrDescription: Optional - ) = passengerNameOrDescription(passengerNameOrDescription.getOrNull()) + /** + * 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 - /** - * 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 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 - /** Additional travel charges, such as baggage fees. */ - fun services(services: List) = services(JsonField.of(services)) + /** + * 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 - /** - * 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() } - } + /** + * 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 - /** - * 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) - } - } + /** + * 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 - /** Ticket document number. */ - fun ticketDocumentNumber(ticketDocumentNumber: String?) = - ticketDocumentNumber(JsonField.ofNullable(ticketDocumentNumber)) + /** + * 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 - /** - * Alias for calling [Builder.ticketDocumentNumber] with - * `ticketDocumentNumber.orElse(null)`. - */ - fun ticketDocumentNumber(ticketDocumentNumber: Optional) = - ticketDocumentNumber(ticketDocumentNumber.getOrNull()) + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - /** - * 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 - } + @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 [CardValidation]. + * + * The following fields are required: + * ```java + * .id() + * .actioner() + * .additionalAmounts() + * .cardPaymentId() + * .currency() + * .digitalWalletTokenId() + * .merchantAcceptorId() + * .merchantCategoryCode() + * .merchantCity() + * .merchantCountry() + * .merchantDescriptor() + * .merchantPostalCode() + * .merchantState() + * .networkDetails() + * .networkIdentifiers() + * .networkRiskScore() + * .physicalCardId() + * .realTimeDecisionId() + * .terminalId() + * .type() + * .verification() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** A builder for [CardValidation]. */ + class Builder internal constructor() { - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + private var id: JsonField? = null + private var actioner: JsonField? = null + private var additionalAmounts: 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 terminalId: JsonField? = null + private var type: JsonField? = null + private var verification: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** - * 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(), - ) - } + @JvmSynthetic + internal fun from(cardValidation: CardValidation) = apply { + id = cardValidation.id + actioner = cardValidation.actioner + additionalAmounts = cardValidation.additionalAmounts + cardPaymentId = cardValidation.cardPaymentId + currency = cardValidation.currency + digitalWalletTokenId = cardValidation.digitalWalletTokenId + merchantAcceptorId = cardValidation.merchantAcceptorId + merchantCategoryCode = cardValidation.merchantCategoryCode + merchantCity = cardValidation.merchantCity + merchantCountry = cardValidation.merchantCountry + merchantDescriptor = cardValidation.merchantDescriptor + merchantPostalCode = cardValidation.merchantPostalCode + merchantState = cardValidation.merchantState + networkDetails = cardValidation.networkDetails + networkIdentifiers = cardValidation.networkIdentifiers + networkRiskScore = cardValidation.networkRiskScore + physicalCardId = cardValidation.physicalCardId + realTimeDecisionId = cardValidation.realTimeDecisionId + terminalId = cardValidation.terminalId + type = cardValidation.type + verification = cardValidation.verification + additionalProperties = cardValidation.additionalProperties.toMutableMap() + } - private var validated: Boolean = false + /** The Card Validation identifier. */ + fun id(id: String) = id(JsonField.of(id)) - fun validate(): Ancillary = apply { - if (validated) { - return@apply - } + /** + * 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 } - connectedTicketDocumentNumber() - creditReasonIndicator().ifPresent { it.validate() } - passengerNameOrDescription() - services().forEach { it.validate() } - ticketDocumentNumber() - validated = true - } + /** + * Whether this authorization was approved by Increase, the card network through + * stand-in processing, or the user through a real-time decision. + */ + fun actioner(actioner: Actioner) = actioner(JsonField.of(actioner)) - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * Sets [Builder.actioner] to an arbitrary JSON value. + * + * You should usually call [Builder.actioner] with a well-typed [Actioner] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun actioner(actioner: JsonField) = apply { this.actioner = actioner } - /** - * 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) + /** + * 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)) - /** Indicates the reason for a credit to the cardholder. */ - class CreditReasonIndicator - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** + * 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 + } - /** - * 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 ID of the Card Payment this transaction belongs to. */ + fun cardPaymentId(cardPaymentId: String) = + cardPaymentId(JsonField.of(cardPaymentId)) - companion object { + /** + * 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 + } - /** No credit */ - @JvmField val NO_CREDIT = of("no_credit") + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's + * currency. + */ + fun currency(currency: Currency) = currency(JsonField.of(currency)) - /** Passenger transport ancillary purchase cancellation */ - @JvmField - val PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = - of("passenger_transport_ancillary_purchase_cancellation") + /** + * 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 } - /** - * 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" - ) + /** + * 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)) - /** Other */ - @JvmField val OTHER = of("other") + /** + * Alias for calling [Builder.digitalWalletTokenId] with + * `digitalWalletTokenId.orElse(null)`. + */ + fun digitalWalletTokenId(digitalWalletTokenId: Optional) = + digitalWalletTokenId(digitalWalletTokenId.getOrNull()) - @JvmStatic - fun of(value: String) = CreditReasonIndicator(JsonField.of(value)) - } + /** + * 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 + } - /** 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, - } + /** + * 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 [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.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 + } - /** - * 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 - } + /** + * The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card + * is transacting with. + */ + fun merchantCategoryCode(merchantCategoryCode: String) = + merchantCategoryCode(JsonField.of(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) { - 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" - ) - } + /** + * 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 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 city the merchant resides in. */ + fun merchantCity(merchantCity: String?) = + merchantCity(JsonField.ofNullable(merchantCity)) - private var validated: Boolean = false + /** 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 + } - fun validate(): CreditReasonIndicator = apply { - if (validated) { - return@apply - } + /** The country the merchant resides in. */ + fun merchantCountry(merchantCountry: String) = + merchantCountry(JsonField.of(merchantCountry)) - known() - validated = true - } + /** + * 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 isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** The merchant descriptor of the merchant the card is transacting with. */ + fun merchantDescriptor(merchantDescriptor: String) = + merchantDescriptor(JsonField.of(merchantDescriptor)) - /** - * 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.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 + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * 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)) - return /* spotless:off */ other is CreditReasonIndicator && value == other.value /* spotless:on */ - } + /** + * Alias for calling [Builder.merchantPostalCode] with + * `merchantPostalCode.orElse(null)`. + */ + fun merchantPostalCode(merchantPostalCode: Optional) = + merchantPostalCode(merchantPostalCode.getOrNull()) - override fun hashCode() = value.hashCode() + /** + * 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 toString() = value.toString() - } + /** The state the merchant resides in. */ + fun merchantState(merchantState: String?) = + merchantState(JsonField.ofNullable(merchantState)) - class Service - private constructor( - private val category: JsonField, - private val subCategory: JsonField, - private val additionalProperties: MutableMap, - ) { + /** Alias for calling [Builder.merchantState] with `merchantState.orElse(null)`. */ + fun merchantState(merchantState: Optional) = + merchantState(merchantState.getOrNull()) - @JsonCreator - private constructor( - @JsonProperty("category") - @ExcludeMissing - category: JsonField = JsonMissing.of(), - @JsonProperty("sub_category") - @ExcludeMissing - subCategory: JsonField = JsonMissing.of(), - ) : this(category, subCategory, mutableMapOf()) + /** + * 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 + } - /** - * 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") + /** Fields specific to the `network`. */ + fun networkDetails(networkDetails: NetworkDetails) = + networkDetails(JsonField.of(networkDetails)) - /** - * 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") + /** + * 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 + } - /** - * 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 + /** Network-specific identifiers for a specific request or transaction. */ + fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) = + networkIdentifiers(JsonField.of(networkIdentifiers)) - /** - * 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 + /** + * 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 + } - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** + * 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. + */ + fun networkRiskScore(networkRiskScore: Long?) = + networkRiskScore(JsonField.ofNullable(networkRiskScore)) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** + * Alias for [Builder.networkRiskScore]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun networkRiskScore(networkRiskScore: Long) = + networkRiskScore(networkRiskScore as Long?) - fun toBuilder() = Builder().from(this) + /** + * Alias for calling [Builder.networkRiskScore] with + * `networkRiskScore.orElse(null)`. + */ + fun networkRiskScore(networkRiskScore: Optional) = + networkRiskScore(networkRiskScore.getOrNull()) - companion object { + /** + * 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 + } - /** - * Returns a mutable builder for constructing an instance of - * [Service]. - * - * The following fields are required: - * ```java - * .category() - * .subCategory() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + /** + * 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)) - /** A builder for [Service]. */ - class Builder internal constructor() { + /** + * Alias for calling [Builder.physicalCardId] with `physicalCardId.orElse(null)`. + */ + fun physicalCardId(physicalCardId: Optional) = + physicalCardId(physicalCardId.getOrNull()) - private var category: JsonField? = null - private var subCategory: JsonField? = null - private var additionalProperties: MutableMap = - mutableMapOf() + /** + * 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 + } - @JvmSynthetic - internal fun from(service: Service) = apply { - category = service.category - subCategory = service.subCategory - additionalProperties = - service.additionalProperties.toMutableMap() - } + /** + * The identifier of the Real-Time Decision sent to approve or decline this + * transaction. + */ + fun realTimeDecisionId(realTimeDecisionId: String?) = + realTimeDecisionId(JsonField.ofNullable(realTimeDecisionId)) - /** Category of the ancillary service. */ - fun category(category: Category?) = - category(JsonField.ofNullable(category)) + /** + * Alias for calling [Builder.realTimeDecisionId] with + * `realTimeDecisionId.orElse(null)`. + */ + fun realTimeDecisionId(realTimeDecisionId: Optional) = + realTimeDecisionId(realTimeDecisionId.getOrNull()) - /** - * Alias for calling [Builder.category] with - * `category.orElse(null)`. - */ - fun category(category: Optional) = - category(category.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 + } - /** - * 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 - } + /** + * The terminal identifier (commonly abbreviated as TID) of the terminal the card is + * transacting with. + */ + fun terminalId(terminalId: String?) = terminalId(JsonField.ofNullable(terminalId)) - /** Sub-category of the ancillary service, free-form. */ - fun subCategory(subCategory: String?) = - subCategory(JsonField.ofNullable(subCategory)) + /** Alias for calling [Builder.terminalId] with `terminalId.orElse(null)`. */ + fun terminalId(terminalId: Optional) = terminalId(terminalId.getOrNull()) - /** - * Alias for calling [Builder.subCategory] with - * `subCategory.orElse(null)`. - */ - fun subCategory(subCategory: Optional) = - subCategory(subCategory.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 + } - /** - * 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 - } + /** + * A constant representing the object's type. For this resource it will always be + * `inbound_card_validation`. + */ + fun type(type: Type) = type(JsonField.of(type)) - fun additionalProperties( - additionalProperties: Map - ) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** + * 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 } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** Fields related to verification of cardholder-provided values. */ + fun verification(verification: Verification) = + verification(JsonField.of(verification)) - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } + /** + * 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 removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * 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(), - ) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - private var validated: Boolean = false + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun validate(): Service = apply { - if (validated) { - return@apply - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - category().ifPresent { it.validate() } - subCategory() - validated = true - } + /** + * Returns an immutable instance of [CardValidation]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .actioner() + * .additionalAmounts() + * .cardPaymentId() + * .currency() + * .digitalWalletTokenId() + * .merchantAcceptorId() + * .merchantCategoryCode() + * .merchantCity() + * .merchantCountry() + * .merchantDescriptor() + * .merchantPostalCode() + * .merchantState() + * .networkDetails() + * .networkIdentifiers() + * .networkRiskScore() + * .physicalCardId() + * .realTimeDecisionId() + * .terminalId() + * .type() + * .verification() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CardValidation = + CardValidation( + checkRequired("id", id), + checkRequired("actioner", actioner), + checkRequired("additionalAmounts", additionalAmounts), + 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("terminalId", terminalId), + checkRequired("type", type), + checkRequired("verification", verification), + additionalProperties.toMutableMap(), + ) + } - 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 = - (category.asKnown().getOrNull()?.validity() ?: 0) + - (if (subCategory.asKnown().isPresent) 1 else 0) + fun validate(): CardValidation = apply { + if (validated) { + return@apply + } - /** Category of the ancillary service. */ - class Category - @JsonCreator - private constructor(private val value: JsonField) : Enum { + id() + actioner().validate() + additionalAmounts().validate() + cardPaymentId() + currency().validate() + digitalWalletTokenId() + merchantAcceptorId() + merchantCategoryCode() + merchantCity() + merchantCountry() + merchantDescriptor() + merchantPostalCode() + merchantState() + networkDetails().validate() + networkIdentifiers().validate() + networkRiskScore() + physicalCardId() + realTimeDecisionId() + terminalId() + type().validate() + verification().validate() + validated = 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 + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - companion object { + /** + * 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) + + (actioner.asKnown().getOrNull()?.validity() ?: 0) + + (additionalAmounts.asKnown().getOrNull()?.validity() ?: 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) + + (if (terminalId.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (verification.asKnown().getOrNull()?.validity() ?: 0) - /** None */ - @JvmField val NONE = of("none") + /** + * Whether this authorization was approved by Increase, the card network through + * stand-in processing, or the user through a real-time decision. + */ + class Actioner @JsonCreator private constructor(private val value: JsonField) : + Enum { - /** Bundled service */ - @JvmField val BUNDLED_SERVICE = of("bundled_service") + /** + * 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 - /** Baggage fee */ - @JvmField val BAGGAGE_FEE = of("baggage_fee") + companion object { - /** Change fee */ - @JvmField val CHANGE_FEE = of("change_fee") + /** This object was actioned by the user through a real-time decision. */ + @JvmField val USER = of("user") - /** Cargo */ - @JvmField val CARGO = of("cargo") + /** This object was actioned by Increase without user intervention. */ + @JvmField val INCREASE = of("increase") - /** Carbon offset */ - @JvmField val CARBON_OFFSET = of("carbon_offset") + /** This object was actioned by the network, through stand-in processing. */ + @JvmField val NETWORK = of("network") - /** Frequent flyer */ - @JvmField val FREQUENT_FLYER = of("frequent_flyer") + @JvmStatic fun of(value: String) = Actioner(JsonField.of(value)) + } - /** Gift card */ - @JvmField val GIFT_CARD = of("gift_card") + /** An enum containing [Actioner]'s known values. */ + enum class Known { + /** This object was actioned by the user through a real-time decision. */ + USER, + /** This object was actioned by Increase without user intervention. */ + INCREASE, + /** This object was actioned by the network, through stand-in processing. */ + NETWORK, + } - /** Ground transport */ - @JvmField val GROUND_TRANSPORT = of("ground_transport") + /** + * An enum containing [Actioner]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Actioner] 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 { + /** This object was actioned by the user through a real-time decision. */ + USER, + /** This object was actioned by Increase without user intervention. */ + INCREASE, + /** This object was actioned by the network, through stand-in processing. */ + NETWORK, + /** + * An enum member indicating that [Actioner] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } - /** In-flight entertainment */ - @JvmField - val IN_FLIGHT_ENTERTAINMENT = of("in_flight_entertainment") + /** + * 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) { + USER -> Value.USER + INCREASE -> Value.INCREASE + NETWORK -> Value.NETWORK + else -> Value._UNKNOWN + } - /** Lounge */ - @JvmField val LOUNGE = of("lounge") + /** + * 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) { + USER -> Known.USER + INCREASE -> Known.INCREASE + NETWORK -> Known.NETWORK + else -> throw IncreaseInvalidDataException("Unknown Actioner: $value") + } - /** Medical */ - @JvmField val MEDICAL = of("medical") + /** + * 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") + } - /** Meal beverage */ - @JvmField val MEAL_BEVERAGE = of("meal_beverage") + private var validated: Boolean = false - /** Other */ - @JvmField val OTHER = of("other") + fun validate(): Actioner = apply { + if (validated) { + return@apply + } - /** Passenger assist fee */ - @JvmField val PASSENGER_ASSIST_FEE = of("passenger_assist_fee") + known() + validated = true + } - /** Pets */ - @JvmField val PETS = of("pets") + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** Seat fees */ - @JvmField val SEAT_FEES = of("seat_fees") + /** + * 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 - /** Standby */ - @JvmField val STANDBY = of("standby") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** Service fee */ - @JvmField val SERVICE_FEE = of("service_fee") + return /* spotless:off */ other is Actioner && value == other.value /* spotless:on */ + } - /** Store */ - @JvmField val STORE = of("store") + override fun hashCode() = value.hashCode() - /** Travel service */ - @JvmField val TRAVEL_SERVICE = of("travel_service") + override fun toString() = value.toString() + } - /** Unaccompanied travel */ - @JvmField val UNACCOMPANIED_TRAVEL = of("unaccompanied_travel") + /** + * 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 + private constructor( + private val clinic: JsonField, + private val dental: 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, + ) { - /** Upgrades */ - @JvmField val UPGRADES = of("upgrades") + @JsonCreator + private constructor( + @JsonProperty("clinic") + @ExcludeMissing + clinic: JsonField = JsonMissing.of(), + @JsonProperty("dental") + @ExcludeMissing + dental: 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, + prescription, + surcharge, + totalCumulative, + totalHealthcare, + transit, + unknown, + vision, + mutableMapOf(), + ) - /** Wi-fi */ - @JvmField val WIFI = of("wifi") + /** + * 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") - @JvmStatic fun of(value: String) = Category(JsonField.of(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") - /** 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, - } + /** + * 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") - /** - * 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, - } + /** + * 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") - /** - * 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 - } + /** + * 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") - /** - * 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" - ) - } + /** + * 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") - /** - * 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 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") - private var validated: Boolean = false + /** + * 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") - fun validate(): Category = apply { - if (validated) { - return@apply - } + /** + * 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") - known() - validated = true - } + /** + * 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 - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * 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 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 [prescription]. + * + * Unlike [prescription], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("prescription") + @ExcludeMissing + fun _prescription(): JsonField = prescription - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * 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 - return /* spotless:off */ other is Category && value == other.value /* spotless:on */ - } + /** + * 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 - override fun hashCode() = value.hashCode() + /** + * 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 - override fun toString() = value.toString() - } + /** + * 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 - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * 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 - return /* spotless:off */ other is Service && category == other.category && subCategory == other.subCategory && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * 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 - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(category, subCategory, additionalProperties) } - /* spotless:on */ + @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 /* spotless:off */ other is Ancillary && connectedTicketDocumentNumber == other.connectedTicketDocumentNumber && creditReasonIndicator == other.creditReasonIndicator && passengerNameOrDescription == other.passengerNameOrDescription && services == other.services && ticketDocumentNumber == other.ticketDocumentNumber && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * Returns a mutable builder for constructing an instance of + * [AdditionalAmounts]. + * + * The following fields are required: + * ```java + * .clinic() + * .dental() + * .prescription() + * .surcharge() + * .totalCumulative() + * .totalHealthcare() + * .transit() + * .unknown() + * .vision() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(connectedTicketDocumentNumber, creditReasonIndicator, passengerNameOrDescription, services, ticketDocumentNumber, additionalProperties) } - /* spotless:on */ + /** A builder for [AdditionalAmounts]. */ + class Builder internal constructor() { - override fun hashCode(): Int = hashCode + private var clinic: JsonField? = null + private var dental: 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() - override fun toString() = - "Ancillary{connectedTicketDocumentNumber=$connectedTicketDocumentNumber, creditReasonIndicator=$creditReasonIndicator, passengerNameOrDescription=$passengerNameOrDescription, services=$services, ticketDocumentNumber=$ticketDocumentNumber, additionalProperties=$additionalProperties}" + @JvmSynthetic + internal fun from(additionalAmounts: AdditionalAmounts) = apply { + clinic = additionalAmounts.clinic + dental = additionalAmounts.dental + 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() } - /** Indicates the reason for a credit to the cardholder. */ - class CreditReasonIndicator - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** The part of this transaction amount that was for clinic-related services. */ + fun clinic(clinic: Clinic?) = clinic(JsonField.ofNullable(clinic)) - /** - * 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.clinic] with `clinic.orElse(null)`. */ + fun clinic(clinic: Optional) = clinic(clinic.getOrNull()) - companion object { + /** + * 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 } - /** No credit */ - @JvmField val NO_CREDIT = of("no_credit") + /** The part of this transaction amount that was for dental-related services. */ + fun dental(dental: Dental?) = dental(JsonField.ofNullable(dental)) - /** Passenger transport ancillary purchase cancellation */ - @JvmField - val PASSENGER_TRANSPORT_ANCILLARY_PURCHASE_CANCELLATION = - of("passenger_transport_ancillary_purchase_cancellation") + /** Alias for calling [Builder.dental] with `dental.orElse(null)`. */ + fun dental(dental: Optional) = dental(dental.getOrNull()) - /** - * 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" - ) + /** + * 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 } - /** Airline ticket cancellation */ - @JvmField - val AIRLINE_TICKET_CANCELLATION = of("airline_ticket_cancellation") + /** + * The part of this transaction amount that was for healthcare prescriptions. + */ + fun prescription(prescription: Prescription?) = + prescription(JsonField.ofNullable(prescription)) - /** Other */ - @JvmField val OTHER = of("other") + /** + * Alias for calling [Builder.prescription] with `prescription.orElse(null)`. + */ + fun prescription(prescription: Optional) = + prescription(prescription.getOrNull()) - /** Partial refund of airline ticket */ - @JvmField - val PARTIAL_REFUND_OF_AIRLINE_TICKET = - of("partial_refund_of_airline_ticket") + /** + * Sets [Builder.prescription] to an arbitrary JSON value. + * + * You should usually call [Builder.prescription] with a well-typed + * [Prescription] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun prescription(prescription: JsonField) = apply { + this.prescription = prescription + } - @JvmStatic - fun of(value: String) = CreditReasonIndicator(JsonField.of(value)) - } + /** The surcharge amount charged for this transaction by the merchant. */ + fun surcharge(surcharge: Surcharge?) = + surcharge(JsonField.ofNullable(surcharge)) - /** 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, - } + /** Alias for calling [Builder.surcharge] with `surcharge.orElse(null)`. */ + fun surcharge(surcharge: Optional) = surcharge(surcharge.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, - /** 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, - } + /** + * Sets [Builder.surcharge] to an arbitrary JSON value. + * + * You should usually call [Builder.surcharge] with a well-typed [Surcharge] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun surcharge(surcharge: JsonField) = apply { + this.surcharge = surcharge + } - /** - * 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 total amount of a series of incremental authorizations, optionally + * provided. + */ + fun totalCumulative(totalCumulative: TotalCumulative?) = + totalCumulative(JsonField.ofNullable(totalCumulative)) - /** - * 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" - ) - } + /** + * Alias for calling [Builder.totalCumulative] with + * `totalCumulative.orElse(null)`. + */ + fun totalCumulative(totalCumulative: Optional) = + totalCumulative(totalCumulative.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.totalCumulative] to an arbitrary JSON value. + * + * You should usually call [Builder.totalCumulative] with a well-typed + * [TotalCumulative] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun totalCumulative(totalCumulative: JsonField) = apply { + this.totalCumulative = totalCumulative + } - private var validated: Boolean = false + /** The total amount of healthcare-related additional amounts. */ + fun totalHealthcare(totalHealthcare: TotalHealthcare?) = + totalHealthcare(JsonField.ofNullable(totalHealthcare)) - fun validate(): CreditReasonIndicator = apply { - if (validated) { - return@apply - } + /** + * Alias for calling [Builder.totalHealthcare] with + * `totalHealthcare.orElse(null)`. + */ + fun totalHealthcare(totalHealthcare: Optional) = + totalHealthcare(totalHealthcare.getOrNull()) - known() - validated = true - } + /** + * Sets [Builder.totalHealthcare] to an arbitrary JSON value. + * + * You should usually call [Builder.totalHealthcare] with a well-typed + * [TotalHealthcare] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun totalHealthcare(totalHealthcare: JsonField) = apply { + this.totalHealthcare = totalHealthcare + } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + /** + * The part of this transaction amount that was for transit-related services. + */ + fun transit(transit: Transit?) = transit(JsonField.ofNullable(transit)) - /** - * 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.transit] with `transit.orElse(null)`. */ + fun transit(transit: Optional) = transit(transit.getOrNull()) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Sets [Builder.transit] to an arbitrary JSON value. + * + * You should usually call [Builder.transit] with a well-typed [Transit] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun transit(transit: JsonField) = apply { this.transit = transit } - return /* spotless:off */ other is CreditReasonIndicator && value == other.value /* spotless:on */ - } + /** An unknown additional amount. */ + fun unknown(unknown: Unknown?) = unknown(JsonField.ofNullable(unknown)) - override fun hashCode() = value.hashCode() + /** Alias for calling [Builder.unknown] with `unknown.orElse(null)`. */ + fun unknown(unknown: Optional) = unknown(unknown.getOrNull()) - override fun toString() = value.toString() - } + /** + * Sets [Builder.unknown] to an arbitrary JSON value. + * + * You should usually call [Builder.unknown] with a well-typed [Unknown] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun unknown(unknown: JsonField) = apply { this.unknown = unknown } - /** Indicates whether this ticket is non-refundable. */ - class RestrictedTicketIndicator - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** The part of this transaction amount that was for vision-related services. */ + fun vision(vision: Vision?) = vision(JsonField.ofNullable(vision)) - /** - * 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.vision] with `vision.orElse(null)`. */ + fun vision(vision: Optional) = vision(vision.getOrNull()) - companion object { + /** + * Sets [Builder.vision] to an arbitrary JSON value. + * + * You should usually call [Builder.vision] with a well-typed [Vision] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun vision(vision: JsonField) = apply { this.vision = vision } - /** 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 [AdditionalAmounts]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .clinic() + * .dental() + * .prescription() + * .surcharge() + * .totalCumulative() + * .totalHealthcare() + * .transit() + * .unknown() + * .vision() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): AdditionalAmounts = + AdditionalAmounts( + checkRequired("clinic", clinic), + checkRequired("dental", dental), + checkRequired("prescription", prescription), + checkRequired("surcharge", surcharge), + checkRequired("totalCumulative", totalCumulative), + checkRequired("totalHealthcare", totalHealthcare), + checkRequired("transit", transit), + checkRequired("unknown", unknown), + checkRequired("vision", vision), + 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 - /** - * 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(): AdditionalAmounts = apply { + if (validated) { + return@apply + } + + clinic().ifPresent { it.validate() } + dental().ifPresent { it.validate() } + prescription().ifPresent { it.validate() } + surcharge().ifPresent { it.validate() } + totalCumulative().ifPresent { it.validate() } + totalHealthcare().ifPresent { it.validate() } + transit().ifPresent { it.validate() } + unknown().ifPresent { it.validate() } + vision().ifPresent { it.validate() } + validated = true + } + + 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 = + (clinic.asKnown().getOrNull()?.validity() ?: 0) + + (dental.asKnown().getOrNull()?.validity() ?: 0) + + (prescription.asKnown().getOrNull()?.validity() ?: 0) + + (surcharge.asKnown().getOrNull()?.validity() ?: 0) + + (totalCumulative.asKnown().getOrNull()?.validity() ?: 0) + + (totalHealthcare.asKnown().getOrNull()?.validity() ?: 0) + + (transit.asKnown().getOrNull()?.validity() ?: 0) + + (unknown.asKnown().getOrNull()?.validity() ?: 0) + + (vision.asKnown().getOrNull()?.validity() ?: 0) + + /** The part of this transaction amount that was for clinic-related services. */ + class Clinic + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { - fun validate(): RestrictedTicketIndicator = apply { - if (validated) { - return@apply - } + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) - known() - validated = true - } + /** + * The amount in minor units of the `currency` field. + * + * @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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount'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(): String = currency.getRequired("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 (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 [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("currency") + @ExcludeMissing + fun _currency(): JsonField = currency - return /* spotless:off */ other is RestrictedTicketIndicator && value == other.value /* spotless:on */ - } + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - override fun hashCode() = value.hashCode() + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - override fun toString() = value.toString() - } + fun toBuilder() = Builder().from(this) - /** Indicates why a ticket was changed. */ - class TicketChangeIndicator - @JsonCreator - private constructor(private val value: JsonField) : Enum { + companion object { /** - * Returns this class instance's raw value. + * Returns a mutable builder for constructing an instance of [Clinic]. * - * 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. + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - /** None */ - @JvmField val NONE = of("none") + @JvmStatic fun builder() = Builder() + } - /** Change to existing ticket */ - @JvmField - val CHANGE_TO_EXISTING_TICKET = of("change_to_existing_ticket") + /** A builder for [Clinic]. */ + class Builder internal constructor() { - /** New ticket */ - @JvmField val NEW_TICKET = of("new_ticket") + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() - @JvmStatic - fun of(value: String) = TicketChangeIndicator(JsonField.of(value)) + @JvmSynthetic + internal fun from(clinic: Clinic) = apply { + amount = clinic.amount + currency = clinic.currency + additionalProperties = clinic.additionalProperties.toMutableMap() } - /** An enum containing [TicketChangeIndicator]'s known values. */ - enum class Known { - /** None */ - NONE, - /** Change to existing ticket */ - CHANGE_TO_EXISTING_TICKET, - /** New ticket */ - NEW_TICKET, - } + /** The amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) /** - * An enum containing [TicketChangeIndicator]'s known values, as well as an - * [_UNKNOWN] member. + * Sets [Builder.amount] 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.amount] with a well-typed [Long] 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 amount(amount: JsonField) = apply { this.amount = 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. + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. */ - 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 currency(currency: String) = 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. + * Sets [Builder.currency] to an arbitrary JSON value. * - * @throws IncreaseInvalidDataException if this class instance's value is a - * not a known member. + * You should usually call [Builder.currency] with a well-typed [String] + * 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 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") + 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 [Clinic]. * - * Used for best match union deserialization. + * 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. */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + fun build(): Clinic = + Clinic( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + private var validated: Boolean = false - return /* spotless:off */ other is TicketChangeIndicator && value == other.value /* spotless:on */ + fun validate(): Clinic = apply { + if (validated) { + return@apply } - override fun hashCode() = value.hashCode() + amount() + currency() + validated = true + } - override fun toString() = value.toString() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Clinic && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } - class TripLeg + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Clinic{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** The part of this transaction amount that was for dental-related services. */ + class Dental + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator 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, - ) { + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) - @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(), - ) + /** + * The amount in minor units of the `currency` field. + * + * @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") - /** - * 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 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount'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(): String = currency.getRequired("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). - */ - fun destinationCityAirportCode(): Optional = - destinationCityAirportCode.getOptional("destination_city_airport_code") + /** + * 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 - /** - * 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") + /** + * 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 - /** - * 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") + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - /** - * 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") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** - * 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") + fun toBuilder() = Builder().from(this) - /** - * 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 + companion object { /** - * Returns the raw JSON value of [destinationCityAirportCode]. + * Returns a mutable builder for constructing an instance of [Dental]. * - * Unlike [destinationCityAirportCode], this method doesn't throw if the - * JSON field has an unexpected type. + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` */ - @JsonProperty("destination_city_airport_code") - @ExcludeMissing - fun _destinationCityAirportCode(): JsonField = - destinationCityAirportCode + @JvmStatic fun builder() = Builder() + } - /** - * 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 + /** A builder for [Dental]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(dental: Dental) = apply { + amount = dental.amount + currency = dental.currency + additionalProperties = dental.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) /** - * Returns the raw JSON value of [flightNumber]. + * Sets [Builder.amount] to an arbitrary JSON value. * - * Unlike [flightNumber], 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("flight_number") - @ExcludeMissing - fun _flightNumber(): JsonField = flightNumber + fun amount(amount: JsonField) = apply { this.amount = amount } /** - * Returns the raw JSON value of [serviceClass]. - * - * Unlike [serviceClass], 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 + * additional amount's currency. */ - @JsonProperty("service_class") - @ExcludeMissing - fun _serviceClass(): JsonField = serviceClass + fun currency(currency: String) = currency(JsonField.of(currency)) /** - * Returns the raw JSON value of [stopOverCode]. + * Sets [Builder.currency] to an arbitrary JSON value. * - * Unlike [stopOverCode], this method doesn't throw if the JSON field has an - * unexpected type. + * You should usually call [Builder.currency] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ - @JsonProperty("stop_over_code") - @ExcludeMissing - fun _stopOverCode(): JsonField = stopOverCode + fun currency(currency: JsonField) = apply { + this.currency = currency + } - @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 [TripLeg]. - * - * The following fields are required: - * ```java - * .carrierCode() - * .destinationCityAirportCode() - * .fareBasisCode() - * .flightNumber() - * .serviceClass() - * .stopOverCode() - * ``` - */ - @JvmStatic fun builder() = Builder() + /** + * Returns an immutable instance of [Dental]. + * + * 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(): Dental = + Dental( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Dental = apply { + if (validated) { + return@apply } - /** A builder for [TripLeg]. */ - class Builder internal constructor() { + amount() + currency() + validated = true + } - 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() + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - @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() - } + /** + * 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 (currency.asKnown().isPresent) 1 else 0) - /** Carrier code (e.g., United Airlines, Jet Blue, etc.). */ - fun carrierCode(carrierCode: String?) = - carrierCode(JsonField.ofNullable(carrierCode)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Alias for calling [Builder.carrierCode] with - * `carrierCode.orElse(null)`. - */ - fun carrierCode(carrierCode: Optional) = - carrierCode(carrierCode.getOrNull()) + return /* spotless:off */ other is Dental && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * 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 - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ - /** Code for the destination city or airport. */ - fun destinationCityAirportCode(destinationCityAirportCode: String?) = - destinationCityAirportCode( - JsonField.ofNullable(destinationCityAirportCode) - ) + override fun hashCode(): Int = hashCode - /** - * Alias for calling [Builder.destinationCityAirportCode] with - * `destinationCityAirportCode.orElse(null)`. - */ - fun destinationCityAirportCode( - destinationCityAirportCode: Optional - ) = destinationCityAirportCode(destinationCityAirportCode.getOrNull()) + override fun toString() = + "Dental{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } - /** - * 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 - } + /** The part of this transaction amount that was for healthcare prescriptions. */ + class Prescription + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { - /** Fare basis code. */ - fun fareBasisCode(fareBasisCode: String?) = - fareBasisCode(JsonField.ofNullable(fareBasisCode)) + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) - /** - * Alias for calling [Builder.fareBasisCode] with - * `fareBasisCode.orElse(null)`. - */ - fun fareBasisCode(fareBasisCode: Optional) = - fareBasisCode(fareBasisCode.getOrNull()) + /** + * The amount in minor units of the `currency` field. + * + * @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.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 - } + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount'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(): String = currency.getRequired("currency") - /** Flight number. */ - fun flightNumber(flightNumber: String?) = - flightNumber(JsonField.ofNullable(flightNumber)) + /** + * 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 calling [Builder.flightNumber] with - * `flightNumber.orElse(null)`. - */ - fun flightNumber(flightNumber: Optional) = - flightNumber(flightNumber.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.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 - } + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - /** Service class (e.g., first class, business class, etc.). */ - fun serviceClass(serviceClass: String?) = - serviceClass(JsonField.ofNullable(serviceClass)) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** - * Alias for calling [Builder.serviceClass] with - * `serviceClass.orElse(null)`. - */ - fun serviceClass(serviceClass: Optional) = - serviceClass(serviceClass.getOrNull()) + fun toBuilder() = Builder().from(this) - /** - * 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 - } + companion object { - /** Indicates whether a stopover is allowed on this ticket. */ - fun stopOverCode(stopOverCode: StopOverCode?) = - stopOverCode(JsonField.ofNullable(stopOverCode)) + /** + * Returns a mutable builder for constructing an instance of [Prescription]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - /** - * Alias for calling [Builder.stopOverCode] with - * `stopOverCode.orElse(null)`. - */ - fun stopOverCode(stopOverCode: Optional) = - stopOverCode(stopOverCode.getOrNull()) + /** A builder for [Prescription]. */ + class Builder internal constructor() { - /** - * 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 - } + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() - fun additionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + @JvmSynthetic + internal fun from(prescription: Prescription) = apply { + amount = prescription.amount + currency = prescription.currency + additionalProperties = prescription.additionalProperties.toMutableMap() + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** The amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(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 } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: JsonField) = apply { + this.currency = currency + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) } - /** - * 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(), - ) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } - private var validated: Boolean = false - - fun validate(): TripLeg = apply { - if (validated) { - return@apply - } + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } - carrierCode() - destinationCityAirportCode() - fareBasisCode() - flightNumber() - serviceClass() - stopOverCode().ifPresent { it.validate() } - 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 [Prescription]. * - * Used for best match union deserialization. + * 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. */ - @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) + fun build(): Prescription = + Prescription( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } - /** Indicates whether a stopover is allowed on this ticket. */ - class StopOverCode - @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(): Prescription = apply { + if (validated) { + return@apply + } - companion object { + amount() + currency() + validated = true + } - /** None */ - @JvmField val NONE = of("none") + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** Stop over allowed */ - @JvmField val STOP_OVER_ALLOWED = of("stop_over_allowed") + /** + * 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 (currency.asKnown().isPresent) 1 else 0) - /** Stop over not allowed */ - @JvmField val STOP_OVER_NOT_ALLOWED = of("stop_over_not_allowed") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmStatic fun of(value: String) = StopOverCode(JsonField.of(value)) - } + return /* spotless:off */ other is Prescription && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** 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, - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ - /** - * 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, - } + 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 - STOP_OVER_ALLOWED -> Value.STOP_OVER_ALLOWED - STOP_OVER_NOT_ALLOWED -> Value.STOP_OVER_NOT_ALLOWED - else -> Value._UNKNOWN - } + override fun toString() = + "Prescription{amount=$amount, currency=$currency, 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 - STOP_OVER_ALLOWED -> Known.STOP_OVER_ALLOWED - STOP_OVER_NOT_ALLOWED -> Known.STOP_OVER_NOT_ALLOWED - else -> - throw IncreaseInvalidDataException( - "Unknown StopOverCode: $value" - ) - } + /** The surcharge amount charged for this transaction by the merchant. */ + class Surcharge + private constructor( + private val amount: JsonField, + private val currency: 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("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) + + /** + * The amount in minor units of the `currency` field. + * + * @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 + * additional amount'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(): String = 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) + } - private var validated: Boolean = false + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - fun validate(): StopOverCode = 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 [Surcharge]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @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 [Surcharge]. */ + class Builder internal constructor() { - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() - return /* spotless:off */ other is StopOverCode && value == other.value /* spotless:on */ - } + @JvmSynthetic + internal fun from(surcharge: Surcharge) = apply { + amount = surcharge.amount + currency = surcharge.currency + additionalProperties = surcharge.additionalProperties.toMutableMap() + } - override fun hashCode() = value.hashCode() + /** The amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) - override fun toString() = value.toString() + /** + * 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: JsonField) = apply { + this.currency = currency } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) } - return /* spotless:off */ other is TripLeg && carrierCode == other.carrierCode && destinationCityAirportCode == other.destinationCityAirportCode && fareBasisCode == other.fareBasisCode && flightNumber == other.flightNumber && serviceClass == other.serviceClass && stopOverCode == other.stopOverCode && additionalProperties == other.additionalProperties /* spotless:on */ + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(carrierCode, destinationCityAirportCode, fareBasisCode, flightNumber, serviceClass, stopOverCode, additionalProperties) } - /* spotless:on */ + 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() = - "TripLeg{carrierCode=$carrierCode, destinationCityAirportCode=$destinationCityAirportCode, fareBasisCode=$fareBasisCode, flightNumber=$flightNumber, serviceClass=$serviceClass, stopOverCode=$stopOverCode, additionalProperties=$additionalProperties}" + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Surcharge]. + * + * 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(): Surcharge = + Surcharge( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Surcharge = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ 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 /* spotless:on */ + return /* spotless:off */ other is Surcharge && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(ancillary, computerizedReservationSystem, creditReasonIndicator, departureDate, originationCityAirportCode, passengerName, restrictedTicketIndicator, ticketChangeIndicator, ticketNumber, travelAgencyCode, travelAgencyName, tripLegs, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } /* spotless:on */ 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 /* spotless:off */ 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 /* spotless:on */ + "Surcharge{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(carRental, customerReferenceIdentifier, localTaxAmount, localTaxCurrency, lodging, nationalTaxAmount, nationalTaxCurrency, purchaseIdentifier, purchaseIdentifierFormat, travel, additionalProperties) } - /* spotless:on */ - - 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}" - } - - /** - * A constant representing the object's type. For this resource it will always be - * `card_settlement`. - */ - 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. + * The total amount of a series of incremental authorizations, optionally provided. */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + class TotalCumulative + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { - companion object { + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) - @JvmField val CARD_SETTLEMENT = of("card_settlement") + /** + * The amount in minor units of the `currency` field. + * + * @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") - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount'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(): String = currency.getRequired("currency") - /** An enum containing [Type]'s known values. */ - enum class Known { - CARD_SETTLEMENT - } + /** + * 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 - /** - * 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_SETTLEMENT, /** - * An enum member indicating that [Type] was instantiated with an unknown value. + * Returns the raw JSON value of [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an + * unexpected type. */ - _UNKNOWN, - } + @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. - * - * 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_SETTLEMENT -> Value.CARD_SETTLEMENT - 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_SETTLEMENT -> Known.CARD_SETTLEMENT - else -> throw IncreaseInvalidDataException("Unknown Type: $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(): Type = apply { - if (validated) { - return@apply + /** + * Returns a mutable builder for constructing an instance of + * [TotalCumulative]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() } - known() - validated = true - } + /** A builder for [TotalCumulative]. */ + class Builder internal constructor() { - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + private var amount: JsonField? = null + private var currency: 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(totalCumulative: TotalCumulative) = apply { + amount = totalCumulative.amount + currency = totalCumulative.currency + additionalProperties = + totalCumulative.additionalProperties.toMutableMap() + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** The amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } + /** + * 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 } - override fun hashCode() = value.hashCode() + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) - override fun toString() = value.toString() - } + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: JsonField) = apply { + this.currency = currency + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - return /* spotless:off */ other is CardSettlement && id == other.id && amount == other.amount && cardAuthorization == other.cardAuthorization && 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 && pendingTransactionId == other.pendingTransactionId && presentmentAmount == other.presentmentAmount && presentmentCurrency == other.presentmentCurrency && purchaseDetails == other.purchaseDetails && transactionId == other.transactionId && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, amount, cardAuthorization, cardPaymentId, cashback, currency, interchange, merchantAcceptorId, merchantCategoryCode, merchantCity, merchantCountry, merchantName, merchantPostalCode, merchantState, networkIdentifiers, pendingTransactionId, presentmentAmount, presentmentCurrency, purchaseDetails, transactionId, type, additionalProperties) } - /* spotless:on */ + 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() = - "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, networkIdentifiers=$networkIdentifiers, pendingTransactionId=$pendingTransactionId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, purchaseDetails=$purchaseDetails, transactionId=$transactionId, type=$type, additionalProperties=$additionalProperties}" - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * An Inbound Card Validation object. This field will be present in the JSON response if and - * only if `category` is equal to `card_validation`. Inbound Card Validations are requests - * from a merchant to verify that a card number and optionally its address and/or Card - * Verification Value are valid. - */ - class CardValidation - private constructor( - private val id: JsonField, - private val actioner: 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 terminalId: JsonField, - private val type: JsonField, - private val verification: JsonField, - private val additionalProperties: MutableMap, - ) { + /** + * Returns an immutable instance of [TotalCumulative]. + * + * 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(): TotalCumulative = + TotalCumulative( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("actioner") - @ExcludeMissing - actioner: 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("terminal_id") - @ExcludeMissing - terminalId: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - @JsonProperty("verification") - @ExcludeMissing - verification: JsonField = JsonMissing.of(), - ) : this( - id, - actioner, - cardPaymentId, - currency, - digitalWalletTokenId, - merchantAcceptorId, - merchantCategoryCode, - merchantCity, - merchantCountry, - merchantDescriptor, - merchantPostalCode, - merchantState, - networkDetails, - networkIdentifiers, - networkRiskScore, - physicalCardId, - realTimeDecisionId, - terminalId, - type, - verification, - mutableMapOf(), - ) + private var validated: Boolean = false + + fun validate(): TotalCumulative = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is TotalCumulative && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ - /** - * The Card Validation 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 hashCode(): Int = hashCode - /** - * Whether this authorization was approved by Increase, the card network through - * stand-in processing, or the user through a real-time decision. - * - * @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 actioner(): Actioner = actioner.getRequired("actioner") + override fun toString() = + "TotalCumulative{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } - /** - * 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 total amount of healthcare-related additional amounts. */ + class TotalHealthcare + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction'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") + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) - /** - * 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 amount in minor units of the `currency` field. + * + * @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 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount'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(): String = currency.getRequired("currency") - /** - * 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") + /** + * 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 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") + /** + * 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 - /** - * 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") + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - /** - * 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") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** - * 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") + fun toBuilder() = Builder().from(this) - /** - * 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") + companion object { - /** - * 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") + /** + * Returns a mutable builder for constructing an instance of + * [TotalHealthcare]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - /** - * 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") + /** A builder for [TotalHealthcare]. */ + class Builder internal constructor() { - /** - * 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. - * - * @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") + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() - /** - * 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") + @JvmSynthetic + internal fun from(totalHealthcare: TotalHealthcare) = apply { + amount = totalHealthcare.amount + currency = totalHealthcare.currency + additionalProperties = + totalHealthcare.additionalProperties.toMutableMap() + } - /** - * 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 amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) - /** - * 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") + /** + * 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 } - /** - * A constant representing the object's type. For this resource it will always be - * `inbound_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 type(): Type = type.getRequired("type") + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) - /** - * 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") + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: JsonField) = apply { + this.currency = currency + } - /** - * 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 + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * Returns the raw JSON value of [actioner]. - * - * Unlike [actioner], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("actioner") - @ExcludeMissing - fun _actioner(): JsonField = actioner + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * 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 + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(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 + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * 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 + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * 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 an immutable instance of [TotalHealthcare]. + * + * 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(): TotalHealthcare = + TotalHealthcare( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } - /** - * 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 + private var validated: Boolean = false - /** - * 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 + fun validate(): TotalHealthcare = apply { + if (validated) { + return@apply + } - /** - * 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 + amount() + currency() + validated = true + } - /** - * 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 + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * 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 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 (currency.asKnown().isPresent) 1 else 0) - /** - * 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 + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * 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 + return /* spotless:off */ other is TotalHealthcare && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * 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 + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ - /** - * 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 + override fun hashCode(): Int = hashCode - /** - * 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 + override fun toString() = + "TotalHealthcare{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } - /** - * 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 + /** The part of this transaction amount that was for transit-related services. */ + class Transit + 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 amount in minor units of the `currency` field. + * + * @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 + * additional amount'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(): String = 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 [Transit]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Transit]. */ + class Builder internal constructor() { - /** - * 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 + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + 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 + @JvmSynthetic + internal fun from(transit: Transit) = apply { + amount = transit.amount + currency = transit.currency + additionalProperties = transit.additionalProperties.toMutableMap() + } - /** - * 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 + /** The amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** + * 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 } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) - fun toBuilder() = Builder().from(this) + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: JsonField) = apply { + this.currency = currency + } - companion object { + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * Returns a mutable builder for constructing an instance of [CardValidation]. - * - * The following fields are required: - * ```java - * .id() - * .actioner() - * .cardPaymentId() - * .currency() - * .digitalWalletTokenId() - * .merchantAcceptorId() - * .merchantCategoryCode() - * .merchantCity() - * .merchantCountry() - * .merchantDescriptor() - * .merchantPostalCode() - * .merchantState() - * .networkDetails() - * .networkIdentifiers() - * .networkRiskScore() - * .physicalCardId() - * .realTimeDecisionId() - * .terminalId() - * .type() - * .verification() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** A builder for [CardValidation]. */ - class Builder internal constructor() { + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } - private var id: JsonField? = null - private var actioner: 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 terminalId: JsonField? = null - private var type: JsonField? = null - private var verification: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - @JvmSynthetic - internal fun from(cardValidation: CardValidation) = apply { - id = cardValidation.id - actioner = cardValidation.actioner - cardPaymentId = cardValidation.cardPaymentId - currency = cardValidation.currency - digitalWalletTokenId = cardValidation.digitalWalletTokenId - merchantAcceptorId = cardValidation.merchantAcceptorId - merchantCategoryCode = cardValidation.merchantCategoryCode - merchantCity = cardValidation.merchantCity - merchantCountry = cardValidation.merchantCountry - merchantDescriptor = cardValidation.merchantDescriptor - merchantPostalCode = cardValidation.merchantPostalCode - merchantState = cardValidation.merchantState - networkDetails = cardValidation.networkDetails - networkIdentifiers = cardValidation.networkIdentifiers - networkRiskScore = cardValidation.networkRiskScore - physicalCardId = cardValidation.physicalCardId - realTimeDecisionId = cardValidation.realTimeDecisionId - terminalId = cardValidation.terminalId - type = cardValidation.type - verification = cardValidation.verification - additionalProperties = cardValidation.additionalProperties.toMutableMap() - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** The Card Validation identifier. */ - fun id(id: String) = id(JsonField.of(id)) + /** + * Returns an immutable instance of [Transit]. + * + * 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(): Transit = + Transit( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } - /** - * 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 } + private var validated: Boolean = false - /** - * Whether this authorization was approved by Increase, the card network through - * stand-in processing, or the user through a real-time decision. - */ - fun actioner(actioner: Actioner) = actioner(JsonField.of(actioner)) + fun validate(): Transit = apply { + if (validated) { + return@apply + } - /** - * Sets [Builder.actioner] to an arbitrary JSON value. - * - * You should usually call [Builder.actioner] with a well-typed [Actioner] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun actioner(actioner: JsonField) = apply { this.actioner = actioner } + amount() + currency() + validated = true + } - /** The ID of the Card Payment this transaction belongs to. */ - fun cardPaymentId(cardPaymentId: String) = - cardPaymentId(JsonField.of(cardPaymentId)) + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * 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 - } + /** + * 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 (currency.asKnown().isPresent) 1 else 0) - /** - * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's - * currency. - */ - fun currency(currency: Currency) = currency(JsonField.of(currency)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * 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 } + return /* spotless:off */ other is Transit && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * 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)) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ - /** - * Alias for calling [Builder.digitalWalletTokenId] with - * `digitalWalletTokenId.orElse(null)`. - */ - fun digitalWalletTokenId(digitalWalletTokenId: Optional) = - digitalWalletTokenId(digitalWalletTokenId.getOrNull()) + override fun hashCode(): Int = hashCode - /** - * 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 + override fun toString() = + "Transit{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" } - /** - * The merchant identifier (commonly abbreviated as MID) of the merchant the card is - * transacting with. - */ - fun merchantAcceptorId(merchantAcceptorId: String) = - merchantAcceptorId(JsonField.of(merchantAcceptorId)) + /** An unknown additional amount. */ + class Unknown + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { - /** - * 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 - } + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) - /** - * The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card - * is transacting with. - */ - fun merchantCategoryCode(merchantCategoryCode: String) = - merchantCategoryCode(JsonField.of(merchantCategoryCode)) + /** + * The amount in minor units of the `currency` field. + * + * @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.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 + * additional amount'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(): String = currency.getRequired("currency") - /** The city the merchant resides in. */ - fun merchantCity(merchantCity: String?) = - merchantCity(JsonField.ofNullable(merchantCity)) + /** + * 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 calling [Builder.merchantCity] with `merchantCity.orElse(null)`. */ - fun merchantCity(merchantCity: Optional) = - merchantCity(merchantCity.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.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 - } + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - /** The country the merchant resides in. */ - fun merchantCountry(merchantCountry: String) = - merchantCountry(JsonField.of(merchantCountry)) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** - * 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 toBuilder() = Builder().from(this) - /** The merchant descriptor of the merchant the card is transacting with. */ - fun merchantDescriptor(merchantDescriptor: String) = - merchantDescriptor(JsonField.of(merchantDescriptor)) + companion object { - /** - * 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 - } + /** + * Returns a mutable builder for constructing an instance of [Unknown]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - /** - * 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)) + /** A builder for [Unknown]. */ + class Builder internal constructor() { - /** - * Alias for calling [Builder.merchantPostalCode] with - * `merchantPostalCode.orElse(null)`. - */ - fun merchantPostalCode(merchantPostalCode: Optional) = - merchantPostalCode(merchantPostalCode.getOrNull()) + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() - /** - * 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 - } + @JvmSynthetic + internal fun from(unknown: Unknown) = apply { + amount = unknown.amount + currency = unknown.currency + additionalProperties = unknown.additionalProperties.toMutableMap() + } - /** The state the merchant resides in. */ - fun merchantState(merchantState: String?) = - merchantState(JsonField.ofNullable(merchantState)) + /** The amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) - /** Alias for calling [Builder.merchantState] with `merchantState.orElse(null)`. */ - fun merchantState(merchantState: Optional) = - merchantState(merchantState.getOrNull()) + /** + * 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 } - /** - * 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) - /** Fields specific to the `network`. */ - fun networkDetails(networkDetails: NetworkDetails) = - networkDetails(JsonField.of(networkDetails)) + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: JsonField) = apply { + this.currency = currency + } - /** - * 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 - } + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** Network-specific identifiers for a specific request or transaction. */ - fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) = - networkIdentifiers(JsonField.of(networkIdentifiers)) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * 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 - } + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } - /** - * 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. - */ - fun networkRiskScore(networkRiskScore: Long?) = - networkRiskScore(JsonField.ofNullable(networkRiskScore)) + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * Alias for [Builder.networkRiskScore]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun networkRiskScore(networkRiskScore: Long) = - networkRiskScore(networkRiskScore as Long?) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * Alias for calling [Builder.networkRiskScore] with - * `networkRiskScore.orElse(null)`. - */ - fun networkRiskScore(networkRiskScore: Optional) = - networkRiskScore(networkRiskScore.getOrNull()) + /** + * Returns an immutable instance of [Unknown]. + * + * 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(): Unknown = + Unknown( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } - /** - * 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 - } + private var validated: Boolean = false - /** - * 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)) + fun validate(): Unknown = apply { + if (validated) { + return@apply + } - /** - * Alias for calling [Builder.physicalCardId] with `physicalCardId.orElse(null)`. - */ - fun physicalCardId(physicalCardId: Optional) = - physicalCardId(physicalCardId.getOrNull()) + amount() + currency() + validated = true + } - /** - * 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 - } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - /** - * The identifier of the Real-Time Decision sent to approve or decline this - * transaction. - */ - fun realTimeDecisionId(realTimeDecisionId: String?) = - realTimeDecisionId(JsonField.ofNullable(realTimeDecisionId)) + /** + * 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 (currency.asKnown().isPresent) 1 else 0) - /** - * Alias for calling [Builder.realTimeDecisionId] with - * `realTimeDecisionId.orElse(null)`. - */ - fun realTimeDecisionId(realTimeDecisionId: Optional) = - realTimeDecisionId(realTimeDecisionId.getOrNull()) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * 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 - } + return /* spotless:off */ other is Unknown && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * The terminal identifier (commonly abbreviated as TID) of the terminal the card is - * transacting with. - */ - fun terminalId(terminalId: String?) = terminalId(JsonField.ofNullable(terminalId)) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ - /** Alias for calling [Builder.terminalId] with `terminalId.orElse(null)`. */ - fun terminalId(terminalId: Optional) = terminalId(terminalId.getOrNull()) + override fun hashCode(): Int = hashCode - /** - * 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 + override fun toString() = + "Unknown{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" } - /** - * A constant representing the object's type. For this resource it will always be - * `inbound_card_validation`. - */ - fun type(type: Type) = type(JsonField.of(type)) + /** The part of this transaction amount that was for vision-related services. */ + class Vision + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { - /** - * 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 } + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) - /** Fields related to verification of cardholder-provided values. */ - fun verification(verification: Verification) = - verification(JsonField.of(verification)) + /** + * The amount in minor units of the `currency` field. + * + * @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.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 - } + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount'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(): String = currency.getRequired("currency") - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** + * 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 - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, 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 - 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) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** - * Returns an immutable instance of [CardValidation]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .actioner() - * .cardPaymentId() - * .currency() - * .digitalWalletTokenId() - * .merchantAcceptorId() - * .merchantCategoryCode() - * .merchantCity() - * .merchantCountry() - * .merchantDescriptor() - * .merchantPostalCode() - * .merchantState() - * .networkDetails() - * .networkIdentifiers() - * .networkRiskScore() - * .physicalCardId() - * .realTimeDecisionId() - * .terminalId() - * .type() - * .verification() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CardValidation = - CardValidation( - checkRequired("id", id), - checkRequired("actioner", actioner), - 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("terminalId", terminalId), - checkRequired("type", type), - checkRequired("verification", verification), - additionalProperties.toMutableMap(), - ) - } + fun toBuilder() = Builder().from(this) - private var validated: Boolean = false + companion object { - fun validate(): CardValidation = apply { - if (validated) { - return@apply - } + /** + * Returns a mutable builder for constructing an instance of [Vision]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - id() - actioner().validate() - cardPaymentId() - currency().validate() - digitalWalletTokenId() - merchantAcceptorId() - merchantCategoryCode() - merchantCity() - merchantCountry() - merchantDescriptor() - merchantPostalCode() - merchantState() - networkDetails().validate() - networkIdentifiers().validate() - networkRiskScore() - physicalCardId() - realTimeDecisionId() - terminalId() - type().validate() - verification().validate() - validated = true - } + /** A builder for [Vision]. */ + class Builder internal constructor() { - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false - } + private var amount: JsonField? = null + private var currency: 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 (id.asKnown().isPresent) 1 else 0) + - (actioner.asKnown().getOrNull()?.validity() ?: 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) + - (if (terminalId.asKnown().isPresent) 1 else 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) + - (verification.asKnown().getOrNull()?.validity() ?: 0) + @JvmSynthetic + internal fun from(vision: Vision) = apply { + amount = vision.amount + currency = vision.currency + additionalProperties = vision.additionalProperties.toMutableMap() + } - /** - * Whether this authorization was approved by Increase, the card network through - * stand-in processing, or the user through a real-time decision. - */ - class Actioner @JsonCreator private constructor(private val value: JsonField) : - Enum { + /** The amount in minor units of the `currency` field. */ + fun amount(amount: Long) = amount(JsonField.of(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 + /** + * 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 } - companion object { + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) - /** This object was actioned by the user through a real-time decision. */ - @JvmField val USER = of("user") + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: JsonField) = apply { + this.currency = currency + } - /** This object was actioned by Increase without user intervention. */ - @JvmField val INCREASE = of("increase") + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** This object was actioned by the network, through stand-in processing. */ - @JvmField val NETWORK = of("network") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - @JvmStatic fun of(value: String) = Actioner(JsonField.of(value)) - } + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } - /** An enum containing [Actioner]'s known values. */ - enum class Known { - /** This object was actioned by the user through a real-time decision. */ - USER, - /** This object was actioned by Increase without user intervention. */ - INCREASE, - /** This object was actioned by the network, through stand-in processing. */ - NETWORK, - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * An enum containing [Actioner]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Actioner] 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 { - /** This object was actioned by the user through a real-time decision. */ - USER, - /** This object was actioned by Increase without user intervention. */ - INCREASE, - /** This object was actioned by the network, through stand-in processing. */ - NETWORK, - /** - * An enum member indicating that [Actioner] 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) { - USER -> Value.USER - INCREASE -> Value.INCREASE - NETWORK -> Value.NETWORK - else -> Value._UNKNOWN + /** + * Returns an immutable instance of [Vision]. + * + * 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(): Vision = + Vision( + checkRequired("amount", amount), + checkRequired("currency", currency), + 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) { - USER -> Known.USER - INCREASE -> Known.INCREASE - NETWORK -> Known.NETWORK - else -> throw IncreaseInvalidDataException("Unknown Actioner: $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(): Vision = apply { + if (validated) { + return@apply + } + + amount() + currency() + validated = true } - private var validated: Boolean = false + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } - fun validate(): Actioner = 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 (amount.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) - 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 /* spotless:off */ other is Vision && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } - /** - * 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 + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Vision{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is Actioner && value == other.value /* spotless:on */ + return /* spotless:off */ other is AdditionalAmounts && clinic == other.clinic && dental == other.dental && prescription == other.prescription && surcharge == other.surcharge && totalCumulative == other.totalCumulative && totalHealthcare == other.totalHealthcare && transit == other.transit && unknown == other.unknown && vision == other.vision && additionalProperties == other.additionalProperties /* spotless:on */ } - override fun hashCode() = value.hashCode() + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(clinic, dental, prescription, surcharge, totalCumulative, totalHealthcare, transit, unknown, vision, additionalProperties) } + /* spotless:on */ - override fun toString() = value.toString() + override fun hashCode(): Int = hashCode + + override fun toString() = + "AdditionalAmounts{clinic=$clinic, dental=$dental, prescription=$prescription, surcharge=$surcharge, totalCumulative=$totalCumulative, totalHealthcare=$totalHealthcare, transit=$transit, unknown=$unknown, vision=$vision, additionalProperties=$additionalProperties}" } /** @@ -43852,17 +54269,17 @@ private constructor( return true } - return /* spotless:off */ other is CardValidation && id == other.id && actioner == other.actioner && 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 /* spotless:on */ + return /* spotless:off */ 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 /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, actioner, cardPaymentId, currency, digitalWalletTokenId, merchantAcceptorId, merchantCategoryCode, merchantCity, merchantCountry, merchantDescriptor, merchantPostalCode, merchantState, networkDetails, networkIdentifiers, networkRiskScore, physicalCardId, realTimeDecisionId, terminalId, type, verification, 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) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CardValidation{id=$id, actioner=$actioner, 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}" + "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}" } /** 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 928165aad..476db9fd4 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 @@ -2538,6 +2538,7 @@ private constructor( private constructor( private val id: JsonField, private val actioner: JsonField, + private val additionalAmounts: JsonField, private val amount: JsonField, private val cardPaymentId: JsonField, private val currency: JsonField, @@ -2572,6 +2573,9 @@ private constructor( @JsonProperty("actioner") @ExcludeMissing actioner: JsonField = JsonMissing.of(), + @JsonProperty("additional_amounts") + @ExcludeMissing + additionalAmounts: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), @JsonProperty("card_payment_id") @ExcludeMissing @@ -2648,6 +2652,7 @@ private constructor( ) : this( id, actioner, + additionalAmounts, amount, cardPaymentId, currency, @@ -2695,6 +2700,18 @@ private constructor( */ fun actioner(): Actioner = actioner.getRequired("actioner") + /** + * 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 declined amount in the minor unit of the destination account currency. For * dollars, for example, this is cents. @@ -2951,6 +2968,16 @@ private constructor( @ExcludeMissing fun _actioner(): JsonField = actioner + /** + * 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 [amount]. * @@ -3217,6 +3244,7 @@ private constructor( * ```java * .id() * .actioner() + * .additionalAmounts() * .amount() * .cardPaymentId() * .currency() @@ -3252,6 +3280,7 @@ private constructor( private var id: JsonField? = null private var actioner: JsonField? = null + private var additionalAmounts: JsonField? = null private var amount: JsonField? = null private var cardPaymentId: JsonField? = null private var currency: JsonField? = null @@ -3283,6 +3312,7 @@ private constructor( internal fun from(cardDecline: CardDecline) = apply { id = cardDecline.id actioner = cardDecline.actioner + additionalAmounts = cardDecline.additionalAmounts amount = cardDecline.amount cardPaymentId = cardDecline.cardPaymentId currency = cardDecline.currency @@ -3338,6 +3368,25 @@ private constructor( */ fun actioner(actioner: JsonField) = apply { this.actioner = actioner } + /** + * 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 declined amount in the minor unit of the destination account currency. For * dollars, for example, this is cents. @@ -3837,6 +3886,7 @@ private constructor( * ```java * .id() * .actioner() + * .additionalAmounts() * .amount() * .cardPaymentId() * .currency() @@ -3870,6 +3920,7 @@ private constructor( CardDecline( checkRequired("id", id), checkRequired("actioner", actioner), + checkRequired("additionalAmounts", additionalAmounts), checkRequired("amount", amount), checkRequired("cardPaymentId", cardPaymentId), checkRequired("currency", currency), @@ -3908,6 +3959,7 @@ private constructor( id() actioner().validate() + additionalAmounts().validate() amount() cardPaymentId() currency().validate() @@ -3954,6 +4006,7 @@ private constructor( internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + (actioner.asKnown().getOrNull()?.validity() ?: 0) + + (additionalAmounts.asKnown().getOrNull()?.validity() ?: 0) + (if (amount.asKnown().isPresent) 1 else 0) + (if (cardPaymentId.asKnown().isPresent) 1 else 0) + (currency.asKnown().getOrNull()?.validity() ?: 0) + @@ -4130,6 +4183,2532 @@ private constructor( override fun toString() = value.toString() } + /** + * 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 + private constructor( + private val clinic: JsonField, + private val dental: 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("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, + 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 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 [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() + * .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 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 + 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 part of this transaction amount that was for healthcare prescriptions. + */ + fun prescription(prescription: Prescription?) = + prescription(JsonField.ofNullable(prescription)) + + /** + * Alias for calling [Builder.prescription] with `prescription.orElse(null)`. + */ + fun prescription(prescription: Optional) = + prescription(prescription.getOrNull()) + + /** + * Sets [Builder.prescription] to an arbitrary JSON value. + * + * You should usually call [Builder.prescription] with a well-typed + * [Prescription] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun prescription(prescription: JsonField) = apply { + this.prescription = prescription + } + + /** The surcharge amount charged for this transaction by the merchant. */ + fun surcharge(surcharge: Surcharge?) = + surcharge(JsonField.ofNullable(surcharge)) + + /** Alias for calling [Builder.surcharge] with `surcharge.orElse(null)`. */ + fun surcharge(surcharge: Optional) = surcharge(surcharge.getOrNull()) + + /** + * Sets [Builder.surcharge] to an arbitrary JSON value. + * + * You should usually call [Builder.surcharge] with a well-typed [Surcharge] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun surcharge(surcharge: JsonField) = apply { + this.surcharge = surcharge + } + + /** + * The total amount of a series of incremental authorizations, optionally + * provided. + */ + fun totalCumulative(totalCumulative: TotalCumulative?) = + totalCumulative(JsonField.ofNullable(totalCumulative)) + + /** + * Alias for calling [Builder.totalCumulative] with + * `totalCumulative.orElse(null)`. + */ + fun totalCumulative(totalCumulative: Optional) = + totalCumulative(totalCumulative.getOrNull()) + + /** + * Sets [Builder.totalCumulative] to an arbitrary JSON value. + * + * You should usually call [Builder.totalCumulative] with a well-typed + * [TotalCumulative] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun totalCumulative(totalCumulative: JsonField) = apply { + this.totalCumulative = totalCumulative + } + + /** The total amount of healthcare-related additional amounts. */ + fun totalHealthcare(totalHealthcare: TotalHealthcare?) = + totalHealthcare(JsonField.ofNullable(totalHealthcare)) + + /** + * Alias for calling [Builder.totalHealthcare] with + * `totalHealthcare.orElse(null)`. + */ + fun totalHealthcare(totalHealthcare: Optional) = + totalHealthcare(totalHealthcare.getOrNull()) + + /** + * Sets [Builder.totalHealthcare] to an arbitrary JSON value. + * + * You should usually call [Builder.totalHealthcare] with a well-typed + * [TotalHealthcare] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun totalHealthcare(totalHealthcare: JsonField) = apply { + this.totalHealthcare = totalHealthcare + } + + /** + * The part of this transaction amount that was for transit-related services. + */ + fun transit(transit: Transit?) = transit(JsonField.ofNullable(transit)) + + /** Alias for calling [Builder.transit] with `transit.orElse(null)`. */ + fun transit(transit: Optional) = transit(transit.getOrNull()) + + /** + * Sets [Builder.transit] to an arbitrary JSON value. + * + * You should usually call [Builder.transit] with a well-typed [Transit] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun transit(transit: JsonField) = apply { this.transit = transit } + + /** An unknown additional amount. */ + fun unknown(unknown: Unknown?) = unknown(JsonField.ofNullable(unknown)) + + /** Alias for calling [Builder.unknown] with `unknown.orElse(null)`. */ + fun unknown(unknown: Optional) = unknown(unknown.getOrNull()) + + /** + * Sets [Builder.unknown] to an arbitrary JSON value. + * + * You should usually call [Builder.unknown] with a well-typed [Unknown] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun unknown(unknown: JsonField) = apply { this.unknown = unknown } + + /** The part of this transaction amount that was for vision-related services. */ + fun vision(vision: Vision?) = vision(JsonField.ofNullable(vision)) + + /** Alias for calling [Builder.vision] with `vision.orElse(null)`. */ + fun vision(vision: Optional) = vision(vision.getOrNull()) + + /** + * Sets [Builder.vision] to an arbitrary JSON value. + * + * You should usually call [Builder.vision] with a well-typed [Vision] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun vision(vision: JsonField) = apply { this.vision = vision } + + 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 [AdditionalAmounts]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .clinic() + * .dental() + * .prescription() + * .surcharge() + * .totalCumulative() + * .totalHealthcare() + * .transit() + * .unknown() + * .vision() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): AdditionalAmounts = + AdditionalAmounts( + checkRequired("clinic", clinic), + checkRequired("dental", dental), + checkRequired("prescription", prescription), + checkRequired("surcharge", surcharge), + checkRequired("totalCumulative", totalCumulative), + checkRequired("totalHealthcare", totalHealthcare), + checkRequired("transit", transit), + checkRequired("unknown", unknown), + checkRequired("vision", vision), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): AdditionalAmounts = apply { + if (validated) { + return@apply + } + + clinic().ifPresent { it.validate() } + dental().ifPresent { it.validate() } + prescription().ifPresent { it.validate() } + surcharge().ifPresent { it.validate() } + totalCumulative().ifPresent { it.validate() } + totalHealthcare().ifPresent { it.validate() } + transit().ifPresent { it.validate() } + unknown().ifPresent { it.validate() } + vision().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 = + (clinic.asKnown().getOrNull()?.validity() ?: 0) + + (dental.asKnown().getOrNull()?.validity() ?: 0) + + (prescription.asKnown().getOrNull()?.validity() ?: 0) + + (surcharge.asKnown().getOrNull()?.validity() ?: 0) + + (totalCumulative.asKnown().getOrNull()?.validity() ?: 0) + + (totalHealthcare.asKnown().getOrNull()?.validity() ?: 0) + + (transit.asKnown().getOrNull()?.validity() ?: 0) + + (unknown.asKnown().getOrNull()?.validity() ?: 0) + + (vision.asKnown().getOrNull()?.validity() ?: 0) + + /** The part of this transaction amount that was for clinic-related services. */ + class Clinic + 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 amount in minor units of the `currency` field. + * + * @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 + * additional amount'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(): String = 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 [Clinic]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Clinic]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(clinic: Clinic) = apply { + amount = clinic.amount + currency = clinic.currency + additionalProperties = clinic.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [Clinic]. + * + * 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(): Clinic = + Clinic( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Clinic = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Clinic && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Clinic{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** The part of this transaction amount that was for dental-related services. */ + class Dental + 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 amount in minor units of the `currency` field. + * + * @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 + * additional amount'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(): String = 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 [Dental]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Dental]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(dental: Dental) = apply { + amount = dental.amount + currency = dental.currency + additionalProperties = dental.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [Dental]. + * + * 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(): Dental = + Dental( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Dental = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Dental && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Dental{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** The part of this transaction amount that was for healthcare prescriptions. */ + class Prescription + 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 amount in minor units of the `currency` field. + * + * @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 + * additional amount'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(): String = 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 [Prescription]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Prescription]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(prescription: Prescription) = apply { + amount = prescription.amount + currency = prescription.currency + additionalProperties = prescription.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [Prescription]. + * + * 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(): Prescription = + Prescription( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Prescription = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Prescription && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Prescription{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** The surcharge amount charged for this transaction by the merchant. */ + class Surcharge + 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 amount in minor units of the `currency` field. + * + * @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 + * additional amount'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(): String = 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 [Surcharge]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Surcharge]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(surcharge: Surcharge) = apply { + amount = surcharge.amount + currency = surcharge.currency + additionalProperties = surcharge.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [Surcharge]. + * + * 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(): Surcharge = + Surcharge( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Surcharge = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Surcharge && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Surcharge{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** + * The total amount of a series of incremental authorizations, optionally provided. + */ + class TotalCumulative + 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 amount in minor units of the `currency` field. + * + * @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 + * additional amount'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(): String = 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 + * [TotalCumulative]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TotalCumulative]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(totalCumulative: TotalCumulative) = apply { + amount = totalCumulative.amount + currency = totalCumulative.currency + additionalProperties = + totalCumulative.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [TotalCumulative]. + * + * 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(): TotalCumulative = + TotalCumulative( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): TotalCumulative = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is TotalCumulative && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "TotalCumulative{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** The total amount of healthcare-related additional amounts. */ + class TotalHealthcare + 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 amount in minor units of the `currency` field. + * + * @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 + * additional amount'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(): String = 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 + * [TotalHealthcare]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TotalHealthcare]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(totalHealthcare: TotalHealthcare) = apply { + amount = totalHealthcare.amount + currency = totalHealthcare.currency + additionalProperties = + totalHealthcare.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [TotalHealthcare]. + * + * 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(): TotalHealthcare = + TotalHealthcare( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): TotalHealthcare = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is TotalHealthcare && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "TotalHealthcare{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** The part of this transaction amount that was for transit-related services. */ + class Transit + 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 amount in minor units of the `currency` field. + * + * @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 + * additional amount'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(): String = 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 [Transit]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Transit]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(transit: Transit) = apply { + amount = transit.amount + currency = transit.currency + additionalProperties = transit.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [Transit]. + * + * 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(): Transit = + Transit( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Transit = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Transit && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Transit{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** An unknown additional amount. */ + class Unknown + 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 amount in minor units of the `currency` field. + * + * @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 + * additional amount'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(): String = 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 [Unknown]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Unknown]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(unknown: Unknown) = apply { + amount = unknown.amount + currency = unknown.currency + additionalProperties = unknown.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [Unknown]. + * + * 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(): Unknown = + Unknown( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Unknown = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Unknown && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Unknown{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** The part of this transaction amount that was for vision-related services. */ + class Vision + 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 amount in minor units of the `currency` field. + * + * @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 + * additional amount'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(): String = 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 [Vision]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Vision]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(vision: Vision) = apply { + amount = vision.amount + currency = vision.currency + additionalProperties = vision.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [Vision]. + * + * 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(): Vision = + Vision( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Vision = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Vision && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Vision{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is AdditionalAmounts && clinic == other.clinic && dental == other.dental && prescription == other.prescription && surcharge == other.surcharge && totalCumulative == other.totalCumulative && totalHealthcare == other.totalHealthcare && transit == other.transit && unknown == other.unknown && vision == other.vision && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(clinic, dental, prescription, surcharge, totalCumulative, totalHealthcare, transit, unknown, vision, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "AdditionalAmounts{clinic=$clinic, dental=$dental, prescription=$prescription, surcharge=$surcharge, totalCumulative=$totalCumulative, totalHealthcare=$totalHealthcare, transit=$transit, unknown=$unknown, vision=$vision, additionalProperties=$additionalProperties}" + } + /** * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the destination * account currency. @@ -8225,17 +10804,17 @@ private constructor( return true } - return /* spotless:off */ other is CardDecline && id == other.id && actioner == other.actioner && amount == other.amount && cardPaymentId == other.cardPaymentId && currency == other.currency && declinedTransactionId == other.declinedTransactionId && 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 && realTimeDecisionReason == other.realTimeDecisionReason && reason == other.reason && terminalId == other.terminalId && verification == other.verification && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CardDecline && id == other.id && actioner == other.actioner && additionalAmounts == other.additionalAmounts && amount == other.amount && cardPaymentId == other.cardPaymentId && currency == other.currency && declinedTransactionId == other.declinedTransactionId && 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 && realTimeDecisionReason == other.realTimeDecisionReason && reason == other.reason && terminalId == other.terminalId && verification == other.verification && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, actioner, amount, cardPaymentId, currency, declinedTransactionId, digitalWalletTokenId, direction, merchantAcceptorId, merchantCategoryCode, merchantCity, merchantCountry, merchantDescriptor, merchantPostalCode, merchantState, networkDetails, networkIdentifiers, networkRiskScore, physicalCardId, presentmentAmount, presentmentCurrency, processingCategory, realTimeDecisionId, realTimeDecisionReason, reason, terminalId, verification, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, actioner, additionalAmounts, amount, cardPaymentId, currency, declinedTransactionId, digitalWalletTokenId, direction, merchantAcceptorId, merchantCategoryCode, merchantCity, merchantCountry, merchantDescriptor, merchantPostalCode, merchantState, networkDetails, networkIdentifiers, networkRiskScore, physicalCardId, presentmentAmount, presentmentCurrency, processingCategory, realTimeDecisionId, realTimeDecisionReason, reason, terminalId, verification, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CardDecline{id=$id, actioner=$actioner, amount=$amount, cardPaymentId=$cardPaymentId, currency=$currency, declinedTransactionId=$declinedTransactionId, 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, 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, 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}" } /** 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 b855c99f9..90d9123f6 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 @@ -2679,6 +2679,7 @@ private constructor( private constructor( private val id: JsonField, private val actioner: JsonField, + private val additionalAmounts: JsonField, private val amount: JsonField, private val cardPaymentId: JsonField, private val currency: JsonField, @@ -2713,6 +2714,9 @@ private constructor( @JsonProperty("actioner") @ExcludeMissing actioner: JsonField = JsonMissing.of(), + @JsonProperty("additional_amounts") + @ExcludeMissing + additionalAmounts: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), @JsonProperty("card_payment_id") @ExcludeMissing @@ -2787,6 +2791,7 @@ private constructor( ) : this( id, actioner, + additionalAmounts, amount, cardPaymentId, currency, @@ -2834,6 +2839,18 @@ private constructor( */ fun actioner(): Actioner = actioner.getRequired("actioner") + /** + * 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 pending amount in the minor unit of the transaction's currency. For dollars, for * example, this is cents. @@ -3091,6 +3108,16 @@ private constructor( @ExcludeMissing fun _actioner(): JsonField = actioner + /** + * 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 [amount]. * @@ -3356,6 +3383,7 @@ private constructor( * ```java * .id() * .actioner() + * .additionalAmounts() * .amount() * .cardPaymentId() * .currency() @@ -3391,6 +3419,7 @@ private constructor( private var id: JsonField? = null private var actioner: JsonField? = null + private var additionalAmounts: JsonField? = null private var amount: JsonField? = null private var cardPaymentId: JsonField? = null private var currency: JsonField? = null @@ -3422,6 +3451,7 @@ private constructor( internal fun from(cardAuthorization: CardAuthorization) = apply { id = cardAuthorization.id actioner = cardAuthorization.actioner + additionalAmounts = cardAuthorization.additionalAmounts amount = cardAuthorization.amount cardPaymentId = cardAuthorization.cardPaymentId currency = cardAuthorization.currency @@ -3477,6 +3507,25 @@ private constructor( */ fun actioner(actioner: JsonField) = apply { this.actioner = actioner } + /** + * 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 pending amount in the minor unit of the transaction's currency. For dollars, * for example, this is cents. @@ -3978,6 +4027,7 @@ private constructor( * ```java * .id() * .actioner() + * .additionalAmounts() * .amount() * .cardPaymentId() * .currency() @@ -4011,6 +4061,7 @@ private constructor( CardAuthorization( checkRequired("id", id), checkRequired("actioner", actioner), + checkRequired("additionalAmounts", additionalAmounts), checkRequired("amount", amount), checkRequired("cardPaymentId", cardPaymentId), checkRequired("currency", currency), @@ -4049,6 +4100,7 @@ private constructor( id() actioner().validate() + additionalAmounts().validate() amount() cardPaymentId() currency().validate() @@ -4095,6 +4147,7 @@ private constructor( internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + (actioner.asKnown().getOrNull()?.validity() ?: 0) + + (additionalAmounts.asKnown().getOrNull()?.validity() ?: 0) + (if (amount.asKnown().isPresent) 1 else 0) + (if (cardPaymentId.asKnown().isPresent) 1 else 0) + (currency.asKnown().getOrNull()?.validity() ?: 0) + @@ -4271,6 +4324,2532 @@ private constructor( override fun toString() = value.toString() } + /** + * 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 + private constructor( + private val clinic: JsonField, + private val dental: 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("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, + 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 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 [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() + * .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 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 + 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 part of this transaction amount that was for healthcare prescriptions. + */ + fun prescription(prescription: Prescription?) = + prescription(JsonField.ofNullable(prescription)) + + /** + * Alias for calling [Builder.prescription] with `prescription.orElse(null)`. + */ + fun prescription(prescription: Optional) = + prescription(prescription.getOrNull()) + + /** + * Sets [Builder.prescription] to an arbitrary JSON value. + * + * You should usually call [Builder.prescription] with a well-typed + * [Prescription] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun prescription(prescription: JsonField) = apply { + this.prescription = prescription + } + + /** The surcharge amount charged for this transaction by the merchant. */ + fun surcharge(surcharge: Surcharge?) = + surcharge(JsonField.ofNullable(surcharge)) + + /** Alias for calling [Builder.surcharge] with `surcharge.orElse(null)`. */ + fun surcharge(surcharge: Optional) = surcharge(surcharge.getOrNull()) + + /** + * Sets [Builder.surcharge] to an arbitrary JSON value. + * + * You should usually call [Builder.surcharge] with a well-typed [Surcharge] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun surcharge(surcharge: JsonField) = apply { + this.surcharge = surcharge + } + + /** + * The total amount of a series of incremental authorizations, optionally + * provided. + */ + fun totalCumulative(totalCumulative: TotalCumulative?) = + totalCumulative(JsonField.ofNullable(totalCumulative)) + + /** + * Alias for calling [Builder.totalCumulative] with + * `totalCumulative.orElse(null)`. + */ + fun totalCumulative(totalCumulative: Optional) = + totalCumulative(totalCumulative.getOrNull()) + + /** + * Sets [Builder.totalCumulative] to an arbitrary JSON value. + * + * You should usually call [Builder.totalCumulative] with a well-typed + * [TotalCumulative] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun totalCumulative(totalCumulative: JsonField) = apply { + this.totalCumulative = totalCumulative + } + + /** The total amount of healthcare-related additional amounts. */ + fun totalHealthcare(totalHealthcare: TotalHealthcare?) = + totalHealthcare(JsonField.ofNullable(totalHealthcare)) + + /** + * Alias for calling [Builder.totalHealthcare] with + * `totalHealthcare.orElse(null)`. + */ + fun totalHealthcare(totalHealthcare: Optional) = + totalHealthcare(totalHealthcare.getOrNull()) + + /** + * Sets [Builder.totalHealthcare] to an arbitrary JSON value. + * + * You should usually call [Builder.totalHealthcare] with a well-typed + * [TotalHealthcare] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun totalHealthcare(totalHealthcare: JsonField) = apply { + this.totalHealthcare = totalHealthcare + } + + /** + * The part of this transaction amount that was for transit-related services. + */ + fun transit(transit: Transit?) = transit(JsonField.ofNullable(transit)) + + /** Alias for calling [Builder.transit] with `transit.orElse(null)`. */ + fun transit(transit: Optional) = transit(transit.getOrNull()) + + /** + * Sets [Builder.transit] to an arbitrary JSON value. + * + * You should usually call [Builder.transit] with a well-typed [Transit] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun transit(transit: JsonField) = apply { this.transit = transit } + + /** An unknown additional amount. */ + fun unknown(unknown: Unknown?) = unknown(JsonField.ofNullable(unknown)) + + /** Alias for calling [Builder.unknown] with `unknown.orElse(null)`. */ + fun unknown(unknown: Optional) = unknown(unknown.getOrNull()) + + /** + * Sets [Builder.unknown] to an arbitrary JSON value. + * + * You should usually call [Builder.unknown] with a well-typed [Unknown] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun unknown(unknown: JsonField) = apply { this.unknown = unknown } + + /** The part of this transaction amount that was for vision-related services. */ + fun vision(vision: Vision?) = vision(JsonField.ofNullable(vision)) + + /** Alias for calling [Builder.vision] with `vision.orElse(null)`. */ + fun vision(vision: Optional) = vision(vision.getOrNull()) + + /** + * Sets [Builder.vision] to an arbitrary JSON value. + * + * You should usually call [Builder.vision] with a well-typed [Vision] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun vision(vision: JsonField) = apply { this.vision = vision } + + 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 [AdditionalAmounts]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .clinic() + * .dental() + * .prescription() + * .surcharge() + * .totalCumulative() + * .totalHealthcare() + * .transit() + * .unknown() + * .vision() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): AdditionalAmounts = + AdditionalAmounts( + checkRequired("clinic", clinic), + checkRequired("dental", dental), + checkRequired("prescription", prescription), + checkRequired("surcharge", surcharge), + checkRequired("totalCumulative", totalCumulative), + checkRequired("totalHealthcare", totalHealthcare), + checkRequired("transit", transit), + checkRequired("unknown", unknown), + checkRequired("vision", vision), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): AdditionalAmounts = apply { + if (validated) { + return@apply + } + + clinic().ifPresent { it.validate() } + dental().ifPresent { it.validate() } + prescription().ifPresent { it.validate() } + surcharge().ifPresent { it.validate() } + totalCumulative().ifPresent { it.validate() } + totalHealthcare().ifPresent { it.validate() } + transit().ifPresent { it.validate() } + unknown().ifPresent { it.validate() } + vision().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 = + (clinic.asKnown().getOrNull()?.validity() ?: 0) + + (dental.asKnown().getOrNull()?.validity() ?: 0) + + (prescription.asKnown().getOrNull()?.validity() ?: 0) + + (surcharge.asKnown().getOrNull()?.validity() ?: 0) + + (totalCumulative.asKnown().getOrNull()?.validity() ?: 0) + + (totalHealthcare.asKnown().getOrNull()?.validity() ?: 0) + + (transit.asKnown().getOrNull()?.validity() ?: 0) + + (unknown.asKnown().getOrNull()?.validity() ?: 0) + + (vision.asKnown().getOrNull()?.validity() ?: 0) + + /** The part of this transaction amount that was for clinic-related services. */ + class Clinic + 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 amount in minor units of the `currency` field. + * + * @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 + * additional amount'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(): String = 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 [Clinic]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Clinic]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(clinic: Clinic) = apply { + amount = clinic.amount + currency = clinic.currency + additionalProperties = clinic.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [Clinic]. + * + * 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(): Clinic = + Clinic( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Clinic = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Clinic && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Clinic{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** The part of this transaction amount that was for dental-related services. */ + class Dental + 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 amount in minor units of the `currency` field. + * + * @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 + * additional amount'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(): String = 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 [Dental]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Dental]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(dental: Dental) = apply { + amount = dental.amount + currency = dental.currency + additionalProperties = dental.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [Dental]. + * + * 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(): Dental = + Dental( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Dental = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Dental && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Dental{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** The part of this transaction amount that was for healthcare prescriptions. */ + class Prescription + 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 amount in minor units of the `currency` field. + * + * @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 + * additional amount'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(): String = 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 [Prescription]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Prescription]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(prescription: Prescription) = apply { + amount = prescription.amount + currency = prescription.currency + additionalProperties = prescription.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [Prescription]. + * + * 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(): Prescription = + Prescription( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Prescription = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Prescription && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Prescription{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** The surcharge amount charged for this transaction by the merchant. */ + class Surcharge + 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 amount in minor units of the `currency` field. + * + * @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 + * additional amount'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(): String = 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 [Surcharge]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Surcharge]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(surcharge: Surcharge) = apply { + amount = surcharge.amount + currency = surcharge.currency + additionalProperties = surcharge.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [Surcharge]. + * + * 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(): Surcharge = + Surcharge( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Surcharge = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Surcharge && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Surcharge{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** + * The total amount of a series of incremental authorizations, optionally provided. + */ + class TotalCumulative + 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 amount in minor units of the `currency` field. + * + * @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 + * additional amount'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(): String = 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 + * [TotalCumulative]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TotalCumulative]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(totalCumulative: TotalCumulative) = apply { + amount = totalCumulative.amount + currency = totalCumulative.currency + additionalProperties = + totalCumulative.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [TotalCumulative]. + * + * 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(): TotalCumulative = + TotalCumulative( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): TotalCumulative = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is TotalCumulative && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "TotalCumulative{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** The total amount of healthcare-related additional amounts. */ + class TotalHealthcare + 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 amount in minor units of the `currency` field. + * + * @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 + * additional amount'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(): String = 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 + * [TotalHealthcare]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TotalHealthcare]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(totalHealthcare: TotalHealthcare) = apply { + amount = totalHealthcare.amount + currency = totalHealthcare.currency + additionalProperties = + totalHealthcare.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [TotalHealthcare]. + * + * 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(): TotalHealthcare = + TotalHealthcare( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): TotalHealthcare = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is TotalHealthcare && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "TotalHealthcare{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** The part of this transaction amount that was for transit-related services. */ + class Transit + 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 amount in minor units of the `currency` field. + * + * @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 + * additional amount'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(): String = 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 [Transit]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Transit]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(transit: Transit) = apply { + amount = transit.amount + currency = transit.currency + additionalProperties = transit.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [Transit]. + * + * 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(): Transit = + Transit( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Transit = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Transit && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Transit{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** An unknown additional amount. */ + class Unknown + 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 amount in minor units of the `currency` field. + * + * @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 + * additional amount'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(): String = 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 [Unknown]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Unknown]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(unknown: Unknown) = apply { + amount = unknown.amount + currency = unknown.currency + additionalProperties = unknown.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [Unknown]. + * + * 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(): Unknown = + Unknown( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Unknown = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Unknown && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Unknown{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** The part of this transaction amount that was for vision-related services. */ + class Vision + 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 amount in minor units of the `currency` field. + * + * @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 + * additional amount'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(): String = 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 [Vision]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Vision]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(vision: Vision) = apply { + amount = vision.amount + currency = vision.currency + additionalProperties = vision.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [Vision]. + * + * 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(): Vision = + Vision( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Vision = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Vision && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Vision{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is AdditionalAmounts && clinic == other.clinic && dental == other.dental && prescription == other.prescription && surcharge == other.surcharge && totalCumulative == other.totalCumulative && totalHealthcare == other.totalHealthcare && transit == other.transit && unknown == other.unknown && vision == other.vision && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(clinic, dental, prescription, surcharge, totalCumulative, totalHealthcare, transit, unknown, vision, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "AdditionalAmounts{clinic=$clinic, dental=$dental, prescription=$prescription, surcharge=$surcharge, totalCumulative=$totalCumulative, totalHealthcare=$totalHealthcare, transit=$transit, unknown=$unknown, vision=$vision, additionalProperties=$additionalProperties}" + } + /** * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's * currency. @@ -7916,17 +10495,17 @@ private constructor( return true } - return /* spotless:off */ other is CardAuthorization && id == other.id && actioner == other.actioner && 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 /* spotless:on */ + return /* spotless:off */ 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 /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, actioner, 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 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) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CardAuthorization{id=$id, actioner=$actioner, 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, terminalId=$terminalId, type=$type, verification=$verification, additionalProperties=$additionalProperties}" } /** diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecision.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecision.kt index bf11fa0be..dda7898a9 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecision.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecision.kt @@ -1536,6 +1536,7 @@ private constructor( class CardAuthorization private constructor( private val accountId: JsonField, + private val additionalAmounts: JsonField, private val cardId: JsonField, private val decision: JsonField, private val digitalWalletTokenId: JsonField, @@ -1568,6 +1569,9 @@ private constructor( @JsonProperty("account_id") @ExcludeMissing accountId: JsonField = JsonMissing.of(), + @JsonProperty("additional_amounts") + @ExcludeMissing + additionalAmounts: JsonField = JsonMissing.of(), @JsonProperty("card_id") @ExcludeMissing cardId: JsonField = JsonMissing.of(), @JsonProperty("decision") @ExcludeMissing @@ -1640,6 +1644,7 @@ private constructor( verification: JsonField = JsonMissing.of(), ) : this( accountId, + additionalAmounts, cardId, decision, digitalWalletTokenId, @@ -1675,6 +1680,17 @@ private constructor( */ fun accountId(): String = accountId.getRequired("account_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 identifier of the Card that is being authorized. * @@ -1894,6 +1910,16 @@ private constructor( */ @JsonProperty("account_id") @ExcludeMissing fun _accountId(): JsonField = accountId + /** + * 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 [cardId]. * @@ -2146,6 +2172,7 @@ private constructor( * The following fields are required: * ```java * .accountId() + * .additionalAmounts() * .cardId() * .decision() * .digitalWalletTokenId() @@ -2179,6 +2206,7 @@ private constructor( class Builder internal constructor() { private var accountId: JsonField? = null + private var additionalAmounts: JsonField? = null private var cardId: JsonField? = null private var decision: JsonField? = null private var digitalWalletTokenId: JsonField? = null @@ -2208,6 +2236,7 @@ private constructor( @JvmSynthetic internal fun from(cardAuthorization: CardAuthorization) = apply { accountId = cardAuthorization.accountId + additionalAmounts = cardAuthorization.additionalAmounts cardId = cardAuthorization.cardId decision = cardAuthorization.decision digitalWalletTokenId = cardAuthorization.digitalWalletTokenId @@ -2247,6 +2276,25 @@ private constructor( */ fun accountId(accountId: JsonField) = apply { this.accountId = accountId } + /** + * 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 identifier of the Card that is being authorized. */ fun cardId(cardId: String) = cardId(JsonField.of(cardId)) @@ -2710,6 +2758,7 @@ private constructor( * The following fields are required: * ```java * .accountId() + * .additionalAmounts() * .cardId() * .decision() * .digitalWalletTokenId() @@ -2741,6 +2790,7 @@ private constructor( fun build(): CardAuthorization = CardAuthorization( checkRequired("accountId", accountId), + checkRequired("additionalAmounts", additionalAmounts), checkRequired("cardId", cardId), checkRequired("decision", decision), checkRequired("digitalWalletTokenId", digitalWalletTokenId), @@ -2777,6 +2827,7 @@ private constructor( } accountId() + additionalAmounts().validate() cardId() decision().ifPresent { it.validate() } digitalWalletTokenId() @@ -2821,6 +2872,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (accountId.asKnown().isPresent) 1 else 0) + + (additionalAmounts.asKnown().getOrNull()?.validity() ?: 0) + (if (cardId.asKnown().isPresent) 1 else 0) + (decision.asKnown().getOrNull()?.validity() ?: 0) + (if (digitalWalletTokenId.asKnown().isPresent) 1 else 0) + @@ -2846,6 +2898,2476 @@ private constructor( (if (upcomingCardPaymentId.asKnown().isPresent) 1 else 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 + private constructor( + private val clinic: JsonField, + private val dental: 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("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, + 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 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 [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() + * .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 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 + 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 part of this transaction amount that was for healthcare prescriptions. */ + fun prescription(prescription: Prescription?) = + prescription(JsonField.ofNullable(prescription)) + + /** Alias for calling [Builder.prescription] with `prescription.orElse(null)`. */ + fun prescription(prescription: Optional) = + prescription(prescription.getOrNull()) + + /** + * Sets [Builder.prescription] to an arbitrary JSON value. + * + * You should usually call [Builder.prescription] with a well-typed [Prescription] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun prescription(prescription: JsonField) = apply { + this.prescription = prescription + } + + /** The surcharge amount charged for this transaction by the merchant. */ + fun surcharge(surcharge: Surcharge?) = surcharge(JsonField.ofNullable(surcharge)) + + /** Alias for calling [Builder.surcharge] with `surcharge.orElse(null)`. */ + fun surcharge(surcharge: Optional) = surcharge(surcharge.getOrNull()) + + /** + * Sets [Builder.surcharge] to an arbitrary JSON value. + * + * You should usually call [Builder.surcharge] with a well-typed [Surcharge] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun surcharge(surcharge: JsonField) = apply { + this.surcharge = surcharge + } + + /** + * The total amount of a series of incremental authorizations, optionally provided. + */ + fun totalCumulative(totalCumulative: TotalCumulative?) = + totalCumulative(JsonField.ofNullable(totalCumulative)) + + /** + * Alias for calling [Builder.totalCumulative] with `totalCumulative.orElse(null)`. + */ + fun totalCumulative(totalCumulative: Optional) = + totalCumulative(totalCumulative.getOrNull()) + + /** + * Sets [Builder.totalCumulative] to an arbitrary JSON value. + * + * You should usually call [Builder.totalCumulative] with a well-typed + * [TotalCumulative] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun totalCumulative(totalCumulative: JsonField) = apply { + this.totalCumulative = totalCumulative + } + + /** The total amount of healthcare-related additional amounts. */ + fun totalHealthcare(totalHealthcare: TotalHealthcare?) = + totalHealthcare(JsonField.ofNullable(totalHealthcare)) + + /** + * Alias for calling [Builder.totalHealthcare] with `totalHealthcare.orElse(null)`. + */ + fun totalHealthcare(totalHealthcare: Optional) = + totalHealthcare(totalHealthcare.getOrNull()) + + /** + * Sets [Builder.totalHealthcare] to an arbitrary JSON value. + * + * You should usually call [Builder.totalHealthcare] with a well-typed + * [TotalHealthcare] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun totalHealthcare(totalHealthcare: JsonField) = apply { + this.totalHealthcare = totalHealthcare + } + + /** The part of this transaction amount that was for transit-related services. */ + fun transit(transit: Transit?) = transit(JsonField.ofNullable(transit)) + + /** Alias for calling [Builder.transit] with `transit.orElse(null)`. */ + fun transit(transit: Optional) = transit(transit.getOrNull()) + + /** + * Sets [Builder.transit] to an arbitrary JSON value. + * + * You should usually call [Builder.transit] with a well-typed [Transit] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun transit(transit: JsonField) = apply { this.transit = transit } + + /** An unknown additional amount. */ + fun unknown(unknown: Unknown?) = unknown(JsonField.ofNullable(unknown)) + + /** Alias for calling [Builder.unknown] with `unknown.orElse(null)`. */ + fun unknown(unknown: Optional) = unknown(unknown.getOrNull()) + + /** + * Sets [Builder.unknown] to an arbitrary JSON value. + * + * You should usually call [Builder.unknown] with a well-typed [Unknown] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun unknown(unknown: JsonField) = apply { this.unknown = unknown } + + /** The part of this transaction amount that was for vision-related services. */ + fun vision(vision: Vision?) = vision(JsonField.ofNullable(vision)) + + /** Alias for calling [Builder.vision] with `vision.orElse(null)`. */ + fun vision(vision: Optional) = vision(vision.getOrNull()) + + /** + * Sets [Builder.vision] to an arbitrary JSON value. + * + * You should usually call [Builder.vision] with a well-typed [Vision] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun vision(vision: JsonField) = apply { this.vision = vision } + + 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 [AdditionalAmounts]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .clinic() + * .dental() + * .prescription() + * .surcharge() + * .totalCumulative() + * .totalHealthcare() + * .transit() + * .unknown() + * .vision() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): AdditionalAmounts = + AdditionalAmounts( + checkRequired("clinic", clinic), + checkRequired("dental", dental), + checkRequired("prescription", prescription), + checkRequired("surcharge", surcharge), + checkRequired("totalCumulative", totalCumulative), + checkRequired("totalHealthcare", totalHealthcare), + checkRequired("transit", transit), + checkRequired("unknown", unknown), + checkRequired("vision", vision), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): AdditionalAmounts = apply { + if (validated) { + return@apply + } + + clinic().ifPresent { it.validate() } + dental().ifPresent { it.validate() } + prescription().ifPresent { it.validate() } + surcharge().ifPresent { it.validate() } + totalCumulative().ifPresent { it.validate() } + totalHealthcare().ifPresent { it.validate() } + transit().ifPresent { it.validate() } + unknown().ifPresent { it.validate() } + vision().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 = + (clinic.asKnown().getOrNull()?.validity() ?: 0) + + (dental.asKnown().getOrNull()?.validity() ?: 0) + + (prescription.asKnown().getOrNull()?.validity() ?: 0) + + (surcharge.asKnown().getOrNull()?.validity() ?: 0) + + (totalCumulative.asKnown().getOrNull()?.validity() ?: 0) + + (totalHealthcare.asKnown().getOrNull()?.validity() ?: 0) + + (transit.asKnown().getOrNull()?.validity() ?: 0) + + (unknown.asKnown().getOrNull()?.validity() ?: 0) + + (vision.asKnown().getOrNull()?.validity() ?: 0) + + /** The part of this transaction amount that was for clinic-related services. */ + class Clinic + 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 amount in minor units of the `currency` field. + * + * @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 additional + * amount'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(): String = 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 [Clinic]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Clinic]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(clinic: Clinic) = apply { + amount = clinic.amount + currency = clinic.currency + additionalProperties = clinic.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [Clinic]. + * + * 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(): Clinic = + Clinic( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Clinic = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Clinic && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Clinic{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** The part of this transaction amount that was for dental-related services. */ + class Dental + 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 amount in minor units of the `currency` field. + * + * @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 additional + * amount'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(): String = 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 [Dental]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Dental]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(dental: Dental) = apply { + amount = dental.amount + currency = dental.currency + additionalProperties = dental.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [Dental]. + * + * 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(): Dental = + Dental( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Dental = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Dental && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Dental{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** The part of this transaction amount that was for healthcare prescriptions. */ + class Prescription + 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 amount in minor units of the `currency` field. + * + * @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 additional + * amount'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(): String = 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 [Prescription]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Prescription]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(prescription: Prescription) = apply { + amount = prescription.amount + currency = prescription.currency + additionalProperties = prescription.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [Prescription]. + * + * 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(): Prescription = + Prescription( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Prescription = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Prescription && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Prescription{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** The surcharge amount charged for this transaction by the merchant. */ + class Surcharge + 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 amount in minor units of the `currency` field. + * + * @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 additional + * amount'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(): String = 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 [Surcharge]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Surcharge]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(surcharge: Surcharge) = apply { + amount = surcharge.amount + currency = surcharge.currency + additionalProperties = surcharge.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [Surcharge]. + * + * 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(): Surcharge = + Surcharge( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Surcharge = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Surcharge && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Surcharge{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** The total amount of a series of incremental authorizations, optionally provided. */ + class TotalCumulative + 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 amount in minor units of the `currency` field. + * + * @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 additional + * amount'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(): String = 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 [TotalCumulative]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TotalCumulative]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(totalCumulative: TotalCumulative) = apply { + amount = totalCumulative.amount + currency = totalCumulative.currency + additionalProperties = totalCumulative.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [TotalCumulative]. + * + * 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(): TotalCumulative = + TotalCumulative( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): TotalCumulative = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is TotalCumulative && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "TotalCumulative{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** The total amount of healthcare-related additional amounts. */ + class TotalHealthcare + 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 amount in minor units of the `currency` field. + * + * @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 additional + * amount'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(): String = 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 [TotalHealthcare]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TotalHealthcare]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(totalHealthcare: TotalHealthcare) = apply { + amount = totalHealthcare.amount + currency = totalHealthcare.currency + additionalProperties = totalHealthcare.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [TotalHealthcare]. + * + * 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(): TotalHealthcare = + TotalHealthcare( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): TotalHealthcare = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is TotalHealthcare && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "TotalHealthcare{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** The part of this transaction amount that was for transit-related services. */ + class Transit + 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 amount in minor units of the `currency` field. + * + * @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 additional + * amount'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(): String = 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 [Transit]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Transit]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(transit: Transit) = apply { + amount = transit.amount + currency = transit.currency + additionalProperties = transit.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [Transit]. + * + * 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(): Transit = + Transit( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Transit = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Transit && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Transit{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** An unknown additional amount. */ + class Unknown + 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 amount in minor units of the `currency` field. + * + * @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 additional + * amount'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(): String = 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 [Unknown]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Unknown]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(unknown: Unknown) = apply { + amount = unknown.amount + currency = unknown.currency + additionalProperties = unknown.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [Unknown]. + * + * 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(): Unknown = + Unknown( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Unknown = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Unknown && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Unknown{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** The part of this transaction amount that was for vision-related services. */ + class Vision + 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 amount in minor units of the `currency` field. + * + * @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 additional + * amount'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(): String = 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 [Vision]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Vision]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(vision: Vision) = apply { + amount = vision.amount + currency = vision.currency + additionalProperties = vision.additionalProperties.toMutableMap() + } + + /** The amount in minor units of the `currency` field. */ + 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 [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + * additional amount's currency. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] 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: 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 [Vision]. + * + * 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(): Vision = + Vision( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Vision = apply { + if (validated) { + return@apply + } + + amount() + currency() + 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 (currency.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Vision && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, currency, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Vision{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is AdditionalAmounts && clinic == other.clinic && dental == other.dental && prescription == other.prescription && surcharge == other.surcharge && totalCumulative == other.totalCumulative && totalHealthcare == other.totalHealthcare && transit == other.transit && unknown == other.unknown && vision == other.vision && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(clinic, dental, prescription, surcharge, totalCumulative, totalHealthcare, transit, unknown, vision, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "AdditionalAmounts{clinic=$clinic, dental=$dental, prescription=$prescription, surcharge=$surcharge, totalCumulative=$totalCumulative, totalHealthcare=$totalHealthcare, transit=$transit, unknown=$unknown, vision=$vision, additionalProperties=$additionalProperties}" + } + /** Whether or not the authorization was approved. */ class Decision @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -6888,17 +9410,17 @@ private constructor( return true } - return /* spotless:off */ other is CardAuthorization && accountId == other.accountId && cardId == other.cardId && decision == other.decision && 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 && requestDetails == other.requestDetails && settlementAmount == other.settlementAmount && settlementCurrency == other.settlementCurrency && terminalId == other.terminalId && upcomingCardPaymentId == other.upcomingCardPaymentId && verification == other.verification && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CardAuthorization && accountId == other.accountId && additionalAmounts == other.additionalAmounts && cardId == other.cardId && decision == other.decision && 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 && requestDetails == other.requestDetails && settlementAmount == other.settlementAmount && settlementCurrency == other.settlementCurrency && terminalId == other.terminalId && upcomingCardPaymentId == other.upcomingCardPaymentId && verification == other.verification && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(accountId, cardId, decision, digitalWalletTokenId, direction, merchantAcceptorId, merchantCategoryCode, merchantCity, merchantCountry, merchantDescriptor, merchantPostalCode, merchantState, networkDetails, networkIdentifiers, networkRiskScore, physicalCardId, presentmentAmount, presentmentCurrency, processingCategory, requestDetails, settlementAmount, settlementCurrency, terminalId, upcomingCardPaymentId, verification, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(accountId, additionalAmounts, cardId, decision, digitalWalletTokenId, direction, merchantAcceptorId, merchantCategoryCode, merchantCity, merchantCountry, merchantDescriptor, merchantPostalCode, merchantState, networkDetails, networkIdentifiers, networkRiskScore, physicalCardId, presentmentAmount, presentmentCurrency, processingCategory, requestDetails, settlementAmount, settlementCurrency, terminalId, upcomingCardPaymentId, verification, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CardAuthorization{accountId=$accountId, cardId=$cardId, decision=$decision, 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, requestDetails=$requestDetails, settlementAmount=$settlementAmount, settlementCurrency=$settlementCurrency, terminalId=$terminalId, upcomingCardPaymentId=$upcomingCardPaymentId, verification=$verification, additionalProperties=$additionalProperties}" + "CardAuthorization{accountId=$accountId, additionalAmounts=$additionalAmounts, cardId=$cardId, decision=$decision, 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, requestDetails=$requestDetails, settlementAmount=$settlementAmount, settlementCurrency=$settlementCurrency, terminalId=$terminalId, upcomingCardPaymentId=$upcomingCardPaymentId, verification=$verification, additionalProperties=$additionalProperties}" } /** The category of the Real-Time Decision. */ 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 ec7fbc4ed..f3d6d46d6 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 @@ -101,6 +101,93 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardAuthorization.Actioner .INCREASE ) + .additionalAmounts( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency( @@ -251,6 +338,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardDecline.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardDecline.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardDecline + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardDecline + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardDecline.Currency.USD) @@ -400,6 +573,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardIncrement.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardIncrement.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(20L) .cardAuthorizationId( "card_authorization_6iqxap6ivd0fo5eu3i8x" @@ -420,6 +679,8 @@ internal class CardPaymentListPageResponseTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .presentmentAmount(20L) + .presentmentCurrency("USD") .realTimeDecisionId(null) .type( CardPayment.Element.CardIncrement.Type @@ -1020,6 +1281,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardValidation.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardValidation.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardValidation + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardValidation + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency( CardPayment.Element.CardValidation.Currency.USD @@ -1201,6 +1548,93 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardAuthorization.Actioner .INCREASE ) + .additionalAmounts( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency( @@ -1351,6 +1785,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardDecline.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardDecline.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardDecline + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardDecline + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardDecline.Currency.USD) @@ -1500,35 +2020,123 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardIncrement.Actioner.INCREASE ) - .amount(20L) - .cardAuthorizationId( - "card_authorization_6iqxap6ivd0fo5eu3i8x" - ) - .currency( - CardPayment.Element.CardIncrement.Currency.USD - ) - .network(CardPayment.Element.CardIncrement.Network.VISA) - .networkIdentifiers( - CardPayment.Element.CardIncrement.NetworkIdentifiers + .additionalAmounts( + CardPayment.Element.CardIncrement.AdditionalAmounts .builder() - .retrievalReferenceNumber("785867080153") - .traceNumber("487941") - .transactionId("627199945183184") - .build() - ) - .networkRiskScore(10L) - .pendingTransactionId( - "pending_transaction_k1sfetcau2qbvjbzgju4" - ) - .realTimeDecisionId(null) - .type( - CardPayment.Element.CardIncrement.Type - .CARD_INCREMENT - ) - .updatedAuthorizationAmount(120L) - .build() - ) - .cardRefund( + .clinic( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) + .amount(20L) + .cardAuthorizationId( + "card_authorization_6iqxap6ivd0fo5eu3i8x" + ) + .currency( + CardPayment.Element.CardIncrement.Currency.USD + ) + .network(CardPayment.Element.CardIncrement.Network.VISA) + .networkIdentifiers( + CardPayment.Element.CardIncrement.NetworkIdentifiers + .builder() + .retrievalReferenceNumber("785867080153") + .traceNumber("487941") + .transactionId("627199945183184") + .build() + ) + .networkRiskScore(10L) + .pendingTransactionId( + "pending_transaction_k1sfetcau2qbvjbzgju4" + ) + .presentmentAmount(20L) + .presentmentCurrency("USD") + .realTimeDecisionId(null) + .type( + CardPayment.Element.CardIncrement.Type + .CARD_INCREMENT + ) + .updatedAuthorizationAmount(120L) + .build() + ) + .cardRefund( CardPayment.Element.CardRefund.builder() .id("card_refund_imgc2xwplh6t4r3gn16e") .amount(100L) @@ -2120,6 +2728,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardValidation.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardValidation.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardValidation + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardValidation + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency( CardPayment.Element.CardValidation.Currency.USD @@ -2301,6 +2995,93 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardAuthorization.Actioner .INCREASE ) + .additionalAmounts( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency( @@ -2451,6 +3232,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardDecline.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardDecline.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardDecline + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardDecline + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardDecline.Currency.USD) @@ -2600,6 +3467,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardIncrement.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardIncrement.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(20L) .cardAuthorizationId( "card_authorization_6iqxap6ivd0fo5eu3i8x" @@ -2620,6 +3573,8 @@ internal class CardPaymentListPageResponseTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .presentmentAmount(20L) + .presentmentCurrency("USD") .realTimeDecisionId(null) .type( CardPayment.Element.CardIncrement.Type @@ -3220,6 +4175,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardValidation.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardValidation.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardValidation + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardValidation + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency( CardPayment.Element.CardValidation.Currency.USD @@ -3401,15 +4442,102 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardAuthorization.Actioner .INCREASE ) - .amount(100L) - .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") - .currency( - CardPayment.Element.CardAuthorization.Currency.USD - ) - .digitalWalletTokenId(null) - .direction( - CardPayment.Element.CardAuthorization.Direction - .SETTLEMENT + .additionalAmounts( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) + .amount(100L) + .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") + .currency( + CardPayment.Element.CardAuthorization.Currency.USD + ) + .digitalWalletTokenId(null) + .direction( + CardPayment.Element.CardAuthorization.Direction + .SETTLEMENT ) .expiresAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) .merchantAcceptorId("5665270011000168") @@ -3551,6 +4679,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardDecline.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardDecline.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardDecline + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardDecline + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardDecline.Currency.USD) @@ -3700,6 +4914,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardIncrement.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardIncrement.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(20L) .cardAuthorizationId( "card_authorization_6iqxap6ivd0fo5eu3i8x" @@ -3720,6 +5020,8 @@ internal class CardPaymentListPageResponseTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .presentmentAmount(20L) + .presentmentCurrency("USD") .realTimeDecisionId(null) .type( CardPayment.Element.CardIncrement.Type @@ -4320,6 +5622,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardValidation.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardValidation.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardValidation + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardValidation + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency( CardPayment.Element.CardValidation.Currency.USD @@ -4525,6 +5913,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardAuthorization.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency( @@ -4663,6 +6137,92 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardDecline.builder() .id("card_decline_bx3o8zd7glq8yvtwg25v") .actioner(CardPayment.Element.CardDecline.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardDecline.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardDecline + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardDecline + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardDecline.Currency.USD) @@ -4806,36 +6366,124 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardIncrement.Actioner.INCREASE ) - .amount(20L) - .cardAuthorizationId( - "card_authorization_6iqxap6ivd0fo5eu3i8x" - ) - .currency(CardPayment.Element.CardIncrement.Currency.USD) - .network(CardPayment.Element.CardIncrement.Network.VISA) - .networkIdentifiers( - CardPayment.Element.CardIncrement.NetworkIdentifiers + .additionalAmounts( + CardPayment.Element.CardIncrement.AdditionalAmounts .builder() - .retrievalReferenceNumber("785867080153") - .traceNumber("487941") - .transactionId("627199945183184") - .build() - ) - .networkRiskScore(10L) - .pendingTransactionId( - "pending_transaction_k1sfetcau2qbvjbzgju4" - ) - .realTimeDecisionId(null) - .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) - .updatedAuthorizationAmount(120L) - .build() - ) - .cardRefund( - CardPayment.Element.CardRefund.builder() - .id("card_refund_imgc2xwplh6t4r3gn16e") - .amount(100L) - .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") - .cashback( - CardPayment.Element.CardRefund.Cashback.builder() + .clinic( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) + .amount(20L) + .cardAuthorizationId( + "card_authorization_6iqxap6ivd0fo5eu3i8x" + ) + .currency(CardPayment.Element.CardIncrement.Currency.USD) + .network(CardPayment.Element.CardIncrement.Network.VISA) + .networkIdentifiers( + CardPayment.Element.CardIncrement.NetworkIdentifiers + .builder() + .retrievalReferenceNumber("785867080153") + .traceNumber("487941") + .transactionId("627199945183184") + .build() + ) + .networkRiskScore(10L) + .pendingTransactionId( + "pending_transaction_k1sfetcau2qbvjbzgju4" + ) + .presentmentAmount(20L) + .presentmentCurrency("USD") + .realTimeDecisionId(null) + .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) + .updatedAuthorizationAmount(120L) + .build() + ) + .cardRefund( + CardPayment.Element.CardRefund.builder() + .id("card_refund_imgc2xwplh6t4r3gn16e") + .amount(100L) + .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") + .cashback( + CardPayment.Element.CardRefund.Cashback.builder() .amount("-16699") .currency( CardPayment.Element.CardRefund.Cashback.Currency @@ -5383,6 +7031,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardValidation.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardValidation.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardValidation + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardValidation + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardValidation.Currency.USD) .digitalWalletTokenId(null) @@ -5555,6 +7289,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardAuthorization.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency( @@ -5693,6 +7513,92 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardDecline.builder() .id("card_decline_bx3o8zd7glq8yvtwg25v") .actioner(CardPayment.Element.CardDecline.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardDecline.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardDecline + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardDecline + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardDecline.Currency.USD) @@ -5836,6 +7742,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardIncrement.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardIncrement.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(20L) .cardAuthorizationId( "card_authorization_6iqxap6ivd0fo5eu3i8x" @@ -5854,6 +7846,8 @@ internal class CardPaymentListPageResponseTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .presentmentAmount(20L) + .presentmentCurrency("USD") .realTimeDecisionId(null) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) @@ -6413,6 +8407,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardValidation.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardValidation.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardValidation + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardValidation + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardValidation.Currency.USD) .digitalWalletTokenId(null) @@ -6585,24 +8665,110 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardAuthorization.Actioner.INCREASE ) - .amount(100L) - .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") - .currency( - CardPayment.Element.CardAuthorization.Currency.USD - ) - .digitalWalletTokenId(null) - .direction( - CardPayment.Element.CardAuthorization.Direction - .SETTLEMENT - ) - .expiresAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .merchantAcceptorId("5665270011000168") - .merchantCategoryCode("5734") - .merchantCity("New York") - .merchantCountry("US") - .merchantDescriptor("AMAZON.COM") - .merchantPostalCode("10045") - .merchantState("NY") + .additionalAmounts( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) + .amount(100L) + .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") + .currency( + CardPayment.Element.CardAuthorization.Currency.USD + ) + .digitalWalletTokenId(null) + .direction( + CardPayment.Element.CardAuthorization.Direction + .SETTLEMENT + ) + .expiresAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .merchantAcceptorId("5665270011000168") + .merchantCategoryCode("5734") + .merchantCity("New York") + .merchantCountry("US") + .merchantDescriptor("AMAZON.COM") + .merchantPostalCode("10045") + .merchantState("NY") .networkDetails( CardPayment.Element.CardAuthorization.NetworkDetails .builder() @@ -6723,6 +8889,92 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardDecline.builder() .id("card_decline_bx3o8zd7glq8yvtwg25v") .actioner(CardPayment.Element.CardDecline.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardDecline.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardDecline + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardDecline + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardDecline.Currency.USD) @@ -6866,6 +9118,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardIncrement.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardIncrement.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(20L) .cardAuthorizationId( "card_authorization_6iqxap6ivd0fo5eu3i8x" @@ -6884,6 +9222,8 @@ internal class CardPaymentListPageResponseTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .presentmentAmount(20L) + .presentmentCurrency("USD") .realTimeDecisionId(null) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) @@ -7443,6 +9783,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardValidation.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardValidation.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardValidation + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardValidation + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardValidation.Currency.USD) .digitalWalletTokenId(null) @@ -7615,6 +10041,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardAuthorization.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency( @@ -7753,6 +10265,92 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardDecline.builder() .id("card_decline_bx3o8zd7glq8yvtwg25v") .actioner(CardPayment.Element.CardDecline.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardDecline.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardDecline + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardDecline + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardDecline.Currency.USD) @@ -7896,6 +10494,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardIncrement.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardIncrement.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(20L) .cardAuthorizationId( "card_authorization_6iqxap6ivd0fo5eu3i8x" @@ -7914,6 +10598,8 @@ internal class CardPaymentListPageResponseTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .presentmentAmount(20L) + .presentmentCurrency("USD") .realTimeDecisionId(null) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) @@ -8473,6 +11159,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardValidation.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardValidation.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardValidation + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardValidation + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardValidation.Currency.USD) .digitalWalletTokenId(null) @@ -8681,6 +11453,93 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardAuthorization.Actioner .INCREASE ) + .additionalAmounts( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency( @@ -8831,6 +11690,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardDecline.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardDecline.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardDecline + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardDecline + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardDecline.Currency.USD) @@ -8980,6 +11925,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardIncrement.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardIncrement.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(20L) .cardAuthorizationId( "card_authorization_6iqxap6ivd0fo5eu3i8x" @@ -9000,6 +12031,8 @@ internal class CardPaymentListPageResponseTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .presentmentAmount(20L) + .presentmentCurrency("USD") .realTimeDecisionId(null) .type( CardPayment.Element.CardIncrement.Type @@ -9600,6 +12633,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardValidation.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardValidation.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardValidation + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardValidation + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency( CardPayment.Element.CardValidation.Currency.USD @@ -9781,6 +12900,93 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardAuthorization.Actioner .INCREASE ) + .additionalAmounts( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency( @@ -9931,6 +13137,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardDecline.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardDecline.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardDecline + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardDecline + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardDecline.Currency.USD) @@ -10080,6 +13372,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardIncrement.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardIncrement.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(20L) .cardAuthorizationId( "card_authorization_6iqxap6ivd0fo5eu3i8x" @@ -10100,6 +13478,8 @@ internal class CardPaymentListPageResponseTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .presentmentAmount(20L) + .presentmentCurrency("USD") .realTimeDecisionId(null) .type( CardPayment.Element.CardIncrement.Type @@ -10700,6 +14080,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardValidation.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardValidation.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardValidation + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardValidation + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency( CardPayment.Element.CardValidation.Currency.USD @@ -10881,6 +14347,93 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardAuthorization.Actioner .INCREASE ) + .additionalAmounts( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency( @@ -10998,39 +14551,125 @@ internal class CardPaymentListPageResponseTest { ) .build() ) - .build() - ) - .cardAuthorizationExpiration( - CardPayment.Element.CardAuthorizationExpiration.builder() - .id( - "card_authorization_expiration_9xxbjtmixs8sfluzux2e" - ) - .cardAuthorizationId( - "card_authorization_6iqxap6ivd0fo5eu3i8x" - ) - .currency( - CardPayment.Element.CardAuthorizationExpiration - .Currency - .USD - ) - .expiredAmount(20L) - .network( - CardPayment.Element.CardAuthorizationExpiration - .Network - .VISA - ) - .type( - CardPayment.Element.CardAuthorizationExpiration.Type - .CARD_AUTHORIZATION_EXPIRATION - ) - .build() - ) - .cardDecline( - CardPayment.Element.CardDecline.builder() - .id("card_decline_bx3o8zd7glq8yvtwg25v") - .actioner( - CardPayment.Element.CardDecline.Actioner.INCREASE - ) + .build() + ) + .cardAuthorizationExpiration( + CardPayment.Element.CardAuthorizationExpiration.builder() + .id( + "card_authorization_expiration_9xxbjtmixs8sfluzux2e" + ) + .cardAuthorizationId( + "card_authorization_6iqxap6ivd0fo5eu3i8x" + ) + .currency( + CardPayment.Element.CardAuthorizationExpiration + .Currency + .USD + ) + .expiredAmount(20L) + .network( + CardPayment.Element.CardAuthorizationExpiration + .Network + .VISA + ) + .type( + CardPayment.Element.CardAuthorizationExpiration.Type + .CARD_AUTHORIZATION_EXPIRATION + ) + .build() + ) + .cardDecline( + CardPayment.Element.CardDecline.builder() + .id("card_decline_bx3o8zd7glq8yvtwg25v") + .actioner( + CardPayment.Element.CardDecline.Actioner.INCREASE + ) + .additionalAmounts( + CardPayment.Element.CardDecline.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardDecline + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardDecline + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardDecline.Currency.USD) @@ -11180,6 +14819,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardIncrement.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardIncrement.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(20L) .cardAuthorizationId( "card_authorization_6iqxap6ivd0fo5eu3i8x" @@ -11200,6 +14925,8 @@ internal class CardPaymentListPageResponseTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .presentmentAmount(20L) + .presentmentCurrency("USD") .realTimeDecisionId(null) .type( CardPayment.Element.CardIncrement.Type @@ -11800,6 +15527,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardValidation.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardValidation.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardValidation + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardValidation + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency( CardPayment.Element.CardValidation.Currency.USD @@ -11981,6 +15794,93 @@ internal class CardPaymentListPageResponseTest { CardPayment.Element.CardAuthorization.Actioner .INCREASE ) + .additionalAmounts( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency( @@ -12131,6 +16031,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardDecline.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardDecline.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardDecline + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardDecline + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardDecline + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardDecline.Currency.USD) @@ -12280,6 +16266,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardIncrement.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardIncrement.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardIncrement + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(20L) .cardAuthorizationId( "card_authorization_6iqxap6ivd0fo5eu3i8x" @@ -12300,6 +16372,8 @@ internal class CardPaymentListPageResponseTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .presentmentAmount(20L) + .presentmentCurrency("USD") .realTimeDecisionId(null) .type( CardPayment.Element.CardIncrement.Type @@ -12900,6 +16974,92 @@ internal class CardPaymentListPageResponseTest { .actioner( CardPayment.Element.CardValidation.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardValidation.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardValidation + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardValidation + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardValidation + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency( CardPayment.Element.CardValidation.Currency.USD 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 6d1ef0810..0fbe81d3f 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 @@ -89,6 +89,92 @@ internal class CardPaymentTest { .actioner( CardPayment.Element.CardAuthorization.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardAuthorization.Currency.USD) @@ -215,6 +301,82 @@ internal class CardPaymentTest { CardPayment.Element.CardDecline.builder() .id("card_decline_bx3o8zd7glq8yvtwg25v") .actioner(CardPayment.Element.CardDecline.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardDecline.AdditionalAmounts.builder() + .clinic( + CardPayment.Element.CardDecline.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardDecline.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardDecline.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardDecline.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardDecline.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardDecline.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardDecline.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardDecline.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardDecline.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardDecline.Currency.USD) @@ -341,6 +503,83 @@ internal class CardPaymentTest { CardPayment.Element.CardIncrement.builder() .id("card_increment_6ztayc58j1od0rpebp3e") .actioner(CardPayment.Element.CardIncrement.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardIncrement.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + CardPayment.Element.CardIncrement.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardIncrement.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(20L) .cardAuthorizationId("card_authorization_6iqxap6ivd0fo5eu3i8x") .currency(CardPayment.Element.CardIncrement.Currency.USD) @@ -357,6 +596,8 @@ internal class CardPaymentTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .presentmentAmount(20L) + .presentmentCurrency("USD") .realTimeDecisionId(null) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) @@ -890,6 +1131,83 @@ internal class CardPaymentTest { CardPayment.Element.CardValidation.builder() .id("card_validation_yi4e59jiaz6n9hx8tczv") .actioner(CardPayment.Element.CardValidation.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardValidation.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardValidation.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardValidation.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardValidation.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardValidation.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardValidation.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardValidation.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardValidation.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardValidation.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardValidation.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardValidation.Currency.USD) .digitalWalletTokenId(null) @@ -1052,6 +1370,92 @@ internal class CardPaymentTest { .actioner( CardPayment.Element.CardAuthorization.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardAuthorization.Currency.USD) @@ -1178,6 +1582,82 @@ internal class CardPaymentTest { CardPayment.Element.CardDecline.builder() .id("card_decline_bx3o8zd7glq8yvtwg25v") .actioner(CardPayment.Element.CardDecline.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardDecline.AdditionalAmounts.builder() + .clinic( + CardPayment.Element.CardDecline.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardDecline.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardDecline.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardDecline.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardDecline.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardDecline.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardDecline.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardDecline.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardDecline.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardDecline.Currency.USD) @@ -1304,6 +1784,83 @@ internal class CardPaymentTest { CardPayment.Element.CardIncrement.builder() .id("card_increment_6ztayc58j1od0rpebp3e") .actioner(CardPayment.Element.CardIncrement.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardIncrement.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + CardPayment.Element.CardIncrement.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardIncrement.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(20L) .cardAuthorizationId("card_authorization_6iqxap6ivd0fo5eu3i8x") .currency(CardPayment.Element.CardIncrement.Currency.USD) @@ -1320,6 +1877,8 @@ internal class CardPaymentTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .presentmentAmount(20L) + .presentmentCurrency("USD") .realTimeDecisionId(null) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) @@ -1853,6 +2412,83 @@ internal class CardPaymentTest { CardPayment.Element.CardValidation.builder() .id("card_validation_yi4e59jiaz6n9hx8tczv") .actioner(CardPayment.Element.CardValidation.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardValidation.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardValidation.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardValidation.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardValidation.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardValidation.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardValidation.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardValidation.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardValidation.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardValidation.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardValidation.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardValidation.Currency.USD) .digitalWalletTokenId(null) @@ -2015,22 +2651,108 @@ internal class CardPaymentTest { .actioner( CardPayment.Element.CardAuthorization.Actioner.INCREASE ) - .amount(100L) - .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") - .currency(CardPayment.Element.CardAuthorization.Currency.USD) - .digitalWalletTokenId(null) - .direction( - CardPayment.Element.CardAuthorization.Direction.SETTLEMENT - ) - .expiresAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .merchantAcceptorId("5665270011000168") - .merchantCategoryCode("5734") - .merchantCity("New York") - .merchantCountry("US") - .merchantDescriptor("AMAZON.COM") - .merchantPostalCode("10045") - .merchantState("NY") - .networkDetails( + .additionalAmounts( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) + .amount(100L) + .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") + .currency(CardPayment.Element.CardAuthorization.Currency.USD) + .digitalWalletTokenId(null) + .direction( + CardPayment.Element.CardAuthorization.Direction.SETTLEMENT + ) + .expiresAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .merchantAcceptorId("5665270011000168") + .merchantCategoryCode("5734") + .merchantCity("New York") + .merchantCountry("US") + .merchantDescriptor("AMAZON.COM") + .merchantPostalCode("10045") + .merchantState("NY") + .networkDetails( CardPayment.Element.CardAuthorization.NetworkDetails .builder() .category( @@ -2141,6 +2863,82 @@ internal class CardPaymentTest { CardPayment.Element.CardDecline.builder() .id("card_decline_bx3o8zd7glq8yvtwg25v") .actioner(CardPayment.Element.CardDecline.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardDecline.AdditionalAmounts.builder() + .clinic( + CardPayment.Element.CardDecline.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardDecline.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardDecline.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardDecline.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardDecline.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardDecline.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardDecline.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardDecline.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardDecline.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardDecline.Currency.USD) @@ -2267,6 +3065,83 @@ internal class CardPaymentTest { CardPayment.Element.CardIncrement.builder() .id("card_increment_6ztayc58j1od0rpebp3e") .actioner(CardPayment.Element.CardIncrement.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardIncrement.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + CardPayment.Element.CardIncrement.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardIncrement.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(20L) .cardAuthorizationId("card_authorization_6iqxap6ivd0fo5eu3i8x") .currency(CardPayment.Element.CardIncrement.Currency.USD) @@ -2283,6 +3158,8 @@ internal class CardPaymentTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .presentmentAmount(20L) + .presentmentCurrency("USD") .realTimeDecisionId(null) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) @@ -2816,6 +3693,83 @@ internal class CardPaymentTest { CardPayment.Element.CardValidation.builder() .id("card_validation_yi4e59jiaz6n9hx8tczv") .actioner(CardPayment.Element.CardValidation.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardValidation.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardValidation.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardValidation.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardValidation.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardValidation.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardValidation.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardValidation.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardValidation.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardValidation.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardValidation.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardValidation.Currency.USD) .digitalWalletTokenId(null) @@ -2978,6 +3932,92 @@ internal class CardPaymentTest { .actioner( CardPayment.Element.CardAuthorization.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardAuthorization.Currency.USD) @@ -3104,6 +4144,82 @@ internal class CardPaymentTest { CardPayment.Element.CardDecline.builder() .id("card_decline_bx3o8zd7glq8yvtwg25v") .actioner(CardPayment.Element.CardDecline.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardDecline.AdditionalAmounts.builder() + .clinic( + CardPayment.Element.CardDecline.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardDecline.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardDecline.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardDecline.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardDecline.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardDecline.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardDecline.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardDecline.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardDecline.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardDecline.Currency.USD) @@ -3230,6 +4346,83 @@ internal class CardPaymentTest { CardPayment.Element.CardIncrement.builder() .id("card_increment_6ztayc58j1od0rpebp3e") .actioner(CardPayment.Element.CardIncrement.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardIncrement.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + CardPayment.Element.CardIncrement.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardIncrement.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(20L) .cardAuthorizationId("card_authorization_6iqxap6ivd0fo5eu3i8x") .currency(CardPayment.Element.CardIncrement.Currency.USD) @@ -3246,6 +4439,8 @@ internal class CardPaymentTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .presentmentAmount(20L) + .presentmentCurrency("USD") .realTimeDecisionId(null) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) @@ -3779,6 +4974,83 @@ internal class CardPaymentTest { CardPayment.Element.CardValidation.builder() .id("card_validation_yi4e59jiaz6n9hx8tczv") .actioner(CardPayment.Element.CardValidation.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardValidation.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardValidation.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardValidation.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardValidation.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardValidation.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardValidation.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardValidation.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardValidation.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardValidation.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardValidation.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardValidation.Currency.USD) .digitalWalletTokenId(null) @@ -3953,6 +5225,82 @@ internal class CardPaymentTest { CardPayment.Element.CardAuthorization.builder() .id("card_authorization_6iqxap6ivd0fo5eu3i8x") .actioner(CardPayment.Element.CardAuthorization.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardAuthorization.AdditionalAmounts.builder() + .clinic( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardAuthorization.Currency.USD) @@ -4062,6 +5410,76 @@ internal class CardPaymentTest { CardPayment.Element.CardDecline.builder() .id("card_decline_bx3o8zd7glq8yvtwg25v") .actioner(CardPayment.Element.CardDecline.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardDecline.AdditionalAmounts.builder() + .clinic( + CardPayment.Element.CardDecline.AdditionalAmounts.Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardDecline.AdditionalAmounts.Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardDecline.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardDecline.AdditionalAmounts.Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardDecline.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardDecline.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardDecline.AdditionalAmounts.Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardDecline.AdditionalAmounts.Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardDecline.AdditionalAmounts.Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardDecline.Currency.USD) @@ -4175,6 +5593,77 @@ internal class CardPaymentTest { CardPayment.Element.CardIncrement.builder() .id("card_increment_6ztayc58j1od0rpebp3e") .actioner(CardPayment.Element.CardIncrement.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardIncrement.AdditionalAmounts.builder() + .clinic( + CardPayment.Element.CardIncrement.AdditionalAmounts.Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardIncrement.AdditionalAmounts.Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + CardPayment.Element.CardIncrement.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardIncrement.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardIncrement.AdditionalAmounts.Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardIncrement.AdditionalAmounts.Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardIncrement.AdditionalAmounts.Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(20L) .cardAuthorizationId("card_authorization_6iqxap6ivd0fo5eu3i8x") .currency(CardPayment.Element.CardIncrement.Currency.USD) @@ -4188,6 +5677,8 @@ internal class CardPaymentTest { ) .networkRiskScore(10L) .pendingTransactionId("pending_transaction_k1sfetcau2qbvjbzgju4") + .presentmentAmount(20L) + .presentmentCurrency("USD") .realTimeDecisionId(null) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) @@ -4668,6 +6159,77 @@ internal class CardPaymentTest { CardPayment.Element.CardValidation.builder() .id("card_validation_yi4e59jiaz6n9hx8tczv") .actioner(CardPayment.Element.CardValidation.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardValidation.AdditionalAmounts.builder() + .clinic( + CardPayment.Element.CardValidation.AdditionalAmounts.Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardValidation.AdditionalAmounts.Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardValidation.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardValidation.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardValidation.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardValidation.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardValidation.AdditionalAmounts.Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardValidation.AdditionalAmounts.Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardValidation.AdditionalAmounts.Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardValidation.Currency.USD) .digitalWalletTokenId(null) @@ -4810,6 +6372,82 @@ internal class CardPaymentTest { CardPayment.Element.CardAuthorization.builder() .id("card_authorization_6iqxap6ivd0fo5eu3i8x") .actioner(CardPayment.Element.CardAuthorization.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardAuthorization.AdditionalAmounts.builder() + .clinic( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardAuthorization.Currency.USD) @@ -4919,6 +6557,76 @@ internal class CardPaymentTest { CardPayment.Element.CardDecline.builder() .id("card_decline_bx3o8zd7glq8yvtwg25v") .actioner(CardPayment.Element.CardDecline.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardDecline.AdditionalAmounts.builder() + .clinic( + CardPayment.Element.CardDecline.AdditionalAmounts.Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardDecline.AdditionalAmounts.Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardDecline.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardDecline.AdditionalAmounts.Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardDecline.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardDecline.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardDecline.AdditionalAmounts.Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardDecline.AdditionalAmounts.Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardDecline.AdditionalAmounts.Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardDecline.Currency.USD) @@ -5032,6 +6740,77 @@ internal class CardPaymentTest { CardPayment.Element.CardIncrement.builder() .id("card_increment_6ztayc58j1od0rpebp3e") .actioner(CardPayment.Element.CardIncrement.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardIncrement.AdditionalAmounts.builder() + .clinic( + CardPayment.Element.CardIncrement.AdditionalAmounts.Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardIncrement.AdditionalAmounts.Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + CardPayment.Element.CardIncrement.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardIncrement.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardIncrement.AdditionalAmounts.Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardIncrement.AdditionalAmounts.Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardIncrement.AdditionalAmounts.Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(20L) .cardAuthorizationId("card_authorization_6iqxap6ivd0fo5eu3i8x") .currency(CardPayment.Element.CardIncrement.Currency.USD) @@ -5045,6 +6824,8 @@ internal class CardPaymentTest { ) .networkRiskScore(10L) .pendingTransactionId("pending_transaction_k1sfetcau2qbvjbzgju4") + .presentmentAmount(20L) + .presentmentCurrency("USD") .realTimeDecisionId(null) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) @@ -5525,6 +7306,77 @@ internal class CardPaymentTest { CardPayment.Element.CardValidation.builder() .id("card_validation_yi4e59jiaz6n9hx8tczv") .actioner(CardPayment.Element.CardValidation.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardValidation.AdditionalAmounts.builder() + .clinic( + CardPayment.Element.CardValidation.AdditionalAmounts.Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardValidation.AdditionalAmounts.Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardValidation.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardValidation.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardValidation.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardValidation.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardValidation.AdditionalAmounts.Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardValidation.AdditionalAmounts.Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardValidation.AdditionalAmounts.Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardValidation.Currency.USD) .digitalWalletTokenId(null) @@ -5667,6 +7519,82 @@ internal class CardPaymentTest { CardPayment.Element.CardAuthorization.builder() .id("card_authorization_6iqxap6ivd0fo5eu3i8x") .actioner(CardPayment.Element.CardAuthorization.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardAuthorization.AdditionalAmounts.builder() + .clinic( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardAuthorization.Currency.USD) @@ -5776,6 +7704,76 @@ internal class CardPaymentTest { CardPayment.Element.CardDecline.builder() .id("card_decline_bx3o8zd7glq8yvtwg25v") .actioner(CardPayment.Element.CardDecline.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardDecline.AdditionalAmounts.builder() + .clinic( + CardPayment.Element.CardDecline.AdditionalAmounts.Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardDecline.AdditionalAmounts.Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardDecline.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardDecline.AdditionalAmounts.Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardDecline.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardDecline.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardDecline.AdditionalAmounts.Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardDecline.AdditionalAmounts.Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardDecline.AdditionalAmounts.Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardDecline.Currency.USD) @@ -5889,6 +7887,77 @@ internal class CardPaymentTest { CardPayment.Element.CardIncrement.builder() .id("card_increment_6ztayc58j1od0rpebp3e") .actioner(CardPayment.Element.CardIncrement.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardIncrement.AdditionalAmounts.builder() + .clinic( + CardPayment.Element.CardIncrement.AdditionalAmounts.Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardIncrement.AdditionalAmounts.Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + CardPayment.Element.CardIncrement.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardIncrement.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardIncrement.AdditionalAmounts.Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardIncrement.AdditionalAmounts.Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardIncrement.AdditionalAmounts.Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(20L) .cardAuthorizationId("card_authorization_6iqxap6ivd0fo5eu3i8x") .currency(CardPayment.Element.CardIncrement.Currency.USD) @@ -5902,6 +7971,8 @@ internal class CardPaymentTest { ) .networkRiskScore(10L) .pendingTransactionId("pending_transaction_k1sfetcau2qbvjbzgju4") + .presentmentAmount(20L) + .presentmentCurrency("USD") .realTimeDecisionId(null) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) @@ -6382,6 +8453,77 @@ internal class CardPaymentTest { CardPayment.Element.CardValidation.builder() .id("card_validation_yi4e59jiaz6n9hx8tczv") .actioner(CardPayment.Element.CardValidation.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardValidation.AdditionalAmounts.builder() + .clinic( + CardPayment.Element.CardValidation.AdditionalAmounts.Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardValidation.AdditionalAmounts.Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardValidation.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardValidation.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardValidation.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardValidation.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardValidation.AdditionalAmounts.Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardValidation.AdditionalAmounts.Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardValidation.AdditionalAmounts.Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardValidation.Currency.USD) .digitalWalletTokenId(null) @@ -6524,6 +8666,82 @@ internal class CardPaymentTest { CardPayment.Element.CardAuthorization.builder() .id("card_authorization_6iqxap6ivd0fo5eu3i8x") .actioner(CardPayment.Element.CardAuthorization.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardAuthorization.AdditionalAmounts.builder() + .clinic( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardAuthorization.Currency.USD) @@ -6633,6 +8851,76 @@ internal class CardPaymentTest { CardPayment.Element.CardDecline.builder() .id("card_decline_bx3o8zd7glq8yvtwg25v") .actioner(CardPayment.Element.CardDecline.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardDecline.AdditionalAmounts.builder() + .clinic( + CardPayment.Element.CardDecline.AdditionalAmounts.Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardDecline.AdditionalAmounts.Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardDecline.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardDecline.AdditionalAmounts.Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardDecline.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardDecline.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardDecline.AdditionalAmounts.Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardDecline.AdditionalAmounts.Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardDecline.AdditionalAmounts.Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardDecline.Currency.USD) @@ -6746,6 +9034,77 @@ internal class CardPaymentTest { CardPayment.Element.CardIncrement.builder() .id("card_increment_6ztayc58j1od0rpebp3e") .actioner(CardPayment.Element.CardIncrement.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardIncrement.AdditionalAmounts.builder() + .clinic( + CardPayment.Element.CardIncrement.AdditionalAmounts.Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardIncrement.AdditionalAmounts.Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + CardPayment.Element.CardIncrement.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardIncrement.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardIncrement.AdditionalAmounts.Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardIncrement.AdditionalAmounts.Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardIncrement.AdditionalAmounts.Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(20L) .cardAuthorizationId("card_authorization_6iqxap6ivd0fo5eu3i8x") .currency(CardPayment.Element.CardIncrement.Currency.USD) @@ -6759,6 +9118,8 @@ internal class CardPaymentTest { ) .networkRiskScore(10L) .pendingTransactionId("pending_transaction_k1sfetcau2qbvjbzgju4") + .presentmentAmount(20L) + .presentmentCurrency("USD") .realTimeDecisionId(null) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) @@ -7231,14 +9592,85 @@ internal class CardPaymentTest { ) .build() ) - .transactionId("transaction_uyrp7fld2ium70oa7oi") - .type(CardPayment.Element.CardSettlement.Type.CARD_SETTLEMENT) - .build() - ) - .cardValidation( - CardPayment.Element.CardValidation.builder() - .id("card_validation_yi4e59jiaz6n9hx8tczv") - .actioner(CardPayment.Element.CardValidation.Actioner.INCREASE) + .transactionId("transaction_uyrp7fld2ium70oa7oi") + .type(CardPayment.Element.CardSettlement.Type.CARD_SETTLEMENT) + .build() + ) + .cardValidation( + CardPayment.Element.CardValidation.builder() + .id("card_validation_yi4e59jiaz6n9hx8tczv") + .actioner(CardPayment.Element.CardValidation.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardValidation.AdditionalAmounts.builder() + .clinic( + CardPayment.Element.CardValidation.AdditionalAmounts.Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardValidation.AdditionalAmounts.Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardValidation.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardValidation.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardValidation.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardValidation.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardValidation.AdditionalAmounts.Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardValidation.AdditionalAmounts.Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardValidation.AdditionalAmounts.Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardValidation.Currency.USD) .digitalWalletTokenId(null) @@ -7418,6 +9850,92 @@ internal class CardPaymentTest { .actioner( CardPayment.Element.CardAuthorization.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardAuthorization.Currency.USD) @@ -7544,6 +10062,82 @@ internal class CardPaymentTest { CardPayment.Element.CardDecline.builder() .id("card_decline_bx3o8zd7glq8yvtwg25v") .actioner(CardPayment.Element.CardDecline.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardDecline.AdditionalAmounts.builder() + .clinic( + CardPayment.Element.CardDecline.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardDecline.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardDecline.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardDecline.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardDecline.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardDecline.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardDecline.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardDecline.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardDecline.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardDecline.Currency.USD) @@ -7670,6 +10264,83 @@ internal class CardPaymentTest { CardPayment.Element.CardIncrement.builder() .id("card_increment_6ztayc58j1od0rpebp3e") .actioner(CardPayment.Element.CardIncrement.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardIncrement.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + CardPayment.Element.CardIncrement.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardIncrement.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(20L) .cardAuthorizationId("card_authorization_6iqxap6ivd0fo5eu3i8x") .currency(CardPayment.Element.CardIncrement.Currency.USD) @@ -7686,6 +10357,8 @@ internal class CardPaymentTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .presentmentAmount(20L) + .presentmentCurrency("USD") .realTimeDecisionId(null) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) @@ -8219,6 +10892,83 @@ internal class CardPaymentTest { CardPayment.Element.CardValidation.builder() .id("card_validation_yi4e59jiaz6n9hx8tczv") .actioner(CardPayment.Element.CardValidation.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardValidation.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardValidation.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardValidation.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardValidation.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardValidation.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardValidation.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardValidation.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardValidation.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardValidation.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardValidation.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardValidation.Currency.USD) .digitalWalletTokenId(null) @@ -8381,6 +11131,92 @@ internal class CardPaymentTest { .actioner( CardPayment.Element.CardAuthorization.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardAuthorization.Currency.USD) @@ -8507,6 +11343,82 @@ internal class CardPaymentTest { CardPayment.Element.CardDecline.builder() .id("card_decline_bx3o8zd7glq8yvtwg25v") .actioner(CardPayment.Element.CardDecline.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardDecline.AdditionalAmounts.builder() + .clinic( + CardPayment.Element.CardDecline.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardDecline.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardDecline.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardDecline.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardDecline.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardDecline.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardDecline.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardDecline.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardDecline.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardDecline.Currency.USD) @@ -8633,6 +11545,83 @@ internal class CardPaymentTest { CardPayment.Element.CardIncrement.builder() .id("card_increment_6ztayc58j1od0rpebp3e") .actioner(CardPayment.Element.CardIncrement.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardIncrement.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + CardPayment.Element.CardIncrement.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardIncrement.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(20L) .cardAuthorizationId("card_authorization_6iqxap6ivd0fo5eu3i8x") .currency(CardPayment.Element.CardIncrement.Currency.USD) @@ -8649,6 +11638,8 @@ internal class CardPaymentTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .presentmentAmount(20L) + .presentmentCurrency("USD") .realTimeDecisionId(null) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) @@ -9174,14 +12165,91 @@ internal class CardPaymentTest { ) .build() ) - .transactionId("transaction_uyrp7fld2ium70oa7oi") - .type(CardPayment.Element.CardSettlement.Type.CARD_SETTLEMENT) - .build() - ) - .cardValidation( - CardPayment.Element.CardValidation.builder() - .id("card_validation_yi4e59jiaz6n9hx8tczv") - .actioner(CardPayment.Element.CardValidation.Actioner.INCREASE) + .transactionId("transaction_uyrp7fld2ium70oa7oi") + .type(CardPayment.Element.CardSettlement.Type.CARD_SETTLEMENT) + .build() + ) + .cardValidation( + CardPayment.Element.CardValidation.builder() + .id("card_validation_yi4e59jiaz6n9hx8tczv") + .actioner(CardPayment.Element.CardValidation.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardValidation.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardValidation.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardValidation.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardValidation.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardValidation.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardValidation.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardValidation.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardValidation.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardValidation.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardValidation.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardValidation.Currency.USD) .digitalWalletTokenId(null) @@ -9344,6 +12412,92 @@ internal class CardPaymentTest { .actioner( CardPayment.Element.CardAuthorization.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardAuthorization.Currency.USD) @@ -9470,6 +12624,82 @@ internal class CardPaymentTest { CardPayment.Element.CardDecline.builder() .id("card_decline_bx3o8zd7glq8yvtwg25v") .actioner(CardPayment.Element.CardDecline.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardDecline.AdditionalAmounts.builder() + .clinic( + CardPayment.Element.CardDecline.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardDecline.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardDecline.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardDecline.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardDecline.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardDecline.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardDecline.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardDecline.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardDecline.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardDecline.Currency.USD) @@ -9596,6 +12826,83 @@ internal class CardPaymentTest { CardPayment.Element.CardIncrement.builder() .id("card_increment_6ztayc58j1od0rpebp3e") .actioner(CardPayment.Element.CardIncrement.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardIncrement.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + CardPayment.Element.CardIncrement.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardIncrement.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(20L) .cardAuthorizationId("card_authorization_6iqxap6ivd0fo5eu3i8x") .currency(CardPayment.Element.CardIncrement.Currency.USD) @@ -9612,6 +12919,8 @@ internal class CardPaymentTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .presentmentAmount(20L) + .presentmentCurrency("USD") .realTimeDecisionId(null) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) @@ -10145,6 +13454,83 @@ internal class CardPaymentTest { CardPayment.Element.CardValidation.builder() .id("card_validation_yi4e59jiaz6n9hx8tczv") .actioner(CardPayment.Element.CardValidation.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardValidation.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardValidation.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardValidation.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardValidation.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardValidation.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardValidation.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardValidation.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardValidation.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardValidation.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardValidation.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardValidation.Currency.USD) .digitalWalletTokenId(null) @@ -10307,6 +13693,92 @@ internal class CardPaymentTest { .actioner( CardPayment.Element.CardAuthorization.Actioner.INCREASE ) + .additionalAmounts( + CardPayment.Element.CardAuthorization.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardAuthorization + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardAuthorization.Currency.USD) @@ -10433,6 +13905,82 @@ internal class CardPaymentTest { CardPayment.Element.CardDecline.builder() .id("card_decline_bx3o8zd7glq8yvtwg25v") .actioner(CardPayment.Element.CardDecline.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardDecline.AdditionalAmounts.builder() + .clinic( + CardPayment.Element.CardDecline.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardDecline.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardDecline.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardDecline.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardDecline.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardDecline.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardDecline.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardDecline.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardDecline.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardDecline.Currency.USD) @@ -10559,6 +14107,83 @@ internal class CardPaymentTest { CardPayment.Element.CardIncrement.builder() .id("card_increment_6ztayc58j1od0rpebp3e") .actioner(CardPayment.Element.CardIncrement.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardIncrement.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + CardPayment.Element.CardIncrement.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardIncrement.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardIncrement.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(20L) .cardAuthorizationId("card_authorization_6iqxap6ivd0fo5eu3i8x") .currency(CardPayment.Element.CardIncrement.Currency.USD) @@ -10575,6 +14200,8 @@ internal class CardPaymentTest { .pendingTransactionId( "pending_transaction_k1sfetcau2qbvjbzgju4" ) + .presentmentAmount(20L) + .presentmentCurrency("USD") .realTimeDecisionId(null) .type(CardPayment.Element.CardIncrement.Type.CARD_INCREMENT) .updatedAuthorizationAmount(120L) @@ -11108,6 +14735,83 @@ internal class CardPaymentTest { CardPayment.Element.CardValidation.builder() .id("card_validation_yi4e59jiaz6n9hx8tczv") .actioner(CardPayment.Element.CardValidation.Actioner.INCREASE) + .additionalAmounts( + CardPayment.Element.CardValidation.AdditionalAmounts + .builder() + .clinic( + CardPayment.Element.CardValidation.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + CardPayment.Element.CardValidation.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + CardPayment.Element.CardValidation.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + CardPayment.Element.CardValidation.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + CardPayment.Element.CardValidation.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + CardPayment.Element.CardValidation.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + CardPayment.Element.CardValidation.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + CardPayment.Element.CardValidation.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + CardPayment.Element.CardValidation.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(CardPayment.Element.CardValidation.Currency.USD) .digitalWalletTokenId(null) 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 90625127c..47e823b87 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 @@ -56,6 +56,92 @@ internal class DeclinedTransactionListPageResponseTest { .actioner( DeclinedTransaction.Source.CardDecline.Actioner.INCREASE ) + .additionalAmounts( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .builder() + .clinic( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency( @@ -299,6 +385,92 @@ internal class DeclinedTransactionListPageResponseTest { .actioner( DeclinedTransaction.Source.CardDecline.Actioner.INCREASE ) + .additionalAmounts( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .builder() + .clinic( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(DeclinedTransaction.Source.CardDecline.Currency.USD) @@ -539,6 +711,92 @@ internal class DeclinedTransactionListPageResponseTest { .actioner( DeclinedTransaction.Source.CardDecline.Actioner.INCREASE ) + .additionalAmounts( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .builder() + .clinic( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency( 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 a6c7b0774..e3c3fcef5 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 @@ -47,6 +47,83 @@ internal class DeclinedTransactionTest { DeclinedTransaction.Source.CardDecline.builder() .id("card_decline_bx3o8zd7glq8yvtwg25v") .actioner(DeclinedTransaction.Source.CardDecline.Actioner.INCREASE) + .additionalAmounts( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .builder() + .clinic( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(DeclinedTransaction.Source.CardDecline.Currency.USD) @@ -255,6 +332,82 @@ internal class DeclinedTransactionTest { DeclinedTransaction.Source.CardDecline.builder() .id("card_decline_bx3o8zd7glq8yvtwg25v") .actioner(DeclinedTransaction.Source.CardDecline.Actioner.INCREASE) + .additionalAmounts( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts.builder() + .clinic( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(DeclinedTransaction.Source.CardDecline.Currency.USD) @@ -453,6 +606,83 @@ internal class DeclinedTransactionTest { DeclinedTransaction.Source.CardDecline.builder() .id("card_decline_bx3o8zd7glq8yvtwg25v") .actioner(DeclinedTransaction.Source.CardDecline.Actioner.INCREASE) + .additionalAmounts( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .builder() + .clinic( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(DeclinedTransaction.Source.CardDecline.Currency.USD) 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 2f1ad61a7..2308c6172 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 @@ -53,6 +53,93 @@ internal class PendingTransactionListPageResponseTest { PendingTransaction.Source.CardAuthorization.Actioner .INCREASE ) + .additionalAmounts( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .builder() + .clinic( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency( @@ -313,6 +400,93 @@ internal class PendingTransactionListPageResponseTest { PendingTransaction.Source.CardAuthorization.Actioner .INCREASE ) + .additionalAmounts( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .builder() + .clinic( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency( @@ -562,6 +736,93 @@ internal class PendingTransactionListPageResponseTest { PendingTransaction.Source.CardAuthorization.Actioner .INCREASE ) + .additionalAmounts( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .builder() + .clinic( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency( 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 a1ae6574a..fb9156100 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 @@ -49,6 +49,92 @@ internal class PendingTransactionTest { .actioner( PendingTransaction.Source.CardAuthorization.Actioner.INCREASE ) + .additionalAmounts( + PendingTransaction.Source.CardAuthorization.AdditionalAmounts + .builder() + .clinic( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(PendingTransaction.Source.CardAuthorization.Currency.USD) @@ -270,6 +356,92 @@ internal class PendingTransactionTest { PendingTransaction.Source.CardAuthorization.builder() .id("card_authorization_6iqxap6ivd0fo5eu3i8x") .actioner(PendingTransaction.Source.CardAuthorization.Actioner.INCREASE) + .additionalAmounts( + PendingTransaction.Source.CardAuthorization.AdditionalAmounts + .builder() + .clinic( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(PendingTransaction.Source.CardAuthorization.Currency.USD) @@ -488,6 +660,92 @@ internal class PendingTransactionTest { .actioner( PendingTransaction.Source.CardAuthorization.Actioner.INCREASE ) + .additionalAmounts( + PendingTransaction.Source.CardAuthorization.AdditionalAmounts + .builder() + .clinic( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(PendingTransaction.Source.CardAuthorization.Currency.USD) diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecisionTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecisionTest.kt index 4c44f1496..890f8639b 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecisionTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecisionTest.kt @@ -36,6 +36,76 @@ internal class RealTimeDecisionTest { .cardAuthorization( RealTimeDecision.CardAuthorization.builder() .accountId("account_in71c4amph0vgo2qllky") + .additionalAmounts( + RealTimeDecision.CardAuthorization.AdditionalAmounts.builder() + .clinic( + RealTimeDecision.CardAuthorization.AdditionalAmounts.Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + RealTimeDecision.CardAuthorization.AdditionalAmounts.Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + RealTimeDecision.CardAuthorization.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + RealTimeDecision.CardAuthorization.AdditionalAmounts.Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + RealTimeDecision.CardAuthorization.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + RealTimeDecision.CardAuthorization.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + RealTimeDecision.CardAuthorization.AdditionalAmounts.Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + RealTimeDecision.CardAuthorization.AdditionalAmounts.Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + RealTimeDecision.CardAuthorization.AdditionalAmounts.Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .cardId("card_oubs0hwk5rn6knuecxg2") .decision(RealTimeDecision.CardAuthorization.Decision.APPROVE) .digitalWalletTokenId(null) @@ -197,6 +267,73 @@ internal class RealTimeDecisionTest { .contains( RealTimeDecision.CardAuthorization.builder() .accountId("account_in71c4amph0vgo2qllky") + .additionalAmounts( + RealTimeDecision.CardAuthorization.AdditionalAmounts.builder() + .clinic( + RealTimeDecision.CardAuthorization.AdditionalAmounts.Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + RealTimeDecision.CardAuthorization.AdditionalAmounts.Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + RealTimeDecision.CardAuthorization.AdditionalAmounts.Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + RealTimeDecision.CardAuthorization.AdditionalAmounts.Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + RealTimeDecision.CardAuthorization.AdditionalAmounts.TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + RealTimeDecision.CardAuthorization.AdditionalAmounts.TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + RealTimeDecision.CardAuthorization.AdditionalAmounts.Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + RealTimeDecision.CardAuthorization.AdditionalAmounts.Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + RealTimeDecision.CardAuthorization.AdditionalAmounts.Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .cardId("card_oubs0hwk5rn6knuecxg2") .decision(RealTimeDecision.CardAuthorization.Decision.APPROVE) .digitalWalletTokenId(null) @@ -361,6 +498,76 @@ internal class RealTimeDecisionTest { .cardAuthorization( RealTimeDecision.CardAuthorization.builder() .accountId("account_in71c4amph0vgo2qllky") + .additionalAmounts( + RealTimeDecision.CardAuthorization.AdditionalAmounts.builder() + .clinic( + RealTimeDecision.CardAuthorization.AdditionalAmounts.Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + RealTimeDecision.CardAuthorization.AdditionalAmounts.Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + RealTimeDecision.CardAuthorization.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + RealTimeDecision.CardAuthorization.AdditionalAmounts.Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + RealTimeDecision.CardAuthorization.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + RealTimeDecision.CardAuthorization.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + RealTimeDecision.CardAuthorization.AdditionalAmounts.Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + RealTimeDecision.CardAuthorization.AdditionalAmounts.Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + RealTimeDecision.CardAuthorization.AdditionalAmounts.Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .cardId("card_oubs0hwk5rn6knuecxg2") .decision(RealTimeDecision.CardAuthorization.Decision.APPROVE) .digitalWalletTokenId(null) 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 2680ff34d..99bdb0c3c 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 @@ -58,6 +58,92 @@ internal class CardAuthorizationCreateResponseTest { .actioner( DeclinedTransaction.Source.CardDecline.Actioner.INCREASE ) + .additionalAmounts( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .builder() + .clinic( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency( @@ -296,6 +382,93 @@ internal class CardAuthorizationCreateResponseTest { PendingTransaction.Source.CardAuthorization.Actioner .INCREASE ) + .additionalAmounts( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .builder() + .clinic( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency( @@ -558,6 +731,92 @@ internal class CardAuthorizationCreateResponseTest { .actioner( DeclinedTransaction.Source.CardDecline.Actioner.INCREASE ) + .additionalAmounts( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .builder() + .clinic( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(DeclinedTransaction.Source.CardDecline.Currency.USD) @@ -788,6 +1047,93 @@ internal class CardAuthorizationCreateResponseTest { PendingTransaction.Source.CardAuthorization.Actioner .INCREASE ) + .additionalAmounts( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .builder() + .clinic( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency( @@ -1043,6 +1389,92 @@ internal class CardAuthorizationCreateResponseTest { .actioner( DeclinedTransaction.Source.CardDecline.Actioner.INCREASE ) + .additionalAmounts( + DeclinedTransaction.Source.CardDecline.AdditionalAmounts + .builder() + .clinic( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + DeclinedTransaction.Source.CardDecline + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(-1000L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency( @@ -1281,6 +1713,93 @@ internal class CardAuthorizationCreateResponseTest { PendingTransaction.Source.CardAuthorization.Actioner .INCREASE ) + .additionalAmounts( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .builder() + .clinic( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + PendingTransaction.Source.CardAuthorization + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) .amount(100L) .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") .currency(