From 76ef438085db48829e4f2341e8d0bdfb7874edd6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 8 Dec 2025 23:20:47 +0000 Subject: [PATCH 1/2] feat(api): api update --- .stats.yml | 4 +- .../com/increase/api/models/events/Event.kt | 22 + .../api/models/events/EventListParams.kt | 22 + .../eventsubscriptions/EventSubscription.kt | 22 + .../EventSubscriptionCreateParams.kt | 22 + .../realtimedecisions/RealTimeDecision.kt | 7564 ++++++++++++++++- .../RealTimeDecisionActionParams.kt | 599 +- .../RealTimeDecisionActionParamsTest.kt | 31 + .../realtimedecisions/RealTimeDecisionTest.kt | 514 ++ .../async/RealTimeDecisionServiceAsyncTest.kt | 12 + .../blocking/RealTimeDecisionServiceTest.kt | 12 + 11 files changed, 8808 insertions(+), 16 deletions(-) diff --git a/.stats.yml b/.stats.yml index 62bd5d7e3..537cdff67 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 229 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-56334e000721ba4ee20536271d3acf7231529d7b1f651729e2f4ebe75eb12048.yml -openapi_spec_hash: 45777c412bcbc1aead50c84f78695203 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-942f7494ee0f14c1634ede0989985359cea633e5eece3d761910e7ffd6ac0fd8.yml +openapi_spec_hash: d87134899fb29e27832158facf9d67eb config_hash: b6f365add90e618b2174634df140826e diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/events/Event.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/events/Event.kt index 5096a94c5..e33897ad6 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/events/Event.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/events/Event.kt @@ -670,6 +670,14 @@ private constructor( val REAL_TIME_DECISION_CARD_AUTHORIZATION_REQUESTED = of("real_time_decision.card_authorization_requested") + /** + * Occurs whenever a Real-Time Decision is created in response to a card balance + * inquiry. + */ + @JvmField + val REAL_TIME_DECISION_CARD_BALANCE_INQUIRY_REQUESTED = + of("real_time_decision.card_balance_inquiry_requested") + /** * Occurs whenever a Real-Time Decision is created in response to a digital wallet * provisioning attempt. @@ -920,6 +928,11 @@ private constructor( * Occurs whenever a Real-Time Decision is created in response to a card authorization. */ REAL_TIME_DECISION_CARD_AUTHORIZATION_REQUESTED, + /** + * Occurs whenever a Real-Time Decision is created in response to a card balance + * inquiry. + */ + REAL_TIME_DECISION_CARD_BALANCE_INQUIRY_REQUESTED, /** * Occurs whenever a Real-Time Decision is created in response to a digital wallet * provisioning attempt. @@ -1148,6 +1161,11 @@ private constructor( * Occurs whenever a Real-Time Decision is created in response to a card authorization. */ REAL_TIME_DECISION_CARD_AUTHORIZATION_REQUESTED, + /** + * Occurs whenever a Real-Time Decision is created in response to a card balance + * inquiry. + */ + REAL_TIME_DECISION_CARD_BALANCE_INQUIRY_REQUESTED, /** * Occurs whenever a Real-Time Decision is created in response to a digital wallet * provisioning attempt. @@ -1292,6 +1310,8 @@ private constructor( Value.PROOF_OF_AUTHORIZATION_REQUEST_UPDATED REAL_TIME_DECISION_CARD_AUTHORIZATION_REQUESTED -> Value.REAL_TIME_DECISION_CARD_AUTHORIZATION_REQUESTED + REAL_TIME_DECISION_CARD_BALANCE_INQUIRY_REQUESTED -> + Value.REAL_TIME_DECISION_CARD_BALANCE_INQUIRY_REQUESTED REAL_TIME_DECISION_DIGITAL_WALLET_TOKEN_REQUESTED -> Value.REAL_TIME_DECISION_DIGITAL_WALLET_TOKEN_REQUESTED REAL_TIME_DECISION_DIGITAL_WALLET_AUTHENTICATION_REQUESTED -> @@ -1417,6 +1437,8 @@ private constructor( Known.PROOF_OF_AUTHORIZATION_REQUEST_UPDATED REAL_TIME_DECISION_CARD_AUTHORIZATION_REQUESTED -> Known.REAL_TIME_DECISION_CARD_AUTHORIZATION_REQUESTED + REAL_TIME_DECISION_CARD_BALANCE_INQUIRY_REQUESTED -> + Known.REAL_TIME_DECISION_CARD_BALANCE_INQUIRY_REQUESTED REAL_TIME_DECISION_DIGITAL_WALLET_TOKEN_REQUESTED -> Known.REAL_TIME_DECISION_DIGITAL_WALLET_TOKEN_REQUESTED REAL_TIME_DECISION_DIGITAL_WALLET_AUTHENTICATION_REQUESTED -> diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/events/EventListParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/events/EventListParams.kt index 4d602f1f4..ed44749e8 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/events/EventListParams.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/events/EventListParams.kt @@ -683,6 +683,14 @@ private constructor( val REAL_TIME_DECISION_CARD_AUTHORIZATION_REQUESTED = of("real_time_decision.card_authorization_requested") + /** + * Occurs whenever a Real-Time Decision is created in response to a card balance + * inquiry. + */ + @JvmField + val REAL_TIME_DECISION_CARD_BALANCE_INQUIRY_REQUESTED = + of("real_time_decision.card_balance_inquiry_requested") + /** * Occurs whenever a Real-Time Decision is created in response to a digital wallet * provisioning attempt. @@ -935,6 +943,11 @@ private constructor( * authorization. */ REAL_TIME_DECISION_CARD_AUTHORIZATION_REQUESTED, + /** + * Occurs whenever a Real-Time Decision is created in response to a card balance + * inquiry. + */ + REAL_TIME_DECISION_CARD_BALANCE_INQUIRY_REQUESTED, /** * Occurs whenever a Real-Time Decision is created in response to a digital wallet * provisioning attempt. @@ -1165,6 +1178,11 @@ private constructor( * authorization. */ REAL_TIME_DECISION_CARD_AUTHORIZATION_REQUESTED, + /** + * Occurs whenever a Real-Time Decision is created in response to a card balance + * inquiry. + */ + REAL_TIME_DECISION_CARD_BALANCE_INQUIRY_REQUESTED, /** * Occurs whenever a Real-Time Decision is created in response to a digital wallet * provisioning attempt. @@ -1311,6 +1329,8 @@ private constructor( Value.PROOF_OF_AUTHORIZATION_REQUEST_UPDATED REAL_TIME_DECISION_CARD_AUTHORIZATION_REQUESTED -> Value.REAL_TIME_DECISION_CARD_AUTHORIZATION_REQUESTED + REAL_TIME_DECISION_CARD_BALANCE_INQUIRY_REQUESTED -> + Value.REAL_TIME_DECISION_CARD_BALANCE_INQUIRY_REQUESTED REAL_TIME_DECISION_DIGITAL_WALLET_TOKEN_REQUESTED -> Value.REAL_TIME_DECISION_DIGITAL_WALLET_TOKEN_REQUESTED REAL_TIME_DECISION_DIGITAL_WALLET_AUTHENTICATION_REQUESTED -> @@ -1437,6 +1457,8 @@ private constructor( Known.PROOF_OF_AUTHORIZATION_REQUEST_UPDATED REAL_TIME_DECISION_CARD_AUTHORIZATION_REQUESTED -> Known.REAL_TIME_DECISION_CARD_AUTHORIZATION_REQUESTED + REAL_TIME_DECISION_CARD_BALANCE_INQUIRY_REQUESTED -> + Known.REAL_TIME_DECISION_CARD_BALANCE_INQUIRY_REQUESTED REAL_TIME_DECISION_DIGITAL_WALLET_TOKEN_REQUESTED -> Known.REAL_TIME_DECISION_DIGITAL_WALLET_TOKEN_REQUESTED REAL_TIME_DECISION_DIGITAL_WALLET_AUTHENTICATION_REQUESTED -> diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/eventsubscriptions/EventSubscription.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/eventsubscriptions/EventSubscription.kt index 9edcb1147..7bfa836a5 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/eventsubscriptions/EventSubscription.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/eventsubscriptions/EventSubscription.kt @@ -781,6 +781,14 @@ private constructor( val REAL_TIME_DECISION_CARD_AUTHORIZATION_REQUESTED = of("real_time_decision.card_authorization_requested") + /** + * Occurs whenever a Real-Time Decision is created in response to a card balance + * inquiry. + */ + @JvmField + val REAL_TIME_DECISION_CARD_BALANCE_INQUIRY_REQUESTED = + of("real_time_decision.card_balance_inquiry_requested") + /** * Occurs whenever a Real-Time Decision is created in response to a digital wallet * provisioning attempt. @@ -1031,6 +1039,11 @@ private constructor( * Occurs whenever a Real-Time Decision is created in response to a card authorization. */ REAL_TIME_DECISION_CARD_AUTHORIZATION_REQUESTED, + /** + * Occurs whenever a Real-Time Decision is created in response to a card balance + * inquiry. + */ + REAL_TIME_DECISION_CARD_BALANCE_INQUIRY_REQUESTED, /** * Occurs whenever a Real-Time Decision is created in response to a digital wallet * provisioning attempt. @@ -1260,6 +1273,11 @@ private constructor( * Occurs whenever a Real-Time Decision is created in response to a card authorization. */ REAL_TIME_DECISION_CARD_AUTHORIZATION_REQUESTED, + /** + * Occurs whenever a Real-Time Decision is created in response to a card balance + * inquiry. + */ + REAL_TIME_DECISION_CARD_BALANCE_INQUIRY_REQUESTED, /** * Occurs whenever a Real-Time Decision is created in response to a digital wallet * provisioning attempt. @@ -1407,6 +1425,8 @@ private constructor( Value.PROOF_OF_AUTHORIZATION_REQUEST_UPDATED REAL_TIME_DECISION_CARD_AUTHORIZATION_REQUESTED -> Value.REAL_TIME_DECISION_CARD_AUTHORIZATION_REQUESTED + REAL_TIME_DECISION_CARD_BALANCE_INQUIRY_REQUESTED -> + Value.REAL_TIME_DECISION_CARD_BALANCE_INQUIRY_REQUESTED REAL_TIME_DECISION_DIGITAL_WALLET_TOKEN_REQUESTED -> Value.REAL_TIME_DECISION_DIGITAL_WALLET_TOKEN_REQUESTED REAL_TIME_DECISION_DIGITAL_WALLET_AUTHENTICATION_REQUESTED -> @@ -1532,6 +1552,8 @@ private constructor( Known.PROOF_OF_AUTHORIZATION_REQUEST_UPDATED REAL_TIME_DECISION_CARD_AUTHORIZATION_REQUESTED -> Known.REAL_TIME_DECISION_CARD_AUTHORIZATION_REQUESTED + REAL_TIME_DECISION_CARD_BALANCE_INQUIRY_REQUESTED -> + Known.REAL_TIME_DECISION_CARD_BALANCE_INQUIRY_REQUESTED REAL_TIME_DECISION_DIGITAL_WALLET_TOKEN_REQUESTED -> Known.REAL_TIME_DECISION_DIGITAL_WALLET_TOKEN_REQUESTED REAL_TIME_DECISION_DIGITAL_WALLET_AUTHENTICATION_REQUESTED -> diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/eventsubscriptions/EventSubscriptionCreateParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/eventsubscriptions/EventSubscriptionCreateParams.kt index 90274b1c6..d8dae45c4 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/eventsubscriptions/EventSubscriptionCreateParams.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/eventsubscriptions/EventSubscriptionCreateParams.kt @@ -1031,6 +1031,14 @@ private constructor( val REAL_TIME_DECISION_CARD_AUTHORIZATION_REQUESTED = of("real_time_decision.card_authorization_requested") + /** + * Occurs whenever a Real-Time Decision is created in response to a card balance + * inquiry. + */ + @JvmField + val REAL_TIME_DECISION_CARD_BALANCE_INQUIRY_REQUESTED = + of("real_time_decision.card_balance_inquiry_requested") + /** * Occurs whenever a Real-Time Decision is created in response to a digital wallet * provisioning attempt. @@ -1281,6 +1289,11 @@ private constructor( * Occurs whenever a Real-Time Decision is created in response to a card authorization. */ REAL_TIME_DECISION_CARD_AUTHORIZATION_REQUESTED, + /** + * Occurs whenever a Real-Time Decision is created in response to a card balance + * inquiry. + */ + REAL_TIME_DECISION_CARD_BALANCE_INQUIRY_REQUESTED, /** * Occurs whenever a Real-Time Decision is created in response to a digital wallet * provisioning attempt. @@ -1510,6 +1523,11 @@ private constructor( * Occurs whenever a Real-Time Decision is created in response to a card authorization. */ REAL_TIME_DECISION_CARD_AUTHORIZATION_REQUESTED, + /** + * Occurs whenever a Real-Time Decision is created in response to a card balance + * inquiry. + */ + REAL_TIME_DECISION_CARD_BALANCE_INQUIRY_REQUESTED, /** * Occurs whenever a Real-Time Decision is created in response to a digital wallet * provisioning attempt. @@ -1657,6 +1675,8 @@ private constructor( Value.PROOF_OF_AUTHORIZATION_REQUEST_UPDATED REAL_TIME_DECISION_CARD_AUTHORIZATION_REQUESTED -> Value.REAL_TIME_DECISION_CARD_AUTHORIZATION_REQUESTED + REAL_TIME_DECISION_CARD_BALANCE_INQUIRY_REQUESTED -> + Value.REAL_TIME_DECISION_CARD_BALANCE_INQUIRY_REQUESTED REAL_TIME_DECISION_DIGITAL_WALLET_TOKEN_REQUESTED -> Value.REAL_TIME_DECISION_DIGITAL_WALLET_TOKEN_REQUESTED REAL_TIME_DECISION_DIGITAL_WALLET_AUTHENTICATION_REQUESTED -> @@ -1782,6 +1802,8 @@ private constructor( Known.PROOF_OF_AUTHORIZATION_REQUEST_UPDATED REAL_TIME_DECISION_CARD_AUTHORIZATION_REQUESTED -> Known.REAL_TIME_DECISION_CARD_AUTHORIZATION_REQUESTED + REAL_TIME_DECISION_CARD_BALANCE_INQUIRY_REQUESTED -> + Known.REAL_TIME_DECISION_CARD_BALANCE_INQUIRY_REQUESTED REAL_TIME_DECISION_DIGITAL_WALLET_TOKEN_REQUESTED -> Known.REAL_TIME_DECISION_DIGITAL_WALLET_TOKEN_REQUESTED REAL_TIME_DECISION_DIGITAL_WALLET_AUTHENTICATION_REQUESTED -> diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecision.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecision.kt index c45f8777b..299dbf545 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecision.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecision.kt @@ -31,6 +31,7 @@ private constructor( private val cardAuthentication: JsonField, private val cardAuthenticationChallenge: JsonField, private val cardAuthorization: JsonField, + private val cardBalanceInquiry: JsonField, private val category: JsonField, private val createdAt: JsonField, private val digitalWalletAuthentication: JsonField, @@ -53,6 +54,9 @@ private constructor( @JsonProperty("card_authorization") @ExcludeMissing cardAuthorization: JsonField = JsonMissing.of(), + @JsonProperty("card_balance_inquiry") + @ExcludeMissing + cardBalanceInquiry: JsonField = JsonMissing.of(), @JsonProperty("category") @ExcludeMissing category: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing @@ -73,6 +77,7 @@ private constructor( cardAuthentication, cardAuthenticationChallenge, cardAuthorization, + cardBalanceInquiry, category, createdAt, digitalWalletAuthentication, @@ -118,6 +123,15 @@ private constructor( fun cardAuthorization(): Optional = cardAuthorization.getOptional("card_authorization") + /** + * Fields related to a card balance inquiry. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun cardBalanceInquiry(): Optional = + cardBalanceInquiry.getOptional("card_balance_inquiry") + /** * The category of the Real-Time Decision. * @@ -217,6 +231,16 @@ private constructor( @ExcludeMissing fun _cardAuthorization(): JsonField = cardAuthorization + /** + * Returns the raw JSON value of [cardBalanceInquiry]. + * + * Unlike [cardBalanceInquiry], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("card_balance_inquiry") + @ExcludeMissing + fun _cardBalanceInquiry(): JsonField = cardBalanceInquiry + /** * Returns the raw JSON value of [category]. * @@ -300,6 +324,7 @@ private constructor( * .cardAuthentication() * .cardAuthenticationChallenge() * .cardAuthorization() + * .cardBalanceInquiry() * .category() * .createdAt() * .digitalWalletAuthentication() @@ -319,6 +344,7 @@ private constructor( private var cardAuthentication: JsonField? = null private var cardAuthenticationChallenge: JsonField? = null private var cardAuthorization: JsonField? = null + private var cardBalanceInquiry: JsonField? = null private var category: JsonField? = null private var createdAt: JsonField? = null private var digitalWalletAuthentication: JsonField? = null @@ -334,6 +360,7 @@ private constructor( cardAuthentication = realTimeDecision.cardAuthentication cardAuthenticationChallenge = realTimeDecision.cardAuthenticationChallenge cardAuthorization = realTimeDecision.cardAuthorization + cardBalanceInquiry = realTimeDecision.cardBalanceInquiry category = realTimeDecision.category createdAt = realTimeDecision.createdAt digitalWalletAuthentication = realTimeDecision.digitalWalletAuthentication @@ -418,6 +445,27 @@ private constructor( this.cardAuthorization = cardAuthorization } + /** Fields related to a card balance inquiry. */ + fun cardBalanceInquiry(cardBalanceInquiry: CardBalanceInquiry?) = + cardBalanceInquiry(JsonField.ofNullable(cardBalanceInquiry)) + + /** + * Alias for calling [Builder.cardBalanceInquiry] with `cardBalanceInquiry.orElse(null)`. + */ + fun cardBalanceInquiry(cardBalanceInquiry: Optional) = + cardBalanceInquiry(cardBalanceInquiry.getOrNull()) + + /** + * Sets [Builder.cardBalanceInquiry] to an arbitrary JSON value. + * + * You should usually call [Builder.cardBalanceInquiry] with a well-typed + * [CardBalanceInquiry] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun cardBalanceInquiry(cardBalanceInquiry: JsonField) = apply { + this.cardBalanceInquiry = cardBalanceInquiry + } + /** The category of the Real-Time Decision. */ fun category(category: Category) = category(JsonField.of(category)) @@ -559,6 +607,7 @@ private constructor( * .cardAuthentication() * .cardAuthenticationChallenge() * .cardAuthorization() + * .cardBalanceInquiry() * .category() * .createdAt() * .digitalWalletAuthentication() @@ -576,6 +625,7 @@ private constructor( checkRequired("cardAuthentication", cardAuthentication), checkRequired("cardAuthenticationChallenge", cardAuthenticationChallenge), checkRequired("cardAuthorization", cardAuthorization), + checkRequired("cardBalanceInquiry", cardBalanceInquiry), checkRequired("category", category), checkRequired("createdAt", createdAt), checkRequired("digitalWalletAuthentication", digitalWalletAuthentication), @@ -598,6 +648,7 @@ private constructor( cardAuthentication().ifPresent { it.validate() } cardAuthenticationChallenge().ifPresent { it.validate() } cardAuthorization().ifPresent { it.validate() } + cardBalanceInquiry().ifPresent { it.validate() } category().validate() createdAt() digitalWalletAuthentication().ifPresent { it.validate() } @@ -627,6 +678,7 @@ private constructor( (cardAuthentication.asKnown().getOrNull()?.validity() ?: 0) + (cardAuthenticationChallenge.asKnown().getOrNull()?.validity() ?: 0) + (cardAuthorization.asKnown().getOrNull()?.validity() ?: 0) + + (cardBalanceInquiry.asKnown().getOrNull()?.validity() ?: 0) + (category.asKnown().getOrNull()?.validity() ?: 0) + (if (createdAt.asKnown().isPresent) 1 else 0) + (digitalWalletAuthentication.asKnown().getOrNull()?.validity() ?: 0) + @@ -11241,23 +11293,7503 @@ private constructor( "CardAuthorization{accountId=$accountId, additionalAmounts=$additionalAmounts, approval=$approval, cardId=$cardId, decision=$decision, decline=$decline, digitalWalletTokenId=$digitalWalletTokenId, direction=$direction, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkDetails=$networkDetails, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, partialApprovalCapability=$partialApprovalCapability, physicalCardId=$physicalCardId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, processingCategory=$processingCategory, requestDetails=$requestDetails, settlementAmount=$settlementAmount, settlementCurrency=$settlementCurrency, terminalId=$terminalId, upcomingCardPaymentId=$upcomingCardPaymentId, verification=$verification, additionalProperties=$additionalProperties}" } - /** The category of the Real-Time Decision. */ - class Category @JsonCreator private constructor(private val value: JsonField) : Enum { + /** Fields related to a card balance inquiry. */ + class CardBalanceInquiry + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val accountId: JsonField, + private val additionalAmounts: JsonField, + private val approval: JsonField, + private val cardId: JsonField, + private val decision: JsonField, + private val digitalWalletTokenId: JsonField, + private val merchantAcceptorId: JsonField, + private val merchantCategoryCode: JsonField, + private val merchantCity: JsonField, + private val merchantCountry: JsonField, + private val merchantDescriptor: JsonField, + private val merchantPostalCode: JsonField, + private val merchantState: JsonField, + private val networkDetails: JsonField, + private val networkIdentifiers: JsonField, + private val networkRiskScore: JsonField, + private val physicalCardId: JsonField, + private val terminalId: JsonField, + private val upcomingCardPaymentId: JsonField, + private val verification: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("account_id") + @ExcludeMissing + accountId: JsonField = JsonMissing.of(), + @JsonProperty("additional_amounts") + @ExcludeMissing + additionalAmounts: JsonField = JsonMissing.of(), + @JsonProperty("approval") + @ExcludeMissing + approval: JsonField = JsonMissing.of(), + @JsonProperty("card_id") @ExcludeMissing cardId: JsonField = JsonMissing.of(), + @JsonProperty("decision") + @ExcludeMissing + decision: JsonField = JsonMissing.of(), + @JsonProperty("digital_wallet_token_id") + @ExcludeMissing + digitalWalletTokenId: JsonField = JsonMissing.of(), + @JsonProperty("merchant_acceptor_id") + @ExcludeMissing + merchantAcceptorId: JsonField = JsonMissing.of(), + @JsonProperty("merchant_category_code") + @ExcludeMissing + merchantCategoryCode: JsonField = JsonMissing.of(), + @JsonProperty("merchant_city") + @ExcludeMissing + merchantCity: JsonField = JsonMissing.of(), + @JsonProperty("merchant_country") + @ExcludeMissing + merchantCountry: JsonField = JsonMissing.of(), + @JsonProperty("merchant_descriptor") + @ExcludeMissing + merchantDescriptor: JsonField = JsonMissing.of(), + @JsonProperty("merchant_postal_code") + @ExcludeMissing + merchantPostalCode: JsonField = JsonMissing.of(), + @JsonProperty("merchant_state") + @ExcludeMissing + merchantState: JsonField = JsonMissing.of(), + @JsonProperty("network_details") + @ExcludeMissing + networkDetails: JsonField = JsonMissing.of(), + @JsonProperty("network_identifiers") + @ExcludeMissing + networkIdentifiers: JsonField = JsonMissing.of(), + @JsonProperty("network_risk_score") + @ExcludeMissing + networkRiskScore: JsonField = JsonMissing.of(), + @JsonProperty("physical_card_id") + @ExcludeMissing + physicalCardId: JsonField = JsonMissing.of(), + @JsonProperty("terminal_id") + @ExcludeMissing + terminalId: JsonField = JsonMissing.of(), + @JsonProperty("upcoming_card_payment_id") + @ExcludeMissing + upcomingCardPaymentId: JsonField = JsonMissing.of(), + @JsonProperty("verification") + @ExcludeMissing + verification: JsonField = JsonMissing.of(), + ) : this( + accountId, + additionalAmounts, + approval, + cardId, + decision, + digitalWalletTokenId, + merchantAcceptorId, + merchantCategoryCode, + merchantCity, + merchantCountry, + merchantDescriptor, + merchantPostalCode, + merchantState, + networkDetails, + networkIdentifiers, + networkRiskScore, + physicalCardId, + terminalId, + upcomingCardPaymentId, + verification, + mutableMapOf(), + ) /** - * Returns this class instance's raw value. + * The identifier of the Account the authorization will debit. * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + fun accountId(): String = accountId.getRequired("account_id") - companion object { + /** + * Additional amounts associated with the card authorization, such as ATM surcharges fees. + * These are usually a subset of the `amount` field and are used to provide more detailed + * information about the transaction. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun additionalAmounts(): AdditionalAmounts = + additionalAmounts.getRequired("additional_amounts") - /** A card is being authorized. */ - @JvmField val CARD_AUTHORIZATION_REQUESTED = of("card_authorization_requested") + /** + * Present if and only if `decision` is `approve`. Contains information related to the + * approval of the balance inquiry. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun approval(): Optional = approval.getOptional("approval") + + /** + * The identifier of the Card that is being authorized. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun cardId(): String = cardId.getRequired("card_id") + + /** + * Whether or not the authorization was approved. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun decision(): Optional = decision.getOptional("decision") + + /** + * If the authorization was made via a Digital Wallet Token (such as an Apple Pay purchase), + * the identifier of the token that was used. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun digitalWalletTokenId(): Optional = + digitalWalletTokenId.getOptional("digital_wallet_token_id") + + /** + * The merchant identifier (commonly abbreviated as MID) of the merchant the card is + * transacting with. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun merchantAcceptorId(): String = merchantAcceptorId.getRequired("merchant_acceptor_id") + + /** + * The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card is + * transacting with. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun merchantCategoryCode(): String = + merchantCategoryCode.getRequired("merchant_category_code") + + /** + * The city the merchant resides in. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun merchantCity(): Optional = merchantCity.getOptional("merchant_city") + + /** + * The country the merchant resides in. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun merchantCountry(): String = merchantCountry.getRequired("merchant_country") + + /** + * The merchant descriptor of the merchant the card is transacting with. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun merchantDescriptor(): String = merchantDescriptor.getRequired("merchant_descriptor") + + /** + * The merchant's postal code. For US merchants this is either a 5-digit or 9-digit ZIP + * code, where the first 5 and last 4 are separated by a dash. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun merchantPostalCode(): Optional = + merchantPostalCode.getOptional("merchant_postal_code") + + /** + * The state the merchant resides in. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun merchantState(): Optional = merchantState.getOptional("merchant_state") + + /** + * Fields specific to the `network`. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun networkDetails(): NetworkDetails = networkDetails.getRequired("network_details") + + /** + * Network-specific identifiers for a specific request or transaction. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun networkIdentifiers(): NetworkIdentifiers = + networkIdentifiers.getRequired("network_identifiers") + + /** + * The risk score generated by the card network. For Visa this is the Visa Advanced + * Authorization risk score, from 0 to 99, where 99 is the riskiest. For Pulse the score is + * from 0 to 999, where 999 is the riskiest. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun networkRiskScore(): Optional = networkRiskScore.getOptional("network_risk_score") + + /** + * If the authorization was made in-person with a physical card, the Physical Card that was + * used. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun physicalCardId(): Optional = physicalCardId.getOptional("physical_card_id") + + /** + * The 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 Card Payment this authorization will belong to. Available in the + * API once the card authorization has completed. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun upcomingCardPaymentId(): String = + upcomingCardPaymentId.getRequired("upcoming_card_payment_id") + + /** + * 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 [accountId]. + * + * Unlike [accountId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("account_id") @ExcludeMissing fun _accountId(): JsonField = accountId + + /** + * Returns the raw JSON value of [additionalAmounts]. + * + * Unlike [additionalAmounts], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("additional_amounts") + @ExcludeMissing + fun _additionalAmounts(): JsonField = additionalAmounts + + /** + * Returns the raw JSON value of [approval]. + * + * Unlike [approval], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("approval") @ExcludeMissing fun _approval(): JsonField = approval + + /** + * Returns the raw JSON value of [cardId]. + * + * Unlike [cardId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("card_id") @ExcludeMissing fun _cardId(): JsonField = cardId + + /** + * Returns the raw JSON value of [decision]. + * + * Unlike [decision], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("decision") @ExcludeMissing fun _decision(): JsonField = decision + + /** + * Returns the raw JSON value of [digitalWalletTokenId]. + * + * Unlike [digitalWalletTokenId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("digital_wallet_token_id") + @ExcludeMissing + fun _digitalWalletTokenId(): JsonField = digitalWalletTokenId + + /** + * Returns the raw JSON value of [merchantAcceptorId]. + * + * Unlike [merchantAcceptorId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("merchant_acceptor_id") + @ExcludeMissing + fun _merchantAcceptorId(): JsonField = merchantAcceptorId + + /** + * Returns the raw JSON value of [merchantCategoryCode]. + * + * Unlike [merchantCategoryCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("merchant_category_code") + @ExcludeMissing + fun _merchantCategoryCode(): JsonField = merchantCategoryCode + + /** + * Returns the raw JSON value of [merchantCity]. + * + * Unlike [merchantCity], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("merchant_city") + @ExcludeMissing + fun _merchantCity(): JsonField = merchantCity + + /** + * Returns the raw JSON value of [merchantCountry]. + * + * Unlike [merchantCountry], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("merchant_country") + @ExcludeMissing + fun _merchantCountry(): JsonField = merchantCountry + + /** + * Returns the raw JSON value of [merchantDescriptor]. + * + * Unlike [merchantDescriptor], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("merchant_descriptor") + @ExcludeMissing + fun _merchantDescriptor(): JsonField = merchantDescriptor + + /** + * Returns the raw JSON value of [merchantPostalCode]. + * + * Unlike [merchantPostalCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("merchant_postal_code") + @ExcludeMissing + fun _merchantPostalCode(): JsonField = merchantPostalCode + + /** + * Returns the raw JSON value of [merchantState]. + * + * Unlike [merchantState], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("merchant_state") + @ExcludeMissing + fun _merchantState(): JsonField = merchantState + + /** + * Returns the raw JSON value of [networkDetails]. + * + * Unlike [networkDetails], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("network_details") + @ExcludeMissing + fun _networkDetails(): JsonField = networkDetails + + /** + * Returns the raw JSON value of [networkIdentifiers]. + * + * Unlike [networkIdentifiers], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("network_identifiers") + @ExcludeMissing + fun _networkIdentifiers(): JsonField = networkIdentifiers + + /** + * Returns the raw JSON value of [networkRiskScore]. + * + * Unlike [networkRiskScore], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("network_risk_score") + @ExcludeMissing + fun _networkRiskScore(): JsonField = networkRiskScore + + /** + * Returns the raw JSON value of [physicalCardId]. + * + * Unlike [physicalCardId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("physical_card_id") + @ExcludeMissing + fun _physicalCardId(): JsonField = physicalCardId + + /** + * Returns the raw JSON value of [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 [upcomingCardPaymentId]. + * + * Unlike [upcomingCardPaymentId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("upcoming_card_payment_id") + @ExcludeMissing + fun _upcomingCardPaymentId(): JsonField = upcomingCardPaymentId + + /** + * Returns the raw JSON value of [verification]. + * + * Unlike [verification], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("verification") + @ExcludeMissing + fun _verification(): JsonField = verification + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [CardBalanceInquiry]. + * + * The following fields are required: + * ```java + * .accountId() + * .additionalAmounts() + * .approval() + * .cardId() + * .decision() + * .digitalWalletTokenId() + * .merchantAcceptorId() + * .merchantCategoryCode() + * .merchantCity() + * .merchantCountry() + * .merchantDescriptor() + * .merchantPostalCode() + * .merchantState() + * .networkDetails() + * .networkIdentifiers() + * .networkRiskScore() + * .physicalCardId() + * .terminalId() + * .upcomingCardPaymentId() + * .verification() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [CardBalanceInquiry]. */ + class Builder internal constructor() { + + private var accountId: JsonField? = null + private var additionalAmounts: JsonField? = null + private var approval: JsonField? = null + private var cardId: JsonField? = null + private var decision: JsonField? = null + private var digitalWalletTokenId: JsonField? = null + private var merchantAcceptorId: JsonField? = null + private var merchantCategoryCode: JsonField? = null + private var merchantCity: JsonField? = null + private var merchantCountry: JsonField? = null + private var merchantDescriptor: JsonField? = null + private var merchantPostalCode: JsonField? = null + private var merchantState: JsonField? = null + private var networkDetails: JsonField? = null + private var networkIdentifiers: JsonField? = null + private var networkRiskScore: JsonField? = null + private var physicalCardId: JsonField? = null + private var terminalId: JsonField? = null + private var upcomingCardPaymentId: JsonField? = null + private var verification: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(cardBalanceInquiry: CardBalanceInquiry) = apply { + accountId = cardBalanceInquiry.accountId + additionalAmounts = cardBalanceInquiry.additionalAmounts + approval = cardBalanceInquiry.approval + cardId = cardBalanceInquiry.cardId + decision = cardBalanceInquiry.decision + digitalWalletTokenId = cardBalanceInquiry.digitalWalletTokenId + merchantAcceptorId = cardBalanceInquiry.merchantAcceptorId + merchantCategoryCode = cardBalanceInquiry.merchantCategoryCode + merchantCity = cardBalanceInquiry.merchantCity + merchantCountry = cardBalanceInquiry.merchantCountry + merchantDescriptor = cardBalanceInquiry.merchantDescriptor + merchantPostalCode = cardBalanceInquiry.merchantPostalCode + merchantState = cardBalanceInquiry.merchantState + networkDetails = cardBalanceInquiry.networkDetails + networkIdentifiers = cardBalanceInquiry.networkIdentifiers + networkRiskScore = cardBalanceInquiry.networkRiskScore + physicalCardId = cardBalanceInquiry.physicalCardId + terminalId = cardBalanceInquiry.terminalId + upcomingCardPaymentId = cardBalanceInquiry.upcomingCardPaymentId + verification = cardBalanceInquiry.verification + additionalProperties = cardBalanceInquiry.additionalProperties.toMutableMap() + } + + /** The identifier of the Account the authorization will debit. */ + fun accountId(accountId: String) = accountId(JsonField.of(accountId)) + + /** + * Sets [Builder.accountId] to an arbitrary JSON value. + * + * You should usually call [Builder.accountId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun accountId(accountId: JsonField) = apply { this.accountId = accountId } + + /** + * Additional amounts associated with the card authorization, such as ATM surcharges + * fees. These are usually a subset of the `amount` field and are used to provide more + * detailed information about the transaction. + */ + fun additionalAmounts(additionalAmounts: AdditionalAmounts) = + additionalAmounts(JsonField.of(additionalAmounts)) + + /** + * Sets [Builder.additionalAmounts] to an arbitrary JSON value. + * + * You should usually call [Builder.additionalAmounts] with a well-typed + * [AdditionalAmounts] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun additionalAmounts(additionalAmounts: JsonField) = apply { + this.additionalAmounts = additionalAmounts + } + + /** + * Present if and only if `decision` is `approve`. Contains information related to the + * approval of the balance inquiry. + */ + fun approval(approval: Approval?) = approval(JsonField.ofNullable(approval)) + + /** Alias for calling [Builder.approval] with `approval.orElse(null)`. */ + fun approval(approval: Optional) = approval(approval.getOrNull()) + + /** + * Sets [Builder.approval] to an arbitrary JSON value. + * + * You should usually call [Builder.approval] with a well-typed [Approval] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun approval(approval: JsonField) = apply { this.approval = approval } + + /** The identifier of the Card that is being authorized. */ + fun cardId(cardId: String) = cardId(JsonField.of(cardId)) + + /** + * Sets [Builder.cardId] to an arbitrary JSON value. + * + * You should usually call [Builder.cardId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun cardId(cardId: JsonField) = apply { this.cardId = cardId } + + /** Whether or not the authorization was approved. */ + fun decision(decision: Decision?) = decision(JsonField.ofNullable(decision)) + + /** Alias for calling [Builder.decision] with `decision.orElse(null)`. */ + fun decision(decision: Optional) = decision(decision.getOrNull()) + + /** + * Sets [Builder.decision] to an arbitrary JSON value. + * + * You should usually call [Builder.decision] with a well-typed [Decision] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun decision(decision: JsonField) = apply { this.decision = decision } + + /** + * If the authorization was made via a Digital Wallet Token (such as an Apple Pay + * purchase), the identifier of the token that was used. + */ + fun digitalWalletTokenId(digitalWalletTokenId: String?) = + digitalWalletTokenId(JsonField.ofNullable(digitalWalletTokenId)) + + /** + * Alias for calling [Builder.digitalWalletTokenId] with + * `digitalWalletTokenId.orElse(null)`. + */ + fun digitalWalletTokenId(digitalWalletTokenId: Optional) = + digitalWalletTokenId(digitalWalletTokenId.getOrNull()) + + /** + * Sets [Builder.digitalWalletTokenId] to an arbitrary JSON value. + * + * You should usually call [Builder.digitalWalletTokenId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun digitalWalletTokenId(digitalWalletTokenId: JsonField) = apply { + this.digitalWalletTokenId = digitalWalletTokenId + } + + /** + * The merchant identifier (commonly abbreviated as MID) of the merchant the card is + * transacting with. + */ + fun merchantAcceptorId(merchantAcceptorId: String) = + merchantAcceptorId(JsonField.of(merchantAcceptorId)) + + /** + * Sets [Builder.merchantAcceptorId] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantAcceptorId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun merchantAcceptorId(merchantAcceptorId: JsonField) = apply { + this.merchantAcceptorId = merchantAcceptorId + } + + /** + * The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card is + * transacting with. + */ + fun merchantCategoryCode(merchantCategoryCode: String) = + merchantCategoryCode(JsonField.of(merchantCategoryCode)) + + /** + * Sets [Builder.merchantCategoryCode] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantCategoryCode] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun merchantCategoryCode(merchantCategoryCode: JsonField) = apply { + this.merchantCategoryCode = merchantCategoryCode + } + + /** The city the merchant resides in. */ + fun merchantCity(merchantCity: String?) = + merchantCity(JsonField.ofNullable(merchantCity)) + + /** Alias for calling [Builder.merchantCity] with `merchantCity.orElse(null)`. */ + fun merchantCity(merchantCity: Optional) = + merchantCity(merchantCity.getOrNull()) + + /** + * Sets [Builder.merchantCity] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantCity] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun merchantCity(merchantCity: JsonField) = apply { + this.merchantCity = merchantCity + } + + /** The country the merchant resides in. */ + fun merchantCountry(merchantCountry: String) = + merchantCountry(JsonField.of(merchantCountry)) + + /** + * Sets [Builder.merchantCountry] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantCountry] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun merchantCountry(merchantCountry: JsonField) = apply { + this.merchantCountry = merchantCountry + } + + /** The merchant descriptor of the merchant the card is transacting with. */ + fun merchantDescriptor(merchantDescriptor: String) = + merchantDescriptor(JsonField.of(merchantDescriptor)) + + /** + * Sets [Builder.merchantDescriptor] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantDescriptor] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun merchantDescriptor(merchantDescriptor: JsonField) = apply { + this.merchantDescriptor = merchantDescriptor + } + + /** + * The merchant's postal code. For US merchants this is either a 5-digit or 9-digit ZIP + * code, where the first 5 and last 4 are separated by a dash. + */ + fun merchantPostalCode(merchantPostalCode: String?) = + merchantPostalCode(JsonField.ofNullable(merchantPostalCode)) + + /** + * Alias for calling [Builder.merchantPostalCode] with + * `merchantPostalCode.orElse(null)`. + */ + fun merchantPostalCode(merchantPostalCode: Optional) = + merchantPostalCode(merchantPostalCode.getOrNull()) + + /** + * Sets [Builder.merchantPostalCode] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantPostalCode] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun merchantPostalCode(merchantPostalCode: JsonField) = apply { + this.merchantPostalCode = merchantPostalCode + } + + /** The state the merchant resides in. */ + fun merchantState(merchantState: String?) = + merchantState(JsonField.ofNullable(merchantState)) + + /** Alias for calling [Builder.merchantState] with `merchantState.orElse(null)`. */ + fun merchantState(merchantState: Optional) = + merchantState(merchantState.getOrNull()) + + /** + * Sets [Builder.merchantState] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantState] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun merchantState(merchantState: JsonField) = apply { + this.merchantState = merchantState + } + + /** Fields specific to the `network`. */ + fun networkDetails(networkDetails: NetworkDetails) = + networkDetails(JsonField.of(networkDetails)) + + /** + * Sets [Builder.networkDetails] to an arbitrary JSON value. + * + * You should usually call [Builder.networkDetails] with a well-typed [NetworkDetails] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun networkDetails(networkDetails: JsonField) = apply { + this.networkDetails = networkDetails + } + + /** Network-specific identifiers for a specific request or transaction. */ + fun networkIdentifiers(networkIdentifiers: NetworkIdentifiers) = + networkIdentifiers(JsonField.of(networkIdentifiers)) + + /** + * Sets [Builder.networkIdentifiers] to an arbitrary JSON value. + * + * You should usually call [Builder.networkIdentifiers] with a well-typed + * [NetworkIdentifiers] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun networkIdentifiers(networkIdentifiers: JsonField) = apply { + this.networkIdentifiers = networkIdentifiers + } + + /** + * The risk score generated by the card network. For Visa this is the Visa Advanced + * Authorization risk score, from 0 to 99, where 99 is the riskiest. For Pulse the score + * is from 0 to 999, where 999 is the riskiest. + */ + fun networkRiskScore(networkRiskScore: Long?) = + networkRiskScore(JsonField.ofNullable(networkRiskScore)) + + /** + * Alias for [Builder.networkRiskScore]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun networkRiskScore(networkRiskScore: Long) = + networkRiskScore(networkRiskScore as Long?) + + /** + * Alias for calling [Builder.networkRiskScore] with `networkRiskScore.orElse(null)`. + */ + fun networkRiskScore(networkRiskScore: Optional) = + networkRiskScore(networkRiskScore.getOrNull()) + + /** + * Sets [Builder.networkRiskScore] to an arbitrary JSON value. + * + * You should usually call [Builder.networkRiskScore] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun networkRiskScore(networkRiskScore: JsonField) = apply { + this.networkRiskScore = networkRiskScore + } + + /** + * If the authorization was made in-person with a physical card, the Physical Card that + * was used. + */ + fun physicalCardId(physicalCardId: String?) = + physicalCardId(JsonField.ofNullable(physicalCardId)) + + /** Alias for calling [Builder.physicalCardId] with `physicalCardId.orElse(null)`. */ + fun physicalCardId(physicalCardId: Optional) = + physicalCardId(physicalCardId.getOrNull()) + + /** + * Sets [Builder.physicalCardId] to an arbitrary JSON value. + * + * You should usually call [Builder.physicalCardId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun physicalCardId(physicalCardId: JsonField) = apply { + this.physicalCardId = physicalCardId + } + + /** + * The 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 Card Payment this authorization will belong to. Available in + * the API once the card authorization has completed. + */ + fun upcomingCardPaymentId(upcomingCardPaymentId: String) = + upcomingCardPaymentId(JsonField.of(upcomingCardPaymentId)) + + /** + * Sets [Builder.upcomingCardPaymentId] to an arbitrary JSON value. + * + * You should usually call [Builder.upcomingCardPaymentId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun upcomingCardPaymentId(upcomingCardPaymentId: JsonField) = apply { + this.upcomingCardPaymentId = upcomingCardPaymentId + } + + /** Fields related to verification of cardholder-provided values. */ + fun verification(verification: Verification) = verification(JsonField.of(verification)) + + /** + * Sets [Builder.verification] to an arbitrary JSON value. + * + * You should usually call [Builder.verification] with a well-typed [Verification] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun verification(verification: JsonField) = apply { + this.verification = verification + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [CardBalanceInquiry]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .accountId() + * .additionalAmounts() + * .approval() + * .cardId() + * .decision() + * .digitalWalletTokenId() + * .merchantAcceptorId() + * .merchantCategoryCode() + * .merchantCity() + * .merchantCountry() + * .merchantDescriptor() + * .merchantPostalCode() + * .merchantState() + * .networkDetails() + * .networkIdentifiers() + * .networkRiskScore() + * .physicalCardId() + * .terminalId() + * .upcomingCardPaymentId() + * .verification() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CardBalanceInquiry = + CardBalanceInquiry( + checkRequired("accountId", accountId), + checkRequired("additionalAmounts", additionalAmounts), + checkRequired("approval", approval), + checkRequired("cardId", cardId), + checkRequired("decision", decision), + checkRequired("digitalWalletTokenId", digitalWalletTokenId), + checkRequired("merchantAcceptorId", merchantAcceptorId), + checkRequired("merchantCategoryCode", merchantCategoryCode), + checkRequired("merchantCity", merchantCity), + checkRequired("merchantCountry", merchantCountry), + checkRequired("merchantDescriptor", merchantDescriptor), + checkRequired("merchantPostalCode", merchantPostalCode), + checkRequired("merchantState", merchantState), + checkRequired("networkDetails", networkDetails), + checkRequired("networkIdentifiers", networkIdentifiers), + checkRequired("networkRiskScore", networkRiskScore), + checkRequired("physicalCardId", physicalCardId), + checkRequired("terminalId", terminalId), + checkRequired("upcomingCardPaymentId", upcomingCardPaymentId), + checkRequired("verification", verification), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): CardBalanceInquiry = apply { + if (validated) { + return@apply + } + + accountId() + additionalAmounts().validate() + approval().ifPresent { it.validate() } + cardId() + decision().ifPresent { it.validate() } + digitalWalletTokenId() + merchantAcceptorId() + merchantCategoryCode() + merchantCity() + merchantCountry() + merchantDescriptor() + merchantPostalCode() + merchantState() + networkDetails().validate() + networkIdentifiers().validate() + networkRiskScore() + physicalCardId() + terminalId() + upcomingCardPaymentId() + 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 (accountId.asKnown().isPresent) 1 else 0) + + (additionalAmounts.asKnown().getOrNull()?.validity() ?: 0) + + (approval.asKnown().getOrNull()?.validity() ?: 0) + + (if (cardId.asKnown().isPresent) 1 else 0) + + (decision.asKnown().getOrNull()?.validity() ?: 0) + + (if (digitalWalletTokenId.asKnown().isPresent) 1 else 0) + + (if (merchantAcceptorId.asKnown().isPresent) 1 else 0) + + (if (merchantCategoryCode.asKnown().isPresent) 1 else 0) + + (if (merchantCity.asKnown().isPresent) 1 else 0) + + (if (merchantCountry.asKnown().isPresent) 1 else 0) + + (if (merchantDescriptor.asKnown().isPresent) 1 else 0) + + (if (merchantPostalCode.asKnown().isPresent) 1 else 0) + + (if (merchantState.asKnown().isPresent) 1 else 0) + + (networkDetails.asKnown().getOrNull()?.validity() ?: 0) + + (networkIdentifiers.asKnown().getOrNull()?.validity() ?: 0) + + (if (networkRiskScore.asKnown().isPresent) 1 else 0) + + (if (physicalCardId.asKnown().isPresent) 1 else 0) + + (if (terminalId.asKnown().isPresent) 1 else 0) + + (if (upcomingCardPaymentId.asKnown().isPresent) 1 else 0) + + (verification.asKnown().getOrNull()?.validity() ?: 0) + + /** + * Additional amounts associated with the card authorization, such as ATM surcharges fees. + * These are usually a subset of the `amount` field and are used to provide more detailed + * information about the transaction. + */ + class AdditionalAmounts + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val clinic: JsonField, + private val dental: JsonField, + private val original: JsonField, + private val prescription: JsonField, + private val surcharge: JsonField, + private val totalCumulative: JsonField, + private val totalHealthcare: JsonField, + private val transit: JsonField, + private val unknown: JsonField, + private val vision: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("clinic") + @ExcludeMissing + clinic: JsonField = JsonMissing.of(), + @JsonProperty("dental") + @ExcludeMissing + dental: JsonField = JsonMissing.of(), + @JsonProperty("original") + @ExcludeMissing + original: JsonField = JsonMissing.of(), + @JsonProperty("prescription") + @ExcludeMissing + prescription: JsonField = JsonMissing.of(), + @JsonProperty("surcharge") + @ExcludeMissing + surcharge: JsonField = JsonMissing.of(), + @JsonProperty("total_cumulative") + @ExcludeMissing + totalCumulative: JsonField = JsonMissing.of(), + @JsonProperty("total_healthcare") + @ExcludeMissing + totalHealthcare: JsonField = JsonMissing.of(), + @JsonProperty("transit") + @ExcludeMissing + transit: JsonField = JsonMissing.of(), + @JsonProperty("unknown") + @ExcludeMissing + unknown: JsonField = JsonMissing.of(), + @JsonProperty("vision") @ExcludeMissing vision: JsonField = JsonMissing.of(), + ) : this( + clinic, + dental, + original, + prescription, + surcharge, + totalCumulative, + totalHealthcare, + transit, + unknown, + vision, + mutableMapOf(), + ) + + /** + * The part of this transaction amount that was for clinic-related services. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun clinic(): Optional = clinic.getOptional("clinic") + + /** + * The part of this transaction amount that was for dental-related services. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun dental(): Optional = dental.getOptional("dental") + + /** + * The original pre-authorized amount. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun original(): Optional = original.getOptional("original") + + /** + * The part of this transaction amount that was for healthcare prescriptions. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun prescription(): Optional = prescription.getOptional("prescription") + + /** + * The surcharge amount charged for this transaction by the merchant. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun surcharge(): Optional = surcharge.getOptional("surcharge") + + /** + * The total amount of a series of incremental authorizations, optionally provided. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun totalCumulative(): Optional = + totalCumulative.getOptional("total_cumulative") + + /** + * The total amount of healthcare-related additional amounts. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun totalHealthcare(): Optional = + totalHealthcare.getOptional("total_healthcare") + + /** + * The part of this transaction amount that was for transit-related services. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun transit(): Optional = transit.getOptional("transit") + + /** + * An unknown additional amount. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun unknown(): Optional = unknown.getOptional("unknown") + + /** + * The part of this transaction amount that was for vision-related services. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun vision(): Optional = vision.getOptional("vision") + + /** + * Returns the raw JSON value of [clinic]. + * + * Unlike [clinic], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("clinic") @ExcludeMissing fun _clinic(): JsonField = clinic + + /** + * Returns the raw JSON value of [dental]. + * + * Unlike [dental], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dental") @ExcludeMissing fun _dental(): JsonField = dental + + /** + * Returns the raw JSON value of [original]. + * + * Unlike [original], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("original") + @ExcludeMissing + fun _original(): JsonField = original + + /** + * Returns the raw JSON value of [prescription]. + * + * Unlike [prescription], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("prescription") + @ExcludeMissing + fun _prescription(): JsonField = prescription + + /** + * Returns the raw JSON value of [surcharge]. + * + * Unlike [surcharge], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("surcharge") + @ExcludeMissing + fun _surcharge(): JsonField = surcharge + + /** + * Returns the raw JSON value of [totalCumulative]. + * + * Unlike [totalCumulative], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("total_cumulative") + @ExcludeMissing + fun _totalCumulative(): JsonField = totalCumulative + + /** + * Returns the raw JSON value of [totalHealthcare]. + * + * Unlike [totalHealthcare], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("total_healthcare") + @ExcludeMissing + fun _totalHealthcare(): JsonField = totalHealthcare + + /** + * Returns the raw JSON value of [transit]. + * + * Unlike [transit], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("transit") @ExcludeMissing fun _transit(): JsonField = transit + + /** + * Returns the raw JSON value of [unknown]. + * + * Unlike [unknown], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("unknown") @ExcludeMissing fun _unknown(): JsonField = unknown + + /** + * Returns the raw JSON value of [vision]. + * + * Unlike [vision], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("vision") @ExcludeMissing fun _vision(): JsonField = vision + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [AdditionalAmounts]. + * + * The following fields are required: + * ```java + * .clinic() + * .dental() + * .original() + * .prescription() + * .surcharge() + * .totalCumulative() + * .totalHealthcare() + * .transit() + * .unknown() + * .vision() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AdditionalAmounts]. */ + class Builder internal constructor() { + + private var clinic: JsonField? = null + private var dental: JsonField? = null + private var original: JsonField? = null + private var prescription: JsonField? = null + private var surcharge: JsonField? = null + private var totalCumulative: JsonField? = null + private var totalHealthcare: JsonField? = null + private var transit: JsonField? = null + private var unknown: JsonField? = null + private var vision: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(additionalAmounts: AdditionalAmounts) = apply { + clinic = additionalAmounts.clinic + dental = additionalAmounts.dental + original = additionalAmounts.original + prescription = additionalAmounts.prescription + surcharge = additionalAmounts.surcharge + totalCumulative = additionalAmounts.totalCumulative + totalHealthcare = additionalAmounts.totalHealthcare + transit = additionalAmounts.transit + unknown = additionalAmounts.unknown + vision = additionalAmounts.vision + additionalProperties = additionalAmounts.additionalProperties.toMutableMap() + } + + /** The part of this transaction amount that was for clinic-related services. */ + fun clinic(clinic: Clinic?) = clinic(JsonField.ofNullable(clinic)) + + /** Alias for calling [Builder.clinic] with `clinic.orElse(null)`. */ + fun clinic(clinic: Optional) = clinic(clinic.getOrNull()) + + /** + * Sets [Builder.clinic] to an arbitrary JSON value. + * + * You should usually call [Builder.clinic] with a well-typed [Clinic] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun clinic(clinic: JsonField) = apply { this.clinic = clinic } + + /** The part of this transaction amount that was for dental-related services. */ + fun dental(dental: Dental?) = dental(JsonField.ofNullable(dental)) + + /** Alias for calling [Builder.dental] with `dental.orElse(null)`. */ + fun dental(dental: Optional) = dental(dental.getOrNull()) + + /** + * Sets [Builder.dental] to an arbitrary JSON value. + * + * You should usually call [Builder.dental] with a well-typed [Dental] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun dental(dental: JsonField) = apply { this.dental = dental } + + /** The original pre-authorized amount. */ + fun original(original: Original?) = original(JsonField.ofNullable(original)) + + /** Alias for calling [Builder.original] with `original.orElse(null)`. */ + fun original(original: Optional) = original(original.getOrNull()) + + /** + * Sets [Builder.original] to an arbitrary JSON value. + * + * You should usually call [Builder.original] with a well-typed [Original] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun original(original: JsonField) = apply { this.original = original } + + /** 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() + * .original() + * .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("original", original), + 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() } + original().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) + + (original.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 original pre-authorized amount. */ + class Original + @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 [Original]. + * + * The following fields are required: + * ```java + * .amount() + * .currency() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Original]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var currency: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(original: Original) = apply { + amount = original.amount + currency = original.currency + additionalProperties = original.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 [Original]. + * + * 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(): Original = + Original( + checkRequired("amount", amount), + checkRequired("currency", currency), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Original = 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 Original && + 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() = + "Original{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 && + original == other.original && + 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, + original, + prescription, + surcharge, + totalCumulative, + totalHealthcare, + transit, + unknown, + vision, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "AdditionalAmounts{clinic=$clinic, dental=$dental, original=$original, prescription=$prescription, surcharge=$surcharge, totalCumulative=$totalCumulative, totalHealthcare=$totalHealthcare, transit=$transit, unknown=$unknown, vision=$vision, additionalProperties=$additionalProperties}" + } + + /** + * Present if and only if `decision` is `approve`. Contains information related to the + * approval of the balance inquiry. + */ + class Approval + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val balance: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("balance") @ExcludeMissing balance: JsonField = JsonMissing.of() + ) : this(balance, mutableMapOf()) + + /** + * If the balance inquiry was approved, this field contains the balance in the minor + * unit of the 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 balance(): Long = balance.getRequired("balance") + + /** + * Returns the raw JSON value of [balance]. + * + * Unlike [balance], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("balance") @ExcludeMissing fun _balance(): JsonField = balance + + @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 [Approval]. + * + * The following fields are required: + * ```java + * .balance() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Approval]. */ + class Builder internal constructor() { + + private var balance: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(approval: Approval) = apply { + balance = approval.balance + additionalProperties = approval.additionalProperties.toMutableMap() + } + + /** + * If the balance inquiry was approved, this field contains the balance in the minor + * unit of the settlement currency. + */ + fun balance(balance: Long) = balance(JsonField.of(balance)) + + /** + * Sets [Builder.balance] to an arbitrary JSON value. + * + * You should usually call [Builder.balance] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun balance(balance: JsonField) = apply { this.balance = balance } + + 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 [Approval]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .balance() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Approval = + Approval(checkRequired("balance", balance), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Approval = apply { + if (validated) { + return@apply + } + + balance() + 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 (balance.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Approval && + balance == other.balance && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(balance, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Approval{balance=$balance, additionalProperties=$additionalProperties}" + } + + /** Whether or not the authorization was approved. */ + class Decision @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 { + + /** Approve the authorization. */ + @JvmField val APPROVE = of("approve") + + /** Decline the authorization. */ + @JvmField val DECLINE = of("decline") + + @JvmStatic fun of(value: String) = Decision(JsonField.of(value)) + } + + /** An enum containing [Decision]'s known values. */ + enum class Known { + /** Approve the authorization. */ + APPROVE, + /** Decline the authorization. */ + DECLINE, + } + + /** + * An enum containing [Decision]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Decision] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then 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 { + /** Approve the authorization. */ + APPROVE, + /** Decline the authorization. */ + DECLINE, + /** + * An enum member indicating that [Decision] 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) { + APPROVE -> Value.APPROVE + DECLINE -> Value.DECLINE + 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) { + APPROVE -> Known.APPROVE + DECLINE -> Known.DECLINE + else -> throw IncreaseInvalidDataException("Unknown Decision: $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(): Decision = 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 Decision && 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 pulse: JsonField, + private val visa: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("category") + @ExcludeMissing + category: JsonField = JsonMissing.of(), + @JsonProperty("pulse") @ExcludeMissing pulse: JsonField = JsonMissing.of(), + @JsonProperty("visa") @ExcludeMissing visa: JsonField = JsonMissing.of(), + ) : this(category, pulse, 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 `pulse` network. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun pulse(): Optional = pulse.getOptional("pulse") + + /** + * 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 [pulse]. + * + * Unlike [pulse], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("pulse") @ExcludeMissing fun _pulse(): JsonField = pulse + + /** + * 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() + * .pulse() + * .visa() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [NetworkDetails]. */ + class Builder internal constructor() { + + private var category: JsonField? = null + private var pulse: JsonField? = null + private var visa: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(networkDetails: NetworkDetails) = apply { + category = networkDetails.category + pulse = networkDetails.pulse + 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 `pulse` network. */ + fun pulse(pulse: Pulse?) = pulse(JsonField.ofNullable(pulse)) + + /** Alias for calling [Builder.pulse] with `pulse.orElse(null)`. */ + fun pulse(pulse: Optional) = pulse(pulse.getOrNull()) + + /** + * Sets [Builder.pulse] to an arbitrary JSON value. + * + * You should usually call [Builder.pulse] with a well-typed [Pulse] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun pulse(pulse: JsonField) = apply { this.pulse = pulse } + + /** 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() + * .pulse() + * .visa() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): NetworkDetails = + NetworkDetails( + checkRequired("category", category), + checkRequired("pulse", pulse), + checkRequired("visa", visa), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): NetworkDetails = apply { + if (validated) { + return@apply + } + + category().validate() + pulse().ifPresent { it.validate() } + visa().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (category.asKnown().getOrNull()?.validity() ?: 0) + + (pulse.asKnown().getOrNull()?.validity() ?: 0) + + (visa.asKnown().getOrNull()?.validity() ?: 0) + + /** The payment network used to process this card authorization. */ + class Category @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + /** Visa */ + @JvmField val VISA = of("visa") + + /** Pulse */ + @JvmField val PULSE = of("pulse") + + @JvmStatic fun of(value: String) = Category(JsonField.of(value)) + } + + /** An enum containing [Category]'s known values. */ + enum class Known { + /** Visa */ + VISA, + /** Pulse */ + PULSE, + } + + /** + * An enum containing [Category]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Category] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** Visa */ + VISA, + /** Pulse */ + PULSE, + /** + * An enum member indicating that [Category] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + VISA -> Value.VISA + PULSE -> Value.PULSE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + VISA -> Known.VISA + PULSE -> Known.PULSE + else -> throw IncreaseInvalidDataException("Unknown Category: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Category = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Category && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Fields specific to the `pulse` network. */ + class Pulse + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor(private val additionalProperties: MutableMap) { + + @JsonCreator private constructor() : this(mutableMapOf()) + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Pulse]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Pulse]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(pulse: Pulse) = apply { + additionalProperties = pulse.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Pulse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Pulse = Pulse(additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Pulse = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = 0 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Pulse && additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "Pulse{additionalProperties=$additionalProperties}" + } + + /** Fields specific to the `visa` network. */ + class Visa + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val electronicCommerceIndicator: JsonField, + private val pointOfServiceEntryMode: JsonField, + private val standInProcessingReason: JsonField, + private val 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 && + pulse == other.pulse && + visa == other.visa && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(category, pulse, visa, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "NetworkDetails{category=$category, pulse=$pulse, visa=$visa, additionalProperties=$additionalProperties}" + } + + /** Network-specific identifiers for a specific request or transaction. */ + class NetworkIdentifiers + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val authorizationIdentificationResponse: JsonField, + private val retrievalReferenceNumber: JsonField, + private val traceNumber: JsonField, + private val transactionId: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("authorization_identification_response") + @ExcludeMissing + authorizationIdentificationResponse: JsonField = JsonMissing.of(), + @JsonProperty("retrieval_reference_number") + @ExcludeMissing + retrievalReferenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("trace_number") + @ExcludeMissing + traceNumber: JsonField = JsonMissing.of(), + @JsonProperty("transaction_id") + @ExcludeMissing + transactionId: JsonField = JsonMissing.of(), + ) : this( + authorizationIdentificationResponse, + retrievalReferenceNumber, + traceNumber, + transactionId, + mutableMapOf(), + ) + + /** + * The randomly generated 6-character Authorization Identification Response code sent + * back to the acquirer in an approved response. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun authorizationIdentificationResponse(): Optional = + authorizationIdentificationResponse.getOptional( + "authorization_identification_response" + ) + + /** + * A life-cycle identifier used across e.g., an authorization and a reversal. Expected + * to be unique per acquirer within a window of time. For some card networks the + * retrieval reference number includes the trace counter. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun retrievalReferenceNumber(): Optional = + retrievalReferenceNumber.getOptional("retrieval_reference_number") + + /** + * A counter used to verify an individual authorization. Expected to be unique per + * acquirer within a window of time. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun traceNumber(): Optional = traceNumber.getOptional("trace_number") + + /** + * A globally unique transaction identifier provided by the card network, used across + * multiple life-cycle requests. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun transactionId(): Optional = transactionId.getOptional("transaction_id") + + /** + * Returns the raw JSON value of [authorizationIdentificationResponse]. + * + * Unlike [authorizationIdentificationResponse], this method doesn't throw if the JSON + * field has an unexpected type. + */ + @JsonProperty("authorization_identification_response") + @ExcludeMissing + fun _authorizationIdentificationResponse(): JsonField = + authorizationIdentificationResponse + + /** + * Returns the raw JSON value of [retrievalReferenceNumber]. + * + * Unlike [retrievalReferenceNumber], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("retrieval_reference_number") + @ExcludeMissing + fun _retrievalReferenceNumber(): JsonField = retrievalReferenceNumber + + /** + * Returns the raw JSON value of [traceNumber]. + * + * Unlike [traceNumber], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("trace_number") + @ExcludeMissing + fun _traceNumber(): JsonField = traceNumber + + /** + * Returns the raw JSON value of [transactionId]. + * + * Unlike [transactionId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("transaction_id") + @ExcludeMissing + fun _transactionId(): JsonField = transactionId + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [NetworkIdentifiers]. + * + * The following fields are required: + * ```java + * .authorizationIdentificationResponse() + * .retrievalReferenceNumber() + * .traceNumber() + * .transactionId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [NetworkIdentifiers]. */ + class Builder internal constructor() { + + private var authorizationIdentificationResponse: JsonField? = null + private var retrievalReferenceNumber: JsonField? = null + private var traceNumber: JsonField? = null + private var transactionId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(networkIdentifiers: NetworkIdentifiers) = apply { + authorizationIdentificationResponse = + networkIdentifiers.authorizationIdentificationResponse + retrievalReferenceNumber = networkIdentifiers.retrievalReferenceNumber + traceNumber = networkIdentifiers.traceNumber + transactionId = networkIdentifiers.transactionId + additionalProperties = networkIdentifiers.additionalProperties.toMutableMap() + } + + /** + * The randomly generated 6-character Authorization Identification Response code + * sent back to the acquirer in an approved response. + */ + fun authorizationIdentificationResponse( + authorizationIdentificationResponse: String? + ) = + authorizationIdentificationResponse( + JsonField.ofNullable(authorizationIdentificationResponse) + ) + + /** + * Alias for calling [Builder.authorizationIdentificationResponse] with + * `authorizationIdentificationResponse.orElse(null)`. + */ + fun authorizationIdentificationResponse( + authorizationIdentificationResponse: Optional + ) = + authorizationIdentificationResponse( + authorizationIdentificationResponse.getOrNull() + ) + + /** + * Sets [Builder.authorizationIdentificationResponse] to an arbitrary JSON value. + * + * You should usually call [Builder.authorizationIdentificationResponse] with a + * well-typed [String] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun authorizationIdentificationResponse( + authorizationIdentificationResponse: JsonField + ) = apply { + this.authorizationIdentificationResponse = authorizationIdentificationResponse + } + + /** + * A life-cycle identifier used across e.g., an authorization and a reversal. + * Expected to be unique per acquirer within a window of time. For some card + * networks the retrieval reference number includes the trace counter. + */ + fun retrievalReferenceNumber(retrievalReferenceNumber: String?) = + retrievalReferenceNumber(JsonField.ofNullable(retrievalReferenceNumber)) + + /** + * Alias for calling [Builder.retrievalReferenceNumber] with + * `retrievalReferenceNumber.orElse(null)`. + */ + fun retrievalReferenceNumber(retrievalReferenceNumber: Optional) = + retrievalReferenceNumber(retrievalReferenceNumber.getOrNull()) + + /** + * Sets [Builder.retrievalReferenceNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.retrievalReferenceNumber] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun retrievalReferenceNumber(retrievalReferenceNumber: JsonField) = apply { + this.retrievalReferenceNumber = retrievalReferenceNumber + } + + /** + * A counter used to verify an individual authorization. Expected to be unique per + * acquirer within a window of time. + */ + fun traceNumber(traceNumber: String?) = + traceNumber(JsonField.ofNullable(traceNumber)) + + /** Alias for calling [Builder.traceNumber] with `traceNumber.orElse(null)`. */ + fun traceNumber(traceNumber: Optional) = + traceNumber(traceNumber.getOrNull()) + + /** + * Sets [Builder.traceNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.traceNumber] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun traceNumber(traceNumber: JsonField) = apply { + this.traceNumber = traceNumber + } + + /** + * A globally unique transaction identifier provided by the card network, used + * across multiple life-cycle requests. + */ + fun transactionId(transactionId: String?) = + transactionId(JsonField.ofNullable(transactionId)) + + /** Alias for calling [Builder.transactionId] with `transactionId.orElse(null)`. */ + fun transactionId(transactionId: Optional) = + transactionId(transactionId.getOrNull()) + + /** + * Sets [Builder.transactionId] to an arbitrary JSON value. + * + * You should usually call [Builder.transactionId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun transactionId(transactionId: JsonField) = apply { + this.transactionId = transactionId + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [NetworkIdentifiers]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .authorizationIdentificationResponse() + * .retrievalReferenceNumber() + * .traceNumber() + * .transactionId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): NetworkIdentifiers = + NetworkIdentifiers( + checkRequired( + "authorizationIdentificationResponse", + authorizationIdentificationResponse, + ), + checkRequired("retrievalReferenceNumber", retrievalReferenceNumber), + checkRequired("traceNumber", traceNumber), + checkRequired("transactionId", transactionId), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): NetworkIdentifiers = apply { + if (validated) { + return@apply + } + + authorizationIdentificationResponse() + retrievalReferenceNumber() + traceNumber() + transactionId() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (authorizationIdentificationResponse.asKnown().isPresent) 1 else 0) + + (if (retrievalReferenceNumber.asKnown().isPresent) 1 else 0) + + (if (traceNumber.asKnown().isPresent) 1 else 0) + + (if (transactionId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is NetworkIdentifiers && + authorizationIdentificationResponse == + other.authorizationIdentificationResponse && + retrievalReferenceNumber == other.retrievalReferenceNumber && + traceNumber == other.traceNumber && + transactionId == other.transactionId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + authorizationIdentificationResponse, + retrievalReferenceNumber, + traceNumber, + transactionId, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "NetworkIdentifiers{authorizationIdentificationResponse=$authorizationIdentificationResponse, retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}" + } + + /** 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 CardBalanceInquiry && + accountId == other.accountId && + additionalAmounts == other.additionalAmounts && + approval == other.approval && + cardId == other.cardId && + decision == other.decision && + digitalWalletTokenId == other.digitalWalletTokenId && + merchantAcceptorId == other.merchantAcceptorId && + merchantCategoryCode == other.merchantCategoryCode && + merchantCity == other.merchantCity && + merchantCountry == other.merchantCountry && + merchantDescriptor == other.merchantDescriptor && + merchantPostalCode == other.merchantPostalCode && + merchantState == other.merchantState && + networkDetails == other.networkDetails && + networkIdentifiers == other.networkIdentifiers && + networkRiskScore == other.networkRiskScore && + physicalCardId == other.physicalCardId && + terminalId == other.terminalId && + upcomingCardPaymentId == other.upcomingCardPaymentId && + verification == other.verification && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + accountId, + additionalAmounts, + approval, + cardId, + decision, + digitalWalletTokenId, + merchantAcceptorId, + merchantCategoryCode, + merchantCity, + merchantCountry, + merchantDescriptor, + merchantPostalCode, + merchantState, + networkDetails, + networkIdentifiers, + networkRiskScore, + physicalCardId, + terminalId, + upcomingCardPaymentId, + verification, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "CardBalanceInquiry{accountId=$accountId, additionalAmounts=$additionalAmounts, approval=$approval, cardId=$cardId, decision=$decision, digitalWalletTokenId=$digitalWalletTokenId, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkDetails=$networkDetails, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, physicalCardId=$physicalCardId, terminalId=$terminalId, upcomingCardPaymentId=$upcomingCardPaymentId, verification=$verification, additionalProperties=$additionalProperties}" + } + + /** The category of the Real-Time Decision. */ + 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 { + + /** A card is being authorized. */ + @JvmField val CARD_AUTHORIZATION_REQUESTED = of("card_authorization_requested") + + /** A balance inquiry is being made on a card. */ + @JvmField val CARD_BALANCE_INQUIRY_REQUESTED = of("card_balance_inquiry_requested") /** 3DS authentication is requested. */ @JvmField val CARD_AUTHENTICATION_REQUESTED = of("card_authentication_requested") @@ -11284,6 +18816,8 @@ private constructor( enum class Known { /** A card is being authorized. */ CARD_AUTHORIZATION_REQUESTED, + /** A balance inquiry is being made on a card. */ + CARD_BALANCE_INQUIRY_REQUESTED, /** 3DS authentication is requested. */ CARD_AUTHENTICATION_REQUESTED, /** 3DS authentication challenge requires cardholder involvement. */ @@ -11308,6 +18842,8 @@ private constructor( enum class Value { /** A card is being authorized. */ CARD_AUTHORIZATION_REQUESTED, + /** A balance inquiry is being made on a card. */ + CARD_BALANCE_INQUIRY_REQUESTED, /** 3DS authentication is requested. */ CARD_AUTHENTICATION_REQUESTED, /** 3DS authentication challenge requires cardholder involvement. */ @@ -11332,6 +18868,7 @@ private constructor( fun value(): Value = when (this) { CARD_AUTHORIZATION_REQUESTED -> Value.CARD_AUTHORIZATION_REQUESTED + CARD_BALANCE_INQUIRY_REQUESTED -> Value.CARD_BALANCE_INQUIRY_REQUESTED CARD_AUTHENTICATION_REQUESTED -> Value.CARD_AUTHENTICATION_REQUESTED CARD_AUTHENTICATION_CHALLENGE_REQUESTED -> Value.CARD_AUTHENTICATION_CHALLENGE_REQUESTED @@ -11353,6 +18890,7 @@ private constructor( fun known(): Known = when (this) { CARD_AUTHORIZATION_REQUESTED -> Known.CARD_AUTHORIZATION_REQUESTED + CARD_BALANCE_INQUIRY_REQUESTED -> Known.CARD_BALANCE_INQUIRY_REQUESTED CARD_AUTHENTICATION_REQUESTED -> Known.CARD_AUTHENTICATION_REQUESTED CARD_AUTHENTICATION_CHALLENGE_REQUESTED -> Known.CARD_AUTHENTICATION_CHALLENGE_REQUESTED @@ -13322,6 +20860,7 @@ private constructor( cardAuthentication == other.cardAuthentication && cardAuthenticationChallenge == other.cardAuthenticationChallenge && cardAuthorization == other.cardAuthorization && + cardBalanceInquiry == other.cardBalanceInquiry && category == other.category && createdAt == other.createdAt && digitalWalletAuthentication == other.digitalWalletAuthentication && @@ -13338,6 +20877,7 @@ private constructor( cardAuthentication, cardAuthenticationChallenge, cardAuthorization, + cardBalanceInquiry, category, createdAt, digitalWalletAuthentication, @@ -13352,5 +20892,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "RealTimeDecision{id=$id, cardAuthentication=$cardAuthentication, cardAuthenticationChallenge=$cardAuthenticationChallenge, cardAuthorization=$cardAuthorization, category=$category, createdAt=$createdAt, digitalWalletAuthentication=$digitalWalletAuthentication, digitalWalletToken=$digitalWalletToken, status=$status, timeoutAt=$timeoutAt, type=$type, additionalProperties=$additionalProperties}" + "RealTimeDecision{id=$id, cardAuthentication=$cardAuthentication, cardAuthenticationChallenge=$cardAuthenticationChallenge, cardAuthorization=$cardAuthorization, cardBalanceInquiry=$cardBalanceInquiry, category=$category, createdAt=$createdAt, digitalWalletAuthentication=$digitalWalletAuthentication, digitalWalletToken=$digitalWalletToken, status=$status, timeoutAt=$timeoutAt, type=$type, additionalProperties=$additionalProperties}" } diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecisionActionParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecisionActionParams.kt index f67e0356d..14664c19d 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecisionActionParams.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecisionActionParams.kt @@ -61,6 +61,15 @@ private constructor( */ fun cardAuthorization(): Optional = body.cardAuthorization() + /** + * If the Real-Time Decision relates to a card balance inquiry attempt, this object contains + * your response to the inquiry. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun cardBalanceInquiry(): Optional = body.cardBalanceInquiry() + /** * If the Real-Time Decision relates to a digital wallet authentication attempt, this object * contains your response to the authentication. @@ -105,6 +114,14 @@ private constructor( */ fun _cardAuthorization(): JsonField = body._cardAuthorization() + /** + * Returns the raw JSON value of [cardBalanceInquiry]. + * + * Unlike [cardBalanceInquiry], this method doesn't throw if the JSON field has an unexpected + * type. + */ + fun _cardBalanceInquiry(): JsonField = body._cardBalanceInquiry() + /** * Returns the raw JSON value of [digitalWalletAuthentication]. * @@ -177,8 +194,8 @@ private constructor( * - [cardAuthentication] * - [cardAuthenticationChallenge] * - [cardAuthorization] + * - [cardBalanceInquiry] * - [digitalWalletAuthentication] - * - [digitalWalletToken] * - etc. */ fun body(body: Body) = apply { this.body = body.toBuilder() } @@ -241,6 +258,25 @@ private constructor( body.cardAuthorization(cardAuthorization) } + /** + * If the Real-Time Decision relates to a card balance inquiry attempt, this object contains + * your response to the inquiry. + */ + fun cardBalanceInquiry(cardBalanceInquiry: CardBalanceInquiry) = apply { + body.cardBalanceInquiry(cardBalanceInquiry) + } + + /** + * Sets [Builder.cardBalanceInquiry] to an arbitrary JSON value. + * + * You should usually call [Builder.cardBalanceInquiry] with a well-typed + * [CardBalanceInquiry] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun cardBalanceInquiry(cardBalanceInquiry: JsonField) = apply { + body.cardBalanceInquiry(cardBalanceInquiry) + } + /** * If the Real-Time Decision relates to a digital wallet authentication attempt, this object * contains your response to the authentication. @@ -429,6 +465,7 @@ private constructor( private val cardAuthentication: JsonField, private val cardAuthenticationChallenge: JsonField, private val cardAuthorization: JsonField, + private val cardBalanceInquiry: JsonField, private val digitalWalletAuthentication: JsonField, private val digitalWalletToken: JsonField, private val additionalProperties: MutableMap, @@ -445,6 +482,9 @@ private constructor( @JsonProperty("card_authorization") @ExcludeMissing cardAuthorization: JsonField = JsonMissing.of(), + @JsonProperty("card_balance_inquiry") + @ExcludeMissing + cardBalanceInquiry: JsonField = JsonMissing.of(), @JsonProperty("digital_wallet_authentication") @ExcludeMissing digitalWalletAuthentication: JsonField = JsonMissing.of(), @@ -455,6 +495,7 @@ private constructor( cardAuthentication, cardAuthenticationChallenge, cardAuthorization, + cardBalanceInquiry, digitalWalletAuthentication, digitalWalletToken, mutableMapOf(), @@ -490,6 +531,16 @@ private constructor( fun cardAuthorization(): Optional = cardAuthorization.getOptional("card_authorization") + /** + * If the Real-Time Decision relates to a card balance inquiry attempt, this object contains + * your response to the inquiry. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun cardBalanceInquiry(): Optional = + cardBalanceInquiry.getOptional("card_balance_inquiry") + /** * If the Real-Time Decision relates to a digital wallet authentication attempt, this object * contains your response to the authentication. @@ -541,6 +592,16 @@ private constructor( @ExcludeMissing fun _cardAuthorization(): JsonField = cardAuthorization + /** + * Returns the raw JSON value of [cardBalanceInquiry]. + * + * Unlike [cardBalanceInquiry], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("card_balance_inquiry") + @ExcludeMissing + fun _cardBalanceInquiry(): JsonField = cardBalanceInquiry + /** * Returns the raw JSON value of [digitalWalletAuthentication]. * @@ -587,6 +648,7 @@ private constructor( private var cardAuthenticationChallenge: JsonField = JsonMissing.of() private var cardAuthorization: JsonField = JsonMissing.of() + private var cardBalanceInquiry: JsonField = JsonMissing.of() private var digitalWalletAuthentication: JsonField = JsonMissing.of() private var digitalWalletToken: JsonField = JsonMissing.of() @@ -597,6 +659,7 @@ private constructor( cardAuthentication = body.cardAuthentication cardAuthenticationChallenge = body.cardAuthenticationChallenge cardAuthorization = body.cardAuthorization + cardBalanceInquiry = body.cardBalanceInquiry digitalWalletAuthentication = body.digitalWalletAuthentication digitalWalletToken = body.digitalWalletToken additionalProperties = body.additionalProperties.toMutableMap() @@ -657,6 +720,24 @@ private constructor( this.cardAuthorization = cardAuthorization } + /** + * If the Real-Time Decision relates to a card balance inquiry attempt, this object + * contains your response to the inquiry. + */ + fun cardBalanceInquiry(cardBalanceInquiry: CardBalanceInquiry) = + cardBalanceInquiry(JsonField.of(cardBalanceInquiry)) + + /** + * Sets [Builder.cardBalanceInquiry] to an arbitrary JSON value. + * + * You should usually call [Builder.cardBalanceInquiry] with a well-typed + * [CardBalanceInquiry] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun cardBalanceInquiry(cardBalanceInquiry: JsonField) = apply { + this.cardBalanceInquiry = cardBalanceInquiry + } + /** * If the Real-Time Decision relates to a digital wallet authentication attempt, this * object contains your response to the authentication. @@ -723,6 +804,7 @@ private constructor( cardAuthentication, cardAuthenticationChallenge, cardAuthorization, + cardBalanceInquiry, digitalWalletAuthentication, digitalWalletToken, additionalProperties.toMutableMap(), @@ -739,6 +821,7 @@ private constructor( cardAuthentication().ifPresent { it.validate() } cardAuthenticationChallenge().ifPresent { it.validate() } cardAuthorization().ifPresent { it.validate() } + cardBalanceInquiry().ifPresent { it.validate() } digitalWalletAuthentication().ifPresent { it.validate() } digitalWalletToken().ifPresent { it.validate() } validated = true @@ -763,6 +846,7 @@ private constructor( (cardAuthentication.asKnown().getOrNull()?.validity() ?: 0) + (cardAuthenticationChallenge.asKnown().getOrNull()?.validity() ?: 0) + (cardAuthorization.asKnown().getOrNull()?.validity() ?: 0) + + (cardBalanceInquiry.asKnown().getOrNull()?.validity() ?: 0) + (digitalWalletAuthentication.asKnown().getOrNull()?.validity() ?: 0) + (digitalWalletToken.asKnown().getOrNull()?.validity() ?: 0) @@ -775,6 +859,7 @@ private constructor( cardAuthentication == other.cardAuthentication && cardAuthenticationChallenge == other.cardAuthenticationChallenge && cardAuthorization == other.cardAuthorization && + cardBalanceInquiry == other.cardBalanceInquiry && digitalWalletAuthentication == other.digitalWalletAuthentication && digitalWalletToken == other.digitalWalletToken && additionalProperties == other.additionalProperties @@ -785,6 +870,7 @@ private constructor( cardAuthentication, cardAuthenticationChallenge, cardAuthorization, + cardBalanceInquiry, digitalWalletAuthentication, digitalWalletToken, additionalProperties, @@ -794,7 +880,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Body{cardAuthentication=$cardAuthentication, cardAuthenticationChallenge=$cardAuthenticationChallenge, cardAuthorization=$cardAuthorization, digitalWalletAuthentication=$digitalWalletAuthentication, digitalWalletToken=$digitalWalletToken, additionalProperties=$additionalProperties}" + "Body{cardAuthentication=$cardAuthentication, cardAuthenticationChallenge=$cardAuthenticationChallenge, cardAuthorization=$cardAuthorization, cardBalanceInquiry=$cardBalanceInquiry, digitalWalletAuthentication=$digitalWalletAuthentication, digitalWalletToken=$digitalWalletToken, additionalProperties=$additionalProperties}" } /** @@ -2996,6 +3082,515 @@ private constructor( "CardAuthorization{decision=$decision, approval=$approval, decline=$decline, additionalProperties=$additionalProperties}" } + /** + * If the Real-Time Decision relates to a card balance inquiry attempt, this object contains + * your response to the inquiry. + */ + class CardBalanceInquiry + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val decision: JsonField, + private val approval: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("decision") + @ExcludeMissing + decision: JsonField = JsonMissing.of(), + @JsonProperty("approval") + @ExcludeMissing + approval: JsonField = JsonMissing.of(), + ) : this(decision, approval, mutableMapOf()) + + /** + * Whether the card balance inquiry should be approved or declined. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun decision(): Decision = decision.getRequired("decision") + + /** + * If your application approves the balance inquiry, this contains metadata about your + * decision to approve. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun approval(): Optional = approval.getOptional("approval") + + /** + * Returns the raw JSON value of [decision]. + * + * Unlike [decision], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("decision") @ExcludeMissing fun _decision(): JsonField = decision + + /** + * Returns the raw JSON value of [approval]. + * + * Unlike [approval], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("approval") @ExcludeMissing fun _approval(): JsonField = approval + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [CardBalanceInquiry]. + * + * The following fields are required: + * ```java + * .decision() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [CardBalanceInquiry]. */ + class Builder internal constructor() { + + private var decision: JsonField? = null + private var approval: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(cardBalanceInquiry: CardBalanceInquiry) = apply { + decision = cardBalanceInquiry.decision + approval = cardBalanceInquiry.approval + additionalProperties = cardBalanceInquiry.additionalProperties.toMutableMap() + } + + /** Whether the card balance inquiry should be approved or declined. */ + fun decision(decision: Decision) = decision(JsonField.of(decision)) + + /** + * Sets [Builder.decision] to an arbitrary JSON value. + * + * You should usually call [Builder.decision] with a well-typed [Decision] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun decision(decision: JsonField) = apply { this.decision = decision } + + /** + * If your application approves the balance inquiry, this contains metadata about your + * decision to approve. + */ + fun approval(approval: Approval) = approval(JsonField.of(approval)) + + /** + * Sets [Builder.approval] to an arbitrary JSON value. + * + * You should usually call [Builder.approval] with a well-typed [Approval] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun approval(approval: JsonField) = apply { this.approval = approval } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [CardBalanceInquiry]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .decision() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CardBalanceInquiry = + CardBalanceInquiry( + checkRequired("decision", decision), + approval, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): CardBalanceInquiry = apply { + if (validated) { + return@apply + } + + decision().validate() + approval().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 = + (decision.asKnown().getOrNull()?.validity() ?: 0) + + (approval.asKnown().getOrNull()?.validity() ?: 0) + + /** Whether the card balance inquiry should be approved or declined. */ + class Decision @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 { + + /** Approve the authorization. */ + @JvmField val APPROVE = of("approve") + + /** Decline the authorization. */ + @JvmField val DECLINE = of("decline") + + @JvmStatic fun of(value: String) = Decision(JsonField.of(value)) + } + + /** An enum containing [Decision]'s known values. */ + enum class Known { + /** Approve the authorization. */ + APPROVE, + /** Decline the authorization. */ + DECLINE, + } + + /** + * An enum containing [Decision]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Decision] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then 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 { + /** Approve the authorization. */ + APPROVE, + /** Decline the authorization. */ + DECLINE, + /** + * An enum member indicating that [Decision] 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) { + APPROVE -> Value.APPROVE + DECLINE -> Value.DECLINE + 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) { + APPROVE -> Known.APPROVE + DECLINE -> Known.DECLINE + else -> throw IncreaseInvalidDataException("Unknown Decision: $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(): Decision = 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 Decision && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * If your application approves the balance inquiry, this contains metadata about your + * decision to approve. + */ + class Approval + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val balance: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("balance") @ExcludeMissing balance: JsonField = JsonMissing.of() + ) : this(balance, mutableMapOf()) + + /** + * The balance on the card in the settlement currency of 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 balance(): Long = balance.getRequired("balance") + + /** + * Returns the raw JSON value of [balance]. + * + * Unlike [balance], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("balance") @ExcludeMissing fun _balance(): JsonField = balance + + @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 [Approval]. + * + * The following fields are required: + * ```java + * .balance() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Approval]. */ + class Builder internal constructor() { + + private var balance: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(approval: Approval) = apply { + balance = approval.balance + additionalProperties = approval.additionalProperties.toMutableMap() + } + + /** The balance on the card in the settlement currency of the transaction. */ + fun balance(balance: Long) = balance(JsonField.of(balance)) + + /** + * Sets [Builder.balance] to an arbitrary JSON value. + * + * You should usually call [Builder.balance] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun balance(balance: JsonField) = apply { this.balance = balance } + + 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 [Approval]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .balance() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Approval = + Approval(checkRequired("balance", balance), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Approval = apply { + if (validated) { + return@apply + } + + balance() + 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 (balance.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Approval && + balance == other.balance && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(balance, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Approval{balance=$balance, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is CardBalanceInquiry && + decision == other.decision && + approval == other.approval && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(decision, approval, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "CardBalanceInquiry{decision=$decision, approval=$approval, additionalProperties=$additionalProperties}" + } + /** * If the Real-Time Decision relates to a digital wallet authentication attempt, this object * contains your response to the authentication. diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecisionActionParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecisionActionParamsTest.kt index e3269815f..73c7b1c6d 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecisionActionParamsTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecisionActionParamsTest.kt @@ -57,6 +57,16 @@ internal class RealTimeDecisionActionParamsTest { ) .build() ) + .cardBalanceInquiry( + RealTimeDecisionActionParams.CardBalanceInquiry.builder() + .decision(RealTimeDecisionActionParams.CardBalanceInquiry.Decision.APPROVE) + .approval( + RealTimeDecisionActionParams.CardBalanceInquiry.Approval.builder() + .balance(0L) + .build() + ) + .build() + ) .digitalWalletAuthentication( RealTimeDecisionActionParams.DigitalWalletAuthentication.builder() .result(RealTimeDecisionActionParams.DigitalWalletAuthentication.Result.SUCCESS) @@ -151,6 +161,16 @@ internal class RealTimeDecisionActionParamsTest { ) .build() ) + .cardBalanceInquiry( + RealTimeDecisionActionParams.CardBalanceInquiry.builder() + .decision(RealTimeDecisionActionParams.CardBalanceInquiry.Decision.APPROVE) + .approval( + RealTimeDecisionActionParams.CardBalanceInquiry.Approval.builder() + .balance(0L) + .build() + ) + .build() + ) .digitalWalletAuthentication( RealTimeDecisionActionParams.DigitalWalletAuthentication.builder() .result( @@ -233,6 +253,17 @@ internal class RealTimeDecisionActionParamsTest { ) .build() ) + assertThat(body.cardBalanceInquiry()) + .contains( + RealTimeDecisionActionParams.CardBalanceInquiry.builder() + .decision(RealTimeDecisionActionParams.CardBalanceInquiry.Decision.APPROVE) + .approval( + RealTimeDecisionActionParams.CardBalanceInquiry.Approval.builder() + .balance(0L) + .build() + ) + .build() + ) assertThat(body.digitalWalletAuthentication()) .contains( RealTimeDecisionActionParams.DigitalWalletAuthentication.builder() diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecisionTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecisionTest.kt index 227e7adf6..7a31aa564 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecisionTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecisionTest.kt @@ -244,6 +244,179 @@ internal class RealTimeDecisionTest { ) .build() ) + .cardBalanceInquiry( + RealTimeDecision.CardBalanceInquiry.builder() + .accountId("account_id") + .additionalAmounts( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts.builder() + .clinic( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts.Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts.Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .original( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts.Original + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts.Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts.Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts.Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts.Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) + .approval( + RealTimeDecision.CardBalanceInquiry.Approval.builder() + .balance(0L) + .build() + ) + .cardId("card_id") + .decision(RealTimeDecision.CardBalanceInquiry.Decision.APPROVE) + .digitalWalletTokenId("digital_wallet_token_id") + .merchantAcceptorId("merchant_acceptor_id") + .merchantCategoryCode("merchant_category_code") + .merchantCity("merchant_city") + .merchantCountry("merchant_country") + .merchantDescriptor("merchant_descriptor") + .merchantPostalCode("merchant_postal_code") + .merchantState("merchant_state") + .networkDetails( + RealTimeDecision.CardBalanceInquiry.NetworkDetails.builder() + .category( + RealTimeDecision.CardBalanceInquiry.NetworkDetails.Category.VISA + ) + .pulse( + RealTimeDecision.CardBalanceInquiry.NetworkDetails.Pulse + .builder() + .build() + ) + .visa( + RealTimeDecision.CardBalanceInquiry.NetworkDetails.Visa + .builder() + .electronicCommerceIndicator( + RealTimeDecision.CardBalanceInquiry.NetworkDetails.Visa + .ElectronicCommerceIndicator + .MAIL_PHONE_ORDER + ) + .pointOfServiceEntryMode( + RealTimeDecision.CardBalanceInquiry.NetworkDetails.Visa + .PointOfServiceEntryMode + .UNKNOWN + ) + .standInProcessingReason( + RealTimeDecision.CardBalanceInquiry.NetworkDetails.Visa + .StandInProcessingReason + .ISSUER_ERROR + ) + .build() + ) + .build() + ) + .networkIdentifiers( + RealTimeDecision.CardBalanceInquiry.NetworkIdentifiers.builder() + .authorizationIdentificationResponse(null) + .retrievalReferenceNumber("785867080153") + .traceNumber("487941") + .transactionId("627199945183184") + .build() + ) + .networkRiskScore(0L) + .physicalCardId("physical_card_id") + .terminalId("terminal_id") + .upcomingCardPaymentId("upcoming_card_payment_id") + .verification( + RealTimeDecision.CardBalanceInquiry.Verification.builder() + .cardVerificationCode( + RealTimeDecision.CardBalanceInquiry.Verification + .CardVerificationCode + .builder() + .result( + RealTimeDecision.CardBalanceInquiry.Verification + .CardVerificationCode + .Result + .NOT_CHECKED + ) + .build() + ) + .cardholderAddress( + RealTimeDecision.CardBalanceInquiry.Verification + .CardholderAddress + .builder() + .actualLine1("actual_line1") + .actualPostalCode("actual_postal_code") + .providedLine1("provided_line1") + .providedPostalCode("provided_postal_code") + .result( + RealTimeDecision.CardBalanceInquiry.Verification + .CardholderAddress + .Result + .NOT_CHECKED + ) + .build() + ) + .build() + ) + .build() + ) .category(RealTimeDecision.Category.CARD_AUTHORIZATION_REQUESTED) .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) .digitalWalletAuthentication( @@ -499,6 +672,174 @@ internal class RealTimeDecisionTest { ) .build() ) + assertThat(realTimeDecision.cardBalanceInquiry()) + .contains( + RealTimeDecision.CardBalanceInquiry.builder() + .accountId("account_id") + .additionalAmounts( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts.builder() + .clinic( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts.Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts.Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .original( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts.Original + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts.Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts.Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts.Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts.Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts.Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) + .approval( + RealTimeDecision.CardBalanceInquiry.Approval.builder().balance(0L).build() + ) + .cardId("card_id") + .decision(RealTimeDecision.CardBalanceInquiry.Decision.APPROVE) + .digitalWalletTokenId("digital_wallet_token_id") + .merchantAcceptorId("merchant_acceptor_id") + .merchantCategoryCode("merchant_category_code") + .merchantCity("merchant_city") + .merchantCountry("merchant_country") + .merchantDescriptor("merchant_descriptor") + .merchantPostalCode("merchant_postal_code") + .merchantState("merchant_state") + .networkDetails( + RealTimeDecision.CardBalanceInquiry.NetworkDetails.builder() + .category( + RealTimeDecision.CardBalanceInquiry.NetworkDetails.Category.VISA + ) + .pulse( + RealTimeDecision.CardBalanceInquiry.NetworkDetails.Pulse.builder() + .build() + ) + .visa( + RealTimeDecision.CardBalanceInquiry.NetworkDetails.Visa.builder() + .electronicCommerceIndicator( + RealTimeDecision.CardBalanceInquiry.NetworkDetails.Visa + .ElectronicCommerceIndicator + .MAIL_PHONE_ORDER + ) + .pointOfServiceEntryMode( + RealTimeDecision.CardBalanceInquiry.NetworkDetails.Visa + .PointOfServiceEntryMode + .UNKNOWN + ) + .standInProcessingReason( + RealTimeDecision.CardBalanceInquiry.NetworkDetails.Visa + .StandInProcessingReason + .ISSUER_ERROR + ) + .build() + ) + .build() + ) + .networkIdentifiers( + RealTimeDecision.CardBalanceInquiry.NetworkIdentifiers.builder() + .authorizationIdentificationResponse(null) + .retrievalReferenceNumber("785867080153") + .traceNumber("487941") + .transactionId("627199945183184") + .build() + ) + .networkRiskScore(0L) + .physicalCardId("physical_card_id") + .terminalId("terminal_id") + .upcomingCardPaymentId("upcoming_card_payment_id") + .verification( + RealTimeDecision.CardBalanceInquiry.Verification.builder() + .cardVerificationCode( + RealTimeDecision.CardBalanceInquiry.Verification + .CardVerificationCode + .builder() + .result( + RealTimeDecision.CardBalanceInquiry.Verification + .CardVerificationCode + .Result + .NOT_CHECKED + ) + .build() + ) + .cardholderAddress( + RealTimeDecision.CardBalanceInquiry.Verification.CardholderAddress + .builder() + .actualLine1("actual_line1") + .actualPostalCode("actual_postal_code") + .providedLine1("provided_line1") + .providedPostalCode("provided_postal_code") + .result( + RealTimeDecision.CardBalanceInquiry.Verification + .CardholderAddress + .Result + .NOT_CHECKED + ) + .build() + ) + .build() + ) + .build() + ) assertThat(realTimeDecision.category()) .isEqualTo(RealTimeDecision.Category.CARD_AUTHORIZATION_REQUESTED) assertThat(realTimeDecision.createdAt()) @@ -771,6 +1112,179 @@ internal class RealTimeDecisionTest { ) .build() ) + .cardBalanceInquiry( + RealTimeDecision.CardBalanceInquiry.builder() + .accountId("account_id") + .additionalAmounts( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts.builder() + .clinic( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts.Clinic + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .dental( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts.Dental + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .original( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts.Original + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .prescription( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts + .Prescription + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .surcharge( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts.Surcharge + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalCumulative( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts + .TotalCumulative + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .totalHealthcare( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts + .TotalHealthcare + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .transit( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts.Transit + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .unknown( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts.Unknown + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .vision( + RealTimeDecision.CardBalanceInquiry.AdditionalAmounts.Vision + .builder() + .amount(0L) + .currency("currency") + .build() + ) + .build() + ) + .approval( + RealTimeDecision.CardBalanceInquiry.Approval.builder() + .balance(0L) + .build() + ) + .cardId("card_id") + .decision(RealTimeDecision.CardBalanceInquiry.Decision.APPROVE) + .digitalWalletTokenId("digital_wallet_token_id") + .merchantAcceptorId("merchant_acceptor_id") + .merchantCategoryCode("merchant_category_code") + .merchantCity("merchant_city") + .merchantCountry("merchant_country") + .merchantDescriptor("merchant_descriptor") + .merchantPostalCode("merchant_postal_code") + .merchantState("merchant_state") + .networkDetails( + RealTimeDecision.CardBalanceInquiry.NetworkDetails.builder() + .category( + RealTimeDecision.CardBalanceInquiry.NetworkDetails.Category.VISA + ) + .pulse( + RealTimeDecision.CardBalanceInquiry.NetworkDetails.Pulse + .builder() + .build() + ) + .visa( + RealTimeDecision.CardBalanceInquiry.NetworkDetails.Visa + .builder() + .electronicCommerceIndicator( + RealTimeDecision.CardBalanceInquiry.NetworkDetails.Visa + .ElectronicCommerceIndicator + .MAIL_PHONE_ORDER + ) + .pointOfServiceEntryMode( + RealTimeDecision.CardBalanceInquiry.NetworkDetails.Visa + .PointOfServiceEntryMode + .UNKNOWN + ) + .standInProcessingReason( + RealTimeDecision.CardBalanceInquiry.NetworkDetails.Visa + .StandInProcessingReason + .ISSUER_ERROR + ) + .build() + ) + .build() + ) + .networkIdentifiers( + RealTimeDecision.CardBalanceInquiry.NetworkIdentifiers.builder() + .authorizationIdentificationResponse(null) + .retrievalReferenceNumber("785867080153") + .traceNumber("487941") + .transactionId("627199945183184") + .build() + ) + .networkRiskScore(0L) + .physicalCardId("physical_card_id") + .terminalId("terminal_id") + .upcomingCardPaymentId("upcoming_card_payment_id") + .verification( + RealTimeDecision.CardBalanceInquiry.Verification.builder() + .cardVerificationCode( + RealTimeDecision.CardBalanceInquiry.Verification + .CardVerificationCode + .builder() + .result( + RealTimeDecision.CardBalanceInquiry.Verification + .CardVerificationCode + .Result + .NOT_CHECKED + ) + .build() + ) + .cardholderAddress( + RealTimeDecision.CardBalanceInquiry.Verification + .CardholderAddress + .builder() + .actualLine1("actual_line1") + .actualPostalCode("actual_postal_code") + .providedLine1("provided_line1") + .providedPostalCode("provided_postal_code") + .result( + RealTimeDecision.CardBalanceInquiry.Verification + .CardholderAddress + .Result + .NOT_CHECKED + ) + .build() + ) + .build() + ) + .build() + ) .category(RealTimeDecision.Category.CARD_AUTHORIZATION_REQUESTED) .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) .digitalWalletAuthentication( diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/async/RealTimeDecisionServiceAsyncTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/async/RealTimeDecisionServiceAsyncTest.kt index d5d3a1d8e..7c17aa7b5 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/async/RealTimeDecisionServiceAsyncTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/async/RealTimeDecisionServiceAsyncTest.kt @@ -96,6 +96,18 @@ internal class RealTimeDecisionServiceAsyncTest { ) .build() ) + .cardBalanceInquiry( + RealTimeDecisionActionParams.CardBalanceInquiry.builder() + .decision( + RealTimeDecisionActionParams.CardBalanceInquiry.Decision.APPROVE + ) + .approval( + RealTimeDecisionActionParams.CardBalanceInquiry.Approval.builder() + .balance(0L) + .build() + ) + .build() + ) .digitalWalletAuthentication( RealTimeDecisionActionParams.DigitalWalletAuthentication.builder() .result( diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/RealTimeDecisionServiceTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/RealTimeDecisionServiceTest.kt index bd6ee3001..9292ed804 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/RealTimeDecisionServiceTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/RealTimeDecisionServiceTest.kt @@ -95,6 +95,18 @@ internal class RealTimeDecisionServiceTest { ) .build() ) + .cardBalanceInquiry( + RealTimeDecisionActionParams.CardBalanceInquiry.builder() + .decision( + RealTimeDecisionActionParams.CardBalanceInquiry.Decision.APPROVE + ) + .approval( + RealTimeDecisionActionParams.CardBalanceInquiry.Approval.builder() + .balance(0L) + .build() + ) + .build() + ) .digitalWalletAuthentication( RealTimeDecisionActionParams.DigitalWalletAuthentication.builder() .result( From 99583354b8a7f8a980da11b3410082e6fd31614c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 8 Dec 2025 23:21:14 +0000 Subject: [PATCH 2/2] release: 0.376.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 93ed6faef..c1ebe3f9a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.375.0" + ".": "0.376.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index c299b9f59..39b949425 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.376.0 (2025-12-08) + +Full Changelog: [v0.375.0...v0.376.0](https://github.com/Increase/increase-java/compare/v0.375.0...v0.376.0) + +### Features + +* **api:** api update ([76ef438](https://github.com/Increase/increase-java/commit/76ef438085db48829e4f2341e8d0bdfb7874edd6)) + ## 0.375.0 (2025-12-08) Full Changelog: [v0.374.0...v0.375.0](https://github.com/Increase/increase-java/compare/v0.374.0...v0.375.0) diff --git a/README.md b/README.md index 8a1ad7b8a..9c803eea3 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.375.0) -[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.375.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.375.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.increase.api/increase-java)](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.376.0) +[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.376.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.376.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.375.0). +The REST API documentation can be found on [increase.com](https://increase.com/documentation). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.increase.api/increase-java/0.376.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.375.0") +implementation("com.increase.api:increase-java:0.376.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.375.0") com.increase.api increase-java - 0.375.0 + 0.376.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 521fa4876..8e7f18546 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.increase.api" - version = "0.375.0" // x-release-please-version + version = "0.376.0" // x-release-please-version } subprojects {