From b56315678747c227486e75be28e75bbdd967a4e1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 26 Sep 2025 04:13:15 +0000 Subject: [PATCH 1/2] feat(api): api update --- .stats.yml | 4 +- .../api/models/transactions/Transaction.kt | 8890 ++++++++++++++++- .../transactions/TransactionListParams.kt | 9 + .../TransactionListPageResponseTest.kt | 564 ++ .../models/transactions/TransactionTest.kt | 502 + 5 files changed, 9566 insertions(+), 403 deletions(-) diff --git a/.stats.yml b/.stats.yml index 2923d8298..a9120ac7b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 214 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-3e092c1a52f33e962b8415bfa24a244fdb66783aa093e027501124cb8658881b.yml -openapi_spec_hash: 677f23c2d65201b72074b3effb7d9ad4 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-749004bde06df3642fccde727f8e872c02795128db180789d1377c3168bd71ba.yml +openapi_spec_hash: 9058f9b3951c7608de5b67d8d5c87ffd config_hash: a143293c5450ae8f52acad08f3102575 diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/transactions/Transaction.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/transactions/Transaction.kt index f92c28978..537bacf55 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/transactions/Transaction.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/transactions/Transaction.kt @@ -878,6 +878,7 @@ private constructor( private val cardDisputeAcceptance: JsonField, private val cardDisputeFinancial: JsonField, private val cardDisputeLoss: JsonField, + private val cardFinancial: JsonField, private val cardPushTransferAcceptance: JsonField, private val cardRefund: JsonField, private val cardRevenuePayment: JsonField, @@ -938,6 +939,9 @@ private constructor( @JsonProperty("card_dispute_loss") @ExcludeMissing cardDisputeLoss: JsonField = JsonMissing.of(), + @JsonProperty("card_financial") + @ExcludeMissing + cardFinancial: JsonField = JsonMissing.of(), @JsonProperty("card_push_transfer_acceptance") @ExcludeMissing cardPushTransferAcceptance: JsonField = JsonMissing.of(), @@ -1037,6 +1041,7 @@ private constructor( cardDisputeAcceptance, cardDisputeFinancial, cardDisputeLoss, + cardFinancial, cardPushTransferAcceptance, cardRefund, cardRevenuePayment, @@ -1162,6 +1167,16 @@ private constructor( fun cardDisputeLoss(): Optional = cardDisputeLoss.getOptional("card_dispute_loss") + /** + * A Card Financial object. This field will be present in the JSON response if and only if + * `category` is equal to `card_financial`. Card Financials are temporary holds placed on a + * customers funds with the intent to later clear a transaction. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun cardFinancial(): Optional = cardFinancial.getOptional("card_financial") + /** * A Card Push Transfer Acceptance object. This field will be present in the JSON response * if and only if `category` is equal to `card_push_transfer_acceptance`. A Card Push @@ -1569,6 +1584,16 @@ private constructor( @ExcludeMissing fun _cardDisputeLoss(): JsonField = cardDisputeLoss + /** + * Returns the raw JSON value of [cardFinancial]. + * + * Unlike [cardFinancial], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("card_financial") + @ExcludeMissing + fun _cardFinancial(): JsonField = cardFinancial + /** * Returns the raw JSON value of [cardPushTransferAcceptance]. * @@ -1870,6 +1895,7 @@ private constructor( * .cardDisputeAcceptance() * .cardDisputeFinancial() * .cardDisputeLoss() + * .cardFinancial() * .cardPushTransferAcceptance() * .cardRefund() * .cardRevenuePayment() @@ -1914,6 +1940,7 @@ private constructor( private var cardDisputeAcceptance: JsonField? = null private var cardDisputeFinancial: JsonField? = null private var cardDisputeLoss: JsonField? = null + private var cardFinancial: JsonField? = null private var cardPushTransferAcceptance: JsonField? = null private var cardRefund: JsonField? = null private var cardRevenuePayment: JsonField? = null @@ -1965,6 +1992,7 @@ private constructor( cardDisputeAcceptance = source.cardDisputeAcceptance cardDisputeFinancial = source.cardDisputeFinancial cardDisputeLoss = source.cardDisputeLoss + cardFinancial = source.cardFinancial cardPushTransferAcceptance = source.cardPushTransferAcceptance cardRefund = source.cardRefund cardRevenuePayment = source.cardRevenuePayment @@ -2214,6 +2242,29 @@ private constructor( this.cardDisputeLoss = cardDisputeLoss } + /** + * A Card Financial object. This field will be present in the JSON response if and only + * if `category` is equal to `card_financial`. Card Financials are temporary holds + * placed on a customers funds with the intent to later clear a transaction. + */ + fun cardFinancial(cardFinancial: CardFinancial?) = + cardFinancial(JsonField.ofNullable(cardFinancial)) + + /** Alias for calling [Builder.cardFinancial] with `cardFinancial.orElse(null)`. */ + fun cardFinancial(cardFinancial: Optional) = + cardFinancial(cardFinancial.getOrNull()) + + /** + * Sets [Builder.cardFinancial] to an arbitrary JSON value. + * + * You should usually call [Builder.cardFinancial] with a well-typed [CardFinancial] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun cardFinancial(cardFinancial: JsonField) = apply { + this.cardFinancial = cardFinancial + } + /** * A Card Push Transfer Acceptance object. This field will be present in the JSON * response if and only if `category` is equal to `card_push_transfer_acceptance`. A @@ -3001,6 +3052,7 @@ private constructor( * .cardDisputeAcceptance() * .cardDisputeFinancial() * .cardDisputeLoss() + * .cardFinancial() * .cardPushTransferAcceptance() * .cardRefund() * .cardRevenuePayment() @@ -3043,6 +3095,7 @@ private constructor( checkRequired("cardDisputeAcceptance", cardDisputeAcceptance), checkRequired("cardDisputeFinancial", cardDisputeFinancial), checkRequired("cardDisputeLoss", cardDisputeLoss), + checkRequired("cardFinancial", cardFinancial), checkRequired("cardPushTransferAcceptance", cardPushTransferAcceptance), checkRequired("cardRefund", cardRefund), checkRequired("cardRevenuePayment", cardRevenuePayment), @@ -3105,6 +3158,7 @@ private constructor( cardDisputeAcceptance().ifPresent { it.validate() } cardDisputeFinancial().ifPresent { it.validate() } cardDisputeLoss().ifPresent { it.validate() } + cardFinancial().ifPresent { it.validate() } cardPushTransferAcceptance().ifPresent { it.validate() } cardRefund().ifPresent { it.validate() } cardRevenuePayment().ifPresent { it.validate() } @@ -3159,6 +3213,7 @@ private constructor( (cardDisputeAcceptance.asKnown().getOrNull()?.validity() ?: 0) + (cardDisputeFinancial.asKnown().getOrNull()?.validity() ?: 0) + (cardDisputeLoss.asKnown().getOrNull()?.validity() ?: 0) + + (cardFinancial.asKnown().getOrNull()?.validity() ?: 0) + (cardPushTransferAcceptance.asKnown().getOrNull()?.validity() ?: 0) + (cardRefund.asKnown().getOrNull()?.validity() ?: 0) + (cardRevenuePayment.asKnown().getOrNull()?.validity() ?: 0) + @@ -7683,272 +7738,65 @@ private constructor( } /** - * A Card Push Transfer Acceptance object. This field will be present in the JSON response - * if and only if `category` is equal to `card_push_transfer_acceptance`. A Card Push - * Transfer Acceptance is created when an Outbound Card Push Transfer sent from Increase is - * accepted by the receiving bank. + * A Card Financial object. This field will be present in the JSON response if and only if + * `category` is equal to `card_financial`. Card Financials are temporary holds placed on a + * customers funds with the intent to later clear a transaction. */ - class CardPushTransferAcceptance - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val amount: JsonField, - private val transferId: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - @JsonProperty("transfer_id") - @ExcludeMissing - transferId: JsonField = JsonMissing.of(), - ) : this(amount, transferId, mutableMapOf()) - - /** - * The transfer amount in USD cents. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun amount(): Long = amount.getRequired("amount") - - /** - * The identifier of the Card Push Transfer that led to this Transaction. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun transferId(): String = transferId.getRequired("transfer_id") - - /** - * 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 [transferId]. - * - * Unlike [transferId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("transfer_id") - @ExcludeMissing - fun _transferId(): JsonField = transferId - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [CardPushTransferAcceptance]. - * - * The following fields are required: - * ```java - * .amount() - * .transferId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CardPushTransferAcceptance]. */ - class Builder internal constructor() { - - private var amount: JsonField? = null - private var transferId: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(cardPushTransferAcceptance: CardPushTransferAcceptance) = apply { - amount = cardPushTransferAcceptance.amount - transferId = cardPushTransferAcceptance.transferId - additionalProperties = - cardPushTransferAcceptance.additionalProperties.toMutableMap() - } - - /** The transfer amount in USD 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 identifier of the Card Push Transfer that led to this Transaction. */ - fun transferId(transferId: String) = transferId(JsonField.of(transferId)) - - /** - * Sets [Builder.transferId] to an arbitrary JSON value. - * - * You should usually call [Builder.transferId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun transferId(transferId: JsonField) = apply { - this.transferId = transferId - } - - 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 [CardPushTransferAcceptance]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .amount() - * .transferId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CardPushTransferAcceptance = - CardPushTransferAcceptance( - checkRequired("amount", amount), - checkRequired("transferId", transferId), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): CardPushTransferAcceptance = apply { - if (validated) { - return@apply - } - - amount() - transferId() - 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 (transferId.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CardPushTransferAcceptance && - amount == other.amount && - transferId == other.transferId && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(amount, transferId, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "CardPushTransferAcceptance{amount=$amount, transferId=$transferId, additionalProperties=$additionalProperties}" - } - - /** - * 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 + class CardFinancial @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val id: JsonField, + private val actioner: JsonField, + private val additionalAmounts: JsonField, private val amount: JsonField, private val cardPaymentId: JsonField, - private val cashback: JsonField, private val currency: JsonField, - private val interchange: 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 merchantName: 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 purchaseDetails: JsonField, + private val processingCategory: JsonField, + private val realTimeDecisionId: JsonField, + private val terminalId: JsonField, private val transactionId: JsonField, private val type: 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("additional_amounts") + @ExcludeMissing + additionalAmounts: 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") + @JsonProperty("digital_wallet_token_id") @ExcludeMissing - interchange: JsonField = JsonMissing.of(), + digitalWalletTokenId: JsonField = JsonMissing.of(), + @JsonProperty("direction") + @ExcludeMissing + direction: JsonField = JsonMissing.of(), @JsonProperty("merchant_acceptor_id") @ExcludeMissing merchantAcceptorId: JsonField = JsonMissing.of(), @@ -7961,56 +7809,82 @@ private constructor( @JsonProperty("merchant_country") @ExcludeMissing merchantCountry: JsonField = JsonMissing.of(), - @JsonProperty("merchant_name") + @JsonProperty("merchant_descriptor") @ExcludeMissing - merchantName: JsonField = JsonMissing.of(), + 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("purchase_details") + @JsonProperty("processing_category") @ExcludeMissing - purchaseDetails: JsonField = JsonMissing.of(), + processingCategory: JsonField = JsonMissing.of(), + @JsonProperty("real_time_decision_id") + @ExcludeMissing + realTimeDecisionId: JsonField = JsonMissing.of(), + @JsonProperty("terminal_id") + @ExcludeMissing + terminalId: JsonField = JsonMissing.of(), @JsonProperty("transaction_id") @ExcludeMissing transactionId: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("verification") + @ExcludeMissing + verification: JsonField = JsonMissing.of(), ) : this( id, + actioner, + additionalAmounts, amount, cardPaymentId, - cashback, currency, - interchange, + digitalWalletTokenId, + direction, merchantAcceptorId, merchantCategoryCode, merchantCity, merchantCountry, - merchantName, + merchantDescriptor, merchantPostalCode, merchantState, + networkDetails, networkIdentifiers, + networkRiskScore, + physicalCardId, presentmentAmount, presentmentCurrency, - purchaseDetails, + processingCategory, + realTimeDecisionId, + terminalId, transactionId, type, + verification, mutableMapOf(), ) /** - * The Card Refund identifier. + * The Card Financial 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 @@ -8019,36 +7893,49 @@ private constructor( 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. + * Whether this financial 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 amount(): Long = amount.getRequired("amount") + fun actioner(): Actioner = actioner.getRequired("actioner") /** - * The ID of the Card Payment this transaction belongs to. + * 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 cardPaymentId(): String = cardPaymentId.getRequired("card_payment_id") + fun additionalAmounts(): AdditionalAmounts = + additionalAmounts.getRequired("additional_amounts") /** - * Cashback debited for this transaction, if eligible. Cashback is paid out in - * aggregate, monthly. + * The pending amount in the minor unit of the transaction's currency. For dollars, for + * example, this is cents. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (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 cashback(): Optional = cashback.getOptional("cashback") + fun amount(): Long = amount.getRequired("amount") + + /** + * 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 - * settlement currency. + * 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 @@ -8057,12 +7944,24 @@ private constructor( fun currency(): Currency = currency.getRequired("currency") /** - * Interchange assessed as a part of this transaciton. + * 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 interchange(): Optional = interchange.getOptional("interchange") + fun digitalWalletTokenId(): Optional = + digitalWalletTokenId.getOptional("digital_wallet_token_id") + + /** + * 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") /** * The merchant identifier (commonly abbreviated as MID) of the merchant the card is @@ -8076,7 +7975,8 @@ private constructor( merchantAcceptorId.getRequired("merchant_acceptor_id") /** - * The 4-digit MCC describing the merchant's business. + * 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 @@ -8088,11 +7988,10 @@ private constructor( /** * 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). + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). */ - fun merchantCity(): String = merchantCity.getRequired("merchant_city") + fun merchantCity(): Optional = merchantCity.getOptional("merchant_city") /** * The country the merchant resides in. @@ -8104,16 +8003,17 @@ private constructor( fun merchantCountry(): String = merchantCountry.getRequired("merchant_country") /** - * The name of the merchant. + * 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 merchantName(): String = merchantName.getRequired("merchant_name") + fun merchantDescriptor(): String = merchantDescriptor.getRequired("merchant_descriptor") /** - * The merchant's postal code. For US merchants this is always a 5-digit ZIP code. + * 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). @@ -8130,7 +8030,16 @@ private constructor( fun merchantState(): Optional = merchantState.getOptional("merchant_state") /** - * Network-specific identifiers for this refund. + * Fields specific to the `network`. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun networkDetails(): NetworkDetails = networkDetails.getRequired("network_details") + + /** + * Network-specific identifiers for a specific request or transaction. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected @@ -8140,7 +8049,26 @@ private constructor( networkIdentifiers.getRequired("network_identifiers") /** - * The amount in the minor unit of the transaction's presentment currency. + * 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") + + /** + * If the authorization was made in-person with a physical card, the Physical Card that + * was used. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun physicalCardId(): Optional = physicalCardId.getOptional("physical_card_id") + + /** + * The pending 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 @@ -8160,13 +8088,33 @@ private constructor( presentmentCurrency.getRequired("presentment_currency") /** - * Additional details about the card purchase, such as tax and industry-specific fields. + * The processing category describes the intent behind the financial, 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") + + /** + * 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 purchaseDetails(): Optional = - purchaseDetails.getOptional("purchase_details") + fun realTimeDecisionId(): Optional = + realTimeDecisionId.getOptional("real_time_decision_id") + + /** + * The terminal identifier (commonly abbreviated as TID) of the terminal the card is + * transacting with. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun terminalId(): Optional = terminalId.getOptional("terminal_id") /** * The identifier of the Transaction associated with this Transaction. @@ -8179,7 +8127,7 @@ private constructor( /** * A constant representing the object's type. For this resource it will always be - * `card_refund`. + * `card_financial`. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected @@ -8187,6 +8135,15 @@ private constructor( */ fun type(): Type = type.getRequired("type") + /** + * Fields related to verification of cardholder-provided values. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun verification(): Verification = verification.getRequired("verification") + /** * Returns the raw JSON value of [id]. * @@ -8194,6 +8151,26 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * 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 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]. * @@ -8212,34 +8189,34 @@ private constructor( fun _cardPaymentId(): JsonField = cardPaymentId /** - * Returns the raw JSON value of [cashback]. + * Returns the raw JSON value of [currency]. * - * Unlike [cashback], this method doesn't throw if the JSON field has an unexpected + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("cashback") + @JsonProperty("currency") @ExcludeMissing - fun _cashback(): JsonField = cashback + fun _currency(): JsonField = currency /** - * Returns the raw JSON value of [currency]. + * Returns the raw JSON value of [digitalWalletTokenId]. * - * Unlike [currency], this method doesn't throw if the JSON field has an unexpected - * type. + * Unlike [digitalWalletTokenId], this method doesn't throw if the JSON field has an + * unexpected type. */ - @JsonProperty("currency") + @JsonProperty("digital_wallet_token_id") @ExcludeMissing - fun _currency(): JsonField = currency + fun _digitalWalletTokenId(): JsonField = digitalWalletTokenId /** - * Returns the raw JSON value of [interchange]. + * Returns the raw JSON value of [direction]. * - * Unlike [interchange], this method doesn't throw if the JSON field has an unexpected + * Unlike [direction], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("interchange") + @JsonProperty("direction") @ExcludeMissing - fun _interchange(): JsonField = interchange + fun _direction(): JsonField = direction /** * Returns the raw JSON value of [merchantAcceptorId]. @@ -8282,14 +8259,14 @@ private constructor( fun _merchantCountry(): JsonField = merchantCountry /** - * Returns the raw JSON value of [merchantName]. + * Returns the raw JSON value of [merchantDescriptor]. * - * Unlike [merchantName], this method doesn't throw if the JSON field has an unexpected - * type. + * Unlike [merchantDescriptor], this method doesn't throw if the JSON field has an + * unexpected type. */ - @JsonProperty("merchant_name") + @JsonProperty("merchant_descriptor") @ExcludeMissing - fun _merchantName(): JsonField = merchantName + fun _merchantDescriptor(): JsonField = merchantDescriptor /** * Returns the raw JSON value of [merchantPostalCode]. @@ -8311,6 +8288,16 @@ private constructor( @ExcludeMissing fun _merchantState(): JsonField = merchantState + /** + * Returns the raw JSON value of [networkDetails]. + * + * Unlike [networkDetails], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("network_details") + @ExcludeMissing + fun _networkDetails(): JsonField = networkDetails + /** * Returns the raw JSON value of [networkIdentifiers]. * @@ -8321,6 +8308,26 @@ private constructor( @ExcludeMissing fun _networkIdentifiers(): JsonField = networkIdentifiers + /** + * Returns the raw JSON value of [networkRiskScore]. + * + * Unlike [networkRiskScore], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("network_risk_score") + @ExcludeMissing + fun _networkRiskScore(): JsonField = networkRiskScore + + /** + * Returns the raw JSON value of [physicalCardId]. + * + * Unlike [physicalCardId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("physical_card_id") + @ExcludeMissing + fun _physicalCardId(): JsonField = physicalCardId + /** * Returns the raw JSON value of [presentmentAmount]. * @@ -8342,14 +8349,34 @@ private constructor( fun _presentmentCurrency(): JsonField = presentmentCurrency /** - * Returns the raw JSON value of [purchaseDetails]. + * Returns the raw JSON value of [processingCategory]. * - * Unlike [purchaseDetails], this method doesn't throw if the JSON field has an + * Unlike [processingCategory], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("purchase_details") + @JsonProperty("processing_category") @ExcludeMissing - fun _purchaseDetails(): JsonField = purchaseDetails + fun _processingCategory(): JsonField = processingCategory + + /** + * Returns the raw JSON value of [realTimeDecisionId]. + * + * Unlike [realTimeDecisionId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("real_time_decision_id") + @ExcludeMissing + fun _realTimeDecisionId(): JsonField = realTimeDecisionId + + /** + * Returns the raw JSON value of [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 [transactionId]. @@ -8368,6 +8395,16 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + /** + * Returns the raw JSON value of [verification]. + * + * Unlike [verification], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("verification") + @ExcludeMissing + fun _verification(): JsonField = verification + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -8383,83 +8420,107 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [CardRefund]. + * Returns a mutable builder for constructing an instance of [CardFinancial]. * * The following fields are required: * ```java * .id() + * .actioner() + * .additionalAmounts() * .amount() * .cardPaymentId() - * .cashback() * .currency() - * .interchange() + * .digitalWalletTokenId() + * .direction() * .merchantAcceptorId() * .merchantCategoryCode() * .merchantCity() * .merchantCountry() - * .merchantName() + * .merchantDescriptor() * .merchantPostalCode() * .merchantState() + * .networkDetails() * .networkIdentifiers() + * .networkRiskScore() + * .physicalCardId() * .presentmentAmount() * .presentmentCurrency() - * .purchaseDetails() + * .processingCategory() + * .realTimeDecisionId() + * .terminalId() * .transactionId() * .type() + * .verification() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [CardRefund]. */ + /** A builder for [CardFinancial]. */ class Builder internal 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 cashback: JsonField? = null private var currency: JsonField? = null - private var interchange: 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 merchantName: 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 purchaseDetails: JsonField? = null + private var processingCategory: JsonField? = null + private var realTimeDecisionId: JsonField? = null + private var terminalId: JsonField? = null private var transactionId: JsonField? = null private var type: JsonField? = null + private var verification: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(cardRefund: CardRefund) = apply { - id = cardRefund.id - amount = cardRefund.amount - cardPaymentId = cardRefund.cardPaymentId - cashback = cardRefund.cashback - currency = cardRefund.currency - interchange = cardRefund.interchange - merchantAcceptorId = cardRefund.merchantAcceptorId - merchantCategoryCode = cardRefund.merchantCategoryCode - merchantCity = cardRefund.merchantCity - merchantCountry = cardRefund.merchantCountry - merchantName = cardRefund.merchantName - merchantPostalCode = cardRefund.merchantPostalCode - merchantState = cardRefund.merchantState - networkIdentifiers = cardRefund.networkIdentifiers - presentmentAmount = cardRefund.presentmentAmount - presentmentCurrency = cardRefund.presentmentCurrency - purchaseDetails = cardRefund.purchaseDetails - transactionId = cardRefund.transactionId - type = cardRefund.type - additionalProperties = cardRefund.additionalProperties.toMutableMap() - } - - /** The Card Refund identifier. */ + internal fun from(cardFinancial: CardFinancial) = apply { + id = cardFinancial.id + actioner = cardFinancial.actioner + additionalAmounts = cardFinancial.additionalAmounts + amount = cardFinancial.amount + cardPaymentId = cardFinancial.cardPaymentId + currency = cardFinancial.currency + digitalWalletTokenId = cardFinancial.digitalWalletTokenId + direction = cardFinancial.direction + merchantAcceptorId = cardFinancial.merchantAcceptorId + merchantCategoryCode = cardFinancial.merchantCategoryCode + merchantCity = cardFinancial.merchantCity + merchantCountry = cardFinancial.merchantCountry + merchantDescriptor = cardFinancial.merchantDescriptor + merchantPostalCode = cardFinancial.merchantPostalCode + merchantState = cardFinancial.merchantState + networkDetails = cardFinancial.networkDetails + networkIdentifiers = cardFinancial.networkIdentifiers + networkRiskScore = cardFinancial.networkRiskScore + physicalCardId = cardFinancial.physicalCardId + presentmentAmount = cardFinancial.presentmentAmount + presentmentCurrency = cardFinancial.presentmentCurrency + processingCategory = cardFinancial.processingCategory + realTimeDecisionId = cardFinancial.realTimeDecisionId + terminalId = cardFinancial.terminalId + transactionId = cardFinancial.transactionId + type = cardFinancial.type + verification = cardFinancial.verification + additionalProperties = cardFinancial.additionalProperties.toMutableMap() + } + + /** The Card Financial identifier. */ fun id(id: String) = id(JsonField.of(id)) /** @@ -8472,8 +8533,42 @@ private constructor( 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. + * Whether this financial 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)) + + /** + * 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 } + + /** + * 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. */ fun amount(amount: Long) = amount(JsonField.of(amount)) @@ -8501,27 +8596,9 @@ private constructor( this.cardPaymentId = cardPaymentId } - /** - * Cashback debited for this transaction, if eligible. Cashback is paid out in - * aggregate, monthly. - */ - fun cashback(cashback: Cashback?) = cashback(JsonField.ofNullable(cashback)) - - /** Alias for calling [Builder.cashback] with `cashback.orElse(null)`. */ - fun cashback(cashback: Optional) = cashback(cashback.getOrNull()) - - /** - * Sets [Builder.cashback] to an arbitrary JSON value. - * - * You should usually call [Builder.cashback] with a well-typed [Cashback] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun cashback(cashback: JsonField) = apply { this.cashback = cashback } - /** * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's - * settlement currency. + * currency. */ fun currency(currency: Currency) = currency(JsonField.of(currency)) @@ -8534,23 +8611,46 @@ private constructor( */ fun currency(currency: JsonField) = apply { this.currency = currency } - /** Interchange assessed as a part of this transaciton. */ - fun interchange(interchange: Interchange?) = - interchange(JsonField.ofNullable(interchange)) + /** + * If the authorization was made via a Digital Wallet Token (such as an Apple Pay + * purchase), the identifier of the token that was used. + */ + fun digitalWalletTokenId(digitalWalletTokenId: String?) = + digitalWalletTokenId(JsonField.ofNullable(digitalWalletTokenId)) - /** Alias for calling [Builder.interchange] with `interchange.orElse(null)`. */ - fun interchange(interchange: Optional) = - interchange(interchange.getOrNull()) + /** + * Alias for calling [Builder.digitalWalletTokenId] with + * `digitalWalletTokenId.orElse(null)`. + */ + fun digitalWalletTokenId(digitalWalletTokenId: Optional) = + digitalWalletTokenId(digitalWalletTokenId.getOrNull()) /** - * Sets [Builder.interchange] to an arbitrary JSON value. + * Sets [Builder.digitalWalletTokenId] to an arbitrary JSON value. * - * You should usually call [Builder.interchange] with a well-typed [Interchange] + * 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 interchange(interchange: JsonField) = apply { - this.interchange = interchange + fun digitalWalletTokenId(digitalWalletTokenId: JsonField) = apply { + this.digitalWalletTokenId = digitalWalletTokenId + } + + /** + * 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)) + + /** + * 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 } /** @@ -8571,7 +8671,10 @@ private constructor( this.merchantAcceptorId = merchantAcceptorId } - /** The 4-digit MCC describing the merchant's business. */ + /** + * The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card + * is transacting with. + */ fun merchantCategoryCode(merchantCategoryCode: String) = merchantCategoryCode(JsonField.of(merchantCategoryCode)) @@ -8587,7 +8690,12 @@ private constructor( } /** The city the merchant resides in. */ - fun merchantCity(merchantCity: String) = merchantCity(JsonField.of(merchantCity)) + 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. @@ -8615,22 +8723,24 @@ private constructor( this.merchantCountry = merchantCountry } - /** The name of the merchant. */ - fun merchantName(merchantName: String) = merchantName(JsonField.of(merchantName)) + /** The merchant descriptor of the merchant the card is transacting with. */ + fun merchantDescriptor(merchantDescriptor: String) = + merchantDescriptor(JsonField.of(merchantDescriptor)) /** - * Sets [Builder.merchantName] to an arbitrary JSON value. + * Sets [Builder.merchantDescriptor] 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. + * 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 merchantName(merchantName: JsonField) = apply { - this.merchantName = merchantName + fun merchantDescriptor(merchantDescriptor: JsonField) = apply { + this.merchantDescriptor = merchantDescriptor } /** - * The merchant's postal code. For US merchants this is always a 5-digit ZIP code. + * 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)) @@ -8672,7 +8782,22 @@ private constructor( this.merchantState = merchantState } - /** Network-specific identifiers for this refund. */ + /** Fields specific to the `network`. */ + fun networkDetails(networkDetails: NetworkDetails) = + networkDetails(JsonField.of(networkDetails)) + + /** + * Sets [Builder.networkDetails] to an arbitrary JSON value. + * + * You should usually call [Builder.networkDetails] with a well-typed + * [NetworkDetails] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun networkDetails(networkDetails: JsonField) = apply { + this.networkDetails = networkDetails + } + + /** Network-specific identifiers for a specific request or transaction. */ fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) = networkIdentifiers(JsonField.of(networkIdentifiers)) @@ -8687,7 +8812,66 @@ private constructor( this.networkIdentifiers = networkIdentifiers } - /** The amount in the minor unit of the transaction's presentment currency. */ + /** + * 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)) + + /** + * Alias for [Builder.networkRiskScore]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun networkRiskScore(networkRiskScore: Long) = + networkRiskScore(networkRiskScore as Long?) + + /** + * Alias for calling [Builder.networkRiskScore] with + * `networkRiskScore.orElse(null)`. + */ + fun networkRiskScore(networkRiskScore: Optional) = + networkRiskScore(networkRiskScore.getOrNull()) + + /** + * Sets [Builder.networkRiskScore] to an arbitrary JSON value. + * + * You should usually call [Builder.networkRiskScore] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun networkRiskScore(networkRiskScore: JsonField) = apply { + this.networkRiskScore = networkRiskScore + } + + /** + * If the authorization was made in-person with a physical card, the Physical Card + * that was used. + */ + fun physicalCardId(physicalCardId: String?) = + physicalCardId(JsonField.ofNullable(physicalCardId)) + + /** + * Alias for calling [Builder.physicalCardId] with `physicalCardId.orElse(null)`. + */ + fun physicalCardId(physicalCardId: Optional) = + physicalCardId(physicalCardId.getOrNull()) + + /** + * Sets [Builder.physicalCardId] to an arbitrary JSON value. + * + * You should usually call [Builder.physicalCardId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun physicalCardId(physicalCardId: JsonField) = apply { + this.physicalCardId = physicalCardId + } + + /** + * The pending amount in the minor unit of the transaction's presentment currency. + */ fun presentmentAmount(presentmentAmount: Long) = presentmentAmount(JsonField.of(presentmentAmount)) @@ -8721,27 +8905,66 @@ private constructor( } /** - * Additional details about the card purchase, such as tax and industry-specific - * fields. + * The processing category describes the intent behind the financial, such as + * whether it was used for bill payments or an automatic fuel dispenser. */ - fun purchaseDetails(purchaseDetails: PurchaseDetails?) = - purchaseDetails(JsonField.ofNullable(purchaseDetails)) + fun processingCategory(processingCategory: ProcessingCategory) = + processingCategory(JsonField.of(processingCategory)) /** - * Alias for calling [Builder.purchaseDetails] with `purchaseDetails.orElse(null)`. + * 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 purchaseDetails(purchaseDetails: Optional) = - purchaseDetails(purchaseDetails.getOrNull()) + fun processingCategory(processingCategory: JsonField) = apply { + this.processingCategory = processingCategory + } /** - * Sets [Builder.purchaseDetails] to an arbitrary JSON value. + * The identifier of the Real-Time Decision sent to approve or decline this + * transaction. + */ + fun realTimeDecisionId(realTimeDecisionId: String?) = + realTimeDecisionId(JsonField.ofNullable(realTimeDecisionId)) + + /** + * Alias for calling [Builder.realTimeDecisionId] with + * `realTimeDecisionId.orElse(null)`. + */ + fun realTimeDecisionId(realTimeDecisionId: Optional) = + realTimeDecisionId(realTimeDecisionId.getOrNull()) + + /** + * Sets [Builder.realTimeDecisionId] to an arbitrary JSON value. * - * You should usually call [Builder.purchaseDetails] with a well-typed - * [PurchaseDetails] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported 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 purchaseDetails(purchaseDetails: JsonField) = apply { - this.purchaseDetails = purchaseDetails + fun realTimeDecisionId(realTimeDecisionId: JsonField) = apply { + this.realTimeDecisionId = realTimeDecisionId + } + + /** + * 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 } /** The identifier of the Transaction associated with this Transaction. */ @@ -8761,7 +8984,7 @@ private constructor( /** * A constant representing the object's type. For this resource it will always be - * `card_refund`. + * `card_financial`. */ fun type(type: Type) = type(JsonField.of(type)) @@ -8774,6 +8997,21 @@ private constructor( */ fun type(type: JsonField) = apply { this.type = type } + /** Fields related to verification of cardholder-provided values. */ + fun verification(verification: Verification) = + verification(JsonField.of(verification)) + + /** + * Sets [Builder.verification] to an arbitrary JSON value. + * + * You should usually call [Builder.verification] with a well-typed [Verification] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun verification(verification: JsonField) = apply { + this.verification = verification + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -8797,84 +9035,7923 @@ private constructor( } /** - * Returns an immutable instance of [CardRefund]. + * Returns an immutable instance of [CardFinancial]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java * .id() + * .actioner() + * .additionalAmounts() * .amount() * .cardPaymentId() - * .cashback() * .currency() - * .interchange() + * .digitalWalletTokenId() + * .direction() * .merchantAcceptorId() * .merchantCategoryCode() * .merchantCity() * .merchantCountry() - * .merchantName() + * .merchantDescriptor() * .merchantPostalCode() * .merchantState() + * .networkDetails() * .networkIdentifiers() + * .networkRiskScore() + * .physicalCardId() * .presentmentAmount() * .presentmentCurrency() - * .purchaseDetails() + * .processingCategory() + * .realTimeDecisionId() + * .terminalId() * .transactionId() * .type() + * .verification() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): CardRefund = - CardRefund( + fun build(): CardFinancial = + CardFinancial( checkRequired("id", id), + checkRequired("actioner", actioner), + checkRequired("additionalAmounts", additionalAmounts), checkRequired("amount", amount), checkRequired("cardPaymentId", cardPaymentId), - checkRequired("cashback", cashback), checkRequired("currency", currency), - checkRequired("interchange", interchange), + checkRequired("digitalWalletTokenId", digitalWalletTokenId), + checkRequired("direction", direction), checkRequired("merchantAcceptorId", merchantAcceptorId), checkRequired("merchantCategoryCode", merchantCategoryCode), checkRequired("merchantCity", merchantCity), checkRequired("merchantCountry", merchantCountry), - checkRequired("merchantName", merchantName), + 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("purchaseDetails", purchaseDetails), + checkRequired("processingCategory", processingCategory), + checkRequired("realTimeDecisionId", realTimeDecisionId), + checkRequired("terminalId", terminalId), checkRequired("transactionId", transactionId), checkRequired("type", type), + checkRequired("verification", verification), additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): CardRefund = apply { + fun validate(): CardFinancial = apply { if (validated) { return@apply } id() + actioner().validate() + additionalAmounts().validate() amount() cardPaymentId() - cashback().ifPresent { it.validate() } currency().validate() - interchange().ifPresent { it.validate() } + digitalWalletTokenId() + direction().validate() merchantAcceptorId() merchantCategoryCode() merchantCity() merchantCountry() - merchantName() + merchantDescriptor() merchantPostalCode() merchantState() + networkDetails().validate() networkIdentifiers().validate() + networkRiskScore() + physicalCardId() presentmentAmount() presentmentCurrency() - purchaseDetails().ifPresent { it.validate() } + processingCategory().validate() + realTimeDecisionId() + terminalId() + transactionId() + type().validate() + verification().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (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 (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) + + (if (terminalId.asKnown().isPresent) 1 else 0) + + (if (transactionId.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (verification.asKnown().getOrNull()?.validity() ?: 0) + + /** + * Whether this financial 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 { + + /** + * 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 { + + /** This object was actioned by the user through a real-time decision. */ + @JvmField val USER = of("user") + + /** This object was actioned by Increase without user intervention. */ + @JvmField val INCREASE = of("increase") + + /** This object was actioned by the network, through stand-in processing. */ + @JvmField val NETWORK = of("network") + + @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 + } + + /** + * 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") + } + + /** + * 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(): Actioner = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Actioner && value == other.value + } + + 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 + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + 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 + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) + + /** + * The amount in minor units of the `currency` field. The amount is positive if + * it is added to the amount (such as an ATM surcharge fee) and negative if it + * is subtracted from the amount (such as a discount). + * + * @throws IncreaseInvalidDataException if 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. The amount is positive + * if it is added to the amount (such as an ATM surcharge fee) and negative + * if it is subtracted from the amount (such as a discount). + */ + 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 other is Clinic && + amount == other.amount && + currency == other.currency && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(amount, currency, additionalProperties) + } + + 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 + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) + + /** + * The amount in minor units of the `currency` field. The amount is positive if + * it is added to the amount (such as an ATM surcharge fee) and negative if it + * is subtracted from the amount (such as a discount). + * + * @throws IncreaseInvalidDataException if 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. The amount is positive + * if it is added to the amount (such as an ATM surcharge fee) and negative + * if it is subtracted from the amount (such as a discount). + */ + 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 other is Dental && + amount == other.amount && + currency == other.currency && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(amount, currency, additionalProperties) + } + + 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 + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) + + /** + * The amount in minor units of the `currency` field. The amount is positive if + * it is added to the amount (such as an ATM surcharge fee) and negative if it + * is subtracted from the amount (such as a discount). + * + * @throws IncreaseInvalidDataException if 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. The amount is positive + * if it is added to the amount (such as an ATM surcharge fee) and negative + * if it is subtracted from the amount (such as a discount). + */ + 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 other is Prescription && + amount == other.amount && + currency == other.currency && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(amount, currency, additionalProperties) + } + + 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 + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) + + /** + * The amount in minor units of the `currency` field. The amount is positive if + * it is added to the amount (such as an ATM surcharge fee) and negative if it + * is subtracted from the amount (such as a discount). + * + * @throws IncreaseInvalidDataException if 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. The amount is positive + * if it is added to the amount (such as an ATM surcharge fee) and negative + * if it is subtracted from the amount (such as a discount). + */ + 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 other is Surcharge && + amount == other.amount && + currency == other.currency && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(amount, currency, additionalProperties) + } + + 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 + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) + + /** + * The amount in minor units of the `currency` field. The amount is positive if + * it is added to the amount (such as an ATM surcharge fee) and negative if it + * is subtracted from the amount (such as a discount). + * + * @throws IncreaseInvalidDataException if 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. The amount is positive + * if it is added to the amount (such as an ATM surcharge fee) and negative + * if it is subtracted from the amount (such as a discount). + */ + 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 other is TotalCumulative && + amount == other.amount && + currency == other.currency && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(amount, currency, additionalProperties) + } + + 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 + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) + + /** + * The amount in minor units of the `currency` field. The amount is positive if + * it is added to the amount (such as an ATM surcharge fee) and negative if it + * is subtracted from the amount (such as a discount). + * + * @throws IncreaseInvalidDataException if 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. The amount is positive + * if it is added to the amount (such as an ATM surcharge fee) and negative + * if it is subtracted from the amount (such as a discount). + */ + 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 other is TotalHealthcare && + amount == other.amount && + currency == other.currency && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(amount, currency, additionalProperties) + } + + 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 + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) + + /** + * The amount in minor units of the `currency` field. The amount is positive if + * it is added to the amount (such as an ATM surcharge fee) and negative if it + * is subtracted from the amount (such as a discount). + * + * @throws IncreaseInvalidDataException if 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. The amount is positive + * if it is added to the amount (such as an ATM surcharge fee) and negative + * if it is subtracted from the amount (such as a discount). + */ + 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 other is Transit && + amount == other.amount && + currency == other.currency && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(amount, currency, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Transit{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + } + + /** An unknown additional amount. */ + class Unknown + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) + + /** + * The amount in minor units of the `currency` field. The amount is positive if + * it is added to the amount (such as an ATM surcharge fee) and negative if it + * is subtracted from the amount (such as a discount). + * + * @throws IncreaseInvalidDataException if 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. The amount is positive + * if it is added to the amount (such as an ATM surcharge fee) and negative + * if it is subtracted from the amount (such as a discount). + */ + 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 other is Unknown && + amount == other.amount && + currency == other.currency && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(amount, currency, additionalProperties) + } + + 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 + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val amount: JsonField, + private val currency: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + ) : this(amount, currency, mutableMapOf()) + + /** + * The amount in minor units of the `currency` field. The amount is positive if + * it is added to the amount (such as an ATM surcharge fee) and negative if it + * is subtracted from the amount (such as a discount). + * + * @throws IncreaseInvalidDataException if 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. The amount is positive + * if it is added to the amount (such as an ATM surcharge fee) and negative + * if it is subtracted from the amount (such as a discount). + */ + 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 other is Vision && + amount == other.amount && + currency == other.currency && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(amount, currency, additionalProperties) + } + + 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 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 + } + + private val hashCode: Int by lazy { + Objects.hash( + clinic, + dental, + prescription, + surcharge, + totalCumulative, + totalHealthcare, + transit, + unknown, + vision, + additionalProperties, + ) + } + + 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, + } + + /** + * 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 other is Currency && value == other.value + } + + 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 { + + /** + * 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 { + + /** 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, + } + + /** + * An enum containing [Direction]'s known values, as well as an [_UNKNOWN] member. + * + * 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 { + /** 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, + } + + /** + * 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) { + SETTLEMENT -> Value.SETTLEMENT + REFUND -> Value.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) { + SETTLEMENT -> Known.SETTLEMENT + REFUND -> Known.REFUND + else -> throw IncreaseInvalidDataException("Unknown Direction: $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(): Direction = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Direction && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Fields specific to the `network`. */ + class NetworkDetails + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + 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()) + + /** + * 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") + + /** + * 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") + + /** + * 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 [visa]. + * + * Unlike [visa], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("visa") @ExcludeMissing fun _visa(): JsonField = visa + + @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 [NetworkDetails]. + * + * The following fields are required: + * ```java + * .category() + * .visa() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [NetworkDetails]. */ + class Builder internal constructor() { + + private var category: JsonField? = null + private var visa: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(networkDetails: NetworkDetails) = apply { + category = networkDetails.category + visa = networkDetails.visa + additionalProperties = networkDetails.additionalProperties.toMutableMap() + } + + /** The payment network used to process this card authorization. */ + fun category(category: Category) = category(JsonField.of(category)) + + /** + * Sets [Builder.category] to an arbitrary JSON value. + * + * You should usually call [Builder.category] with a well-typed [Category] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun category(category: JsonField) = apply { this.category = category } + + /** 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.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 } + + 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 [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(), + ) + } + + private var validated: Boolean = false + + fun validate(): NetworkDetails = apply { + if (validated) { + return@apply + } + + category().validate() + visa().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (category.asKnown().getOrNull()?.validity() ?: 0) + + (visa.asKnown().getOrNull()?.validity() ?: 0) + + /** The payment network used to process this card authorization. */ + class Category + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** Visa */ + @JvmField val VISA = of("visa") + + @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 other is Category && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Fields specific to the `visa` network. */ + class Visa + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val electronicCommerceIndicator: JsonField, + private val pointOfServiceEntryMode: JsonField, + private val standInProcessingReason: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("electronic_commerce_indicator") + @ExcludeMissing + electronicCommerceIndicator: JsonField = + JsonMissing.of(), + @JsonProperty("point_of_service_entry_mode") + @ExcludeMissing + pointOfServiceEntryMode: JsonField = + JsonMissing.of(), + @JsonProperty("stand_in_processing_reason") + @ExcludeMissing + standInProcessingReason: JsonField = + JsonMissing.of(), + ) : 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") + + /** + * The method used to enter the cardholder's primary account number and card + * expiration date. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun pointOfServiceEntryMode(): Optional = + pointOfServiceEntryMode.getOptional("point_of_service_entry_mode") + + /** + * Only present when `actioner: network`. Describes why a card authorization was + * approved or declined by Visa through stand-in processing. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun standInProcessingReason(): Optional = + standInProcessingReason.getOptional("stand_in_processing_reason") + + /** + * Returns the raw JSON value of [electronicCommerceIndicator]. + * + * Unlike [electronicCommerceIndicator], this method doesn't throw if the JSON + * field has an unexpected type. + */ + @JsonProperty("electronic_commerce_indicator") + @ExcludeMissing + fun _electronicCommerceIndicator(): JsonField = + electronicCommerceIndicator + + /** + * Returns the raw JSON value of [pointOfServiceEntryMode]. + * + * Unlike [pointOfServiceEntryMode], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("point_of_service_entry_mode") + @ExcludeMissing + fun _pointOfServiceEntryMode(): JsonField = + pointOfServiceEntryMode + + /** + * Returns the raw JSON value of [standInProcessingReason]. + * + * Unlike [standInProcessingReason], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("stand_in_processing_reason") + @ExcludeMissing + fun _standInProcessingReason(): JsonField = + standInProcessingReason + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Visa]. + * + * The following fields are required: + * ```java + * .electronicCommerceIndicator() + * .pointOfServiceEntryMode() + * .standInProcessingReason() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Visa]. */ + class Builder internal constructor() { + + private var electronicCommerceIndicator: + JsonField? = + null + private var pointOfServiceEntryMode: JsonField? = + null + private var standInProcessingReason: JsonField? = + null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(visa: Visa) = apply { + electronicCommerceIndicator = visa.electronicCommerceIndicator + pointOfServiceEntryMode = visa.pointOfServiceEntryMode + standInProcessingReason = visa.standInProcessingReason + additionalProperties = visa.additionalProperties.toMutableMap() + } + + /** + * For electronic commerce transactions, this identifies the level of + * security used in obtaining the customer's payment credential. For mail or + * telephone order transactions, identifies the type of mail or telephone + * order. + */ + fun electronicCommerceIndicator( + electronicCommerceIndicator: ElectronicCommerceIndicator? + ) = + electronicCommerceIndicator( + JsonField.ofNullable(electronicCommerceIndicator) + ) + + /** + * Alias for calling [Builder.electronicCommerceIndicator] with + * `electronicCommerceIndicator.orElse(null)`. + */ + fun electronicCommerceIndicator( + electronicCommerceIndicator: Optional + ) = electronicCommerceIndicator(electronicCommerceIndicator.getOrNull()) + + /** + * Sets [Builder.electronicCommerceIndicator] to an arbitrary JSON value. + * + * You should usually call [Builder.electronicCommerceIndicator] with a + * well-typed [ElectronicCommerceIndicator] value instead. This method is + * primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun electronicCommerceIndicator( + electronicCommerceIndicator: JsonField + ) = apply { this.electronicCommerceIndicator = electronicCommerceIndicator } + + /** + * The method used to enter the cardholder's primary account number and card + * expiration date. + */ + fun pointOfServiceEntryMode( + pointOfServiceEntryMode: PointOfServiceEntryMode? + ) = pointOfServiceEntryMode(JsonField.ofNullable(pointOfServiceEntryMode)) + + /** + * Alias for calling [Builder.pointOfServiceEntryMode] with + * `pointOfServiceEntryMode.orElse(null)`. + */ + fun pointOfServiceEntryMode( + pointOfServiceEntryMode: Optional + ) = pointOfServiceEntryMode(pointOfServiceEntryMode.getOrNull()) + + /** + * Sets [Builder.pointOfServiceEntryMode] to an arbitrary JSON value. + * + * You should usually call [Builder.pointOfServiceEntryMode] with a + * well-typed [PointOfServiceEntryMode] value instead. This method is + * primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun pointOfServiceEntryMode( + pointOfServiceEntryMode: JsonField + ) = apply { this.pointOfServiceEntryMode = pointOfServiceEntryMode } + + /** + * Only present when `actioner: network`. Describes why a card authorization + * was approved or declined by Visa through stand-in processing. + */ + fun standInProcessingReason( + standInProcessingReason: StandInProcessingReason? + ) = standInProcessingReason(JsonField.ofNullable(standInProcessingReason)) + + /** + * Alias for calling [Builder.standInProcessingReason] with + * `standInProcessingReason.orElse(null)`. + */ + fun standInProcessingReason( + standInProcessingReason: Optional + ) = standInProcessingReason(standInProcessingReason.getOrNull()) + + /** + * Sets [Builder.standInProcessingReason] to an arbitrary JSON value. + * + * You should usually call [Builder.standInProcessingReason] with a + * well-typed [StandInProcessingReason] value instead. This method is + * primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun standInProcessingReason( + standInProcessingReason: JsonField + ) = apply { this.standInProcessingReason = standInProcessingReason } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Visa]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .electronicCommerceIndicator() + * .pointOfServiceEntryMode() + * .standInProcessingReason() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Visa = + Visa( + checkRequired( + "electronicCommerceIndicator", + electronicCommerceIndicator, + ), + checkRequired("pointOfServiceEntryMode", pointOfServiceEntryMode), + checkRequired("standInProcessingReason", standInProcessingReason), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Visa = apply { + if (validated) { + return@apply + } + + electronicCommerceIndicator().ifPresent { it.validate() } + pointOfServiceEntryMode().ifPresent { it.validate() } + standInProcessingReason().ifPresent { it.validate() } + 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 = + (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 { + + /** + * Single transaction of a mail/phone order: Use to indicate that the + * transaction is a mail/phone order purchase, not a recurring + * transaction or installment payment. For domestic transactions in the + * US region, this value may also indicate one bill payment transaction + * in the card-present or card-absent environments. + */ + @JvmField val MAIL_PHONE_ORDER = of("mail_phone_order") + + /** + * Recurring transaction: Payment indicator used to indicate a recurring + * transaction that originates from an acquirer in the US region. + */ + @JvmField val RECURRING = of("recurring") + + /** + * Installment payment: Payment indicator used to indicate one purchase + * of goods or services that is billed to the account in multiple + * charges over a period of time agreed upon by the cardholder and + * merchant from transactions that originate from an acquirer in the US + * region. + */ + @JvmField val INSTALLMENT = of("installment") + + /** + * Unknown classification: other mail order: Use to indicate that the + * type of mail/telephone order is unknown. + */ + @JvmField val UNKNOWN_MAIL_PHONE_ORDER = of("unknown_mail_phone_order") + + /** + * Secure electronic commerce transaction: Use to indicate that the + * electronic commerce transaction has been authenticated using e.g., + * 3-D Secure + */ + @JvmField + val SECURE_ELECTRONIC_COMMERCE = of("secure_electronic_commerce") + + /** + * Non-authenticated security transaction at a 3-D Secure-capable + * merchant, and merchant attempted to authenticate the cardholder using + * 3-D Secure: Use to identify an electronic commerce transaction where + * the merchant attempted to authenticate the cardholder using 3-D + * Secure, but was unable to complete the authentication because the + * issuer or cardholder does not participate in the 3-D Secure program. + */ + @JvmField + val NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT = + of("non_authenticated_security_transaction_at_3ds_capable_merchant") + + /** + * Non-authenticated security transaction: Use to identify an electronic + * commerce transaction that uses data encryption for security however , + * cardholder authentication is not performed using 3-D Secure. + */ + @JvmField + val NON_AUTHENTICATED_SECURITY_TRANSACTION = + of("non_authenticated_security_transaction") + + /** + * Non-secure transaction: Use to identify an electronic commerce + * transaction that has no data protection. + */ + @JvmField val NON_SECURE_TRANSACTION = of("non_secure_transaction") + + @JvmStatic + fun of(value: String) = ElectronicCommerceIndicator(JsonField.of(value)) + } + + /** An enum containing [ElectronicCommerceIndicator]'s known values. */ + enum class Known { + /** + * Single transaction of a mail/phone order: Use to indicate that the + * transaction is a mail/phone order purchase, not a recurring + * transaction or installment payment. For domestic transactions in the + * US region, this value may also indicate one bill payment transaction + * in the card-present or card-absent environments. + */ + MAIL_PHONE_ORDER, + /** + * Recurring transaction: Payment indicator used to indicate a recurring + * transaction that originates from an acquirer in the US region. + */ + RECURRING, + /** + * Installment payment: Payment indicator used to indicate one purchase + * of goods or services that is billed to the account in multiple + * charges over a period of time agreed upon by the cardholder and + * merchant from transactions that originate from an acquirer in the US + * region. + */ + INSTALLMENT, + /** + * Unknown classification: other mail order: Use to indicate that the + * type of mail/telephone order is unknown. + */ + UNKNOWN_MAIL_PHONE_ORDER, + /** + * Secure electronic commerce transaction: Use to indicate that the + * electronic commerce transaction has been authenticated using e.g., + * 3-D Secure + */ + SECURE_ELECTRONIC_COMMERCE, + /** + * Non-authenticated security transaction at a 3-D Secure-capable + * merchant, and merchant attempted to authenticate the cardholder using + * 3-D Secure: Use to identify an electronic commerce transaction where + * the merchant attempted to authenticate the cardholder using 3-D + * Secure, but was unable to complete the authentication because the + * issuer or cardholder does not participate in the 3-D Secure program. + */ + NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT, + /** + * Non-authenticated security transaction: Use to identify an electronic + * commerce transaction that uses data encryption for security however , + * cardholder authentication is not performed using 3-D Secure. + */ + NON_AUTHENTICATED_SECURITY_TRANSACTION, + /** + * Non-secure transaction: Use to identify an electronic commerce + * transaction that has no data protection. + */ + NON_SECURE_TRANSACTION, + } + + /** + * An enum containing [ElectronicCommerceIndicator]'s known values, as well + * as an [_UNKNOWN] member. + * + * An instance of [ElectronicCommerceIndicator] can contain an unknown value + * in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** + * Single transaction of a mail/phone order: Use to indicate that the + * transaction is a mail/phone order purchase, not a recurring + * transaction or installment payment. For domestic transactions in the + * US region, this value may also indicate one bill payment transaction + * in the card-present or card-absent environments. + */ + MAIL_PHONE_ORDER, + /** + * Recurring transaction: Payment indicator used to indicate a recurring + * transaction that originates from an acquirer in the US region. + */ + RECURRING, + /** + * Installment payment: Payment indicator used to indicate one purchase + * of goods or services that is billed to the account in multiple + * charges over a period of time agreed upon by the cardholder and + * merchant from transactions that originate from an acquirer in the US + * region. + */ + INSTALLMENT, + /** + * Unknown classification: other mail order: Use to indicate that the + * type of mail/telephone order is unknown. + */ + UNKNOWN_MAIL_PHONE_ORDER, + /** + * Secure electronic commerce transaction: Use to indicate that the + * electronic commerce transaction has been authenticated using e.g., + * 3-D Secure + */ + SECURE_ELECTRONIC_COMMERCE, + /** + * Non-authenticated security transaction at a 3-D Secure-capable + * merchant, and merchant attempted to authenticate the cardholder using + * 3-D Secure: Use to identify an electronic commerce transaction where + * the merchant attempted to authenticate the cardholder using 3-D + * Secure, but was unable to complete the authentication because the + * issuer or cardholder does not participate in the 3-D Secure program. + */ + NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT, + /** + * Non-authenticated security transaction: Use to identify an electronic + * commerce transaction that uses data encryption for security however , + * cardholder authentication is not performed using 3-D Secure. + */ + NON_AUTHENTICATED_SECURITY_TRANSACTION, + /** + * Non-secure transaction: Use to identify an electronic commerce + * transaction that has no data protection. + */ + NON_SECURE_TRANSACTION, + /** + * An enum member indicating that [ElectronicCommerceIndicator] was + * instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + MAIL_PHONE_ORDER -> Value.MAIL_PHONE_ORDER + RECURRING -> Value.RECURRING + INSTALLMENT -> Value.INSTALLMENT + UNKNOWN_MAIL_PHONE_ORDER -> Value.UNKNOWN_MAIL_PHONE_ORDER + SECURE_ELECTRONIC_COMMERCE -> Value.SECURE_ELECTRONIC_COMMERCE + NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT -> + Value + .NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT + NON_AUTHENTICATED_SECURITY_TRANSACTION -> + Value.NON_AUTHENTICATED_SECURITY_TRANSACTION + NON_SECURE_TRANSACTION -> Value.NON_SECURE_TRANSACTION + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + MAIL_PHONE_ORDER -> Known.MAIL_PHONE_ORDER + RECURRING -> Known.RECURRING + INSTALLMENT -> Known.INSTALLMENT + UNKNOWN_MAIL_PHONE_ORDER -> Known.UNKNOWN_MAIL_PHONE_ORDER + SECURE_ELECTRONIC_COMMERCE -> Known.SECURE_ELECTRONIC_COMMERCE + NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT -> + Known + .NON_AUTHENTICATED_SECURITY_TRANSACTION_AT_3DS_CAPABLE_MERCHANT + NON_AUTHENTICATED_SECURITY_TRANSACTION -> + Known.NON_AUTHENTICATED_SECURITY_TRANSACTION + NON_SECURE_TRANSACTION -> Known.NON_SECURE_TRANSACTION + else -> + throw IncreaseInvalidDataException( + "Unknown ElectronicCommerceIndicator: $value" + ) + } + + /** + * Returns 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(): ElectronicCommerceIndicator = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ElectronicCommerceIndicator && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * The method used to enter the cardholder's primary account number and card + * expiration date. + */ + class PointOfServiceEntryMode + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** Unknown */ + @JvmField val UNKNOWN = of("unknown") + + /** 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") + + /** + * Transaction initiated using a credential that has previously been + * stored on file + */ + @JvmField val CREDENTIAL_ON_FILE = of("credential_on_file") + + /** Magnetic stripe read */ + @JvmField val MAGNETIC_STRIPE = of("magnetic_stripe") + + /** Contactless read of magnetic stripe data */ + @JvmField + val CONTACTLESS_MAGNETIC_STRIPE = of("contactless_magnetic_stripe") + + /** Contact chip card, without card verification value */ + @JvmField + val INTEGRATED_CIRCUIT_CARD_NO_CVV = + of("integrated_circuit_card_no_cvv") + + @JvmStatic + fun of(value: String) = PointOfServiceEntryMode(JsonField.of(value)) + } + + /** An enum containing [PointOfServiceEntryMode]'s known values. */ + enum class Known { + /** Unknown */ + UNKNOWN, + /** Manual key entry */ + MANUAL, + /** Magnetic stripe read, without card verification value */ + MAGNETIC_STRIPE_NO_CVV, + /** Optical code */ + OPTICAL_CODE, + /** Contact chip card */ + INTEGRATED_CIRCUIT_CARD, + /** Contactless read of chip card */ + CONTACTLESS, + /** + * Transaction initiated using a credential that has previously been + * stored on file + */ + CREDENTIAL_ON_FILE, + /** Magnetic stripe read */ + MAGNETIC_STRIPE, + /** Contactless read of magnetic stripe data */ + CONTACTLESS_MAGNETIC_STRIPE, + /** Contact chip card, without card verification value */ + INTEGRATED_CIRCUIT_CARD_NO_CVV, + } + + /** + * 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, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + UNKNOWN -> Value.UNKNOWN + MANUAL -> Value.MANUAL + MAGNETIC_STRIPE_NO_CVV -> Value.MAGNETIC_STRIPE_NO_CVV + OPTICAL_CODE -> Value.OPTICAL_CODE + INTEGRATED_CIRCUIT_CARD -> Value.INTEGRATED_CIRCUIT_CARD + CONTACTLESS -> Value.CONTACTLESS + CREDENTIAL_ON_FILE -> Value.CREDENTIAL_ON_FILE + MAGNETIC_STRIPE -> Value.MAGNETIC_STRIPE + CONTACTLESS_MAGNETIC_STRIPE -> Value.CONTACTLESS_MAGNETIC_STRIPE + INTEGRATED_CIRCUIT_CARD_NO_CVV -> + Value.INTEGRATED_CIRCUIT_CARD_NO_CVV + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + UNKNOWN -> Known.UNKNOWN + MANUAL -> Known.MANUAL + MAGNETIC_STRIPE_NO_CVV -> Known.MAGNETIC_STRIPE_NO_CVV + OPTICAL_CODE -> Known.OPTICAL_CODE + INTEGRATED_CIRCUIT_CARD -> Known.INTEGRATED_CIRCUIT_CARD + CONTACTLESS -> Known.CONTACTLESS + CREDENTIAL_ON_FILE -> Known.CREDENTIAL_ON_FILE + MAGNETIC_STRIPE -> Known.MAGNETIC_STRIPE + CONTACTLESS_MAGNETIC_STRIPE -> Known.CONTACTLESS_MAGNETIC_STRIPE + INTEGRATED_CIRCUIT_CARD_NO_CVV -> + Known.INTEGRATED_CIRCUIT_CARD_NO_CVV + else -> + throw IncreaseInvalidDataException( + "Unknown PointOfServiceEntryMode: $value" + ) + } + + /** + * Returns 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(): PointOfServiceEntryMode = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is PointOfServiceEntryMode && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * Only present when `actioner: network`. Describes why a card authorization was + * approved or declined by Visa through stand-in processing. + */ + class StandInProcessingReason + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * 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 { + + /** Increase failed to process the authorization in a timely manner. */ + @JvmField val ISSUER_ERROR = of("issuer_error") + + /** + * The physical card read had an invalid CVV, dCVV, or authorization + * request cryptogram. + */ + @JvmField val INVALID_PHYSICAL_CARD = of("invalid_physical_card") + + /** The 3DS cardholder authentication verification value was invalid. */ + @JvmField + val INVALID_CARDHOLDER_AUTHENTICATION_VERIFICATION_VALUE = + of("invalid_cardholder_authentication_verification_value") + + /** + * An internal Visa error occurred. Visa uses this reason code for + * certain expected occurrences as well, such as Application Transaction + * Counter (ATC) replays. + */ + @JvmField val INTERNAL_VISA_ERROR = of("internal_visa_error") + + /** + * The merchant has enabled Visa's Transaction Advisory Service and + * requires further authentication to perform the transaction. In + * practice this is often utilized at fuel pumps to tell the cardholder + * to see the cashier. + */ + @JvmField + val MERCHANT_TRANSACTION_ADVISORY_SERVICE_AUTHENTICATION_REQUIRED = + of("merchant_transaction_advisory_service_authentication_required") + + /** + * The transaction was blocked by Visa's Payment Fraud Disruption + * service due to fraudulent Acquirer behavior, such as card testing. + */ + @JvmField + val PAYMENT_FRAUD_DISRUPTION_ACQUIRER_BLOCK = + of("payment_fraud_disruption_acquirer_block") + + /** An unspecific reason for stand-in processing. */ + @JvmField val OTHER = of("other") + + @JvmStatic + fun of(value: String) = StandInProcessingReason(JsonField.of(value)) + } + + /** An enum containing [StandInProcessingReason]'s known values. */ + enum class Known { + /** Increase failed to process the authorization in a timely manner. */ + ISSUER_ERROR, + /** + * The physical card read had an invalid CVV, 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 [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 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 + } + + /** + * 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" + ) + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): StandInProcessingReason = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is StandInProcessingReason && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Visa && + electronicCommerceIndicator == other.electronicCommerceIndicator && + pointOfServiceEntryMode == other.pointOfServiceEntryMode && + standInProcessingReason == other.standInProcessingReason && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + electronicCommerceIndicator, + pointOfServiceEntryMode, + standInProcessingReason, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Visa{electronicCommerceIndicator=$electronicCommerceIndicator, pointOfServiceEntryMode=$pointOfServiceEntryMode, standInProcessingReason=$standInProcessingReason, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is NetworkDetails && + category == other.category && + visa == other.visa && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(category, visa, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "NetworkDetails{category=$category, visa=$visa, additionalProperties=$additionalProperties}" + } + + /** Network-specific identifiers for a specific request or transaction. */ + class NetworkIdentifiers + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + 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 other is NetworkIdentifiers && + retrievalReferenceNumber == other.retrievalReferenceNumber && + traceNumber == other.traceNumber && + transactionId == other.transactionId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + retrievalReferenceNumber, + traceNumber, + transactionId, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "NetworkIdentifiers{retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}" + } + + /** + * The processing category describes the intent behind the financial, such as whether it + * was used for bill payments or an automatic fuel dispenser. + */ + class ProcessingCategory + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + /** + * Account funding transactions are transactions used to e.g., fund an account + * or transfer funds between accounts. + */ + @JvmField val ACCOUNT_FUNDING = of("account_funding") + + /** + * Automatic fuel dispenser authorizations occur when a card is used at a gas + * pump, prior to the actual transaction amount being known. They are followed + * by an advice message that updates the amount of the pending transaction. + */ + @JvmField val AUTOMATIC_FUEL_DISPENSER = of("automatic_fuel_dispenser") + + /** A transaction used to pay a bill. */ + @JvmField val BILL_PAYMENT = of("bill_payment") + + /** Original credit transactions are used to send money to a cardholder. */ + @JvmField val ORIGINAL_CREDIT = of("original_credit") + + /** A regular purchase. */ + @JvmField val PURCHASE = of("purchase") + + /** + * Quasi-cash transactions represent purchases of items which may be convertible + * to cash. + */ + @JvmField val QUASI_CASH = of("quasi_cash") + + /** + * A refund card authorization, sometimes referred to as a credit voucher + * authorization, where funds are credited to the cardholder. + */ + @JvmField val REFUND = of("refund") + + /** + * Cash disbursement transactions are used to withdraw cash from an ATM or a + * point of sale. + */ + @JvmField val CASH_DISBURSEMENT = of("cash_disbursement") + + /** The processing category is unknown. */ + @JvmField val UNKNOWN = of("unknown") + + @JvmStatic fun of(value: String) = ProcessingCategory(JsonField.of(value)) + } + + /** An enum containing [ProcessingCategory]'s known values. */ + enum class Known { + /** + * Account funding transactions are transactions used to e.g., fund an account + * or transfer funds between accounts. + */ + ACCOUNT_FUNDING, + /** + * Automatic fuel dispenser authorizations occur when a card is used at a gas + * pump, prior to the actual transaction amount being known. They are followed + * by an advice message that updates the amount of the pending transaction. + */ + AUTOMATIC_FUEL_DISPENSER, + /** A transaction used to pay a bill. */ + BILL_PAYMENT, + /** Original credit transactions are used to send money to a cardholder. */ + ORIGINAL_CREDIT, + /** A regular purchase. */ + PURCHASE, + /** + * Quasi-cash transactions represent purchases of items which may be convertible + * to cash. + */ + QUASI_CASH, + /** + * A refund card authorization, sometimes referred to as a credit voucher + * authorization, where funds are credited to the cardholder. + */ + REFUND, + /** + * Cash disbursement transactions are used to withdraw cash from an ATM or a + * point of sale. + */ + CASH_DISBURSEMENT, + /** The processing category is unknown. */ + UNKNOWN, + } + + /** + * An enum containing [ProcessingCategory]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [ProcessingCategory] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** + * Account funding transactions are transactions used to e.g., fund an account + * or transfer funds between accounts. + */ + ACCOUNT_FUNDING, + /** + * Automatic fuel dispenser authorizations occur when a card is used at a gas + * pump, prior to the actual transaction amount being known. They are followed + * by an advice message that updates the amount of the pending transaction. + */ + AUTOMATIC_FUEL_DISPENSER, + /** A transaction used to pay a bill. */ + BILL_PAYMENT, + /** Original credit transactions are used to send money to a cardholder. */ + ORIGINAL_CREDIT, + /** A regular purchase. */ + PURCHASE, + /** + * Quasi-cash transactions represent purchases of items which may be convertible + * to cash. + */ + QUASI_CASH, + /** + * A refund card authorization, sometimes referred to as a credit voucher + * authorization, where funds are credited to the cardholder. + */ + REFUND, + /** + * Cash disbursement transactions are used to withdraw cash from an ATM or a + * point of sale. + */ + CASH_DISBURSEMENT, + /** The processing category is unknown. */ + UNKNOWN, + /** + * An enum member indicating that [ProcessingCategory] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ACCOUNT_FUNDING -> Value.ACCOUNT_FUNDING + AUTOMATIC_FUEL_DISPENSER -> Value.AUTOMATIC_FUEL_DISPENSER + BILL_PAYMENT -> Value.BILL_PAYMENT + ORIGINAL_CREDIT -> Value.ORIGINAL_CREDIT + PURCHASE -> Value.PURCHASE + QUASI_CASH -> Value.QUASI_CASH + REFUND -> Value.REFUND + CASH_DISBURSEMENT -> Value.CASH_DISBURSEMENT + UNKNOWN -> Value.UNKNOWN + 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) { + 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") + } + + /** + * 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(): ProcessingCategory = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProcessingCategory && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * A constant representing the object's type. For this resource it will always be + * `card_financial`. + */ + 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_FINANCIAL = of("card_financial") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + CARD_FINANCIAL + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + CARD_FINANCIAL, + /** + * An enum member indicating that [Type] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + CARD_FINANCIAL -> Value.CARD_FINANCIAL + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + CARD_FINANCIAL -> Known.CARD_FINANCIAL + else -> throw IncreaseInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Fields related to verification of cardholder-provided values. */ + class Verification + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val cardVerificationCode: JsonField, + private val cardholderAddress: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("card_verification_code") + @ExcludeMissing + cardVerificationCode: JsonField = JsonMissing.of(), + @JsonProperty("cardholder_address") + @ExcludeMissing + cardholderAddress: JsonField = JsonMissing.of(), + ) : this(cardVerificationCode, cardholderAddress, mutableMapOf()) + + /** + * Fields related to verification of the Card Verification Code, a 3-digit code on + * the back of the card. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun cardVerificationCode(): CardVerificationCode = + cardVerificationCode.getRequired("card_verification_code") + + /** + * Cardholder address provided in the authorization request and the address on file + * we verified it against. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun cardholderAddress(): CardholderAddress = + cardholderAddress.getRequired("cardholder_address") + + /** + * Returns the raw JSON value of [cardVerificationCode]. + * + * Unlike [cardVerificationCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("card_verification_code") + @ExcludeMissing + fun _cardVerificationCode(): JsonField = cardVerificationCode + + /** + * Returns the raw JSON value of [cardholderAddress]. + * + * Unlike [cardholderAddress], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("cardholder_address") + @ExcludeMissing + fun _cardholderAddress(): JsonField = cardholderAddress + + @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 [Verification]. + * + * The following fields are required: + * ```java + * .cardVerificationCode() + * .cardholderAddress() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Verification]. */ + class Builder internal constructor() { + + private var cardVerificationCode: JsonField? = null + private var cardholderAddress: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(verification: Verification) = apply { + cardVerificationCode = verification.cardVerificationCode + cardholderAddress = verification.cardholderAddress + additionalProperties = verification.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)) + + /** + * 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 } + + /** + * Cardholder address provided in the authorization request and the address on + * file we verified it against. + */ + fun cardholderAddress(cardholderAddress: CardholderAddress) = + cardholderAddress(JsonField.of(cardholderAddress)) + + /** + * 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 + } + + 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 + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val result: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("result") + @ExcludeMissing + result: JsonField = JsonMissing.of() + ) : this(result, mutableMapOf()) + + /** + * The result of verifying the Card Verification Code. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun result(): Result = result.getRequired("result") + + /** + * Returns the raw JSON value of [result]. + * + * Unlike [result], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("result") + @ExcludeMissing + fun _result(): JsonField = result + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [CardVerificationCode]. + * + * The following fields are required: + * ```java + * .result() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [CardVerificationCode]. */ + class Builder internal constructor() { + + private var result: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(cardVerificationCode: CardVerificationCode) = apply { + result = cardVerificationCode.result + additionalProperties = + cardVerificationCode.additionalProperties.toMutableMap() + } + + /** The result of verifying the Card Verification Code. */ + fun result(result: Result) = result(JsonField.of(result)) + + /** + * Sets [Builder.result] to an arbitrary JSON value. + * + * You should usually call [Builder.result] with a well-typed [Result] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun result(result: JsonField) = apply { this.result = result } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [CardVerificationCode]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .result() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CardVerificationCode = + CardVerificationCode( + checkRequired("result", result), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): CardVerificationCode = apply { + if (validated) { + return@apply + } + + result().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = (result.asKnown().getOrNull()?.validity() ?: 0) + + /** The result of verifying the Card Verification Code. */ + class Result + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** + * No card verification code was provided in the authorization request. + */ + @JvmField val NOT_CHECKED = of("not_checked") + + /** The card verification code matched the one on file. */ + @JvmField val MATCH = of("match") + + /** The card verification code did not match the one on file. */ + @JvmField val NO_MATCH = of("no_match") + + @JvmStatic fun of(value: String) = Result(JsonField.of(value)) + } + + /** An enum containing [Result]'s known values. */ + enum class Known { + /** + * No card verification code was provided in the authorization request. + */ + NOT_CHECKED, + /** The card verification code matched the one on file. */ + MATCH, + /** The card verification code did not match the one on file. */ + NO_MATCH, + } + + /** + * An enum containing [Result]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Result] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** + * No card verification code was provided in the authorization request. + */ + NOT_CHECKED, + /** The card verification code matched the one on file. */ + MATCH, + /** The card verification code did not match the one on file. */ + NO_MATCH, + /** + * An enum member indicating that [Result] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NOT_CHECKED -> Value.NOT_CHECKED + MATCH -> Value.MATCH + NO_MATCH -> Value.NO_MATCH + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + NOT_CHECKED -> Known.NOT_CHECKED + MATCH -> Known.MATCH + NO_MATCH -> Known.NO_MATCH + else -> throw IncreaseInvalidDataException("Unknown Result: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Result = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Result && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is CardVerificationCode && + result == other.result && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(result, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "CardVerificationCode{result=$result, additionalProperties=$additionalProperties}" + } + + /** + * Cardholder address provided in the authorization request and the address on file + * we verified it against. + */ + class CardholderAddress + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val actualLine1: JsonField, + private val actualPostalCode: JsonField, + private val providedLine1: JsonField, + private val providedPostalCode: JsonField, + private val result: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("actual_line1") + @ExcludeMissing + actualLine1: JsonField = JsonMissing.of(), + @JsonProperty("actual_postal_code") + @ExcludeMissing + actualPostalCode: JsonField = JsonMissing.of(), + @JsonProperty("provided_line1") + @ExcludeMissing + providedLine1: JsonField = JsonMissing.of(), + @JsonProperty("provided_postal_code") + @ExcludeMissing + providedPostalCode: JsonField = JsonMissing.of(), + @JsonProperty("result") + @ExcludeMissing + result: JsonField = JsonMissing.of(), + ) : this( + actualLine1, + actualPostalCode, + providedLine1, + providedPostalCode, + result, + mutableMapOf(), + ) + + /** + * Line 1 of the address on file for the cardholder. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun actualLine1(): Optional = actualLine1.getOptional("actual_line1") + + /** + * The postal code of the address on file for the cardholder. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun actualPostalCode(): Optional = + actualPostalCode.getOptional("actual_postal_code") + + /** + * The cardholder address line 1 provided for verification in the authorization + * request. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun providedLine1(): Optional = + providedLine1.getOptional("provided_line1") + + /** + * The postal code provided for verification in the authorization request. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun providedPostalCode(): Optional = + providedPostalCode.getOptional("provided_postal_code") + + /** + * The address verification result returned to the card network. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun result(): Result = result.getRequired("result") + + /** + * Returns the raw JSON value of [actualLine1]. + * + * Unlike [actualLine1], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("actual_line1") + @ExcludeMissing + fun _actualLine1(): JsonField = actualLine1 + + /** + * Returns the raw JSON value of [actualPostalCode]. + * + * Unlike [actualPostalCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("actual_postal_code") + @ExcludeMissing + fun _actualPostalCode(): JsonField = actualPostalCode + + /** + * Returns the raw JSON value of [providedLine1]. + * + * Unlike [providedLine1], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("provided_line1") + @ExcludeMissing + fun _providedLine1(): JsonField = providedLine1 + + /** + * Returns the raw JSON value of [providedPostalCode]. + * + * Unlike [providedPostalCode], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("provided_postal_code") + @ExcludeMissing + fun _providedPostalCode(): JsonField = providedPostalCode + + /** + * Returns the raw JSON value of [result]. + * + * Unlike [result], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("result") + @ExcludeMissing + fun _result(): JsonField = result + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [CardholderAddress]. + * + * The following fields are required: + * ```java + * .actualLine1() + * .actualPostalCode() + * .providedLine1() + * .providedPostalCode() + * .result() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [CardholderAddress]. */ + class Builder internal constructor() { + + private var actualLine1: JsonField? = null + private var actualPostalCode: JsonField? = null + private var providedLine1: JsonField? = null + private var providedPostalCode: JsonField? = null + private var result: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(cardholderAddress: CardholderAddress) = apply { + actualLine1 = cardholderAddress.actualLine1 + actualPostalCode = cardholderAddress.actualPostalCode + providedLine1 = cardholderAddress.providedLine1 + providedPostalCode = cardholderAddress.providedPostalCode + result = cardholderAddress.result + additionalProperties = + cardholderAddress.additionalProperties.toMutableMap() + } + + /** Line 1 of the address on file for the cardholder. */ + fun actualLine1(actualLine1: String?) = + actualLine1(JsonField.ofNullable(actualLine1)) + + /** + * Alias for calling [Builder.actualLine1] with `actualLine1.orElse(null)`. + */ + fun actualLine1(actualLine1: Optional) = + actualLine1(actualLine1.getOrNull()) + + /** + * Sets [Builder.actualLine1] to an arbitrary JSON value. + * + * You should usually call [Builder.actualLine1] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun actualLine1(actualLine1: JsonField) = apply { + this.actualLine1 = actualLine1 + } + + /** The postal code of the address on file for the cardholder. */ + fun actualPostalCode(actualPostalCode: String?) = + actualPostalCode(JsonField.ofNullable(actualPostalCode)) + + /** + * Alias for calling [Builder.actualPostalCode] with + * `actualPostalCode.orElse(null)`. + */ + fun actualPostalCode(actualPostalCode: Optional) = + actualPostalCode(actualPostalCode.getOrNull()) + + /** + * Sets [Builder.actualPostalCode] to an arbitrary JSON value. + * + * You should usually call [Builder.actualPostalCode] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun actualPostalCode(actualPostalCode: JsonField) = apply { + this.actualPostalCode = actualPostalCode + } + + /** + * The cardholder address line 1 provided for verification in the + * authorization request. + */ + fun providedLine1(providedLine1: String?) = + providedLine1(JsonField.ofNullable(providedLine1)) + + /** + * Alias for calling [Builder.providedLine1] with + * `providedLine1.orElse(null)`. + */ + fun providedLine1(providedLine1: Optional) = + providedLine1(providedLine1.getOrNull()) + + /** + * Sets [Builder.providedLine1] to an arbitrary JSON value. + * + * You should usually call [Builder.providedLine1] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun providedLine1(providedLine1: JsonField) = apply { + this.providedLine1 = providedLine1 + } + + /** + * The postal code provided for verification in the authorization request. + */ + fun providedPostalCode(providedPostalCode: String?) = + providedPostalCode(JsonField.ofNullable(providedPostalCode)) + + /** + * Alias for calling [Builder.providedPostalCode] with + * `providedPostalCode.orElse(null)`. + */ + fun providedPostalCode(providedPostalCode: Optional) = + providedPostalCode(providedPostalCode.getOrNull()) + + /** + * Sets [Builder.providedPostalCode] to an arbitrary JSON value. + * + * You should usually call [Builder.providedPostalCode] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun providedPostalCode(providedPostalCode: JsonField) = apply { + this.providedPostalCode = providedPostalCode + } + + /** The address verification result returned to the card network. */ + fun result(result: Result) = result(JsonField.of(result)) + + /** + * Sets [Builder.result] to an arbitrary JSON value. + * + * You should usually call [Builder.result] with a well-typed [Result] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun result(result: JsonField) = apply { this.result = result } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [CardholderAddress]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .actualLine1() + * .actualPostalCode() + * .providedLine1() + * .providedPostalCode() + * .result() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CardholderAddress = + CardholderAddress( + checkRequired("actualLine1", actualLine1), + checkRequired("actualPostalCode", actualPostalCode), + checkRequired("providedLine1", providedLine1), + checkRequired("providedPostalCode", providedPostalCode), + checkRequired("result", result), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): CardholderAddress = apply { + if (validated) { + return@apply + } + + actualLine1() + actualPostalCode() + providedLine1() + providedPostalCode() + result().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (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 + @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 address information was provided in the authorization request. */ + @JvmField val NOT_CHECKED = of("not_checked") + + /** + * Postal code matches, but the street address does not match or was not + * provided. + */ + @JvmField + val POSTAL_CODE_MATCH_ADDRESS_NO_MATCH = + of("postal_code_match_address_no_match") + + /** + * Postal code does not match, but the street address matches or was not + * provided. + */ + @JvmField + val POSTAL_CODE_NO_MATCH_ADDRESS_MATCH = + of("postal_code_no_match_address_match") + + /** Postal code and street address match. */ + @JvmField val MATCH = of("match") + + /** Postal code and street address do not match. */ + @JvmField val NO_MATCH = of("no_match") + + /** + * Postal code matches, but the street address was not verified. + * (deprecated) + */ + @JvmField + val POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED = + of("postal_code_match_address_not_checked") + + @JvmStatic fun of(value: String) = Result(JsonField.of(value)) + } + + /** An enum containing [Result]'s known values. */ + enum class Known { + /** No address information was provided in the authorization request. */ + NOT_CHECKED, + /** + * Postal code matches, but the street address does not match or was not + * provided. + */ + POSTAL_CODE_MATCH_ADDRESS_NO_MATCH, + /** + * Postal code does not match, but the street address matches or was not + * provided. + */ + POSTAL_CODE_NO_MATCH_ADDRESS_MATCH, + /** Postal code and street address match. */ + MATCH, + /** Postal code and street address do not match. */ + NO_MATCH, + /** + * Postal code matches, but the street address was not verified. + * (deprecated) + */ + POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED, + } + + /** + * An enum containing [Result]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Result] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** No address information was provided in the authorization request. */ + NOT_CHECKED, + /** + * Postal code matches, but the street address does not match or was not + * provided. + */ + POSTAL_CODE_MATCH_ADDRESS_NO_MATCH, + /** + * Postal code does not match, but the street address matches or was not + * provided. + */ + POSTAL_CODE_NO_MATCH_ADDRESS_MATCH, + /** Postal code and street address match. */ + MATCH, + /** Postal code and street address do not match. */ + NO_MATCH, + /** + * Postal code matches, but the street address was not verified. + * (deprecated) + */ + POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED, + /** + * An enum member indicating that [Result] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NOT_CHECKED -> Value.NOT_CHECKED + POSTAL_CODE_MATCH_ADDRESS_NO_MATCH -> + Value.POSTAL_CODE_MATCH_ADDRESS_NO_MATCH + POSTAL_CODE_NO_MATCH_ADDRESS_MATCH -> + Value.POSTAL_CODE_NO_MATCH_ADDRESS_MATCH + MATCH -> Value.MATCH + NO_MATCH -> Value.NO_MATCH + POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED -> + Value.POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + NOT_CHECKED -> Known.NOT_CHECKED + POSTAL_CODE_MATCH_ADDRESS_NO_MATCH -> + Known.POSTAL_CODE_MATCH_ADDRESS_NO_MATCH + POSTAL_CODE_NO_MATCH_ADDRESS_MATCH -> + Known.POSTAL_CODE_NO_MATCH_ADDRESS_MATCH + MATCH -> Known.MATCH + NO_MATCH -> Known.NO_MATCH + POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED -> + Known.POSTAL_CODE_MATCH_ADDRESS_NOT_CHECKED + else -> throw IncreaseInvalidDataException("Unknown Result: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Result = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Result && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is CardholderAddress && + actualLine1 == other.actualLine1 && + actualPostalCode == other.actualPostalCode && + providedLine1 == other.providedLine1 && + providedPostalCode == other.providedPostalCode && + result == other.result && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + actualLine1, + actualPostalCode, + providedLine1, + providedPostalCode, + result, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "CardholderAddress{actualLine1=$actualLine1, actualPostalCode=$actualPostalCode, providedLine1=$providedLine1, providedPostalCode=$providedPostalCode, result=$result, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Verification && + cardVerificationCode == other.cardVerificationCode && + cardholderAddress == other.cardholderAddress && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(cardVerificationCode, cardholderAddress, additionalProperties) + } + + 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 other is CardFinancial && + id == other.id && + actioner == other.actioner && + additionalAmounts == other.additionalAmounts && + amount == other.amount && + cardPaymentId == other.cardPaymentId && + currency == other.currency && + digitalWalletTokenId == other.digitalWalletTokenId && + direction == other.direction && + merchantAcceptorId == other.merchantAcceptorId && + merchantCategoryCode == other.merchantCategoryCode && + merchantCity == other.merchantCity && + merchantCountry == other.merchantCountry && + merchantDescriptor == other.merchantDescriptor && + merchantPostalCode == other.merchantPostalCode && + merchantState == other.merchantState && + networkDetails == other.networkDetails && + networkIdentifiers == other.networkIdentifiers && + networkRiskScore == other.networkRiskScore && + physicalCardId == other.physicalCardId && + presentmentAmount == other.presentmentAmount && + presentmentCurrency == other.presentmentCurrency && + processingCategory == other.processingCategory && + realTimeDecisionId == other.realTimeDecisionId && + terminalId == other.terminalId && + transactionId == other.transactionId && + type == other.type && + verification == other.verification && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + actioner, + additionalAmounts, + amount, + cardPaymentId, + currency, + digitalWalletTokenId, + direction, + merchantAcceptorId, + merchantCategoryCode, + merchantCity, + merchantCountry, + merchantDescriptor, + merchantPostalCode, + merchantState, + networkDetails, + networkIdentifiers, + networkRiskScore, + physicalCardId, + presentmentAmount, + presentmentCurrency, + processingCategory, + realTimeDecisionId, + terminalId, + transactionId, + type, + verification, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "CardFinancial{id=$id, actioner=$actioner, additionalAmounts=$additionalAmounts, amount=$amount, cardPaymentId=$cardPaymentId, currency=$currency, digitalWalletTokenId=$digitalWalletTokenId, direction=$direction, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkDetails=$networkDetails, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, physicalCardId=$physicalCardId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, processingCategory=$processingCategory, realTimeDecisionId=$realTimeDecisionId, terminalId=$terminalId, transactionId=$transactionId, type=$type, verification=$verification, additionalProperties=$additionalProperties}" + } + + /** + * A Card Push Transfer Acceptance object. This field will be present in the JSON response + * if and only if `category` is equal to `card_push_transfer_acceptance`. A Card Push + * Transfer Acceptance is created when an Outbound Card Push Transfer sent from Increase is + * accepted by the receiving bank. + */ + class CardPushTransferAcceptance + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val amount: JsonField, + private val transferId: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), + @JsonProperty("transfer_id") + @ExcludeMissing + transferId: JsonField = JsonMissing.of(), + ) : this(amount, transferId, mutableMapOf()) + + /** + * The transfer amount in USD cents. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun amount(): Long = amount.getRequired("amount") + + /** + * The identifier of the Card Push Transfer that led to this Transaction. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun transferId(): String = transferId.getRequired("transfer_id") + + /** + * 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 [transferId]. + * + * Unlike [transferId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("transfer_id") + @ExcludeMissing + fun _transferId(): JsonField = transferId + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [CardPushTransferAcceptance]. + * + * The following fields are required: + * ```java + * .amount() + * .transferId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [CardPushTransferAcceptance]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var transferId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(cardPushTransferAcceptance: CardPushTransferAcceptance) = apply { + amount = cardPushTransferAcceptance.amount + transferId = cardPushTransferAcceptance.transferId + additionalProperties = + cardPushTransferAcceptance.additionalProperties.toMutableMap() + } + + /** The transfer amount in USD 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 identifier of the Card Push Transfer that led to this Transaction. */ + fun transferId(transferId: String) = transferId(JsonField.of(transferId)) + + /** + * Sets [Builder.transferId] to an arbitrary JSON value. + * + * You should usually call [Builder.transferId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun transferId(transferId: JsonField) = apply { + this.transferId = transferId + } + + 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 [CardPushTransferAcceptance]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .amount() + * .transferId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CardPushTransferAcceptance = + CardPushTransferAcceptance( + checkRequired("amount", amount), + checkRequired("transferId", transferId), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): CardPushTransferAcceptance = apply { + if (validated) { + return@apply + } + + amount() + transferId() + 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 (transferId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is CardPushTransferAcceptance && + amount == other.amount && + transferId == other.transferId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(amount, transferId, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "CardPushTransferAcceptance{amount=$amount, transferId=$transferId, additionalProperties=$additionalProperties}" + } + + /** + * A Card Refund object. This field will be present in the JSON response if and only if + * `category` is equal to `card_refund`. Card Refunds move money back to the cardholder. + * While they are usually connected to a Card Settlement an acquirer can also refund money + * directly to a card without relation to a transaction. + */ + class CardRefund + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val amount: JsonField, + private val cardPaymentId: JsonField, + private val cashback: JsonField, + private val currency: JsonField, + private val interchange: JsonField, + private val merchantAcceptorId: JsonField, + private val merchantCategoryCode: JsonField, + private val merchantCity: JsonField, + private val merchantCountry: JsonField, + private val merchantName: JsonField, + private val merchantPostalCode: JsonField, + private val merchantState: JsonField, + private val networkIdentifiers: JsonField, + private val presentmentAmount: JsonField, + private val presentmentCurrency: JsonField, + private val purchaseDetails: JsonField, + private val transactionId: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, + ) { + + @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 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 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 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 debited for this transaction, if eligible. Cashback is paid out in + * aggregate, monthly. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun cashback(): Optional = cashback.getOptional("cashback") + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the 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 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") + + /** + * 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 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_refund`. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun type(): Type = type.getRequired("type") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + + /** + * 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 [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 [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() + } + + /** A builder for [CardRefund]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var amount: JsonField? = null + private var cardPaymentId: JsonField? = null + private var cashback: JsonField? = null + private var currency: JsonField? = null + private var interchange: JsonField? = null + private var merchantAcceptorId: JsonField? = null + private var merchantCategoryCode: JsonField? = null + private var merchantCity: JsonField? = null + private var merchantCountry: JsonField? = null + private var merchantName: JsonField? = null + private var merchantPostalCode: JsonField? = null + private var merchantState: JsonField? = null + private var networkIdentifiers: JsonField? = null + private var presentmentAmount: JsonField? = null + private var presentmentCurrency: JsonField? = null + private var purchaseDetails: JsonField? = null + private var transactionId: JsonField? = null + private var type: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(cardRefund: CardRefund) = apply { + id = cardRefund.id + amount = cardRefund.amount + cardPaymentId = cardRefund.cardPaymentId + cashback = cardRefund.cashback + currency = cardRefund.currency + interchange = cardRefund.interchange + merchantAcceptorId = cardRefund.merchantAcceptorId + merchantCategoryCode = cardRefund.merchantCategoryCode + merchantCity = cardRefund.merchantCity + merchantCountry = cardRefund.merchantCountry + merchantName = cardRefund.merchantName + merchantPostalCode = cardRefund.merchantPostalCode + merchantState = cardRefund.merchantState + networkIdentifiers = cardRefund.networkIdentifiers + presentmentAmount = cardRefund.presentmentAmount + presentmentCurrency = cardRefund.presentmentCurrency + purchaseDetails = cardRefund.purchaseDetails + transactionId = cardRefund.transactionId + type = cardRefund.type + additionalProperties = cardRefund.additionalProperties.toMutableMap() + } + + /** The Card Refund identifier. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** + * The amount in the minor unit of the transaction's settlement currency. For + * dollars, for example, this is cents. + */ + fun amount(amount: Long) = amount(JsonField.of(amount)) + + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun amount(amount: JsonField) = apply { this.amount = amount } + + /** The ID of the Card Payment this transaction belongs to. */ + fun cardPaymentId(cardPaymentId: String) = + cardPaymentId(JsonField.of(cardPaymentId)) + + /** + * Sets [Builder.cardPaymentId] to an arbitrary JSON value. + * + * You should usually call [Builder.cardPaymentId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun cardPaymentId(cardPaymentId: JsonField) = apply { + this.cardPaymentId = cardPaymentId + } + + /** + * Cashback debited for this transaction, if eligible. Cashback is paid out in + * aggregate, monthly. + */ + fun cashback(cashback: Cashback?) = cashback(JsonField.ofNullable(cashback)) + + /** Alias for calling [Builder.cashback] with `cashback.orElse(null)`. */ + fun cashback(cashback: Optional) = cashback(cashback.getOrNull()) + + /** + * Sets [Builder.cashback] to an arbitrary JSON value. + * + * You should usually call [Builder.cashback] with a well-typed [Cashback] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun cashback(cashback: JsonField) = apply { this.cashback = cashback } + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's + * settlement currency. + */ + fun currency(currency: Currency) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [Currency] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } + + /** Interchange assessed as a part of this 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. + * + * You should usually call [Builder.interchange] with a well-typed [Interchange] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun interchange(interchange: JsonField) = apply { + this.interchange = interchange + } + + /** + * The merchant identifier (commonly abbreviated as MID) of the merchant the card is + * transacting with. + */ + fun merchantAcceptorId(merchantAcceptorId: String) = + merchantAcceptorId(JsonField.of(merchantAcceptorId)) + + /** + * Sets [Builder.merchantAcceptorId] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantAcceptorId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun merchantAcceptorId(merchantAcceptorId: JsonField) = apply { + this.merchantAcceptorId = merchantAcceptorId + } + + /** The 4-digit MCC describing the merchant's business. */ + fun merchantCategoryCode(merchantCategoryCode: String) = + merchantCategoryCode(JsonField.of(merchantCategoryCode)) + + /** + * Sets [Builder.merchantCategoryCode] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantCategoryCode] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun merchantCategoryCode(merchantCategoryCode: JsonField) = apply { + this.merchantCategoryCode = merchantCategoryCode + } + + /** The city the merchant resides in. */ + fun merchantCity(merchantCity: String) = merchantCity(JsonField.of(merchantCity)) + + /** + * Sets [Builder.merchantCity] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantCity] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun merchantCity(merchantCity: JsonField) = apply { + this.merchantCity = merchantCity + } + + /** The country the merchant resides in. */ + fun merchantCountry(merchantCountry: String) = + merchantCountry(JsonField.of(merchantCountry)) + + /** + * Sets [Builder.merchantCountry] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantCountry] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun merchantCountry(merchantCountry: JsonField) = apply { + this.merchantCountry = merchantCountry + } + + /** The name of the merchant. */ + fun merchantName(merchantName: String) = merchantName(JsonField.of(merchantName)) + + /** + * Sets [Builder.merchantName] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun merchantName(merchantName: JsonField) = apply { + this.merchantName = merchantName + } + + /** + * The merchant's postal code. For US merchants this is always a 5-digit ZIP code. + */ + fun merchantPostalCode(merchantPostalCode: String?) = + merchantPostalCode(JsonField.ofNullable(merchantPostalCode)) + + /** + * Alias for calling [Builder.merchantPostalCode] with + * `merchantPostalCode.orElse(null)`. + */ + fun merchantPostalCode(merchantPostalCode: Optional) = + merchantPostalCode(merchantPostalCode.getOrNull()) + + /** + * Sets [Builder.merchantPostalCode] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantPostalCode] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun merchantPostalCode(merchantPostalCode: JsonField) = apply { + this.merchantPostalCode = merchantPostalCode + } + + /** The state the merchant resides in. */ + fun merchantState(merchantState: String?) = + merchantState(JsonField.ofNullable(merchantState)) + + /** Alias for calling [Builder.merchantState] with `merchantState.orElse(null)`. */ + fun merchantState(merchantState: Optional) = + merchantState(merchantState.getOrNull()) + + /** + * Sets [Builder.merchantState] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantState] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun merchantState(merchantState: JsonField) = apply { + this.merchantState = merchantState + } + + /** Network-specific identifiers for this refund. */ + fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) = + networkIdentifiers(JsonField.of(networkIdentifiers)) + + /** + * Sets [Builder.networkIdentifiers] to an arbitrary JSON value. + * + * You should usually call [Builder.networkIdentifiers] with a well-typed + * [NetworkIdentifiers] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun networkIdentifiers(networkIdentifiers: JsonField) = apply { + this.networkIdentifiers = networkIdentifiers + } + + /** The amount in the minor unit of the transaction's presentment currency. */ + fun presentmentAmount(presentmentAmount: Long) = + presentmentAmount(JsonField.of(presentmentAmount)) + + /** + * Sets [Builder.presentmentAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.presentmentAmount] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun presentmentAmount(presentmentAmount: JsonField) = apply { + this.presentmentAmount = presentmentAmount + } + + /** + * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's + * presentment currency. + */ + fun presentmentCurrency(presentmentCurrency: String) = + presentmentCurrency(JsonField.of(presentmentCurrency)) + + /** + * Sets [Builder.presentmentCurrency] to an arbitrary JSON value. + * + * You should usually call [Builder.presentmentCurrency] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun presentmentCurrency(presentmentCurrency: JsonField) = apply { + this.presentmentCurrency = presentmentCurrency + } + + /** + * Additional details about the card purchase, such as tax and industry-specific + * fields. + */ + fun purchaseDetails(purchaseDetails: PurchaseDetails?) = + purchaseDetails(JsonField.ofNullable(purchaseDetails)) + + /** + * 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_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) + } + + 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 [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 @@ -28685,6 +36762,9 @@ private constructor( /** Card Settlement: details will be under the `card_settlement` object. */ @JvmField val CARD_SETTLEMENT = of("card_settlement") + /** Card Financial: details will be under the `card_financial` object. */ + @JvmField val CARD_FINANCIAL = of("card_financial") + /** * Card Revenue Payment: details will be under the `card_revenue_payment` object. */ @@ -28867,6 +36947,8 @@ private constructor( CARD_REFUND, /** Card Settlement: details will be under the `card_settlement` object. */ CARD_SETTLEMENT, + /** Card Financial: details will be under the `card_financial` object. */ + CARD_FINANCIAL, /** * Card Revenue Payment: details will be under the `card_revenue_payment` object. */ @@ -29020,6 +37102,8 @@ private constructor( CARD_REFUND, /** Card Settlement: details will be under the `card_settlement` object. */ CARD_SETTLEMENT, + /** Card Financial: details will be under the `card_financial` object. */ + CARD_FINANCIAL, /** * Card Revenue Payment: details will be under the `card_revenue_payment` object. */ @@ -29151,6 +37235,7 @@ private constructor( CARD_DISPUTE_LOSS -> Value.CARD_DISPUTE_LOSS CARD_REFUND -> Value.CARD_REFUND CARD_SETTLEMENT -> Value.CARD_SETTLEMENT + CARD_FINANCIAL -> Value.CARD_FINANCIAL CARD_REVENUE_PAYMENT -> Value.CARD_REVENUE_PAYMENT CHECK_DEPOSIT_ACCEPTANCE -> Value.CHECK_DEPOSIT_ACCEPTANCE CHECK_DEPOSIT_RETURN -> Value.CHECK_DEPOSIT_RETURN @@ -29205,6 +37290,7 @@ private constructor( CARD_DISPUTE_LOSS -> Known.CARD_DISPUTE_LOSS CARD_REFUND -> Known.CARD_REFUND CARD_SETTLEMENT -> Known.CARD_SETTLEMENT + CARD_FINANCIAL -> Known.CARD_FINANCIAL CARD_REVENUE_PAYMENT -> Known.CARD_REVENUE_PAYMENT CHECK_DEPOSIT_ACCEPTANCE -> Known.CHECK_DEPOSIT_ACCEPTANCE CHECK_DEPOSIT_RETURN -> Known.CHECK_DEPOSIT_RETURN @@ -40333,6 +48419,7 @@ private constructor( cardDisputeAcceptance == other.cardDisputeAcceptance && cardDisputeFinancial == other.cardDisputeFinancial && cardDisputeLoss == other.cardDisputeLoss && + cardFinancial == other.cardFinancial && cardPushTransferAcceptance == other.cardPushTransferAcceptance && cardRefund == other.cardRefund && cardRevenuePayment == other.cardRevenuePayment && @@ -40376,6 +48463,7 @@ private constructor( cardDisputeAcceptance, cardDisputeFinancial, cardDisputeLoss, + cardFinancial, cardPushTransferAcceptance, cardRefund, cardRevenuePayment, @@ -40411,7 +48499,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Source{accountRevenuePayment=$accountRevenuePayment, accountTransferIntention=$accountTransferIntention, achTransferIntention=$achTransferIntention, achTransferRejection=$achTransferRejection, achTransferReturn=$achTransferReturn, cardDisputeAcceptance=$cardDisputeAcceptance, cardDisputeFinancial=$cardDisputeFinancial, cardDisputeLoss=$cardDisputeLoss, cardPushTransferAcceptance=$cardPushTransferAcceptance, cardRefund=$cardRefund, cardRevenuePayment=$cardRevenuePayment, cardSettlement=$cardSettlement, cashbackPayment=$cashbackPayment, category=$category, checkDepositAcceptance=$checkDepositAcceptance, checkDepositReturn=$checkDepositReturn, checkTransferDeposit=$checkTransferDeposit, fednowTransferAcknowledgement=$fednowTransferAcknowledgement, feePayment=$feePayment, inboundAchTransfer=$inboundAchTransfer, inboundAchTransferReturnIntention=$inboundAchTransferReturnIntention, inboundCheckAdjustment=$inboundCheckAdjustment, inboundCheckDepositReturnIntention=$inboundCheckDepositReturnIntention, inboundFednowTransferConfirmation=$inboundFednowTransferConfirmation, inboundRealTimePaymentsTransferConfirmation=$inboundRealTimePaymentsTransferConfirmation, inboundWireReversal=$inboundWireReversal, inboundWireTransfer=$inboundWireTransfer, inboundWireTransferReversal=$inboundWireTransferReversal, interestPayment=$interestPayment, internalSource=$internalSource, other=$other, realTimePaymentsTransferAcknowledgement=$realTimePaymentsTransferAcknowledgement, sampleFunds=$sampleFunds, swiftTransferIntention=$swiftTransferIntention, swiftTransferReturn=$swiftTransferReturn, wireTransferIntention=$wireTransferIntention, additionalProperties=$additionalProperties}" + "Source{accountRevenuePayment=$accountRevenuePayment, accountTransferIntention=$accountTransferIntention, achTransferIntention=$achTransferIntention, achTransferRejection=$achTransferRejection, achTransferReturn=$achTransferReturn, cardDisputeAcceptance=$cardDisputeAcceptance, cardDisputeFinancial=$cardDisputeFinancial, cardDisputeLoss=$cardDisputeLoss, cardFinancial=$cardFinancial, cardPushTransferAcceptance=$cardPushTransferAcceptance, cardRefund=$cardRefund, cardRevenuePayment=$cardRevenuePayment, cardSettlement=$cardSettlement, cashbackPayment=$cashbackPayment, category=$category, checkDepositAcceptance=$checkDepositAcceptance, checkDepositReturn=$checkDepositReturn, checkTransferDeposit=$checkTransferDeposit, fednowTransferAcknowledgement=$fednowTransferAcknowledgement, feePayment=$feePayment, inboundAchTransfer=$inboundAchTransfer, inboundAchTransferReturnIntention=$inboundAchTransferReturnIntention, inboundCheckAdjustment=$inboundCheckAdjustment, inboundCheckDepositReturnIntention=$inboundCheckDepositReturnIntention, inboundFednowTransferConfirmation=$inboundFednowTransferConfirmation, inboundRealTimePaymentsTransferConfirmation=$inboundRealTimePaymentsTransferConfirmation, inboundWireReversal=$inboundWireReversal, inboundWireTransfer=$inboundWireTransfer, inboundWireTransferReversal=$inboundWireTransferReversal, interestPayment=$interestPayment, internalSource=$internalSource, other=$other, realTimePaymentsTransferAcknowledgement=$realTimePaymentsTransferAcknowledgement, sampleFunds=$sampleFunds, swiftTransferIntention=$swiftTransferIntention, swiftTransferReturn=$swiftTransferReturn, wireTransferIntention=$wireTransferIntention, additionalProperties=$additionalProperties}" } /** diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/transactions/TransactionListParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/transactions/TransactionListParams.kt index ee531bc2e..146829302 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/transactions/TransactionListParams.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/transactions/TransactionListParams.kt @@ -464,6 +464,9 @@ private constructor( /** Card Settlement: details will be under the `card_settlement` object. */ @JvmField val CARD_SETTLEMENT = of("card_settlement") + /** Card Financial: details will be under the `card_financial` object. */ + @JvmField val CARD_FINANCIAL = of("card_financial") + /** * Card Revenue Payment: details will be under the `card_revenue_payment` object. */ @@ -646,6 +649,8 @@ private constructor( CARD_REFUND, /** Card Settlement: details will be under the `card_settlement` object. */ CARD_SETTLEMENT, + /** Card Financial: details will be under the `card_financial` object. */ + CARD_FINANCIAL, /** * Card Revenue Payment: details will be under the `card_revenue_payment` object. */ @@ -799,6 +804,8 @@ private constructor( CARD_REFUND, /** Card Settlement: details will be under the `card_settlement` object. */ CARD_SETTLEMENT, + /** Card Financial: details will be under the `card_financial` object. */ + CARD_FINANCIAL, /** * Card Revenue Payment: details will be under the `card_revenue_payment` object. */ @@ -928,6 +935,7 @@ private constructor( CARD_DISPUTE_LOSS -> Value.CARD_DISPUTE_LOSS CARD_REFUND -> Value.CARD_REFUND CARD_SETTLEMENT -> Value.CARD_SETTLEMENT + CARD_FINANCIAL -> Value.CARD_FINANCIAL CARD_REVENUE_PAYMENT -> Value.CARD_REVENUE_PAYMENT CHECK_DEPOSIT_ACCEPTANCE -> Value.CHECK_DEPOSIT_ACCEPTANCE CHECK_DEPOSIT_RETURN -> Value.CHECK_DEPOSIT_RETURN @@ -982,6 +990,7 @@ private constructor( CARD_DISPUTE_LOSS -> Known.CARD_DISPUTE_LOSS CARD_REFUND -> Known.CARD_REFUND CARD_SETTLEMENT -> Known.CARD_SETTLEMENT + CARD_FINANCIAL -> Known.CARD_FINANCIAL CARD_REVENUE_PAYMENT -> Known.CARD_REVENUE_PAYMENT CHECK_DEPOSIT_ACCEPTANCE -> Known.CHECK_DEPOSIT_ACCEPTANCE CHECK_DEPOSIT_RETURN -> Known.CHECK_DEPOSIT_RETURN diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/transactions/TransactionListPageResponseTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/transactions/TransactionListPageResponseTest.kt index 651b43a3b..c4fd74327 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/transactions/TransactionListPageResponseTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/transactions/TransactionListPageResponseTest.kt @@ -109,6 +109,199 @@ internal class TransactionListPageResponseTest { .transactionId("transaction_uyrp7fld2ium70oa7oi") .build() ) + .cardFinancial( + Transaction.Source.CardFinancial.builder() + .id("card_financial_di5b98i72ppomo268zfk") + .actioner( + Transaction.Source.CardFinancial.Actioner.INCREASE + ) + .additionalAmounts( + Transaction.Source.CardFinancial.AdditionalAmounts + .builder() + .clinic( + Transaction.Source.CardFinancial + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + Transaction.Source.CardFinancial + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + Transaction.Source.CardFinancial + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + Transaction.Source.CardFinancial + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + Transaction.Source.CardFinancial + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + Transaction.Source.CardFinancial + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + Transaction.Source.CardFinancial + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + Transaction.Source.CardFinancial + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + Transaction.Source.CardFinancial + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) + .amount(100L) + .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") + .currency(Transaction.Source.CardFinancial.Currency.USD) + .digitalWalletTokenId(null) + .direction( + Transaction.Source.CardFinancial.Direction.SETTLEMENT + ) + .merchantAcceptorId("5665270011000168") + .merchantCategoryCode("5734") + .merchantCity("New York") + .merchantCountry("US") + .merchantDescriptor("AMAZON.COM") + .merchantPostalCode("10045") + .merchantState("NY") + .networkDetails( + Transaction.Source.CardFinancial.NetworkDetails + .builder() + .category( + Transaction.Source.CardFinancial.NetworkDetails + .Category + .VISA + ) + .visa( + Transaction.Source.CardFinancial.NetworkDetails + .Visa + .builder() + .electronicCommerceIndicator( + Transaction.Source.CardFinancial + .NetworkDetails + .Visa + .ElectronicCommerceIndicator + .SECURE_ELECTRONIC_COMMERCE + ) + .pointOfServiceEntryMode( + Transaction.Source.CardFinancial + .NetworkDetails + .Visa + .PointOfServiceEntryMode + .MANUAL + ) + .standInProcessingReason(null) + .build() + ) + .build() + ) + .networkIdentifiers( + Transaction.Source.CardFinancial.NetworkIdentifiers + .builder() + .retrievalReferenceNumber("785867080153") + .traceNumber("487941") + .transactionId("627199945183184") + .build() + ) + .networkRiskScore(10L) + .physicalCardId(null) + .presentmentAmount(100L) + .presentmentCurrency("USD") + .processingCategory( + Transaction.Source.CardFinancial.ProcessingCategory + .PURCHASE + ) + .realTimeDecisionId(null) + .terminalId("RCN5VNXS") + .transactionId("transaction_uyrp7fld2ium70oa7oi") + .type(Transaction.Source.CardFinancial.Type.CARD_FINANCIAL) + .verification( + Transaction.Source.CardFinancial.Verification.builder() + .cardVerificationCode( + Transaction.Source.CardFinancial.Verification + .CardVerificationCode + .builder() + .result( + Transaction.Source.CardFinancial + .Verification + .CardVerificationCode + .Result + .MATCH + ) + .build() + ) + .cardholderAddress( + Transaction.Source.CardFinancial.Verification + .CardholderAddress + .builder() + .actualLine1("33 Liberty Street") + .actualPostalCode("94131") + .providedLine1("33 Liberty Street") + .providedPostalCode("94132") + .result( + Transaction.Source.CardFinancial + .Verification + .CardholderAddress + .Result + .POSTAL_CODE_NO_MATCH_ADDRESS_MATCH + ) + .build() + ) + .build() + ) + .build() + ) .cardPushTransferAcceptance( Transaction.Source.CardPushTransferAcceptance.builder() .amount(100L) @@ -1014,6 +1207,184 @@ internal class TransactionListPageResponseTest { .transactionId("transaction_uyrp7fld2ium70oa7oi") .build() ) + .cardFinancial( + Transaction.Source.CardFinancial.builder() + .id("card_financial_di5b98i72ppomo268zfk") + .actioner(Transaction.Source.CardFinancial.Actioner.INCREASE) + .additionalAmounts( + Transaction.Source.CardFinancial.AdditionalAmounts.builder() + .clinic( + Transaction.Source.CardFinancial.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + Transaction.Source.CardFinancial.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + Transaction.Source.CardFinancial.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + Transaction.Source.CardFinancial.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + Transaction.Source.CardFinancial.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + Transaction.Source.CardFinancial.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + Transaction.Source.CardFinancial.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + Transaction.Source.CardFinancial.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + Transaction.Source.CardFinancial.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) + .amount(100L) + .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") + .currency(Transaction.Source.CardFinancial.Currency.USD) + .digitalWalletTokenId(null) + .direction( + Transaction.Source.CardFinancial.Direction.SETTLEMENT + ) + .merchantAcceptorId("5665270011000168") + .merchantCategoryCode("5734") + .merchantCity("New York") + .merchantCountry("US") + .merchantDescriptor("AMAZON.COM") + .merchantPostalCode("10045") + .merchantState("NY") + .networkDetails( + Transaction.Source.CardFinancial.NetworkDetails.builder() + .category( + Transaction.Source.CardFinancial.NetworkDetails + .Category + .VISA + ) + .visa( + Transaction.Source.CardFinancial.NetworkDetails.Visa + .builder() + .electronicCommerceIndicator( + Transaction.Source.CardFinancial + .NetworkDetails + .Visa + .ElectronicCommerceIndicator + .SECURE_ELECTRONIC_COMMERCE + ) + .pointOfServiceEntryMode( + Transaction.Source.CardFinancial + .NetworkDetails + .Visa + .PointOfServiceEntryMode + .MANUAL + ) + .standInProcessingReason(null) + .build() + ) + .build() + ) + .networkIdentifiers( + Transaction.Source.CardFinancial.NetworkIdentifiers + .builder() + .retrievalReferenceNumber("785867080153") + .traceNumber("487941") + .transactionId("627199945183184") + .build() + ) + .networkRiskScore(10L) + .physicalCardId(null) + .presentmentAmount(100L) + .presentmentCurrency("USD") + .processingCategory( + Transaction.Source.CardFinancial.ProcessingCategory.PURCHASE + ) + .realTimeDecisionId(null) + .terminalId("RCN5VNXS") + .transactionId("transaction_uyrp7fld2ium70oa7oi") + .type(Transaction.Source.CardFinancial.Type.CARD_FINANCIAL) + .verification( + Transaction.Source.CardFinancial.Verification.builder() + .cardVerificationCode( + Transaction.Source.CardFinancial.Verification + .CardVerificationCode + .builder() + .result( + Transaction.Source.CardFinancial + .Verification + .CardVerificationCode + .Result + .MATCH + ) + .build() + ) + .cardholderAddress( + Transaction.Source.CardFinancial.Verification + .CardholderAddress + .builder() + .actualLine1("33 Liberty Street") + .actualPostalCode("94131") + .providedLine1("33 Liberty Street") + .providedPostalCode("94132") + .result( + Transaction.Source.CardFinancial + .Verification + .CardholderAddress + .Result + .POSTAL_CODE_NO_MATCH_ADDRESS_MATCH + ) + .build() + ) + .build() + ) + .build() + ) .cardPushTransferAcceptance( Transaction.Source.CardPushTransferAcceptance.builder() .amount(100L) @@ -1882,6 +2253,199 @@ internal class TransactionListPageResponseTest { .transactionId("transaction_uyrp7fld2ium70oa7oi") .build() ) + .cardFinancial( + Transaction.Source.CardFinancial.builder() + .id("card_financial_di5b98i72ppomo268zfk") + .actioner( + Transaction.Source.CardFinancial.Actioner.INCREASE + ) + .additionalAmounts( + Transaction.Source.CardFinancial.AdditionalAmounts + .builder() + .clinic( + Transaction.Source.CardFinancial + .AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + Transaction.Source.CardFinancial + .AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + Transaction.Source.CardFinancial + .AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + Transaction.Source.CardFinancial + .AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + Transaction.Source.CardFinancial + .AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + Transaction.Source.CardFinancial + .AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + Transaction.Source.CardFinancial + .AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + Transaction.Source.CardFinancial + .AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + Transaction.Source.CardFinancial + .AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) + .amount(100L) + .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") + .currency(Transaction.Source.CardFinancial.Currency.USD) + .digitalWalletTokenId(null) + .direction( + Transaction.Source.CardFinancial.Direction.SETTLEMENT + ) + .merchantAcceptorId("5665270011000168") + .merchantCategoryCode("5734") + .merchantCity("New York") + .merchantCountry("US") + .merchantDescriptor("AMAZON.COM") + .merchantPostalCode("10045") + .merchantState("NY") + .networkDetails( + Transaction.Source.CardFinancial.NetworkDetails + .builder() + .category( + Transaction.Source.CardFinancial.NetworkDetails + .Category + .VISA + ) + .visa( + Transaction.Source.CardFinancial.NetworkDetails + .Visa + .builder() + .electronicCommerceIndicator( + Transaction.Source.CardFinancial + .NetworkDetails + .Visa + .ElectronicCommerceIndicator + .SECURE_ELECTRONIC_COMMERCE + ) + .pointOfServiceEntryMode( + Transaction.Source.CardFinancial + .NetworkDetails + .Visa + .PointOfServiceEntryMode + .MANUAL + ) + .standInProcessingReason(null) + .build() + ) + .build() + ) + .networkIdentifiers( + Transaction.Source.CardFinancial.NetworkIdentifiers + .builder() + .retrievalReferenceNumber("785867080153") + .traceNumber("487941") + .transactionId("627199945183184") + .build() + ) + .networkRiskScore(10L) + .physicalCardId(null) + .presentmentAmount(100L) + .presentmentCurrency("USD") + .processingCategory( + Transaction.Source.CardFinancial.ProcessingCategory + .PURCHASE + ) + .realTimeDecisionId(null) + .terminalId("RCN5VNXS") + .transactionId("transaction_uyrp7fld2ium70oa7oi") + .type(Transaction.Source.CardFinancial.Type.CARD_FINANCIAL) + .verification( + Transaction.Source.CardFinancial.Verification.builder() + .cardVerificationCode( + Transaction.Source.CardFinancial.Verification + .CardVerificationCode + .builder() + .result( + Transaction.Source.CardFinancial + .Verification + .CardVerificationCode + .Result + .MATCH + ) + .build() + ) + .cardholderAddress( + Transaction.Source.CardFinancial.Verification + .CardholderAddress + .builder() + .actualLine1("33 Liberty Street") + .actualPostalCode("94131") + .providedLine1("33 Liberty Street") + .providedPostalCode("94132") + .result( + Transaction.Source.CardFinancial + .Verification + .CardholderAddress + .Result + .POSTAL_CODE_NO_MATCH_ADDRESS_MATCH + ) + .build() + ) + .build() + ) + .build() + ) .cardPushTransferAcceptance( Transaction.Source.CardPushTransferAcceptance.builder() .amount(100L) diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/transactions/TransactionTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/transactions/TransactionTest.kt index 879b5117d..f67dd3b9a 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/transactions/TransactionTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/transactions/TransactionTest.kt @@ -98,6 +98,176 @@ internal class TransactionTest { .transactionId("transaction_uyrp7fld2ium70oa7oi") .build() ) + .cardFinancial( + Transaction.Source.CardFinancial.builder() + .id("card_financial_di5b98i72ppomo268zfk") + .actioner(Transaction.Source.CardFinancial.Actioner.INCREASE) + .additionalAmounts( + Transaction.Source.CardFinancial.AdditionalAmounts.builder() + .clinic( + Transaction.Source.CardFinancial.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + Transaction.Source.CardFinancial.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + Transaction.Source.CardFinancial.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + Transaction.Source.CardFinancial.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + Transaction.Source.CardFinancial.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + Transaction.Source.CardFinancial.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + Transaction.Source.CardFinancial.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + Transaction.Source.CardFinancial.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + Transaction.Source.CardFinancial.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) + .amount(100L) + .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") + .currency(Transaction.Source.CardFinancial.Currency.USD) + .digitalWalletTokenId(null) + .direction(Transaction.Source.CardFinancial.Direction.SETTLEMENT) + .merchantAcceptorId("5665270011000168") + .merchantCategoryCode("5734") + .merchantCity("New York") + .merchantCountry("US") + .merchantDescriptor("AMAZON.COM") + .merchantPostalCode("10045") + .merchantState("NY") + .networkDetails( + Transaction.Source.CardFinancial.NetworkDetails.builder() + .category( + Transaction.Source.CardFinancial.NetworkDetails.Category + .VISA + ) + .visa( + Transaction.Source.CardFinancial.NetworkDetails.Visa + .builder() + .electronicCommerceIndicator( + Transaction.Source.CardFinancial.NetworkDetails + .Visa + .ElectronicCommerceIndicator + .SECURE_ELECTRONIC_COMMERCE + ) + .pointOfServiceEntryMode( + Transaction.Source.CardFinancial.NetworkDetails + .Visa + .PointOfServiceEntryMode + .MANUAL + ) + .standInProcessingReason(null) + .build() + ) + .build() + ) + .networkIdentifiers( + Transaction.Source.CardFinancial.NetworkIdentifiers.builder() + .retrievalReferenceNumber("785867080153") + .traceNumber("487941") + .transactionId("627199945183184") + .build() + ) + .networkRiskScore(10L) + .physicalCardId(null) + .presentmentAmount(100L) + .presentmentCurrency("USD") + .processingCategory( + Transaction.Source.CardFinancial.ProcessingCategory.PURCHASE + ) + .realTimeDecisionId(null) + .terminalId("RCN5VNXS") + .transactionId("transaction_uyrp7fld2ium70oa7oi") + .type(Transaction.Source.CardFinancial.Type.CARD_FINANCIAL) + .verification( + Transaction.Source.CardFinancial.Verification.builder() + .cardVerificationCode( + Transaction.Source.CardFinancial.Verification + .CardVerificationCode + .builder() + .result( + Transaction.Source.CardFinancial.Verification + .CardVerificationCode + .Result + .MATCH + ) + .build() + ) + .cardholderAddress( + Transaction.Source.CardFinancial.Verification + .CardholderAddress + .builder() + .actualLine1("33 Liberty Street") + .actualPostalCode("94131") + .providedLine1("33 Liberty Street") + .providedPostalCode("94132") + .result( + Transaction.Source.CardFinancial.Verification + .CardholderAddress + .Result + .POSTAL_CODE_NO_MATCH_ADDRESS_MATCH + ) + .build() + ) + .build() + ) + .build() + ) .cardPushTransferAcceptance( Transaction.Source.CardPushTransferAcceptance.builder() .amount(100L) @@ -912,6 +1082,168 @@ internal class TransactionTest { .transactionId("transaction_uyrp7fld2ium70oa7oi") .build() ) + .cardFinancial( + Transaction.Source.CardFinancial.builder() + .id("card_financial_di5b98i72ppomo268zfk") + .actioner(Transaction.Source.CardFinancial.Actioner.INCREASE) + .additionalAmounts( + Transaction.Source.CardFinancial.AdditionalAmounts.builder() + .clinic( + Transaction.Source.CardFinancial.AdditionalAmounts.Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + Transaction.Source.CardFinancial.AdditionalAmounts.Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + Transaction.Source.CardFinancial.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + Transaction.Source.CardFinancial.AdditionalAmounts.Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + Transaction.Source.CardFinancial.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + Transaction.Source.CardFinancial.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + Transaction.Source.CardFinancial.AdditionalAmounts.Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + Transaction.Source.CardFinancial.AdditionalAmounts.Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + Transaction.Source.CardFinancial.AdditionalAmounts.Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) + .amount(100L) + .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") + .currency(Transaction.Source.CardFinancial.Currency.USD) + .digitalWalletTokenId(null) + .direction(Transaction.Source.CardFinancial.Direction.SETTLEMENT) + .merchantAcceptorId("5665270011000168") + .merchantCategoryCode("5734") + .merchantCity("New York") + .merchantCountry("US") + .merchantDescriptor("AMAZON.COM") + .merchantPostalCode("10045") + .merchantState("NY") + .networkDetails( + Transaction.Source.CardFinancial.NetworkDetails.builder() + .category( + Transaction.Source.CardFinancial.NetworkDetails.Category + .VISA + ) + .visa( + Transaction.Source.CardFinancial.NetworkDetails.Visa + .builder() + .electronicCommerceIndicator( + Transaction.Source.CardFinancial.NetworkDetails.Visa + .ElectronicCommerceIndicator + .SECURE_ELECTRONIC_COMMERCE + ) + .pointOfServiceEntryMode( + Transaction.Source.CardFinancial.NetworkDetails.Visa + .PointOfServiceEntryMode + .MANUAL + ) + .standInProcessingReason(null) + .build() + ) + .build() + ) + .networkIdentifiers( + Transaction.Source.CardFinancial.NetworkIdentifiers.builder() + .retrievalReferenceNumber("785867080153") + .traceNumber("487941") + .transactionId("627199945183184") + .build() + ) + .networkRiskScore(10L) + .physicalCardId(null) + .presentmentAmount(100L) + .presentmentCurrency("USD") + .processingCategory( + Transaction.Source.CardFinancial.ProcessingCategory.PURCHASE + ) + .realTimeDecisionId(null) + .terminalId("RCN5VNXS") + .transactionId("transaction_uyrp7fld2ium70oa7oi") + .type(Transaction.Source.CardFinancial.Type.CARD_FINANCIAL) + .verification( + Transaction.Source.CardFinancial.Verification.builder() + .cardVerificationCode( + Transaction.Source.CardFinancial.Verification + .CardVerificationCode + .builder() + .result( + Transaction.Source.CardFinancial.Verification + .CardVerificationCode + .Result + .MATCH + ) + .build() + ) + .cardholderAddress( + Transaction.Source.CardFinancial.Verification + .CardholderAddress + .builder() + .actualLine1("33 Liberty Street") + .actualPostalCode("94131") + .providedLine1("33 Liberty Street") + .providedPostalCode("94132") + .result( + Transaction.Source.CardFinancial.Verification + .CardholderAddress + .Result + .POSTAL_CODE_NO_MATCH_ADDRESS_MATCH + ) + .build() + ) + .build() + ) + .build() + ) .cardPushTransferAcceptance( Transaction.Source.CardPushTransferAcceptance.builder() .amount(100L) @@ -1689,6 +2021,176 @@ internal class TransactionTest { .transactionId("transaction_uyrp7fld2ium70oa7oi") .build() ) + .cardFinancial( + Transaction.Source.CardFinancial.builder() + .id("card_financial_di5b98i72ppomo268zfk") + .actioner(Transaction.Source.CardFinancial.Actioner.INCREASE) + .additionalAmounts( + Transaction.Source.CardFinancial.AdditionalAmounts.builder() + .clinic( + Transaction.Source.CardFinancial.AdditionalAmounts + .Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + Transaction.Source.CardFinancial.AdditionalAmounts + .Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + Transaction.Source.CardFinancial.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + Transaction.Source.CardFinancial.AdditionalAmounts + .Surcharge + .builder() + .amount(10L) + .currency("USD") + .build() + ) + .totalCumulative( + Transaction.Source.CardFinancial.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + Transaction.Source.CardFinancial.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + Transaction.Source.CardFinancial.AdditionalAmounts + .Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + Transaction.Source.CardFinancial.AdditionalAmounts + .Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + Transaction.Source.CardFinancial.AdditionalAmounts + .Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) + .amount(100L) + .cardPaymentId("card_payment_nd3k2kacrqjli8482ave") + .currency(Transaction.Source.CardFinancial.Currency.USD) + .digitalWalletTokenId(null) + .direction(Transaction.Source.CardFinancial.Direction.SETTLEMENT) + .merchantAcceptorId("5665270011000168") + .merchantCategoryCode("5734") + .merchantCity("New York") + .merchantCountry("US") + .merchantDescriptor("AMAZON.COM") + .merchantPostalCode("10045") + .merchantState("NY") + .networkDetails( + Transaction.Source.CardFinancial.NetworkDetails.builder() + .category( + Transaction.Source.CardFinancial.NetworkDetails.Category + .VISA + ) + .visa( + Transaction.Source.CardFinancial.NetworkDetails.Visa + .builder() + .electronicCommerceIndicator( + Transaction.Source.CardFinancial.NetworkDetails + .Visa + .ElectronicCommerceIndicator + .SECURE_ELECTRONIC_COMMERCE + ) + .pointOfServiceEntryMode( + Transaction.Source.CardFinancial.NetworkDetails + .Visa + .PointOfServiceEntryMode + .MANUAL + ) + .standInProcessingReason(null) + .build() + ) + .build() + ) + .networkIdentifiers( + Transaction.Source.CardFinancial.NetworkIdentifiers.builder() + .retrievalReferenceNumber("785867080153") + .traceNumber("487941") + .transactionId("627199945183184") + .build() + ) + .networkRiskScore(10L) + .physicalCardId(null) + .presentmentAmount(100L) + .presentmentCurrency("USD") + .processingCategory( + Transaction.Source.CardFinancial.ProcessingCategory.PURCHASE + ) + .realTimeDecisionId(null) + .terminalId("RCN5VNXS") + .transactionId("transaction_uyrp7fld2ium70oa7oi") + .type(Transaction.Source.CardFinancial.Type.CARD_FINANCIAL) + .verification( + Transaction.Source.CardFinancial.Verification.builder() + .cardVerificationCode( + Transaction.Source.CardFinancial.Verification + .CardVerificationCode + .builder() + .result( + Transaction.Source.CardFinancial.Verification + .CardVerificationCode + .Result + .MATCH + ) + .build() + ) + .cardholderAddress( + Transaction.Source.CardFinancial.Verification + .CardholderAddress + .builder() + .actualLine1("33 Liberty Street") + .actualPostalCode("94131") + .providedLine1("33 Liberty Street") + .providedPostalCode("94132") + .result( + Transaction.Source.CardFinancial.Verification + .CardholderAddress + .Result + .POSTAL_CODE_NO_MATCH_ADDRESS_MATCH + ) + .build() + ) + .build() + ) + .build() + ) .cardPushTransferAcceptance( Transaction.Source.CardPushTransferAcceptance.builder() .amount(100L) From 71b6006d0d0ee76a677febec7a7221c17a9ec41d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 26 Sep 2025 04:13:41 +0000 Subject: [PATCH 2/2] release: 0.338.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ README.md | 10 +++++----- build.gradle.kts | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 63083449c..2503a8405 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.337.1" + ".": "0.338.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cd05372c..31051f916 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.338.0 (2025-09-26) + +Full Changelog: [v0.337.1...v0.338.0](https://github.com/Increase/increase-java/compare/v0.337.1...v0.338.0) + +### Features + +* **api:** api update ([b563156](https://github.com/Increase/increase-java/commit/b56315678747c227486e75be28e75bbdd967a4e1)) + ## 0.337.1 (2025-09-25) Full Changelog: [v0.337.0...v0.337.1](https://github.com/Increase/increase-java/compare/v0.337.0...v0.337.1) diff --git a/README.md b/README.md index d5d6bf10a..62cb79aec 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.337.1) -[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.337.1/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.337.1) +[![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.338.0) +[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.338.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.338.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.337.1). +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.338.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.337.1") +implementation("com.increase.api:increase-java:0.338.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.337.1") com.increase.api increase-java - 0.337.1 + 0.338.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index dd6310906..a66106de5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.increase.api" - version = "0.337.1" // x-release-please-version + version = "0.338.0" // x-release-please-version } subprojects {