From f6866ccb2402a93cad1dd152bd47cc7ffa74cb81 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 23 Oct 2025 18:23:18 +0000 Subject: [PATCH 1/2] feat(api): updates to Auth Rules and Card provisioning - removes Auth Performance reports from the API - adds additional response type to Card provisioning - adds new field to 3DS and ASA webhooks --- .stats.yml | 8 +- .../api/models/AccountActivityListPage.kt | 70 +- .../models/AccountActivityListPageAsync.kt | 70 +- .../models/AccountActivityListPageResponse.kt | 45 +- .../api/models/AccountActivityListResponse.kt | 10268 ++------------- ...ountActivityRetrieveTransactionResponse.kt | 10274 ++-------------- .../lithic/api/models/AuthRuleCondition.kt | 6 + .../api/models/AuthRuleV2CreateParams.kt | 54 + .../api/models/AuthRuleV2DraftParams.kt | 15 + .../api/models/AuthRuleV2ReportParams.kt | 281 - .../models/AuthenticationRetrieveResponse.kt | 212 +- .../lithic/api/models/BookTransferResponse.kt | 524 +- .../api/models/CardProvisionResponse.kt | 273 +- .../models/Conditional3dsActionParameters.kt | 15 + .../lithic/api/models/ConditionalAttribute.kt | 9 + .../kotlin/com/lithic/api/models/Event.kt | 7 - .../com/lithic/api/models/EventListParams.kt | 7 - .../lithic/api/models/EventSubscription.kt | 7 - .../models/EventSubscriptionCreateParams.kt | 7 - ...tSubscriptionSendSimulatedExampleParams.kt | 7 - .../models/EventSubscriptionUpdateParams.kt | 7 - .../models/ExternalBankAccountCreateParams.kt | 623 +- .../com/lithic/api/models/ExternalPayment.kt | 354 +- .../com/lithic/api/models/FinancialAccount.kt | 674 +- .../models/FinancialAccountCreditConfig.kt | 213 +- .../models/ManagementOperationTransaction.kt | 354 +- .../kotlin/com/lithic/api/models/Payment.kt | 2463 ++-- .../api/models/PaymentCreateResponse.kt | 462 +- .../lithic/api/models/PaymentRetryResponse.kt | 462 +- .../lithic/api/models/ProvisionResponse.kt | 250 + .../com/lithic/api/models/Tokenization.kt | 55 +- .../com/lithic/api/models/Transaction.kt | 24 + .../com/lithic/api/models/V2ApplyResponse.kt | 32 + .../com/lithic/api/models/V2CreateResponse.kt | 32 + .../com/lithic/api/models/V2DraftResponse.kt | 32 + .../com/lithic/api/models/V2ListResponse.kt | 32 + .../lithic/api/models/V2PromoteResponse.kt | 32 + .../com/lithic/api/models/V2ReportResponse.kt | 158 - .../lithic/api/models/V2RetrieveResponse.kt | 32 + .../com/lithic/api/models/V2UpdateResponse.kt | 32 + .../lithic/api/models/VerificationMethod.kt | 6 - .../async/authRules/V2ServiceAsync.kt | 135 - .../async/authRules/V2ServiceAsyncImpl.kt | 45 - .../services/blocking/authRules/V2Service.kt | 135 - .../blocking/authRules/V2ServiceImpl.kt | 42 - .../AccountActivityListPageResponseTest.kt | 17 +- .../models/AccountActivityListResponseTest.kt | 329 +- ...ActivityRetrieveTransactionResponseTest.kt | 418 +- .../api/models/AuthRuleV2ReportParamsTest.kt | 28 - .../AuthenticationRetrieveResponseTest.kt | 9 + .../BookTransferListPageResponseTest.kt | 51 +- .../api/models/BookTransferResponseTest.kt | 60 +- .../api/models/CardProvisionResponseTest.kt | 7 +- .../ExternalPaymentListPageResponseTest.kt | 6 +- .../lithic/api/models/ExternalPaymentTest.kt | 6 +- .../FinancialAccountCreditConfigTest.kt | 18 +- .../FinancialAccountListPageResponseTest.kt | 66 +- .../lithic/api/models/FinancialAccountTest.kt | 64 +- ...ManagementOperationListPageResponseTest.kt | 6 +- .../ManagementOperationTransactionTest.kt | 8 +- .../api/models/PaymentCreateResponseTest.kt | 91 +- .../api/models/PaymentListPageResponseTest.kt | 75 +- .../api/models/PaymentRetryResponseTest.kt | 91 +- .../com/lithic/api/models/PaymentTest.kt | 91 +- .../api/models/ProvisionResponseTest.kt | 44 + .../TokenizationListPageResponseTest.kt | 12 +- .../TokenizationSimulateResponseTest.kt | 12 +- .../com/lithic/api/models/TokenizationTest.kt | 6 +- ...izationUpdateDigitalCardArtResponseTest.kt | 12 +- .../lithic/api/models/V2ReportResponseTest.kt | 34 - .../async/authRules/V2ServiceAsyncTest.kt | 15 - .../blocking/authRules/V2ServiceTest.kt | 14 - 72 files changed, 7663 insertions(+), 22772 deletions(-) delete mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ReportParams.kt create mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/ProvisionResponse.kt delete mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ReportResponse.kt delete mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ReportParamsTest.kt create mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/ProvisionResponseTest.kt delete mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/V2ReportResponseTest.kt diff --git a/.stats.yml b/.stats.yml index 13cfc26b6..f728fc48c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 170 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-b1839661d8405911184d5cb7230f16e626a616e5b744634bd7f0bb4e730bf899.yml -openapi_spec_hash: c1c2c5a5c2a4067a714b35f873e3846f -config_hash: 98214f2eab6804b5c0048331e32c08e3 +configured_endpoints: 169 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-6432801dcf017d9234739b9f6153a8cfecd91255af4765f24ba5209f3e320b5c.yml +openapi_spec_hash: c2cfee2f044ba15d15b5bfdbd37280c0 +config_hash: 8ac73ccdb428816c89c84802c794a3f8 diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListPage.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListPage.kt index a9dad29b2..68f308289 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListPage.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListPage.kt @@ -46,36 +46,29 @@ private constructor( .first() .accept( object : AccountActivityListResponse.Visitor> { - override fun visitFinancialTransaction( - financialTransaction: - AccountActivityListResponse.FinancialTransaction - ): Optional = - financialTransaction._token().getOptional("token") + override fun visitInternal( + internal_: AccountActivityListResponse.FinancialTransaction + ): Optional = internal_._token().getOptional("token") - override fun visitBookTransferTransaction( - bookTransferTransaction: - AccountActivityListResponse.BookTransferTransaction - ): Optional = - bookTransferTransaction._token().getOptional("token") + override fun visitTransfer( + transfer: BookTransferResponse + ): Optional = transfer._token().getOptional("token") - override fun visitCardTransaction( - cardTransaction: AccountActivityListResponse.CardTransaction - ): Optional = cardTransaction._token().getOptional("token") + override fun visitCard( + card: AccountActivityListResponse.CardTransaction + ): Optional = card._token().getOptional("token") - override fun visitPaymentTransaction( - paymentTransaction: - AccountActivityListResponse.PaymentTransaction - ): Optional = - paymentTransaction._token().getOptional("token") + override fun visitPayment(payment: Payment): Optional = + payment._token().getOptional("token") override fun visitExternalPayment( externalPayment: ExternalPayment ): Optional = externalPayment._token().getOptional("token") - override fun visitManagementOperationTransaction( - managementOperationTransaction: ManagementOperationTransaction + override fun visitManagementOperation( + managementOperation: ManagementOperationTransaction ): Optional = - managementOperationTransaction._token().getOptional("token") + managementOperation._token().getOptional("token") } ) ) @@ -88,36 +81,29 @@ private constructor( .last() .accept( object : AccountActivityListResponse.Visitor> { - override fun visitFinancialTransaction( - financialTransaction: - AccountActivityListResponse.FinancialTransaction - ): Optional = - financialTransaction._token().getOptional("token") + override fun visitInternal( + internal_: AccountActivityListResponse.FinancialTransaction + ): Optional = internal_._token().getOptional("token") - override fun visitBookTransferTransaction( - bookTransferTransaction: - AccountActivityListResponse.BookTransferTransaction - ): Optional = - bookTransferTransaction._token().getOptional("token") + override fun visitTransfer( + transfer: BookTransferResponse + ): Optional = transfer._token().getOptional("token") - override fun visitCardTransaction( - cardTransaction: AccountActivityListResponse.CardTransaction - ): Optional = cardTransaction._token().getOptional("token") + override fun visitCard( + card: AccountActivityListResponse.CardTransaction + ): Optional = card._token().getOptional("token") - override fun visitPaymentTransaction( - paymentTransaction: - AccountActivityListResponse.PaymentTransaction - ): Optional = - paymentTransaction._token().getOptional("token") + override fun visitPayment(payment: Payment): Optional = + payment._token().getOptional("token") override fun visitExternalPayment( externalPayment: ExternalPayment ): Optional = externalPayment._token().getOptional("token") - override fun visitManagementOperationTransaction( - managementOperationTransaction: ManagementOperationTransaction + override fun visitManagementOperation( + managementOperation: ManagementOperationTransaction ): Optional = - managementOperationTransaction._token().getOptional("token") + managementOperation._token().getOptional("token") } ) ) diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListPageAsync.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListPageAsync.kt index 5fd09f7a0..cc509dfd6 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListPageAsync.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListPageAsync.kt @@ -49,36 +49,29 @@ private constructor( .first() .accept( object : AccountActivityListResponse.Visitor> { - override fun visitFinancialTransaction( - financialTransaction: - AccountActivityListResponse.FinancialTransaction - ): Optional = - financialTransaction._token().getOptional("token") + override fun visitInternal( + internal_: AccountActivityListResponse.FinancialTransaction + ): Optional = internal_._token().getOptional("token") - override fun visitBookTransferTransaction( - bookTransferTransaction: - AccountActivityListResponse.BookTransferTransaction - ): Optional = - bookTransferTransaction._token().getOptional("token") + override fun visitTransfer( + transfer: BookTransferResponse + ): Optional = transfer._token().getOptional("token") - override fun visitCardTransaction( - cardTransaction: AccountActivityListResponse.CardTransaction - ): Optional = cardTransaction._token().getOptional("token") + override fun visitCard( + card: AccountActivityListResponse.CardTransaction + ): Optional = card._token().getOptional("token") - override fun visitPaymentTransaction( - paymentTransaction: - AccountActivityListResponse.PaymentTransaction - ): Optional = - paymentTransaction._token().getOptional("token") + override fun visitPayment(payment: Payment): Optional = + payment._token().getOptional("token") override fun visitExternalPayment( externalPayment: ExternalPayment ): Optional = externalPayment._token().getOptional("token") - override fun visitManagementOperationTransaction( - managementOperationTransaction: ManagementOperationTransaction + override fun visitManagementOperation( + managementOperation: ManagementOperationTransaction ): Optional = - managementOperationTransaction._token().getOptional("token") + managementOperation._token().getOptional("token") } ) ) @@ -91,36 +84,29 @@ private constructor( .last() .accept( object : AccountActivityListResponse.Visitor> { - override fun visitFinancialTransaction( - financialTransaction: - AccountActivityListResponse.FinancialTransaction - ): Optional = - financialTransaction._token().getOptional("token") + override fun visitInternal( + internal_: AccountActivityListResponse.FinancialTransaction + ): Optional = internal_._token().getOptional("token") - override fun visitBookTransferTransaction( - bookTransferTransaction: - AccountActivityListResponse.BookTransferTransaction - ): Optional = - bookTransferTransaction._token().getOptional("token") + override fun visitTransfer( + transfer: BookTransferResponse + ): Optional = transfer._token().getOptional("token") - override fun visitCardTransaction( - cardTransaction: AccountActivityListResponse.CardTransaction - ): Optional = cardTransaction._token().getOptional("token") + override fun visitCard( + card: AccountActivityListResponse.CardTransaction + ): Optional = card._token().getOptional("token") - override fun visitPaymentTransaction( - paymentTransaction: - AccountActivityListResponse.PaymentTransaction - ): Optional = - paymentTransaction._token().getOptional("token") + override fun visitPayment(payment: Payment): Optional = + payment._token().getOptional("token") override fun visitExternalPayment( externalPayment: ExternalPayment ): Optional = externalPayment._token().getOptional("token") - override fun visitManagementOperationTransaction( - managementOperationTransaction: ManagementOperationTransaction + override fun visitManagementOperation( + managementOperation: ManagementOperationTransaction ): Optional = - managementOperationTransaction._token().getOptional("token") + managementOperation._token().getOptional("token") } ) ) diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListPageResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListPageResponse.kt index 79bb4c7d7..29731923e 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListPageResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListPageResponse.kt @@ -127,33 +127,20 @@ private constructor( } } - /** - * Alias for calling [addData] with - * `AccountActivityListResponse.ofFinancialTransaction(financialTransaction)`. - */ - fun addData(financialTransaction: AccountActivityListResponse.FinancialTransaction) = - addData(AccountActivityListResponse.ofFinancialTransaction(financialTransaction)) + /** Alias for calling [addData] with `AccountActivityListResponse.ofInternal(internal_)`. */ + fun addData(internal_: AccountActivityListResponse.FinancialTransaction) = + addData(AccountActivityListResponse.ofInternal(internal_)) - /** - * Alias for calling [addData] with - * `AccountActivityListResponse.ofBookTransferTransaction(bookTransferTransaction)`. - */ - fun addData(bookTransferTransaction: AccountActivityListResponse.BookTransferTransaction) = - addData(AccountActivityListResponse.ofBookTransferTransaction(bookTransferTransaction)) + /** Alias for calling [addData] with `AccountActivityListResponse.ofTransfer(transfer)`. */ + fun addData(transfer: BookTransferResponse) = + addData(AccountActivityListResponse.ofTransfer(transfer)) - /** - * Alias for calling [addData] with - * `AccountActivityListResponse.ofCardTransaction(cardTransaction)`. - */ - fun addData(cardTransaction: AccountActivityListResponse.CardTransaction) = - addData(AccountActivityListResponse.ofCardTransaction(cardTransaction)) + /** Alias for calling [addData] with `AccountActivityListResponse.ofCard(card)`. */ + fun addData(card: AccountActivityListResponse.CardTransaction) = + addData(AccountActivityListResponse.ofCard(card)) - /** - * Alias for calling [addData] with - * `AccountActivityListResponse.ofPaymentTransaction(paymentTransaction)`. - */ - fun addData(paymentTransaction: AccountActivityListResponse.PaymentTransaction) = - addData(AccountActivityListResponse.ofPaymentTransaction(paymentTransaction)) + /** Alias for calling [addData] with `AccountActivityListResponse.ofPayment(payment)`. */ + fun addData(payment: Payment) = addData(AccountActivityListResponse.ofPayment(payment)) /** * Alias for calling [addData] with @@ -164,14 +151,10 @@ private constructor( /** * Alias for calling [addData] with - * `AccountActivityListResponse.ofManagementOperationTransaction(managementOperationTransaction)`. + * `AccountActivityListResponse.ofManagementOperation(managementOperation)`. */ - fun addData(managementOperationTransaction: ManagementOperationTransaction) = - addData( - AccountActivityListResponse.ofManagementOperationTransaction( - managementOperationTransaction - ) - ) + fun addData(managementOperation: ManagementOperationTransaction) = + addData(AccountActivityListResponse.ofManagementOperation(managementOperation)) /** Indicates if there are more transactions available for pagination */ fun hasMore(hasMore: Boolean) = hasMore(JsonField.of(hasMore)) diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListResponse.kt index 62ad82e20..5175793d0 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListResponse.kt @@ -20,96 +20,93 @@ import com.lithic.api.core.ExcludeMissing import com.lithic.api.core.JsonField import com.lithic.api.core.JsonMissing import com.lithic.api.core.JsonValue -import com.lithic.api.core.allMaxBy import com.lithic.api.core.checkKnown import com.lithic.api.core.checkRequired import com.lithic.api.core.getOrThrow import com.lithic.api.core.toImmutable import com.lithic.api.errors.LithicInvalidDataException -import java.time.LocalDate import java.time.OffsetDateTime import java.util.Collections import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Response containing multiple transaction types */ +/** + * Response containing multiple transaction types. The `family` field determines which transaction + * type is returned: INTERNAL returns FinancialTransaction, TRANSFER returns + * BookTransferTransaction, CARD returns CardTransaction, PAYMENT returns PaymentTransaction, + * EXTERNAL_PAYMENT returns ExternalPaymentResponse, and MANAGEMENT_OPERATION returns + * ManagementOperationTransaction + */ @JsonDeserialize(using = AccountActivityListResponse.Deserializer::class) @JsonSerialize(using = AccountActivityListResponse.Serializer::class) class AccountActivityListResponse private constructor( - private val financialTransaction: FinancialTransaction? = null, - private val bookTransferTransaction: BookTransferTransaction? = null, - private val cardTransaction: CardTransaction? = null, - private val paymentTransaction: PaymentTransaction? = null, + private val internal_: FinancialTransaction? = null, + private val transfer: BookTransferResponse? = null, + private val card: CardTransaction? = null, + private val payment: Payment? = null, private val externalPayment: ExternalPayment? = null, - private val managementOperationTransaction: ManagementOperationTransaction? = null, + private val managementOperation: ManagementOperationTransaction? = null, private val _json: JsonValue? = null, ) { /** Financial transaction with inheritance from unified base transaction */ - fun financialTransaction(): Optional = - Optional.ofNullable(financialTransaction) + fun internal_(): Optional = Optional.ofNullable(internal_) /** Book transfer transaction */ - fun bookTransferTransaction(): Optional = - Optional.ofNullable(bookTransferTransaction) + fun transfer(): Optional = Optional.ofNullable(transfer) - /** Base class for all transaction types in the ledger service */ - fun cardTransaction(): Optional = Optional.ofNullable(cardTransaction) + /** Card transaction with ledger base properties */ + fun card(): Optional = Optional.ofNullable(card) /** Payment transaction */ - fun paymentTransaction(): Optional = Optional.ofNullable(paymentTransaction) + fun payment(): Optional = Optional.ofNullable(payment) fun externalPayment(): Optional = Optional.ofNullable(externalPayment) - fun managementOperationTransaction(): Optional = - Optional.ofNullable(managementOperationTransaction) + fun managementOperation(): Optional = + Optional.ofNullable(managementOperation) - fun isFinancialTransaction(): Boolean = financialTransaction != null + fun isInternal(): Boolean = internal_ != null - fun isBookTransferTransaction(): Boolean = bookTransferTransaction != null + fun isTransfer(): Boolean = transfer != null - fun isCardTransaction(): Boolean = cardTransaction != null + fun isCard(): Boolean = card != null - fun isPaymentTransaction(): Boolean = paymentTransaction != null + fun isPayment(): Boolean = payment != null fun isExternalPayment(): Boolean = externalPayment != null - fun isManagementOperationTransaction(): Boolean = managementOperationTransaction != null + fun isManagementOperation(): Boolean = managementOperation != null /** Financial transaction with inheritance from unified base transaction */ - fun asFinancialTransaction(): FinancialTransaction = - financialTransaction.getOrThrow("financialTransaction") + fun asInternal(): FinancialTransaction = internal_.getOrThrow("internal_") /** Book transfer transaction */ - fun asBookTransferTransaction(): BookTransferTransaction = - bookTransferTransaction.getOrThrow("bookTransferTransaction") + fun asTransfer(): BookTransferResponse = transfer.getOrThrow("transfer") - /** Base class for all transaction types in the ledger service */ - fun asCardTransaction(): CardTransaction = cardTransaction.getOrThrow("cardTransaction") + /** Card transaction with ledger base properties */ + fun asCard(): CardTransaction = card.getOrThrow("card") /** Payment transaction */ - fun asPaymentTransaction(): PaymentTransaction = - paymentTransaction.getOrThrow("paymentTransaction") + fun asPayment(): Payment = payment.getOrThrow("payment") fun asExternalPayment(): ExternalPayment = externalPayment.getOrThrow("externalPayment") - fun asManagementOperationTransaction(): ManagementOperationTransaction = - managementOperationTransaction.getOrThrow("managementOperationTransaction") + fun asManagementOperation(): ManagementOperationTransaction = + managementOperation.getOrThrow("managementOperation") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - financialTransaction != null -> visitor.visitFinancialTransaction(financialTransaction) - bookTransferTransaction != null -> - visitor.visitBookTransferTransaction(bookTransferTransaction) - cardTransaction != null -> visitor.visitCardTransaction(cardTransaction) - paymentTransaction != null -> visitor.visitPaymentTransaction(paymentTransaction) + internal_ != null -> visitor.visitInternal(internal_) + transfer != null -> visitor.visitTransfer(transfer) + card != null -> visitor.visitCard(card) + payment != null -> visitor.visitPayment(payment) externalPayment != null -> visitor.visitExternalPayment(externalPayment) - managementOperationTransaction != null -> - visitor.visitManagementOperationTransaction(managementOperationTransaction) + managementOperation != null -> visitor.visitManagementOperation(managementOperation) else -> visitor.unknown(_json) } @@ -122,32 +119,30 @@ private constructor( accept( object : Visitor { - override fun visitFinancialTransaction(financialTransaction: FinancialTransaction) { - financialTransaction.validate() + override fun visitInternal(internal_: FinancialTransaction) { + internal_.validate() } - override fun visitBookTransferTransaction( - bookTransferTransaction: BookTransferTransaction - ) { - bookTransferTransaction.validate() + override fun visitTransfer(transfer: BookTransferResponse) { + transfer.validate() } - override fun visitCardTransaction(cardTransaction: CardTransaction) { - cardTransaction.validate() + override fun visitCard(card: CardTransaction) { + card.validate() } - override fun visitPaymentTransaction(paymentTransaction: PaymentTransaction) { - paymentTransaction.validate() + override fun visitPayment(payment: Payment) { + payment.validate() } override fun visitExternalPayment(externalPayment: ExternalPayment) { externalPayment.validate() } - override fun visitManagementOperationTransaction( - managementOperationTransaction: ManagementOperationTransaction + override fun visitManagementOperation( + managementOperation: ManagementOperationTransaction ) { - managementOperationTransaction.validate() + managementOperation.validate() } } ) @@ -171,25 +166,20 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitFinancialTransaction(financialTransaction: FinancialTransaction) = - financialTransaction.validity() + override fun visitInternal(internal_: FinancialTransaction) = internal_.validity() - override fun visitBookTransferTransaction( - bookTransferTransaction: BookTransferTransaction - ) = bookTransferTransaction.validity() + override fun visitTransfer(transfer: BookTransferResponse) = transfer.validity() - override fun visitCardTransaction(cardTransaction: CardTransaction) = - cardTransaction.validity() + override fun visitCard(card: CardTransaction) = card.validity() - override fun visitPaymentTransaction(paymentTransaction: PaymentTransaction) = - paymentTransaction.validity() + override fun visitPayment(payment: Payment) = payment.validity() override fun visitExternalPayment(externalPayment: ExternalPayment) = externalPayment.validity() - override fun visitManagementOperationTransaction( - managementOperationTransaction: ManagementOperationTransaction - ) = managementOperationTransaction.validity() + override fun visitManagementOperation( + managementOperation: ManagementOperationTransaction + ) = managementOperation.validity() override fun unknown(json: JsonValue?) = 0 } @@ -201,38 +191,27 @@ private constructor( } return other is AccountActivityListResponse && - financialTransaction == other.financialTransaction && - bookTransferTransaction == other.bookTransferTransaction && - cardTransaction == other.cardTransaction && - paymentTransaction == other.paymentTransaction && + internal_ == other.internal_ && + transfer == other.transfer && + card == other.card && + payment == other.payment && externalPayment == other.externalPayment && - managementOperationTransaction == other.managementOperationTransaction + managementOperation == other.managementOperation } override fun hashCode(): Int = - Objects.hash( - financialTransaction, - bookTransferTransaction, - cardTransaction, - paymentTransaction, - externalPayment, - managementOperationTransaction, - ) + Objects.hash(internal_, transfer, card, payment, externalPayment, managementOperation) override fun toString(): String = when { - financialTransaction != null -> - "AccountActivityListResponse{financialTransaction=$financialTransaction}" - bookTransferTransaction != null -> - "AccountActivityListResponse{bookTransferTransaction=$bookTransferTransaction}" - cardTransaction != null -> - "AccountActivityListResponse{cardTransaction=$cardTransaction}" - paymentTransaction != null -> - "AccountActivityListResponse{paymentTransaction=$paymentTransaction}" + internal_ != null -> "AccountActivityListResponse{internal_=$internal_}" + transfer != null -> "AccountActivityListResponse{transfer=$transfer}" + card != null -> "AccountActivityListResponse{card=$card}" + payment != null -> "AccountActivityListResponse{payment=$payment}" externalPayment != null -> "AccountActivityListResponse{externalPayment=$externalPayment}" - managementOperationTransaction != null -> - "AccountActivityListResponse{managementOperationTransaction=$managementOperationTransaction}" + managementOperation != null -> + "AccountActivityListResponse{managementOperation=$managementOperation}" _json != null -> "AccountActivityListResponse{_unknown=$_json}" else -> throw IllegalStateException("Invalid AccountActivityListResponse") } @@ -241,35 +220,27 @@ private constructor( /** Financial transaction with inheritance from unified base transaction */ @JvmStatic - fun ofFinancialTransaction(financialTransaction: FinancialTransaction) = - AccountActivityListResponse(financialTransaction = financialTransaction) + fun ofInternal(internal_: FinancialTransaction) = + AccountActivityListResponse(internal_ = internal_) /** Book transfer transaction */ @JvmStatic - fun ofBookTransferTransaction(bookTransferTransaction: BookTransferTransaction) = - AccountActivityListResponse(bookTransferTransaction = bookTransferTransaction) + fun ofTransfer(transfer: BookTransferResponse) = + AccountActivityListResponse(transfer = transfer) - /** Base class for all transaction types in the ledger service */ - @JvmStatic - fun ofCardTransaction(cardTransaction: CardTransaction) = - AccountActivityListResponse(cardTransaction = cardTransaction) + /** Card transaction with ledger base properties */ + @JvmStatic fun ofCard(card: CardTransaction) = AccountActivityListResponse(card = card) /** Payment transaction */ - @JvmStatic - fun ofPaymentTransaction(paymentTransaction: PaymentTransaction) = - AccountActivityListResponse(paymentTransaction = paymentTransaction) + @JvmStatic fun ofPayment(payment: Payment) = AccountActivityListResponse(payment = payment) @JvmStatic fun ofExternalPayment(externalPayment: ExternalPayment) = AccountActivityListResponse(externalPayment = externalPayment) @JvmStatic - fun ofManagementOperationTransaction( - managementOperationTransaction: ManagementOperationTransaction - ) = - AccountActivityListResponse( - managementOperationTransaction = managementOperationTransaction - ) + fun ofManagementOperation(managementOperation: ManagementOperationTransaction) = + AccountActivityListResponse(managementOperation = managementOperation) } /** @@ -279,22 +250,20 @@ private constructor( interface Visitor { /** Financial transaction with inheritance from unified base transaction */ - fun visitFinancialTransaction(financialTransaction: FinancialTransaction): T + fun visitInternal(internal_: FinancialTransaction): T /** Book transfer transaction */ - fun visitBookTransferTransaction(bookTransferTransaction: BookTransferTransaction): T + fun visitTransfer(transfer: BookTransferResponse): T - /** Base class for all transaction types in the ledger service */ - fun visitCardTransaction(cardTransaction: CardTransaction): T + /** Card transaction with ledger base properties */ + fun visitCard(card: CardTransaction): T /** Payment transaction */ - fun visitPaymentTransaction(paymentTransaction: PaymentTransaction): T + fun visitPayment(payment: Payment): T fun visitExternalPayment(externalPayment: ExternalPayment): T - fun visitManagementOperationTransaction( - managementOperationTransaction: ManagementOperationTransaction - ): T + fun visitManagementOperation(managementOperation: ManagementOperationTransaction): T /** * Maps an unknown variant of [AccountActivityListResponse] to a value of type [T]. @@ -318,45 +287,41 @@ private constructor( val json = JsonValue.fromJsonNode(node) val family = json.asObject().getOrNull()?.get("family")?.asString()?.getOrNull() - when (family) {} - - val bestMatches = - sequenceOf( - tryDeserialize(node, jacksonTypeRef())?.let { - AccountActivityListResponse(financialTransaction = it, _json = json) - }, - tryDeserialize(node, jacksonTypeRef())?.let { - AccountActivityListResponse(bookTransferTransaction = it, _json = json) - }, - tryDeserialize(node, jacksonTypeRef())?.let { - AccountActivityListResponse(cardTransaction = it, _json = json) - }, - tryDeserialize(node, jacksonTypeRef())?.let { - AccountActivityListResponse(paymentTransaction = it, _json = json) - }, - tryDeserialize(node, jacksonTypeRef())?.let { - AccountActivityListResponse(externalPayment = it, _json = json) - }, - tryDeserialize(node, jacksonTypeRef()) - ?.let { - AccountActivityListResponse( - managementOperationTransaction = it, - _json = json, - ) - }, - ) - .filterNotNull() - .allMaxBy { it.validity() } - .toList() - return when (bestMatches.size) { - // This can happen if what we're deserializing is completely incompatible with all - // the possible variants (e.g. deserializing from boolean). - 0 -> AccountActivityListResponse(_json = json) - 1 -> bestMatches.single() - // If there's more than one match with the highest validity, then use the first - // completely valid match, or simply the first match if none are completely valid. - else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first() + when (family) { + "INTERNAL" -> { + return tryDeserialize(node, jacksonTypeRef())?.let { + AccountActivityListResponse(internal_ = it, _json = json) + } ?: AccountActivityListResponse(_json = json) + } + "TRANSFER" -> { + return tryDeserialize(node, jacksonTypeRef())?.let { + AccountActivityListResponse(transfer = it, _json = json) + } ?: AccountActivityListResponse(_json = json) + } + "CARD" -> { + return tryDeserialize(node, jacksonTypeRef())?.let { + AccountActivityListResponse(card = it, _json = json) + } ?: AccountActivityListResponse(_json = json) + } + "PAYMENT" -> { + return tryDeserialize(node, jacksonTypeRef())?.let { + AccountActivityListResponse(payment = it, _json = json) + } ?: AccountActivityListResponse(_json = json) + } + "EXTERNAL_PAYMENT" -> { + return tryDeserialize(node, jacksonTypeRef())?.let { + AccountActivityListResponse(externalPayment = it, _json = json) + } ?: AccountActivityListResponse(_json = json) + } + "MANAGEMENT_OPERATION" -> { + return tryDeserialize(node, jacksonTypeRef()) + ?.let { + AccountActivityListResponse(managementOperation = it, _json = json) + } ?: AccountActivityListResponse(_json = json) + } } + + return AccountActivityListResponse(_json = json) } } @@ -369,15 +334,13 @@ private constructor( provider: SerializerProvider, ) { when { - value.financialTransaction != null -> - generator.writeObject(value.financialTransaction) - value.bookTransferTransaction != null -> - generator.writeObject(value.bookTransferTransaction) - value.cardTransaction != null -> generator.writeObject(value.cardTransaction) - value.paymentTransaction != null -> generator.writeObject(value.paymentTransaction) + value.internal_ != null -> generator.writeObject(value.internal_) + value.transfer != null -> generator.writeObject(value.transfer) + value.card != null -> generator.writeObject(value.card) + value.payment != null -> generator.writeObject(value.payment) value.externalPayment != null -> generator.writeObject(value.externalPayment) - value.managementOperationTransaction != null -> - generator.writeObject(value.managementOperationTransaction) + value.managementOperation != null -> + generator.writeObject(value.managementOperation) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid AccountActivityListResponse") } @@ -394,7 +357,7 @@ private constructor( private val currency: JsonField, private val descriptor: JsonField, private val events: JsonField>, - private val family: JsonField, + private val family: JsonField, private val financialAccountToken: JsonField, private val pendingAmount: JsonField, private val result: JsonField, @@ -422,9 +385,7 @@ private constructor( @JsonProperty("events") @ExcludeMissing events: JsonField> = JsonMissing.of(), - @JsonProperty("family") - @ExcludeMissing - family: JsonField = JsonMissing.of(), + @JsonProperty("family") @ExcludeMissing family: JsonField = JsonMissing.of(), @JsonProperty("financial_account_token") @ExcludeMissing financialAccountToken: JsonField = JsonMissing.of(), @@ -509,10 +470,12 @@ private constructor( fun events(): List = events.getRequired("events") /** + * INTERNAL - Financial Transaction + * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun family(): TransactionFamilyTypes = family.getRequired("family") + fun family(): Family = family.getRequired("family") /** * Financial account token associated with the transaction @@ -616,9 +579,7 @@ private constructor( * * Unlike [family], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("family") - @ExcludeMissing - fun _family(): JsonField = family + @JsonProperty("family") @ExcludeMissing fun _family(): JsonField = family /** * Returns the raw JSON value of [financialAccountToken]. @@ -717,7 +678,7 @@ private constructor( private var currency: JsonField? = null private var descriptor: JsonField? = null private var events: JsonField>? = null - private var family: JsonField? = null + private var family: JsonField? = null private var financialAccountToken: JsonField? = null private var pendingAmount: JsonField? = null private var result: JsonField? = null @@ -832,16 +793,17 @@ private constructor( } } - fun family(family: TransactionFamilyTypes) = family(JsonField.of(family)) + /** INTERNAL - Financial Transaction */ + fun family(family: Family) = family(JsonField.of(family)) /** * Sets [Builder.family] to an arbitrary JSON value. * - * You should usually call [Builder.family] with a well-typed [TransactionFamilyTypes] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * You should usually call [Builder.family] with a well-typed [Family] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun family(family: JsonField) = apply { this.family = family } + fun family(family: JsonField) = apply { this.family = family } /** Financial account token associated with the transaction */ fun financialAccountToken(financialAccountToken: String) = @@ -2253,9 +2215,8 @@ private constructor( "FinancialEvent{token=$token, amount=$amount, created=$created, result=$result, type=$type, additionalProperties=$additionalProperties}" } - class TransactionFamilyTypes - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** INTERNAL - Financial Transaction */ + class Family @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2269,52 +2230,29 @@ private constructor( companion object { - @JvmField val CARD = of("CARD") - - @JvmField val PAYMENT = of("PAYMENT") - - @JvmField val TRANSFER = of("TRANSFER") - @JvmField val INTERNAL = of("INTERNAL") - @JvmField val EXTERNAL_PAYMENT = of("EXTERNAL_PAYMENT") - - @JvmField val MANAGEMENT_OPERATION = of("MANAGEMENT_OPERATION") - - @JvmStatic fun of(value: String) = TransactionFamilyTypes(JsonField.of(value)) + @JvmStatic fun of(value: String) = Family(JsonField.of(value)) } - /** An enum containing [TransactionFamilyTypes]'s known values. */ + /** An enum containing [Family]'s known values. */ enum class Known { - CARD, - PAYMENT, - TRANSFER, - INTERNAL, - EXTERNAL_PAYMENT, - MANAGEMENT_OPERATION, + INTERNAL } /** - * An enum containing [TransactionFamilyTypes]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [Family]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [TransactionFamilyTypes] can contain an unknown value in a couple of - * cases: + * An instance of [Family] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, if * the SDK is on an older version than the API, then the API may respond with new * members that the SDK is unaware of. * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - CARD, - PAYMENT, - TRANSFER, INTERNAL, - EXTERNAL_PAYMENT, - MANAGEMENT_OPERATION, /** - * An enum member indicating that [TransactionFamilyTypes] was instantiated with an - * unknown value. + * An enum member indicating that [Family] was instantiated with an unknown value. */ _UNKNOWN, } @@ -2328,12 +2266,7 @@ private constructor( */ fun value(): Value = when (this) { - CARD -> Value.CARD - PAYMENT -> Value.PAYMENT - TRANSFER -> Value.TRANSFER INTERNAL -> Value.INTERNAL - EXTERNAL_PAYMENT -> Value.EXTERNAL_PAYMENT - MANAGEMENT_OPERATION -> Value.MANAGEMENT_OPERATION else -> Value._UNKNOWN } @@ -2348,14 +2281,8 @@ private constructor( */ fun known(): Known = when (this) { - CARD -> Known.CARD - PAYMENT -> Known.PAYMENT - TRANSFER -> Known.TRANSFER INTERNAL -> Known.INTERNAL - EXTERNAL_PAYMENT -> Known.EXTERNAL_PAYMENT - MANAGEMENT_OPERATION -> Known.MANAGEMENT_OPERATION - else -> - throw LithicInvalidDataException("Unknown TransactionFamilyTypes: $value") + else -> throw LithicInvalidDataException("Unknown Family: $value") } /** @@ -2374,7 +2301,7 @@ private constructor( private var validated: Boolean = false - fun validate(): TransactionFamilyTypes = apply { + fun validate(): Family = apply { if (validated) { return@apply } @@ -2404,7 +2331,7 @@ private constructor( return true } - return other is TransactionFamilyTypes && value == other.value + return other is Family && value == other.value } override fun hashCode() = value.hashCode() @@ -2745,99 +2672,177 @@ private constructor( "FinancialTransaction{token=$token, category=$category, created=$created, currency=$currency, descriptor=$descriptor, events=$events, family=$family, financialAccountToken=$financialAccountToken, pendingAmount=$pendingAmount, result=$result, settledAmount=$settledAmount, status=$status, updated=$updated, additionalProperties=$additionalProperties}" } - /** Book transfer transaction */ - class BookTransferTransaction + /** Card transaction with ledger base properties */ + class CardTransaction @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val token: JsonField, - private val category: JsonField, + private val accountToken: JsonField, + private val acquirerFee: JsonField, + private val acquirerReferenceNumber: JsonField, + private val amount: JsonField, + private val amounts: JsonField, + private val authorizationAmount: JsonField, + private val authorizationCode: JsonField, + private val avs: JsonField, + private val cardToken: JsonField, + private val cardholderAuthentication: JsonField, private val created: JsonField, - private val currency: JsonField, - private val events: JsonField>, - private val family: JsonField, - private val fromFinancialAccountToken: JsonField, - private val pendingAmount: JsonField, - private val result: JsonField, + private val financialAccountToken: JsonField, + private val merchant: JsonField, + private val merchantAmount: JsonField, + private val merchantAuthorizationAmount: JsonField, + private val merchantCurrency: JsonField, + private val network: JsonField, + private val networkRiskScore: JsonField, + private val pos: JsonField, + private val result: JsonField, private val settledAmount: JsonField, - private val status: JsonField, - private val toFinancialAccountToken: JsonField, + private val status: JsonField, + private val tokenInfo: JsonField, private val updated: JsonField, - private val externalId: JsonField, - private val externalResource: JsonField, - private val transactionSeries: JsonField, + private val events: JsonField>, + private val family: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), - @JsonProperty("category") + @JsonProperty("account_token") + @ExcludeMissing + accountToken: JsonField = JsonMissing.of(), + @JsonProperty("acquirer_fee") + @ExcludeMissing + acquirerFee: JsonField = JsonMissing.of(), + @JsonProperty("acquirer_reference_number") + @ExcludeMissing + acquirerReferenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), + @JsonProperty("amounts") + @ExcludeMissing + amounts: JsonField = JsonMissing.of(), + @JsonProperty("authorization_amount") + @ExcludeMissing + authorizationAmount: JsonField = JsonMissing.of(), + @JsonProperty("authorization_code") + @ExcludeMissing + authorizationCode: JsonField = JsonMissing.of(), + @JsonProperty("avs") @ExcludeMissing avs: JsonField = JsonMissing.of(), + @JsonProperty("card_token") + @ExcludeMissing + cardToken: JsonField = JsonMissing.of(), + @JsonProperty("cardholder_authentication") @ExcludeMissing - category: JsonField = JsonMissing.of(), + cardholderAuthentication: JsonField = + JsonMissing.of(), @JsonProperty("created") @ExcludeMissing created: JsonField = JsonMissing.of(), - @JsonProperty("currency") + @JsonProperty("financial_account_token") @ExcludeMissing - currency: JsonField = JsonMissing.of(), - @JsonProperty("events") + financialAccountToken: JsonField = JsonMissing.of(), + @JsonProperty("merchant") @ExcludeMissing - events: JsonField> = JsonMissing.of(), - @JsonProperty("family") + merchant: JsonField = JsonMissing.of(), + @JsonProperty("merchant_amount") @ExcludeMissing - family: JsonField = JsonMissing.of(), - @JsonProperty("from_financial_account_token") + merchantAmount: JsonField = JsonMissing.of(), + @JsonProperty("merchant_authorization_amount") @ExcludeMissing - fromFinancialAccountToken: JsonField = JsonMissing.of(), - @JsonProperty("pending_amount") + merchantAuthorizationAmount: JsonField = JsonMissing.of(), + @JsonProperty("merchant_currency") @ExcludeMissing - pendingAmount: JsonField = JsonMissing.of(), + merchantCurrency: JsonField = JsonMissing.of(), + @JsonProperty("network") + @ExcludeMissing + network: JsonField = JsonMissing.of(), + @JsonProperty("network_risk_score") + @ExcludeMissing + networkRiskScore: JsonField = JsonMissing.of(), + @JsonProperty("pos") @ExcludeMissing pos: JsonField = JsonMissing.of(), @JsonProperty("result") @ExcludeMissing - result: JsonField = JsonMissing.of(), + result: JsonField = JsonMissing.of(), @JsonProperty("settled_amount") @ExcludeMissing settledAmount: JsonField = JsonMissing.of(), @JsonProperty("status") @ExcludeMissing - status: JsonField = JsonMissing.of(), - @JsonProperty("to_financial_account_token") + status: JsonField = JsonMissing.of(), + @JsonProperty("token_info") @ExcludeMissing - toFinancialAccountToken: JsonField = JsonMissing.of(), + tokenInfo: JsonField = JsonMissing.of(), @JsonProperty("updated") @ExcludeMissing updated: JsonField = JsonMissing.of(), - @JsonProperty("external_id") - @ExcludeMissing - externalId: JsonField = JsonMissing.of(), - @JsonProperty("external_resource") - @ExcludeMissing - externalResource: JsonField = JsonMissing.of(), - @JsonProperty("transaction_series") + @JsonProperty("events") @ExcludeMissing - transactionSeries: JsonField = JsonMissing.of(), + events: JsonField> = JsonMissing.of(), + @JsonProperty("family") @ExcludeMissing family: JsonField = JsonMissing.of(), ) : this( token, - category, + accountToken, + acquirerFee, + acquirerReferenceNumber, + amount, + amounts, + authorizationAmount, + authorizationCode, + avs, + cardToken, + cardholderAuthentication, created, - currency, - events, - family, - fromFinancialAccountToken, - pendingAmount, + financialAccountToken, + merchant, + merchantAmount, + merchantAuthorizationAmount, + merchantCurrency, + network, + networkRiskScore, + pos, result, settledAmount, status, - toFinancialAccountToken, + tokenInfo, updated, - externalId, - externalResource, - transactionSeries, + events, + family, mutableMapOf(), ) + fun toTransaction(): Transaction = + Transaction.builder() + .token(token) + .accountToken(accountToken) + .acquirerFee(acquirerFee) + .acquirerReferenceNumber(acquirerReferenceNumber) + .amount(amount) + .amounts(amounts) + .authorizationAmount(authorizationAmount) + .authorizationCode(authorizationCode) + .avs(avs) + .cardToken(cardToken) + .cardholderAuthentication(cardholderAuthentication) + .created(created) + .financialAccountToken(financialAccountToken) + .merchant(merchant) + .merchantAmount(merchantAmount) + .merchantAuthorizationAmount(merchantAuthorizationAmount) + .merchantCurrency(merchantCurrency) + .network(network) + .networkRiskScore(networkRiskScore) + .pos(pos) + .result(result) + .settledAmount(settledAmount) + .status(status) + .tokenInfo(tokenInfo) + .updated(updated) + .events(events) + .build() + /** - * Unique identifier for the transaction + * Globally unique identifier. * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -2845,120 +2850,217 @@ private constructor( fun token(): String = token.getRequired("token") /** + * The token for the account associated with this transaction. + * * @throws LithicInvalidDataException if 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(): BookTransferCategory = category.getRequired("category") + fun accountToken(): String = accountToken.getRequired("account_token") /** - * ISO 8601 timestamp of when the transaction was created + * Fee assessed by the merchant and paid for by the cardholder in the smallest unit of the + * currency. Will be zero if no fee is assessed. Rebates may be transmitted as a negative + * value to indicate credited fees. * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun created(): OffsetDateTime = created.getRequired("created") + fun acquirerFee(): Optional = acquirerFee.getOptional("acquirer_fee") /** - * Currency of the transaction in ISO 4217 format + * Unique identifier assigned to a transaction by the acquirer that can be used in dispute + * and chargeback filing. This field has been deprecated in favor of the + * `acquirer_reference_number` that resides in the event-level `network_info`. * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun currency(): String = currency.getRequired("currency") + @Deprecated("deprecated") + fun acquirerReferenceNumber(): Optional = + acquirerReferenceNumber.getOptional("acquirer_reference_number") /** - * List of events associated with this book transfer + * When the transaction is pending, this represents the authorization amount of the + * transaction in the anticipated settlement currency. Once the transaction has settled, + * this field represents the settled amount in the settlement currency. * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun events(): List = events.getRequired("events") + @Deprecated("deprecated") fun amount(): Long = amount.getRequired("amount") /** * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun family(): TransactionFamilyTypes = family.getRequired("family") + fun amounts(): Transaction.TransactionAmounts = amounts.getRequired("amounts") /** - * Source account token + * The authorization amount of the transaction in the anticipated settlement currency. * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun fromFinancialAccountToken(): String = - fromFinancialAccountToken.getRequired("from_financial_account_token") + @Deprecated("deprecated") + fun authorizationAmount(): Optional = + authorizationAmount.getOptional("authorization_amount") /** - * The pending amount of the transaction in cents + * A fixed-width 6-digit numeric identifier that can be used to identify a transaction with + * networks. * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun pendingAmount(): Long = pendingAmount.getRequired("pending_amount") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun result(): TransactionResult = result.getRequired("result") + fun authorizationCode(): Optional = + authorizationCode.getOptional("authorization_code") /** - * The settled amount of the transaction in cents - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun settledAmount(): Long = settledAmount.getRequired("settled_amount") + fun avs(): Optional = avs.getOptional("avs") /** - * The status of the transaction + * Token for the card used in this transaction. * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun status(): TransactionStatus = status.getRequired("status") + fun cardToken(): String = cardToken.getRequired("card_token") /** - * Destination account token - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun toFinancialAccountToken(): String = - toFinancialAccountToken.getRequired("to_financial_account_token") + fun cardholderAuthentication(): Optional = + cardholderAuthentication.getOptional("cardholder_authentication") /** - * ISO 8601 timestamp of when the transaction was last updated + * Date and time when the transaction first occurred. UTC time zone. * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun updated(): OffsetDateTime = updated.getRequired("updated") + fun created(): OffsetDateTime = created.getRequired("created") /** - * External identifier for the transaction - * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun externalId(): Optional = externalId.getOptional("external_id") + fun financialAccountToken(): Optional = + financialAccountToken.getOptional("financial_account_token") + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun merchant(): Transaction.Merchant = merchant.getRequired("merchant") + + /** + * Analogous to the 'amount', but in the merchant currency. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + @Deprecated("deprecated") + fun merchantAmount(): Optional = merchantAmount.getOptional("merchant_amount") + + /** + * Analogous to the 'authorization_amount', but in the merchant currency. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + @Deprecated("deprecated") + fun merchantAuthorizationAmount(): Optional = + merchantAuthorizationAmount.getOptional("merchant_authorization_amount") + + /** + * 3-character alphabetic ISO 4217 code for the local currency of the transaction. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + @Deprecated("deprecated") + fun merchantCurrency(): String = merchantCurrency.getRequired("merchant_currency") + + /** + * Card network of the authorization. Value is `UNKNOWN` when Lithic cannot determine the + * network code from the upstream provider. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun network(): Optional = network.getOptional("network") + + /** + * Network-provided score assessing risk level associated with a given authorization. Scores + * are on a range of 0-999, with 0 representing the lowest risk and 999 representing the + * highest risk. For Visa transactions, where the raw score has a range of 0-99, Lithic will + * normalize the score by multiplying the raw score by 10x. + * + * @throws LithicInvalidDataException 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") + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun pos(): Transaction.Pos = pos.getRequired("pos") + + /** + * @throws LithicInvalidDataException if 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(): Transaction.DeclineResult = result.getRequired("result") + + /** + * The settled amount of the transaction in the settlement currency. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + @Deprecated("deprecated") + fun settledAmount(): Long = settledAmount.getRequired("settled_amount") + + /** + * Status of the transaction. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun status(): Transaction.Status = status.getRequired("status") + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun tokenInfo(): Optional = tokenInfo.getOptional("token_info") /** - * External resource associated with the management operation + * Date and time when the transaction last updated. UTC time zone. * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun updated(): OffsetDateTime = updated.getRequired("updated") + + /** * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun externalResource(): Optional = - externalResource.getOptional("external_resource") + fun events(): Optional> = events.getOptional("events") /** + * CARD - Card Transaction + * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun transactionSeries(): Optional = - transactionSeries.getOptional("transaction_series") + fun family(): Optional = family.getOptional("family") /** * Returns the raw JSON value of [token]. @@ -2968,216 +3070,361 @@ private constructor( @JsonProperty("token") @ExcludeMissing fun _token(): JsonField = token /** - * Returns the raw JSON value of [category]. + * Returns the raw JSON value of [accountToken]. * - * Unlike [category], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [accountToken], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("category") + @JsonProperty("account_token") @ExcludeMissing - fun _category(): JsonField = category + fun _accountToken(): JsonField = accountToken /** - * Returns the raw JSON value of [created]. + * Returns the raw JSON value of [acquirerFee]. * - * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [acquirerFee], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created + @JsonProperty("acquirer_fee") + @ExcludeMissing + fun _acquirerFee(): JsonField = acquirerFee /** - * Returns the raw JSON value of [currency]. + * Returns the raw JSON value of [acquirerReferenceNumber]. * - * Unlike [currency], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [acquirerReferenceNumber], this method doesn't throw if the JSON field has an + * unexpected type. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency + @Deprecated("deprecated") + @JsonProperty("acquirer_reference_number") + @ExcludeMissing + fun _acquirerReferenceNumber(): JsonField = acquirerReferenceNumber /** - * Returns the raw JSON value of [events]. + * Returns the raw JSON value of [amount]. * - * Unlike [events], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("events") + @Deprecated("deprecated") + @JsonProperty("amount") @ExcludeMissing - fun _events(): JsonField> = events + fun _amount(): JsonField = amount /** - * Returns the raw JSON value of [family]. + * Returns the raw JSON value of [amounts]. * - * Unlike [family], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [amounts], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("family") + @JsonProperty("amounts") @ExcludeMissing - fun _family(): JsonField = family + fun _amounts(): JsonField = amounts /** - * Returns the raw JSON value of [fromFinancialAccountToken]. + * Returns the raw JSON value of [authorizationAmount]. * - * Unlike [fromFinancialAccountToken], this method doesn't throw if the JSON field has an + * Unlike [authorizationAmount], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("from_financial_account_token") + @Deprecated("deprecated") + @JsonProperty("authorization_amount") @ExcludeMissing - fun _fromFinancialAccountToken(): JsonField = fromFinancialAccountToken + fun _authorizationAmount(): JsonField = authorizationAmount /** - * Returns the raw JSON value of [pendingAmount]. + * Returns the raw JSON value of [authorizationCode]. * - * Unlike [pendingAmount], this method doesn't throw if the JSON field has an unexpected + * Unlike [authorizationCode], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("pending_amount") + @JsonProperty("authorization_code") @ExcludeMissing - fun _pendingAmount(): JsonField = pendingAmount + fun _authorizationCode(): JsonField = authorizationCode /** - * Returns the raw JSON value of [result]. + * Returns the raw JSON value of [avs]. * - * Unlike [result], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [avs], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("result") @ExcludeMissing fun _result(): JsonField = result + @JsonProperty("avs") @ExcludeMissing fun _avs(): JsonField = avs /** - * Returns the raw JSON value of [settledAmount]. + * Returns the raw JSON value of [cardToken]. * - * Unlike [settledAmount], this method doesn't throw if the JSON field has an unexpected - * type. + * Unlike [cardToken], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("settled_amount") + @JsonProperty("card_token") @ExcludeMissing fun _cardToken(): JsonField = cardToken + + /** + * Returns the raw JSON value of [cardholderAuthentication]. + * + * Unlike [cardholderAuthentication], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("cardholder_authentication") @ExcludeMissing - fun _settledAmount(): JsonField = settledAmount + fun _cardholderAuthentication(): JsonField = + cardholderAuthentication /** - * Returns the raw JSON value of [status]. + * Returns the raw JSON value of [created]. * - * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created /** - * Returns the raw JSON value of [toFinancialAccountToken]. + * Returns the raw JSON value of [financialAccountToken]. * - * Unlike [toFinancialAccountToken], this method doesn't throw if the JSON field has an + * Unlike [financialAccountToken], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("to_financial_account_token") + @JsonProperty("financial_account_token") @ExcludeMissing - fun _toFinancialAccountToken(): JsonField = toFinancialAccountToken + fun _financialAccountToken(): JsonField = financialAccountToken /** - * Returns the raw JSON value of [updated]. + * Returns the raw JSON value of [merchant]. * - * Unlike [updated], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [merchant], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("updated") @ExcludeMissing fun _updated(): JsonField = updated + @JsonProperty("merchant") + @ExcludeMissing + fun _merchant(): JsonField = merchant /** - * Returns the raw JSON value of [externalId]. + * Returns the raw JSON value of [merchantAmount]. * - * Unlike [externalId], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [merchantAmount], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("external_id") + @Deprecated("deprecated") + @JsonProperty("merchant_amount") @ExcludeMissing - fun _externalId(): JsonField = externalId + fun _merchantAmount(): JsonField = merchantAmount /** - * Returns the raw JSON value of [externalResource]. + * Returns the raw JSON value of [merchantAuthorizationAmount]. * - * Unlike [externalResource], this method doesn't throw if the JSON field has an unexpected - * type. + * Unlike [merchantAuthorizationAmount], this method doesn't throw if the JSON field has an + * unexpected type. */ - @JsonProperty("external_resource") + @Deprecated("deprecated") + @JsonProperty("merchant_authorization_amount") @ExcludeMissing - fun _externalResource(): JsonField = externalResource + fun _merchantAuthorizationAmount(): JsonField = merchantAuthorizationAmount /** - * Returns the raw JSON value of [transactionSeries]. + * Returns the raw JSON value of [merchantCurrency]. * - * Unlike [transactionSeries], this method doesn't throw if the JSON field has an unexpected + * Unlike [merchantCurrency], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("transaction_series") + @Deprecated("deprecated") + @JsonProperty("merchant_currency") @ExcludeMissing - fun _transactionSeries(): JsonField = transactionSeries + fun _merchantCurrency(): JsonField = merchantCurrency - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** + * Returns the raw JSON value of [network]. + * + * Unlike [network], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("network") + @ExcludeMissing + fun _network(): JsonField = network - @JsonAnyGetter + /** + * 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 _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + fun _networkRiskScore(): JsonField = networkRiskScore - fun toBuilder() = Builder().from(this) + /** + * Returns the raw JSON value of [pos]. + * + * Unlike [pos], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("pos") @ExcludeMissing fun _pos(): JsonField = pos - companion object { + /** + * Returns the raw JSON value of [result]. + * + * Unlike [result], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("result") + @ExcludeMissing + fun _result(): JsonField = result - /** - * Returns a mutable builder for constructing an instance of [BookTransferTransaction]. - * - * The following fields are required: - * ```java + /** + * Returns the raw JSON value of [settledAmount]. + * + * Unlike [settledAmount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @Deprecated("deprecated") + @JsonProperty("settled_amount") + @ExcludeMissing + fun _settledAmount(): JsonField = settledAmount + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") + @ExcludeMissing + fun _status(): JsonField = status + + /** + * Returns the raw JSON value of [tokenInfo]. + * + * Unlike [tokenInfo], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("token_info") + @ExcludeMissing + fun _tokenInfo(): JsonField = tokenInfo + + /** + * Returns the raw JSON value of [updated]. + * + * Unlike [updated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("updated") @ExcludeMissing fun _updated(): JsonField = updated + + /** + * Returns the raw JSON value of [events]. + * + * Unlike [events], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("events") + @ExcludeMissing + fun _events(): JsonField> = events + + /** + * Returns the raw JSON value of [family]. + * + * Unlike [family], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("family") @ExcludeMissing fun _family(): JsonField = family + + @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 [CardTransaction]. + * + * The following fields are required: + * ```java * .token() - * .category() + * .accountToken() + * .acquirerFee() + * .acquirerReferenceNumber() + * .amount() + * .amounts() + * .authorizationAmount() + * .authorizationCode() + * .avs() + * .cardToken() + * .cardholderAuthentication() * .created() - * .currency() - * .events() - * .family() - * .fromFinancialAccountToken() - * .pendingAmount() + * .financialAccountToken() + * .merchant() + * .merchantAmount() + * .merchantAuthorizationAmount() + * .merchantCurrency() + * .network() + * .networkRiskScore() + * .pos() * .result() * .settledAmount() * .status() - * .toFinancialAccountToken() + * .tokenInfo() * .updated() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [BookTransferTransaction]. */ + /** A builder for [CardTransaction]. */ class Builder internal constructor() { private var token: JsonField? = null - private var category: JsonField? = null + private var accountToken: JsonField? = null + private var acquirerFee: JsonField? = null + private var acquirerReferenceNumber: JsonField? = null + private var amount: JsonField? = null + private var amounts: JsonField? = null + private var authorizationAmount: JsonField? = null + private var authorizationCode: JsonField? = null + private var avs: JsonField? = null + private var cardToken: JsonField? = null + private var cardholderAuthentication: JsonField? = + null private var created: JsonField? = null - private var currency: JsonField? = null - private var events: JsonField>? = null - private var family: JsonField? = null - private var fromFinancialAccountToken: JsonField? = null - private var pendingAmount: JsonField? = null - private var result: JsonField? = null + private var financialAccountToken: JsonField? = null + private var merchant: JsonField? = null + private var merchantAmount: JsonField? = null + private var merchantAuthorizationAmount: JsonField? = null + private var merchantCurrency: JsonField? = null + private var network: JsonField? = null + private var networkRiskScore: JsonField? = null + private var pos: JsonField? = null + private var result: JsonField? = null private var settledAmount: JsonField? = null - private var status: JsonField? = null - private var toFinancialAccountToken: JsonField? = null + private var status: JsonField? = null + private var tokenInfo: JsonField? = null private var updated: JsonField? = null - private var externalId: JsonField = JsonMissing.of() - private var externalResource: JsonField = JsonMissing.of() - private var transactionSeries: JsonField = JsonMissing.of() + private var events: JsonField>? = null + private var family: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(bookTransferTransaction: BookTransferTransaction) = apply { - token = bookTransferTransaction.token - category = bookTransferTransaction.category - created = bookTransferTransaction.created - currency = bookTransferTransaction.currency - events = bookTransferTransaction.events.map { it.toMutableList() } - family = bookTransferTransaction.family - fromFinancialAccountToken = bookTransferTransaction.fromFinancialAccountToken - pendingAmount = bookTransferTransaction.pendingAmount - result = bookTransferTransaction.result - settledAmount = bookTransferTransaction.settledAmount - status = bookTransferTransaction.status - toFinancialAccountToken = bookTransferTransaction.toFinancialAccountToken - updated = bookTransferTransaction.updated - externalId = bookTransferTransaction.externalId - externalResource = bookTransferTransaction.externalResource - transactionSeries = bookTransferTransaction.transactionSeries - additionalProperties = bookTransferTransaction.additionalProperties.toMutableMap() + internal fun from(cardTransaction: CardTransaction) = apply { + token = cardTransaction.token + accountToken = cardTransaction.accountToken + acquirerFee = cardTransaction.acquirerFee + acquirerReferenceNumber = cardTransaction.acquirerReferenceNumber + amount = cardTransaction.amount + amounts = cardTransaction.amounts + authorizationAmount = cardTransaction.authorizationAmount + authorizationCode = cardTransaction.authorizationCode + avs = cardTransaction.avs + cardToken = cardTransaction.cardToken + cardholderAuthentication = cardTransaction.cardholderAuthentication + created = cardTransaction.created + financialAccountToken = cardTransaction.financialAccountToken + merchant = cardTransaction.merchant + merchantAmount = cardTransaction.merchantAmount + merchantAuthorizationAmount = cardTransaction.merchantAuthorizationAmount + merchantCurrency = cardTransaction.merchantCurrency + network = cardTransaction.network + networkRiskScore = cardTransaction.networkRiskScore + pos = cardTransaction.pos + result = cardTransaction.result + settledAmount = cardTransaction.settledAmount + status = cardTransaction.status + tokenInfo = cardTransaction.tokenInfo + updated = cardTransaction.updated + events = cardTransaction.events.map { it.toMutableList() } + family = cardTransaction.family + additionalProperties = cardTransaction.additionalProperties.toMutableMap() } - /** Unique identifier for the transaction */ + /** Globally unique identifier. */ fun token(token: String) = token(JsonField.of(token)) /** @@ -3189,8719 +3436,681 @@ private constructor( */ fun token(token: JsonField) = apply { this.token = token } - fun category(category: BookTransferCategory) = category(JsonField.of(category)) + /** The token for the account associated with this transaction. */ + fun accountToken(accountToken: String) = accountToken(JsonField.of(accountToken)) /** - * Sets [Builder.category] to an arbitrary JSON value. + * Sets [Builder.accountToken] to an arbitrary JSON value. * - * You should usually call [Builder.category] with a well-typed [BookTransferCategory] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * You should usually call [Builder.accountToken] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun category(category: JsonField) = apply { - this.category = category + fun accountToken(accountToken: JsonField) = apply { + this.accountToken = accountToken } - /** ISO 8601 timestamp of when the transaction was created */ - fun created(created: OffsetDateTime) = created(JsonField.of(created)) + /** + * Fee assessed by the merchant and paid for by the cardholder in the smallest unit of + * the currency. Will be zero if no fee is assessed. Rebates may be transmitted as a + * negative value to indicate credited fees. + */ + fun acquirerFee(acquirerFee: Long?) = acquirerFee(JsonField.ofNullable(acquirerFee)) /** - * Sets [Builder.created] to an arbitrary JSON value. + * Alias for [Builder.acquirerFee]. * - * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * This unboxed primitive overload exists for backwards compatibility. */ - fun created(created: JsonField) = apply { this.created = created } + fun acquirerFee(acquirerFee: Long) = acquirerFee(acquirerFee as Long?) - /** Currency of the transaction in ISO 4217 format */ - fun currency(currency: String) = currency(JsonField.of(currency)) + /** Alias for calling [Builder.acquirerFee] with `acquirerFee.orElse(null)`. */ + fun acquirerFee(acquirerFee: Optional) = acquirerFee(acquirerFee.getOrNull()) /** - * Sets [Builder.currency] to an arbitrary JSON value. + * Sets [Builder.acquirerFee] to an arbitrary JSON value. * - * You should usually call [Builder.currency] with a well-typed [String] value instead. + * You should usually call [Builder.acquirerFee] with a well-typed [Long] 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 acquirerFee(acquirerFee: JsonField) = apply { this.acquirerFee = acquirerFee } + + /** + * Unique identifier assigned to a transaction by the acquirer that can be used in + * dispute and chargeback filing. This field has been deprecated in favor of the + * `acquirer_reference_number` that resides in the event-level `network_info`. + */ + @Deprecated("deprecated") + fun acquirerReferenceNumber(acquirerReferenceNumber: String?) = + acquirerReferenceNumber(JsonField.ofNullable(acquirerReferenceNumber)) - /** List of events associated with this book transfer */ - fun events(events: List) = events(JsonField.of(events)) + /** + * Alias for calling [Builder.acquirerReferenceNumber] with + * `acquirerReferenceNumber.orElse(null)`. + */ + @Deprecated("deprecated") + fun acquirerReferenceNumber(acquirerReferenceNumber: Optional) = + acquirerReferenceNumber(acquirerReferenceNumber.getOrNull()) /** - * Sets [Builder.events] to an arbitrary JSON value. + * Sets [Builder.acquirerReferenceNumber] to an arbitrary JSON value. * - * You should usually call [Builder.events] with a well-typed `List` + * You should usually call [Builder.acquirerReferenceNumber] with a well-typed [String] * value instead. This method is primarily for setting the field to an undocumented or * not yet supported value. */ - fun events(events: JsonField>) = apply { - this.events = events.map { it.toMutableList() } + @Deprecated("deprecated") + fun acquirerReferenceNumber(acquirerReferenceNumber: JsonField) = apply { + this.acquirerReferenceNumber = acquirerReferenceNumber } /** - * Adds a single [BookTransferEvent] to [events]. - * - * @throws IllegalStateException if the field was previously set to a non-list. + * When the transaction is pending, this represents the authorization amount of the + * transaction in the anticipated settlement currency. Once the transaction has settled, + * this field represents the settled amount in the settlement currency. */ - fun addEvent(event: BookTransferEvent) = apply { - events = - (events ?: JsonField.of(mutableListOf())).also { - checkKnown("events", it).add(event) - } - } - - fun family(family: TransactionFamilyTypes) = family(JsonField.of(family)) + @Deprecated("deprecated") fun amount(amount: Long) = amount(JsonField.of(amount)) /** - * Sets [Builder.family] to an arbitrary JSON value. + * Sets [Builder.amount] to an arbitrary JSON value. * - * You should usually call [Builder.family] with a well-typed [TransactionFamilyTypes] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * You should usually call [Builder.amount] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun family(family: JsonField) = apply { this.family = family } + @Deprecated("deprecated") + fun amount(amount: JsonField) = apply { this.amount = amount } - /** Source account token */ - fun fromFinancialAccountToken(fromFinancialAccountToken: String) = - fromFinancialAccountToken(JsonField.of(fromFinancialAccountToken)) + fun amounts(amounts: Transaction.TransactionAmounts) = amounts(JsonField.of(amounts)) /** - * Sets [Builder.fromFinancialAccountToken] to an arbitrary JSON value. + * Sets [Builder.amounts] to an arbitrary JSON value. * - * You should usually call [Builder.fromFinancialAccountToken] with a well-typed - * [String] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * You should usually call [Builder.amounts] with a well-typed + * [Transaction.TransactionAmounts] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. */ - fun fromFinancialAccountToken(fromFinancialAccountToken: JsonField) = apply { - this.fromFinancialAccountToken = fromFinancialAccountToken + fun amounts(amounts: JsonField) = apply { + this.amounts = amounts } - /** The pending amount of the transaction in cents */ - fun pendingAmount(pendingAmount: Long) = pendingAmount(JsonField.of(pendingAmount)) + /** + * The authorization amount of the transaction in the anticipated settlement currency. + */ + @Deprecated("deprecated") + fun authorizationAmount(authorizationAmount: Long?) = + authorizationAmount(JsonField.ofNullable(authorizationAmount)) /** - * Sets [Builder.pendingAmount] to an arbitrary JSON value. + * Alias for [Builder.authorizationAmount]. * - * You should usually call [Builder.pendingAmount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * This unboxed primitive overload exists for backwards compatibility. */ - fun pendingAmount(pendingAmount: JsonField) = apply { - this.pendingAmount = pendingAmount - } + @Deprecated("deprecated") + fun authorizationAmount(authorizationAmount: Long) = + authorizationAmount(authorizationAmount as Long?) - fun result(result: TransactionResult) = result(JsonField.of(result)) + /** + * Alias for calling [Builder.authorizationAmount] with + * `authorizationAmount.orElse(null)`. + */ + @Deprecated("deprecated") + fun authorizationAmount(authorizationAmount: Optional) = + authorizationAmount(authorizationAmount.getOrNull()) /** - * Sets [Builder.result] to an arbitrary JSON value. + * Sets [Builder.authorizationAmount] to an arbitrary JSON value. * - * You should usually call [Builder.result] with a well-typed [TransactionResult] value + * You should usually call [Builder.authorizationAmount] with a well-typed [Long] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun result(result: JsonField) = apply { this.result = result } + @Deprecated("deprecated") + fun authorizationAmount(authorizationAmount: JsonField) = apply { + this.authorizationAmount = authorizationAmount + } - /** The settled amount of the transaction in cents */ - fun settledAmount(settledAmount: Long) = settledAmount(JsonField.of(settledAmount)) + /** + * A fixed-width 6-digit numeric identifier that can be used to identify a transaction + * with networks. + */ + fun authorizationCode(authorizationCode: String?) = + authorizationCode(JsonField.ofNullable(authorizationCode)) /** - * Sets [Builder.settledAmount] to an arbitrary JSON value. + * Alias for calling [Builder.authorizationCode] with `authorizationCode.orElse(null)`. + */ + fun authorizationCode(authorizationCode: Optional) = + authorizationCode(authorizationCode.getOrNull()) + + /** + * Sets [Builder.authorizationCode] to an arbitrary JSON value. * - * You should usually call [Builder.settledAmount] with a well-typed [Long] value + * You should usually call [Builder.authorizationCode] with a well-typed [String] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun settledAmount(settledAmount: JsonField) = apply { - this.settledAmount = settledAmount + fun authorizationCode(authorizationCode: JsonField) = apply { + this.authorizationCode = authorizationCode } - /** The status of the transaction */ - fun status(status: TransactionStatus) = status(JsonField.of(status)) + fun avs(avs: Transaction.Avs?) = avs(JsonField.ofNullable(avs)) + + /** Alias for calling [Builder.avs] with `avs.orElse(null)`. */ + fun avs(avs: Optional) = avs(avs.getOrNull()) /** - * Sets [Builder.status] to an arbitrary JSON value. + * Sets [Builder.avs] to an arbitrary JSON value. * - * You should usually call [Builder.status] with a well-typed [TransactionStatus] value + * You should usually call [Builder.avs] with a well-typed [Transaction.Avs] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun status(status: JsonField) = apply { this.status = status } + fun avs(avs: JsonField) = apply { this.avs = avs } - /** Destination account token */ - fun toFinancialAccountToken(toFinancialAccountToken: String) = - toFinancialAccountToken(JsonField.of(toFinancialAccountToken)) + /** Token for the card used in this transaction. */ + fun cardToken(cardToken: String) = cardToken(JsonField.of(cardToken)) /** - * Sets [Builder.toFinancialAccountToken] to an arbitrary JSON value. + * Sets [Builder.cardToken] to an arbitrary JSON value. * - * You should usually call [Builder.toFinancialAccountToken] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * You should usually call [Builder.cardToken] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun toFinancialAccountToken(toFinancialAccountToken: JsonField) = apply { - this.toFinancialAccountToken = toFinancialAccountToken - } + fun cardToken(cardToken: JsonField) = apply { this.cardToken = cardToken } - /** ISO 8601 timestamp of when the transaction was last updated */ - fun updated(updated: OffsetDateTime) = updated(JsonField.of(updated)) + fun cardholderAuthentication( + cardholderAuthentication: Transaction.CardholderAuthentication? + ) = cardholderAuthentication(JsonField.ofNullable(cardholderAuthentication)) /** - * Sets [Builder.updated] to an arbitrary JSON value. + * Alias for calling [Builder.cardholderAuthentication] with + * `cardholderAuthentication.orElse(null)`. + */ + fun cardholderAuthentication( + cardholderAuthentication: Optional + ) = cardholderAuthentication(cardholderAuthentication.getOrNull()) + + /** + * Sets [Builder.cardholderAuthentication] to an arbitrary JSON value. * - * You should usually call [Builder.updated] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * You should usually call [Builder.cardholderAuthentication] with a well-typed + * [Transaction.CardholderAuthentication] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. */ - fun updated(updated: JsonField) = apply { this.updated = updated } + fun cardholderAuthentication( + cardholderAuthentication: JsonField + ) = apply { this.cardholderAuthentication = cardholderAuthentication } - /** External identifier for the transaction */ - fun externalId(externalId: String) = externalId(JsonField.of(externalId)) + /** Date and time when the transaction first occurred. UTC time zone. */ + fun created(created: OffsetDateTime) = created(JsonField.of(created)) /** - * Sets [Builder.externalId] to an arbitrary JSON value. + * Sets [Builder.created] to an arbitrary JSON value. * - * You should usually call [Builder.externalId] with a well-typed [String] value + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun externalId(externalId: JsonField) = apply { this.externalId = externalId } + fun created(created: JsonField) = apply { this.created = created } - /** External resource associated with the management operation */ - fun externalResource(externalResource: ExternalResource?) = - externalResource(JsonField.ofNullable(externalResource)) + fun financialAccountToken(financialAccountToken: String?) = + financialAccountToken(JsonField.ofNullable(financialAccountToken)) /** - * Alias for calling [Builder.externalResource] with `externalResource.orElse(null)`. + * Alias for calling [Builder.financialAccountToken] with + * `financialAccountToken.orElse(null)`. */ - fun externalResource(externalResource: Optional) = - externalResource(externalResource.getOrNull()) + fun financialAccountToken(financialAccountToken: Optional) = + financialAccountToken(financialAccountToken.getOrNull()) /** - * Sets [Builder.externalResource] to an arbitrary JSON value. + * Sets [Builder.financialAccountToken] to an arbitrary JSON value. * - * You should usually call [Builder.externalResource] with a well-typed - * [ExternalResource] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * You should usually call [Builder.financialAccountToken] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - fun externalResource(externalResource: JsonField) = apply { - this.externalResource = externalResource + fun financialAccountToken(financialAccountToken: JsonField) = apply { + this.financialAccountToken = financialAccountToken } - fun transactionSeries(transactionSeries: TransactionSeries?) = - transactionSeries(JsonField.ofNullable(transactionSeries)) + fun merchant(merchant: Transaction.Merchant) = merchant(JsonField.of(merchant)) /** - * Alias for calling [Builder.transactionSeries] with `transactionSeries.orElse(null)`. + * Sets [Builder.merchant] to an arbitrary JSON value. + * + * You should usually call [Builder.merchant] with a well-typed [Transaction.Merchant] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - fun transactionSeries(transactionSeries: Optional) = - transactionSeries(transactionSeries.getOrNull()) + fun merchant(merchant: JsonField) = apply { + this.merchant = merchant + } + + /** Analogous to the 'amount', but in the merchant currency. */ + @Deprecated("deprecated") + fun merchantAmount(merchantAmount: Long?) = + merchantAmount(JsonField.ofNullable(merchantAmount)) /** - * Sets [Builder.transactionSeries] to an arbitrary JSON value. + * Alias for [Builder.merchantAmount]. * - * You should usually call [Builder.transactionSeries] with a well-typed - * [TransactionSeries] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * This unboxed primitive overload exists for backwards compatibility. */ - fun transactionSeries(transactionSeries: JsonField) = apply { - this.transactionSeries = transactionSeries - } + @Deprecated("deprecated") + fun merchantAmount(merchantAmount: Long) = merchantAmount(merchantAmount as Long?) - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** Alias for calling [Builder.merchantAmount] with `merchantAmount.orElse(null)`. */ + @Deprecated("deprecated") + fun merchantAmount(merchantAmount: Optional) = + merchantAmount(merchantAmount.getOrNull()) - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + /** + * Sets [Builder.merchantAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantAmount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + @Deprecated("deprecated") + fun merchantAmount(merchantAmount: JsonField) = apply { + this.merchantAmount = merchantAmount } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + /** Analogous to the 'authorization_amount', but in the merchant currency. */ + @Deprecated("deprecated") + fun merchantAuthorizationAmount(merchantAuthorizationAmount: Long?) = + merchantAuthorizationAmount(JsonField.ofNullable(merchantAuthorizationAmount)) - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + /** + * Alias for [Builder.merchantAuthorizationAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + @Deprecated("deprecated") + fun merchantAuthorizationAmount(merchantAuthorizationAmount: Long) = + merchantAuthorizationAmount(merchantAuthorizationAmount as Long?) - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** + * Alias for calling [Builder.merchantAuthorizationAmount] with + * `merchantAuthorizationAmount.orElse(null)`. + */ + @Deprecated("deprecated") + fun merchantAuthorizationAmount(merchantAuthorizationAmount: Optional) = + merchantAuthorizationAmount(merchantAuthorizationAmount.getOrNull()) /** - * Returns an immutable instance of [BookTransferTransaction]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .token() - * .category() - * .created() - * .currency() - * .events() - * .family() - * .fromFinancialAccountToken() - * .pendingAmount() - * .result() - * .settledAmount() - * .status() - * .toFinancialAccountToken() - * .updated() - * ``` + * Sets [Builder.merchantAuthorizationAmount] to an arbitrary JSON value. * - * @throws IllegalStateException if any required field is unset. + * You should usually call [Builder.merchantAuthorizationAmount] with a well-typed + * [Long] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ - fun build(): BookTransferTransaction = - BookTransferTransaction( - checkRequired("token", token), - checkRequired("category", category), - checkRequired("created", created), - checkRequired("currency", currency), - checkRequired("events", events).map { it.toImmutable() }, - checkRequired("family", family), - checkRequired("fromFinancialAccountToken", fromFinancialAccountToken), - checkRequired("pendingAmount", pendingAmount), - checkRequired("result", result), - checkRequired("settledAmount", settledAmount), - checkRequired("status", status), - checkRequired("toFinancialAccountToken", toFinancialAccountToken), - checkRequired("updated", updated), - externalId, - externalResource, - transactionSeries, - additionalProperties.toMutableMap(), - ) - } + @Deprecated("deprecated") + fun merchantAuthorizationAmount(merchantAuthorizationAmount: JsonField) = apply { + this.merchantAuthorizationAmount = merchantAuthorizationAmount + } - private var validated: Boolean = false + /** 3-character alphabetic ISO 4217 code for the local currency of the transaction. */ + @Deprecated("deprecated") + fun merchantCurrency(merchantCurrency: String) = + merchantCurrency(JsonField.of(merchantCurrency)) - fun validate(): BookTransferTransaction = apply { - if (validated) { - return@apply + /** + * Sets [Builder.merchantCurrency] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantCurrency] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + @Deprecated("deprecated") + fun merchantCurrency(merchantCurrency: JsonField) = apply { + this.merchantCurrency = merchantCurrency } - token() - category().validate() - created() - currency() - events().forEach { it.validate() } - family().validate() - fromFinancialAccountToken() - pendingAmount() - result().validate() - settledAmount() - status().validate() - toFinancialAccountToken() - updated() - externalId() - externalResource().ifPresent { it.validate() } - transactionSeries().ifPresent { it.validate() } - validated = true - } + /** + * Card network of the authorization. Value is `UNKNOWN` when Lithic cannot determine + * the network code from the upstream provider. + */ + fun network(network: Transaction.Network?) = network(JsonField.ofNullable(network)) - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 (token.asKnown().isPresent) 1 else 0) + - (category.asKnown().getOrNull()?.validity() ?: 0) + - (if (created.asKnown().isPresent) 1 else 0) + - (if (currency.asKnown().isPresent) 1 else 0) + - (events.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (family.asKnown().getOrNull()?.validity() ?: 0) + - (if (fromFinancialAccountToken.asKnown().isPresent) 1 else 0) + - (if (pendingAmount.asKnown().isPresent) 1 else 0) + - (result.asKnown().getOrNull()?.validity() ?: 0) + - (if (settledAmount.asKnown().isPresent) 1 else 0) + - (status.asKnown().getOrNull()?.validity() ?: 0) + - (if (toFinancialAccountToken.asKnown().isPresent) 1 else 0) + - (if (updated.asKnown().isPresent) 1 else 0) + - (if (externalId.asKnown().isPresent) 1 else 0) + - (externalResource.asKnown().getOrNull()?.validity() ?: 0) + - (transactionSeries.asKnown().getOrNull()?.validity() ?: 0) - - class BookTransferCategory - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ADJUSTMENT = of("ADJUSTMENT") - - @JvmField val BALANCE_OR_FUNDING = of("BALANCE_OR_FUNDING") - - @JvmField val DERECOGNITION = of("DERECOGNITION") - - @JvmField val DISPUTE = of("DISPUTE") - - @JvmField val FEE = of("FEE") - - @JvmField val INTERNAL = of("INTERNAL") - - @JvmField val REWARD = of("REWARD") - - @JvmField val PROGRAM_FUNDING = of("PROGRAM_FUNDING") - - @JvmField val TRANSFER = of("TRANSFER") - - @JvmStatic fun of(value: String) = BookTransferCategory(JsonField.of(value)) - } - - /** An enum containing [BookTransferCategory]'s known values. */ - enum class Known { - ADJUSTMENT, - BALANCE_OR_FUNDING, - DERECOGNITION, - DISPUTE, - FEE, - INTERNAL, - REWARD, - PROGRAM_FUNDING, - TRANSFER, - } - - /** - * An enum containing [BookTransferCategory]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [BookTransferCategory] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then 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 { - ADJUSTMENT, - BALANCE_OR_FUNDING, - DERECOGNITION, - DISPUTE, - FEE, - INTERNAL, - REWARD, - PROGRAM_FUNDING, - TRANSFER, - /** - * An enum member indicating that [BookTransferCategory] 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) { - ADJUSTMENT -> Value.ADJUSTMENT - BALANCE_OR_FUNDING -> Value.BALANCE_OR_FUNDING - DERECOGNITION -> Value.DERECOGNITION - DISPUTE -> Value.DISPUTE - FEE -> Value.FEE - INTERNAL -> Value.INTERNAL - REWARD -> Value.REWARD - PROGRAM_FUNDING -> Value.PROGRAM_FUNDING - TRANSFER -> Value.TRANSFER - 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 LithicInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ADJUSTMENT -> Known.ADJUSTMENT - BALANCE_OR_FUNDING -> Known.BALANCE_OR_FUNDING - DERECOGNITION -> Known.DERECOGNITION - DISPUTE -> Known.DISPUTE - FEE -> Known.FEE - INTERNAL -> Known.INTERNAL - REWARD -> Known.REWARD - PROGRAM_FUNDING -> Known.PROGRAM_FUNDING - TRANSFER -> Known.TRANSFER - else -> throw LithicInvalidDataException("Unknown BookTransferCategory: $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 LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): BookTransferCategory = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 BookTransferCategory && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** Book transfer Event */ - class BookTransferEvent - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val token: JsonField, - private val amount: JsonField, - private val created: JsonField, - private val detailedResults: JsonField, - private val memo: JsonField, - private val result: JsonField, - private val subtype: JsonField, - private val type: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), - @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - @JsonProperty("created") - @ExcludeMissing - created: JsonField = JsonMissing.of(), - @JsonProperty("detailed_results") - @ExcludeMissing - detailedResults: JsonField = JsonMissing.of(), - @JsonProperty("memo") @ExcludeMissing memo: JsonField = JsonMissing.of(), - @JsonProperty("result") - @ExcludeMissing - result: JsonField = JsonMissing.of(), - @JsonProperty("subtype") - @ExcludeMissing - subtype: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - type: JsonField = JsonMissing.of(), - ) : this( - token, - amount, - created, - detailedResults, - memo, - result, - subtype, - type, - mutableMapOf(), - ) - - /** - * Globally unique identifier. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun token(): String = token.getRequired("token") - - /** - * Amount of the financial event that has been settled in the currency's smallest unit - * (e.g., cents). - * - * @throws LithicInvalidDataException if 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") - - /** - * Date and time when the financial event occurred. UTC time zone. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun created(): OffsetDateTime = created.getRequired("created") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun detailedResults(): BookTransferDetailedResults = - detailedResults.getRequired("detailed_results") - - /** - * Memo for the transfer. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun memo(): String = memo.getRequired("memo") - - /** - * APPROVED financial events were successful while DECLINED financial events were - * declined by user, Lithic, or the network. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun result(): Result = result.getRequired("result") - - /** - * The program specific subtype code for the specified category/type. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun subtype(): String = subtype.getRequired("subtype") - - /** - * Type of the book transfer - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun type(): BookTransferType = type.getRequired("type") - - /** - * Returns the raw JSON value of [token]. - * - * Unlike [token], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("token") @ExcludeMissing fun _token(): JsonField = token - - /** - * 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 [created]. - * - * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("created") - @ExcludeMissing - fun _created(): JsonField = created - - /** - * Returns the raw JSON value of [detailedResults]. - * - * Unlike [detailedResults], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("detailed_results") - @ExcludeMissing - fun _detailedResults(): JsonField = detailedResults - - /** - * Returns the raw JSON value of [memo]. - * - * Unlike [memo], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("memo") @ExcludeMissing fun _memo(): JsonField = memo - - /** - * 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 - - /** - * Returns the raw JSON value of [subtype]. - * - * Unlike [subtype], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("subtype") @ExcludeMissing fun _subtype(): JsonField = subtype - - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [BookTransferEvent]. - * - * The following fields are required: - * ```java - * .token() - * .amount() - * .created() - * .detailedResults() - * .memo() - * .result() - * .subtype() - * .type() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [BookTransferEvent]. */ - class Builder internal constructor() { - - private var token: JsonField? = null - private var amount: JsonField? = null - private var created: JsonField? = null - private var detailedResults: JsonField? = null - private var memo: JsonField? = null - private var result: JsonField? = null - private var subtype: JsonField? = null - private var type: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(bookTransferEvent: BookTransferEvent) = apply { - token = bookTransferEvent.token - amount = bookTransferEvent.amount - created = bookTransferEvent.created - detailedResults = bookTransferEvent.detailedResults - memo = bookTransferEvent.memo - result = bookTransferEvent.result - subtype = bookTransferEvent.subtype - type = bookTransferEvent.type - additionalProperties = bookTransferEvent.additionalProperties.toMutableMap() - } - - /** Globally unique identifier. */ - fun token(token: String) = token(JsonField.of(token)) - - /** - * Sets [Builder.token] to an arbitrary JSON value. - * - * You should usually call [Builder.token] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun token(token: JsonField) = apply { this.token = token } - - /** - * Amount of the financial event that has been settled in the currency's smallest - * unit (e.g., cents). - */ - fun amount(amount: Long) = amount(JsonField.of(amount)) - - /** - * Sets [Builder.amount] to an arbitrary JSON value. - * - * You should usually call [Builder.amount] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } - - /** Date and time when the financial event occurred. UTC time zone. */ - fun created(created: OffsetDateTime) = created(JsonField.of(created)) - - /** - * Sets [Builder.created] to an arbitrary JSON value. - * - * You should usually call [Builder.created] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun created(created: JsonField) = apply { this.created = created } - - fun detailedResults(detailedResults: BookTransferDetailedResults) = - detailedResults(JsonField.of(detailedResults)) - - /** - * Sets [Builder.detailedResults] to an arbitrary JSON value. - * - * You should usually call [Builder.detailedResults] with a well-typed - * [BookTransferDetailedResults] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. - */ - fun detailedResults(detailedResults: JsonField) = - apply { - this.detailedResults = detailedResults - } - - /** Memo for the transfer. */ - fun memo(memo: String) = memo(JsonField.of(memo)) - - /** - * Sets [Builder.memo] to an arbitrary JSON value. - * - * You should usually call [Builder.memo] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun memo(memo: JsonField) = apply { this.memo = memo } - - /** - * APPROVED financial events were successful while DECLINED financial events were - * declined by user, Lithic, or the 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 } - - /** The program specific subtype code for the specified category/type. */ - fun subtype(subtype: String) = subtype(JsonField.of(subtype)) - - /** - * Sets [Builder.subtype] to an arbitrary JSON value. - * - * You should usually call [Builder.subtype] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun subtype(subtype: JsonField) = apply { this.subtype = subtype } - - /** Type of the book transfer */ - fun type(type: BookTransferType) = type(JsonField.of(type)) - - /** - * Sets [Builder.type] to an arbitrary JSON value. - * - * You should usually call [Builder.type] with a well-typed [BookTransferType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun type(type: JsonField) = apply { this.type = type } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [BookTransferEvent]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .token() - * .amount() - * .created() - * .detailedResults() - * .memo() - * .result() - * .subtype() - * .type() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): BookTransferEvent = - BookTransferEvent( - checkRequired("token", token), - checkRequired("amount", amount), - checkRequired("created", created), - checkRequired("detailedResults", detailedResults), - checkRequired("memo", memo), - checkRequired("result", result), - checkRequired("subtype", subtype), - checkRequired("type", type), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): BookTransferEvent = apply { - if (validated) { - return@apply - } - - token() - amount() - created() - detailedResults().validate() - memo() - result().validate() - subtype() - type().validate() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 (token.asKnown().isPresent) 1 else 0) + - (if (amount.asKnown().isPresent) 1 else 0) + - (if (created.asKnown().isPresent) 1 else 0) + - (detailedResults.asKnown().getOrNull()?.validity() ?: 0) + - (if (memo.asKnown().isPresent) 1 else 0) + - (result.asKnown().getOrNull()?.validity() ?: 0) + - (if (subtype.asKnown().isPresent) 1 else 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) - - class BookTransferDetailedResults - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val APPROVED = of("APPROVED") - - @JvmField val FUNDS_INSUFFICIENT = of("FUNDS_INSUFFICIENT") - - @JvmStatic - fun of(value: String) = BookTransferDetailedResults(JsonField.of(value)) - } - - /** An enum containing [BookTransferDetailedResults]'s known values. */ - enum class Known { - APPROVED, - FUNDS_INSUFFICIENT, - } - - /** - * An enum containing [BookTransferDetailedResults]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [BookTransferDetailedResults] can contain an unknown value in a - * couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then 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 { - APPROVED, - FUNDS_INSUFFICIENT, - /** - * An enum member indicating that [BookTransferDetailedResults] 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) { - APPROVED -> Value.APPROVED - FUNDS_INSUFFICIENT -> Value.FUNDS_INSUFFICIENT - 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 LithicInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - APPROVED -> Known.APPROVED - FUNDS_INSUFFICIENT -> Known.FUNDS_INSUFFICIENT - else -> - throw LithicInvalidDataException( - "Unknown BookTransferDetailedResults: $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 LithicInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): BookTransferDetailedResults = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 BookTransferDetailedResults && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** - * APPROVED financial events were successful while DECLINED financial events were - * declined by user, Lithic, or the 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 { - - @JvmField val APPROVED = of("APPROVED") - - @JvmField val DECLINED = of("DECLINED") - - @JvmStatic fun of(value: String) = Result(JsonField.of(value)) - } - - /** An enum containing [Result]'s known values. */ - enum class Known { - APPROVED, - DECLINED, - } - - /** - * 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 { - APPROVED, - DECLINED, - /** - * 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) { - APPROVED -> Value.APPROVED - DECLINED -> Value.DECLINED - 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 LithicInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - APPROVED -> Known.APPROVED - DECLINED -> Known.DECLINED - else -> throw LithicInvalidDataException("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 LithicInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("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: LithicInvalidDataException) { - 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() - } - - /** Type of the book transfer */ - class BookTransferType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ATM_BALANCE_INQUIRY = of("ATM_BALANCE_INQUIRY") - - @JvmField val ATM_WITHDRAWAL = of("ATM_WITHDRAWAL") - - @JvmField val ATM_DECLINE = of("ATM_DECLINE") - - @JvmField val INTERNATIONAL_ATM_WITHDRAWAL = of("INTERNATIONAL_ATM_WITHDRAWAL") - - @JvmField val INACTIVITY = of("INACTIVITY") - - @JvmField val STATEMENT = of("STATEMENT") - - @JvmField val MONTHLY = of("MONTHLY") - - @JvmField val QUARTERLY = of("QUARTERLY") - - @JvmField val ANNUAL = of("ANNUAL") - - @JvmField val CUSTOMER_SERVICE = of("CUSTOMER_SERVICE") - - @JvmField val ACCOUNT_MAINTENANCE = of("ACCOUNT_MAINTENANCE") - - @JvmField val ACCOUNT_ACTIVATION = of("ACCOUNT_ACTIVATION") - - @JvmField val ACCOUNT_CLOSURE = of("ACCOUNT_CLOSURE") - - @JvmField val CARD_REPLACEMENT = of("CARD_REPLACEMENT") - - @JvmField val CARD_DELIVERY = of("CARD_DELIVERY") - - @JvmField val CARD_CREATE = of("CARD_CREATE") - - @JvmField val CURRENCY_CONVERSION = of("CURRENCY_CONVERSION") - - @JvmField val INTEREST = of("INTEREST") - - @JvmField val LATE_PAYMENT = of("LATE_PAYMENT") - - @JvmField val BILL_PAYMENT = of("BILL_PAYMENT") - - @JvmField val CASH_BACK = of("CASH_BACK") - - @JvmField val ACCOUNT_TO_ACCOUNT = of("ACCOUNT_TO_ACCOUNT") - - @JvmField val CARD_TO_CARD = of("CARD_TO_CARD") - - @JvmField val DISBURSE = of("DISBURSE") - - @JvmField val BILLING_ERROR = of("BILLING_ERROR") - - @JvmField val LOSS_WRITE_OFF = of("LOSS_WRITE_OFF") - - @JvmField val EXPIRED_CARD = of("EXPIRED_CARD") - - @JvmField val EARLY_DERECOGNITION = of("EARLY_DERECOGNITION") - - @JvmField val ESCHEATMENT = of("ESCHEATMENT") - - @JvmField val INACTIVITY_FEE_DOWN = of("INACTIVITY_FEE_DOWN") - - @JvmField val PROVISIONAL_CREDIT = of("PROVISIONAL_CREDIT") - - @JvmField val DISPUTE_WON = of("DISPUTE_WON") - - @JvmField val SERVICE = of("SERVICE") - - @JvmField val TRANSFER = of("TRANSFER") - - @JvmField val COLLECTION = of("COLLECTION") - - @JvmStatic fun of(value: String) = BookTransferType(JsonField.of(value)) - } - - /** An enum containing [BookTransferType]'s known values. */ - enum class Known { - ATM_BALANCE_INQUIRY, - ATM_WITHDRAWAL, - ATM_DECLINE, - INTERNATIONAL_ATM_WITHDRAWAL, - INACTIVITY, - STATEMENT, - MONTHLY, - QUARTERLY, - ANNUAL, - CUSTOMER_SERVICE, - ACCOUNT_MAINTENANCE, - ACCOUNT_ACTIVATION, - ACCOUNT_CLOSURE, - CARD_REPLACEMENT, - CARD_DELIVERY, - CARD_CREATE, - CURRENCY_CONVERSION, - INTEREST, - LATE_PAYMENT, - BILL_PAYMENT, - CASH_BACK, - ACCOUNT_TO_ACCOUNT, - CARD_TO_CARD, - DISBURSE, - BILLING_ERROR, - LOSS_WRITE_OFF, - EXPIRED_CARD, - EARLY_DERECOGNITION, - ESCHEATMENT, - INACTIVITY_FEE_DOWN, - PROVISIONAL_CREDIT, - DISPUTE_WON, - SERVICE, - TRANSFER, - COLLECTION, - } - - /** - * An enum containing [BookTransferType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [BookTransferType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then 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 { - ATM_BALANCE_INQUIRY, - ATM_WITHDRAWAL, - ATM_DECLINE, - INTERNATIONAL_ATM_WITHDRAWAL, - INACTIVITY, - STATEMENT, - MONTHLY, - QUARTERLY, - ANNUAL, - CUSTOMER_SERVICE, - ACCOUNT_MAINTENANCE, - ACCOUNT_ACTIVATION, - ACCOUNT_CLOSURE, - CARD_REPLACEMENT, - CARD_DELIVERY, - CARD_CREATE, - CURRENCY_CONVERSION, - INTEREST, - LATE_PAYMENT, - BILL_PAYMENT, - CASH_BACK, - ACCOUNT_TO_ACCOUNT, - CARD_TO_CARD, - DISBURSE, - BILLING_ERROR, - LOSS_WRITE_OFF, - EXPIRED_CARD, - EARLY_DERECOGNITION, - ESCHEATMENT, - INACTIVITY_FEE_DOWN, - PROVISIONAL_CREDIT, - DISPUTE_WON, - SERVICE, - TRANSFER, - COLLECTION, - /** - * An enum member indicating that [BookTransferType] 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) { - ATM_BALANCE_INQUIRY -> Value.ATM_BALANCE_INQUIRY - ATM_WITHDRAWAL -> Value.ATM_WITHDRAWAL - ATM_DECLINE -> Value.ATM_DECLINE - INTERNATIONAL_ATM_WITHDRAWAL -> Value.INTERNATIONAL_ATM_WITHDRAWAL - INACTIVITY -> Value.INACTIVITY - STATEMENT -> Value.STATEMENT - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ANNUAL -> Value.ANNUAL - CUSTOMER_SERVICE -> Value.CUSTOMER_SERVICE - ACCOUNT_MAINTENANCE -> Value.ACCOUNT_MAINTENANCE - ACCOUNT_ACTIVATION -> Value.ACCOUNT_ACTIVATION - ACCOUNT_CLOSURE -> Value.ACCOUNT_CLOSURE - CARD_REPLACEMENT -> Value.CARD_REPLACEMENT - CARD_DELIVERY -> Value.CARD_DELIVERY - CARD_CREATE -> Value.CARD_CREATE - CURRENCY_CONVERSION -> Value.CURRENCY_CONVERSION - INTEREST -> Value.INTEREST - LATE_PAYMENT -> Value.LATE_PAYMENT - BILL_PAYMENT -> Value.BILL_PAYMENT - CASH_BACK -> Value.CASH_BACK - ACCOUNT_TO_ACCOUNT -> Value.ACCOUNT_TO_ACCOUNT - CARD_TO_CARD -> Value.CARD_TO_CARD - DISBURSE -> Value.DISBURSE - BILLING_ERROR -> Value.BILLING_ERROR - LOSS_WRITE_OFF -> Value.LOSS_WRITE_OFF - EXPIRED_CARD -> Value.EXPIRED_CARD - EARLY_DERECOGNITION -> Value.EARLY_DERECOGNITION - ESCHEATMENT -> Value.ESCHEATMENT - INACTIVITY_FEE_DOWN -> Value.INACTIVITY_FEE_DOWN - PROVISIONAL_CREDIT -> Value.PROVISIONAL_CREDIT - DISPUTE_WON -> Value.DISPUTE_WON - SERVICE -> Value.SERVICE - TRANSFER -> Value.TRANSFER - COLLECTION -> Value.COLLECTION - 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 LithicInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - ATM_BALANCE_INQUIRY -> Known.ATM_BALANCE_INQUIRY - ATM_WITHDRAWAL -> Known.ATM_WITHDRAWAL - ATM_DECLINE -> Known.ATM_DECLINE - INTERNATIONAL_ATM_WITHDRAWAL -> Known.INTERNATIONAL_ATM_WITHDRAWAL - INACTIVITY -> Known.INACTIVITY - STATEMENT -> Known.STATEMENT - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ANNUAL -> Known.ANNUAL - CUSTOMER_SERVICE -> Known.CUSTOMER_SERVICE - ACCOUNT_MAINTENANCE -> Known.ACCOUNT_MAINTENANCE - ACCOUNT_ACTIVATION -> Known.ACCOUNT_ACTIVATION - ACCOUNT_CLOSURE -> Known.ACCOUNT_CLOSURE - CARD_REPLACEMENT -> Known.CARD_REPLACEMENT - CARD_DELIVERY -> Known.CARD_DELIVERY - CARD_CREATE -> Known.CARD_CREATE - CURRENCY_CONVERSION -> Known.CURRENCY_CONVERSION - INTEREST -> Known.INTEREST - LATE_PAYMENT -> Known.LATE_PAYMENT - BILL_PAYMENT -> Known.BILL_PAYMENT - CASH_BACK -> Known.CASH_BACK - ACCOUNT_TO_ACCOUNT -> Known.ACCOUNT_TO_ACCOUNT - CARD_TO_CARD -> Known.CARD_TO_CARD - DISBURSE -> Known.DISBURSE - BILLING_ERROR -> Known.BILLING_ERROR - LOSS_WRITE_OFF -> Known.LOSS_WRITE_OFF - EXPIRED_CARD -> Known.EXPIRED_CARD - EARLY_DERECOGNITION -> Known.EARLY_DERECOGNITION - ESCHEATMENT -> Known.ESCHEATMENT - INACTIVITY_FEE_DOWN -> Known.INACTIVITY_FEE_DOWN - PROVISIONAL_CREDIT -> Known.PROVISIONAL_CREDIT - DISPUTE_WON -> Known.DISPUTE_WON - SERVICE -> Known.SERVICE - TRANSFER -> Known.TRANSFER - COLLECTION -> Known.COLLECTION - else -> throw LithicInvalidDataException("Unknown BookTransferType: $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 LithicInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): BookTransferType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 BookTransferType && 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 BookTransferEvent && - token == other.token && - amount == other.amount && - created == other.created && - detailedResults == other.detailedResults && - memo == other.memo && - result == other.result && - subtype == other.subtype && - type == other.type && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - token, - amount, - created, - detailedResults, - memo, - result, - subtype, - type, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "BookTransferEvent{token=$token, amount=$amount, created=$created, detailedResults=$detailedResults, memo=$memo, result=$result, subtype=$subtype, type=$type, additionalProperties=$additionalProperties}" - } - - class TransactionFamilyTypes - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CARD = of("CARD") - - @JvmField val PAYMENT = of("PAYMENT") - - @JvmField val TRANSFER = of("TRANSFER") - - @JvmField val INTERNAL = of("INTERNAL") - - @JvmField val EXTERNAL_PAYMENT = of("EXTERNAL_PAYMENT") - - @JvmField val MANAGEMENT_OPERATION = of("MANAGEMENT_OPERATION") - - @JvmStatic fun of(value: String) = TransactionFamilyTypes(JsonField.of(value)) - } - - /** An enum containing [TransactionFamilyTypes]'s known values. */ - enum class Known { - CARD, - PAYMENT, - TRANSFER, - INTERNAL, - EXTERNAL_PAYMENT, - MANAGEMENT_OPERATION, - } - - /** - * An enum containing [TransactionFamilyTypes]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [TransactionFamilyTypes] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CARD, - PAYMENT, - TRANSFER, - INTERNAL, - EXTERNAL_PAYMENT, - MANAGEMENT_OPERATION, - /** - * An enum member indicating that [TransactionFamilyTypes] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CARD -> Value.CARD - PAYMENT -> Value.PAYMENT - TRANSFER -> Value.TRANSFER - INTERNAL -> Value.INTERNAL - EXTERNAL_PAYMENT -> Value.EXTERNAL_PAYMENT - MANAGEMENT_OPERATION -> Value.MANAGEMENT_OPERATION - 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 LithicInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - CARD -> Known.CARD - PAYMENT -> Known.PAYMENT - TRANSFER -> Known.TRANSFER - INTERNAL -> Known.INTERNAL - EXTERNAL_PAYMENT -> Known.EXTERNAL_PAYMENT - MANAGEMENT_OPERATION -> Known.MANAGEMENT_OPERATION - else -> - throw LithicInvalidDataException("Unknown TransactionFamilyTypes: $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 LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): TransactionFamilyTypes = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 TransactionFamilyTypes && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - class TransactionResult - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val APPROVED = of("APPROVED") - - @JvmField val DECLINED = of("DECLINED") - - @JvmStatic fun of(value: String) = TransactionResult(JsonField.of(value)) - } - - /** An enum containing [TransactionResult]'s known values. */ - enum class Known { - APPROVED, - DECLINED, - } - - /** - * An enum containing [TransactionResult]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [TransactionResult] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then 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 { - APPROVED, - DECLINED, - /** - * An enum member indicating that [TransactionResult] 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) { - APPROVED -> Value.APPROVED - DECLINED -> Value.DECLINED - 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 LithicInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - APPROVED -> Known.APPROVED - DECLINED -> Known.DECLINED - else -> throw LithicInvalidDataException("Unknown TransactionResult: $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 LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): TransactionResult = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 TransactionResult && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The status of the transaction */ - class TransactionStatus - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val PENDING = of("PENDING") - - @JvmField val SETTLED = of("SETTLED") - - @JvmField val DECLINED = of("DECLINED") - - @JvmField val REVERSED = of("REVERSED") - - @JvmField val CANCELED = of("CANCELED") - - @JvmStatic fun of(value: String) = TransactionStatus(JsonField.of(value)) - } - - /** An enum containing [TransactionStatus]'s known values. */ - enum class Known { - PENDING, - SETTLED, - DECLINED, - REVERSED, - CANCELED, - } - - /** - * An enum containing [TransactionStatus]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [TransactionStatus] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then 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 { - PENDING, - SETTLED, - DECLINED, - REVERSED, - CANCELED, - /** - * An enum member indicating that [TransactionStatus] 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) { - PENDING -> Value.PENDING - SETTLED -> Value.SETTLED - DECLINED -> Value.DECLINED - REVERSED -> Value.REVERSED - CANCELED -> Value.CANCELED - 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 LithicInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - PENDING -> Known.PENDING - SETTLED -> Known.SETTLED - DECLINED -> Known.DECLINED - REVERSED -> Known.REVERSED - CANCELED -> Known.CANCELED - else -> throw LithicInvalidDataException("Unknown TransactionStatus: $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 LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): TransactionStatus = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 TransactionStatus && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - class TransactionSeries - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val relatedTransactionEventToken: JsonField, - private val relatedTransactionToken: JsonField, - private val type: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("related_transaction_event_token") - @ExcludeMissing - relatedTransactionEventToken: JsonField = JsonMissing.of(), - @JsonProperty("related_transaction_token") - @ExcludeMissing - relatedTransactionToken: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - ) : this(relatedTransactionEventToken, relatedTransactionToken, type, mutableMapOf()) - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun relatedTransactionEventToken(): Optional = - relatedTransactionEventToken.getOptional("related_transaction_event_token") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun relatedTransactionToken(): Optional = - relatedTransactionToken.getOptional("related_transaction_token") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun type(): String = type.getRequired("type") - - /** - * Returns the raw JSON value of [relatedTransactionEventToken]. - * - * Unlike [relatedTransactionEventToken], this method doesn't throw if the JSON field - * has an unexpected type. - */ - @JsonProperty("related_transaction_event_token") - @ExcludeMissing - fun _relatedTransactionEventToken(): JsonField = relatedTransactionEventToken - - /** - * Returns the raw JSON value of [relatedTransactionToken]. - * - * Unlike [relatedTransactionToken], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("related_transaction_token") - @ExcludeMissing - fun _relatedTransactionToken(): JsonField = relatedTransactionToken - - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [TransactionSeries]. - * - * The following fields are required: - * ```java - * .relatedTransactionEventToken() - * .relatedTransactionToken() - * .type() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [TransactionSeries]. */ - class Builder internal constructor() { - - private var relatedTransactionEventToken: JsonField? = null - private var relatedTransactionToken: JsonField? = null - private var type: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(transactionSeries: TransactionSeries) = apply { - relatedTransactionEventToken = transactionSeries.relatedTransactionEventToken - relatedTransactionToken = transactionSeries.relatedTransactionToken - type = transactionSeries.type - additionalProperties = transactionSeries.additionalProperties.toMutableMap() - } - - fun relatedTransactionEventToken(relatedTransactionEventToken: String?) = - relatedTransactionEventToken(JsonField.ofNullable(relatedTransactionEventToken)) - - /** - * Alias for calling [Builder.relatedTransactionEventToken] with - * `relatedTransactionEventToken.orElse(null)`. - */ - fun relatedTransactionEventToken(relatedTransactionEventToken: Optional) = - relatedTransactionEventToken(relatedTransactionEventToken.getOrNull()) - - /** - * Sets [Builder.relatedTransactionEventToken] to an arbitrary JSON value. - * - * You should usually call [Builder.relatedTransactionEventToken] with a well-typed - * [String] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun relatedTransactionEventToken(relatedTransactionEventToken: JsonField) = - apply { - this.relatedTransactionEventToken = relatedTransactionEventToken - } - - fun relatedTransactionToken(relatedTransactionToken: String?) = - relatedTransactionToken(JsonField.ofNullable(relatedTransactionToken)) - - /** - * Alias for calling [Builder.relatedTransactionToken] with - * `relatedTransactionToken.orElse(null)`. - */ - fun relatedTransactionToken(relatedTransactionToken: Optional) = - relatedTransactionToken(relatedTransactionToken.getOrNull()) - - /** - * Sets [Builder.relatedTransactionToken] to an arbitrary JSON value. - * - * You should usually call [Builder.relatedTransactionToken] with a well-typed - * [String] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun relatedTransactionToken(relatedTransactionToken: JsonField) = apply { - this.relatedTransactionToken = relatedTransactionToken - } - - fun type(type: String) = type(JsonField.of(type)) - - /** - * Sets [Builder.type] to an arbitrary JSON value. - * - * You should usually call [Builder.type] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun type(type: JsonField) = apply { this.type = type } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [TransactionSeries]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .relatedTransactionEventToken() - * .relatedTransactionToken() - * .type() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): TransactionSeries = - TransactionSeries( - checkRequired("relatedTransactionEventToken", relatedTransactionEventToken), - checkRequired("relatedTransactionToken", relatedTransactionToken), - checkRequired("type", type), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): TransactionSeries = apply { - if (validated) { - return@apply - } - - relatedTransactionEventToken() - relatedTransactionToken() - type() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 (relatedTransactionEventToken.asKnown().isPresent) 1 else 0) + - (if (relatedTransactionToken.asKnown().isPresent) 1 else 0) + - (if (type.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is TransactionSeries && - relatedTransactionEventToken == other.relatedTransactionEventToken && - relatedTransactionToken == other.relatedTransactionToken && - type == other.type && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - relatedTransactionEventToken, - relatedTransactionToken, - type, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "TransactionSeries{relatedTransactionEventToken=$relatedTransactionEventToken, relatedTransactionToken=$relatedTransactionToken, type=$type, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is BookTransferTransaction && - token == other.token && - category == other.category && - created == other.created && - currency == other.currency && - events == other.events && - family == other.family && - fromFinancialAccountToken == other.fromFinancialAccountToken && - pendingAmount == other.pendingAmount && - result == other.result && - settledAmount == other.settledAmount && - status == other.status && - toFinancialAccountToken == other.toFinancialAccountToken && - updated == other.updated && - externalId == other.externalId && - externalResource == other.externalResource && - transactionSeries == other.transactionSeries && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - token, - category, - created, - currency, - events, - family, - fromFinancialAccountToken, - pendingAmount, - result, - settledAmount, - status, - toFinancialAccountToken, - updated, - externalId, - externalResource, - transactionSeries, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "BookTransferTransaction{token=$token, category=$category, created=$created, currency=$currency, events=$events, family=$family, fromFinancialAccountToken=$fromFinancialAccountToken, pendingAmount=$pendingAmount, result=$result, settledAmount=$settledAmount, status=$status, toFinancialAccountToken=$toFinancialAccountToken, updated=$updated, externalId=$externalId, externalResource=$externalResource, transactionSeries=$transactionSeries, additionalProperties=$additionalProperties}" - } - - /** Base class for all transaction types in the ledger service */ - class CardTransaction - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val token: JsonField, - private val accountToken: JsonField, - private val acquirerFee: JsonField, - private val acquirerReferenceNumber: JsonField, - private val amount: JsonField, - private val amounts: JsonField, - private val authorizationAmount: JsonField, - private val authorizationCode: JsonField, - private val avs: JsonField, - private val cardToken: JsonField, - private val cardholderAuthentication: JsonField, - private val created: JsonField, - private val financialAccountToken: JsonField, - private val merchant: JsonField, - private val merchantAmount: JsonField, - private val merchantAuthorizationAmount: JsonField, - private val merchantCurrency: JsonField, - private val network: JsonField, - private val networkRiskScore: JsonField, - private val pos: JsonField, - private val result: JsonField, - private val settledAmount: JsonField, - private val status: JsonField, - private val tokenInfo: JsonField, - private val updated: JsonField, - private val events: JsonField>, - private val family: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), - @JsonProperty("account_token") - @ExcludeMissing - accountToken: JsonField = JsonMissing.of(), - @JsonProperty("acquirer_fee") - @ExcludeMissing - acquirerFee: JsonField = JsonMissing.of(), - @JsonProperty("acquirer_reference_number") - @ExcludeMissing - acquirerReferenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - @JsonProperty("amounts") - @ExcludeMissing - amounts: JsonField = JsonMissing.of(), - @JsonProperty("authorization_amount") - @ExcludeMissing - authorizationAmount: JsonField = JsonMissing.of(), - @JsonProperty("authorization_code") - @ExcludeMissing - authorizationCode: JsonField = JsonMissing.of(), - @JsonProperty("avs") @ExcludeMissing avs: JsonField = JsonMissing.of(), - @JsonProperty("card_token") - @ExcludeMissing - cardToken: JsonField = JsonMissing.of(), - @JsonProperty("cardholder_authentication") - @ExcludeMissing - cardholderAuthentication: JsonField = - JsonMissing.of(), - @JsonProperty("created") - @ExcludeMissing - created: JsonField = JsonMissing.of(), - @JsonProperty("financial_account_token") - @ExcludeMissing - financialAccountToken: JsonField = JsonMissing.of(), - @JsonProperty("merchant") - @ExcludeMissing - merchant: JsonField = JsonMissing.of(), - @JsonProperty("merchant_amount") - @ExcludeMissing - merchantAmount: JsonField = JsonMissing.of(), - @JsonProperty("merchant_authorization_amount") - @ExcludeMissing - merchantAuthorizationAmount: JsonField = JsonMissing.of(), - @JsonProperty("merchant_currency") - @ExcludeMissing - merchantCurrency: JsonField = JsonMissing.of(), - @JsonProperty("network") - @ExcludeMissing - network: JsonField = JsonMissing.of(), - @JsonProperty("network_risk_score") - @ExcludeMissing - networkRiskScore: JsonField = JsonMissing.of(), - @JsonProperty("pos") @ExcludeMissing pos: JsonField = JsonMissing.of(), - @JsonProperty("result") - @ExcludeMissing - result: JsonField = JsonMissing.of(), - @JsonProperty("settled_amount") - @ExcludeMissing - settledAmount: JsonField = JsonMissing.of(), - @JsonProperty("status") - @ExcludeMissing - status: JsonField = JsonMissing.of(), - @JsonProperty("token_info") - @ExcludeMissing - tokenInfo: JsonField = JsonMissing.of(), - @JsonProperty("updated") - @ExcludeMissing - updated: JsonField = JsonMissing.of(), - @JsonProperty("events") - @ExcludeMissing - events: JsonField> = JsonMissing.of(), - @JsonProperty("family") - @ExcludeMissing - family: JsonField = JsonMissing.of(), - ) : this( - token, - accountToken, - acquirerFee, - acquirerReferenceNumber, - amount, - amounts, - authorizationAmount, - authorizationCode, - avs, - cardToken, - cardholderAuthentication, - created, - financialAccountToken, - merchant, - merchantAmount, - merchantAuthorizationAmount, - merchantCurrency, - network, - networkRiskScore, - pos, - result, - settledAmount, - status, - tokenInfo, - updated, - events, - family, - mutableMapOf(), - ) - - fun toTransaction(): Transaction = - Transaction.builder() - .token(token) - .accountToken(accountToken) - .acquirerFee(acquirerFee) - .acquirerReferenceNumber(acquirerReferenceNumber) - .amount(amount) - .amounts(amounts) - .authorizationAmount(authorizationAmount) - .authorizationCode(authorizationCode) - .avs(avs) - .cardToken(cardToken) - .cardholderAuthentication(cardholderAuthentication) - .created(created) - .financialAccountToken(financialAccountToken) - .merchant(merchant) - .merchantAmount(merchantAmount) - .merchantAuthorizationAmount(merchantAuthorizationAmount) - .merchantCurrency(merchantCurrency) - .network(network) - .networkRiskScore(networkRiskScore) - .pos(pos) - .result(result) - .settledAmount(settledAmount) - .status(status) - .tokenInfo(tokenInfo) - .updated(updated) - .events(events) - .build() - - /** - * Globally unique identifier. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun token(): String = token.getRequired("token") - - /** - * The token for the account associated with this transaction. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun accountToken(): String = accountToken.getRequired("account_token") - - /** - * Fee assessed by the merchant and paid for by the cardholder in the smallest unit of the - * currency. Will be zero if no fee is assessed. Rebates may be transmitted as a negative - * value to indicate credited fees. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun acquirerFee(): Optional = acquirerFee.getOptional("acquirer_fee") - - /** - * Unique identifier assigned to a transaction by the acquirer that can be used in dispute - * and chargeback filing. This field has been deprecated in favor of the - * `acquirer_reference_number` that resides in the event-level `network_info`. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - @Deprecated("deprecated") - fun acquirerReferenceNumber(): Optional = - acquirerReferenceNumber.getOptional("acquirer_reference_number") - - /** - * When the transaction is pending, this represents the authorization amount of the - * transaction in the anticipated settlement currency. Once the transaction has settled, - * this field represents the settled amount in the settlement currency. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - @Deprecated("deprecated") fun amount(): Long = amount.getRequired("amount") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun amounts(): Transaction.TransactionAmounts = amounts.getRequired("amounts") - - /** - * The authorization amount of the transaction in the anticipated settlement currency. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - @Deprecated("deprecated") - fun authorizationAmount(): Optional = - authorizationAmount.getOptional("authorization_amount") - - /** - * A fixed-width 6-digit numeric identifier that can be used to identify a transaction with - * networks. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun authorizationCode(): Optional = - authorizationCode.getOptional("authorization_code") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun avs(): Optional = avs.getOptional("avs") - - /** - * Token for the card used in this transaction. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun cardToken(): String = cardToken.getRequired("card_token") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun cardholderAuthentication(): Optional = - cardholderAuthentication.getOptional("cardholder_authentication") - - /** - * Date and time when the transaction first occurred. UTC time zone. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun created(): OffsetDateTime = created.getRequired("created") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun financialAccountToken(): Optional = - financialAccountToken.getOptional("financial_account_token") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun merchant(): Transaction.Merchant = merchant.getRequired("merchant") - - /** - * Analogous to the 'amount', but in the merchant currency. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - @Deprecated("deprecated") - fun merchantAmount(): Optional = merchantAmount.getOptional("merchant_amount") - - /** - * Analogous to the 'authorization_amount', but in the merchant currency. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - @Deprecated("deprecated") - fun merchantAuthorizationAmount(): Optional = - merchantAuthorizationAmount.getOptional("merchant_authorization_amount") - - /** - * 3-character alphabetic ISO 4217 code for the local currency of the transaction. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - @Deprecated("deprecated") - fun merchantCurrency(): String = merchantCurrency.getRequired("merchant_currency") - - /** - * Card network of the authorization. Value is `UNKNOWN` when Lithic cannot determine the - * network code from the upstream provider. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun network(): Optional = network.getOptional("network") - - /** - * Network-provided score assessing risk level associated with a given authorization. Scores - * are on a range of 0-999, with 0 representing the lowest risk and 999 representing the - * highest risk. For Visa transactions, where the raw score has a range of 0-99, Lithic will - * normalize the score by multiplying the raw score by 10x. - * - * @throws LithicInvalidDataException 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") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun pos(): Transaction.Pos = pos.getRequired("pos") - - /** - * @throws LithicInvalidDataException if 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(): Transaction.DeclineResult = result.getRequired("result") - - /** - * The settled amount of the transaction in the settlement currency. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - @Deprecated("deprecated") - fun settledAmount(): Long = settledAmount.getRequired("settled_amount") - - /** - * Status of the transaction. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun status(): Transaction.Status = status.getRequired("status") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun tokenInfo(): Optional = tokenInfo.getOptional("token_info") - - /** - * Date and time when the transaction last updated. UTC time zone. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun updated(): OffsetDateTime = updated.getRequired("updated") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun events(): Optional> = events.getOptional("events") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun family(): TransactionFamilyTypes = family.getRequired("family") - - /** - * Returns the raw JSON value of [token]. - * - * Unlike [token], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("token") @ExcludeMissing fun _token(): JsonField = token - - /** - * Returns the raw JSON value of [accountToken]. - * - * Unlike [accountToken], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("account_token") - @ExcludeMissing - fun _accountToken(): JsonField = accountToken - - /** - * Returns the raw JSON value of [acquirerFee]. - * - * Unlike [acquirerFee], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("acquirer_fee") - @ExcludeMissing - fun _acquirerFee(): JsonField = acquirerFee - - /** - * Returns the raw JSON value of [acquirerReferenceNumber]. - * - * Unlike [acquirerReferenceNumber], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @Deprecated("deprecated") - @JsonProperty("acquirer_reference_number") - @ExcludeMissing - fun _acquirerReferenceNumber(): JsonField = acquirerReferenceNumber - - /** - * Returns the raw JSON value of [amount]. - * - * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. - */ - @Deprecated("deprecated") - @JsonProperty("amount") - @ExcludeMissing - fun _amount(): JsonField = amount - - /** - * Returns the raw JSON value of [amounts]. - * - * Unlike [amounts], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("amounts") - @ExcludeMissing - fun _amounts(): JsonField = amounts - - /** - * Returns the raw JSON value of [authorizationAmount]. - * - * Unlike [authorizationAmount], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @Deprecated("deprecated") - @JsonProperty("authorization_amount") - @ExcludeMissing - fun _authorizationAmount(): JsonField = authorizationAmount - - /** - * Returns the raw JSON value of [authorizationCode]. - * - * Unlike [authorizationCode], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("authorization_code") - @ExcludeMissing - fun _authorizationCode(): JsonField = authorizationCode - - /** - * Returns the raw JSON value of [avs]. - * - * Unlike [avs], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("avs") @ExcludeMissing fun _avs(): JsonField = avs - - /** - * Returns the raw JSON value of [cardToken]. - * - * Unlike [cardToken], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("card_token") @ExcludeMissing fun _cardToken(): JsonField = cardToken - - /** - * Returns the raw JSON value of [cardholderAuthentication]. - * - * Unlike [cardholderAuthentication], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("cardholder_authentication") - @ExcludeMissing - fun _cardholderAuthentication(): JsonField = - cardholderAuthentication - - /** - * Returns the raw JSON value of [created]. - * - * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created - - /** - * Returns the raw JSON value of [financialAccountToken]. - * - * Unlike [financialAccountToken], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("financial_account_token") - @ExcludeMissing - fun _financialAccountToken(): JsonField = financialAccountToken - - /** - * Returns the raw JSON value of [merchant]. - * - * Unlike [merchant], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("merchant") - @ExcludeMissing - fun _merchant(): JsonField = merchant - - /** - * Returns the raw JSON value of [merchantAmount]. - * - * Unlike [merchantAmount], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @Deprecated("deprecated") - @JsonProperty("merchant_amount") - @ExcludeMissing - fun _merchantAmount(): JsonField = merchantAmount - - /** - * Returns the raw JSON value of [merchantAuthorizationAmount]. - * - * Unlike [merchantAuthorizationAmount], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @Deprecated("deprecated") - @JsonProperty("merchant_authorization_amount") - @ExcludeMissing - fun _merchantAuthorizationAmount(): JsonField = merchantAuthorizationAmount - - /** - * Returns the raw JSON value of [merchantCurrency]. - * - * Unlike [merchantCurrency], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @Deprecated("deprecated") - @JsonProperty("merchant_currency") - @ExcludeMissing - fun _merchantCurrency(): JsonField = merchantCurrency - - /** - * Returns the raw JSON value of [network]. - * - * Unlike [network], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("network") - @ExcludeMissing - fun _network(): JsonField = network - - /** - * Returns the raw JSON value of [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 [pos]. - * - * Unlike [pos], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("pos") @ExcludeMissing fun _pos(): JsonField = pos - - /** - * 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 - - /** - * Returns the raw JSON value of [settledAmount]. - * - * Unlike [settledAmount], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @Deprecated("deprecated") - @JsonProperty("settled_amount") - @ExcludeMissing - fun _settledAmount(): JsonField = settledAmount - - /** - * Returns the raw JSON value of [status]. - * - * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("status") - @ExcludeMissing - fun _status(): JsonField = status - - /** - * Returns the raw JSON value of [tokenInfo]. - * - * Unlike [tokenInfo], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("token_info") - @ExcludeMissing - fun _tokenInfo(): JsonField = tokenInfo - - /** - * Returns the raw JSON value of [updated]. - * - * Unlike [updated], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("updated") @ExcludeMissing fun _updated(): JsonField = updated - - /** - * Returns the raw JSON value of [events]. - * - * Unlike [events], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("events") - @ExcludeMissing - fun _events(): JsonField> = events - - /** - * Returns the raw JSON value of [family]. - * - * Unlike [family], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("family") - @ExcludeMissing - fun _family(): JsonField = family - - @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 [CardTransaction]. - * - * The following fields are required: - * ```java - * .token() - * .accountToken() - * .acquirerFee() - * .acquirerReferenceNumber() - * .amount() - * .amounts() - * .authorizationAmount() - * .authorizationCode() - * .avs() - * .cardToken() - * .cardholderAuthentication() - * .created() - * .financialAccountToken() - * .merchant() - * .merchantAmount() - * .merchantAuthorizationAmount() - * .merchantCurrency() - * .network() - * .networkRiskScore() - * .pos() - * .result() - * .settledAmount() - * .status() - * .tokenInfo() - * .updated() - * .family() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CardTransaction]. */ - class Builder internal constructor() { - - private var token: JsonField? = null - private var accountToken: JsonField? = null - private var acquirerFee: JsonField? = null - private var acquirerReferenceNumber: JsonField? = null - private var amount: JsonField? = null - private var amounts: JsonField? = null - private var authorizationAmount: JsonField? = null - private var authorizationCode: JsonField? = null - private var avs: JsonField? = null - private var cardToken: JsonField? = null - private var cardholderAuthentication: JsonField? = - null - private var created: JsonField? = null - private var financialAccountToken: JsonField? = null - private var merchant: JsonField? = null - private var merchantAmount: JsonField? = null - private var merchantAuthorizationAmount: JsonField? = null - private var merchantCurrency: JsonField? = null - private var network: JsonField? = null - private var networkRiskScore: JsonField? = null - private var pos: JsonField? = null - private var result: JsonField? = null - private var settledAmount: JsonField? = null - private var status: JsonField? = null - private var tokenInfo: JsonField? = null - private var updated: JsonField? = null - private var events: JsonField>? = null - private var family: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(cardTransaction: CardTransaction) = apply { - token = cardTransaction.token - accountToken = cardTransaction.accountToken - acquirerFee = cardTransaction.acquirerFee - acquirerReferenceNumber = cardTransaction.acquirerReferenceNumber - amount = cardTransaction.amount - amounts = cardTransaction.amounts - authorizationAmount = cardTransaction.authorizationAmount - authorizationCode = cardTransaction.authorizationCode - avs = cardTransaction.avs - cardToken = cardTransaction.cardToken - cardholderAuthentication = cardTransaction.cardholderAuthentication - created = cardTransaction.created - financialAccountToken = cardTransaction.financialAccountToken - merchant = cardTransaction.merchant - merchantAmount = cardTransaction.merchantAmount - merchantAuthorizationAmount = cardTransaction.merchantAuthorizationAmount - merchantCurrency = cardTransaction.merchantCurrency - network = cardTransaction.network - networkRiskScore = cardTransaction.networkRiskScore - pos = cardTransaction.pos - result = cardTransaction.result - settledAmount = cardTransaction.settledAmount - status = cardTransaction.status - tokenInfo = cardTransaction.tokenInfo - updated = cardTransaction.updated - events = cardTransaction.events.map { it.toMutableList() } - family = cardTransaction.family - additionalProperties = cardTransaction.additionalProperties.toMutableMap() - } - - /** Globally unique identifier. */ - fun token(token: String) = token(JsonField.of(token)) - - /** - * Sets [Builder.token] to an arbitrary JSON value. - * - * You should usually call [Builder.token] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun token(token: JsonField) = apply { this.token = token } - - /** The token for the account associated with this transaction. */ - fun accountToken(accountToken: String) = accountToken(JsonField.of(accountToken)) - - /** - * Sets [Builder.accountToken] to an arbitrary JSON value. - * - * You should usually call [Builder.accountToken] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun accountToken(accountToken: JsonField) = apply { - this.accountToken = accountToken - } - - /** - * Fee assessed by the merchant and paid for by the cardholder in the smallest unit of - * the currency. Will be zero if no fee is assessed. Rebates may be transmitted as a - * negative value to indicate credited fees. - */ - fun acquirerFee(acquirerFee: Long?) = acquirerFee(JsonField.ofNullable(acquirerFee)) - - /** - * Alias for [Builder.acquirerFee]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun acquirerFee(acquirerFee: Long) = acquirerFee(acquirerFee as Long?) - - /** Alias for calling [Builder.acquirerFee] with `acquirerFee.orElse(null)`. */ - fun acquirerFee(acquirerFee: Optional) = acquirerFee(acquirerFee.getOrNull()) - - /** - * Sets [Builder.acquirerFee] to an arbitrary JSON value. - * - * You should usually call [Builder.acquirerFee] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun acquirerFee(acquirerFee: JsonField) = apply { this.acquirerFee = acquirerFee } - - /** - * Unique identifier assigned to a transaction by the acquirer that can be used in - * dispute and chargeback filing. This field has been deprecated in favor of the - * `acquirer_reference_number` that resides in the event-level `network_info`. - */ - @Deprecated("deprecated") - fun acquirerReferenceNumber(acquirerReferenceNumber: String?) = - acquirerReferenceNumber(JsonField.ofNullable(acquirerReferenceNumber)) - - /** - * Alias for calling [Builder.acquirerReferenceNumber] with - * `acquirerReferenceNumber.orElse(null)`. - */ - @Deprecated("deprecated") - fun acquirerReferenceNumber(acquirerReferenceNumber: Optional) = - acquirerReferenceNumber(acquirerReferenceNumber.getOrNull()) - - /** - * Sets [Builder.acquirerReferenceNumber] to an arbitrary JSON value. - * - * You should usually call [Builder.acquirerReferenceNumber] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - @Deprecated("deprecated") - fun acquirerReferenceNumber(acquirerReferenceNumber: JsonField) = apply { - this.acquirerReferenceNumber = acquirerReferenceNumber - } - - /** - * When the transaction is pending, this represents the authorization amount of the - * transaction in the anticipated settlement currency. Once the transaction has settled, - * this field represents the settled amount in the settlement currency. - */ - @Deprecated("deprecated") 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. - */ - @Deprecated("deprecated") - fun amount(amount: JsonField) = apply { this.amount = amount } - - fun amounts(amounts: Transaction.TransactionAmounts) = amounts(JsonField.of(amounts)) - - /** - * Sets [Builder.amounts] to an arbitrary JSON value. - * - * You should usually call [Builder.amounts] with a well-typed - * [Transaction.TransactionAmounts] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. - */ - fun amounts(amounts: JsonField) = apply { - this.amounts = amounts - } - - /** - * The authorization amount of the transaction in the anticipated settlement currency. - */ - @Deprecated("deprecated") - fun authorizationAmount(authorizationAmount: Long?) = - authorizationAmount(JsonField.ofNullable(authorizationAmount)) - - /** - * Alias for [Builder.authorizationAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - @Deprecated("deprecated") - fun authorizationAmount(authorizationAmount: Long) = - authorizationAmount(authorizationAmount as Long?) - - /** - * Alias for calling [Builder.authorizationAmount] with - * `authorizationAmount.orElse(null)`. - */ - @Deprecated("deprecated") - fun authorizationAmount(authorizationAmount: Optional) = - authorizationAmount(authorizationAmount.getOrNull()) - - /** - * Sets [Builder.authorizationAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.authorizationAmount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - @Deprecated("deprecated") - fun authorizationAmount(authorizationAmount: JsonField) = apply { - this.authorizationAmount = authorizationAmount - } - - /** - * A fixed-width 6-digit numeric identifier that can be used to identify a transaction - * with networks. - */ - fun authorizationCode(authorizationCode: String?) = - authorizationCode(JsonField.ofNullable(authorizationCode)) - - /** - * Alias for calling [Builder.authorizationCode] with `authorizationCode.orElse(null)`. - */ - fun authorizationCode(authorizationCode: Optional) = - authorizationCode(authorizationCode.getOrNull()) - - /** - * Sets [Builder.authorizationCode] to an arbitrary JSON value. - * - * You should usually call [Builder.authorizationCode] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun authorizationCode(authorizationCode: JsonField) = apply { - this.authorizationCode = authorizationCode - } - - fun avs(avs: Transaction.Avs?) = avs(JsonField.ofNullable(avs)) - - /** Alias for calling [Builder.avs] with `avs.orElse(null)`. */ - fun avs(avs: Optional) = avs(avs.getOrNull()) - - /** - * Sets [Builder.avs] to an arbitrary JSON value. - * - * You should usually call [Builder.avs] with a well-typed [Transaction.Avs] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun avs(avs: JsonField) = apply { this.avs = avs } - - /** Token for the card used in this transaction. */ - fun cardToken(cardToken: String) = cardToken(JsonField.of(cardToken)) - - /** - * Sets [Builder.cardToken] to an arbitrary JSON value. - * - * You should usually call [Builder.cardToken] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun cardToken(cardToken: JsonField) = apply { this.cardToken = cardToken } - - fun cardholderAuthentication( - cardholderAuthentication: Transaction.CardholderAuthentication? - ) = cardholderAuthentication(JsonField.ofNullable(cardholderAuthentication)) - - /** - * Alias for calling [Builder.cardholderAuthentication] with - * `cardholderAuthentication.orElse(null)`. - */ - fun cardholderAuthentication( - cardholderAuthentication: Optional - ) = cardholderAuthentication(cardholderAuthentication.getOrNull()) - - /** - * Sets [Builder.cardholderAuthentication] to an arbitrary JSON value. - * - * You should usually call [Builder.cardholderAuthentication] with a well-typed - * [Transaction.CardholderAuthentication] value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. - */ - fun cardholderAuthentication( - cardholderAuthentication: JsonField - ) = apply { this.cardholderAuthentication = cardholderAuthentication } - - /** Date and time when the transaction first occurred. UTC time zone. */ - fun created(created: OffsetDateTime) = created(JsonField.of(created)) - - /** - * Sets [Builder.created] to an arbitrary JSON value. - * - * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun created(created: JsonField) = apply { this.created = created } - - fun financialAccountToken(financialAccountToken: String?) = - financialAccountToken(JsonField.ofNullable(financialAccountToken)) - - /** - * Alias for calling [Builder.financialAccountToken] with - * `financialAccountToken.orElse(null)`. - */ - fun financialAccountToken(financialAccountToken: Optional) = - financialAccountToken(financialAccountToken.getOrNull()) - - /** - * Sets [Builder.financialAccountToken] to an arbitrary JSON value. - * - * You should usually call [Builder.financialAccountToken] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun financialAccountToken(financialAccountToken: JsonField) = apply { - this.financialAccountToken = financialAccountToken - } - - fun merchant(merchant: Transaction.Merchant) = merchant(JsonField.of(merchant)) - - /** - * Sets [Builder.merchant] to an arbitrary JSON value. - * - * You should usually call [Builder.merchant] with a well-typed [Transaction.Merchant] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun merchant(merchant: JsonField) = apply { - this.merchant = merchant - } - - /** Analogous to the 'amount', but in the merchant currency. */ - @Deprecated("deprecated") - fun merchantAmount(merchantAmount: Long?) = - merchantAmount(JsonField.ofNullable(merchantAmount)) - - /** - * Alias for [Builder.merchantAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - @Deprecated("deprecated") - fun merchantAmount(merchantAmount: Long) = merchantAmount(merchantAmount as Long?) - - /** Alias for calling [Builder.merchantAmount] with `merchantAmount.orElse(null)`. */ - @Deprecated("deprecated") - fun merchantAmount(merchantAmount: Optional) = - merchantAmount(merchantAmount.getOrNull()) - - /** - * Sets [Builder.merchantAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.merchantAmount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - @Deprecated("deprecated") - fun merchantAmount(merchantAmount: JsonField) = apply { - this.merchantAmount = merchantAmount - } - - /** Analogous to the 'authorization_amount', but in the merchant currency. */ - @Deprecated("deprecated") - fun merchantAuthorizationAmount(merchantAuthorizationAmount: Long?) = - merchantAuthorizationAmount(JsonField.ofNullable(merchantAuthorizationAmount)) - - /** - * Alias for [Builder.merchantAuthorizationAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - @Deprecated("deprecated") - fun merchantAuthorizationAmount(merchantAuthorizationAmount: Long) = - merchantAuthorizationAmount(merchantAuthorizationAmount as Long?) - - /** - * Alias for calling [Builder.merchantAuthorizationAmount] with - * `merchantAuthorizationAmount.orElse(null)`. - */ - @Deprecated("deprecated") - fun merchantAuthorizationAmount(merchantAuthorizationAmount: Optional) = - merchantAuthorizationAmount(merchantAuthorizationAmount.getOrNull()) - - /** - * Sets [Builder.merchantAuthorizationAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.merchantAuthorizationAmount] with a well-typed - * [Long] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - @Deprecated("deprecated") - fun merchantAuthorizationAmount(merchantAuthorizationAmount: JsonField) = apply { - this.merchantAuthorizationAmount = merchantAuthorizationAmount - } - - /** 3-character alphabetic ISO 4217 code for the local currency of the transaction. */ - @Deprecated("deprecated") - fun merchantCurrency(merchantCurrency: String) = - merchantCurrency(JsonField.of(merchantCurrency)) - - /** - * Sets [Builder.merchantCurrency] to an arbitrary JSON value. - * - * You should usually call [Builder.merchantCurrency] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - @Deprecated("deprecated") - fun merchantCurrency(merchantCurrency: JsonField) = apply { - this.merchantCurrency = merchantCurrency - } - - /** - * Card network of the authorization. Value is `UNKNOWN` when Lithic cannot determine - * the network code from the upstream provider. - */ - fun network(network: Transaction.Network?) = network(JsonField.ofNullable(network)) - - /** Alias for calling [Builder.network] with `network.orElse(null)`. */ - fun network(network: Optional) = network(network.getOrNull()) - - /** - * Sets [Builder.network] to an arbitrary JSON value. - * - * You should usually call [Builder.network] with a well-typed [Transaction.Network] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun network(network: JsonField) = apply { this.network = network } - - /** - * Network-provided score assessing risk level associated with a given authorization. - * Scores are on a range of 0-999, with 0 representing the lowest risk and 999 - * representing the highest risk. For Visa transactions, where the raw score has a range - * of 0-99, Lithic will normalize the score by multiplying the raw score by 10x. - */ - 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 - } - - fun pos(pos: Transaction.Pos) = pos(JsonField.of(pos)) - - /** - * Sets [Builder.pos] to an arbitrary JSON value. - * - * You should usually call [Builder.pos] with a well-typed [Transaction.Pos] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun pos(pos: JsonField) = apply { this.pos = pos } - - fun result(result: Transaction.DeclineResult) = result(JsonField.of(result)) - - /** - * Sets [Builder.result] to an arbitrary JSON value. - * - * You should usually call [Builder.result] with a well-typed - * [Transaction.DeclineResult] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun result(result: JsonField) = apply { - this.result = result - } - - /** The settled amount of the transaction in the settlement currency. */ - @Deprecated("deprecated") - fun settledAmount(settledAmount: Long) = settledAmount(JsonField.of(settledAmount)) - - /** - * Sets [Builder.settledAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.settledAmount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - @Deprecated("deprecated") - fun settledAmount(settledAmount: JsonField) = apply { - this.settledAmount = settledAmount - } - - /** Status of the transaction. */ - fun status(status: Transaction.Status) = status(JsonField.of(status)) - - /** - * Sets [Builder.status] to an arbitrary JSON value. - * - * You should usually call [Builder.status] with a well-typed [Transaction.Status] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun status(status: JsonField) = apply { this.status = status } - - fun tokenInfo(tokenInfo: Transaction.TokenInfo?) = - tokenInfo(JsonField.ofNullable(tokenInfo)) - - /** Alias for calling [Builder.tokenInfo] with `tokenInfo.orElse(null)`. */ - fun tokenInfo(tokenInfo: Optional) = - tokenInfo(tokenInfo.getOrNull()) - - /** - * Sets [Builder.tokenInfo] to an arbitrary JSON value. - * - * You should usually call [Builder.tokenInfo] with a well-typed [Transaction.TokenInfo] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun tokenInfo(tokenInfo: JsonField) = apply { - this.tokenInfo = tokenInfo - } - - /** Date and time when the transaction last updated. UTC time zone. */ - fun updated(updated: OffsetDateTime) = updated(JsonField.of(updated)) - - /** - * Sets [Builder.updated] to an arbitrary JSON value. - * - * You should usually call [Builder.updated] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun updated(updated: JsonField) = apply { this.updated = updated } - - fun events(events: List) = events(JsonField.of(events)) - - /** - * Sets [Builder.events] to an arbitrary JSON value. - * - * You should usually call [Builder.events] with a well-typed - * `List` value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. - */ - fun events(events: JsonField>) = apply { - this.events = events.map { it.toMutableList() } - } - - /** - * Adds a single [Transaction.TransactionEvent] to [events]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addEvent(event: Transaction.TransactionEvent) = apply { - events = - (events ?: JsonField.of(mutableListOf())).also { - checkKnown("events", it).add(event) - } - } - - fun family(family: TransactionFamilyTypes) = family(JsonField.of(family)) - - /** - * Sets [Builder.family] to an arbitrary JSON value. - * - * You should usually call [Builder.family] with a well-typed [TransactionFamilyTypes] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun family(family: JsonField) = apply { this.family = family } - - 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 [CardTransaction]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .token() - * .accountToken() - * .acquirerFee() - * .acquirerReferenceNumber() - * .amount() - * .amounts() - * .authorizationAmount() - * .authorizationCode() - * .avs() - * .cardToken() - * .cardholderAuthentication() - * .created() - * .financialAccountToken() - * .merchant() - * .merchantAmount() - * .merchantAuthorizationAmount() - * .merchantCurrency() - * .network() - * .networkRiskScore() - * .pos() - * .result() - * .settledAmount() - * .status() - * .tokenInfo() - * .updated() - * .family() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CardTransaction = - CardTransaction( - checkRequired("token", token), - checkRequired("accountToken", accountToken), - checkRequired("acquirerFee", acquirerFee), - checkRequired("acquirerReferenceNumber", acquirerReferenceNumber), - checkRequired("amount", amount), - checkRequired("amounts", amounts), - checkRequired("authorizationAmount", authorizationAmount), - checkRequired("authorizationCode", authorizationCode), - checkRequired("avs", avs), - checkRequired("cardToken", cardToken), - checkRequired("cardholderAuthentication", cardholderAuthentication), - checkRequired("created", created), - checkRequired("financialAccountToken", financialAccountToken), - checkRequired("merchant", merchant), - checkRequired("merchantAmount", merchantAmount), - checkRequired("merchantAuthorizationAmount", merchantAuthorizationAmount), - checkRequired("merchantCurrency", merchantCurrency), - checkRequired("network", network), - checkRequired("networkRiskScore", networkRiskScore), - checkRequired("pos", pos), - checkRequired("result", result), - checkRequired("settledAmount", settledAmount), - checkRequired("status", status), - checkRequired("tokenInfo", tokenInfo), - checkRequired("updated", updated), - (events ?: JsonMissing.of()).map { it.toImmutable() }, - checkRequired("family", family), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): CardTransaction = apply { - if (validated) { - return@apply - } - - token() - accountToken() - acquirerFee() - acquirerReferenceNumber() - amount() - amounts().validate() - authorizationAmount() - authorizationCode() - avs().ifPresent { it.validate() } - cardToken() - cardholderAuthentication().ifPresent { it.validate() } - created() - financialAccountToken() - merchant().validate() - merchantAmount() - merchantAuthorizationAmount() - merchantCurrency() - network().ifPresent { it.validate() } - networkRiskScore() - pos().validate() - result().validate() - settledAmount() - status().validate() - tokenInfo().ifPresent { it.validate() } - updated() - events().ifPresent { it.forEach { it.validate() } } - family().validate() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 (token.asKnown().isPresent) 1 else 0) + - (if (accountToken.asKnown().isPresent) 1 else 0) + - (if (acquirerFee.asKnown().isPresent) 1 else 0) + - (if (acquirerReferenceNumber.asKnown().isPresent) 1 else 0) + - (if (amount.asKnown().isPresent) 1 else 0) + - (amounts.asKnown().getOrNull()?.validity() ?: 0) + - (if (authorizationAmount.asKnown().isPresent) 1 else 0) + - (if (authorizationCode.asKnown().isPresent) 1 else 0) + - (avs.asKnown().getOrNull()?.validity() ?: 0) + - (if (cardToken.asKnown().isPresent) 1 else 0) + - (cardholderAuthentication.asKnown().getOrNull()?.validity() ?: 0) + - (if (created.asKnown().isPresent) 1 else 0) + - (if (financialAccountToken.asKnown().isPresent) 1 else 0) + - (merchant.asKnown().getOrNull()?.validity() ?: 0) + - (if (merchantAmount.asKnown().isPresent) 1 else 0) + - (if (merchantAuthorizationAmount.asKnown().isPresent) 1 else 0) + - (if (merchantCurrency.asKnown().isPresent) 1 else 0) + - (network.asKnown().getOrNull()?.validity() ?: 0) + - (if (networkRiskScore.asKnown().isPresent) 1 else 0) + - (pos.asKnown().getOrNull()?.validity() ?: 0) + - (result.asKnown().getOrNull()?.validity() ?: 0) + - (if (settledAmount.asKnown().isPresent) 1 else 0) + - (status.asKnown().getOrNull()?.validity() ?: 0) + - (tokenInfo.asKnown().getOrNull()?.validity() ?: 0) + - (if (updated.asKnown().isPresent) 1 else 0) + - (events.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (family.asKnown().getOrNull()?.validity() ?: 0) - - class TransactionFamilyTypes - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CARD = of("CARD") - - @JvmField val PAYMENT = of("PAYMENT") - - @JvmField val TRANSFER = of("TRANSFER") - - @JvmField val INTERNAL = of("INTERNAL") - - @JvmField val EXTERNAL_PAYMENT = of("EXTERNAL_PAYMENT") - - @JvmField val MANAGEMENT_OPERATION = of("MANAGEMENT_OPERATION") - - @JvmStatic fun of(value: String) = TransactionFamilyTypes(JsonField.of(value)) - } - - /** An enum containing [TransactionFamilyTypes]'s known values. */ - enum class Known { - CARD, - PAYMENT, - TRANSFER, - INTERNAL, - EXTERNAL_PAYMENT, - MANAGEMENT_OPERATION, - } - - /** - * An enum containing [TransactionFamilyTypes]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [TransactionFamilyTypes] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CARD, - PAYMENT, - TRANSFER, - INTERNAL, - EXTERNAL_PAYMENT, - MANAGEMENT_OPERATION, - /** - * An enum member indicating that [TransactionFamilyTypes] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CARD -> Value.CARD - PAYMENT -> Value.PAYMENT - TRANSFER -> Value.TRANSFER - INTERNAL -> Value.INTERNAL - EXTERNAL_PAYMENT -> Value.EXTERNAL_PAYMENT - MANAGEMENT_OPERATION -> Value.MANAGEMENT_OPERATION - 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 LithicInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - CARD -> Known.CARD - PAYMENT -> Known.PAYMENT - TRANSFER -> Known.TRANSFER - INTERNAL -> Known.INTERNAL - EXTERNAL_PAYMENT -> Known.EXTERNAL_PAYMENT - MANAGEMENT_OPERATION -> Known.MANAGEMENT_OPERATION - else -> - throw LithicInvalidDataException("Unknown TransactionFamilyTypes: $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 LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): TransactionFamilyTypes = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 TransactionFamilyTypes && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The status of the transaction */ - class TransactionStatus - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val PENDING = of("PENDING") - - @JvmField val SETTLED = of("SETTLED") - - @JvmField val DECLINED = of("DECLINED") - - @JvmField val REVERSED = of("REVERSED") - - @JvmField val CANCELED = of("CANCELED") - - @JvmStatic fun of(value: String) = TransactionStatus(JsonField.of(value)) - } - - /** An enum containing [TransactionStatus]'s known values. */ - enum class Known { - PENDING, - SETTLED, - DECLINED, - REVERSED, - CANCELED, - } - - /** - * An enum containing [TransactionStatus]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [TransactionStatus] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then 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 { - PENDING, - SETTLED, - DECLINED, - REVERSED, - CANCELED, - /** - * An enum member indicating that [TransactionStatus] 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) { - PENDING -> Value.PENDING - SETTLED -> Value.SETTLED - DECLINED -> Value.DECLINED - REVERSED -> Value.REVERSED - CANCELED -> Value.CANCELED - 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 LithicInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - PENDING -> Known.PENDING - SETTLED -> Known.SETTLED - DECLINED -> Known.DECLINED - REVERSED -> Known.REVERSED - CANCELED -> Known.CANCELED - else -> throw LithicInvalidDataException("Unknown TransactionStatus: $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 LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): TransactionStatus = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 TransactionStatus && 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 CardTransaction && - token == other.token && - accountToken == other.accountToken && - acquirerFee == other.acquirerFee && - acquirerReferenceNumber == other.acquirerReferenceNumber && - amount == other.amount && - amounts == other.amounts && - authorizationAmount == other.authorizationAmount && - authorizationCode == other.authorizationCode && - avs == other.avs && - cardToken == other.cardToken && - cardholderAuthentication == other.cardholderAuthentication && - created == other.created && - financialAccountToken == other.financialAccountToken && - merchant == other.merchant && - merchantAmount == other.merchantAmount && - merchantAuthorizationAmount == other.merchantAuthorizationAmount && - merchantCurrency == other.merchantCurrency && - network == other.network && - networkRiskScore == other.networkRiskScore && - pos == other.pos && - result == other.result && - settledAmount == other.settledAmount && - status == other.status && - tokenInfo == other.tokenInfo && - updated == other.updated && - events == other.events && - family == other.family && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - token, - accountToken, - acquirerFee, - acquirerReferenceNumber, - amount, - amounts, - authorizationAmount, - authorizationCode, - avs, - cardToken, - cardholderAuthentication, - created, - financialAccountToken, - merchant, - merchantAmount, - merchantAuthorizationAmount, - merchantCurrency, - network, - networkRiskScore, - pos, - result, - settledAmount, - status, - tokenInfo, - updated, - events, - family, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "CardTransaction{token=$token, accountToken=$accountToken, acquirerFee=$acquirerFee, acquirerReferenceNumber=$acquirerReferenceNumber, amount=$amount, amounts=$amounts, authorizationAmount=$authorizationAmount, authorizationCode=$authorizationCode, avs=$avs, cardToken=$cardToken, cardholderAuthentication=$cardholderAuthentication, created=$created, financialAccountToken=$financialAccountToken, merchant=$merchant, merchantAmount=$merchantAmount, merchantAuthorizationAmount=$merchantAuthorizationAmount, merchantCurrency=$merchantCurrency, network=$network, networkRiskScore=$networkRiskScore, pos=$pos, result=$result, settledAmount=$settledAmount, status=$status, tokenInfo=$tokenInfo, updated=$updated, events=$events, family=$family, additionalProperties=$additionalProperties}" - } - - /** Payment transaction */ - class PaymentTransaction - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val token: JsonField, - private val category: JsonField, - private val created: JsonField, - private val descriptor: JsonField, - private val direction: JsonField, - private val events: JsonField>, - private val family: JsonField, - private val financialAccountToken: JsonField, - private val method: JsonField, - private val methodAttributes: JsonField, - private val pendingAmount: JsonField, - private val relatedAccountTokens: JsonField, - private val result: JsonField, - private val settledAmount: JsonField, - private val source: JsonField, - private val status: JsonField, - private val updated: JsonField, - private val currency: JsonField, - private val expectedReleaseDate: JsonField, - private val externalBankAccountToken: JsonField, - private val type: JsonField, - private val userDefinedId: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), - @JsonProperty("category") - @ExcludeMissing - category: JsonField = JsonMissing.of(), - @JsonProperty("created") - @ExcludeMissing - created: JsonField = JsonMissing.of(), - @JsonProperty("descriptor") - @ExcludeMissing - descriptor: JsonField = JsonMissing.of(), - @JsonProperty("direction") - @ExcludeMissing - direction: JsonField = JsonMissing.of(), - @JsonProperty("events") - @ExcludeMissing - events: JsonField> = JsonMissing.of(), - @JsonProperty("family") - @ExcludeMissing - family: JsonField = JsonMissing.of(), - @JsonProperty("financial_account_token") - @ExcludeMissing - financialAccountToken: JsonField = JsonMissing.of(), - @JsonProperty("method") @ExcludeMissing method: JsonField = JsonMissing.of(), - @JsonProperty("method_attributes") - @ExcludeMissing - methodAttributes: JsonField = JsonMissing.of(), - @JsonProperty("pending_amount") - @ExcludeMissing - pendingAmount: JsonField = JsonMissing.of(), - @JsonProperty("related_account_tokens") - @ExcludeMissing - relatedAccountTokens: JsonField = JsonMissing.of(), - @JsonProperty("result") - @ExcludeMissing - result: JsonField = JsonMissing.of(), - @JsonProperty("settled_amount") - @ExcludeMissing - settledAmount: JsonField = JsonMissing.of(), - @JsonProperty("source") @ExcludeMissing source: JsonField = JsonMissing.of(), - @JsonProperty("status") - @ExcludeMissing - status: JsonField = JsonMissing.of(), - @JsonProperty("updated") - @ExcludeMissing - updated: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - currency: JsonField = JsonMissing.of(), - @JsonProperty("expected_release_date") - @ExcludeMissing - expectedReleaseDate: JsonField = JsonMissing.of(), - @JsonProperty("external_bank_account_token") - @ExcludeMissing - externalBankAccountToken: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - @JsonProperty("user_defined_id") - @ExcludeMissing - userDefinedId: JsonField = JsonMissing.of(), - ) : this( - token, - category, - created, - descriptor, - direction, - events, - family, - financialAccountToken, - method, - methodAttributes, - pendingAmount, - relatedAccountTokens, - result, - settledAmount, - source, - status, - updated, - currency, - expectedReleaseDate, - externalBankAccountToken, - type, - userDefinedId, - mutableMapOf(), - ) - - /** - * Unique identifier for the transaction - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun token(): String = token.getRequired("token") - - /** - * Transaction category - * - * @throws LithicInvalidDataException if 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(): TransactionCategory = category.getRequired("category") - - /** - * ISO 8601 timestamp of when the transaction was created - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun created(): OffsetDateTime = created.getRequired("created") - - /** - * Transaction descriptor - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun descriptor(): String = descriptor.getRequired("descriptor") - - /** - * Transfer direction - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun direction(): Direction = direction.getRequired("direction") - - /** - * List of transaction events - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun events(): List = events.getRequired("events") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun family(): TransactionFamilyTypes = family.getRequired("family") - - /** - * Financial account token - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun financialAccountToken(): String = - financialAccountToken.getRequired("financial_account_token") - - /** - * Transfer method - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun method(): Method = method.getRequired("method") - - /** - * Method-specific attributes - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun methodAttributes(): MethodAttributes = methodAttributes.getRequired("method_attributes") - - /** - * Pending amount in cents - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun pendingAmount(): Long = pendingAmount.getRequired("pending_amount") - - /** - * Related account tokens for the transaction - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun relatedAccountTokens(): RelatedAccountTokens = - relatedAccountTokens.getRequired("related_account_tokens") - - /** - * Transaction result - * - * @throws LithicInvalidDataException if 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(): TransactionResult = result.getRequired("result") - - /** - * Settled amount in cents - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun settledAmount(): Long = settledAmount.getRequired("settled_amount") - - /** - * Transaction source - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun source(): Source = source.getRequired("source") - - /** - * The status of the transaction - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun status(): TransactionStatus = status.getRequired("status") - - /** - * ISO 8601 timestamp of when the transaction was last updated - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun updated(): OffsetDateTime = updated.getRequired("updated") - - /** - * Currency of the transaction in ISO 4217 format - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun currency(): Optional = currency.getOptional("currency") - - /** - * Expected release date for the transaction - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun expectedReleaseDate(): Optional = - expectedReleaseDate.getOptional("expected_release_date") - - /** - * External bank account token - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun externalBankAccountToken(): Optional = - externalBankAccountToken.getOptional("external_bank_account_token") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun type(): Optional = type.getOptional("type") - - /** - * User-defined identifier - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun userDefinedId(): Optional = userDefinedId.getOptional("user_defined_id") - - /** - * Returns the raw JSON value of [token]. - * - * Unlike [token], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("token") @ExcludeMissing fun _token(): JsonField = token - - /** - * 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 [created]. - * - * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created - - /** - * Returns the raw JSON value of [descriptor]. - * - * Unlike [descriptor], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("descriptor") - @ExcludeMissing - fun _descriptor(): JsonField = descriptor - - /** - * Returns the raw JSON value of [direction]. - * - * Unlike [direction], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("direction") - @ExcludeMissing - fun _direction(): JsonField = direction - - /** - * Returns the raw JSON value of [events]. - * - * Unlike [events], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("events") - @ExcludeMissing - fun _events(): JsonField> = events - - /** - * Returns the raw JSON value of [family]. - * - * Unlike [family], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("family") - @ExcludeMissing - fun _family(): JsonField = family - - /** - * Returns the raw JSON value of [financialAccountToken]. - * - * Unlike [financialAccountToken], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("financial_account_token") - @ExcludeMissing - fun _financialAccountToken(): JsonField = financialAccountToken - - /** - * Returns the raw JSON value of [method]. - * - * Unlike [method], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("method") @ExcludeMissing fun _method(): JsonField = method - - /** - * Returns the raw JSON value of [methodAttributes]. - * - * Unlike [methodAttributes], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("method_attributes") - @ExcludeMissing - fun _methodAttributes(): JsonField = methodAttributes - - /** - * Returns the raw JSON value of [pendingAmount]. - * - * Unlike [pendingAmount], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("pending_amount") - @ExcludeMissing - fun _pendingAmount(): JsonField = pendingAmount - - /** - * Returns the raw JSON value of [relatedAccountTokens]. - * - * Unlike [relatedAccountTokens], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("related_account_tokens") - @ExcludeMissing - fun _relatedAccountTokens(): JsonField = relatedAccountTokens - - /** - * 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 - - /** - * Returns the raw JSON value of [settledAmount]. - * - * Unlike [settledAmount], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("settled_amount") - @ExcludeMissing - fun _settledAmount(): JsonField = settledAmount - - /** - * Returns the raw JSON value of [source]. - * - * Unlike [source], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("source") @ExcludeMissing fun _source(): JsonField = source - - /** - * Returns the raw JSON value of [status]. - * - * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status - - /** - * Returns the raw JSON value of [updated]. - * - * Unlike [updated], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("updated") @ExcludeMissing fun _updated(): JsonField = updated - - /** - * Returns the raw JSON value of [currency]. - * - * Unlike [currency], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** - * Returns the raw JSON value of [expectedReleaseDate]. - * - * Unlike [expectedReleaseDate], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("expected_release_date") - @ExcludeMissing - fun _expectedReleaseDate(): JsonField = expectedReleaseDate - - /** - * Returns the raw JSON value of [externalBankAccountToken]. - * - * Unlike [externalBankAccountToken], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("external_bank_account_token") - @ExcludeMissing - fun _externalBankAccountToken(): JsonField = externalBankAccountToken - - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - - /** - * Returns the raw JSON value of [userDefinedId]. - * - * Unlike [userDefinedId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("user_defined_id") - @ExcludeMissing - fun _userDefinedId(): JsonField = userDefinedId - - @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 [PaymentTransaction]. - * - * The following fields are required: - * ```java - * .token() - * .category() - * .created() - * .descriptor() - * .direction() - * .events() - * .family() - * .financialAccountToken() - * .method() - * .methodAttributes() - * .pendingAmount() - * .relatedAccountTokens() - * .result() - * .settledAmount() - * .source() - * .status() - * .updated() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [PaymentTransaction]. */ - class Builder internal constructor() { - - private var token: JsonField? = null - private var category: JsonField? = null - private var created: JsonField? = null - private var descriptor: JsonField? = null - private var direction: JsonField? = null - private var events: JsonField>? = null - private var family: JsonField? = null - private var financialAccountToken: JsonField? = null - private var method: JsonField? = null - private var methodAttributes: JsonField? = null - private var pendingAmount: JsonField? = null - private var relatedAccountTokens: JsonField? = null - private var result: JsonField? = null - private var settledAmount: JsonField? = null - private var source: JsonField? = null - private var status: JsonField? = null - private var updated: JsonField? = null - private var currency: JsonField = JsonMissing.of() - private var expectedReleaseDate: JsonField = JsonMissing.of() - private var externalBankAccountToken: JsonField = JsonMissing.of() - private var type: JsonField = JsonMissing.of() - private var userDefinedId: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(paymentTransaction: PaymentTransaction) = apply { - token = paymentTransaction.token - category = paymentTransaction.category - created = paymentTransaction.created - descriptor = paymentTransaction.descriptor - direction = paymentTransaction.direction - events = paymentTransaction.events.map { it.toMutableList() } - family = paymentTransaction.family - financialAccountToken = paymentTransaction.financialAccountToken - method = paymentTransaction.method - methodAttributes = paymentTransaction.methodAttributes - pendingAmount = paymentTransaction.pendingAmount - relatedAccountTokens = paymentTransaction.relatedAccountTokens - result = paymentTransaction.result - settledAmount = paymentTransaction.settledAmount - source = paymentTransaction.source - status = paymentTransaction.status - updated = paymentTransaction.updated - currency = paymentTransaction.currency - expectedReleaseDate = paymentTransaction.expectedReleaseDate - externalBankAccountToken = paymentTransaction.externalBankAccountToken - type = paymentTransaction.type - userDefinedId = paymentTransaction.userDefinedId - additionalProperties = paymentTransaction.additionalProperties.toMutableMap() - } - - /** Unique identifier for the transaction */ - fun token(token: String) = token(JsonField.of(token)) - - /** - * Sets [Builder.token] to an arbitrary JSON value. - * - * You should usually call [Builder.token] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun token(token: JsonField) = apply { this.token = token } - - /** Transaction category */ - fun category(category: TransactionCategory) = category(JsonField.of(category)) - - /** - * Sets [Builder.category] to an arbitrary JSON value. - * - * You should usually call [Builder.category] with a well-typed [TransactionCategory] - * 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 - } - - /** ISO 8601 timestamp of when the transaction was created */ - fun created(created: OffsetDateTime) = created(JsonField.of(created)) - - /** - * Sets [Builder.created] to an arbitrary JSON value. - * - * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun created(created: JsonField) = apply { this.created = created } - - /** Transaction descriptor */ - fun descriptor(descriptor: String) = descriptor(JsonField.of(descriptor)) - - /** - * Sets [Builder.descriptor] to an arbitrary JSON value. - * - * You should usually call [Builder.descriptor] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun descriptor(descriptor: JsonField) = apply { this.descriptor = descriptor } - - /** Transfer direction */ - fun direction(direction: Direction) = direction(JsonField.of(direction)) - - /** - * Sets [Builder.direction] to an arbitrary JSON value. - * - * You should usually call [Builder.direction] with a well-typed [Direction] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun direction(direction: JsonField) = apply { this.direction = direction } - - /** List of transaction events */ - fun events(events: List) = events(JsonField.of(events)) - - /** - * Sets [Builder.events] to an arbitrary JSON value. - * - * You should usually call [Builder.events] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun events(events: JsonField>) = apply { - this.events = events.map { it.toMutableList() } - } - - /** - * Adds a single [PaymentEvent] to [events]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addEvent(event: PaymentEvent) = apply { - events = - (events ?: JsonField.of(mutableListOf())).also { - checkKnown("events", it).add(event) - } - } - - fun family(family: TransactionFamilyTypes) = family(JsonField.of(family)) - - /** - * Sets [Builder.family] to an arbitrary JSON value. - * - * You should usually call [Builder.family] with a well-typed [TransactionFamilyTypes] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun family(family: JsonField) = apply { this.family = family } - - /** Financial account token */ - fun financialAccountToken(financialAccountToken: String) = - financialAccountToken(JsonField.of(financialAccountToken)) - - /** - * Sets [Builder.financialAccountToken] to an arbitrary JSON value. - * - * You should usually call [Builder.financialAccountToken] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun financialAccountToken(financialAccountToken: JsonField) = apply { - this.financialAccountToken = financialAccountToken - } - - /** Transfer method */ - fun method(method: Method) = method(JsonField.of(method)) - - /** - * Sets [Builder.method] to an arbitrary JSON value. - * - * You should usually call [Builder.method] with a well-typed [Method] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun method(method: JsonField) = apply { this.method = method } - - /** Method-specific attributes */ - fun methodAttributes(methodAttributes: MethodAttributes) = - methodAttributes(JsonField.of(methodAttributes)) - - /** - * Sets [Builder.methodAttributes] to an arbitrary JSON value. - * - * You should usually call [Builder.methodAttributes] with a well-typed - * [MethodAttributes] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun methodAttributes(methodAttributes: JsonField) = apply { - this.methodAttributes = methodAttributes - } - - /** Alias for calling [methodAttributes] with `MethodAttributes.ofAch(ach)`. */ - fun methodAttributes(ach: MethodAttributes.AchMethodAttributes) = - methodAttributes(MethodAttributes.ofAch(ach)) - - /** Alias for calling [methodAttributes] with `MethodAttributes.ofWire(wire)`. */ - fun methodAttributes(wire: MethodAttributes.WireMethodAttributes) = - methodAttributes(MethodAttributes.ofWire(wire)) - - /** Pending amount in cents */ - fun pendingAmount(pendingAmount: Long) = pendingAmount(JsonField.of(pendingAmount)) - - /** - * Sets [Builder.pendingAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.pendingAmount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun pendingAmount(pendingAmount: JsonField) = apply { - this.pendingAmount = pendingAmount - } - - /** Related account tokens for the transaction */ - fun relatedAccountTokens(relatedAccountTokens: RelatedAccountTokens) = - relatedAccountTokens(JsonField.of(relatedAccountTokens)) - - /** - * Sets [Builder.relatedAccountTokens] to an arbitrary JSON value. - * - * You should usually call [Builder.relatedAccountTokens] with a well-typed - * [RelatedAccountTokens] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. - */ - fun relatedAccountTokens(relatedAccountTokens: JsonField) = - apply { - this.relatedAccountTokens = relatedAccountTokens - } - - /** Transaction result */ - fun result(result: TransactionResult) = result(JsonField.of(result)) - - /** - * Sets [Builder.result] to an arbitrary JSON value. - * - * You should usually call [Builder.result] with a well-typed [TransactionResult] 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 } - - /** Settled amount in cents */ - fun settledAmount(settledAmount: Long) = settledAmount(JsonField.of(settledAmount)) - - /** - * Sets [Builder.settledAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.settledAmount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun settledAmount(settledAmount: JsonField) = apply { - this.settledAmount = settledAmount - } - - /** Transaction source */ - fun source(source: Source) = source(JsonField.of(source)) - - /** - * Sets [Builder.source] to an arbitrary JSON value. - * - * You should usually call [Builder.source] with a well-typed [Source] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun source(source: JsonField) = apply { this.source = source } - - /** The status of the transaction */ - fun status(status: TransactionStatus) = status(JsonField.of(status)) - - /** - * Sets [Builder.status] to an arbitrary JSON value. - * - * You should usually call [Builder.status] with a well-typed [TransactionStatus] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun status(status: JsonField) = apply { this.status = status } - - /** ISO 8601 timestamp of when the transaction was last updated */ - fun updated(updated: OffsetDateTime) = updated(JsonField.of(updated)) - - /** - * Sets [Builder.updated] to an arbitrary JSON value. - * - * You should usually call [Builder.updated] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun updated(updated: JsonField) = apply { this.updated = updated } - - /** Currency of the transaction in ISO 4217 format */ - 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 } - - /** Expected release date for the transaction */ - fun expectedReleaseDate(expectedReleaseDate: LocalDate?) = - expectedReleaseDate(JsonField.ofNullable(expectedReleaseDate)) - - /** - * Alias for calling [Builder.expectedReleaseDate] with - * `expectedReleaseDate.orElse(null)`. - */ - fun expectedReleaseDate(expectedReleaseDate: Optional) = - expectedReleaseDate(expectedReleaseDate.getOrNull()) - - /** - * Sets [Builder.expectedReleaseDate] to an arbitrary JSON value. - * - * You should usually call [Builder.expectedReleaseDate] with a well-typed [LocalDate] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun expectedReleaseDate(expectedReleaseDate: JsonField) = apply { - this.expectedReleaseDate = expectedReleaseDate - } - - /** External bank account token */ - fun externalBankAccountToken(externalBankAccountToken: String?) = - externalBankAccountToken(JsonField.ofNullable(externalBankAccountToken)) - - /** - * Alias for calling [Builder.externalBankAccountToken] with - * `externalBankAccountToken.orElse(null)`. - */ - fun externalBankAccountToken(externalBankAccountToken: Optional) = - externalBankAccountToken(externalBankAccountToken.getOrNull()) - - /** - * Sets [Builder.externalBankAccountToken] to an arbitrary JSON value. - * - * You should usually call [Builder.externalBankAccountToken] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun externalBankAccountToken(externalBankAccountToken: JsonField) = apply { - this.externalBankAccountToken = externalBankAccountToken - } - - fun type(type: TransferType) = type(JsonField.of(type)) - - /** - * Sets [Builder.type] to an arbitrary JSON value. - * - * You should usually call [Builder.type] with a well-typed [TransferType] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun type(type: JsonField) = apply { this.type = type } - - /** User-defined identifier */ - fun userDefinedId(userDefinedId: String?) = - userDefinedId(JsonField.ofNullable(userDefinedId)) - - /** Alias for calling [Builder.userDefinedId] with `userDefinedId.orElse(null)`. */ - fun userDefinedId(userDefinedId: Optional) = - userDefinedId(userDefinedId.getOrNull()) - - /** - * Sets [Builder.userDefinedId] to an arbitrary JSON value. - * - * You should usually call [Builder.userDefinedId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun userDefinedId(userDefinedId: JsonField) = apply { - this.userDefinedId = userDefinedId - } - - 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 [PaymentTransaction]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .token() - * .category() - * .created() - * .descriptor() - * .direction() - * .events() - * .family() - * .financialAccountToken() - * .method() - * .methodAttributes() - * .pendingAmount() - * .relatedAccountTokens() - * .result() - * .settledAmount() - * .source() - * .status() - * .updated() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): PaymentTransaction = - PaymentTransaction( - checkRequired("token", token), - checkRequired("category", category), - checkRequired("created", created), - checkRequired("descriptor", descriptor), - checkRequired("direction", direction), - checkRequired("events", events).map { it.toImmutable() }, - checkRequired("family", family), - checkRequired("financialAccountToken", financialAccountToken), - checkRequired("method", method), - checkRequired("methodAttributes", methodAttributes), - checkRequired("pendingAmount", pendingAmount), - checkRequired("relatedAccountTokens", relatedAccountTokens), - checkRequired("result", result), - checkRequired("settledAmount", settledAmount), - checkRequired("source", source), - checkRequired("status", status), - checkRequired("updated", updated), - currency, - expectedReleaseDate, - externalBankAccountToken, - type, - userDefinedId, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): PaymentTransaction = apply { - if (validated) { - return@apply - } - - token() - category().validate() - created() - descriptor() - direction().validate() - events().forEach { it.validate() } - family().validate() - financialAccountToken() - method().validate() - methodAttributes().validate() - pendingAmount() - relatedAccountTokens().validate() - result().validate() - settledAmount() - source().validate() - status().validate() - updated() - currency() - expectedReleaseDate() - externalBankAccountToken() - type().ifPresent { it.validate() } - userDefinedId() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 (token.asKnown().isPresent) 1 else 0) + - (category.asKnown().getOrNull()?.validity() ?: 0) + - (if (created.asKnown().isPresent) 1 else 0) + - (if (descriptor.asKnown().isPresent) 1 else 0) + - (direction.asKnown().getOrNull()?.validity() ?: 0) + - (events.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (family.asKnown().getOrNull()?.validity() ?: 0) + - (if (financialAccountToken.asKnown().isPresent) 1 else 0) + - (method.asKnown().getOrNull()?.validity() ?: 0) + - (methodAttributes.asKnown().getOrNull()?.validity() ?: 0) + - (if (pendingAmount.asKnown().isPresent) 1 else 0) + - (relatedAccountTokens.asKnown().getOrNull()?.validity() ?: 0) + - (result.asKnown().getOrNull()?.validity() ?: 0) + - (if (settledAmount.asKnown().isPresent) 1 else 0) + - (source.asKnown().getOrNull()?.validity() ?: 0) + - (status.asKnown().getOrNull()?.validity() ?: 0) + - (if (updated.asKnown().isPresent) 1 else 0) + - (if (currency.asKnown().isPresent) 1 else 0) + - (if (expectedReleaseDate.asKnown().isPresent) 1 else 0) + - (if (externalBankAccountToken.asKnown().isPresent) 1 else 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) + - (if (userDefinedId.asKnown().isPresent) 1 else 0) - - /** Transaction category */ - class TransactionCategory - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ACH = of("ACH") - - @JvmField val BALANCE_OR_FUNDING = of("BALANCE_OR_FUNDING") - - @JvmField val FEE = of("FEE") - - @JvmField val REWARD = of("REWARD") - - @JvmField val ADJUSTMENT = of("ADJUSTMENT") - - @JvmField val DERECOGNITION = of("DERECOGNITION") - - @JvmField val DISPUTE = of("DISPUTE") - - @JvmField val CARD = of("CARD") - - @JvmField val EXTERNAL_ACH = of("EXTERNAL_ACH") - - @JvmField val EXTERNAL_CHECK = of("EXTERNAL_CHECK") - - @JvmField val EXTERNAL_TRANSFER = of("EXTERNAL_TRANSFER") - - @JvmField val EXTERNAL_WIRE = of("EXTERNAL_WIRE") - - @JvmField val MANAGEMENT_ADJUSTMENT = of("MANAGEMENT_ADJUSTMENT") - - @JvmField val MANAGEMENT_DISPUTE = of("MANAGEMENT_DISPUTE") - - @JvmField val MANAGEMENT_FEE = of("MANAGEMENT_FEE") - - @JvmField val MANAGEMENT_REWARD = of("MANAGEMENT_REWARD") - - @JvmField val MANAGEMENT_DISBURSEMENT = of("MANAGEMENT_DISBURSEMENT") - - @JvmField val PROGRAM_FUNDING = of("PROGRAM_FUNDING") - - @JvmStatic fun of(value: String) = TransactionCategory(JsonField.of(value)) - } - - /** An enum containing [TransactionCategory]'s known values. */ - enum class Known { - ACH, - BALANCE_OR_FUNDING, - FEE, - REWARD, - ADJUSTMENT, - DERECOGNITION, - DISPUTE, - CARD, - EXTERNAL_ACH, - EXTERNAL_CHECK, - EXTERNAL_TRANSFER, - EXTERNAL_WIRE, - MANAGEMENT_ADJUSTMENT, - MANAGEMENT_DISPUTE, - MANAGEMENT_FEE, - MANAGEMENT_REWARD, - MANAGEMENT_DISBURSEMENT, - PROGRAM_FUNDING, - } - - /** - * An enum containing [TransactionCategory]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [TransactionCategory] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then 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 { - ACH, - BALANCE_OR_FUNDING, - FEE, - REWARD, - ADJUSTMENT, - DERECOGNITION, - DISPUTE, - CARD, - EXTERNAL_ACH, - EXTERNAL_CHECK, - EXTERNAL_TRANSFER, - EXTERNAL_WIRE, - MANAGEMENT_ADJUSTMENT, - MANAGEMENT_DISPUTE, - MANAGEMENT_FEE, - MANAGEMENT_REWARD, - MANAGEMENT_DISBURSEMENT, - PROGRAM_FUNDING, - /** - * An enum member indicating that [TransactionCategory] 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) { - ACH -> Value.ACH - BALANCE_OR_FUNDING -> Value.BALANCE_OR_FUNDING - FEE -> Value.FEE - REWARD -> Value.REWARD - ADJUSTMENT -> Value.ADJUSTMENT - DERECOGNITION -> Value.DERECOGNITION - DISPUTE -> Value.DISPUTE - CARD -> Value.CARD - EXTERNAL_ACH -> Value.EXTERNAL_ACH - EXTERNAL_CHECK -> Value.EXTERNAL_CHECK - EXTERNAL_TRANSFER -> Value.EXTERNAL_TRANSFER - EXTERNAL_WIRE -> Value.EXTERNAL_WIRE - MANAGEMENT_ADJUSTMENT -> Value.MANAGEMENT_ADJUSTMENT - MANAGEMENT_DISPUTE -> Value.MANAGEMENT_DISPUTE - MANAGEMENT_FEE -> Value.MANAGEMENT_FEE - MANAGEMENT_REWARD -> Value.MANAGEMENT_REWARD - MANAGEMENT_DISBURSEMENT -> Value.MANAGEMENT_DISBURSEMENT - PROGRAM_FUNDING -> Value.PROGRAM_FUNDING - 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 LithicInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ACH -> Known.ACH - BALANCE_OR_FUNDING -> Known.BALANCE_OR_FUNDING - FEE -> Known.FEE - REWARD -> Known.REWARD - ADJUSTMENT -> Known.ADJUSTMENT - DERECOGNITION -> Known.DERECOGNITION - DISPUTE -> Known.DISPUTE - CARD -> Known.CARD - EXTERNAL_ACH -> Known.EXTERNAL_ACH - EXTERNAL_CHECK -> Known.EXTERNAL_CHECK - EXTERNAL_TRANSFER -> Known.EXTERNAL_TRANSFER - EXTERNAL_WIRE -> Known.EXTERNAL_WIRE - MANAGEMENT_ADJUSTMENT -> Known.MANAGEMENT_ADJUSTMENT - MANAGEMENT_DISPUTE -> Known.MANAGEMENT_DISPUTE - MANAGEMENT_FEE -> Known.MANAGEMENT_FEE - MANAGEMENT_REWARD -> Known.MANAGEMENT_REWARD - MANAGEMENT_DISBURSEMENT -> Known.MANAGEMENT_DISBURSEMENT - PROGRAM_FUNDING -> Known.PROGRAM_FUNDING - else -> throw LithicInvalidDataException("Unknown TransactionCategory: $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 LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): TransactionCategory = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 TransactionCategory && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** Transfer direction */ - class Direction @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CREDIT = of("CREDIT") - - @JvmField val DEBIT = of("DEBIT") - - @JvmStatic fun of(value: String) = Direction(JsonField.of(value)) - } - - /** An enum containing [Direction]'s known values. */ - enum class Known { - CREDIT, - DEBIT, - } - - /** - * An enum containing [Direction]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Direction] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CREDIT, - DEBIT, - /** - * An enum member indicating that [Direction] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CREDIT -> Value.CREDIT - DEBIT -> Value.DEBIT - 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 LithicInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - CREDIT -> Known.CREDIT - DEBIT -> Known.DEBIT - else -> throw LithicInvalidDataException("Unknown Direction: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Direction = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Direction && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** Payment Event */ - class PaymentEvent - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val token: JsonField, - private val amount: JsonField, - private val created: JsonField, - private val result: JsonField, - private val type: JsonField, - private val detailedResults: JsonField>, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), - @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - @JsonProperty("created") - @ExcludeMissing - created: JsonField = JsonMissing.of(), - @JsonProperty("result") - @ExcludeMissing - result: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - @JsonProperty("detailed_results") - @ExcludeMissing - detailedResults: JsonField> = JsonMissing.of(), - ) : this(token, amount, created, result, type, detailedResults, mutableMapOf()) - - /** - * Globally unique identifier. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun token(): String = token.getRequired("token") - - /** - * Amount of the financial event that has been settled in the currency's smallest unit - * (e.g., cents). - * - * @throws LithicInvalidDataException if 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") - - /** - * Date and time when the financial event occurred. UTC time zone. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun created(): OffsetDateTime = created.getRequired("created") - - /** - * APPROVED financial events were successful while DECLINED financial events were - * declined by user, Lithic, or the network. - * - * @throws LithicInvalidDataException if 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") - - /** - * Event types: - * * `ACH_ORIGINATION_INITIATED` - ACH origination received and pending approval/release - * from an ACH hold. - * * `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process. - * * `ACH_ORIGINATION_CANCELLED` - ACH origination has been cancelled. - * * `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed and sent to the - * Federal Reserve. - * * `ACH_ORIGINATION_SETTLED` - ACH origination has settled. - * * `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to available - * balance. - * * `ACH_RETURN_PROCESSED` - ACH origination returned by the Receiving Depository - * Financial Institution. - * * `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder. - * * `ACH_RETURN_INITIATED` - ACH initiated return for a ACH receipt. - * * `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled. - * * `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance. - * * `ACH_RETURN_SETTLED` - ACH receipt return settled by the Receiving Depository - * Financial Institution. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun type(): Type = type.getRequired("type") - - /** - * More detailed reasons for the event - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun detailedResults(): Optional> = - detailedResults.getOptional("detailed_results") - - /** - * Returns the raw JSON value of [token]. - * - * Unlike [token], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("token") @ExcludeMissing fun _token(): JsonField = token - - /** - * 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 [created]. - * - * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("created") - @ExcludeMissing - fun _created(): JsonField = created - - /** - * 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 - - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - - /** - * Returns the raw JSON value of [detailedResults]. - * - * Unlike [detailedResults], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("detailed_results") - @ExcludeMissing - fun _detailedResults(): JsonField> = detailedResults - - @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 [PaymentEvent]. - * - * The following fields are required: - * ```java - * .token() - * .amount() - * .created() - * .result() - * .type() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [PaymentEvent]. */ - class Builder internal constructor() { - - private var token: JsonField? = null - private var amount: JsonField? = null - private var created: JsonField? = null - private var result: JsonField? = null - private var type: JsonField? = null - private var detailedResults: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(paymentEvent: PaymentEvent) = apply { - token = paymentEvent.token - amount = paymentEvent.amount - created = paymentEvent.created - result = paymentEvent.result - type = paymentEvent.type - detailedResults = paymentEvent.detailedResults.map { it.toMutableList() } - additionalProperties = paymentEvent.additionalProperties.toMutableMap() - } - - /** Globally unique identifier. */ - fun token(token: String) = token(JsonField.of(token)) - - /** - * Sets [Builder.token] to an arbitrary JSON value. - * - * You should usually call [Builder.token] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun token(token: JsonField) = apply { this.token = token } - - /** - * Amount of the financial event that has been settled in the currency's smallest - * unit (e.g., cents). - */ - fun amount(amount: Long) = amount(JsonField.of(amount)) - - /** - * Sets [Builder.amount] to an arbitrary JSON value. - * - * You should usually call [Builder.amount] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } - - /** Date and time when the financial event occurred. UTC time zone. */ - fun created(created: OffsetDateTime) = created(JsonField.of(created)) - - /** - * Sets [Builder.created] to an arbitrary JSON value. - * - * You should usually call [Builder.created] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun created(created: JsonField) = apply { this.created = created } - - /** - * APPROVED financial events were successful while DECLINED financial events were - * declined by user, Lithic, or the 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 } - - /** - * Event types: - * * `ACH_ORIGINATION_INITIATED` - ACH origination received and pending - * approval/release from an ACH hold. - * * `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process. - * * `ACH_ORIGINATION_CANCELLED` - ACH origination has been cancelled. - * * `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed and sent to - * the Federal Reserve. - * * `ACH_ORIGINATION_SETTLED` - ACH origination has settled. - * * `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to available - * balance. - * * `ACH_RETURN_PROCESSED` - ACH origination returned by the Receiving Depository - * Financial Institution. - * * `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder. - * * `ACH_RETURN_INITIATED` - ACH initiated return for a ACH receipt. - * * `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled. - * * `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available - * balance. - * * `ACH_RETURN_SETTLED` - ACH receipt return settled by the Receiving Depository - * Financial Institution. - */ - fun type(type: Type) = type(JsonField.of(type)) - - /** - * Sets [Builder.type] to an arbitrary JSON value. - * - * You should usually call [Builder.type] with a well-typed [Type] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun type(type: JsonField) = apply { this.type = type } - - /** More detailed reasons for the event */ - fun detailedResults(detailedResults: List) = - detailedResults(JsonField.of(detailedResults)) - - /** - * Sets [Builder.detailedResults] to an arbitrary JSON value. - * - * You should usually call [Builder.detailedResults] with a well-typed - * `List` value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun detailedResults(detailedResults: JsonField>) = apply { - this.detailedResults = detailedResults.map { it.toMutableList() } - } - - /** - * Adds a single [DetailedResult] to [detailedResults]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addDetailedResult(detailedResult: DetailedResult) = apply { - detailedResults = - (detailedResults ?: JsonField.of(mutableListOf())).also { - checkKnown("detailedResults", it).add(detailedResult) - } - } - - 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 [PaymentEvent]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .token() - * .amount() - * .created() - * .result() - * .type() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): PaymentEvent = - PaymentEvent( - checkRequired("token", token), - checkRequired("amount", amount), - checkRequired("created", created), - checkRequired("result", result), - checkRequired("type", type), - (detailedResults ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): PaymentEvent = apply { - if (validated) { - return@apply - } - - token() - amount() - created() - result().validate() - type().validate() - detailedResults().ifPresent { it.forEach { it.validate() } } - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 (token.asKnown().isPresent) 1 else 0) + - (if (amount.asKnown().isPresent) 1 else 0) + - (if (created.asKnown().isPresent) 1 else 0) + - (result.asKnown().getOrNull()?.validity() ?: 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) + - (detailedResults.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) - - /** - * APPROVED financial events were successful while DECLINED financial events were - * declined by user, Lithic, or the 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 { - - @JvmField val APPROVED = of("APPROVED") - - @JvmField val DECLINED = of("DECLINED") - - @JvmStatic fun of(value: String) = Result(JsonField.of(value)) - } - - /** An enum containing [Result]'s known values. */ - enum class Known { - APPROVED, - DECLINED, - } - - /** - * 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 { - APPROVED, - DECLINED, - /** - * 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) { - APPROVED -> Value.APPROVED - DECLINED -> Value.DECLINED - 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 LithicInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - APPROVED -> Known.APPROVED - DECLINED -> Known.DECLINED - else -> throw LithicInvalidDataException("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 LithicInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("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: LithicInvalidDataException) { - 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() - } - - /** - * Event types: - * * `ACH_ORIGINATION_INITIATED` - ACH origination received and pending approval/release - * from an ACH hold. - * * `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process. - * * `ACH_ORIGINATION_CANCELLED` - ACH origination has been cancelled. - * * `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed and sent to the - * Federal Reserve. - * * `ACH_ORIGINATION_SETTLED` - ACH origination has settled. - * * `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to available - * balance. - * * `ACH_RETURN_PROCESSED` - ACH origination returned by the Receiving Depository - * Financial Institution. - * * `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder. - * * `ACH_RETURN_INITIATED` - ACH initiated return for a ACH receipt. - * * `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled. - * * `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance. - * * `ACH_RETURN_SETTLED` - ACH receipt return settled by the Receiving Depository - * Financial Institution. - */ - class Type @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ACH_ORIGINATION_CANCELLED = of("ACH_ORIGINATION_CANCELLED") - - @JvmField val ACH_ORIGINATION_INITIATED = of("ACH_ORIGINATION_INITIATED") - - @JvmField val ACH_ORIGINATION_PROCESSED = of("ACH_ORIGINATION_PROCESSED") - - @JvmField val ACH_ORIGINATION_SETTLED = of("ACH_ORIGINATION_SETTLED") - - @JvmField val ACH_ORIGINATION_RELEASED = of("ACH_ORIGINATION_RELEASED") - - @JvmField val ACH_ORIGINATION_REVIEWED = of("ACH_ORIGINATION_REVIEWED") - - @JvmField val ACH_RECEIPT_PROCESSED = of("ACH_RECEIPT_PROCESSED") - - @JvmField val ACH_RECEIPT_SETTLED = of("ACH_RECEIPT_SETTLED") - - @JvmField val ACH_RETURN_INITIATED = of("ACH_RETURN_INITIATED") - - @JvmField val ACH_RETURN_PROCESSED = of("ACH_RETURN_PROCESSED") - - @JvmField val ACH_RETURN_SETTLED = of("ACH_RETURN_SETTLED") - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - /** An enum containing [Type]'s known values. */ - enum class Known { - ACH_ORIGINATION_CANCELLED, - ACH_ORIGINATION_INITIATED, - ACH_ORIGINATION_PROCESSED, - ACH_ORIGINATION_SETTLED, - ACH_ORIGINATION_RELEASED, - ACH_ORIGINATION_REVIEWED, - ACH_RECEIPT_PROCESSED, - ACH_RECEIPT_SETTLED, - ACH_RETURN_INITIATED, - ACH_RETURN_PROCESSED, - ACH_RETURN_SETTLED, - } - - /** - * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Type] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ACH_ORIGINATION_CANCELLED, - ACH_ORIGINATION_INITIATED, - ACH_ORIGINATION_PROCESSED, - ACH_ORIGINATION_SETTLED, - ACH_ORIGINATION_RELEASED, - ACH_ORIGINATION_REVIEWED, - ACH_RECEIPT_PROCESSED, - ACH_RECEIPT_SETTLED, - ACH_RETURN_INITIATED, - ACH_RETURN_PROCESSED, - ACH_RETURN_SETTLED, - /** - * An enum member indicating that [Type] was instantiated with an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ACH_ORIGINATION_CANCELLED -> Value.ACH_ORIGINATION_CANCELLED - ACH_ORIGINATION_INITIATED -> Value.ACH_ORIGINATION_INITIATED - ACH_ORIGINATION_PROCESSED -> Value.ACH_ORIGINATION_PROCESSED - ACH_ORIGINATION_SETTLED -> Value.ACH_ORIGINATION_SETTLED - ACH_ORIGINATION_RELEASED -> Value.ACH_ORIGINATION_RELEASED - ACH_ORIGINATION_REVIEWED -> Value.ACH_ORIGINATION_REVIEWED - ACH_RECEIPT_PROCESSED -> Value.ACH_RECEIPT_PROCESSED - ACH_RECEIPT_SETTLED -> Value.ACH_RECEIPT_SETTLED - ACH_RETURN_INITIATED -> Value.ACH_RETURN_INITIATED - ACH_RETURN_PROCESSED -> Value.ACH_RETURN_PROCESSED - ACH_RETURN_SETTLED -> Value.ACH_RETURN_SETTLED - 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 LithicInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - ACH_ORIGINATION_CANCELLED -> Known.ACH_ORIGINATION_CANCELLED - ACH_ORIGINATION_INITIATED -> Known.ACH_ORIGINATION_INITIATED - ACH_ORIGINATION_PROCESSED -> Known.ACH_ORIGINATION_PROCESSED - ACH_ORIGINATION_SETTLED -> Known.ACH_ORIGINATION_SETTLED - ACH_ORIGINATION_RELEASED -> Known.ACH_ORIGINATION_RELEASED - ACH_ORIGINATION_REVIEWED -> Known.ACH_ORIGINATION_REVIEWED - ACH_RECEIPT_PROCESSED -> Known.ACH_RECEIPT_PROCESSED - ACH_RECEIPT_SETTLED -> Known.ACH_RECEIPT_SETTLED - ACH_RETURN_INITIATED -> Known.ACH_RETURN_INITIATED - ACH_RETURN_PROCESSED -> Known.ACH_RETURN_PROCESSED - ACH_RETURN_SETTLED -> Known.ACH_RETURN_SETTLED - else -> throw LithicInvalidDataException("Unknown Type: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Type = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Type && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - class DetailedResult - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val APPROVED = of("APPROVED") - - @JvmField val FUNDS_INSUFFICIENT = of("FUNDS_INSUFFICIENT") - - @JvmField val ACCOUNT_INVALID = of("ACCOUNT_INVALID") - - @JvmField - val PROGRAM_TRANSACTION_LIMIT_EXCEEDED = - of("PROGRAM_TRANSACTION_LIMIT_EXCEEDED") - - @JvmField val PROGRAM_DAILY_LIMIT_EXCEEDED = of("PROGRAM_DAILY_LIMIT_EXCEEDED") - - @JvmField - val PROGRAM_MONTHLY_LIMIT_EXCEEDED = of("PROGRAM_MONTHLY_LIMIT_EXCEEDED") - - @JvmStatic fun of(value: String) = DetailedResult(JsonField.of(value)) - } - - /** An enum containing [DetailedResult]'s known values. */ - enum class Known { - APPROVED, - FUNDS_INSUFFICIENT, - ACCOUNT_INVALID, - PROGRAM_TRANSACTION_LIMIT_EXCEEDED, - PROGRAM_DAILY_LIMIT_EXCEEDED, - PROGRAM_MONTHLY_LIMIT_EXCEEDED, - } - - /** - * An enum containing [DetailedResult]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DetailedResult] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then 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 { - APPROVED, - FUNDS_INSUFFICIENT, - ACCOUNT_INVALID, - PROGRAM_TRANSACTION_LIMIT_EXCEEDED, - PROGRAM_DAILY_LIMIT_EXCEEDED, - PROGRAM_MONTHLY_LIMIT_EXCEEDED, - /** - * An enum member indicating that [DetailedResult] 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) { - APPROVED -> Value.APPROVED - FUNDS_INSUFFICIENT -> Value.FUNDS_INSUFFICIENT - ACCOUNT_INVALID -> Value.ACCOUNT_INVALID - PROGRAM_TRANSACTION_LIMIT_EXCEEDED -> - Value.PROGRAM_TRANSACTION_LIMIT_EXCEEDED - PROGRAM_DAILY_LIMIT_EXCEEDED -> Value.PROGRAM_DAILY_LIMIT_EXCEEDED - PROGRAM_MONTHLY_LIMIT_EXCEEDED -> Value.PROGRAM_MONTHLY_LIMIT_EXCEEDED - 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 LithicInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - APPROVED -> Known.APPROVED - FUNDS_INSUFFICIENT -> Known.FUNDS_INSUFFICIENT - ACCOUNT_INVALID -> Known.ACCOUNT_INVALID - PROGRAM_TRANSACTION_LIMIT_EXCEEDED -> - Known.PROGRAM_TRANSACTION_LIMIT_EXCEEDED - PROGRAM_DAILY_LIMIT_EXCEEDED -> Known.PROGRAM_DAILY_LIMIT_EXCEEDED - PROGRAM_MONTHLY_LIMIT_EXCEEDED -> Known.PROGRAM_MONTHLY_LIMIT_EXCEEDED - else -> throw LithicInvalidDataException("Unknown DetailedResult: $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 LithicInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DetailedResult = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 DetailedResult && 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 PaymentEvent && - token == other.token && - amount == other.amount && - created == other.created && - result == other.result && - type == other.type && - detailedResults == other.detailedResults && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - token, - amount, - created, - result, - type, - detailedResults, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "PaymentEvent{token=$token, amount=$amount, created=$created, result=$result, type=$type, detailedResults=$detailedResults, additionalProperties=$additionalProperties}" - } - - class TransactionFamilyTypes - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CARD = of("CARD") - - @JvmField val PAYMENT = of("PAYMENT") - - @JvmField val TRANSFER = of("TRANSFER") - - @JvmField val INTERNAL = of("INTERNAL") - - @JvmField val EXTERNAL_PAYMENT = of("EXTERNAL_PAYMENT") - - @JvmField val MANAGEMENT_OPERATION = of("MANAGEMENT_OPERATION") - - @JvmStatic fun of(value: String) = TransactionFamilyTypes(JsonField.of(value)) - } - - /** An enum containing [TransactionFamilyTypes]'s known values. */ - enum class Known { - CARD, - PAYMENT, - TRANSFER, - INTERNAL, - EXTERNAL_PAYMENT, - MANAGEMENT_OPERATION, - } - - /** - * An enum containing [TransactionFamilyTypes]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [TransactionFamilyTypes] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CARD, - PAYMENT, - TRANSFER, - INTERNAL, - EXTERNAL_PAYMENT, - MANAGEMENT_OPERATION, - /** - * An enum member indicating that [TransactionFamilyTypes] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CARD -> Value.CARD - PAYMENT -> Value.PAYMENT - TRANSFER -> Value.TRANSFER - INTERNAL -> Value.INTERNAL - EXTERNAL_PAYMENT -> Value.EXTERNAL_PAYMENT - MANAGEMENT_OPERATION -> Value.MANAGEMENT_OPERATION - 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 LithicInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - CARD -> Known.CARD - PAYMENT -> Known.PAYMENT - TRANSFER -> Known.TRANSFER - INTERNAL -> Known.INTERNAL - EXTERNAL_PAYMENT -> Known.EXTERNAL_PAYMENT - MANAGEMENT_OPERATION -> Known.MANAGEMENT_OPERATION - else -> - throw LithicInvalidDataException("Unknown TransactionFamilyTypes: $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 LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): TransactionFamilyTypes = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 TransactionFamilyTypes && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** Transfer method */ - class Method @JsonCreator private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ACH_NEXT_DAY = of("ACH_NEXT_DAY") - - @JvmField val ACH_SAME_DAY = of("ACH_SAME_DAY") - - @JvmField val WIRE = of("WIRE") - - @JvmStatic fun of(value: String) = Method(JsonField.of(value)) - } - - /** An enum containing [Method]'s known values. */ - enum class Known { - ACH_NEXT_DAY, - ACH_SAME_DAY, - WIRE, - } - - /** - * An enum containing [Method]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Method] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then 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 { - ACH_NEXT_DAY, - ACH_SAME_DAY, - WIRE, - /** - * An enum member indicating that [Method] 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) { - ACH_NEXT_DAY -> Value.ACH_NEXT_DAY - ACH_SAME_DAY -> Value.ACH_SAME_DAY - WIRE -> Value.WIRE - 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 LithicInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ACH_NEXT_DAY -> Known.ACH_NEXT_DAY - ACH_SAME_DAY -> Known.ACH_SAME_DAY - WIRE -> Known.WIRE - else -> throw LithicInvalidDataException("Unknown Method: $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 LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Method = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 Method && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** Method-specific attributes */ - @JsonDeserialize(using = MethodAttributes.Deserializer::class) - @JsonSerialize(using = MethodAttributes.Serializer::class) - class MethodAttributes - private constructor( - private val ach: AchMethodAttributes? = null, - private val wire: WireMethodAttributes? = null, - private val _json: JsonValue? = null, - ) { - - fun ach(): Optional = Optional.ofNullable(ach) - - fun wire(): Optional = Optional.ofNullable(wire) - - fun isAch(): Boolean = ach != null - - fun isWire(): Boolean = wire != null - - fun asAch(): AchMethodAttributes = ach.getOrThrow("ach") - - fun asWire(): WireMethodAttributes = wire.getOrThrow("wire") - - fun _json(): Optional = Optional.ofNullable(_json) - - fun accept(visitor: Visitor): T = - when { - ach != null -> visitor.visitAch(ach) - wire != null -> visitor.visitWire(wire) - else -> visitor.unknown(_json) - } - - private var validated: Boolean = false - - fun validate(): MethodAttributes = apply { - if (validated) { - return@apply - } - - accept( - object : Visitor { - override fun visitAch(ach: AchMethodAttributes) { - ach.validate() - } - - override fun visitWire(wire: WireMethodAttributes) { - wire.validate() - } - } - ) - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 = - accept( - object : Visitor { - override fun visitAch(ach: AchMethodAttributes) = ach.validity() - - override fun visitWire(wire: WireMethodAttributes) = wire.validity() - - override fun unknown(json: JsonValue?) = 0 - } - ) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is MethodAttributes && ach == other.ach && wire == other.wire - } - - override fun hashCode(): Int = Objects.hash(ach, wire) - - override fun toString(): String = - when { - ach != null -> "MethodAttributes{ach=$ach}" - wire != null -> "MethodAttributes{wire=$wire}" - _json != null -> "MethodAttributes{_unknown=$_json}" - else -> throw IllegalStateException("Invalid MethodAttributes") - } - - companion object { - - @JvmStatic fun ofAch(ach: AchMethodAttributes) = MethodAttributes(ach = ach) - - @JvmStatic fun ofWire(wire: WireMethodAttributes) = MethodAttributes(wire = wire) - } - - /** - * An interface that defines how to map each variant of [MethodAttributes] to a value of - * type [T]. - */ - interface Visitor { - - fun visitAch(ach: AchMethodAttributes): T - - fun visitWire(wire: WireMethodAttributes): T - - /** - * Maps an unknown variant of [MethodAttributes] to a value of type [T]. - * - * An instance of [MethodAttributes] can contain an unknown variant if it was - * deserialized from data that doesn't match any known variant. For example, if the - * SDK is on an older version than the API, then the API may respond with new - * variants that the SDK is unaware of. - * - * @throws LithicInvalidDataException in the default implementation. - */ - fun unknown(json: JsonValue?): T { - throw LithicInvalidDataException("Unknown MethodAttributes: $json") - } - } - - internal class Deserializer : - BaseDeserializer(MethodAttributes::class) { - - override fun ObjectCodec.deserialize(node: JsonNode): MethodAttributes { - val json = JsonValue.fromJsonNode(node) - - val bestMatches = - sequenceOf( - tryDeserialize(node, jacksonTypeRef())?.let { - MethodAttributes(ach = it, _json = json) - }, - tryDeserialize(node, jacksonTypeRef())?.let { - MethodAttributes(wire = it, _json = json) - }, - ) - .filterNotNull() - .allMaxBy { it.validity() } - .toList() - return when (bestMatches.size) { - // This can happen if what we're deserializing is completely incompatible - // with all the possible variants (e.g. deserializing from boolean). - 0 -> MethodAttributes(_json = json) - 1 -> bestMatches.single() - // If there's more than one match with the highest validity, then use the - // first completely valid match, or simply the first match if none are - // completely valid. - else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first() - } - } - } - - internal class Serializer : BaseSerializer(MethodAttributes::class) { - - override fun serialize( - value: MethodAttributes, - generator: JsonGenerator, - provider: SerializerProvider, - ) { - when { - value.ach != null -> generator.writeObject(value.ach) - value.wire != null -> generator.writeObject(value.wire) - value._json != null -> generator.writeObject(value._json) - else -> throw IllegalStateException("Invalid MethodAttributes") - } - } - } - - class AchMethodAttributes - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val secCode: JsonField, - private val addenda: JsonField, - private val companyId: JsonField, - private val receiptRoutingNumber: JsonField, - private val retries: JsonField, - private val returnReasonCode: JsonField, - private val traceNumbers: JsonField>, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("sec_code") - @ExcludeMissing - secCode: JsonField = JsonMissing.of(), - @JsonProperty("addenda") - @ExcludeMissing - addenda: JsonField = JsonMissing.of(), - @JsonProperty("company_id") - @ExcludeMissing - companyId: JsonField = JsonMissing.of(), - @JsonProperty("receipt_routing_number") - @ExcludeMissing - receiptRoutingNumber: JsonField = JsonMissing.of(), - @JsonProperty("retries") - @ExcludeMissing - retries: JsonField = JsonMissing.of(), - @JsonProperty("return_reason_code") - @ExcludeMissing - returnReasonCode: JsonField = JsonMissing.of(), - @JsonProperty("trace_numbers") - @ExcludeMissing - traceNumbers: JsonField> = JsonMissing.of(), - ) : this( - secCode, - addenda, - companyId, - receiptRoutingNumber, - retries, - returnReasonCode, - traceNumbers, - mutableMapOf(), - ) - - /** - * SEC code for ACH transaction - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun secCode(): SecCode = secCode.getRequired("sec_code") - - /** - * Addenda information - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun addenda(): Optional = addenda.getOptional("addenda") - - /** - * Company ID for the ACH transaction - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun companyId(): Optional = companyId.getOptional("company_id") - - /** - * Receipt routing number - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun receiptRoutingNumber(): Optional = - receiptRoutingNumber.getOptional("receipt_routing_number") - - /** - * Number of retries attempted - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun retries(): Optional = retries.getOptional("retries") - - /** - * Return reason code if the transaction was returned - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun returnReasonCode(): Optional = - returnReasonCode.getOptional("return_reason_code") - - /** - * Trace numbers for the ACH transaction - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun traceNumbers(): Optional> = - traceNumbers.getOptional("trace_numbers") - - /** - * Returns the raw JSON value of [secCode]. - * - * Unlike [secCode], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("sec_code") - @ExcludeMissing - fun _secCode(): JsonField = secCode - - /** - * Returns the raw JSON value of [addenda]. - * - * Unlike [addenda], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("addenda") @ExcludeMissing fun _addenda(): JsonField = addenda - - /** - * Returns the raw JSON value of [companyId]. - * - * Unlike [companyId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("company_id") - @ExcludeMissing - fun _companyId(): JsonField = companyId - - /** - * Returns the raw JSON value of [receiptRoutingNumber]. - * - * Unlike [receiptRoutingNumber], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("receipt_routing_number") - @ExcludeMissing - fun _receiptRoutingNumber(): JsonField = receiptRoutingNumber - - /** - * Returns the raw JSON value of [retries]. - * - * Unlike [retries], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("retries") @ExcludeMissing fun _retries(): JsonField = retries - - /** - * Returns the raw JSON value of [returnReasonCode]. - * - * Unlike [returnReasonCode], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("return_reason_code") - @ExcludeMissing - fun _returnReasonCode(): JsonField = returnReasonCode - - /** - * Returns the raw JSON value of [traceNumbers]. - * - * Unlike [traceNumbers], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("trace_numbers") - @ExcludeMissing - fun _traceNumbers(): JsonField> = traceNumbers - - @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 - * [AchMethodAttributes]. - * - * The following fields are required: - * ```java - * .secCode() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [AchMethodAttributes]. */ - class Builder internal constructor() { - - private var secCode: JsonField? = null - private var addenda: JsonField = JsonMissing.of() - private var companyId: JsonField = JsonMissing.of() - private var receiptRoutingNumber: JsonField = JsonMissing.of() - private var retries: JsonField = JsonMissing.of() - private var returnReasonCode: JsonField = JsonMissing.of() - private var traceNumbers: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(achMethodAttributes: AchMethodAttributes) = apply { - secCode = achMethodAttributes.secCode - addenda = achMethodAttributes.addenda - companyId = achMethodAttributes.companyId - receiptRoutingNumber = achMethodAttributes.receiptRoutingNumber - retries = achMethodAttributes.retries - returnReasonCode = achMethodAttributes.returnReasonCode - traceNumbers = achMethodAttributes.traceNumbers.map { it.toMutableList() } - additionalProperties = - achMethodAttributes.additionalProperties.toMutableMap() - } - - /** SEC code for ACH transaction */ - fun secCode(secCode: SecCode) = secCode(JsonField.of(secCode)) - - /** - * Sets [Builder.secCode] to an arbitrary JSON value. - * - * You should usually call [Builder.secCode] with a well-typed [SecCode] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun secCode(secCode: JsonField) = apply { this.secCode = secCode } - - /** Addenda information */ - fun addenda(addenda: String?) = addenda(JsonField.ofNullable(addenda)) - - /** Alias for calling [Builder.addenda] with `addenda.orElse(null)`. */ - fun addenda(addenda: Optional) = addenda(addenda.getOrNull()) - - /** - * Sets [Builder.addenda] to an arbitrary JSON value. - * - * You should usually call [Builder.addenda] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun addenda(addenda: JsonField) = apply { this.addenda = addenda } - - /** Company ID for the ACH transaction */ - fun companyId(companyId: String?) = companyId(JsonField.ofNullable(companyId)) - - /** Alias for calling [Builder.companyId] with `companyId.orElse(null)`. */ - fun companyId(companyId: Optional) = companyId(companyId.getOrNull()) - - /** - * Sets [Builder.companyId] to an arbitrary JSON value. - * - * You should usually call [Builder.companyId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun companyId(companyId: JsonField) = apply { - this.companyId = companyId - } - - /** Receipt routing number */ - fun receiptRoutingNumber(receiptRoutingNumber: String?) = - receiptRoutingNumber(JsonField.ofNullable(receiptRoutingNumber)) - - /** - * Alias for calling [Builder.receiptRoutingNumber] with - * `receiptRoutingNumber.orElse(null)`. - */ - fun receiptRoutingNumber(receiptRoutingNumber: Optional) = - receiptRoutingNumber(receiptRoutingNumber.getOrNull()) - - /** - * Sets [Builder.receiptRoutingNumber] to an arbitrary JSON value. - * - * You should usually call [Builder.receiptRoutingNumber] with a well-typed - * [String] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun receiptRoutingNumber(receiptRoutingNumber: JsonField) = apply { - this.receiptRoutingNumber = receiptRoutingNumber - } - - /** Number of retries attempted */ - fun retries(retries: Long?) = retries(JsonField.ofNullable(retries)) - - /** - * Alias for [Builder.retries]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun retries(retries: Long) = retries(retries as Long?) - - /** Alias for calling [Builder.retries] with `retries.orElse(null)`. */ - fun retries(retries: Optional) = retries(retries.getOrNull()) - - /** - * Sets [Builder.retries] to an arbitrary JSON value. - * - * You should usually call [Builder.retries] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun retries(retries: JsonField) = apply { this.retries = retries } - - /** Return reason code if the transaction was returned */ - fun returnReasonCode(returnReasonCode: String?) = - returnReasonCode(JsonField.ofNullable(returnReasonCode)) - - /** - * Alias for calling [Builder.returnReasonCode] with - * `returnReasonCode.orElse(null)`. - */ - fun returnReasonCode(returnReasonCode: Optional) = - returnReasonCode(returnReasonCode.getOrNull()) - - /** - * Sets [Builder.returnReasonCode] to an arbitrary JSON value. - * - * You should usually call [Builder.returnReasonCode] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun returnReasonCode(returnReasonCode: JsonField) = apply { - this.returnReasonCode = returnReasonCode - } - - /** Trace numbers for the ACH transaction */ - fun traceNumbers(traceNumbers: List) = - traceNumbers(JsonField.of(traceNumbers)) - - /** - * Sets [Builder.traceNumbers] to an arbitrary JSON value. - * - * You should usually call [Builder.traceNumbers] with a well-typed - * `List` value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. - */ - fun traceNumbers(traceNumbers: JsonField>) = apply { - this.traceNumbers = traceNumbers.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [traceNumbers]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addTraceNumber(traceNumber: String) = apply { - traceNumbers = - (traceNumbers ?: JsonField.of(mutableListOf())).also { - checkKnown("traceNumbers", it).add(traceNumber) - } - } - - 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 [AchMethodAttributes]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .secCode() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): AchMethodAttributes = - AchMethodAttributes( - checkRequired("secCode", secCode), - addenda, - companyId, - receiptRoutingNumber, - retries, - returnReasonCode, - (traceNumbers ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): AchMethodAttributes = apply { - if (validated) { - return@apply - } - - secCode().validate() - addenda() - companyId() - receiptRoutingNumber() - retries() - returnReasonCode() - traceNumbers() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 = - (secCode.asKnown().getOrNull()?.validity() ?: 0) + - (if (addenda.asKnown().isPresent) 1 else 0) + - (if (companyId.asKnown().isPresent) 1 else 0) + - (if (receiptRoutingNumber.asKnown().isPresent) 1 else 0) + - (if (retries.asKnown().isPresent) 1 else 0) + - (if (returnReasonCode.asKnown().isPresent) 1 else 0) + - (traceNumbers.asKnown().getOrNull()?.size ?: 0) - - /** SEC code for ACH transaction */ - class SecCode - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val CCD = of("CCD") - - @JvmField val PPD = of("PPD") - - @JvmField val WEB = of("WEB") - - @JvmField val TEL = of("TEL") - - @JvmField val CIE = of("CIE") - - @JvmField val CTX = of("CTX") - - @JvmStatic fun of(value: String) = SecCode(JsonField.of(value)) - } - - /** An enum containing [SecCode]'s known values. */ - enum class Known { - CCD, - PPD, - WEB, - TEL, - CIE, - CTX, - } - - /** - * An enum containing [SecCode]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [SecCode] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then 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 { - CCD, - PPD, - WEB, - TEL, - CIE, - CTX, - /** - * An enum member indicating that [SecCode] 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) { - CCD -> Value.CCD - PPD -> Value.PPD - WEB -> Value.WEB - TEL -> Value.TEL - CIE -> Value.CIE - CTX -> Value.CTX - 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 LithicInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - CCD -> Known.CCD - PPD -> Known.PPD - WEB -> Known.WEB - TEL -> Known.TEL - CIE -> Known.CIE - CTX -> Known.CTX - else -> throw LithicInvalidDataException("Unknown SecCode: $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 LithicInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): SecCode = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 SecCode && 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 AchMethodAttributes && - secCode == other.secCode && - addenda == other.addenda && - companyId == other.companyId && - receiptRoutingNumber == other.receiptRoutingNumber && - retries == other.retries && - returnReasonCode == other.returnReasonCode && - traceNumbers == other.traceNumbers && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - secCode, - addenda, - companyId, - receiptRoutingNumber, - retries, - returnReasonCode, - traceNumbers, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "AchMethodAttributes{secCode=$secCode, addenda=$addenda, companyId=$companyId, receiptRoutingNumber=$receiptRoutingNumber, retries=$retries, returnReasonCode=$returnReasonCode, traceNumbers=$traceNumbers, additionalProperties=$additionalProperties}" - } - - class WireMethodAttributes - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val wireNetwork: JsonField, - private val creditor: JsonField, - private val debtor: JsonField, - private val messageId: JsonField, - private val remittanceInformation: JsonField, - private val wireMessageType: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("wire_network") - @ExcludeMissing - wireNetwork: JsonField = JsonMissing.of(), - @JsonProperty("creditor") - @ExcludeMissing - creditor: JsonField = JsonMissing.of(), - @JsonProperty("debtor") - @ExcludeMissing - debtor: JsonField = JsonMissing.of(), - @JsonProperty("message_id") - @ExcludeMissing - messageId: JsonField = JsonMissing.of(), - @JsonProperty("remittance_information") - @ExcludeMissing - remittanceInformation: JsonField = JsonMissing.of(), - @JsonProperty("wire_message_type") - @ExcludeMissing - wireMessageType: JsonField = JsonMissing.of(), - ) : this( - wireNetwork, - creditor, - debtor, - messageId, - remittanceInformation, - wireMessageType, - mutableMapOf(), - ) - - /** - * Type of wire transfer - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun wireNetwork(): WireNetwork = wireNetwork.getRequired("wire_network") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun creditor(): Optional = creditor.getOptional("creditor") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun debtor(): Optional = debtor.getOptional("debtor") - - /** - * Point to point reference identifier, as assigned by the instructing party, used - * for tracking the message through the Fedwire system - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun messageId(): Optional = messageId.getOptional("message_id") - - /** - * Payment details or invoice reference - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun remittanceInformation(): Optional = - remittanceInformation.getOptional("remittance_information") - - /** - * Type of wire message - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun wireMessageType(): Optional = - wireMessageType.getOptional("wire_message_type") - - /** - * Returns the raw JSON value of [wireNetwork]. - * - * Unlike [wireNetwork], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("wire_network") - @ExcludeMissing - fun _wireNetwork(): JsonField = wireNetwork - - /** - * Returns the raw JSON value of [creditor]. - * - * Unlike [creditor], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("creditor") - @ExcludeMissing - fun _creditor(): JsonField = creditor - - /** - * Returns the raw JSON value of [debtor]. - * - * Unlike [debtor], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("debtor") - @ExcludeMissing - fun _debtor(): JsonField = debtor - - /** - * Returns the raw JSON value of [messageId]. - * - * Unlike [messageId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("message_id") - @ExcludeMissing - fun _messageId(): JsonField = messageId - - /** - * Returns the raw JSON value of [remittanceInformation]. - * - * Unlike [remittanceInformation], this method doesn't throw if the JSON field has - * an unexpected type. - */ - @JsonProperty("remittance_information") - @ExcludeMissing - fun _remittanceInformation(): JsonField = remittanceInformation - - /** - * Returns the raw JSON value of [wireMessageType]. - * - * Unlike [wireMessageType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("wire_message_type") - @ExcludeMissing - fun _wireMessageType(): JsonField = wireMessageType - - @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 - * [WireMethodAttributes]. - * - * The following fields are required: - * ```java - * .wireNetwork() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [WireMethodAttributes]. */ - class Builder internal constructor() { - - private var wireNetwork: JsonField? = null - private var creditor: JsonField = JsonMissing.of() - private var debtor: JsonField = JsonMissing.of() - private var messageId: JsonField = JsonMissing.of() - private var remittanceInformation: JsonField = JsonMissing.of() - private var wireMessageType: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(wireMethodAttributes: WireMethodAttributes) = apply { - wireNetwork = wireMethodAttributes.wireNetwork - creditor = wireMethodAttributes.creditor - debtor = wireMethodAttributes.debtor - messageId = wireMethodAttributes.messageId - remittanceInformation = wireMethodAttributes.remittanceInformation - wireMessageType = wireMethodAttributes.wireMessageType - additionalProperties = - wireMethodAttributes.additionalProperties.toMutableMap() - } - - /** Type of wire transfer */ - fun wireNetwork(wireNetwork: WireNetwork) = - wireNetwork(JsonField.of(wireNetwork)) - - /** - * Sets [Builder.wireNetwork] to an arbitrary JSON value. - * - * You should usually call [Builder.wireNetwork] with a well-typed [WireNetwork] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun wireNetwork(wireNetwork: JsonField) = apply { - this.wireNetwork = wireNetwork - } - - fun creditor(creditor: WirePartyDetails) = creditor(JsonField.of(creditor)) - - /** - * Sets [Builder.creditor] to an arbitrary JSON value. - * - * You should usually call [Builder.creditor] with a well-typed - * [WirePartyDetails] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun creditor(creditor: JsonField) = apply { - this.creditor = creditor - } - - fun debtor(debtor: WirePartyDetails) = debtor(JsonField.of(debtor)) - - /** - * Sets [Builder.debtor] to an arbitrary JSON value. - * - * You should usually call [Builder.debtor] with a well-typed [WirePartyDetails] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun debtor(debtor: JsonField) = apply { this.debtor = debtor } - - /** - * Point to point reference identifier, as assigned by the instructing party, - * used for tracking the message through the Fedwire system - */ - fun messageId(messageId: String?) = messageId(JsonField.ofNullable(messageId)) - - /** Alias for calling [Builder.messageId] with `messageId.orElse(null)`. */ - fun messageId(messageId: Optional) = messageId(messageId.getOrNull()) - - /** - * Sets [Builder.messageId] to an arbitrary JSON value. - * - * You should usually call [Builder.messageId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun messageId(messageId: JsonField) = apply { - this.messageId = messageId - } - - /** Payment details or invoice reference */ - fun remittanceInformation(remittanceInformation: String?) = - remittanceInformation(JsonField.ofNullable(remittanceInformation)) - - /** - * Alias for calling [Builder.remittanceInformation] with - * `remittanceInformation.orElse(null)`. - */ - fun remittanceInformation(remittanceInformation: Optional) = - remittanceInformation(remittanceInformation.getOrNull()) - - /** - * Sets [Builder.remittanceInformation] to an arbitrary JSON value. - * - * You should usually call [Builder.remittanceInformation] with a well-typed - * [String] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun remittanceInformation(remittanceInformation: JsonField) = apply { - this.remittanceInformation = remittanceInformation - } - - /** Type of wire message */ - fun wireMessageType(wireMessageType: String) = - wireMessageType(JsonField.of(wireMessageType)) - - /** - * Sets [Builder.wireMessageType] to an arbitrary JSON value. - * - * You should usually call [Builder.wireMessageType] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun wireMessageType(wireMessageType: JsonField) = apply { - this.wireMessageType = wireMessageType - } - - 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 [WireMethodAttributes]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .wireNetwork() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): WireMethodAttributes = - WireMethodAttributes( - checkRequired("wireNetwork", wireNetwork), - creditor, - debtor, - messageId, - remittanceInformation, - wireMessageType, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): WireMethodAttributes = apply { - if (validated) { - return@apply - } - - wireNetwork().validate() - creditor().ifPresent { it.validate() } - debtor().ifPresent { it.validate() } - messageId() - remittanceInformation() - wireMessageType() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 = - (wireNetwork.asKnown().getOrNull()?.validity() ?: 0) + - (creditor.asKnown().getOrNull()?.validity() ?: 0) + - (debtor.asKnown().getOrNull()?.validity() ?: 0) + - (if (messageId.asKnown().isPresent) 1 else 0) + - (if (remittanceInformation.asKnown().isPresent) 1 else 0) + - (if (wireMessageType.asKnown().isPresent) 1 else 0) - - /** Type of wire transfer */ - class WireNetwork - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val FEDWIRE = of("FEDWIRE") - - @JvmField val SWIFT = of("SWIFT") - - @JvmStatic fun of(value: String) = WireNetwork(JsonField.of(value)) - } - - /** An enum containing [WireNetwork]'s known values. */ - enum class Known { - FEDWIRE, - SWIFT, - } - - /** - * An enum containing [WireNetwork]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [WireNetwork] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then 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 { - FEDWIRE, - SWIFT, - /** - * An enum member indicating that [WireNetwork] 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) { - FEDWIRE -> Value.FEDWIRE - SWIFT -> Value.SWIFT - 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 LithicInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - FEDWIRE -> Known.FEDWIRE - SWIFT -> Known.SWIFT - else -> throw LithicInvalidDataException("Unknown WireNetwork: $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 LithicInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): WireNetwork = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 WireNetwork && 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 WireMethodAttributes && - wireNetwork == other.wireNetwork && - creditor == other.creditor && - debtor == other.debtor && - messageId == other.messageId && - remittanceInformation == other.remittanceInformation && - wireMessageType == other.wireMessageType && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - wireNetwork, - creditor, - debtor, - messageId, - remittanceInformation, - wireMessageType, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "WireMethodAttributes{wireNetwork=$wireNetwork, creditor=$creditor, debtor=$debtor, messageId=$messageId, remittanceInformation=$remittanceInformation, wireMessageType=$wireMessageType, additionalProperties=$additionalProperties}" - } - } - - /** Related account tokens for the transaction */ - class RelatedAccountTokens - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val accountToken: JsonField, - private val businessAccountToken: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("account_token") - @ExcludeMissing - accountToken: JsonField = JsonMissing.of(), - @JsonProperty("business_account_token") - @ExcludeMissing - businessAccountToken: JsonField = JsonMissing.of(), - ) : this(accountToken, businessAccountToken, mutableMapOf()) - - /** - * Globally unique identifier for the account - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun accountToken(): Optional = accountToken.getOptional("account_token") - - /** - * Globally unique identifier for the business account - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun businessAccountToken(): Optional = - businessAccountToken.getOptional("business_account_token") - - /** - * Returns the raw JSON value of [accountToken]. - * - * Unlike [accountToken], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("account_token") - @ExcludeMissing - fun _accountToken(): JsonField = accountToken - - /** - * Returns the raw JSON value of [businessAccountToken]. - * - * Unlike [businessAccountToken], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("business_account_token") - @ExcludeMissing - fun _businessAccountToken(): JsonField = businessAccountToken - - @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 [RelatedAccountTokens]. - * - * The following fields are required: - * ```java - * .accountToken() - * .businessAccountToken() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [RelatedAccountTokens]. */ - class Builder internal constructor() { - - private var accountToken: JsonField? = null - private var businessAccountToken: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(relatedAccountTokens: RelatedAccountTokens) = apply { - accountToken = relatedAccountTokens.accountToken - businessAccountToken = relatedAccountTokens.businessAccountToken - additionalProperties = relatedAccountTokens.additionalProperties.toMutableMap() - } - - /** Globally unique identifier for the account */ - fun accountToken(accountToken: String?) = - accountToken(JsonField.ofNullable(accountToken)) - - /** Alias for calling [Builder.accountToken] with `accountToken.orElse(null)`. */ - fun accountToken(accountToken: Optional) = - accountToken(accountToken.getOrNull()) - - /** - * Sets [Builder.accountToken] to an arbitrary JSON value. - * - * You should usually call [Builder.accountToken] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun accountToken(accountToken: JsonField) = apply { - this.accountToken = accountToken - } - - /** Globally unique identifier for the business account */ - fun businessAccountToken(businessAccountToken: String?) = - businessAccountToken(JsonField.ofNullable(businessAccountToken)) - - /** - * Alias for calling [Builder.businessAccountToken] with - * `businessAccountToken.orElse(null)`. - */ - fun businessAccountToken(businessAccountToken: Optional) = - businessAccountToken(businessAccountToken.getOrNull()) - - /** - * Sets [Builder.businessAccountToken] to an arbitrary JSON value. - * - * You should usually call [Builder.businessAccountToken] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun businessAccountToken(businessAccountToken: JsonField) = apply { - this.businessAccountToken = businessAccountToken - } - - 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 [RelatedAccountTokens]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .accountToken() - * .businessAccountToken() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): RelatedAccountTokens = - RelatedAccountTokens( - checkRequired("accountToken", accountToken), - checkRequired("businessAccountToken", businessAccountToken), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): RelatedAccountTokens = apply { - if (validated) { - return@apply - } - - accountToken() - businessAccountToken() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 (accountToken.asKnown().isPresent) 1 else 0) + - (if (businessAccountToken.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is RelatedAccountTokens && - accountToken == other.accountToken && - businessAccountToken == other.businessAccountToken && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(accountToken, businessAccountToken, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "RelatedAccountTokens{accountToken=$accountToken, businessAccountToken=$businessAccountToken, additionalProperties=$additionalProperties}" - } - - /** Transaction result */ - class TransactionResult - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** Alias for calling [Builder.network] with `network.orElse(null)`. */ + fun network(network: Optional) = network(network.getOrNull()) /** - * Returns this class instance's raw value. + * Sets [Builder.network] to an arbitrary JSON value. * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. + * You should usually call [Builder.network] with a well-typed [Transaction.Network] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val APPROVED = of("APPROVED") - - @JvmField val DECLINED = of("DECLINED") - - @JvmStatic fun of(value: String) = TransactionResult(JsonField.of(value)) - } - - /** An enum containing [TransactionResult]'s known values. */ - enum class Known { - APPROVED, - DECLINED, - } + fun network(network: JsonField) = apply { this.network = network } /** - * An enum containing [TransactionResult]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [TransactionResult] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. + * Network-provided score assessing risk level associated with a given authorization. + * Scores are on a range of 0-999, with 0 representing the lowest risk and 999 + * representing the highest risk. For Visa transactions, where the raw score has a range + * of 0-99, Lithic will normalize the score by multiplying the raw score by 10x. */ - enum class Value { - APPROVED, - DECLINED, - /** - * An enum member indicating that [TransactionResult] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } + fun networkRiskScore(networkRiskScore: Long?) = + networkRiskScore(JsonField.ofNullable(networkRiskScore)) /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * Alias for [Builder.networkRiskScore]. * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. + * This unboxed primitive overload exists for backwards compatibility. */ - fun value(): Value = - when (this) { - APPROVED -> Value.APPROVED - DECLINED -> Value.DECLINED - else -> Value._UNKNOWN - } + fun networkRiskScore(networkRiskScore: Long) = + networkRiskScore(networkRiskScore as Long?) /** - * 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 LithicInvalidDataException if this class instance's value is a not a known - * member. + * Alias for calling [Builder.networkRiskScore] with `networkRiskScore.orElse(null)`. */ - fun known(): Known = - when (this) { - APPROVED -> Known.APPROVED - DECLINED -> Known.DECLINED - else -> throw LithicInvalidDataException("Unknown TransactionResult: $value") - } + fun networkRiskScore(networkRiskScore: Optional) = + networkRiskScore(networkRiskScore.getOrNull()) /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. + * Sets [Builder.networkRiskScore] to an arbitrary JSON value. * - * @throws LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. + * 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 asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): TransactionResult = apply { - if (validated) { - return@apply - } - - known() - validated = true + fun networkRiskScore(networkRiskScore: JsonField) = apply { + this.networkRiskScore = networkRiskScore } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } + fun pos(pos: Transaction.Pos) = pos(JsonField.of(pos)) /** - * Returns a score indicating how many valid values are contained in this object - * recursively. + * Sets [Builder.pos] to an arbitrary JSON value. * - * Used for best match union deserialization. + * You should usually call [Builder.pos] with a well-typed [Transaction.Pos] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + fun pos(pos: JsonField) = apply { this.pos = pos } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun result(result: Transaction.DeclineResult) = result(JsonField.of(result)) - return other is TransactionResult && value == other.value + /** + * Sets [Builder.result] to an arbitrary JSON value. + * + * You should usually call [Builder.result] with a well-typed + * [Transaction.DeclineResult] 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 } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** Transaction source */ - class Source @JsonCreator private constructor(private val value: JsonField) : Enum { + /** The settled amount of the transaction in the settlement currency. */ + @Deprecated("deprecated") + fun settledAmount(settledAmount: Long) = settledAmount(JsonField.of(settledAmount)) /** - * Returns this class instance's raw value. + * Sets [Builder.settledAmount] to an arbitrary JSON value. * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. + * You should usually call [Builder.settledAmount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @Deprecated("deprecated") + fun settledAmount(settledAmount: JsonField) = apply { + this.settledAmount = settledAmount + } - companion object { + /** Status of the transaction. */ + fun status(status: Transaction.Status) = status(JsonField.of(status)) - @JvmField val LITHIC = of("LITHIC") + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Transaction.Status] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun status(status: JsonField) = apply { this.status = status } - @JvmField val EXTERNAL = of("EXTERNAL") + fun tokenInfo(tokenInfo: Transaction.TokenInfo?) = + tokenInfo(JsonField.ofNullable(tokenInfo)) - @JvmField val CUSTOMER = of("CUSTOMER") + /** Alias for calling [Builder.tokenInfo] with `tokenInfo.orElse(null)`. */ + fun tokenInfo(tokenInfo: Optional) = + tokenInfo(tokenInfo.getOrNull()) - @JvmStatic fun of(value: String) = Source(JsonField.of(value)) + /** + * Sets [Builder.tokenInfo] to an arbitrary JSON value. + * + * You should usually call [Builder.tokenInfo] with a well-typed [Transaction.TokenInfo] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun tokenInfo(tokenInfo: JsonField) = apply { + this.tokenInfo = tokenInfo } - /** An enum containing [Source]'s known values. */ - enum class Known { - LITHIC, - EXTERNAL, - CUSTOMER, - } + /** Date and time when the transaction last updated. UTC time zone. */ + fun updated(updated: OffsetDateTime) = updated(JsonField.of(updated)) /** - * An enum containing [Source]'s known values, as well as an [_UNKNOWN] member. + * Sets [Builder.updated] to an arbitrary JSON value. * - * An instance of [Source] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. + * You should usually call [Builder.updated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - enum class Value { - LITHIC, - EXTERNAL, - CUSTOMER, - /** - * An enum member indicating that [Source] was instantiated with an unknown value. - */ - _UNKNOWN, - } + fun updated(updated: JsonField) = apply { this.updated = updated } + + fun events(events: List) = events(JsonField.of(events)) /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * Sets [Builder.events] to an arbitrary JSON value. * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. + * You should usually call [Builder.events] with a well-typed + * `List` value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. */ - fun value(): Value = - when (this) { - LITHIC -> Value.LITHIC - EXTERNAL -> Value.EXTERNAL - CUSTOMER -> Value.CUSTOMER - else -> Value._UNKNOWN - } + fun events(events: JsonField>) = apply { + this.events = events.map { it.toMutableList() } + } /** - * 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. + * Adds a single [Transaction.TransactionEvent] to [events]. * - * @throws LithicInvalidDataException if this class instance's value is a not a known - * member. + * @throws IllegalStateException if the field was previously set to a non-list. */ - fun known(): Known = - when (this) { - LITHIC -> Known.LITHIC - EXTERNAL -> Known.EXTERNAL - CUSTOMER -> Known.CUSTOMER - else -> throw LithicInvalidDataException("Unknown Source: $value") - } + fun addEvent(event: Transaction.TransactionEvent) = apply { + events = + (events ?: JsonField.of(mutableListOf())).also { + checkKnown("events", it).add(event) + } + } + + /** CARD - Card Transaction */ + fun family(family: Family) = family(JsonField.of(family)) /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. + * Sets [Builder.family] to an arbitrary JSON value. * - * @throws LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. + * You should usually call [Builder.family] with a well-typed [Family] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } + fun family(family: JsonField) = apply { this.family = family } - private var validated: Boolean = false + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun validate(): Source = apply { - if (validated) { - return@apply - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - known() - validated = true + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } /** - * Returns a score indicating how many valid values are contained in this object - * recursively. + * Returns an immutable instance of [CardTransaction]. * - * Used for best match union deserialization. + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .token() + * .accountToken() + * .acquirerFee() + * .acquirerReferenceNumber() + * .amount() + * .amounts() + * .authorizationAmount() + * .authorizationCode() + * .avs() + * .cardToken() + * .cardholderAuthentication() + * .created() + * .financialAccountToken() + * .merchant() + * .merchantAmount() + * .merchantAuthorizationAmount() + * .merchantCurrency() + * .network() + * .networkRiskScore() + * .pos() + * .result() + * .settledAmount() + * .status() + * .tokenInfo() + * .updated() + * ``` + * + * @throws IllegalStateException if any required field is unset. */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + fun build(): CardTransaction = + CardTransaction( + checkRequired("token", token), + checkRequired("accountToken", accountToken), + checkRequired("acquirerFee", acquirerFee), + checkRequired("acquirerReferenceNumber", acquirerReferenceNumber), + checkRequired("amount", amount), + checkRequired("amounts", amounts), + checkRequired("authorizationAmount", authorizationAmount), + checkRequired("authorizationCode", authorizationCode), + checkRequired("avs", avs), + checkRequired("cardToken", cardToken), + checkRequired("cardholderAuthentication", cardholderAuthentication), + checkRequired("created", created), + checkRequired("financialAccountToken", financialAccountToken), + checkRequired("merchant", merchant), + checkRequired("merchantAmount", merchantAmount), + checkRequired("merchantAuthorizationAmount", merchantAuthorizationAmount), + checkRequired("merchantCurrency", merchantCurrency), + checkRequired("network", network), + checkRequired("networkRiskScore", networkRiskScore), + checkRequired("pos", pos), + checkRequired("result", result), + checkRequired("settledAmount", settledAmount), + checkRequired("status", status), + checkRequired("tokenInfo", tokenInfo), + checkRequired("updated", updated), + (events ?: JsonMissing.of()).map { it.toImmutable() }, + family, + additionalProperties.toMutableMap(), + ) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + private var validated: Boolean = false - return other is Source && value == other.value + fun validate(): CardTransaction = apply { + if (validated) { + return@apply } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() + token() + accountToken() + acquirerFee() + acquirerReferenceNumber() + amount() + amounts().validate() + authorizationAmount() + authorizationCode() + avs().ifPresent { it.validate() } + cardToken() + cardholderAuthentication().ifPresent { it.validate() } + created() + financialAccountToken() + merchant().validate() + merchantAmount() + merchantAuthorizationAmount() + merchantCurrency() + network().ifPresent { it.validate() } + networkRiskScore() + pos().validate() + result().validate() + settledAmount() + status().validate() + tokenInfo().ifPresent { it.validate() } + updated() + events().ifPresent { it.forEach { it.validate() } } + family().ifPresent { it.validate() } + validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 (token.asKnown().isPresent) 1 else 0) + + (if (accountToken.asKnown().isPresent) 1 else 0) + + (if (acquirerFee.asKnown().isPresent) 1 else 0) + + (if (acquirerReferenceNumber.asKnown().isPresent) 1 else 0) + + (if (amount.asKnown().isPresent) 1 else 0) + + (amounts.asKnown().getOrNull()?.validity() ?: 0) + + (if (authorizationAmount.asKnown().isPresent) 1 else 0) + + (if (authorizationCode.asKnown().isPresent) 1 else 0) + + (avs.asKnown().getOrNull()?.validity() ?: 0) + + (if (cardToken.asKnown().isPresent) 1 else 0) + + (cardholderAuthentication.asKnown().getOrNull()?.validity() ?: 0) + + (if (created.asKnown().isPresent) 1 else 0) + + (if (financialAccountToken.asKnown().isPresent) 1 else 0) + + (merchant.asKnown().getOrNull()?.validity() ?: 0) + + (if (merchantAmount.asKnown().isPresent) 1 else 0) + + (if (merchantAuthorizationAmount.asKnown().isPresent) 1 else 0) + + (if (merchantCurrency.asKnown().isPresent) 1 else 0) + + (network.asKnown().getOrNull()?.validity() ?: 0) + + (if (networkRiskScore.asKnown().isPresent) 1 else 0) + + (pos.asKnown().getOrNull()?.validity() ?: 0) + + (result.asKnown().getOrNull()?.validity() ?: 0) + + (if (settledAmount.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (tokenInfo.asKnown().getOrNull()?.validity() ?: 0) + + (if (updated.asKnown().isPresent) 1 else 0) + + (events.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (family.asKnown().getOrNull()?.validity() ?: 0) + /** The status of the transaction */ class TransactionStatus @JsonCreator @@ -12054,8 +4263,8 @@ private constructor( override fun toString() = value.toString() } - class TransferType @JsonCreator private constructor(private val value: JsonField) : - Enum { + /** CARD - Card Transaction */ + class Family @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -12069,58 +4278,29 @@ private constructor( companion object { - @JvmField val ORIGINATION_CREDIT = of("ORIGINATION_CREDIT") - - @JvmField val ORIGINATION_DEBIT = of("ORIGINATION_DEBIT") - - @JvmField val RECEIPT_CREDIT = of("RECEIPT_CREDIT") - - @JvmField val RECEIPT_DEBIT = of("RECEIPT_DEBIT") - - @JvmField val WIRE_INBOUND_PAYMENT = of("WIRE_INBOUND_PAYMENT") - - @JvmField val WIRE_INBOUND_ADMIN = of("WIRE_INBOUND_ADMIN") - - @JvmField val WIRE_OUTBOUND_PAYMENT = of("WIRE_OUTBOUND_PAYMENT") - - @JvmField val WIRE_OUTBOUND_ADMIN = of("WIRE_OUTBOUND_ADMIN") + @JvmField val CARD = of("CARD") - @JvmStatic fun of(value: String) = TransferType(JsonField.of(value)) + @JvmStatic fun of(value: String) = Family(JsonField.of(value)) } - /** An enum containing [TransferType]'s known values. */ + /** An enum containing [Family]'s known values. */ enum class Known { - ORIGINATION_CREDIT, - ORIGINATION_DEBIT, - RECEIPT_CREDIT, - RECEIPT_DEBIT, - WIRE_INBOUND_PAYMENT, - WIRE_INBOUND_ADMIN, - WIRE_OUTBOUND_PAYMENT, - WIRE_OUTBOUND_ADMIN, + CARD } /** - * An enum containing [TransferType]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [Family]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [TransferType] can contain an unknown value in a couple of cases: + * An instance of [Family] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, if * the SDK is on an older version than the API, then 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 { - ORIGINATION_CREDIT, - ORIGINATION_DEBIT, - RECEIPT_CREDIT, - RECEIPT_DEBIT, - WIRE_INBOUND_PAYMENT, - WIRE_INBOUND_ADMIN, - WIRE_OUTBOUND_PAYMENT, - WIRE_OUTBOUND_ADMIN, + CARD, /** - * An enum member indicating that [TransferType] was instantiated with an unknown - * value. + * An enum member indicating that [Family] was instantiated with an unknown value. */ _UNKNOWN, } @@ -12134,14 +4314,7 @@ private constructor( */ fun value(): Value = when (this) { - ORIGINATION_CREDIT -> Value.ORIGINATION_CREDIT - ORIGINATION_DEBIT -> Value.ORIGINATION_DEBIT - RECEIPT_CREDIT -> Value.RECEIPT_CREDIT - RECEIPT_DEBIT -> Value.RECEIPT_DEBIT - WIRE_INBOUND_PAYMENT -> Value.WIRE_INBOUND_PAYMENT - WIRE_INBOUND_ADMIN -> Value.WIRE_INBOUND_ADMIN - WIRE_OUTBOUND_PAYMENT -> Value.WIRE_OUTBOUND_PAYMENT - WIRE_OUTBOUND_ADMIN -> Value.WIRE_OUTBOUND_ADMIN + CARD -> Value.CARD else -> Value._UNKNOWN } @@ -12156,15 +4329,8 @@ private constructor( */ fun known(): Known = when (this) { - ORIGINATION_CREDIT -> Known.ORIGINATION_CREDIT - ORIGINATION_DEBIT -> Known.ORIGINATION_DEBIT - RECEIPT_CREDIT -> Known.RECEIPT_CREDIT - RECEIPT_DEBIT -> Known.RECEIPT_DEBIT - WIRE_INBOUND_PAYMENT -> Known.WIRE_INBOUND_PAYMENT - WIRE_INBOUND_ADMIN -> Known.WIRE_INBOUND_ADMIN - WIRE_OUTBOUND_PAYMENT -> Known.WIRE_OUTBOUND_PAYMENT - WIRE_OUTBOUND_ADMIN -> Known.WIRE_OUTBOUND_ADMIN - else -> throw LithicInvalidDataException("Unknown TransferType: $value") + CARD -> Known.CARD + else -> throw LithicInvalidDataException("Unknown Family: $value") } /** @@ -12183,7 +4349,7 @@ private constructor( private var validated: Boolean = false - fun validate(): TransferType = apply { + fun validate(): Family = apply { if (validated) { return@apply } @@ -12213,7 +4379,7 @@ private constructor( return true } - return other is TransferType && value == other.value + return other is Family && value == other.value } override fun hashCode() = value.hashCode() @@ -12226,56 +4392,66 @@ private constructor( return true } - return other is PaymentTransaction && + return other is CardTransaction && token == other.token && - category == other.category && + accountToken == other.accountToken && + acquirerFee == other.acquirerFee && + acquirerReferenceNumber == other.acquirerReferenceNumber && + amount == other.amount && + amounts == other.amounts && + authorizationAmount == other.authorizationAmount && + authorizationCode == other.authorizationCode && + avs == other.avs && + cardToken == other.cardToken && + cardholderAuthentication == other.cardholderAuthentication && created == other.created && - descriptor == other.descriptor && - direction == other.direction && - events == other.events && - family == other.family && financialAccountToken == other.financialAccountToken && - method == other.method && - methodAttributes == other.methodAttributes && - pendingAmount == other.pendingAmount && - relatedAccountTokens == other.relatedAccountTokens && + merchant == other.merchant && + merchantAmount == other.merchantAmount && + merchantAuthorizationAmount == other.merchantAuthorizationAmount && + merchantCurrency == other.merchantCurrency && + network == other.network && + networkRiskScore == other.networkRiskScore && + pos == other.pos && result == other.result && settledAmount == other.settledAmount && - source == other.source && status == other.status && + tokenInfo == other.tokenInfo && updated == other.updated && - currency == other.currency && - expectedReleaseDate == other.expectedReleaseDate && - externalBankAccountToken == other.externalBankAccountToken && - type == other.type && - userDefinedId == other.userDefinedId && + events == other.events && + family == other.family && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { Objects.hash( token, - category, + accountToken, + acquirerFee, + acquirerReferenceNumber, + amount, + amounts, + authorizationAmount, + authorizationCode, + avs, + cardToken, + cardholderAuthentication, created, - descriptor, - direction, - events, - family, financialAccountToken, - method, - methodAttributes, - pendingAmount, - relatedAccountTokens, + merchant, + merchantAmount, + merchantAuthorizationAmount, + merchantCurrency, + network, + networkRiskScore, + pos, result, settledAmount, - source, status, + tokenInfo, updated, - currency, - expectedReleaseDate, - externalBankAccountToken, - type, - userDefinedId, + events, + family, additionalProperties, ) } @@ -12283,6 +4459,6 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PaymentTransaction{token=$token, category=$category, created=$created, descriptor=$descriptor, direction=$direction, events=$events, family=$family, financialAccountToken=$financialAccountToken, method=$method, methodAttributes=$methodAttributes, pendingAmount=$pendingAmount, relatedAccountTokens=$relatedAccountTokens, result=$result, settledAmount=$settledAmount, source=$source, status=$status, updated=$updated, currency=$currency, expectedReleaseDate=$expectedReleaseDate, externalBankAccountToken=$externalBankAccountToken, type=$type, userDefinedId=$userDefinedId, additionalProperties=$additionalProperties}" + "CardTransaction{token=$token, accountToken=$accountToken, acquirerFee=$acquirerFee, acquirerReferenceNumber=$acquirerReferenceNumber, amount=$amount, amounts=$amounts, authorizationAmount=$authorizationAmount, authorizationCode=$authorizationCode, avs=$avs, cardToken=$cardToken, cardholderAuthentication=$cardholderAuthentication, created=$created, financialAccountToken=$financialAccountToken, merchant=$merchant, merchantAmount=$merchantAmount, merchantAuthorizationAmount=$merchantAuthorizationAmount, merchantCurrency=$merchantCurrency, network=$network, networkRiskScore=$networkRiskScore, pos=$pos, result=$result, settledAmount=$settledAmount, status=$status, tokenInfo=$tokenInfo, updated=$updated, events=$events, family=$family, additionalProperties=$additionalProperties}" } } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityRetrieveTransactionResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityRetrieveTransactionResponse.kt index 2ea504d60..ebf79985d 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityRetrieveTransactionResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityRetrieveTransactionResponse.kt @@ -20,96 +20,93 @@ import com.lithic.api.core.ExcludeMissing import com.lithic.api.core.JsonField import com.lithic.api.core.JsonMissing import com.lithic.api.core.JsonValue -import com.lithic.api.core.allMaxBy import com.lithic.api.core.checkKnown import com.lithic.api.core.checkRequired import com.lithic.api.core.getOrThrow import com.lithic.api.core.toImmutable import com.lithic.api.errors.LithicInvalidDataException -import java.time.LocalDate import java.time.OffsetDateTime import java.util.Collections import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Response containing multiple transaction types */ +/** + * Response containing multiple transaction types. The `family` field determines which transaction + * type is returned: INTERNAL returns FinancialTransaction, TRANSFER returns + * BookTransferTransaction, CARD returns CardTransaction, PAYMENT returns PaymentTransaction, + * EXTERNAL_PAYMENT returns ExternalPaymentResponse, and MANAGEMENT_OPERATION returns + * ManagementOperationTransaction + */ @JsonDeserialize(using = AccountActivityRetrieveTransactionResponse.Deserializer::class) @JsonSerialize(using = AccountActivityRetrieveTransactionResponse.Serializer::class) class AccountActivityRetrieveTransactionResponse private constructor( - private val financialTransaction: FinancialTransaction? = null, - private val bookTransferTransaction: BookTransferTransaction? = null, - private val cardTransaction: CardTransaction? = null, - private val paymentTransaction: PaymentTransaction? = null, + private val internal_: FinancialTransaction? = null, + private val transfer: BookTransferResponse? = null, + private val card: CardTransaction? = null, + private val payment: Payment? = null, private val externalPayment: ExternalPayment? = null, - private val managementOperationTransaction: ManagementOperationTransaction? = null, + private val managementOperation: ManagementOperationTransaction? = null, private val _json: JsonValue? = null, ) { /** Financial transaction with inheritance from unified base transaction */ - fun financialTransaction(): Optional = - Optional.ofNullable(financialTransaction) + fun internal_(): Optional = Optional.ofNullable(internal_) /** Book transfer transaction */ - fun bookTransferTransaction(): Optional = - Optional.ofNullable(bookTransferTransaction) + fun transfer(): Optional = Optional.ofNullable(transfer) - /** Base class for all transaction types in the ledger service */ - fun cardTransaction(): Optional = Optional.ofNullable(cardTransaction) + /** Card transaction with ledger base properties */ + fun card(): Optional = Optional.ofNullable(card) /** Payment transaction */ - fun paymentTransaction(): Optional = Optional.ofNullable(paymentTransaction) + fun payment(): Optional = Optional.ofNullable(payment) fun externalPayment(): Optional = Optional.ofNullable(externalPayment) - fun managementOperationTransaction(): Optional = - Optional.ofNullable(managementOperationTransaction) + fun managementOperation(): Optional = + Optional.ofNullable(managementOperation) - fun isFinancialTransaction(): Boolean = financialTransaction != null + fun isInternal(): Boolean = internal_ != null - fun isBookTransferTransaction(): Boolean = bookTransferTransaction != null + fun isTransfer(): Boolean = transfer != null - fun isCardTransaction(): Boolean = cardTransaction != null + fun isCard(): Boolean = card != null - fun isPaymentTransaction(): Boolean = paymentTransaction != null + fun isPayment(): Boolean = payment != null fun isExternalPayment(): Boolean = externalPayment != null - fun isManagementOperationTransaction(): Boolean = managementOperationTransaction != null + fun isManagementOperation(): Boolean = managementOperation != null /** Financial transaction with inheritance from unified base transaction */ - fun asFinancialTransaction(): FinancialTransaction = - financialTransaction.getOrThrow("financialTransaction") + fun asInternal(): FinancialTransaction = internal_.getOrThrow("internal_") /** Book transfer transaction */ - fun asBookTransferTransaction(): BookTransferTransaction = - bookTransferTransaction.getOrThrow("bookTransferTransaction") + fun asTransfer(): BookTransferResponse = transfer.getOrThrow("transfer") - /** Base class for all transaction types in the ledger service */ - fun asCardTransaction(): CardTransaction = cardTransaction.getOrThrow("cardTransaction") + /** Card transaction with ledger base properties */ + fun asCard(): CardTransaction = card.getOrThrow("card") /** Payment transaction */ - fun asPaymentTransaction(): PaymentTransaction = - paymentTransaction.getOrThrow("paymentTransaction") + fun asPayment(): Payment = payment.getOrThrow("payment") fun asExternalPayment(): ExternalPayment = externalPayment.getOrThrow("externalPayment") - fun asManagementOperationTransaction(): ManagementOperationTransaction = - managementOperationTransaction.getOrThrow("managementOperationTransaction") + fun asManagementOperation(): ManagementOperationTransaction = + managementOperation.getOrThrow("managementOperation") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { - financialTransaction != null -> visitor.visitFinancialTransaction(financialTransaction) - bookTransferTransaction != null -> - visitor.visitBookTransferTransaction(bookTransferTransaction) - cardTransaction != null -> visitor.visitCardTransaction(cardTransaction) - paymentTransaction != null -> visitor.visitPaymentTransaction(paymentTransaction) + internal_ != null -> visitor.visitInternal(internal_) + transfer != null -> visitor.visitTransfer(transfer) + card != null -> visitor.visitCard(card) + payment != null -> visitor.visitPayment(payment) externalPayment != null -> visitor.visitExternalPayment(externalPayment) - managementOperationTransaction != null -> - visitor.visitManagementOperationTransaction(managementOperationTransaction) + managementOperation != null -> visitor.visitManagementOperation(managementOperation) else -> visitor.unknown(_json) } @@ -122,32 +119,30 @@ private constructor( accept( object : Visitor { - override fun visitFinancialTransaction(financialTransaction: FinancialTransaction) { - financialTransaction.validate() + override fun visitInternal(internal_: FinancialTransaction) { + internal_.validate() } - override fun visitBookTransferTransaction( - bookTransferTransaction: BookTransferTransaction - ) { - bookTransferTransaction.validate() + override fun visitTransfer(transfer: BookTransferResponse) { + transfer.validate() } - override fun visitCardTransaction(cardTransaction: CardTransaction) { - cardTransaction.validate() + override fun visitCard(card: CardTransaction) { + card.validate() } - override fun visitPaymentTransaction(paymentTransaction: PaymentTransaction) { - paymentTransaction.validate() + override fun visitPayment(payment: Payment) { + payment.validate() } override fun visitExternalPayment(externalPayment: ExternalPayment) { externalPayment.validate() } - override fun visitManagementOperationTransaction( - managementOperationTransaction: ManagementOperationTransaction + override fun visitManagementOperation( + managementOperation: ManagementOperationTransaction ) { - managementOperationTransaction.validate() + managementOperation.validate() } } ) @@ -171,25 +166,20 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitFinancialTransaction(financialTransaction: FinancialTransaction) = - financialTransaction.validity() + override fun visitInternal(internal_: FinancialTransaction) = internal_.validity() - override fun visitBookTransferTransaction( - bookTransferTransaction: BookTransferTransaction - ) = bookTransferTransaction.validity() + override fun visitTransfer(transfer: BookTransferResponse) = transfer.validity() - override fun visitCardTransaction(cardTransaction: CardTransaction) = - cardTransaction.validity() + override fun visitCard(card: CardTransaction) = card.validity() - override fun visitPaymentTransaction(paymentTransaction: PaymentTransaction) = - paymentTransaction.validity() + override fun visitPayment(payment: Payment) = payment.validity() override fun visitExternalPayment(externalPayment: ExternalPayment) = externalPayment.validity() - override fun visitManagementOperationTransaction( - managementOperationTransaction: ManagementOperationTransaction - ) = managementOperationTransaction.validity() + override fun visitManagementOperation( + managementOperation: ManagementOperationTransaction + ) = managementOperation.validity() override fun unknown(json: JsonValue?) = 0 } @@ -201,38 +191,27 @@ private constructor( } return other is AccountActivityRetrieveTransactionResponse && - financialTransaction == other.financialTransaction && - bookTransferTransaction == other.bookTransferTransaction && - cardTransaction == other.cardTransaction && - paymentTransaction == other.paymentTransaction && + internal_ == other.internal_ && + transfer == other.transfer && + card == other.card && + payment == other.payment && externalPayment == other.externalPayment && - managementOperationTransaction == other.managementOperationTransaction + managementOperation == other.managementOperation } override fun hashCode(): Int = - Objects.hash( - financialTransaction, - bookTransferTransaction, - cardTransaction, - paymentTransaction, - externalPayment, - managementOperationTransaction, - ) + Objects.hash(internal_, transfer, card, payment, externalPayment, managementOperation) override fun toString(): String = when { - financialTransaction != null -> - "AccountActivityRetrieveTransactionResponse{financialTransaction=$financialTransaction}" - bookTransferTransaction != null -> - "AccountActivityRetrieveTransactionResponse{bookTransferTransaction=$bookTransferTransaction}" - cardTransaction != null -> - "AccountActivityRetrieveTransactionResponse{cardTransaction=$cardTransaction}" - paymentTransaction != null -> - "AccountActivityRetrieveTransactionResponse{paymentTransaction=$paymentTransaction}" + internal_ != null -> "AccountActivityRetrieveTransactionResponse{internal_=$internal_}" + transfer != null -> "AccountActivityRetrieveTransactionResponse{transfer=$transfer}" + card != null -> "AccountActivityRetrieveTransactionResponse{card=$card}" + payment != null -> "AccountActivityRetrieveTransactionResponse{payment=$payment}" externalPayment != null -> "AccountActivityRetrieveTransactionResponse{externalPayment=$externalPayment}" - managementOperationTransaction != null -> - "AccountActivityRetrieveTransactionResponse{managementOperationTransaction=$managementOperationTransaction}" + managementOperation != null -> + "AccountActivityRetrieveTransactionResponse{managementOperation=$managementOperation}" _json != null -> "AccountActivityRetrieveTransactionResponse{_unknown=$_json}" else -> throw IllegalStateException("Invalid AccountActivityRetrieveTransactionResponse") @@ -242,37 +221,30 @@ private constructor( /** Financial transaction with inheritance from unified base transaction */ @JvmStatic - fun ofFinancialTransaction(financialTransaction: FinancialTransaction) = - AccountActivityRetrieveTransactionResponse(financialTransaction = financialTransaction) + fun ofInternal(internal_: FinancialTransaction) = + AccountActivityRetrieveTransactionResponse(internal_ = internal_) /** Book transfer transaction */ @JvmStatic - fun ofBookTransferTransaction(bookTransferTransaction: BookTransferTransaction) = - AccountActivityRetrieveTransactionResponse( - bookTransferTransaction = bookTransferTransaction - ) + fun ofTransfer(transfer: BookTransferResponse) = + AccountActivityRetrieveTransactionResponse(transfer = transfer) - /** Base class for all transaction types in the ledger service */ + /** Card transaction with ledger base properties */ @JvmStatic - fun ofCardTransaction(cardTransaction: CardTransaction) = - AccountActivityRetrieveTransactionResponse(cardTransaction = cardTransaction) + fun ofCard(card: CardTransaction) = AccountActivityRetrieveTransactionResponse(card = card) /** Payment transaction */ @JvmStatic - fun ofPaymentTransaction(paymentTransaction: PaymentTransaction) = - AccountActivityRetrieveTransactionResponse(paymentTransaction = paymentTransaction) + fun ofPayment(payment: Payment) = + AccountActivityRetrieveTransactionResponse(payment = payment) @JvmStatic fun ofExternalPayment(externalPayment: ExternalPayment) = AccountActivityRetrieveTransactionResponse(externalPayment = externalPayment) @JvmStatic - fun ofManagementOperationTransaction( - managementOperationTransaction: ManagementOperationTransaction - ) = - AccountActivityRetrieveTransactionResponse( - managementOperationTransaction = managementOperationTransaction - ) + fun ofManagementOperation(managementOperation: ManagementOperationTransaction) = + AccountActivityRetrieveTransactionResponse(managementOperation = managementOperation) } /** @@ -282,22 +254,20 @@ private constructor( interface Visitor { /** Financial transaction with inheritance from unified base transaction */ - fun visitFinancialTransaction(financialTransaction: FinancialTransaction): T + fun visitInternal(internal_: FinancialTransaction): T /** Book transfer transaction */ - fun visitBookTransferTransaction(bookTransferTransaction: BookTransferTransaction): T + fun visitTransfer(transfer: BookTransferResponse): T - /** Base class for all transaction types in the ledger service */ - fun visitCardTransaction(cardTransaction: CardTransaction): T + /** Card transaction with ledger base properties */ + fun visitCard(card: CardTransaction): T /** Payment transaction */ - fun visitPaymentTransaction(paymentTransaction: PaymentTransaction): T + fun visitPayment(payment: Payment): T fun visitExternalPayment(externalPayment: ExternalPayment): T - fun visitManagementOperationTransaction( - managementOperationTransaction: ManagementOperationTransaction - ): T + fun visitManagementOperation(managementOperation: ManagementOperationTransaction): T /** * Maps an unknown variant of [AccountActivityRetrieveTransactionResponse] to a value of @@ -328,60 +298,47 @@ private constructor( val json = JsonValue.fromJsonNode(node) val family = json.asObject().getOrNull()?.get("family")?.asString()?.getOrNull() - when (family) {} - - val bestMatches = - sequenceOf( - tryDeserialize(node, jacksonTypeRef())?.let { - AccountActivityRetrieveTransactionResponse( - financialTransaction = it, - _json = json, - ) - }, - tryDeserialize(node, jacksonTypeRef())?.let { - AccountActivityRetrieveTransactionResponse( - bookTransferTransaction = it, - _json = json, - ) - }, - tryDeserialize(node, jacksonTypeRef())?.let { - AccountActivityRetrieveTransactionResponse( - cardTransaction = it, - _json = json, - ) - }, - tryDeserialize(node, jacksonTypeRef())?.let { - AccountActivityRetrieveTransactionResponse( - paymentTransaction = it, - _json = json, - ) - }, - tryDeserialize(node, jacksonTypeRef())?.let { + when (family) { + "INTERNAL" -> { + return tryDeserialize(node, jacksonTypeRef())?.let { + AccountActivityRetrieveTransactionResponse(internal_ = it, _json = json) + } ?: AccountActivityRetrieveTransactionResponse(_json = json) + } + "TRANSFER" -> { + return tryDeserialize(node, jacksonTypeRef())?.let { + AccountActivityRetrieveTransactionResponse(transfer = it, _json = json) + } ?: AccountActivityRetrieveTransactionResponse(_json = json) + } + "CARD" -> { + return tryDeserialize(node, jacksonTypeRef())?.let { + AccountActivityRetrieveTransactionResponse(card = it, _json = json) + } ?: AccountActivityRetrieveTransactionResponse(_json = json) + } + "PAYMENT" -> { + return tryDeserialize(node, jacksonTypeRef())?.let { + AccountActivityRetrieveTransactionResponse(payment = it, _json = json) + } ?: AccountActivityRetrieveTransactionResponse(_json = json) + } + "EXTERNAL_PAYMENT" -> { + return tryDeserialize(node, jacksonTypeRef())?.let { + AccountActivityRetrieveTransactionResponse( + externalPayment = it, + _json = json, + ) + } ?: AccountActivityRetrieveTransactionResponse(_json = json) + } + "MANAGEMENT_OPERATION" -> { + return tryDeserialize(node, jacksonTypeRef()) + ?.let { AccountActivityRetrieveTransactionResponse( - externalPayment = it, + managementOperation = it, _json = json, ) - }, - tryDeserialize(node, jacksonTypeRef()) - ?.let { - AccountActivityRetrieveTransactionResponse( - managementOperationTransaction = it, - _json = json, - ) - }, - ) - .filterNotNull() - .allMaxBy { it.validity() } - .toList() - return when (bestMatches.size) { - // This can happen if what we're deserializing is completely incompatible with all - // the possible variants (e.g. deserializing from boolean). - 0 -> AccountActivityRetrieveTransactionResponse(_json = json) - 1 -> bestMatches.single() - // If there's more than one match with the highest validity, then use the first - // completely valid match, or simply the first match if none are completely valid. - else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first() + } ?: AccountActivityRetrieveTransactionResponse(_json = json) + } } + + return AccountActivityRetrieveTransactionResponse(_json = json) } } @@ -396,15 +353,13 @@ private constructor( provider: SerializerProvider, ) { when { - value.financialTransaction != null -> - generator.writeObject(value.financialTransaction) - value.bookTransferTransaction != null -> - generator.writeObject(value.bookTransferTransaction) - value.cardTransaction != null -> generator.writeObject(value.cardTransaction) - value.paymentTransaction != null -> generator.writeObject(value.paymentTransaction) + value.internal_ != null -> generator.writeObject(value.internal_) + value.transfer != null -> generator.writeObject(value.transfer) + value.card != null -> generator.writeObject(value.card) + value.payment != null -> generator.writeObject(value.payment) value.externalPayment != null -> generator.writeObject(value.externalPayment) - value.managementOperationTransaction != null -> - generator.writeObject(value.managementOperationTransaction) + value.managementOperation != null -> + generator.writeObject(value.managementOperation) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException( @@ -424,7 +379,7 @@ private constructor( private val currency: JsonField, private val descriptor: JsonField, private val events: JsonField>, - private val family: JsonField, + private val family: JsonField, private val financialAccountToken: JsonField, private val pendingAmount: JsonField, private val result: JsonField, @@ -452,9 +407,7 @@ private constructor( @JsonProperty("events") @ExcludeMissing events: JsonField> = JsonMissing.of(), - @JsonProperty("family") - @ExcludeMissing - family: JsonField = JsonMissing.of(), + @JsonProperty("family") @ExcludeMissing family: JsonField = JsonMissing.of(), @JsonProperty("financial_account_token") @ExcludeMissing financialAccountToken: JsonField = JsonMissing.of(), @@ -539,10 +492,12 @@ private constructor( fun events(): List = events.getRequired("events") /** + * INTERNAL - Financial Transaction + * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun family(): TransactionFamilyTypes = family.getRequired("family") + fun family(): Family = family.getRequired("family") /** * Financial account token associated with the transaction @@ -646,9 +601,7 @@ private constructor( * * Unlike [family], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("family") - @ExcludeMissing - fun _family(): JsonField = family + @JsonProperty("family") @ExcludeMissing fun _family(): JsonField = family /** * Returns the raw JSON value of [financialAccountToken]. @@ -747,7 +700,7 @@ private constructor( private var currency: JsonField? = null private var descriptor: JsonField? = null private var events: JsonField>? = null - private var family: JsonField? = null + private var family: JsonField? = null private var financialAccountToken: JsonField? = null private var pendingAmount: JsonField? = null private var result: JsonField? = null @@ -862,16 +815,17 @@ private constructor( } } - fun family(family: TransactionFamilyTypes) = family(JsonField.of(family)) + /** INTERNAL - Financial Transaction */ + fun family(family: Family) = family(JsonField.of(family)) /** * Sets [Builder.family] to an arbitrary JSON value. * - * You should usually call [Builder.family] with a well-typed [TransactionFamilyTypes] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * You should usually call [Builder.family] with a well-typed [Family] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun family(family: JsonField) = apply { this.family = family } + fun family(family: JsonField) = apply { this.family = family } /** Financial account token associated with the transaction */ fun financialAccountToken(financialAccountToken: String) = @@ -2283,9 +2237,8 @@ private constructor( "FinancialEvent{token=$token, amount=$amount, created=$created, result=$result, type=$type, additionalProperties=$additionalProperties}" } - class TransactionFamilyTypes - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** INTERNAL - Financial Transaction */ + class Family @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2299,52 +2252,29 @@ private constructor( companion object { - @JvmField val CARD = of("CARD") - - @JvmField val PAYMENT = of("PAYMENT") - - @JvmField val TRANSFER = of("TRANSFER") - @JvmField val INTERNAL = of("INTERNAL") - @JvmField val EXTERNAL_PAYMENT = of("EXTERNAL_PAYMENT") - - @JvmField val MANAGEMENT_OPERATION = of("MANAGEMENT_OPERATION") - - @JvmStatic fun of(value: String) = TransactionFamilyTypes(JsonField.of(value)) + @JvmStatic fun of(value: String) = Family(JsonField.of(value)) } - /** An enum containing [TransactionFamilyTypes]'s known values. */ + /** An enum containing [Family]'s known values. */ enum class Known { - CARD, - PAYMENT, - TRANSFER, - INTERNAL, - EXTERNAL_PAYMENT, - MANAGEMENT_OPERATION, + INTERNAL } /** - * An enum containing [TransactionFamilyTypes]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [Family]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [TransactionFamilyTypes] can contain an unknown value in a couple of - * cases: + * An instance of [Family] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, if * the SDK is on an older version than the API, then the API may respond with new * members that the SDK is unaware of. * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - CARD, - PAYMENT, - TRANSFER, INTERNAL, - EXTERNAL_PAYMENT, - MANAGEMENT_OPERATION, /** - * An enum member indicating that [TransactionFamilyTypes] was instantiated with an - * unknown value. + * An enum member indicating that [Family] was instantiated with an unknown value. */ _UNKNOWN, } @@ -2358,12 +2288,7 @@ private constructor( */ fun value(): Value = when (this) { - CARD -> Value.CARD - PAYMENT -> Value.PAYMENT - TRANSFER -> Value.TRANSFER INTERNAL -> Value.INTERNAL - EXTERNAL_PAYMENT -> Value.EXTERNAL_PAYMENT - MANAGEMENT_OPERATION -> Value.MANAGEMENT_OPERATION else -> Value._UNKNOWN } @@ -2378,14 +2303,8 @@ private constructor( */ fun known(): Known = when (this) { - CARD -> Known.CARD - PAYMENT -> Known.PAYMENT - TRANSFER -> Known.TRANSFER INTERNAL -> Known.INTERNAL - EXTERNAL_PAYMENT -> Known.EXTERNAL_PAYMENT - MANAGEMENT_OPERATION -> Known.MANAGEMENT_OPERATION - else -> - throw LithicInvalidDataException("Unknown TransactionFamilyTypes: $value") + else -> throw LithicInvalidDataException("Unknown Family: $value") } /** @@ -2404,7 +2323,7 @@ private constructor( private var validated: Boolean = false - fun validate(): TransactionFamilyTypes = apply { + fun validate(): Family = apply { if (validated) { return@apply } @@ -2434,7 +2353,7 @@ private constructor( return true } - return other is TransactionFamilyTypes && value == other.value + return other is Family && value == other.value } override fun hashCode() = value.hashCode() @@ -2775,99 +2694,177 @@ private constructor( "FinancialTransaction{token=$token, category=$category, created=$created, currency=$currency, descriptor=$descriptor, events=$events, family=$family, financialAccountToken=$financialAccountToken, pendingAmount=$pendingAmount, result=$result, settledAmount=$settledAmount, status=$status, updated=$updated, additionalProperties=$additionalProperties}" } - /** Book transfer transaction */ - class BookTransferTransaction + /** Card transaction with ledger base properties */ + class CardTransaction @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val token: JsonField, - private val category: JsonField, + private val accountToken: JsonField, + private val acquirerFee: JsonField, + private val acquirerReferenceNumber: JsonField, + private val amount: JsonField, + private val amounts: JsonField, + private val authorizationAmount: JsonField, + private val authorizationCode: JsonField, + private val avs: JsonField, + private val cardToken: JsonField, + private val cardholderAuthentication: JsonField, private val created: JsonField, - private val currency: JsonField, - private val events: JsonField>, - private val family: JsonField, - private val fromFinancialAccountToken: JsonField, - private val pendingAmount: JsonField, - private val result: JsonField, + private val financialAccountToken: JsonField, + private val merchant: JsonField, + private val merchantAmount: JsonField, + private val merchantAuthorizationAmount: JsonField, + private val merchantCurrency: JsonField, + private val network: JsonField, + private val networkRiskScore: JsonField, + private val pos: JsonField, + private val result: JsonField, private val settledAmount: JsonField, - private val status: JsonField, - private val toFinancialAccountToken: JsonField, + private val status: JsonField, + private val tokenInfo: JsonField, private val updated: JsonField, - private val externalId: JsonField, - private val externalResource: JsonField, - private val transactionSeries: JsonField, + private val events: JsonField>, + private val family: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), - @JsonProperty("category") + @JsonProperty("account_token") + @ExcludeMissing + accountToken: JsonField = JsonMissing.of(), + @JsonProperty("acquirer_fee") + @ExcludeMissing + acquirerFee: JsonField = JsonMissing.of(), + @JsonProperty("acquirer_reference_number") + @ExcludeMissing + acquirerReferenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), + @JsonProperty("amounts") + @ExcludeMissing + amounts: JsonField = JsonMissing.of(), + @JsonProperty("authorization_amount") + @ExcludeMissing + authorizationAmount: JsonField = JsonMissing.of(), + @JsonProperty("authorization_code") + @ExcludeMissing + authorizationCode: JsonField = JsonMissing.of(), + @JsonProperty("avs") @ExcludeMissing avs: JsonField = JsonMissing.of(), + @JsonProperty("card_token") + @ExcludeMissing + cardToken: JsonField = JsonMissing.of(), + @JsonProperty("cardholder_authentication") @ExcludeMissing - category: JsonField = JsonMissing.of(), + cardholderAuthentication: JsonField = + JsonMissing.of(), @JsonProperty("created") @ExcludeMissing created: JsonField = JsonMissing.of(), - @JsonProperty("currency") + @JsonProperty("financial_account_token") @ExcludeMissing - currency: JsonField = JsonMissing.of(), - @JsonProperty("events") + financialAccountToken: JsonField = JsonMissing.of(), + @JsonProperty("merchant") @ExcludeMissing - events: JsonField> = JsonMissing.of(), - @JsonProperty("family") + merchant: JsonField = JsonMissing.of(), + @JsonProperty("merchant_amount") @ExcludeMissing - family: JsonField = JsonMissing.of(), - @JsonProperty("from_financial_account_token") + merchantAmount: JsonField = JsonMissing.of(), + @JsonProperty("merchant_authorization_amount") @ExcludeMissing - fromFinancialAccountToken: JsonField = JsonMissing.of(), - @JsonProperty("pending_amount") + merchantAuthorizationAmount: JsonField = JsonMissing.of(), + @JsonProperty("merchant_currency") @ExcludeMissing - pendingAmount: JsonField = JsonMissing.of(), + merchantCurrency: JsonField = JsonMissing.of(), + @JsonProperty("network") + @ExcludeMissing + network: JsonField = JsonMissing.of(), + @JsonProperty("network_risk_score") + @ExcludeMissing + networkRiskScore: JsonField = JsonMissing.of(), + @JsonProperty("pos") @ExcludeMissing pos: JsonField = JsonMissing.of(), @JsonProperty("result") @ExcludeMissing - result: JsonField = JsonMissing.of(), + result: JsonField = JsonMissing.of(), @JsonProperty("settled_amount") @ExcludeMissing settledAmount: JsonField = JsonMissing.of(), @JsonProperty("status") @ExcludeMissing - status: JsonField = JsonMissing.of(), - @JsonProperty("to_financial_account_token") + status: JsonField = JsonMissing.of(), + @JsonProperty("token_info") @ExcludeMissing - toFinancialAccountToken: JsonField = JsonMissing.of(), + tokenInfo: JsonField = JsonMissing.of(), @JsonProperty("updated") @ExcludeMissing updated: JsonField = JsonMissing.of(), - @JsonProperty("external_id") - @ExcludeMissing - externalId: JsonField = JsonMissing.of(), - @JsonProperty("external_resource") - @ExcludeMissing - externalResource: JsonField = JsonMissing.of(), - @JsonProperty("transaction_series") + @JsonProperty("events") @ExcludeMissing - transactionSeries: JsonField = JsonMissing.of(), + events: JsonField> = JsonMissing.of(), + @JsonProperty("family") @ExcludeMissing family: JsonField = JsonMissing.of(), ) : this( token, - category, + accountToken, + acquirerFee, + acquirerReferenceNumber, + amount, + amounts, + authorizationAmount, + authorizationCode, + avs, + cardToken, + cardholderAuthentication, created, - currency, - events, - family, - fromFinancialAccountToken, - pendingAmount, + financialAccountToken, + merchant, + merchantAmount, + merchantAuthorizationAmount, + merchantCurrency, + network, + networkRiskScore, + pos, result, settledAmount, status, - toFinancialAccountToken, + tokenInfo, updated, - externalId, - externalResource, - transactionSeries, + events, + family, mutableMapOf(), ) + fun toTransaction(): Transaction = + Transaction.builder() + .token(token) + .accountToken(accountToken) + .acquirerFee(acquirerFee) + .acquirerReferenceNumber(acquirerReferenceNumber) + .amount(amount) + .amounts(amounts) + .authorizationAmount(authorizationAmount) + .authorizationCode(authorizationCode) + .avs(avs) + .cardToken(cardToken) + .cardholderAuthentication(cardholderAuthentication) + .created(created) + .financialAccountToken(financialAccountToken) + .merchant(merchant) + .merchantAmount(merchantAmount) + .merchantAuthorizationAmount(merchantAuthorizationAmount) + .merchantCurrency(merchantCurrency) + .network(network) + .networkRiskScore(networkRiskScore) + .pos(pos) + .result(result) + .settledAmount(settledAmount) + .status(status) + .tokenInfo(tokenInfo) + .updated(updated) + .events(events) + .build() + /** - * Unique identifier for the transaction + * Globally unique identifier. * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -2875,120 +2872,217 @@ private constructor( fun token(): String = token.getRequired("token") /** + * The token for the account associated with this transaction. + * * @throws LithicInvalidDataException if 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(): BookTransferCategory = category.getRequired("category") + fun accountToken(): String = accountToken.getRequired("account_token") /** - * ISO 8601 timestamp of when the transaction was created + * Fee assessed by the merchant and paid for by the cardholder in the smallest unit of the + * currency. Will be zero if no fee is assessed. Rebates may be transmitted as a negative + * value to indicate credited fees. * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun created(): OffsetDateTime = created.getRequired("created") + fun acquirerFee(): Optional = acquirerFee.getOptional("acquirer_fee") /** - * Currency of the transaction in ISO 4217 format + * Unique identifier assigned to a transaction by the acquirer that can be used in dispute + * and chargeback filing. This field has been deprecated in favor of the + * `acquirer_reference_number` that resides in the event-level `network_info`. * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun currency(): String = currency.getRequired("currency") + @Deprecated("deprecated") + fun acquirerReferenceNumber(): Optional = + acquirerReferenceNumber.getOptional("acquirer_reference_number") /** - * List of events associated with this book transfer + * When the transaction is pending, this represents the authorization amount of the + * transaction in the anticipated settlement currency. Once the transaction has settled, + * this field represents the settled amount in the settlement currency. * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun events(): List = events.getRequired("events") + @Deprecated("deprecated") fun amount(): Long = amount.getRequired("amount") /** * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun family(): TransactionFamilyTypes = family.getRequired("family") + fun amounts(): Transaction.TransactionAmounts = amounts.getRequired("amounts") /** - * Source account token + * The authorization amount of the transaction in the anticipated settlement currency. * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun fromFinancialAccountToken(): String = - fromFinancialAccountToken.getRequired("from_financial_account_token") + @Deprecated("deprecated") + fun authorizationAmount(): Optional = + authorizationAmount.getOptional("authorization_amount") /** - * The pending amount of the transaction in cents + * A fixed-width 6-digit numeric identifier that can be used to identify a transaction with + * networks. * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun pendingAmount(): Long = pendingAmount.getRequired("pending_amount") + fun authorizationCode(): Optional = + authorizationCode.getOptional("authorization_code") /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun result(): TransactionResult = result.getRequired("result") + fun avs(): Optional = avs.getOptional("avs") /** - * The settled amount of the transaction in cents + * Token for the card used in this transaction. * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun settledAmount(): Long = settledAmount.getRequired("settled_amount") + fun cardToken(): String = cardToken.getRequired("card_token") /** - * The status of the transaction - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun status(): TransactionStatus = status.getRequired("status") + fun cardholderAuthentication(): Optional = + cardholderAuthentication.getOptional("cardholder_authentication") /** - * Destination account token + * Date and time when the transaction first occurred. UTC time zone. * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun toFinancialAccountToken(): String = - toFinancialAccountToken.getRequired("to_financial_account_token") + fun created(): OffsetDateTime = created.getRequired("created") /** - * ISO 8601 timestamp of when the transaction was last updated + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun financialAccountToken(): Optional = + financialAccountToken.getOptional("financial_account_token") + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun merchant(): Transaction.Merchant = merchant.getRequired("merchant") + + /** + * Analogous to the 'amount', but in the merchant currency. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + @Deprecated("deprecated") + fun merchantAmount(): Optional = merchantAmount.getOptional("merchant_amount") + + /** + * Analogous to the 'authorization_amount', but in the merchant currency. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + @Deprecated("deprecated") + fun merchantAuthorizationAmount(): Optional = + merchantAuthorizationAmount.getOptional("merchant_authorization_amount") + + /** + * 3-character alphabetic ISO 4217 code for the local currency of the transaction. * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun updated(): OffsetDateTime = updated.getRequired("updated") + @Deprecated("deprecated") + fun merchantCurrency(): String = merchantCurrency.getRequired("merchant_currency") + + /** + * Card network of the authorization. Value is `UNKNOWN` when Lithic cannot determine the + * network code from the upstream provider. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun network(): Optional = network.getOptional("network") + + /** + * Network-provided score assessing risk level associated with a given authorization. Scores + * are on a range of 0-999, with 0 representing the lowest risk and 999 representing the + * highest risk. For Visa transactions, where the raw score has a range of 0-99, Lithic will + * normalize the score by multiplying the raw score by 10x. + * + * @throws LithicInvalidDataException 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") + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun pos(): Transaction.Pos = pos.getRequired("pos") + + /** + * @throws LithicInvalidDataException if 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(): Transaction.DeclineResult = result.getRequired("result") + + /** + * The settled amount of the transaction in the settlement currency. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + @Deprecated("deprecated") + fun settledAmount(): Long = settledAmount.getRequired("settled_amount") /** - * External identifier for the transaction + * Status of the transaction. * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun status(): Transaction.Status = status.getRequired("status") + + /** * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun externalId(): Optional = externalId.getOptional("external_id") + fun tokenInfo(): Optional = tokenInfo.getOptional("token_info") /** - * External resource associated with the management operation + * Date and time when the transaction last updated. UTC time zone. * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun updated(): OffsetDateTime = updated.getRequired("updated") + + /** * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun externalResource(): Optional = - externalResource.getOptional("external_resource") + fun events(): Optional> = events.getOptional("events") /** + * CARD - Card Transaction + * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun transactionSeries(): Optional = - transactionSeries.getOptional("transaction_series") + fun family(): Optional = family.getOptional("family") /** * Returns the raw JSON value of [token]. @@ -2998,216 +3092,361 @@ private constructor( @JsonProperty("token") @ExcludeMissing fun _token(): JsonField = token /** - * Returns the raw JSON value of [category]. + * Returns the raw JSON value of [accountToken]. * - * Unlike [category], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [accountToken], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("category") + @JsonProperty("account_token") @ExcludeMissing - fun _category(): JsonField = category + fun _accountToken(): JsonField = accountToken /** - * Returns the raw JSON value of [created]. + * Returns the raw JSON value of [acquirerFee]. * - * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [acquirerFee], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created + @JsonProperty("acquirer_fee") + @ExcludeMissing + fun _acquirerFee(): JsonField = acquirerFee /** - * Returns the raw JSON value of [currency]. + * Returns the raw JSON value of [acquirerReferenceNumber]. * - * Unlike [currency], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [acquirerReferenceNumber], this method doesn't throw if the JSON field has an + * unexpected type. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency + @Deprecated("deprecated") + @JsonProperty("acquirer_reference_number") + @ExcludeMissing + fun _acquirerReferenceNumber(): JsonField = acquirerReferenceNumber /** - * Returns the raw JSON value of [events]. + * Returns the raw JSON value of [amount]. * - * Unlike [events], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("events") + @Deprecated("deprecated") + @JsonProperty("amount") @ExcludeMissing - fun _events(): JsonField> = events + fun _amount(): JsonField = amount /** - * Returns the raw JSON value of [family]. + * Returns the raw JSON value of [amounts]. * - * Unlike [family], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [amounts], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("family") + @JsonProperty("amounts") @ExcludeMissing - fun _family(): JsonField = family + fun _amounts(): JsonField = amounts /** - * Returns the raw JSON value of [fromFinancialAccountToken]. + * Returns the raw JSON value of [authorizationAmount]. * - * Unlike [fromFinancialAccountToken], this method doesn't throw if the JSON field has an + * Unlike [authorizationAmount], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("from_financial_account_token") + @Deprecated("deprecated") + @JsonProperty("authorization_amount") @ExcludeMissing - fun _fromFinancialAccountToken(): JsonField = fromFinancialAccountToken + fun _authorizationAmount(): JsonField = authorizationAmount /** - * Returns the raw JSON value of [pendingAmount]. + * Returns the raw JSON value of [authorizationCode]. * - * Unlike [pendingAmount], this method doesn't throw if the JSON field has an unexpected + * Unlike [authorizationCode], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("pending_amount") + @JsonProperty("authorization_code") @ExcludeMissing - fun _pendingAmount(): JsonField = pendingAmount + fun _authorizationCode(): JsonField = authorizationCode /** - * Returns the raw JSON value of [result]. + * Returns the raw JSON value of [avs]. * - * Unlike [result], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [avs], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("result") @ExcludeMissing fun _result(): JsonField = result + @JsonProperty("avs") @ExcludeMissing fun _avs(): JsonField = avs /** - * Returns the raw JSON value of [settledAmount]. + * Returns the raw JSON value of [cardToken]. * - * Unlike [settledAmount], this method doesn't throw if the JSON field has an unexpected - * type. + * Unlike [cardToken], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("settled_amount") + @JsonProperty("card_token") @ExcludeMissing fun _cardToken(): JsonField = cardToken + + /** + * Returns the raw JSON value of [cardholderAuthentication]. + * + * Unlike [cardholderAuthentication], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("cardholder_authentication") @ExcludeMissing - fun _settledAmount(): JsonField = settledAmount + fun _cardholderAuthentication(): JsonField = + cardholderAuthentication /** - * Returns the raw JSON value of [status]. + * Returns the raw JSON value of [created]. * - * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created /** - * Returns the raw JSON value of [toFinancialAccountToken]. + * Returns the raw JSON value of [financialAccountToken]. * - * Unlike [toFinancialAccountToken], this method doesn't throw if the JSON field has an + * Unlike [financialAccountToken], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("to_financial_account_token") + @JsonProperty("financial_account_token") @ExcludeMissing - fun _toFinancialAccountToken(): JsonField = toFinancialAccountToken + fun _financialAccountToken(): JsonField = financialAccountToken /** - * Returns the raw JSON value of [updated]. + * Returns the raw JSON value of [merchant]. * - * Unlike [updated], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [merchant], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("updated") @ExcludeMissing fun _updated(): JsonField = updated + @JsonProperty("merchant") + @ExcludeMissing + fun _merchant(): JsonField = merchant /** - * Returns the raw JSON value of [externalId]. + * Returns the raw JSON value of [merchantAmount]. * - * Unlike [externalId], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [merchantAmount], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("external_id") + @Deprecated("deprecated") + @JsonProperty("merchant_amount") @ExcludeMissing - fun _externalId(): JsonField = externalId + fun _merchantAmount(): JsonField = merchantAmount /** - * Returns the raw JSON value of [externalResource]. + * Returns the raw JSON value of [merchantAuthorizationAmount]. * - * Unlike [externalResource], this method doesn't throw if the JSON field has an unexpected - * type. + * Unlike [merchantAuthorizationAmount], this method doesn't throw if the JSON field has an + * unexpected type. */ - @JsonProperty("external_resource") + @Deprecated("deprecated") + @JsonProperty("merchant_authorization_amount") @ExcludeMissing - fun _externalResource(): JsonField = externalResource + fun _merchantAuthorizationAmount(): JsonField = merchantAuthorizationAmount /** - * Returns the raw JSON value of [transactionSeries]. + * Returns the raw JSON value of [merchantCurrency]. * - * Unlike [transactionSeries], this method doesn't throw if the JSON field has an unexpected + * Unlike [merchantCurrency], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("transaction_series") + @Deprecated("deprecated") + @JsonProperty("merchant_currency") @ExcludeMissing - fun _transactionSeries(): JsonField = transactionSeries + fun _merchantCurrency(): JsonField = merchantCurrency - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + /** + * Returns the raw JSON value of [network]. + * + * Unlike [network], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("network") + @ExcludeMissing + fun _network(): JsonField = network - @JsonAnyGetter + /** + * 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 _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + fun _networkRiskScore(): JsonField = networkRiskScore - fun toBuilder() = Builder().from(this) + /** + * Returns the raw JSON value of [pos]. + * + * Unlike [pos], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("pos") @ExcludeMissing fun _pos(): JsonField = pos - companion object { + /** + * Returns the raw JSON value of [result]. + * + * Unlike [result], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("result") + @ExcludeMissing + fun _result(): JsonField = result - /** - * Returns a mutable builder for constructing an instance of [BookTransferTransaction]. - * - * The following fields are required: - * ```java - * .token() - * .category() - * .created() - * .currency() - * .events() - * .family() - * .fromFinancialAccountToken() - * .pendingAmount() + /** + * Returns the raw JSON value of [settledAmount]. + * + * Unlike [settledAmount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @Deprecated("deprecated") + @JsonProperty("settled_amount") + @ExcludeMissing + fun _settledAmount(): JsonField = settledAmount + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") + @ExcludeMissing + fun _status(): JsonField = status + + /** + * Returns the raw JSON value of [tokenInfo]. + * + * Unlike [tokenInfo], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("token_info") + @ExcludeMissing + fun _tokenInfo(): JsonField = tokenInfo + + /** + * Returns the raw JSON value of [updated]. + * + * Unlike [updated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("updated") @ExcludeMissing fun _updated(): JsonField = updated + + /** + * Returns the raw JSON value of [events]. + * + * Unlike [events], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("events") + @ExcludeMissing + fun _events(): JsonField> = events + + /** + * Returns the raw JSON value of [family]. + * + * Unlike [family], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("family") @ExcludeMissing fun _family(): JsonField = family + + @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 [CardTransaction]. + * + * The following fields are required: + * ```java + * .token() + * .accountToken() + * .acquirerFee() + * .acquirerReferenceNumber() + * .amount() + * .amounts() + * .authorizationAmount() + * .authorizationCode() + * .avs() + * .cardToken() + * .cardholderAuthentication() + * .created() + * .financialAccountToken() + * .merchant() + * .merchantAmount() + * .merchantAuthorizationAmount() + * .merchantCurrency() + * .network() + * .networkRiskScore() + * .pos() * .result() * .settledAmount() * .status() - * .toFinancialAccountToken() + * .tokenInfo() * .updated() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [BookTransferTransaction]. */ + /** A builder for [CardTransaction]. */ class Builder internal constructor() { private var token: JsonField? = null - private var category: JsonField? = null + private var accountToken: JsonField? = null + private var acquirerFee: JsonField? = null + private var acquirerReferenceNumber: JsonField? = null + private var amount: JsonField? = null + private var amounts: JsonField? = null + private var authorizationAmount: JsonField? = null + private var authorizationCode: JsonField? = null + private var avs: JsonField? = null + private var cardToken: JsonField? = null + private var cardholderAuthentication: JsonField? = + null private var created: JsonField? = null - private var currency: JsonField? = null - private var events: JsonField>? = null - private var family: JsonField? = null - private var fromFinancialAccountToken: JsonField? = null - private var pendingAmount: JsonField? = null - private var result: JsonField? = null + private var financialAccountToken: JsonField? = null + private var merchant: JsonField? = null + private var merchantAmount: JsonField? = null + private var merchantAuthorizationAmount: JsonField? = null + private var merchantCurrency: JsonField? = null + private var network: JsonField? = null + private var networkRiskScore: JsonField? = null + private var pos: JsonField? = null + private var result: JsonField? = null private var settledAmount: JsonField? = null - private var status: JsonField? = null - private var toFinancialAccountToken: JsonField? = null + private var status: JsonField? = null + private var tokenInfo: JsonField? = null private var updated: JsonField? = null - private var externalId: JsonField = JsonMissing.of() - private var externalResource: JsonField = JsonMissing.of() - private var transactionSeries: JsonField = JsonMissing.of() + private var events: JsonField>? = null + private var family: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(bookTransferTransaction: BookTransferTransaction) = apply { - token = bookTransferTransaction.token - category = bookTransferTransaction.category - created = bookTransferTransaction.created - currency = bookTransferTransaction.currency - events = bookTransferTransaction.events.map { it.toMutableList() } - family = bookTransferTransaction.family - fromFinancialAccountToken = bookTransferTransaction.fromFinancialAccountToken - pendingAmount = bookTransferTransaction.pendingAmount - result = bookTransferTransaction.result - settledAmount = bookTransferTransaction.settledAmount - status = bookTransferTransaction.status - toFinancialAccountToken = bookTransferTransaction.toFinancialAccountToken - updated = bookTransferTransaction.updated - externalId = bookTransferTransaction.externalId - externalResource = bookTransferTransaction.externalResource - transactionSeries = bookTransferTransaction.transactionSeries - additionalProperties = bookTransferTransaction.additionalProperties.toMutableMap() + internal fun from(cardTransaction: CardTransaction) = apply { + token = cardTransaction.token + accountToken = cardTransaction.accountToken + acquirerFee = cardTransaction.acquirerFee + acquirerReferenceNumber = cardTransaction.acquirerReferenceNumber + amount = cardTransaction.amount + amounts = cardTransaction.amounts + authorizationAmount = cardTransaction.authorizationAmount + authorizationCode = cardTransaction.authorizationCode + avs = cardTransaction.avs + cardToken = cardTransaction.cardToken + cardholderAuthentication = cardTransaction.cardholderAuthentication + created = cardTransaction.created + financialAccountToken = cardTransaction.financialAccountToken + merchant = cardTransaction.merchant + merchantAmount = cardTransaction.merchantAmount + merchantAuthorizationAmount = cardTransaction.merchantAuthorizationAmount + merchantCurrency = cardTransaction.merchantCurrency + network = cardTransaction.network + networkRiskScore = cardTransaction.networkRiskScore + pos = cardTransaction.pos + result = cardTransaction.result + settledAmount = cardTransaction.settledAmount + status = cardTransaction.status + tokenInfo = cardTransaction.tokenInfo + updated = cardTransaction.updated + events = cardTransaction.events.map { it.toMutableList() } + family = cardTransaction.family + additionalProperties = cardTransaction.additionalProperties.toMutableMap() } - /** Unique identifier for the transaction */ + /** Globally unique identifier. */ fun token(token: String) = token(JsonField.of(token)) /** @@ -3219,8719 +3458,681 @@ private constructor( */ fun token(token: JsonField) = apply { this.token = token } - fun category(category: BookTransferCategory) = category(JsonField.of(category)) + /** The token for the account associated with this transaction. */ + fun accountToken(accountToken: String) = accountToken(JsonField.of(accountToken)) /** - * Sets [Builder.category] to an arbitrary JSON value. + * Sets [Builder.accountToken] to an arbitrary JSON value. * - * You should usually call [Builder.category] with a well-typed [BookTransferCategory] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * You should usually call [Builder.accountToken] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun category(category: JsonField) = apply { - this.category = category + fun accountToken(accountToken: JsonField) = apply { + this.accountToken = accountToken } - /** ISO 8601 timestamp of when the transaction was created */ - fun created(created: OffsetDateTime) = created(JsonField.of(created)) + /** + * Fee assessed by the merchant and paid for by the cardholder in the smallest unit of + * the currency. Will be zero if no fee is assessed. Rebates may be transmitted as a + * negative value to indicate credited fees. + */ + fun acquirerFee(acquirerFee: Long?) = acquirerFee(JsonField.ofNullable(acquirerFee)) /** - * Sets [Builder.created] to an arbitrary JSON value. + * Alias for [Builder.acquirerFee]. * - * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * This unboxed primitive overload exists for backwards compatibility. */ - fun created(created: JsonField) = apply { this.created = created } + fun acquirerFee(acquirerFee: Long) = acquirerFee(acquirerFee as Long?) - /** Currency of the transaction in ISO 4217 format */ - fun currency(currency: String) = currency(JsonField.of(currency)) + /** Alias for calling [Builder.acquirerFee] with `acquirerFee.orElse(null)`. */ + fun acquirerFee(acquirerFee: Optional) = acquirerFee(acquirerFee.getOrNull()) /** - * Sets [Builder.currency] to an arbitrary JSON value. + * Sets [Builder.acquirerFee] to an arbitrary JSON value. * - * You should usually call [Builder.currency] with a well-typed [String] value instead. + * You should usually call [Builder.acquirerFee] with a well-typed [Long] 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 acquirerFee(acquirerFee: JsonField) = apply { this.acquirerFee = acquirerFee } + + /** + * Unique identifier assigned to a transaction by the acquirer that can be used in + * dispute and chargeback filing. This field has been deprecated in favor of the + * `acquirer_reference_number` that resides in the event-level `network_info`. + */ + @Deprecated("deprecated") + fun acquirerReferenceNumber(acquirerReferenceNumber: String?) = + acquirerReferenceNumber(JsonField.ofNullable(acquirerReferenceNumber)) - /** List of events associated with this book transfer */ - fun events(events: List) = events(JsonField.of(events)) + /** + * Alias for calling [Builder.acquirerReferenceNumber] with + * `acquirerReferenceNumber.orElse(null)`. + */ + @Deprecated("deprecated") + fun acquirerReferenceNumber(acquirerReferenceNumber: Optional) = + acquirerReferenceNumber(acquirerReferenceNumber.getOrNull()) /** - * Sets [Builder.events] to an arbitrary JSON value. + * Sets [Builder.acquirerReferenceNumber] to an arbitrary JSON value. * - * You should usually call [Builder.events] with a well-typed `List` + * You should usually call [Builder.acquirerReferenceNumber] with a well-typed [String] * value instead. This method is primarily for setting the field to an undocumented or * not yet supported value. */ - fun events(events: JsonField>) = apply { - this.events = events.map { it.toMutableList() } + @Deprecated("deprecated") + fun acquirerReferenceNumber(acquirerReferenceNumber: JsonField) = apply { + this.acquirerReferenceNumber = acquirerReferenceNumber } /** - * Adds a single [BookTransferEvent] to [events]. - * - * @throws IllegalStateException if the field was previously set to a non-list. + * When the transaction is pending, this represents the authorization amount of the + * transaction in the anticipated settlement currency. Once the transaction has settled, + * this field represents the settled amount in the settlement currency. */ - fun addEvent(event: BookTransferEvent) = apply { - events = - (events ?: JsonField.of(mutableListOf())).also { - checkKnown("events", it).add(event) - } - } - - fun family(family: TransactionFamilyTypes) = family(JsonField.of(family)) + @Deprecated("deprecated") fun amount(amount: Long) = amount(JsonField.of(amount)) /** - * Sets [Builder.family] to an arbitrary JSON value. + * Sets [Builder.amount] to an arbitrary JSON value. * - * You should usually call [Builder.family] with a well-typed [TransactionFamilyTypes] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * You should usually call [Builder.amount] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun family(family: JsonField) = apply { this.family = family } + @Deprecated("deprecated") + fun amount(amount: JsonField) = apply { this.amount = amount } - /** Source account token */ - fun fromFinancialAccountToken(fromFinancialAccountToken: String) = - fromFinancialAccountToken(JsonField.of(fromFinancialAccountToken)) + fun amounts(amounts: Transaction.TransactionAmounts) = amounts(JsonField.of(amounts)) /** - * Sets [Builder.fromFinancialAccountToken] to an arbitrary JSON value. + * Sets [Builder.amounts] to an arbitrary JSON value. * - * You should usually call [Builder.fromFinancialAccountToken] with a well-typed - * [String] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * You should usually call [Builder.amounts] with a well-typed + * [Transaction.TransactionAmounts] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. */ - fun fromFinancialAccountToken(fromFinancialAccountToken: JsonField) = apply { - this.fromFinancialAccountToken = fromFinancialAccountToken + fun amounts(amounts: JsonField) = apply { + this.amounts = amounts } - /** The pending amount of the transaction in cents */ - fun pendingAmount(pendingAmount: Long) = pendingAmount(JsonField.of(pendingAmount)) + /** + * The authorization amount of the transaction in the anticipated settlement currency. + */ + @Deprecated("deprecated") + fun authorizationAmount(authorizationAmount: Long?) = + authorizationAmount(JsonField.ofNullable(authorizationAmount)) /** - * Sets [Builder.pendingAmount] to an arbitrary JSON value. + * Alias for [Builder.authorizationAmount]. * - * You should usually call [Builder.pendingAmount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * This unboxed primitive overload exists for backwards compatibility. */ - fun pendingAmount(pendingAmount: JsonField) = apply { - this.pendingAmount = pendingAmount - } + @Deprecated("deprecated") + fun authorizationAmount(authorizationAmount: Long) = + authorizationAmount(authorizationAmount as Long?) - fun result(result: TransactionResult) = result(JsonField.of(result)) + /** + * Alias for calling [Builder.authorizationAmount] with + * `authorizationAmount.orElse(null)`. + */ + @Deprecated("deprecated") + fun authorizationAmount(authorizationAmount: Optional) = + authorizationAmount(authorizationAmount.getOrNull()) /** - * Sets [Builder.result] to an arbitrary JSON value. + * Sets [Builder.authorizationAmount] to an arbitrary JSON value. * - * You should usually call [Builder.result] with a well-typed [TransactionResult] value + * You should usually call [Builder.authorizationAmount] with a well-typed [Long] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun result(result: JsonField) = apply { this.result = result } + @Deprecated("deprecated") + fun authorizationAmount(authorizationAmount: JsonField) = apply { + this.authorizationAmount = authorizationAmount + } - /** The settled amount of the transaction in cents */ - fun settledAmount(settledAmount: Long) = settledAmount(JsonField.of(settledAmount)) + /** + * A fixed-width 6-digit numeric identifier that can be used to identify a transaction + * with networks. + */ + fun authorizationCode(authorizationCode: String?) = + authorizationCode(JsonField.ofNullable(authorizationCode)) /** - * Sets [Builder.settledAmount] to an arbitrary JSON value. + * Alias for calling [Builder.authorizationCode] with `authorizationCode.orElse(null)`. + */ + fun authorizationCode(authorizationCode: Optional) = + authorizationCode(authorizationCode.getOrNull()) + + /** + * Sets [Builder.authorizationCode] to an arbitrary JSON value. * - * You should usually call [Builder.settledAmount] with a well-typed [Long] value + * You should usually call [Builder.authorizationCode] with a well-typed [String] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun settledAmount(settledAmount: JsonField) = apply { - this.settledAmount = settledAmount + fun authorizationCode(authorizationCode: JsonField) = apply { + this.authorizationCode = authorizationCode } - /** The status of the transaction */ - fun status(status: TransactionStatus) = status(JsonField.of(status)) + fun avs(avs: Transaction.Avs?) = avs(JsonField.ofNullable(avs)) + + /** Alias for calling [Builder.avs] with `avs.orElse(null)`. */ + fun avs(avs: Optional) = avs(avs.getOrNull()) /** - * Sets [Builder.status] to an arbitrary JSON value. + * Sets [Builder.avs] to an arbitrary JSON value. * - * You should usually call [Builder.status] with a well-typed [TransactionStatus] value + * You should usually call [Builder.avs] with a well-typed [Transaction.Avs] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun status(status: JsonField) = apply { this.status = status } + fun avs(avs: JsonField) = apply { this.avs = avs } - /** Destination account token */ - fun toFinancialAccountToken(toFinancialAccountToken: String) = - toFinancialAccountToken(JsonField.of(toFinancialAccountToken)) + /** Token for the card used in this transaction. */ + fun cardToken(cardToken: String) = cardToken(JsonField.of(cardToken)) /** - * Sets [Builder.toFinancialAccountToken] to an arbitrary JSON value. + * Sets [Builder.cardToken] to an arbitrary JSON value. * - * You should usually call [Builder.toFinancialAccountToken] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * You should usually call [Builder.cardToken] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun toFinancialAccountToken(toFinancialAccountToken: JsonField) = apply { - this.toFinancialAccountToken = toFinancialAccountToken - } + fun cardToken(cardToken: JsonField) = apply { this.cardToken = cardToken } - /** ISO 8601 timestamp of when the transaction was last updated */ - fun updated(updated: OffsetDateTime) = updated(JsonField.of(updated)) + fun cardholderAuthentication( + cardholderAuthentication: Transaction.CardholderAuthentication? + ) = cardholderAuthentication(JsonField.ofNullable(cardholderAuthentication)) /** - * Sets [Builder.updated] to an arbitrary JSON value. + * Alias for calling [Builder.cardholderAuthentication] with + * `cardholderAuthentication.orElse(null)`. + */ + fun cardholderAuthentication( + cardholderAuthentication: Optional + ) = cardholderAuthentication(cardholderAuthentication.getOrNull()) + + /** + * Sets [Builder.cardholderAuthentication] to an arbitrary JSON value. * - * You should usually call [Builder.updated] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * You should usually call [Builder.cardholderAuthentication] with a well-typed + * [Transaction.CardholderAuthentication] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. */ - fun updated(updated: JsonField) = apply { this.updated = updated } + fun cardholderAuthentication( + cardholderAuthentication: JsonField + ) = apply { this.cardholderAuthentication = cardholderAuthentication } - /** External identifier for the transaction */ - fun externalId(externalId: String) = externalId(JsonField.of(externalId)) + /** Date and time when the transaction first occurred. UTC time zone. */ + fun created(created: OffsetDateTime) = created(JsonField.of(created)) /** - * Sets [Builder.externalId] to an arbitrary JSON value. + * Sets [Builder.created] to an arbitrary JSON value. * - * You should usually call [Builder.externalId] with a well-typed [String] value + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun externalId(externalId: JsonField) = apply { this.externalId = externalId } + fun created(created: JsonField) = apply { this.created = created } - /** External resource associated with the management operation */ - fun externalResource(externalResource: ExternalResource?) = - externalResource(JsonField.ofNullable(externalResource)) + fun financialAccountToken(financialAccountToken: String?) = + financialAccountToken(JsonField.ofNullable(financialAccountToken)) /** - * Alias for calling [Builder.externalResource] with `externalResource.orElse(null)`. + * Alias for calling [Builder.financialAccountToken] with + * `financialAccountToken.orElse(null)`. */ - fun externalResource(externalResource: Optional) = - externalResource(externalResource.getOrNull()) + fun financialAccountToken(financialAccountToken: Optional) = + financialAccountToken(financialAccountToken.getOrNull()) /** - * Sets [Builder.externalResource] to an arbitrary JSON value. + * Sets [Builder.financialAccountToken] to an arbitrary JSON value. * - * You should usually call [Builder.externalResource] with a well-typed - * [ExternalResource] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * You should usually call [Builder.financialAccountToken] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - fun externalResource(externalResource: JsonField) = apply { - this.externalResource = externalResource + fun financialAccountToken(financialAccountToken: JsonField) = apply { + this.financialAccountToken = financialAccountToken } - fun transactionSeries(transactionSeries: TransactionSeries?) = - transactionSeries(JsonField.ofNullable(transactionSeries)) + fun merchant(merchant: Transaction.Merchant) = merchant(JsonField.of(merchant)) /** - * Alias for calling [Builder.transactionSeries] with `transactionSeries.orElse(null)`. + * Sets [Builder.merchant] to an arbitrary JSON value. + * + * You should usually call [Builder.merchant] with a well-typed [Transaction.Merchant] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - fun transactionSeries(transactionSeries: Optional) = - transactionSeries(transactionSeries.getOrNull()) + fun merchant(merchant: JsonField) = apply { + this.merchant = merchant + } + + /** Analogous to the 'amount', but in the merchant currency. */ + @Deprecated("deprecated") + fun merchantAmount(merchantAmount: Long?) = + merchantAmount(JsonField.ofNullable(merchantAmount)) /** - * Sets [Builder.transactionSeries] to an arbitrary JSON value. + * Alias for [Builder.merchantAmount]. * - * You should usually call [Builder.transactionSeries] with a well-typed - * [TransactionSeries] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * This unboxed primitive overload exists for backwards compatibility. */ - fun transactionSeries(transactionSeries: JsonField) = apply { - this.transactionSeries = transactionSeries - } + @Deprecated("deprecated") + fun merchantAmount(merchantAmount: Long) = merchantAmount(merchantAmount as Long?) - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** Alias for calling [Builder.merchantAmount] with `merchantAmount.orElse(null)`. */ + @Deprecated("deprecated") + fun merchantAmount(merchantAmount: Optional) = + merchantAmount(merchantAmount.getOrNull()) - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + /** + * Sets [Builder.merchantAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantAmount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + @Deprecated("deprecated") + fun merchantAmount(merchantAmount: JsonField) = apply { + this.merchantAmount = merchantAmount } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + /** Analogous to the 'authorization_amount', but in the merchant currency. */ + @Deprecated("deprecated") + fun merchantAuthorizationAmount(merchantAuthorizationAmount: Long?) = + merchantAuthorizationAmount(JsonField.ofNullable(merchantAuthorizationAmount)) - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + /** + * Alias for [Builder.merchantAuthorizationAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + @Deprecated("deprecated") + fun merchantAuthorizationAmount(merchantAuthorizationAmount: Long) = + merchantAuthorizationAmount(merchantAuthorizationAmount as Long?) - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** + * Alias for calling [Builder.merchantAuthorizationAmount] with + * `merchantAuthorizationAmount.orElse(null)`. + */ + @Deprecated("deprecated") + fun merchantAuthorizationAmount(merchantAuthorizationAmount: Optional) = + merchantAuthorizationAmount(merchantAuthorizationAmount.getOrNull()) /** - * Returns an immutable instance of [BookTransferTransaction]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .token() - * .category() - * .created() - * .currency() - * .events() - * .family() - * .fromFinancialAccountToken() - * .pendingAmount() - * .result() - * .settledAmount() - * .status() - * .toFinancialAccountToken() - * .updated() - * ``` + * Sets [Builder.merchantAuthorizationAmount] to an arbitrary JSON value. * - * @throws IllegalStateException if any required field is unset. + * You should usually call [Builder.merchantAuthorizationAmount] with a well-typed + * [Long] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ - fun build(): BookTransferTransaction = - BookTransferTransaction( - checkRequired("token", token), - checkRequired("category", category), - checkRequired("created", created), - checkRequired("currency", currency), - checkRequired("events", events).map { it.toImmutable() }, - checkRequired("family", family), - checkRequired("fromFinancialAccountToken", fromFinancialAccountToken), - checkRequired("pendingAmount", pendingAmount), - checkRequired("result", result), - checkRequired("settledAmount", settledAmount), - checkRequired("status", status), - checkRequired("toFinancialAccountToken", toFinancialAccountToken), - checkRequired("updated", updated), - externalId, - externalResource, - transactionSeries, - additionalProperties.toMutableMap(), - ) - } + @Deprecated("deprecated") + fun merchantAuthorizationAmount(merchantAuthorizationAmount: JsonField) = apply { + this.merchantAuthorizationAmount = merchantAuthorizationAmount + } - private var validated: Boolean = false + /** 3-character alphabetic ISO 4217 code for the local currency of the transaction. */ + @Deprecated("deprecated") + fun merchantCurrency(merchantCurrency: String) = + merchantCurrency(JsonField.of(merchantCurrency)) - fun validate(): BookTransferTransaction = apply { - if (validated) { - return@apply + /** + * Sets [Builder.merchantCurrency] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantCurrency] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + @Deprecated("deprecated") + fun merchantCurrency(merchantCurrency: JsonField) = apply { + this.merchantCurrency = merchantCurrency } - token() - category().validate() - created() - currency() - events().forEach { it.validate() } - family().validate() - fromFinancialAccountToken() - pendingAmount() - result().validate() - settledAmount() - status().validate() - toFinancialAccountToken() - updated() - externalId() - externalResource().ifPresent { it.validate() } - transactionSeries().ifPresent { it.validate() } - validated = true - } + /** + * Card network of the authorization. Value is `UNKNOWN` when Lithic cannot determine + * the network code from the upstream provider. + */ + fun network(network: Transaction.Network?) = network(JsonField.ofNullable(network)) - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 (token.asKnown().isPresent) 1 else 0) + - (category.asKnown().getOrNull()?.validity() ?: 0) + - (if (created.asKnown().isPresent) 1 else 0) + - (if (currency.asKnown().isPresent) 1 else 0) + - (events.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (family.asKnown().getOrNull()?.validity() ?: 0) + - (if (fromFinancialAccountToken.asKnown().isPresent) 1 else 0) + - (if (pendingAmount.asKnown().isPresent) 1 else 0) + - (result.asKnown().getOrNull()?.validity() ?: 0) + - (if (settledAmount.asKnown().isPresent) 1 else 0) + - (status.asKnown().getOrNull()?.validity() ?: 0) + - (if (toFinancialAccountToken.asKnown().isPresent) 1 else 0) + - (if (updated.asKnown().isPresent) 1 else 0) + - (if (externalId.asKnown().isPresent) 1 else 0) + - (externalResource.asKnown().getOrNull()?.validity() ?: 0) + - (transactionSeries.asKnown().getOrNull()?.validity() ?: 0) - - class BookTransferCategory - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ADJUSTMENT = of("ADJUSTMENT") - - @JvmField val BALANCE_OR_FUNDING = of("BALANCE_OR_FUNDING") - - @JvmField val DERECOGNITION = of("DERECOGNITION") - - @JvmField val DISPUTE = of("DISPUTE") - - @JvmField val FEE = of("FEE") - - @JvmField val INTERNAL = of("INTERNAL") - - @JvmField val REWARD = of("REWARD") - - @JvmField val PROGRAM_FUNDING = of("PROGRAM_FUNDING") - - @JvmField val TRANSFER = of("TRANSFER") - - @JvmStatic fun of(value: String) = BookTransferCategory(JsonField.of(value)) - } - - /** An enum containing [BookTransferCategory]'s known values. */ - enum class Known { - ADJUSTMENT, - BALANCE_OR_FUNDING, - DERECOGNITION, - DISPUTE, - FEE, - INTERNAL, - REWARD, - PROGRAM_FUNDING, - TRANSFER, - } - - /** - * An enum containing [BookTransferCategory]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [BookTransferCategory] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then 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 { - ADJUSTMENT, - BALANCE_OR_FUNDING, - DERECOGNITION, - DISPUTE, - FEE, - INTERNAL, - REWARD, - PROGRAM_FUNDING, - TRANSFER, - /** - * An enum member indicating that [BookTransferCategory] 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) { - ADJUSTMENT -> Value.ADJUSTMENT - BALANCE_OR_FUNDING -> Value.BALANCE_OR_FUNDING - DERECOGNITION -> Value.DERECOGNITION - DISPUTE -> Value.DISPUTE - FEE -> Value.FEE - INTERNAL -> Value.INTERNAL - REWARD -> Value.REWARD - PROGRAM_FUNDING -> Value.PROGRAM_FUNDING - TRANSFER -> Value.TRANSFER - 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 LithicInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ADJUSTMENT -> Known.ADJUSTMENT - BALANCE_OR_FUNDING -> Known.BALANCE_OR_FUNDING - DERECOGNITION -> Known.DERECOGNITION - DISPUTE -> Known.DISPUTE - FEE -> Known.FEE - INTERNAL -> Known.INTERNAL - REWARD -> Known.REWARD - PROGRAM_FUNDING -> Known.PROGRAM_FUNDING - TRANSFER -> Known.TRANSFER - else -> throw LithicInvalidDataException("Unknown BookTransferCategory: $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 LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): BookTransferCategory = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 BookTransferCategory && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** Book transfer Event */ - class BookTransferEvent - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val token: JsonField, - private val amount: JsonField, - private val created: JsonField, - private val detailedResults: JsonField, - private val memo: JsonField, - private val result: JsonField, - private val subtype: JsonField, - private val type: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), - @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - @JsonProperty("created") - @ExcludeMissing - created: JsonField = JsonMissing.of(), - @JsonProperty("detailed_results") - @ExcludeMissing - detailedResults: JsonField = JsonMissing.of(), - @JsonProperty("memo") @ExcludeMissing memo: JsonField = JsonMissing.of(), - @JsonProperty("result") - @ExcludeMissing - result: JsonField = JsonMissing.of(), - @JsonProperty("subtype") - @ExcludeMissing - subtype: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - type: JsonField = JsonMissing.of(), - ) : this( - token, - amount, - created, - detailedResults, - memo, - result, - subtype, - type, - mutableMapOf(), - ) - - /** - * Globally unique identifier. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun token(): String = token.getRequired("token") - - /** - * Amount of the financial event that has been settled in the currency's smallest unit - * (e.g., cents). - * - * @throws LithicInvalidDataException if 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") - - /** - * Date and time when the financial event occurred. UTC time zone. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun created(): OffsetDateTime = created.getRequired("created") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun detailedResults(): BookTransferDetailedResults = - detailedResults.getRequired("detailed_results") - - /** - * Memo for the transfer. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun memo(): String = memo.getRequired("memo") - - /** - * APPROVED financial events were successful while DECLINED financial events were - * declined by user, Lithic, or the network. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun result(): Result = result.getRequired("result") - - /** - * The program specific subtype code for the specified category/type. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun subtype(): String = subtype.getRequired("subtype") - - /** - * Type of the book transfer - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun type(): BookTransferType = type.getRequired("type") - - /** - * Returns the raw JSON value of [token]. - * - * Unlike [token], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("token") @ExcludeMissing fun _token(): JsonField = token - - /** - * 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 [created]. - * - * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("created") - @ExcludeMissing - fun _created(): JsonField = created - - /** - * Returns the raw JSON value of [detailedResults]. - * - * Unlike [detailedResults], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("detailed_results") - @ExcludeMissing - fun _detailedResults(): JsonField = detailedResults - - /** - * Returns the raw JSON value of [memo]. - * - * Unlike [memo], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("memo") @ExcludeMissing fun _memo(): JsonField = memo - - /** - * 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 - - /** - * Returns the raw JSON value of [subtype]. - * - * Unlike [subtype], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("subtype") @ExcludeMissing fun _subtype(): JsonField = subtype - - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [BookTransferEvent]. - * - * The following fields are required: - * ```java - * .token() - * .amount() - * .created() - * .detailedResults() - * .memo() - * .result() - * .subtype() - * .type() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [BookTransferEvent]. */ - class Builder internal constructor() { - - private var token: JsonField? = null - private var amount: JsonField? = null - private var created: JsonField? = null - private var detailedResults: JsonField? = null - private var memo: JsonField? = null - private var result: JsonField? = null - private var subtype: JsonField? = null - private var type: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(bookTransferEvent: BookTransferEvent) = apply { - token = bookTransferEvent.token - amount = bookTransferEvent.amount - created = bookTransferEvent.created - detailedResults = bookTransferEvent.detailedResults - memo = bookTransferEvent.memo - result = bookTransferEvent.result - subtype = bookTransferEvent.subtype - type = bookTransferEvent.type - additionalProperties = bookTransferEvent.additionalProperties.toMutableMap() - } - - /** Globally unique identifier. */ - fun token(token: String) = token(JsonField.of(token)) - - /** - * Sets [Builder.token] to an arbitrary JSON value. - * - * You should usually call [Builder.token] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun token(token: JsonField) = apply { this.token = token } - - /** - * Amount of the financial event that has been settled in the currency's smallest - * unit (e.g., cents). - */ - fun amount(amount: Long) = amount(JsonField.of(amount)) - - /** - * Sets [Builder.amount] to an arbitrary JSON value. - * - * You should usually call [Builder.amount] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } - - /** Date and time when the financial event occurred. UTC time zone. */ - fun created(created: OffsetDateTime) = created(JsonField.of(created)) - - /** - * Sets [Builder.created] to an arbitrary JSON value. - * - * You should usually call [Builder.created] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun created(created: JsonField) = apply { this.created = created } - - fun detailedResults(detailedResults: BookTransferDetailedResults) = - detailedResults(JsonField.of(detailedResults)) - - /** - * Sets [Builder.detailedResults] to an arbitrary JSON value. - * - * You should usually call [Builder.detailedResults] with a well-typed - * [BookTransferDetailedResults] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. - */ - fun detailedResults(detailedResults: JsonField) = - apply { - this.detailedResults = detailedResults - } - - /** Memo for the transfer. */ - fun memo(memo: String) = memo(JsonField.of(memo)) - - /** - * Sets [Builder.memo] to an arbitrary JSON value. - * - * You should usually call [Builder.memo] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun memo(memo: JsonField) = apply { this.memo = memo } - - /** - * APPROVED financial events were successful while DECLINED financial events were - * declined by user, Lithic, or the 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 } - - /** The program specific subtype code for the specified category/type. */ - fun subtype(subtype: String) = subtype(JsonField.of(subtype)) - - /** - * Sets [Builder.subtype] to an arbitrary JSON value. - * - * You should usually call [Builder.subtype] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun subtype(subtype: JsonField) = apply { this.subtype = subtype } - - /** Type of the book transfer */ - fun type(type: BookTransferType) = type(JsonField.of(type)) - - /** - * Sets [Builder.type] to an arbitrary JSON value. - * - * You should usually call [Builder.type] with a well-typed [BookTransferType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun type(type: JsonField) = apply { this.type = type } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [BookTransferEvent]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .token() - * .amount() - * .created() - * .detailedResults() - * .memo() - * .result() - * .subtype() - * .type() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): BookTransferEvent = - BookTransferEvent( - checkRequired("token", token), - checkRequired("amount", amount), - checkRequired("created", created), - checkRequired("detailedResults", detailedResults), - checkRequired("memo", memo), - checkRequired("result", result), - checkRequired("subtype", subtype), - checkRequired("type", type), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): BookTransferEvent = apply { - if (validated) { - return@apply - } - - token() - amount() - created() - detailedResults().validate() - memo() - result().validate() - subtype() - type().validate() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 (token.asKnown().isPresent) 1 else 0) + - (if (amount.asKnown().isPresent) 1 else 0) + - (if (created.asKnown().isPresent) 1 else 0) + - (detailedResults.asKnown().getOrNull()?.validity() ?: 0) + - (if (memo.asKnown().isPresent) 1 else 0) + - (result.asKnown().getOrNull()?.validity() ?: 0) + - (if (subtype.asKnown().isPresent) 1 else 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) - - class BookTransferDetailedResults - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val APPROVED = of("APPROVED") - - @JvmField val FUNDS_INSUFFICIENT = of("FUNDS_INSUFFICIENT") - - @JvmStatic - fun of(value: String) = BookTransferDetailedResults(JsonField.of(value)) - } - - /** An enum containing [BookTransferDetailedResults]'s known values. */ - enum class Known { - APPROVED, - FUNDS_INSUFFICIENT, - } - - /** - * An enum containing [BookTransferDetailedResults]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [BookTransferDetailedResults] can contain an unknown value in a - * couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then 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 { - APPROVED, - FUNDS_INSUFFICIENT, - /** - * An enum member indicating that [BookTransferDetailedResults] 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) { - APPROVED -> Value.APPROVED - FUNDS_INSUFFICIENT -> Value.FUNDS_INSUFFICIENT - 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 LithicInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - APPROVED -> Known.APPROVED - FUNDS_INSUFFICIENT -> Known.FUNDS_INSUFFICIENT - else -> - throw LithicInvalidDataException( - "Unknown BookTransferDetailedResults: $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 LithicInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): BookTransferDetailedResults = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 BookTransferDetailedResults && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** - * APPROVED financial events were successful while DECLINED financial events were - * declined by user, Lithic, or the 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 { - - @JvmField val APPROVED = of("APPROVED") - - @JvmField val DECLINED = of("DECLINED") - - @JvmStatic fun of(value: String) = Result(JsonField.of(value)) - } - - /** An enum containing [Result]'s known values. */ - enum class Known { - APPROVED, - DECLINED, - } - - /** - * 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 { - APPROVED, - DECLINED, - /** - * 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) { - APPROVED -> Value.APPROVED - DECLINED -> Value.DECLINED - 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 LithicInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - APPROVED -> Known.APPROVED - DECLINED -> Known.DECLINED - else -> throw LithicInvalidDataException("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 LithicInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("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: LithicInvalidDataException) { - 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() - } - - /** Type of the book transfer */ - class BookTransferType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ATM_BALANCE_INQUIRY = of("ATM_BALANCE_INQUIRY") - - @JvmField val ATM_WITHDRAWAL = of("ATM_WITHDRAWAL") - - @JvmField val ATM_DECLINE = of("ATM_DECLINE") - - @JvmField val INTERNATIONAL_ATM_WITHDRAWAL = of("INTERNATIONAL_ATM_WITHDRAWAL") - - @JvmField val INACTIVITY = of("INACTIVITY") - - @JvmField val STATEMENT = of("STATEMENT") - - @JvmField val MONTHLY = of("MONTHLY") - - @JvmField val QUARTERLY = of("QUARTERLY") - - @JvmField val ANNUAL = of("ANNUAL") - - @JvmField val CUSTOMER_SERVICE = of("CUSTOMER_SERVICE") - - @JvmField val ACCOUNT_MAINTENANCE = of("ACCOUNT_MAINTENANCE") - - @JvmField val ACCOUNT_ACTIVATION = of("ACCOUNT_ACTIVATION") - - @JvmField val ACCOUNT_CLOSURE = of("ACCOUNT_CLOSURE") - - @JvmField val CARD_REPLACEMENT = of("CARD_REPLACEMENT") - - @JvmField val CARD_DELIVERY = of("CARD_DELIVERY") - - @JvmField val CARD_CREATE = of("CARD_CREATE") - - @JvmField val CURRENCY_CONVERSION = of("CURRENCY_CONVERSION") - - @JvmField val INTEREST = of("INTEREST") - - @JvmField val LATE_PAYMENT = of("LATE_PAYMENT") - - @JvmField val BILL_PAYMENT = of("BILL_PAYMENT") - - @JvmField val CASH_BACK = of("CASH_BACK") - - @JvmField val ACCOUNT_TO_ACCOUNT = of("ACCOUNT_TO_ACCOUNT") - - @JvmField val CARD_TO_CARD = of("CARD_TO_CARD") - - @JvmField val DISBURSE = of("DISBURSE") - - @JvmField val BILLING_ERROR = of("BILLING_ERROR") - - @JvmField val LOSS_WRITE_OFF = of("LOSS_WRITE_OFF") - - @JvmField val EXPIRED_CARD = of("EXPIRED_CARD") - - @JvmField val EARLY_DERECOGNITION = of("EARLY_DERECOGNITION") - - @JvmField val ESCHEATMENT = of("ESCHEATMENT") - - @JvmField val INACTIVITY_FEE_DOWN = of("INACTIVITY_FEE_DOWN") - - @JvmField val PROVISIONAL_CREDIT = of("PROVISIONAL_CREDIT") - - @JvmField val DISPUTE_WON = of("DISPUTE_WON") - - @JvmField val SERVICE = of("SERVICE") - - @JvmField val TRANSFER = of("TRANSFER") - - @JvmField val COLLECTION = of("COLLECTION") - - @JvmStatic fun of(value: String) = BookTransferType(JsonField.of(value)) - } - - /** An enum containing [BookTransferType]'s known values. */ - enum class Known { - ATM_BALANCE_INQUIRY, - ATM_WITHDRAWAL, - ATM_DECLINE, - INTERNATIONAL_ATM_WITHDRAWAL, - INACTIVITY, - STATEMENT, - MONTHLY, - QUARTERLY, - ANNUAL, - CUSTOMER_SERVICE, - ACCOUNT_MAINTENANCE, - ACCOUNT_ACTIVATION, - ACCOUNT_CLOSURE, - CARD_REPLACEMENT, - CARD_DELIVERY, - CARD_CREATE, - CURRENCY_CONVERSION, - INTEREST, - LATE_PAYMENT, - BILL_PAYMENT, - CASH_BACK, - ACCOUNT_TO_ACCOUNT, - CARD_TO_CARD, - DISBURSE, - BILLING_ERROR, - LOSS_WRITE_OFF, - EXPIRED_CARD, - EARLY_DERECOGNITION, - ESCHEATMENT, - INACTIVITY_FEE_DOWN, - PROVISIONAL_CREDIT, - DISPUTE_WON, - SERVICE, - TRANSFER, - COLLECTION, - } - - /** - * An enum containing [BookTransferType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [BookTransferType] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then 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 { - ATM_BALANCE_INQUIRY, - ATM_WITHDRAWAL, - ATM_DECLINE, - INTERNATIONAL_ATM_WITHDRAWAL, - INACTIVITY, - STATEMENT, - MONTHLY, - QUARTERLY, - ANNUAL, - CUSTOMER_SERVICE, - ACCOUNT_MAINTENANCE, - ACCOUNT_ACTIVATION, - ACCOUNT_CLOSURE, - CARD_REPLACEMENT, - CARD_DELIVERY, - CARD_CREATE, - CURRENCY_CONVERSION, - INTEREST, - LATE_PAYMENT, - BILL_PAYMENT, - CASH_BACK, - ACCOUNT_TO_ACCOUNT, - CARD_TO_CARD, - DISBURSE, - BILLING_ERROR, - LOSS_WRITE_OFF, - EXPIRED_CARD, - EARLY_DERECOGNITION, - ESCHEATMENT, - INACTIVITY_FEE_DOWN, - PROVISIONAL_CREDIT, - DISPUTE_WON, - SERVICE, - TRANSFER, - COLLECTION, - /** - * An enum member indicating that [BookTransferType] 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) { - ATM_BALANCE_INQUIRY -> Value.ATM_BALANCE_INQUIRY - ATM_WITHDRAWAL -> Value.ATM_WITHDRAWAL - ATM_DECLINE -> Value.ATM_DECLINE - INTERNATIONAL_ATM_WITHDRAWAL -> Value.INTERNATIONAL_ATM_WITHDRAWAL - INACTIVITY -> Value.INACTIVITY - STATEMENT -> Value.STATEMENT - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ANNUAL -> Value.ANNUAL - CUSTOMER_SERVICE -> Value.CUSTOMER_SERVICE - ACCOUNT_MAINTENANCE -> Value.ACCOUNT_MAINTENANCE - ACCOUNT_ACTIVATION -> Value.ACCOUNT_ACTIVATION - ACCOUNT_CLOSURE -> Value.ACCOUNT_CLOSURE - CARD_REPLACEMENT -> Value.CARD_REPLACEMENT - CARD_DELIVERY -> Value.CARD_DELIVERY - CARD_CREATE -> Value.CARD_CREATE - CURRENCY_CONVERSION -> Value.CURRENCY_CONVERSION - INTEREST -> Value.INTEREST - LATE_PAYMENT -> Value.LATE_PAYMENT - BILL_PAYMENT -> Value.BILL_PAYMENT - CASH_BACK -> Value.CASH_BACK - ACCOUNT_TO_ACCOUNT -> Value.ACCOUNT_TO_ACCOUNT - CARD_TO_CARD -> Value.CARD_TO_CARD - DISBURSE -> Value.DISBURSE - BILLING_ERROR -> Value.BILLING_ERROR - LOSS_WRITE_OFF -> Value.LOSS_WRITE_OFF - EXPIRED_CARD -> Value.EXPIRED_CARD - EARLY_DERECOGNITION -> Value.EARLY_DERECOGNITION - ESCHEATMENT -> Value.ESCHEATMENT - INACTIVITY_FEE_DOWN -> Value.INACTIVITY_FEE_DOWN - PROVISIONAL_CREDIT -> Value.PROVISIONAL_CREDIT - DISPUTE_WON -> Value.DISPUTE_WON - SERVICE -> Value.SERVICE - TRANSFER -> Value.TRANSFER - COLLECTION -> Value.COLLECTION - 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 LithicInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - ATM_BALANCE_INQUIRY -> Known.ATM_BALANCE_INQUIRY - ATM_WITHDRAWAL -> Known.ATM_WITHDRAWAL - ATM_DECLINE -> Known.ATM_DECLINE - INTERNATIONAL_ATM_WITHDRAWAL -> Known.INTERNATIONAL_ATM_WITHDRAWAL - INACTIVITY -> Known.INACTIVITY - STATEMENT -> Known.STATEMENT - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ANNUAL -> Known.ANNUAL - CUSTOMER_SERVICE -> Known.CUSTOMER_SERVICE - ACCOUNT_MAINTENANCE -> Known.ACCOUNT_MAINTENANCE - ACCOUNT_ACTIVATION -> Known.ACCOUNT_ACTIVATION - ACCOUNT_CLOSURE -> Known.ACCOUNT_CLOSURE - CARD_REPLACEMENT -> Known.CARD_REPLACEMENT - CARD_DELIVERY -> Known.CARD_DELIVERY - CARD_CREATE -> Known.CARD_CREATE - CURRENCY_CONVERSION -> Known.CURRENCY_CONVERSION - INTEREST -> Known.INTEREST - LATE_PAYMENT -> Known.LATE_PAYMENT - BILL_PAYMENT -> Known.BILL_PAYMENT - CASH_BACK -> Known.CASH_BACK - ACCOUNT_TO_ACCOUNT -> Known.ACCOUNT_TO_ACCOUNT - CARD_TO_CARD -> Known.CARD_TO_CARD - DISBURSE -> Known.DISBURSE - BILLING_ERROR -> Known.BILLING_ERROR - LOSS_WRITE_OFF -> Known.LOSS_WRITE_OFF - EXPIRED_CARD -> Known.EXPIRED_CARD - EARLY_DERECOGNITION -> Known.EARLY_DERECOGNITION - ESCHEATMENT -> Known.ESCHEATMENT - INACTIVITY_FEE_DOWN -> Known.INACTIVITY_FEE_DOWN - PROVISIONAL_CREDIT -> Known.PROVISIONAL_CREDIT - DISPUTE_WON -> Known.DISPUTE_WON - SERVICE -> Known.SERVICE - TRANSFER -> Known.TRANSFER - COLLECTION -> Known.COLLECTION - else -> throw LithicInvalidDataException("Unknown BookTransferType: $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 LithicInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): BookTransferType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 BookTransferType && 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 BookTransferEvent && - token == other.token && - amount == other.amount && - created == other.created && - detailedResults == other.detailedResults && - memo == other.memo && - result == other.result && - subtype == other.subtype && - type == other.type && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - token, - amount, - created, - detailedResults, - memo, - result, - subtype, - type, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "BookTransferEvent{token=$token, amount=$amount, created=$created, detailedResults=$detailedResults, memo=$memo, result=$result, subtype=$subtype, type=$type, additionalProperties=$additionalProperties}" - } - - class TransactionFamilyTypes - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CARD = of("CARD") - - @JvmField val PAYMENT = of("PAYMENT") - - @JvmField val TRANSFER = of("TRANSFER") - - @JvmField val INTERNAL = of("INTERNAL") - - @JvmField val EXTERNAL_PAYMENT = of("EXTERNAL_PAYMENT") - - @JvmField val MANAGEMENT_OPERATION = of("MANAGEMENT_OPERATION") - - @JvmStatic fun of(value: String) = TransactionFamilyTypes(JsonField.of(value)) - } - - /** An enum containing [TransactionFamilyTypes]'s known values. */ - enum class Known { - CARD, - PAYMENT, - TRANSFER, - INTERNAL, - EXTERNAL_PAYMENT, - MANAGEMENT_OPERATION, - } - - /** - * An enum containing [TransactionFamilyTypes]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [TransactionFamilyTypes] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CARD, - PAYMENT, - TRANSFER, - INTERNAL, - EXTERNAL_PAYMENT, - MANAGEMENT_OPERATION, - /** - * An enum member indicating that [TransactionFamilyTypes] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CARD -> Value.CARD - PAYMENT -> Value.PAYMENT - TRANSFER -> Value.TRANSFER - INTERNAL -> Value.INTERNAL - EXTERNAL_PAYMENT -> Value.EXTERNAL_PAYMENT - MANAGEMENT_OPERATION -> Value.MANAGEMENT_OPERATION - 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 LithicInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - CARD -> Known.CARD - PAYMENT -> Known.PAYMENT - TRANSFER -> Known.TRANSFER - INTERNAL -> Known.INTERNAL - EXTERNAL_PAYMENT -> Known.EXTERNAL_PAYMENT - MANAGEMENT_OPERATION -> Known.MANAGEMENT_OPERATION - else -> - throw LithicInvalidDataException("Unknown TransactionFamilyTypes: $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 LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): TransactionFamilyTypes = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 TransactionFamilyTypes && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - class TransactionResult - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val APPROVED = of("APPROVED") - - @JvmField val DECLINED = of("DECLINED") - - @JvmStatic fun of(value: String) = TransactionResult(JsonField.of(value)) - } - - /** An enum containing [TransactionResult]'s known values. */ - enum class Known { - APPROVED, - DECLINED, - } - - /** - * An enum containing [TransactionResult]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [TransactionResult] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then 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 { - APPROVED, - DECLINED, - /** - * An enum member indicating that [TransactionResult] 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) { - APPROVED -> Value.APPROVED - DECLINED -> Value.DECLINED - 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 LithicInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - APPROVED -> Known.APPROVED - DECLINED -> Known.DECLINED - else -> throw LithicInvalidDataException("Unknown TransactionResult: $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 LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): TransactionResult = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 TransactionResult && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The status of the transaction */ - class TransactionStatus - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val PENDING = of("PENDING") - - @JvmField val SETTLED = of("SETTLED") - - @JvmField val DECLINED = of("DECLINED") - - @JvmField val REVERSED = of("REVERSED") - - @JvmField val CANCELED = of("CANCELED") - - @JvmStatic fun of(value: String) = TransactionStatus(JsonField.of(value)) - } - - /** An enum containing [TransactionStatus]'s known values. */ - enum class Known { - PENDING, - SETTLED, - DECLINED, - REVERSED, - CANCELED, - } - - /** - * An enum containing [TransactionStatus]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [TransactionStatus] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then 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 { - PENDING, - SETTLED, - DECLINED, - REVERSED, - CANCELED, - /** - * An enum member indicating that [TransactionStatus] 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) { - PENDING -> Value.PENDING - SETTLED -> Value.SETTLED - DECLINED -> Value.DECLINED - REVERSED -> Value.REVERSED - CANCELED -> Value.CANCELED - 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 LithicInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - PENDING -> Known.PENDING - SETTLED -> Known.SETTLED - DECLINED -> Known.DECLINED - REVERSED -> Known.REVERSED - CANCELED -> Known.CANCELED - else -> throw LithicInvalidDataException("Unknown TransactionStatus: $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 LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): TransactionStatus = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 TransactionStatus && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - class TransactionSeries - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val relatedTransactionEventToken: JsonField, - private val relatedTransactionToken: JsonField, - private val type: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("related_transaction_event_token") - @ExcludeMissing - relatedTransactionEventToken: JsonField = JsonMissing.of(), - @JsonProperty("related_transaction_token") - @ExcludeMissing - relatedTransactionToken: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - ) : this(relatedTransactionEventToken, relatedTransactionToken, type, mutableMapOf()) - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun relatedTransactionEventToken(): Optional = - relatedTransactionEventToken.getOptional("related_transaction_event_token") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun relatedTransactionToken(): Optional = - relatedTransactionToken.getOptional("related_transaction_token") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun type(): String = type.getRequired("type") - - /** - * Returns the raw JSON value of [relatedTransactionEventToken]. - * - * Unlike [relatedTransactionEventToken], this method doesn't throw if the JSON field - * has an unexpected type. - */ - @JsonProperty("related_transaction_event_token") - @ExcludeMissing - fun _relatedTransactionEventToken(): JsonField = relatedTransactionEventToken - - /** - * Returns the raw JSON value of [relatedTransactionToken]. - * - * Unlike [relatedTransactionToken], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("related_transaction_token") - @ExcludeMissing - fun _relatedTransactionToken(): JsonField = relatedTransactionToken - - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [TransactionSeries]. - * - * The following fields are required: - * ```java - * .relatedTransactionEventToken() - * .relatedTransactionToken() - * .type() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [TransactionSeries]. */ - class Builder internal constructor() { - - private var relatedTransactionEventToken: JsonField? = null - private var relatedTransactionToken: JsonField? = null - private var type: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(transactionSeries: TransactionSeries) = apply { - relatedTransactionEventToken = transactionSeries.relatedTransactionEventToken - relatedTransactionToken = transactionSeries.relatedTransactionToken - type = transactionSeries.type - additionalProperties = transactionSeries.additionalProperties.toMutableMap() - } - - fun relatedTransactionEventToken(relatedTransactionEventToken: String?) = - relatedTransactionEventToken(JsonField.ofNullable(relatedTransactionEventToken)) - - /** - * Alias for calling [Builder.relatedTransactionEventToken] with - * `relatedTransactionEventToken.orElse(null)`. - */ - fun relatedTransactionEventToken(relatedTransactionEventToken: Optional) = - relatedTransactionEventToken(relatedTransactionEventToken.getOrNull()) - - /** - * Sets [Builder.relatedTransactionEventToken] to an arbitrary JSON value. - * - * You should usually call [Builder.relatedTransactionEventToken] with a well-typed - * [String] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun relatedTransactionEventToken(relatedTransactionEventToken: JsonField) = - apply { - this.relatedTransactionEventToken = relatedTransactionEventToken - } - - fun relatedTransactionToken(relatedTransactionToken: String?) = - relatedTransactionToken(JsonField.ofNullable(relatedTransactionToken)) - - /** - * Alias for calling [Builder.relatedTransactionToken] with - * `relatedTransactionToken.orElse(null)`. - */ - fun relatedTransactionToken(relatedTransactionToken: Optional) = - relatedTransactionToken(relatedTransactionToken.getOrNull()) - - /** - * Sets [Builder.relatedTransactionToken] to an arbitrary JSON value. - * - * You should usually call [Builder.relatedTransactionToken] with a well-typed - * [String] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun relatedTransactionToken(relatedTransactionToken: JsonField) = apply { - this.relatedTransactionToken = relatedTransactionToken - } - - fun type(type: String) = type(JsonField.of(type)) - - /** - * Sets [Builder.type] to an arbitrary JSON value. - * - * You should usually call [Builder.type] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun type(type: JsonField) = apply { this.type = type } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [TransactionSeries]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .relatedTransactionEventToken() - * .relatedTransactionToken() - * .type() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): TransactionSeries = - TransactionSeries( - checkRequired("relatedTransactionEventToken", relatedTransactionEventToken), - checkRequired("relatedTransactionToken", relatedTransactionToken), - checkRequired("type", type), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): TransactionSeries = apply { - if (validated) { - return@apply - } - - relatedTransactionEventToken() - relatedTransactionToken() - type() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 (relatedTransactionEventToken.asKnown().isPresent) 1 else 0) + - (if (relatedTransactionToken.asKnown().isPresent) 1 else 0) + - (if (type.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is TransactionSeries && - relatedTransactionEventToken == other.relatedTransactionEventToken && - relatedTransactionToken == other.relatedTransactionToken && - type == other.type && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - relatedTransactionEventToken, - relatedTransactionToken, - type, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "TransactionSeries{relatedTransactionEventToken=$relatedTransactionEventToken, relatedTransactionToken=$relatedTransactionToken, type=$type, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is BookTransferTransaction && - token == other.token && - category == other.category && - created == other.created && - currency == other.currency && - events == other.events && - family == other.family && - fromFinancialAccountToken == other.fromFinancialAccountToken && - pendingAmount == other.pendingAmount && - result == other.result && - settledAmount == other.settledAmount && - status == other.status && - toFinancialAccountToken == other.toFinancialAccountToken && - updated == other.updated && - externalId == other.externalId && - externalResource == other.externalResource && - transactionSeries == other.transactionSeries && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - token, - category, - created, - currency, - events, - family, - fromFinancialAccountToken, - pendingAmount, - result, - settledAmount, - status, - toFinancialAccountToken, - updated, - externalId, - externalResource, - transactionSeries, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "BookTransferTransaction{token=$token, category=$category, created=$created, currency=$currency, events=$events, family=$family, fromFinancialAccountToken=$fromFinancialAccountToken, pendingAmount=$pendingAmount, result=$result, settledAmount=$settledAmount, status=$status, toFinancialAccountToken=$toFinancialAccountToken, updated=$updated, externalId=$externalId, externalResource=$externalResource, transactionSeries=$transactionSeries, additionalProperties=$additionalProperties}" - } - - /** Base class for all transaction types in the ledger service */ - class CardTransaction - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val token: JsonField, - private val accountToken: JsonField, - private val acquirerFee: JsonField, - private val acquirerReferenceNumber: JsonField, - private val amount: JsonField, - private val amounts: JsonField, - private val authorizationAmount: JsonField, - private val authorizationCode: JsonField, - private val avs: JsonField, - private val cardToken: JsonField, - private val cardholderAuthentication: JsonField, - private val created: JsonField, - private val financialAccountToken: JsonField, - private val merchant: JsonField, - private val merchantAmount: JsonField, - private val merchantAuthorizationAmount: JsonField, - private val merchantCurrency: JsonField, - private val network: JsonField, - private val networkRiskScore: JsonField, - private val pos: JsonField, - private val result: JsonField, - private val settledAmount: JsonField, - private val status: JsonField, - private val tokenInfo: JsonField, - private val updated: JsonField, - private val events: JsonField>, - private val family: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), - @JsonProperty("account_token") - @ExcludeMissing - accountToken: JsonField = JsonMissing.of(), - @JsonProperty("acquirer_fee") - @ExcludeMissing - acquirerFee: JsonField = JsonMissing.of(), - @JsonProperty("acquirer_reference_number") - @ExcludeMissing - acquirerReferenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - @JsonProperty("amounts") - @ExcludeMissing - amounts: JsonField = JsonMissing.of(), - @JsonProperty("authorization_amount") - @ExcludeMissing - authorizationAmount: JsonField = JsonMissing.of(), - @JsonProperty("authorization_code") - @ExcludeMissing - authorizationCode: JsonField = JsonMissing.of(), - @JsonProperty("avs") @ExcludeMissing avs: JsonField = JsonMissing.of(), - @JsonProperty("card_token") - @ExcludeMissing - cardToken: JsonField = JsonMissing.of(), - @JsonProperty("cardholder_authentication") - @ExcludeMissing - cardholderAuthentication: JsonField = - JsonMissing.of(), - @JsonProperty("created") - @ExcludeMissing - created: JsonField = JsonMissing.of(), - @JsonProperty("financial_account_token") - @ExcludeMissing - financialAccountToken: JsonField = JsonMissing.of(), - @JsonProperty("merchant") - @ExcludeMissing - merchant: JsonField = JsonMissing.of(), - @JsonProperty("merchant_amount") - @ExcludeMissing - merchantAmount: JsonField = JsonMissing.of(), - @JsonProperty("merchant_authorization_amount") - @ExcludeMissing - merchantAuthorizationAmount: JsonField = JsonMissing.of(), - @JsonProperty("merchant_currency") - @ExcludeMissing - merchantCurrency: JsonField = JsonMissing.of(), - @JsonProperty("network") - @ExcludeMissing - network: JsonField = JsonMissing.of(), - @JsonProperty("network_risk_score") - @ExcludeMissing - networkRiskScore: JsonField = JsonMissing.of(), - @JsonProperty("pos") @ExcludeMissing pos: JsonField = JsonMissing.of(), - @JsonProperty("result") - @ExcludeMissing - result: JsonField = JsonMissing.of(), - @JsonProperty("settled_amount") - @ExcludeMissing - settledAmount: JsonField = JsonMissing.of(), - @JsonProperty("status") - @ExcludeMissing - status: JsonField = JsonMissing.of(), - @JsonProperty("token_info") - @ExcludeMissing - tokenInfo: JsonField = JsonMissing.of(), - @JsonProperty("updated") - @ExcludeMissing - updated: JsonField = JsonMissing.of(), - @JsonProperty("events") - @ExcludeMissing - events: JsonField> = JsonMissing.of(), - @JsonProperty("family") - @ExcludeMissing - family: JsonField = JsonMissing.of(), - ) : this( - token, - accountToken, - acquirerFee, - acquirerReferenceNumber, - amount, - amounts, - authorizationAmount, - authorizationCode, - avs, - cardToken, - cardholderAuthentication, - created, - financialAccountToken, - merchant, - merchantAmount, - merchantAuthorizationAmount, - merchantCurrency, - network, - networkRiskScore, - pos, - result, - settledAmount, - status, - tokenInfo, - updated, - events, - family, - mutableMapOf(), - ) - - fun toTransaction(): Transaction = - Transaction.builder() - .token(token) - .accountToken(accountToken) - .acquirerFee(acquirerFee) - .acquirerReferenceNumber(acquirerReferenceNumber) - .amount(amount) - .amounts(amounts) - .authorizationAmount(authorizationAmount) - .authorizationCode(authorizationCode) - .avs(avs) - .cardToken(cardToken) - .cardholderAuthentication(cardholderAuthentication) - .created(created) - .financialAccountToken(financialAccountToken) - .merchant(merchant) - .merchantAmount(merchantAmount) - .merchantAuthorizationAmount(merchantAuthorizationAmount) - .merchantCurrency(merchantCurrency) - .network(network) - .networkRiskScore(networkRiskScore) - .pos(pos) - .result(result) - .settledAmount(settledAmount) - .status(status) - .tokenInfo(tokenInfo) - .updated(updated) - .events(events) - .build() - - /** - * Globally unique identifier. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun token(): String = token.getRequired("token") - - /** - * The token for the account associated with this transaction. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun accountToken(): String = accountToken.getRequired("account_token") - - /** - * Fee assessed by the merchant and paid for by the cardholder in the smallest unit of the - * currency. Will be zero if no fee is assessed. Rebates may be transmitted as a negative - * value to indicate credited fees. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun acquirerFee(): Optional = acquirerFee.getOptional("acquirer_fee") - - /** - * Unique identifier assigned to a transaction by the acquirer that can be used in dispute - * and chargeback filing. This field has been deprecated in favor of the - * `acquirer_reference_number` that resides in the event-level `network_info`. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - @Deprecated("deprecated") - fun acquirerReferenceNumber(): Optional = - acquirerReferenceNumber.getOptional("acquirer_reference_number") - - /** - * When the transaction is pending, this represents the authorization amount of the - * transaction in the anticipated settlement currency. Once the transaction has settled, - * this field represents the settled amount in the settlement currency. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - @Deprecated("deprecated") fun amount(): Long = amount.getRequired("amount") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun amounts(): Transaction.TransactionAmounts = amounts.getRequired("amounts") - - /** - * The authorization amount of the transaction in the anticipated settlement currency. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - @Deprecated("deprecated") - fun authorizationAmount(): Optional = - authorizationAmount.getOptional("authorization_amount") - - /** - * A fixed-width 6-digit numeric identifier that can be used to identify a transaction with - * networks. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun authorizationCode(): Optional = - authorizationCode.getOptional("authorization_code") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun avs(): Optional = avs.getOptional("avs") - - /** - * Token for the card used in this transaction. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun cardToken(): String = cardToken.getRequired("card_token") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun cardholderAuthentication(): Optional = - cardholderAuthentication.getOptional("cardholder_authentication") - - /** - * Date and time when the transaction first occurred. UTC time zone. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun created(): OffsetDateTime = created.getRequired("created") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun financialAccountToken(): Optional = - financialAccountToken.getOptional("financial_account_token") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun merchant(): Transaction.Merchant = merchant.getRequired("merchant") - - /** - * Analogous to the 'amount', but in the merchant currency. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - @Deprecated("deprecated") - fun merchantAmount(): Optional = merchantAmount.getOptional("merchant_amount") - - /** - * Analogous to the 'authorization_amount', but in the merchant currency. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - @Deprecated("deprecated") - fun merchantAuthorizationAmount(): Optional = - merchantAuthorizationAmount.getOptional("merchant_authorization_amount") - - /** - * 3-character alphabetic ISO 4217 code for the local currency of the transaction. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - @Deprecated("deprecated") - fun merchantCurrency(): String = merchantCurrency.getRequired("merchant_currency") - - /** - * Card network of the authorization. Value is `UNKNOWN` when Lithic cannot determine the - * network code from the upstream provider. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun network(): Optional = network.getOptional("network") - - /** - * Network-provided score assessing risk level associated with a given authorization. Scores - * are on a range of 0-999, with 0 representing the lowest risk and 999 representing the - * highest risk. For Visa transactions, where the raw score has a range of 0-99, Lithic will - * normalize the score by multiplying the raw score by 10x. - * - * @throws LithicInvalidDataException 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") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun pos(): Transaction.Pos = pos.getRequired("pos") - - /** - * @throws LithicInvalidDataException if 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(): Transaction.DeclineResult = result.getRequired("result") - - /** - * The settled amount of the transaction in the settlement currency. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - @Deprecated("deprecated") - fun settledAmount(): Long = settledAmount.getRequired("settled_amount") - - /** - * Status of the transaction. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun status(): Transaction.Status = status.getRequired("status") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun tokenInfo(): Optional = tokenInfo.getOptional("token_info") - - /** - * Date and time when the transaction last updated. UTC time zone. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun updated(): OffsetDateTime = updated.getRequired("updated") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun events(): Optional> = events.getOptional("events") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun family(): TransactionFamilyTypes = family.getRequired("family") - - /** - * Returns the raw JSON value of [token]. - * - * Unlike [token], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("token") @ExcludeMissing fun _token(): JsonField = token - - /** - * Returns the raw JSON value of [accountToken]. - * - * Unlike [accountToken], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("account_token") - @ExcludeMissing - fun _accountToken(): JsonField = accountToken - - /** - * Returns the raw JSON value of [acquirerFee]. - * - * Unlike [acquirerFee], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("acquirer_fee") - @ExcludeMissing - fun _acquirerFee(): JsonField = acquirerFee - - /** - * Returns the raw JSON value of [acquirerReferenceNumber]. - * - * Unlike [acquirerReferenceNumber], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @Deprecated("deprecated") - @JsonProperty("acquirer_reference_number") - @ExcludeMissing - fun _acquirerReferenceNumber(): JsonField = acquirerReferenceNumber - - /** - * Returns the raw JSON value of [amount]. - * - * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. - */ - @Deprecated("deprecated") - @JsonProperty("amount") - @ExcludeMissing - fun _amount(): JsonField = amount - - /** - * Returns the raw JSON value of [amounts]. - * - * Unlike [amounts], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("amounts") - @ExcludeMissing - fun _amounts(): JsonField = amounts - - /** - * Returns the raw JSON value of [authorizationAmount]. - * - * Unlike [authorizationAmount], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @Deprecated("deprecated") - @JsonProperty("authorization_amount") - @ExcludeMissing - fun _authorizationAmount(): JsonField = authorizationAmount - - /** - * Returns the raw JSON value of [authorizationCode]. - * - * Unlike [authorizationCode], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("authorization_code") - @ExcludeMissing - fun _authorizationCode(): JsonField = authorizationCode - - /** - * Returns the raw JSON value of [avs]. - * - * Unlike [avs], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("avs") @ExcludeMissing fun _avs(): JsonField = avs - - /** - * Returns the raw JSON value of [cardToken]. - * - * Unlike [cardToken], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("card_token") @ExcludeMissing fun _cardToken(): JsonField = cardToken - - /** - * Returns the raw JSON value of [cardholderAuthentication]. - * - * Unlike [cardholderAuthentication], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("cardholder_authentication") - @ExcludeMissing - fun _cardholderAuthentication(): JsonField = - cardholderAuthentication - - /** - * Returns the raw JSON value of [created]. - * - * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created - - /** - * Returns the raw JSON value of [financialAccountToken]. - * - * Unlike [financialAccountToken], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("financial_account_token") - @ExcludeMissing - fun _financialAccountToken(): JsonField = financialAccountToken - - /** - * Returns the raw JSON value of [merchant]. - * - * Unlike [merchant], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("merchant") - @ExcludeMissing - fun _merchant(): JsonField = merchant - - /** - * Returns the raw JSON value of [merchantAmount]. - * - * Unlike [merchantAmount], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @Deprecated("deprecated") - @JsonProperty("merchant_amount") - @ExcludeMissing - fun _merchantAmount(): JsonField = merchantAmount - - /** - * Returns the raw JSON value of [merchantAuthorizationAmount]. - * - * Unlike [merchantAuthorizationAmount], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @Deprecated("deprecated") - @JsonProperty("merchant_authorization_amount") - @ExcludeMissing - fun _merchantAuthorizationAmount(): JsonField = merchantAuthorizationAmount - - /** - * Returns the raw JSON value of [merchantCurrency]. - * - * Unlike [merchantCurrency], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @Deprecated("deprecated") - @JsonProperty("merchant_currency") - @ExcludeMissing - fun _merchantCurrency(): JsonField = merchantCurrency - - /** - * Returns the raw JSON value of [network]. - * - * Unlike [network], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("network") - @ExcludeMissing - fun _network(): JsonField = network - - /** - * Returns the raw JSON value of [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 [pos]. - * - * Unlike [pos], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("pos") @ExcludeMissing fun _pos(): JsonField = pos - - /** - * 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 - - /** - * Returns the raw JSON value of [settledAmount]. - * - * Unlike [settledAmount], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @Deprecated("deprecated") - @JsonProperty("settled_amount") - @ExcludeMissing - fun _settledAmount(): JsonField = settledAmount - - /** - * Returns the raw JSON value of [status]. - * - * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("status") - @ExcludeMissing - fun _status(): JsonField = status - - /** - * Returns the raw JSON value of [tokenInfo]. - * - * Unlike [tokenInfo], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("token_info") - @ExcludeMissing - fun _tokenInfo(): JsonField = tokenInfo - - /** - * Returns the raw JSON value of [updated]. - * - * Unlike [updated], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("updated") @ExcludeMissing fun _updated(): JsonField = updated - - /** - * Returns the raw JSON value of [events]. - * - * Unlike [events], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("events") - @ExcludeMissing - fun _events(): JsonField> = events - - /** - * Returns the raw JSON value of [family]. - * - * Unlike [family], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("family") - @ExcludeMissing - fun _family(): JsonField = family - - @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 [CardTransaction]. - * - * The following fields are required: - * ```java - * .token() - * .accountToken() - * .acquirerFee() - * .acquirerReferenceNumber() - * .amount() - * .amounts() - * .authorizationAmount() - * .authorizationCode() - * .avs() - * .cardToken() - * .cardholderAuthentication() - * .created() - * .financialAccountToken() - * .merchant() - * .merchantAmount() - * .merchantAuthorizationAmount() - * .merchantCurrency() - * .network() - * .networkRiskScore() - * .pos() - * .result() - * .settledAmount() - * .status() - * .tokenInfo() - * .updated() - * .family() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CardTransaction]. */ - class Builder internal constructor() { - - private var token: JsonField? = null - private var accountToken: JsonField? = null - private var acquirerFee: JsonField? = null - private var acquirerReferenceNumber: JsonField? = null - private var amount: JsonField? = null - private var amounts: JsonField? = null - private var authorizationAmount: JsonField? = null - private var authorizationCode: JsonField? = null - private var avs: JsonField? = null - private var cardToken: JsonField? = null - private var cardholderAuthentication: JsonField? = - null - private var created: JsonField? = null - private var financialAccountToken: JsonField? = null - private var merchant: JsonField? = null - private var merchantAmount: JsonField? = null - private var merchantAuthorizationAmount: JsonField? = null - private var merchantCurrency: JsonField? = null - private var network: JsonField? = null - private var networkRiskScore: JsonField? = null - private var pos: JsonField? = null - private var result: JsonField? = null - private var settledAmount: JsonField? = null - private var status: JsonField? = null - private var tokenInfo: JsonField? = null - private var updated: JsonField? = null - private var events: JsonField>? = null - private var family: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(cardTransaction: CardTransaction) = apply { - token = cardTransaction.token - accountToken = cardTransaction.accountToken - acquirerFee = cardTransaction.acquirerFee - acquirerReferenceNumber = cardTransaction.acquirerReferenceNumber - amount = cardTransaction.amount - amounts = cardTransaction.amounts - authorizationAmount = cardTransaction.authorizationAmount - authorizationCode = cardTransaction.authorizationCode - avs = cardTransaction.avs - cardToken = cardTransaction.cardToken - cardholderAuthentication = cardTransaction.cardholderAuthentication - created = cardTransaction.created - financialAccountToken = cardTransaction.financialAccountToken - merchant = cardTransaction.merchant - merchantAmount = cardTransaction.merchantAmount - merchantAuthorizationAmount = cardTransaction.merchantAuthorizationAmount - merchantCurrency = cardTransaction.merchantCurrency - network = cardTransaction.network - networkRiskScore = cardTransaction.networkRiskScore - pos = cardTransaction.pos - result = cardTransaction.result - settledAmount = cardTransaction.settledAmount - status = cardTransaction.status - tokenInfo = cardTransaction.tokenInfo - updated = cardTransaction.updated - events = cardTransaction.events.map { it.toMutableList() } - family = cardTransaction.family - additionalProperties = cardTransaction.additionalProperties.toMutableMap() - } - - /** Globally unique identifier. */ - fun token(token: String) = token(JsonField.of(token)) - - /** - * Sets [Builder.token] to an arbitrary JSON value. - * - * You should usually call [Builder.token] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun token(token: JsonField) = apply { this.token = token } - - /** The token for the account associated with this transaction. */ - fun accountToken(accountToken: String) = accountToken(JsonField.of(accountToken)) - - /** - * Sets [Builder.accountToken] to an arbitrary JSON value. - * - * You should usually call [Builder.accountToken] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun accountToken(accountToken: JsonField) = apply { - this.accountToken = accountToken - } - - /** - * Fee assessed by the merchant and paid for by the cardholder in the smallest unit of - * the currency. Will be zero if no fee is assessed. Rebates may be transmitted as a - * negative value to indicate credited fees. - */ - fun acquirerFee(acquirerFee: Long?) = acquirerFee(JsonField.ofNullable(acquirerFee)) - - /** - * Alias for [Builder.acquirerFee]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun acquirerFee(acquirerFee: Long) = acquirerFee(acquirerFee as Long?) - - /** Alias for calling [Builder.acquirerFee] with `acquirerFee.orElse(null)`. */ - fun acquirerFee(acquirerFee: Optional) = acquirerFee(acquirerFee.getOrNull()) - - /** - * Sets [Builder.acquirerFee] to an arbitrary JSON value. - * - * You should usually call [Builder.acquirerFee] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun acquirerFee(acquirerFee: JsonField) = apply { this.acquirerFee = acquirerFee } - - /** - * Unique identifier assigned to a transaction by the acquirer that can be used in - * dispute and chargeback filing. This field has been deprecated in favor of the - * `acquirer_reference_number` that resides in the event-level `network_info`. - */ - @Deprecated("deprecated") - fun acquirerReferenceNumber(acquirerReferenceNumber: String?) = - acquirerReferenceNumber(JsonField.ofNullable(acquirerReferenceNumber)) - - /** - * Alias for calling [Builder.acquirerReferenceNumber] with - * `acquirerReferenceNumber.orElse(null)`. - */ - @Deprecated("deprecated") - fun acquirerReferenceNumber(acquirerReferenceNumber: Optional) = - acquirerReferenceNumber(acquirerReferenceNumber.getOrNull()) - - /** - * Sets [Builder.acquirerReferenceNumber] to an arbitrary JSON value. - * - * You should usually call [Builder.acquirerReferenceNumber] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - @Deprecated("deprecated") - fun acquirerReferenceNumber(acquirerReferenceNumber: JsonField) = apply { - this.acquirerReferenceNumber = acquirerReferenceNumber - } - - /** - * When the transaction is pending, this represents the authorization amount of the - * transaction in the anticipated settlement currency. Once the transaction has settled, - * this field represents the settled amount in the settlement currency. - */ - @Deprecated("deprecated") 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. - */ - @Deprecated("deprecated") - fun amount(amount: JsonField) = apply { this.amount = amount } - - fun amounts(amounts: Transaction.TransactionAmounts) = amounts(JsonField.of(amounts)) - - /** - * Sets [Builder.amounts] to an arbitrary JSON value. - * - * You should usually call [Builder.amounts] with a well-typed - * [Transaction.TransactionAmounts] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. - */ - fun amounts(amounts: JsonField) = apply { - this.amounts = amounts - } - - /** - * The authorization amount of the transaction in the anticipated settlement currency. - */ - @Deprecated("deprecated") - fun authorizationAmount(authorizationAmount: Long?) = - authorizationAmount(JsonField.ofNullable(authorizationAmount)) - - /** - * Alias for [Builder.authorizationAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - @Deprecated("deprecated") - fun authorizationAmount(authorizationAmount: Long) = - authorizationAmount(authorizationAmount as Long?) - - /** - * Alias for calling [Builder.authorizationAmount] with - * `authorizationAmount.orElse(null)`. - */ - @Deprecated("deprecated") - fun authorizationAmount(authorizationAmount: Optional) = - authorizationAmount(authorizationAmount.getOrNull()) - - /** - * Sets [Builder.authorizationAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.authorizationAmount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - @Deprecated("deprecated") - fun authorizationAmount(authorizationAmount: JsonField) = apply { - this.authorizationAmount = authorizationAmount - } - - /** - * A fixed-width 6-digit numeric identifier that can be used to identify a transaction - * with networks. - */ - fun authorizationCode(authorizationCode: String?) = - authorizationCode(JsonField.ofNullable(authorizationCode)) - - /** - * Alias for calling [Builder.authorizationCode] with `authorizationCode.orElse(null)`. - */ - fun authorizationCode(authorizationCode: Optional) = - authorizationCode(authorizationCode.getOrNull()) - - /** - * Sets [Builder.authorizationCode] to an arbitrary JSON value. - * - * You should usually call [Builder.authorizationCode] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun authorizationCode(authorizationCode: JsonField) = apply { - this.authorizationCode = authorizationCode - } - - fun avs(avs: Transaction.Avs?) = avs(JsonField.ofNullable(avs)) - - /** Alias for calling [Builder.avs] with `avs.orElse(null)`. */ - fun avs(avs: Optional) = avs(avs.getOrNull()) - - /** - * Sets [Builder.avs] to an arbitrary JSON value. - * - * You should usually call [Builder.avs] with a well-typed [Transaction.Avs] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun avs(avs: JsonField) = apply { this.avs = avs } - - /** Token for the card used in this transaction. */ - fun cardToken(cardToken: String) = cardToken(JsonField.of(cardToken)) - - /** - * Sets [Builder.cardToken] to an arbitrary JSON value. - * - * You should usually call [Builder.cardToken] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun cardToken(cardToken: JsonField) = apply { this.cardToken = cardToken } - - fun cardholderAuthentication( - cardholderAuthentication: Transaction.CardholderAuthentication? - ) = cardholderAuthentication(JsonField.ofNullable(cardholderAuthentication)) - - /** - * Alias for calling [Builder.cardholderAuthentication] with - * `cardholderAuthentication.orElse(null)`. - */ - fun cardholderAuthentication( - cardholderAuthentication: Optional - ) = cardholderAuthentication(cardholderAuthentication.getOrNull()) - - /** - * Sets [Builder.cardholderAuthentication] to an arbitrary JSON value. - * - * You should usually call [Builder.cardholderAuthentication] with a well-typed - * [Transaction.CardholderAuthentication] value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. - */ - fun cardholderAuthentication( - cardholderAuthentication: JsonField - ) = apply { this.cardholderAuthentication = cardholderAuthentication } - - /** Date and time when the transaction first occurred. UTC time zone. */ - fun created(created: OffsetDateTime) = created(JsonField.of(created)) - - /** - * Sets [Builder.created] to an arbitrary JSON value. - * - * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun created(created: JsonField) = apply { this.created = created } - - fun financialAccountToken(financialAccountToken: String?) = - financialAccountToken(JsonField.ofNullable(financialAccountToken)) - - /** - * Alias for calling [Builder.financialAccountToken] with - * `financialAccountToken.orElse(null)`. - */ - fun financialAccountToken(financialAccountToken: Optional) = - financialAccountToken(financialAccountToken.getOrNull()) - - /** - * Sets [Builder.financialAccountToken] to an arbitrary JSON value. - * - * You should usually call [Builder.financialAccountToken] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun financialAccountToken(financialAccountToken: JsonField) = apply { - this.financialAccountToken = financialAccountToken - } - - fun merchant(merchant: Transaction.Merchant) = merchant(JsonField.of(merchant)) - - /** - * Sets [Builder.merchant] to an arbitrary JSON value. - * - * You should usually call [Builder.merchant] with a well-typed [Transaction.Merchant] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun merchant(merchant: JsonField) = apply { - this.merchant = merchant - } - - /** Analogous to the 'amount', but in the merchant currency. */ - @Deprecated("deprecated") - fun merchantAmount(merchantAmount: Long?) = - merchantAmount(JsonField.ofNullable(merchantAmount)) - - /** - * Alias for [Builder.merchantAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - @Deprecated("deprecated") - fun merchantAmount(merchantAmount: Long) = merchantAmount(merchantAmount as Long?) - - /** Alias for calling [Builder.merchantAmount] with `merchantAmount.orElse(null)`. */ - @Deprecated("deprecated") - fun merchantAmount(merchantAmount: Optional) = - merchantAmount(merchantAmount.getOrNull()) - - /** - * Sets [Builder.merchantAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.merchantAmount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - @Deprecated("deprecated") - fun merchantAmount(merchantAmount: JsonField) = apply { - this.merchantAmount = merchantAmount - } - - /** Analogous to the 'authorization_amount', but in the merchant currency. */ - @Deprecated("deprecated") - fun merchantAuthorizationAmount(merchantAuthorizationAmount: Long?) = - merchantAuthorizationAmount(JsonField.ofNullable(merchantAuthorizationAmount)) - - /** - * Alias for [Builder.merchantAuthorizationAmount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - @Deprecated("deprecated") - fun merchantAuthorizationAmount(merchantAuthorizationAmount: Long) = - merchantAuthorizationAmount(merchantAuthorizationAmount as Long?) - - /** - * Alias for calling [Builder.merchantAuthorizationAmount] with - * `merchantAuthorizationAmount.orElse(null)`. - */ - @Deprecated("deprecated") - fun merchantAuthorizationAmount(merchantAuthorizationAmount: Optional) = - merchantAuthorizationAmount(merchantAuthorizationAmount.getOrNull()) - - /** - * Sets [Builder.merchantAuthorizationAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.merchantAuthorizationAmount] with a well-typed - * [Long] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - @Deprecated("deprecated") - fun merchantAuthorizationAmount(merchantAuthorizationAmount: JsonField) = apply { - this.merchantAuthorizationAmount = merchantAuthorizationAmount - } - - /** 3-character alphabetic ISO 4217 code for the local currency of the transaction. */ - @Deprecated("deprecated") - fun merchantCurrency(merchantCurrency: String) = - merchantCurrency(JsonField.of(merchantCurrency)) - - /** - * Sets [Builder.merchantCurrency] to an arbitrary JSON value. - * - * You should usually call [Builder.merchantCurrency] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - @Deprecated("deprecated") - fun merchantCurrency(merchantCurrency: JsonField) = apply { - this.merchantCurrency = merchantCurrency - } - - /** - * Card network of the authorization. Value is `UNKNOWN` when Lithic cannot determine - * the network code from the upstream provider. - */ - fun network(network: Transaction.Network?) = network(JsonField.ofNullable(network)) - - /** Alias for calling [Builder.network] with `network.orElse(null)`. */ - fun network(network: Optional) = network(network.getOrNull()) - - /** - * Sets [Builder.network] to an arbitrary JSON value. - * - * You should usually call [Builder.network] with a well-typed [Transaction.Network] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun network(network: JsonField) = apply { this.network = network } - - /** - * Network-provided score assessing risk level associated with a given authorization. - * Scores are on a range of 0-999, with 0 representing the lowest risk and 999 - * representing the highest risk. For Visa transactions, where the raw score has a range - * of 0-99, Lithic will normalize the score by multiplying the raw score by 10x. - */ - 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 - } - - fun pos(pos: Transaction.Pos) = pos(JsonField.of(pos)) - - /** - * Sets [Builder.pos] to an arbitrary JSON value. - * - * You should usually call [Builder.pos] with a well-typed [Transaction.Pos] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun pos(pos: JsonField) = apply { this.pos = pos } - - fun result(result: Transaction.DeclineResult) = result(JsonField.of(result)) - - /** - * Sets [Builder.result] to an arbitrary JSON value. - * - * You should usually call [Builder.result] with a well-typed - * [Transaction.DeclineResult] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun result(result: JsonField) = apply { - this.result = result - } - - /** The settled amount of the transaction in the settlement currency. */ - @Deprecated("deprecated") - fun settledAmount(settledAmount: Long) = settledAmount(JsonField.of(settledAmount)) - - /** - * Sets [Builder.settledAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.settledAmount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - @Deprecated("deprecated") - fun settledAmount(settledAmount: JsonField) = apply { - this.settledAmount = settledAmount - } - - /** Status of the transaction. */ - fun status(status: Transaction.Status) = status(JsonField.of(status)) - - /** - * Sets [Builder.status] to an arbitrary JSON value. - * - * You should usually call [Builder.status] with a well-typed [Transaction.Status] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun status(status: JsonField) = apply { this.status = status } - - fun tokenInfo(tokenInfo: Transaction.TokenInfo?) = - tokenInfo(JsonField.ofNullable(tokenInfo)) - - /** Alias for calling [Builder.tokenInfo] with `tokenInfo.orElse(null)`. */ - fun tokenInfo(tokenInfo: Optional) = - tokenInfo(tokenInfo.getOrNull()) - - /** - * Sets [Builder.tokenInfo] to an arbitrary JSON value. - * - * You should usually call [Builder.tokenInfo] with a well-typed [Transaction.TokenInfo] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun tokenInfo(tokenInfo: JsonField) = apply { - this.tokenInfo = tokenInfo - } - - /** Date and time when the transaction last updated. UTC time zone. */ - fun updated(updated: OffsetDateTime) = updated(JsonField.of(updated)) - - /** - * Sets [Builder.updated] to an arbitrary JSON value. - * - * You should usually call [Builder.updated] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun updated(updated: JsonField) = apply { this.updated = updated } - - fun events(events: List) = events(JsonField.of(events)) - - /** - * Sets [Builder.events] to an arbitrary JSON value. - * - * You should usually call [Builder.events] with a well-typed - * `List` value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. - */ - fun events(events: JsonField>) = apply { - this.events = events.map { it.toMutableList() } - } - - /** - * Adds a single [Transaction.TransactionEvent] to [events]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addEvent(event: Transaction.TransactionEvent) = apply { - events = - (events ?: JsonField.of(mutableListOf())).also { - checkKnown("events", it).add(event) - } - } - - fun family(family: TransactionFamilyTypes) = family(JsonField.of(family)) - - /** - * Sets [Builder.family] to an arbitrary JSON value. - * - * You should usually call [Builder.family] with a well-typed [TransactionFamilyTypes] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun family(family: JsonField) = apply { this.family = family } - - 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 [CardTransaction]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .token() - * .accountToken() - * .acquirerFee() - * .acquirerReferenceNumber() - * .amount() - * .amounts() - * .authorizationAmount() - * .authorizationCode() - * .avs() - * .cardToken() - * .cardholderAuthentication() - * .created() - * .financialAccountToken() - * .merchant() - * .merchantAmount() - * .merchantAuthorizationAmount() - * .merchantCurrency() - * .network() - * .networkRiskScore() - * .pos() - * .result() - * .settledAmount() - * .status() - * .tokenInfo() - * .updated() - * .family() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CardTransaction = - CardTransaction( - checkRequired("token", token), - checkRequired("accountToken", accountToken), - checkRequired("acquirerFee", acquirerFee), - checkRequired("acquirerReferenceNumber", acquirerReferenceNumber), - checkRequired("amount", amount), - checkRequired("amounts", amounts), - checkRequired("authorizationAmount", authorizationAmount), - checkRequired("authorizationCode", authorizationCode), - checkRequired("avs", avs), - checkRequired("cardToken", cardToken), - checkRequired("cardholderAuthentication", cardholderAuthentication), - checkRequired("created", created), - checkRequired("financialAccountToken", financialAccountToken), - checkRequired("merchant", merchant), - checkRequired("merchantAmount", merchantAmount), - checkRequired("merchantAuthorizationAmount", merchantAuthorizationAmount), - checkRequired("merchantCurrency", merchantCurrency), - checkRequired("network", network), - checkRequired("networkRiskScore", networkRiskScore), - checkRequired("pos", pos), - checkRequired("result", result), - checkRequired("settledAmount", settledAmount), - checkRequired("status", status), - checkRequired("tokenInfo", tokenInfo), - checkRequired("updated", updated), - (events ?: JsonMissing.of()).map { it.toImmutable() }, - checkRequired("family", family), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): CardTransaction = apply { - if (validated) { - return@apply - } - - token() - accountToken() - acquirerFee() - acquirerReferenceNumber() - amount() - amounts().validate() - authorizationAmount() - authorizationCode() - avs().ifPresent { it.validate() } - cardToken() - cardholderAuthentication().ifPresent { it.validate() } - created() - financialAccountToken() - merchant().validate() - merchantAmount() - merchantAuthorizationAmount() - merchantCurrency() - network().ifPresent { it.validate() } - networkRiskScore() - pos().validate() - result().validate() - settledAmount() - status().validate() - tokenInfo().ifPresent { it.validate() } - updated() - events().ifPresent { it.forEach { it.validate() } } - family().validate() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 (token.asKnown().isPresent) 1 else 0) + - (if (accountToken.asKnown().isPresent) 1 else 0) + - (if (acquirerFee.asKnown().isPresent) 1 else 0) + - (if (acquirerReferenceNumber.asKnown().isPresent) 1 else 0) + - (if (amount.asKnown().isPresent) 1 else 0) + - (amounts.asKnown().getOrNull()?.validity() ?: 0) + - (if (authorizationAmount.asKnown().isPresent) 1 else 0) + - (if (authorizationCode.asKnown().isPresent) 1 else 0) + - (avs.asKnown().getOrNull()?.validity() ?: 0) + - (if (cardToken.asKnown().isPresent) 1 else 0) + - (cardholderAuthentication.asKnown().getOrNull()?.validity() ?: 0) + - (if (created.asKnown().isPresent) 1 else 0) + - (if (financialAccountToken.asKnown().isPresent) 1 else 0) + - (merchant.asKnown().getOrNull()?.validity() ?: 0) + - (if (merchantAmount.asKnown().isPresent) 1 else 0) + - (if (merchantAuthorizationAmount.asKnown().isPresent) 1 else 0) + - (if (merchantCurrency.asKnown().isPresent) 1 else 0) + - (network.asKnown().getOrNull()?.validity() ?: 0) + - (if (networkRiskScore.asKnown().isPresent) 1 else 0) + - (pos.asKnown().getOrNull()?.validity() ?: 0) + - (result.asKnown().getOrNull()?.validity() ?: 0) + - (if (settledAmount.asKnown().isPresent) 1 else 0) + - (status.asKnown().getOrNull()?.validity() ?: 0) + - (tokenInfo.asKnown().getOrNull()?.validity() ?: 0) + - (if (updated.asKnown().isPresent) 1 else 0) + - (events.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (family.asKnown().getOrNull()?.validity() ?: 0) - - class TransactionFamilyTypes - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CARD = of("CARD") - - @JvmField val PAYMENT = of("PAYMENT") - - @JvmField val TRANSFER = of("TRANSFER") - - @JvmField val INTERNAL = of("INTERNAL") - - @JvmField val EXTERNAL_PAYMENT = of("EXTERNAL_PAYMENT") - - @JvmField val MANAGEMENT_OPERATION = of("MANAGEMENT_OPERATION") - - @JvmStatic fun of(value: String) = TransactionFamilyTypes(JsonField.of(value)) - } - - /** An enum containing [TransactionFamilyTypes]'s known values. */ - enum class Known { - CARD, - PAYMENT, - TRANSFER, - INTERNAL, - EXTERNAL_PAYMENT, - MANAGEMENT_OPERATION, - } - - /** - * An enum containing [TransactionFamilyTypes]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [TransactionFamilyTypes] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CARD, - PAYMENT, - TRANSFER, - INTERNAL, - EXTERNAL_PAYMENT, - MANAGEMENT_OPERATION, - /** - * An enum member indicating that [TransactionFamilyTypes] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CARD -> Value.CARD - PAYMENT -> Value.PAYMENT - TRANSFER -> Value.TRANSFER - INTERNAL -> Value.INTERNAL - EXTERNAL_PAYMENT -> Value.EXTERNAL_PAYMENT - MANAGEMENT_OPERATION -> Value.MANAGEMENT_OPERATION - 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 LithicInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - CARD -> Known.CARD - PAYMENT -> Known.PAYMENT - TRANSFER -> Known.TRANSFER - INTERNAL -> Known.INTERNAL - EXTERNAL_PAYMENT -> Known.EXTERNAL_PAYMENT - MANAGEMENT_OPERATION -> Known.MANAGEMENT_OPERATION - else -> - throw LithicInvalidDataException("Unknown TransactionFamilyTypes: $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 LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): TransactionFamilyTypes = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 TransactionFamilyTypes && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The status of the transaction */ - class TransactionStatus - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val PENDING = of("PENDING") - - @JvmField val SETTLED = of("SETTLED") - - @JvmField val DECLINED = of("DECLINED") - - @JvmField val REVERSED = of("REVERSED") - - @JvmField val CANCELED = of("CANCELED") - - @JvmStatic fun of(value: String) = TransactionStatus(JsonField.of(value)) - } - - /** An enum containing [TransactionStatus]'s known values. */ - enum class Known { - PENDING, - SETTLED, - DECLINED, - REVERSED, - CANCELED, - } - - /** - * An enum containing [TransactionStatus]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [TransactionStatus] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then 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 { - PENDING, - SETTLED, - DECLINED, - REVERSED, - CANCELED, - /** - * An enum member indicating that [TransactionStatus] 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) { - PENDING -> Value.PENDING - SETTLED -> Value.SETTLED - DECLINED -> Value.DECLINED - REVERSED -> Value.REVERSED - CANCELED -> Value.CANCELED - 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 LithicInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - PENDING -> Known.PENDING - SETTLED -> Known.SETTLED - DECLINED -> Known.DECLINED - REVERSED -> Known.REVERSED - CANCELED -> Known.CANCELED - else -> throw LithicInvalidDataException("Unknown TransactionStatus: $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 LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): TransactionStatus = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 TransactionStatus && 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 CardTransaction && - token == other.token && - accountToken == other.accountToken && - acquirerFee == other.acquirerFee && - acquirerReferenceNumber == other.acquirerReferenceNumber && - amount == other.amount && - amounts == other.amounts && - authorizationAmount == other.authorizationAmount && - authorizationCode == other.authorizationCode && - avs == other.avs && - cardToken == other.cardToken && - cardholderAuthentication == other.cardholderAuthentication && - created == other.created && - financialAccountToken == other.financialAccountToken && - merchant == other.merchant && - merchantAmount == other.merchantAmount && - merchantAuthorizationAmount == other.merchantAuthorizationAmount && - merchantCurrency == other.merchantCurrency && - network == other.network && - networkRiskScore == other.networkRiskScore && - pos == other.pos && - result == other.result && - settledAmount == other.settledAmount && - status == other.status && - tokenInfo == other.tokenInfo && - updated == other.updated && - events == other.events && - family == other.family && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - token, - accountToken, - acquirerFee, - acquirerReferenceNumber, - amount, - amounts, - authorizationAmount, - authorizationCode, - avs, - cardToken, - cardholderAuthentication, - created, - financialAccountToken, - merchant, - merchantAmount, - merchantAuthorizationAmount, - merchantCurrency, - network, - networkRiskScore, - pos, - result, - settledAmount, - status, - tokenInfo, - updated, - events, - family, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "CardTransaction{token=$token, accountToken=$accountToken, acquirerFee=$acquirerFee, acquirerReferenceNumber=$acquirerReferenceNumber, amount=$amount, amounts=$amounts, authorizationAmount=$authorizationAmount, authorizationCode=$authorizationCode, avs=$avs, cardToken=$cardToken, cardholderAuthentication=$cardholderAuthentication, created=$created, financialAccountToken=$financialAccountToken, merchant=$merchant, merchantAmount=$merchantAmount, merchantAuthorizationAmount=$merchantAuthorizationAmount, merchantCurrency=$merchantCurrency, network=$network, networkRiskScore=$networkRiskScore, pos=$pos, result=$result, settledAmount=$settledAmount, status=$status, tokenInfo=$tokenInfo, updated=$updated, events=$events, family=$family, additionalProperties=$additionalProperties}" - } - - /** Payment transaction */ - class PaymentTransaction - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val token: JsonField, - private val category: JsonField, - private val created: JsonField, - private val descriptor: JsonField, - private val direction: JsonField, - private val events: JsonField>, - private val family: JsonField, - private val financialAccountToken: JsonField, - private val method: JsonField, - private val methodAttributes: JsonField, - private val pendingAmount: JsonField, - private val relatedAccountTokens: JsonField, - private val result: JsonField, - private val settledAmount: JsonField, - private val source: JsonField, - private val status: JsonField, - private val updated: JsonField, - private val currency: JsonField, - private val expectedReleaseDate: JsonField, - private val externalBankAccountToken: JsonField, - private val type: JsonField, - private val userDefinedId: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), - @JsonProperty("category") - @ExcludeMissing - category: JsonField = JsonMissing.of(), - @JsonProperty("created") - @ExcludeMissing - created: JsonField = JsonMissing.of(), - @JsonProperty("descriptor") - @ExcludeMissing - descriptor: JsonField = JsonMissing.of(), - @JsonProperty("direction") - @ExcludeMissing - direction: JsonField = JsonMissing.of(), - @JsonProperty("events") - @ExcludeMissing - events: JsonField> = JsonMissing.of(), - @JsonProperty("family") - @ExcludeMissing - family: JsonField = JsonMissing.of(), - @JsonProperty("financial_account_token") - @ExcludeMissing - financialAccountToken: JsonField = JsonMissing.of(), - @JsonProperty("method") @ExcludeMissing method: JsonField = JsonMissing.of(), - @JsonProperty("method_attributes") - @ExcludeMissing - methodAttributes: JsonField = JsonMissing.of(), - @JsonProperty("pending_amount") - @ExcludeMissing - pendingAmount: JsonField = JsonMissing.of(), - @JsonProperty("related_account_tokens") - @ExcludeMissing - relatedAccountTokens: JsonField = JsonMissing.of(), - @JsonProperty("result") - @ExcludeMissing - result: JsonField = JsonMissing.of(), - @JsonProperty("settled_amount") - @ExcludeMissing - settledAmount: JsonField = JsonMissing.of(), - @JsonProperty("source") @ExcludeMissing source: JsonField = JsonMissing.of(), - @JsonProperty("status") - @ExcludeMissing - status: JsonField = JsonMissing.of(), - @JsonProperty("updated") - @ExcludeMissing - updated: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - currency: JsonField = JsonMissing.of(), - @JsonProperty("expected_release_date") - @ExcludeMissing - expectedReleaseDate: JsonField = JsonMissing.of(), - @JsonProperty("external_bank_account_token") - @ExcludeMissing - externalBankAccountToken: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - @JsonProperty("user_defined_id") - @ExcludeMissing - userDefinedId: JsonField = JsonMissing.of(), - ) : this( - token, - category, - created, - descriptor, - direction, - events, - family, - financialAccountToken, - method, - methodAttributes, - pendingAmount, - relatedAccountTokens, - result, - settledAmount, - source, - status, - updated, - currency, - expectedReleaseDate, - externalBankAccountToken, - type, - userDefinedId, - mutableMapOf(), - ) - - /** - * Unique identifier for the transaction - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun token(): String = token.getRequired("token") - - /** - * Transaction category - * - * @throws LithicInvalidDataException if 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(): TransactionCategory = category.getRequired("category") - - /** - * ISO 8601 timestamp of when the transaction was created - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun created(): OffsetDateTime = created.getRequired("created") - - /** - * Transaction descriptor - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun descriptor(): String = descriptor.getRequired("descriptor") - - /** - * Transfer direction - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun direction(): Direction = direction.getRequired("direction") - - /** - * List of transaction events - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun events(): List = events.getRequired("events") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun family(): TransactionFamilyTypes = family.getRequired("family") - - /** - * Financial account token - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun financialAccountToken(): String = - financialAccountToken.getRequired("financial_account_token") - - /** - * Transfer method - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun method(): Method = method.getRequired("method") - - /** - * Method-specific attributes - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun methodAttributes(): MethodAttributes = methodAttributes.getRequired("method_attributes") - - /** - * Pending amount in cents - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun pendingAmount(): Long = pendingAmount.getRequired("pending_amount") - - /** - * Related account tokens for the transaction - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun relatedAccountTokens(): RelatedAccountTokens = - relatedAccountTokens.getRequired("related_account_tokens") - - /** - * Transaction result - * - * @throws LithicInvalidDataException if 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(): TransactionResult = result.getRequired("result") - - /** - * Settled amount in cents - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun settledAmount(): Long = settledAmount.getRequired("settled_amount") - - /** - * Transaction source - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun source(): Source = source.getRequired("source") - - /** - * The status of the transaction - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun status(): TransactionStatus = status.getRequired("status") - - /** - * ISO 8601 timestamp of when the transaction was last updated - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun updated(): OffsetDateTime = updated.getRequired("updated") - - /** - * Currency of the transaction in ISO 4217 format - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun currency(): Optional = currency.getOptional("currency") - - /** - * Expected release date for the transaction - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun expectedReleaseDate(): Optional = - expectedReleaseDate.getOptional("expected_release_date") - - /** - * External bank account token - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun externalBankAccountToken(): Optional = - externalBankAccountToken.getOptional("external_bank_account_token") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun type(): Optional = type.getOptional("type") - - /** - * User-defined identifier - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun userDefinedId(): Optional = userDefinedId.getOptional("user_defined_id") - - /** - * Returns the raw JSON value of [token]. - * - * Unlike [token], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("token") @ExcludeMissing fun _token(): JsonField = token - - /** - * 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 [created]. - * - * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created - - /** - * Returns the raw JSON value of [descriptor]. - * - * Unlike [descriptor], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("descriptor") - @ExcludeMissing - fun _descriptor(): JsonField = descriptor - - /** - * Returns the raw JSON value of [direction]. - * - * Unlike [direction], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("direction") - @ExcludeMissing - fun _direction(): JsonField = direction - - /** - * Returns the raw JSON value of [events]. - * - * Unlike [events], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("events") - @ExcludeMissing - fun _events(): JsonField> = events - - /** - * Returns the raw JSON value of [family]. - * - * Unlike [family], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("family") - @ExcludeMissing - fun _family(): JsonField = family - - /** - * Returns the raw JSON value of [financialAccountToken]. - * - * Unlike [financialAccountToken], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("financial_account_token") - @ExcludeMissing - fun _financialAccountToken(): JsonField = financialAccountToken - - /** - * Returns the raw JSON value of [method]. - * - * Unlike [method], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("method") @ExcludeMissing fun _method(): JsonField = method - - /** - * Returns the raw JSON value of [methodAttributes]. - * - * Unlike [methodAttributes], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("method_attributes") - @ExcludeMissing - fun _methodAttributes(): JsonField = methodAttributes - - /** - * Returns the raw JSON value of [pendingAmount]. - * - * Unlike [pendingAmount], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("pending_amount") - @ExcludeMissing - fun _pendingAmount(): JsonField = pendingAmount - - /** - * Returns the raw JSON value of [relatedAccountTokens]. - * - * Unlike [relatedAccountTokens], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("related_account_tokens") - @ExcludeMissing - fun _relatedAccountTokens(): JsonField = relatedAccountTokens - - /** - * 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 - - /** - * Returns the raw JSON value of [settledAmount]. - * - * Unlike [settledAmount], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("settled_amount") - @ExcludeMissing - fun _settledAmount(): JsonField = settledAmount - - /** - * Returns the raw JSON value of [source]. - * - * Unlike [source], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("source") @ExcludeMissing fun _source(): JsonField = source - - /** - * Returns the raw JSON value of [status]. - * - * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status - - /** - * Returns the raw JSON value of [updated]. - * - * Unlike [updated], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("updated") @ExcludeMissing fun _updated(): JsonField = updated - - /** - * Returns the raw JSON value of [currency]. - * - * Unlike [currency], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** - * Returns the raw JSON value of [expectedReleaseDate]. - * - * Unlike [expectedReleaseDate], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("expected_release_date") - @ExcludeMissing - fun _expectedReleaseDate(): JsonField = expectedReleaseDate - - /** - * Returns the raw JSON value of [externalBankAccountToken]. - * - * Unlike [externalBankAccountToken], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("external_bank_account_token") - @ExcludeMissing - fun _externalBankAccountToken(): JsonField = externalBankAccountToken - - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - - /** - * Returns the raw JSON value of [userDefinedId]. - * - * Unlike [userDefinedId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("user_defined_id") - @ExcludeMissing - fun _userDefinedId(): JsonField = userDefinedId - - @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 [PaymentTransaction]. - * - * The following fields are required: - * ```java - * .token() - * .category() - * .created() - * .descriptor() - * .direction() - * .events() - * .family() - * .financialAccountToken() - * .method() - * .methodAttributes() - * .pendingAmount() - * .relatedAccountTokens() - * .result() - * .settledAmount() - * .source() - * .status() - * .updated() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [PaymentTransaction]. */ - class Builder internal constructor() { - - private var token: JsonField? = null - private var category: JsonField? = null - private var created: JsonField? = null - private var descriptor: JsonField? = null - private var direction: JsonField? = null - private var events: JsonField>? = null - private var family: JsonField? = null - private var financialAccountToken: JsonField? = null - private var method: JsonField? = null - private var methodAttributes: JsonField? = null - private var pendingAmount: JsonField? = null - private var relatedAccountTokens: JsonField? = null - private var result: JsonField? = null - private var settledAmount: JsonField? = null - private var source: JsonField? = null - private var status: JsonField? = null - private var updated: JsonField? = null - private var currency: JsonField = JsonMissing.of() - private var expectedReleaseDate: JsonField = JsonMissing.of() - private var externalBankAccountToken: JsonField = JsonMissing.of() - private var type: JsonField = JsonMissing.of() - private var userDefinedId: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(paymentTransaction: PaymentTransaction) = apply { - token = paymentTransaction.token - category = paymentTransaction.category - created = paymentTransaction.created - descriptor = paymentTransaction.descriptor - direction = paymentTransaction.direction - events = paymentTransaction.events.map { it.toMutableList() } - family = paymentTransaction.family - financialAccountToken = paymentTransaction.financialAccountToken - method = paymentTransaction.method - methodAttributes = paymentTransaction.methodAttributes - pendingAmount = paymentTransaction.pendingAmount - relatedAccountTokens = paymentTransaction.relatedAccountTokens - result = paymentTransaction.result - settledAmount = paymentTransaction.settledAmount - source = paymentTransaction.source - status = paymentTransaction.status - updated = paymentTransaction.updated - currency = paymentTransaction.currency - expectedReleaseDate = paymentTransaction.expectedReleaseDate - externalBankAccountToken = paymentTransaction.externalBankAccountToken - type = paymentTransaction.type - userDefinedId = paymentTransaction.userDefinedId - additionalProperties = paymentTransaction.additionalProperties.toMutableMap() - } - - /** Unique identifier for the transaction */ - fun token(token: String) = token(JsonField.of(token)) - - /** - * Sets [Builder.token] to an arbitrary JSON value. - * - * You should usually call [Builder.token] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun token(token: JsonField) = apply { this.token = token } - - /** Transaction category */ - fun category(category: TransactionCategory) = category(JsonField.of(category)) - - /** - * Sets [Builder.category] to an arbitrary JSON value. - * - * You should usually call [Builder.category] with a well-typed [TransactionCategory] - * 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 - } - - /** ISO 8601 timestamp of when the transaction was created */ - fun created(created: OffsetDateTime) = created(JsonField.of(created)) - - /** - * Sets [Builder.created] to an arbitrary JSON value. - * - * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun created(created: JsonField) = apply { this.created = created } - - /** Transaction descriptor */ - fun descriptor(descriptor: String) = descriptor(JsonField.of(descriptor)) - - /** - * Sets [Builder.descriptor] to an arbitrary JSON value. - * - * You should usually call [Builder.descriptor] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun descriptor(descriptor: JsonField) = apply { this.descriptor = descriptor } - - /** Transfer direction */ - fun direction(direction: Direction) = direction(JsonField.of(direction)) - - /** - * Sets [Builder.direction] to an arbitrary JSON value. - * - * You should usually call [Builder.direction] with a well-typed [Direction] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun direction(direction: JsonField) = apply { this.direction = direction } - - /** List of transaction events */ - fun events(events: List) = events(JsonField.of(events)) - - /** - * Sets [Builder.events] to an arbitrary JSON value. - * - * You should usually call [Builder.events] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun events(events: JsonField>) = apply { - this.events = events.map { it.toMutableList() } - } - - /** - * Adds a single [PaymentEvent] to [events]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addEvent(event: PaymentEvent) = apply { - events = - (events ?: JsonField.of(mutableListOf())).also { - checkKnown("events", it).add(event) - } - } - - fun family(family: TransactionFamilyTypes) = family(JsonField.of(family)) - - /** - * Sets [Builder.family] to an arbitrary JSON value. - * - * You should usually call [Builder.family] with a well-typed [TransactionFamilyTypes] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun family(family: JsonField) = apply { this.family = family } - - /** Financial account token */ - fun financialAccountToken(financialAccountToken: String) = - financialAccountToken(JsonField.of(financialAccountToken)) - - /** - * Sets [Builder.financialAccountToken] to an arbitrary JSON value. - * - * You should usually call [Builder.financialAccountToken] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun financialAccountToken(financialAccountToken: JsonField) = apply { - this.financialAccountToken = financialAccountToken - } - - /** Transfer method */ - fun method(method: Method) = method(JsonField.of(method)) - - /** - * Sets [Builder.method] to an arbitrary JSON value. - * - * You should usually call [Builder.method] with a well-typed [Method] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun method(method: JsonField) = apply { this.method = method } - - /** Method-specific attributes */ - fun methodAttributes(methodAttributes: MethodAttributes) = - methodAttributes(JsonField.of(methodAttributes)) - - /** - * Sets [Builder.methodAttributes] to an arbitrary JSON value. - * - * You should usually call [Builder.methodAttributes] with a well-typed - * [MethodAttributes] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun methodAttributes(methodAttributes: JsonField) = apply { - this.methodAttributes = methodAttributes - } - - /** Alias for calling [methodAttributes] with `MethodAttributes.ofAch(ach)`. */ - fun methodAttributes(ach: MethodAttributes.AchMethodAttributes) = - methodAttributes(MethodAttributes.ofAch(ach)) - - /** Alias for calling [methodAttributes] with `MethodAttributes.ofWire(wire)`. */ - fun methodAttributes(wire: MethodAttributes.WireMethodAttributes) = - methodAttributes(MethodAttributes.ofWire(wire)) - - /** Pending amount in cents */ - fun pendingAmount(pendingAmount: Long) = pendingAmount(JsonField.of(pendingAmount)) - - /** - * Sets [Builder.pendingAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.pendingAmount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun pendingAmount(pendingAmount: JsonField) = apply { - this.pendingAmount = pendingAmount - } - - /** Related account tokens for the transaction */ - fun relatedAccountTokens(relatedAccountTokens: RelatedAccountTokens) = - relatedAccountTokens(JsonField.of(relatedAccountTokens)) - - /** - * Sets [Builder.relatedAccountTokens] to an arbitrary JSON value. - * - * You should usually call [Builder.relatedAccountTokens] with a well-typed - * [RelatedAccountTokens] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. - */ - fun relatedAccountTokens(relatedAccountTokens: JsonField) = - apply { - this.relatedAccountTokens = relatedAccountTokens - } - - /** Transaction result */ - fun result(result: TransactionResult) = result(JsonField.of(result)) - - /** - * Sets [Builder.result] to an arbitrary JSON value. - * - * You should usually call [Builder.result] with a well-typed [TransactionResult] 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 } - - /** Settled amount in cents */ - fun settledAmount(settledAmount: Long) = settledAmount(JsonField.of(settledAmount)) - - /** - * Sets [Builder.settledAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.settledAmount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun settledAmount(settledAmount: JsonField) = apply { - this.settledAmount = settledAmount - } - - /** Transaction source */ - fun source(source: Source) = source(JsonField.of(source)) - - /** - * Sets [Builder.source] to an arbitrary JSON value. - * - * You should usually call [Builder.source] with a well-typed [Source] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun source(source: JsonField) = apply { this.source = source } - - /** The status of the transaction */ - fun status(status: TransactionStatus) = status(JsonField.of(status)) - - /** - * Sets [Builder.status] to an arbitrary JSON value. - * - * You should usually call [Builder.status] with a well-typed [TransactionStatus] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun status(status: JsonField) = apply { this.status = status } - - /** ISO 8601 timestamp of when the transaction was last updated */ - fun updated(updated: OffsetDateTime) = updated(JsonField.of(updated)) - - /** - * Sets [Builder.updated] to an arbitrary JSON value. - * - * You should usually call [Builder.updated] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun updated(updated: JsonField) = apply { this.updated = updated } - - /** Currency of the transaction in ISO 4217 format */ - 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 } - - /** Expected release date for the transaction */ - fun expectedReleaseDate(expectedReleaseDate: LocalDate?) = - expectedReleaseDate(JsonField.ofNullable(expectedReleaseDate)) - - /** - * Alias for calling [Builder.expectedReleaseDate] with - * `expectedReleaseDate.orElse(null)`. - */ - fun expectedReleaseDate(expectedReleaseDate: Optional) = - expectedReleaseDate(expectedReleaseDate.getOrNull()) - - /** - * Sets [Builder.expectedReleaseDate] to an arbitrary JSON value. - * - * You should usually call [Builder.expectedReleaseDate] with a well-typed [LocalDate] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun expectedReleaseDate(expectedReleaseDate: JsonField) = apply { - this.expectedReleaseDate = expectedReleaseDate - } - - /** External bank account token */ - fun externalBankAccountToken(externalBankAccountToken: String?) = - externalBankAccountToken(JsonField.ofNullable(externalBankAccountToken)) - - /** - * Alias for calling [Builder.externalBankAccountToken] with - * `externalBankAccountToken.orElse(null)`. - */ - fun externalBankAccountToken(externalBankAccountToken: Optional) = - externalBankAccountToken(externalBankAccountToken.getOrNull()) - - /** - * Sets [Builder.externalBankAccountToken] to an arbitrary JSON value. - * - * You should usually call [Builder.externalBankAccountToken] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun externalBankAccountToken(externalBankAccountToken: JsonField) = apply { - this.externalBankAccountToken = externalBankAccountToken - } - - fun type(type: TransferType) = type(JsonField.of(type)) - - /** - * Sets [Builder.type] to an arbitrary JSON value. - * - * You should usually call [Builder.type] with a well-typed [TransferType] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun type(type: JsonField) = apply { this.type = type } - - /** User-defined identifier */ - fun userDefinedId(userDefinedId: String?) = - userDefinedId(JsonField.ofNullable(userDefinedId)) - - /** Alias for calling [Builder.userDefinedId] with `userDefinedId.orElse(null)`. */ - fun userDefinedId(userDefinedId: Optional) = - userDefinedId(userDefinedId.getOrNull()) - - /** - * Sets [Builder.userDefinedId] to an arbitrary JSON value. - * - * You should usually call [Builder.userDefinedId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun userDefinedId(userDefinedId: JsonField) = apply { - this.userDefinedId = userDefinedId - } - - 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 [PaymentTransaction]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .token() - * .category() - * .created() - * .descriptor() - * .direction() - * .events() - * .family() - * .financialAccountToken() - * .method() - * .methodAttributes() - * .pendingAmount() - * .relatedAccountTokens() - * .result() - * .settledAmount() - * .source() - * .status() - * .updated() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): PaymentTransaction = - PaymentTransaction( - checkRequired("token", token), - checkRequired("category", category), - checkRequired("created", created), - checkRequired("descriptor", descriptor), - checkRequired("direction", direction), - checkRequired("events", events).map { it.toImmutable() }, - checkRequired("family", family), - checkRequired("financialAccountToken", financialAccountToken), - checkRequired("method", method), - checkRequired("methodAttributes", methodAttributes), - checkRequired("pendingAmount", pendingAmount), - checkRequired("relatedAccountTokens", relatedAccountTokens), - checkRequired("result", result), - checkRequired("settledAmount", settledAmount), - checkRequired("source", source), - checkRequired("status", status), - checkRequired("updated", updated), - currency, - expectedReleaseDate, - externalBankAccountToken, - type, - userDefinedId, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): PaymentTransaction = apply { - if (validated) { - return@apply - } - - token() - category().validate() - created() - descriptor() - direction().validate() - events().forEach { it.validate() } - family().validate() - financialAccountToken() - method().validate() - methodAttributes().validate() - pendingAmount() - relatedAccountTokens().validate() - result().validate() - settledAmount() - source().validate() - status().validate() - updated() - currency() - expectedReleaseDate() - externalBankAccountToken() - type().ifPresent { it.validate() } - userDefinedId() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 (token.asKnown().isPresent) 1 else 0) + - (category.asKnown().getOrNull()?.validity() ?: 0) + - (if (created.asKnown().isPresent) 1 else 0) + - (if (descriptor.asKnown().isPresent) 1 else 0) + - (direction.asKnown().getOrNull()?.validity() ?: 0) + - (events.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (family.asKnown().getOrNull()?.validity() ?: 0) + - (if (financialAccountToken.asKnown().isPresent) 1 else 0) + - (method.asKnown().getOrNull()?.validity() ?: 0) + - (methodAttributes.asKnown().getOrNull()?.validity() ?: 0) + - (if (pendingAmount.asKnown().isPresent) 1 else 0) + - (relatedAccountTokens.asKnown().getOrNull()?.validity() ?: 0) + - (result.asKnown().getOrNull()?.validity() ?: 0) + - (if (settledAmount.asKnown().isPresent) 1 else 0) + - (source.asKnown().getOrNull()?.validity() ?: 0) + - (status.asKnown().getOrNull()?.validity() ?: 0) + - (if (updated.asKnown().isPresent) 1 else 0) + - (if (currency.asKnown().isPresent) 1 else 0) + - (if (expectedReleaseDate.asKnown().isPresent) 1 else 0) + - (if (externalBankAccountToken.asKnown().isPresent) 1 else 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) + - (if (userDefinedId.asKnown().isPresent) 1 else 0) - - /** Transaction category */ - class TransactionCategory - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ACH = of("ACH") - - @JvmField val BALANCE_OR_FUNDING = of("BALANCE_OR_FUNDING") - - @JvmField val FEE = of("FEE") - - @JvmField val REWARD = of("REWARD") - - @JvmField val ADJUSTMENT = of("ADJUSTMENT") - - @JvmField val DERECOGNITION = of("DERECOGNITION") - - @JvmField val DISPUTE = of("DISPUTE") - - @JvmField val CARD = of("CARD") - - @JvmField val EXTERNAL_ACH = of("EXTERNAL_ACH") - - @JvmField val EXTERNAL_CHECK = of("EXTERNAL_CHECK") - - @JvmField val EXTERNAL_TRANSFER = of("EXTERNAL_TRANSFER") - - @JvmField val EXTERNAL_WIRE = of("EXTERNAL_WIRE") - - @JvmField val MANAGEMENT_ADJUSTMENT = of("MANAGEMENT_ADJUSTMENT") - - @JvmField val MANAGEMENT_DISPUTE = of("MANAGEMENT_DISPUTE") - - @JvmField val MANAGEMENT_FEE = of("MANAGEMENT_FEE") - - @JvmField val MANAGEMENT_REWARD = of("MANAGEMENT_REWARD") - - @JvmField val MANAGEMENT_DISBURSEMENT = of("MANAGEMENT_DISBURSEMENT") - - @JvmField val PROGRAM_FUNDING = of("PROGRAM_FUNDING") - - @JvmStatic fun of(value: String) = TransactionCategory(JsonField.of(value)) - } - - /** An enum containing [TransactionCategory]'s known values. */ - enum class Known { - ACH, - BALANCE_OR_FUNDING, - FEE, - REWARD, - ADJUSTMENT, - DERECOGNITION, - DISPUTE, - CARD, - EXTERNAL_ACH, - EXTERNAL_CHECK, - EXTERNAL_TRANSFER, - EXTERNAL_WIRE, - MANAGEMENT_ADJUSTMENT, - MANAGEMENT_DISPUTE, - MANAGEMENT_FEE, - MANAGEMENT_REWARD, - MANAGEMENT_DISBURSEMENT, - PROGRAM_FUNDING, - } - - /** - * An enum containing [TransactionCategory]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [TransactionCategory] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then 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 { - ACH, - BALANCE_OR_FUNDING, - FEE, - REWARD, - ADJUSTMENT, - DERECOGNITION, - DISPUTE, - CARD, - EXTERNAL_ACH, - EXTERNAL_CHECK, - EXTERNAL_TRANSFER, - EXTERNAL_WIRE, - MANAGEMENT_ADJUSTMENT, - MANAGEMENT_DISPUTE, - MANAGEMENT_FEE, - MANAGEMENT_REWARD, - MANAGEMENT_DISBURSEMENT, - PROGRAM_FUNDING, - /** - * An enum member indicating that [TransactionCategory] 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) { - ACH -> Value.ACH - BALANCE_OR_FUNDING -> Value.BALANCE_OR_FUNDING - FEE -> Value.FEE - REWARD -> Value.REWARD - ADJUSTMENT -> Value.ADJUSTMENT - DERECOGNITION -> Value.DERECOGNITION - DISPUTE -> Value.DISPUTE - CARD -> Value.CARD - EXTERNAL_ACH -> Value.EXTERNAL_ACH - EXTERNAL_CHECK -> Value.EXTERNAL_CHECK - EXTERNAL_TRANSFER -> Value.EXTERNAL_TRANSFER - EXTERNAL_WIRE -> Value.EXTERNAL_WIRE - MANAGEMENT_ADJUSTMENT -> Value.MANAGEMENT_ADJUSTMENT - MANAGEMENT_DISPUTE -> Value.MANAGEMENT_DISPUTE - MANAGEMENT_FEE -> Value.MANAGEMENT_FEE - MANAGEMENT_REWARD -> Value.MANAGEMENT_REWARD - MANAGEMENT_DISBURSEMENT -> Value.MANAGEMENT_DISBURSEMENT - PROGRAM_FUNDING -> Value.PROGRAM_FUNDING - 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 LithicInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ACH -> Known.ACH - BALANCE_OR_FUNDING -> Known.BALANCE_OR_FUNDING - FEE -> Known.FEE - REWARD -> Known.REWARD - ADJUSTMENT -> Known.ADJUSTMENT - DERECOGNITION -> Known.DERECOGNITION - DISPUTE -> Known.DISPUTE - CARD -> Known.CARD - EXTERNAL_ACH -> Known.EXTERNAL_ACH - EXTERNAL_CHECK -> Known.EXTERNAL_CHECK - EXTERNAL_TRANSFER -> Known.EXTERNAL_TRANSFER - EXTERNAL_WIRE -> Known.EXTERNAL_WIRE - MANAGEMENT_ADJUSTMENT -> Known.MANAGEMENT_ADJUSTMENT - MANAGEMENT_DISPUTE -> Known.MANAGEMENT_DISPUTE - MANAGEMENT_FEE -> Known.MANAGEMENT_FEE - MANAGEMENT_REWARD -> Known.MANAGEMENT_REWARD - MANAGEMENT_DISBURSEMENT -> Known.MANAGEMENT_DISBURSEMENT - PROGRAM_FUNDING -> Known.PROGRAM_FUNDING - else -> throw LithicInvalidDataException("Unknown TransactionCategory: $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 LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): TransactionCategory = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 TransactionCategory && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** Transfer direction */ - class Direction @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CREDIT = of("CREDIT") - - @JvmField val DEBIT = of("DEBIT") - - @JvmStatic fun of(value: String) = Direction(JsonField.of(value)) - } - - /** An enum containing [Direction]'s known values. */ - enum class Known { - CREDIT, - DEBIT, - } - - /** - * An enum containing [Direction]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Direction] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CREDIT, - DEBIT, - /** - * An enum member indicating that [Direction] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CREDIT -> Value.CREDIT - DEBIT -> Value.DEBIT - 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 LithicInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - CREDIT -> Known.CREDIT - DEBIT -> Known.DEBIT - else -> throw LithicInvalidDataException("Unknown Direction: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Direction = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Direction && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** Payment Event */ - class PaymentEvent - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val token: JsonField, - private val amount: JsonField, - private val created: JsonField, - private val result: JsonField, - private val type: JsonField, - private val detailedResults: JsonField>, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), - @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - @JsonProperty("created") - @ExcludeMissing - created: JsonField = JsonMissing.of(), - @JsonProperty("result") - @ExcludeMissing - result: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - @JsonProperty("detailed_results") - @ExcludeMissing - detailedResults: JsonField> = JsonMissing.of(), - ) : this(token, amount, created, result, type, detailedResults, mutableMapOf()) - - /** - * Globally unique identifier. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun token(): String = token.getRequired("token") - - /** - * Amount of the financial event that has been settled in the currency's smallest unit - * (e.g., cents). - * - * @throws LithicInvalidDataException if 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") - - /** - * Date and time when the financial event occurred. UTC time zone. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun created(): OffsetDateTime = created.getRequired("created") - - /** - * APPROVED financial events were successful while DECLINED financial events were - * declined by user, Lithic, or the network. - * - * @throws LithicInvalidDataException if 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") - - /** - * Event types: - * * `ACH_ORIGINATION_INITIATED` - ACH origination received and pending approval/release - * from an ACH hold. - * * `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process. - * * `ACH_ORIGINATION_CANCELLED` - ACH origination has been cancelled. - * * `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed and sent to the - * Federal Reserve. - * * `ACH_ORIGINATION_SETTLED` - ACH origination has settled. - * * `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to available - * balance. - * * `ACH_RETURN_PROCESSED` - ACH origination returned by the Receiving Depository - * Financial Institution. - * * `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder. - * * `ACH_RETURN_INITIATED` - ACH initiated return for a ACH receipt. - * * `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled. - * * `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance. - * * `ACH_RETURN_SETTLED` - ACH receipt return settled by the Receiving Depository - * Financial Institution. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun type(): Type = type.getRequired("type") - - /** - * More detailed reasons for the event - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun detailedResults(): Optional> = - detailedResults.getOptional("detailed_results") - - /** - * Returns the raw JSON value of [token]. - * - * Unlike [token], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("token") @ExcludeMissing fun _token(): JsonField = token - - /** - * 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 [created]. - * - * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("created") - @ExcludeMissing - fun _created(): JsonField = created - - /** - * 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 - - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - - /** - * Returns the raw JSON value of [detailedResults]. - * - * Unlike [detailedResults], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("detailed_results") - @ExcludeMissing - fun _detailedResults(): JsonField> = detailedResults - - @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 [PaymentEvent]. - * - * The following fields are required: - * ```java - * .token() - * .amount() - * .created() - * .result() - * .type() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [PaymentEvent]. */ - class Builder internal constructor() { - - private var token: JsonField? = null - private var amount: JsonField? = null - private var created: JsonField? = null - private var result: JsonField? = null - private var type: JsonField? = null - private var detailedResults: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(paymentEvent: PaymentEvent) = apply { - token = paymentEvent.token - amount = paymentEvent.amount - created = paymentEvent.created - result = paymentEvent.result - type = paymentEvent.type - detailedResults = paymentEvent.detailedResults.map { it.toMutableList() } - additionalProperties = paymentEvent.additionalProperties.toMutableMap() - } - - /** Globally unique identifier. */ - fun token(token: String) = token(JsonField.of(token)) - - /** - * Sets [Builder.token] to an arbitrary JSON value. - * - * You should usually call [Builder.token] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun token(token: JsonField) = apply { this.token = token } - - /** - * Amount of the financial event that has been settled in the currency's smallest - * unit (e.g., cents). - */ - fun amount(amount: Long) = amount(JsonField.of(amount)) - - /** - * Sets [Builder.amount] to an arbitrary JSON value. - * - * You should usually call [Builder.amount] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } - - /** Date and time when the financial event occurred. UTC time zone. */ - fun created(created: OffsetDateTime) = created(JsonField.of(created)) - - /** - * Sets [Builder.created] to an arbitrary JSON value. - * - * You should usually call [Builder.created] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun created(created: JsonField) = apply { this.created = created } - - /** - * APPROVED financial events were successful while DECLINED financial events were - * declined by user, Lithic, or the 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 } - - /** - * Event types: - * * `ACH_ORIGINATION_INITIATED` - ACH origination received and pending - * approval/release from an ACH hold. - * * `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process. - * * `ACH_ORIGINATION_CANCELLED` - ACH origination has been cancelled. - * * `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed and sent to - * the Federal Reserve. - * * `ACH_ORIGINATION_SETTLED` - ACH origination has settled. - * * `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to available - * balance. - * * `ACH_RETURN_PROCESSED` - ACH origination returned by the Receiving Depository - * Financial Institution. - * * `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder. - * * `ACH_RETURN_INITIATED` - ACH initiated return for a ACH receipt. - * * `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled. - * * `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available - * balance. - * * `ACH_RETURN_SETTLED` - ACH receipt return settled by the Receiving Depository - * Financial Institution. - */ - fun type(type: Type) = type(JsonField.of(type)) - - /** - * Sets [Builder.type] to an arbitrary JSON value. - * - * You should usually call [Builder.type] with a well-typed [Type] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun type(type: JsonField) = apply { this.type = type } - - /** More detailed reasons for the event */ - fun detailedResults(detailedResults: List) = - detailedResults(JsonField.of(detailedResults)) - - /** - * Sets [Builder.detailedResults] to an arbitrary JSON value. - * - * You should usually call [Builder.detailedResults] with a well-typed - * `List` value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun detailedResults(detailedResults: JsonField>) = apply { - this.detailedResults = detailedResults.map { it.toMutableList() } - } - - /** - * Adds a single [DetailedResult] to [detailedResults]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addDetailedResult(detailedResult: DetailedResult) = apply { - detailedResults = - (detailedResults ?: JsonField.of(mutableListOf())).also { - checkKnown("detailedResults", it).add(detailedResult) - } - } - - 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 [PaymentEvent]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .token() - * .amount() - * .created() - * .result() - * .type() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): PaymentEvent = - PaymentEvent( - checkRequired("token", token), - checkRequired("amount", amount), - checkRequired("created", created), - checkRequired("result", result), - checkRequired("type", type), - (detailedResults ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): PaymentEvent = apply { - if (validated) { - return@apply - } - - token() - amount() - created() - result().validate() - type().validate() - detailedResults().ifPresent { it.forEach { it.validate() } } - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 (token.asKnown().isPresent) 1 else 0) + - (if (amount.asKnown().isPresent) 1 else 0) + - (if (created.asKnown().isPresent) 1 else 0) + - (result.asKnown().getOrNull()?.validity() ?: 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) + - (detailedResults.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) - - /** - * APPROVED financial events were successful while DECLINED financial events were - * declined by user, Lithic, or the 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 { - - @JvmField val APPROVED = of("APPROVED") - - @JvmField val DECLINED = of("DECLINED") - - @JvmStatic fun of(value: String) = Result(JsonField.of(value)) - } - - /** An enum containing [Result]'s known values. */ - enum class Known { - APPROVED, - DECLINED, - } - - /** - * 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 { - APPROVED, - DECLINED, - /** - * 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) { - APPROVED -> Value.APPROVED - DECLINED -> Value.DECLINED - 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 LithicInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - APPROVED -> Known.APPROVED - DECLINED -> Known.DECLINED - else -> throw LithicInvalidDataException("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 LithicInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("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: LithicInvalidDataException) { - 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() - } - - /** - * Event types: - * * `ACH_ORIGINATION_INITIATED` - ACH origination received and pending approval/release - * from an ACH hold. - * * `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process. - * * `ACH_ORIGINATION_CANCELLED` - ACH origination has been cancelled. - * * `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed and sent to the - * Federal Reserve. - * * `ACH_ORIGINATION_SETTLED` - ACH origination has settled. - * * `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to available - * balance. - * * `ACH_RETURN_PROCESSED` - ACH origination returned by the Receiving Depository - * Financial Institution. - * * `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder. - * * `ACH_RETURN_INITIATED` - ACH initiated return for a ACH receipt. - * * `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled. - * * `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance. - * * `ACH_RETURN_SETTLED` - ACH receipt return settled by the Receiving Depository - * Financial Institution. - */ - class Type @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ACH_ORIGINATION_CANCELLED = of("ACH_ORIGINATION_CANCELLED") - - @JvmField val ACH_ORIGINATION_INITIATED = of("ACH_ORIGINATION_INITIATED") - - @JvmField val ACH_ORIGINATION_PROCESSED = of("ACH_ORIGINATION_PROCESSED") - - @JvmField val ACH_ORIGINATION_SETTLED = of("ACH_ORIGINATION_SETTLED") - - @JvmField val ACH_ORIGINATION_RELEASED = of("ACH_ORIGINATION_RELEASED") - - @JvmField val ACH_ORIGINATION_REVIEWED = of("ACH_ORIGINATION_REVIEWED") - - @JvmField val ACH_RECEIPT_PROCESSED = of("ACH_RECEIPT_PROCESSED") - - @JvmField val ACH_RECEIPT_SETTLED = of("ACH_RECEIPT_SETTLED") - - @JvmField val ACH_RETURN_INITIATED = of("ACH_RETURN_INITIATED") - - @JvmField val ACH_RETURN_PROCESSED = of("ACH_RETURN_PROCESSED") - - @JvmField val ACH_RETURN_SETTLED = of("ACH_RETURN_SETTLED") - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - /** An enum containing [Type]'s known values. */ - enum class Known { - ACH_ORIGINATION_CANCELLED, - ACH_ORIGINATION_INITIATED, - ACH_ORIGINATION_PROCESSED, - ACH_ORIGINATION_SETTLED, - ACH_ORIGINATION_RELEASED, - ACH_ORIGINATION_REVIEWED, - ACH_RECEIPT_PROCESSED, - ACH_RECEIPT_SETTLED, - ACH_RETURN_INITIATED, - ACH_RETURN_PROCESSED, - ACH_RETURN_SETTLED, - } - - /** - * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Type] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ACH_ORIGINATION_CANCELLED, - ACH_ORIGINATION_INITIATED, - ACH_ORIGINATION_PROCESSED, - ACH_ORIGINATION_SETTLED, - ACH_ORIGINATION_RELEASED, - ACH_ORIGINATION_REVIEWED, - ACH_RECEIPT_PROCESSED, - ACH_RECEIPT_SETTLED, - ACH_RETURN_INITIATED, - ACH_RETURN_PROCESSED, - ACH_RETURN_SETTLED, - /** - * An enum member indicating that [Type] was instantiated with an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ACH_ORIGINATION_CANCELLED -> Value.ACH_ORIGINATION_CANCELLED - ACH_ORIGINATION_INITIATED -> Value.ACH_ORIGINATION_INITIATED - ACH_ORIGINATION_PROCESSED -> Value.ACH_ORIGINATION_PROCESSED - ACH_ORIGINATION_SETTLED -> Value.ACH_ORIGINATION_SETTLED - ACH_ORIGINATION_RELEASED -> Value.ACH_ORIGINATION_RELEASED - ACH_ORIGINATION_REVIEWED -> Value.ACH_ORIGINATION_REVIEWED - ACH_RECEIPT_PROCESSED -> Value.ACH_RECEIPT_PROCESSED - ACH_RECEIPT_SETTLED -> Value.ACH_RECEIPT_SETTLED - ACH_RETURN_INITIATED -> Value.ACH_RETURN_INITIATED - ACH_RETURN_PROCESSED -> Value.ACH_RETURN_PROCESSED - ACH_RETURN_SETTLED -> Value.ACH_RETURN_SETTLED - 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 LithicInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - ACH_ORIGINATION_CANCELLED -> Known.ACH_ORIGINATION_CANCELLED - ACH_ORIGINATION_INITIATED -> Known.ACH_ORIGINATION_INITIATED - ACH_ORIGINATION_PROCESSED -> Known.ACH_ORIGINATION_PROCESSED - ACH_ORIGINATION_SETTLED -> Known.ACH_ORIGINATION_SETTLED - ACH_ORIGINATION_RELEASED -> Known.ACH_ORIGINATION_RELEASED - ACH_ORIGINATION_REVIEWED -> Known.ACH_ORIGINATION_REVIEWED - ACH_RECEIPT_PROCESSED -> Known.ACH_RECEIPT_PROCESSED - ACH_RECEIPT_SETTLED -> Known.ACH_RECEIPT_SETTLED - ACH_RETURN_INITIATED -> Known.ACH_RETURN_INITIATED - ACH_RETURN_PROCESSED -> Known.ACH_RETURN_PROCESSED - ACH_RETURN_SETTLED -> Known.ACH_RETURN_SETTLED - else -> throw LithicInvalidDataException("Unknown Type: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Type = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Type && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - class DetailedResult - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val APPROVED = of("APPROVED") - - @JvmField val FUNDS_INSUFFICIENT = of("FUNDS_INSUFFICIENT") - - @JvmField val ACCOUNT_INVALID = of("ACCOUNT_INVALID") - - @JvmField - val PROGRAM_TRANSACTION_LIMIT_EXCEEDED = - of("PROGRAM_TRANSACTION_LIMIT_EXCEEDED") - - @JvmField val PROGRAM_DAILY_LIMIT_EXCEEDED = of("PROGRAM_DAILY_LIMIT_EXCEEDED") - - @JvmField - val PROGRAM_MONTHLY_LIMIT_EXCEEDED = of("PROGRAM_MONTHLY_LIMIT_EXCEEDED") - - @JvmStatic fun of(value: String) = DetailedResult(JsonField.of(value)) - } - - /** An enum containing [DetailedResult]'s known values. */ - enum class Known { - APPROVED, - FUNDS_INSUFFICIENT, - ACCOUNT_INVALID, - PROGRAM_TRANSACTION_LIMIT_EXCEEDED, - PROGRAM_DAILY_LIMIT_EXCEEDED, - PROGRAM_MONTHLY_LIMIT_EXCEEDED, - } - - /** - * An enum containing [DetailedResult]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DetailedResult] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then 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 { - APPROVED, - FUNDS_INSUFFICIENT, - ACCOUNT_INVALID, - PROGRAM_TRANSACTION_LIMIT_EXCEEDED, - PROGRAM_DAILY_LIMIT_EXCEEDED, - PROGRAM_MONTHLY_LIMIT_EXCEEDED, - /** - * An enum member indicating that [DetailedResult] 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) { - APPROVED -> Value.APPROVED - FUNDS_INSUFFICIENT -> Value.FUNDS_INSUFFICIENT - ACCOUNT_INVALID -> Value.ACCOUNT_INVALID - PROGRAM_TRANSACTION_LIMIT_EXCEEDED -> - Value.PROGRAM_TRANSACTION_LIMIT_EXCEEDED - PROGRAM_DAILY_LIMIT_EXCEEDED -> Value.PROGRAM_DAILY_LIMIT_EXCEEDED - PROGRAM_MONTHLY_LIMIT_EXCEEDED -> Value.PROGRAM_MONTHLY_LIMIT_EXCEEDED - 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 LithicInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - APPROVED -> Known.APPROVED - FUNDS_INSUFFICIENT -> Known.FUNDS_INSUFFICIENT - ACCOUNT_INVALID -> Known.ACCOUNT_INVALID - PROGRAM_TRANSACTION_LIMIT_EXCEEDED -> - Known.PROGRAM_TRANSACTION_LIMIT_EXCEEDED - PROGRAM_DAILY_LIMIT_EXCEEDED -> Known.PROGRAM_DAILY_LIMIT_EXCEEDED - PROGRAM_MONTHLY_LIMIT_EXCEEDED -> Known.PROGRAM_MONTHLY_LIMIT_EXCEEDED - else -> throw LithicInvalidDataException("Unknown DetailedResult: $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 LithicInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): DetailedResult = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 DetailedResult && 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 PaymentEvent && - token == other.token && - amount == other.amount && - created == other.created && - result == other.result && - type == other.type && - detailedResults == other.detailedResults && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - token, - amount, - created, - result, - type, - detailedResults, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "PaymentEvent{token=$token, amount=$amount, created=$created, result=$result, type=$type, detailedResults=$detailedResults, additionalProperties=$additionalProperties}" - } - - class TransactionFamilyTypes - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CARD = of("CARD") - - @JvmField val PAYMENT = of("PAYMENT") - - @JvmField val TRANSFER = of("TRANSFER") - - @JvmField val INTERNAL = of("INTERNAL") - - @JvmField val EXTERNAL_PAYMENT = of("EXTERNAL_PAYMENT") - - @JvmField val MANAGEMENT_OPERATION = of("MANAGEMENT_OPERATION") - - @JvmStatic fun of(value: String) = TransactionFamilyTypes(JsonField.of(value)) - } - - /** An enum containing [TransactionFamilyTypes]'s known values. */ - enum class Known { - CARD, - PAYMENT, - TRANSFER, - INTERNAL, - EXTERNAL_PAYMENT, - MANAGEMENT_OPERATION, - } - - /** - * An enum containing [TransactionFamilyTypes]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [TransactionFamilyTypes] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CARD, - PAYMENT, - TRANSFER, - INTERNAL, - EXTERNAL_PAYMENT, - MANAGEMENT_OPERATION, - /** - * An enum member indicating that [TransactionFamilyTypes] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CARD -> Value.CARD - PAYMENT -> Value.PAYMENT - TRANSFER -> Value.TRANSFER - INTERNAL -> Value.INTERNAL - EXTERNAL_PAYMENT -> Value.EXTERNAL_PAYMENT - MANAGEMENT_OPERATION -> Value.MANAGEMENT_OPERATION - 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 LithicInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - CARD -> Known.CARD - PAYMENT -> Known.PAYMENT - TRANSFER -> Known.TRANSFER - INTERNAL -> Known.INTERNAL - EXTERNAL_PAYMENT -> Known.EXTERNAL_PAYMENT - MANAGEMENT_OPERATION -> Known.MANAGEMENT_OPERATION - else -> - throw LithicInvalidDataException("Unknown TransactionFamilyTypes: $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 LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): TransactionFamilyTypes = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 TransactionFamilyTypes && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** Transfer method */ - class Method @JsonCreator private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ACH_NEXT_DAY = of("ACH_NEXT_DAY") - - @JvmField val ACH_SAME_DAY = of("ACH_SAME_DAY") - - @JvmField val WIRE = of("WIRE") - - @JvmStatic fun of(value: String) = Method(JsonField.of(value)) - } - - /** An enum containing [Method]'s known values. */ - enum class Known { - ACH_NEXT_DAY, - ACH_SAME_DAY, - WIRE, - } - - /** - * An enum containing [Method]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Method] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then 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 { - ACH_NEXT_DAY, - ACH_SAME_DAY, - WIRE, - /** - * An enum member indicating that [Method] 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) { - ACH_NEXT_DAY -> Value.ACH_NEXT_DAY - ACH_SAME_DAY -> Value.ACH_SAME_DAY - WIRE -> Value.WIRE - 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 LithicInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ACH_NEXT_DAY -> Known.ACH_NEXT_DAY - ACH_SAME_DAY -> Known.ACH_SAME_DAY - WIRE -> Known.WIRE - else -> throw LithicInvalidDataException("Unknown Method: $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 LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Method = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 Method && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** Method-specific attributes */ - @JsonDeserialize(using = MethodAttributes.Deserializer::class) - @JsonSerialize(using = MethodAttributes.Serializer::class) - class MethodAttributes - private constructor( - private val ach: AchMethodAttributes? = null, - private val wire: WireMethodAttributes? = null, - private val _json: JsonValue? = null, - ) { - - fun ach(): Optional = Optional.ofNullable(ach) - - fun wire(): Optional = Optional.ofNullable(wire) - - fun isAch(): Boolean = ach != null - - fun isWire(): Boolean = wire != null - - fun asAch(): AchMethodAttributes = ach.getOrThrow("ach") - - fun asWire(): WireMethodAttributes = wire.getOrThrow("wire") - - fun _json(): Optional = Optional.ofNullable(_json) - - fun accept(visitor: Visitor): T = - when { - ach != null -> visitor.visitAch(ach) - wire != null -> visitor.visitWire(wire) - else -> visitor.unknown(_json) - } - - private var validated: Boolean = false - - fun validate(): MethodAttributes = apply { - if (validated) { - return@apply - } - - accept( - object : Visitor { - override fun visitAch(ach: AchMethodAttributes) { - ach.validate() - } - - override fun visitWire(wire: WireMethodAttributes) { - wire.validate() - } - } - ) - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 = - accept( - object : Visitor { - override fun visitAch(ach: AchMethodAttributes) = ach.validity() - - override fun visitWire(wire: WireMethodAttributes) = wire.validity() - - override fun unknown(json: JsonValue?) = 0 - } - ) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is MethodAttributes && ach == other.ach && wire == other.wire - } - - override fun hashCode(): Int = Objects.hash(ach, wire) - - override fun toString(): String = - when { - ach != null -> "MethodAttributes{ach=$ach}" - wire != null -> "MethodAttributes{wire=$wire}" - _json != null -> "MethodAttributes{_unknown=$_json}" - else -> throw IllegalStateException("Invalid MethodAttributes") - } - - companion object { - - @JvmStatic fun ofAch(ach: AchMethodAttributes) = MethodAttributes(ach = ach) - - @JvmStatic fun ofWire(wire: WireMethodAttributes) = MethodAttributes(wire = wire) - } - - /** - * An interface that defines how to map each variant of [MethodAttributes] to a value of - * type [T]. - */ - interface Visitor { - - fun visitAch(ach: AchMethodAttributes): T - - fun visitWire(wire: WireMethodAttributes): T - - /** - * Maps an unknown variant of [MethodAttributes] to a value of type [T]. - * - * An instance of [MethodAttributes] can contain an unknown variant if it was - * deserialized from data that doesn't match any known variant. For example, if the - * SDK is on an older version than the API, then the API may respond with new - * variants that the SDK is unaware of. - * - * @throws LithicInvalidDataException in the default implementation. - */ - fun unknown(json: JsonValue?): T { - throw LithicInvalidDataException("Unknown MethodAttributes: $json") - } - } - - internal class Deserializer : - BaseDeserializer(MethodAttributes::class) { - - override fun ObjectCodec.deserialize(node: JsonNode): MethodAttributes { - val json = JsonValue.fromJsonNode(node) - - val bestMatches = - sequenceOf( - tryDeserialize(node, jacksonTypeRef())?.let { - MethodAttributes(ach = it, _json = json) - }, - tryDeserialize(node, jacksonTypeRef())?.let { - MethodAttributes(wire = it, _json = json) - }, - ) - .filterNotNull() - .allMaxBy { it.validity() } - .toList() - return when (bestMatches.size) { - // This can happen if what we're deserializing is completely incompatible - // with all the possible variants (e.g. deserializing from boolean). - 0 -> MethodAttributes(_json = json) - 1 -> bestMatches.single() - // If there's more than one match with the highest validity, then use the - // first completely valid match, or simply the first match if none are - // completely valid. - else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first() - } - } - } - - internal class Serializer : BaseSerializer(MethodAttributes::class) { - - override fun serialize( - value: MethodAttributes, - generator: JsonGenerator, - provider: SerializerProvider, - ) { - when { - value.ach != null -> generator.writeObject(value.ach) - value.wire != null -> generator.writeObject(value.wire) - value._json != null -> generator.writeObject(value._json) - else -> throw IllegalStateException("Invalid MethodAttributes") - } - } - } - - class AchMethodAttributes - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val secCode: JsonField, - private val addenda: JsonField, - private val companyId: JsonField, - private val receiptRoutingNumber: JsonField, - private val retries: JsonField, - private val returnReasonCode: JsonField, - private val traceNumbers: JsonField>, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("sec_code") - @ExcludeMissing - secCode: JsonField = JsonMissing.of(), - @JsonProperty("addenda") - @ExcludeMissing - addenda: JsonField = JsonMissing.of(), - @JsonProperty("company_id") - @ExcludeMissing - companyId: JsonField = JsonMissing.of(), - @JsonProperty("receipt_routing_number") - @ExcludeMissing - receiptRoutingNumber: JsonField = JsonMissing.of(), - @JsonProperty("retries") - @ExcludeMissing - retries: JsonField = JsonMissing.of(), - @JsonProperty("return_reason_code") - @ExcludeMissing - returnReasonCode: JsonField = JsonMissing.of(), - @JsonProperty("trace_numbers") - @ExcludeMissing - traceNumbers: JsonField> = JsonMissing.of(), - ) : this( - secCode, - addenda, - companyId, - receiptRoutingNumber, - retries, - returnReasonCode, - traceNumbers, - mutableMapOf(), - ) - - /** - * SEC code for ACH transaction - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun secCode(): SecCode = secCode.getRequired("sec_code") - - /** - * Addenda information - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun addenda(): Optional = addenda.getOptional("addenda") - - /** - * Company ID for the ACH transaction - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun companyId(): Optional = companyId.getOptional("company_id") - - /** - * Receipt routing number - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun receiptRoutingNumber(): Optional = - receiptRoutingNumber.getOptional("receipt_routing_number") - - /** - * Number of retries attempted - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun retries(): Optional = retries.getOptional("retries") - - /** - * Return reason code if the transaction was returned - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun returnReasonCode(): Optional = - returnReasonCode.getOptional("return_reason_code") - - /** - * Trace numbers for the ACH transaction - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun traceNumbers(): Optional> = - traceNumbers.getOptional("trace_numbers") - - /** - * Returns the raw JSON value of [secCode]. - * - * Unlike [secCode], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("sec_code") - @ExcludeMissing - fun _secCode(): JsonField = secCode - - /** - * Returns the raw JSON value of [addenda]. - * - * Unlike [addenda], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("addenda") @ExcludeMissing fun _addenda(): JsonField = addenda - - /** - * Returns the raw JSON value of [companyId]. - * - * Unlike [companyId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("company_id") - @ExcludeMissing - fun _companyId(): JsonField = companyId - - /** - * Returns the raw JSON value of [receiptRoutingNumber]. - * - * Unlike [receiptRoutingNumber], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("receipt_routing_number") - @ExcludeMissing - fun _receiptRoutingNumber(): JsonField = receiptRoutingNumber - - /** - * Returns the raw JSON value of [retries]. - * - * Unlike [retries], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("retries") @ExcludeMissing fun _retries(): JsonField = retries - - /** - * Returns the raw JSON value of [returnReasonCode]. - * - * Unlike [returnReasonCode], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("return_reason_code") - @ExcludeMissing - fun _returnReasonCode(): JsonField = returnReasonCode - - /** - * Returns the raw JSON value of [traceNumbers]. - * - * Unlike [traceNumbers], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("trace_numbers") - @ExcludeMissing - fun _traceNumbers(): JsonField> = traceNumbers - - @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 - * [AchMethodAttributes]. - * - * The following fields are required: - * ```java - * .secCode() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [AchMethodAttributes]. */ - class Builder internal constructor() { - - private var secCode: JsonField? = null - private var addenda: JsonField = JsonMissing.of() - private var companyId: JsonField = JsonMissing.of() - private var receiptRoutingNumber: JsonField = JsonMissing.of() - private var retries: JsonField = JsonMissing.of() - private var returnReasonCode: JsonField = JsonMissing.of() - private var traceNumbers: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(achMethodAttributes: AchMethodAttributes) = apply { - secCode = achMethodAttributes.secCode - addenda = achMethodAttributes.addenda - companyId = achMethodAttributes.companyId - receiptRoutingNumber = achMethodAttributes.receiptRoutingNumber - retries = achMethodAttributes.retries - returnReasonCode = achMethodAttributes.returnReasonCode - traceNumbers = achMethodAttributes.traceNumbers.map { it.toMutableList() } - additionalProperties = - achMethodAttributes.additionalProperties.toMutableMap() - } - - /** SEC code for ACH transaction */ - fun secCode(secCode: SecCode) = secCode(JsonField.of(secCode)) - - /** - * Sets [Builder.secCode] to an arbitrary JSON value. - * - * You should usually call [Builder.secCode] with a well-typed [SecCode] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun secCode(secCode: JsonField) = apply { this.secCode = secCode } - - /** Addenda information */ - fun addenda(addenda: String?) = addenda(JsonField.ofNullable(addenda)) - - /** Alias for calling [Builder.addenda] with `addenda.orElse(null)`. */ - fun addenda(addenda: Optional) = addenda(addenda.getOrNull()) - - /** - * Sets [Builder.addenda] to an arbitrary JSON value. - * - * You should usually call [Builder.addenda] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun addenda(addenda: JsonField) = apply { this.addenda = addenda } - - /** Company ID for the ACH transaction */ - fun companyId(companyId: String?) = companyId(JsonField.ofNullable(companyId)) - - /** Alias for calling [Builder.companyId] with `companyId.orElse(null)`. */ - fun companyId(companyId: Optional) = companyId(companyId.getOrNull()) - - /** - * Sets [Builder.companyId] to an arbitrary JSON value. - * - * You should usually call [Builder.companyId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun companyId(companyId: JsonField) = apply { - this.companyId = companyId - } - - /** Receipt routing number */ - fun receiptRoutingNumber(receiptRoutingNumber: String?) = - receiptRoutingNumber(JsonField.ofNullable(receiptRoutingNumber)) - - /** - * Alias for calling [Builder.receiptRoutingNumber] with - * `receiptRoutingNumber.orElse(null)`. - */ - fun receiptRoutingNumber(receiptRoutingNumber: Optional) = - receiptRoutingNumber(receiptRoutingNumber.getOrNull()) - - /** - * Sets [Builder.receiptRoutingNumber] to an arbitrary JSON value. - * - * You should usually call [Builder.receiptRoutingNumber] with a well-typed - * [String] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun receiptRoutingNumber(receiptRoutingNumber: JsonField) = apply { - this.receiptRoutingNumber = receiptRoutingNumber - } - - /** Number of retries attempted */ - fun retries(retries: Long?) = retries(JsonField.ofNullable(retries)) - - /** - * Alias for [Builder.retries]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun retries(retries: Long) = retries(retries as Long?) - - /** Alias for calling [Builder.retries] with `retries.orElse(null)`. */ - fun retries(retries: Optional) = retries(retries.getOrNull()) - - /** - * Sets [Builder.retries] to an arbitrary JSON value. - * - * You should usually call [Builder.retries] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun retries(retries: JsonField) = apply { this.retries = retries } - - /** Return reason code if the transaction was returned */ - fun returnReasonCode(returnReasonCode: String?) = - returnReasonCode(JsonField.ofNullable(returnReasonCode)) - - /** - * Alias for calling [Builder.returnReasonCode] with - * `returnReasonCode.orElse(null)`. - */ - fun returnReasonCode(returnReasonCode: Optional) = - returnReasonCode(returnReasonCode.getOrNull()) - - /** - * Sets [Builder.returnReasonCode] to an arbitrary JSON value. - * - * You should usually call [Builder.returnReasonCode] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun returnReasonCode(returnReasonCode: JsonField) = apply { - this.returnReasonCode = returnReasonCode - } - - /** Trace numbers for the ACH transaction */ - fun traceNumbers(traceNumbers: List) = - traceNumbers(JsonField.of(traceNumbers)) - - /** - * Sets [Builder.traceNumbers] to an arbitrary JSON value. - * - * You should usually call [Builder.traceNumbers] with a well-typed - * `List` value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. - */ - fun traceNumbers(traceNumbers: JsonField>) = apply { - this.traceNumbers = traceNumbers.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [traceNumbers]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addTraceNumber(traceNumber: String) = apply { - traceNumbers = - (traceNumbers ?: JsonField.of(mutableListOf())).also { - checkKnown("traceNumbers", it).add(traceNumber) - } - } - - 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 [AchMethodAttributes]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .secCode() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): AchMethodAttributes = - AchMethodAttributes( - checkRequired("secCode", secCode), - addenda, - companyId, - receiptRoutingNumber, - retries, - returnReasonCode, - (traceNumbers ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): AchMethodAttributes = apply { - if (validated) { - return@apply - } - - secCode().validate() - addenda() - companyId() - receiptRoutingNumber() - retries() - returnReasonCode() - traceNumbers() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 = - (secCode.asKnown().getOrNull()?.validity() ?: 0) + - (if (addenda.asKnown().isPresent) 1 else 0) + - (if (companyId.asKnown().isPresent) 1 else 0) + - (if (receiptRoutingNumber.asKnown().isPresent) 1 else 0) + - (if (retries.asKnown().isPresent) 1 else 0) + - (if (returnReasonCode.asKnown().isPresent) 1 else 0) + - (traceNumbers.asKnown().getOrNull()?.size ?: 0) - - /** SEC code for ACH transaction */ - class SecCode - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val CCD = of("CCD") - - @JvmField val PPD = of("PPD") - - @JvmField val WEB = of("WEB") - - @JvmField val TEL = of("TEL") - - @JvmField val CIE = of("CIE") - - @JvmField val CTX = of("CTX") - - @JvmStatic fun of(value: String) = SecCode(JsonField.of(value)) - } - - /** An enum containing [SecCode]'s known values. */ - enum class Known { - CCD, - PPD, - WEB, - TEL, - CIE, - CTX, - } - - /** - * An enum containing [SecCode]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [SecCode] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then 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 { - CCD, - PPD, - WEB, - TEL, - CIE, - CTX, - /** - * An enum member indicating that [SecCode] 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) { - CCD -> Value.CCD - PPD -> Value.PPD - WEB -> Value.WEB - TEL -> Value.TEL - CIE -> Value.CIE - CTX -> Value.CTX - 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 LithicInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - CCD -> Known.CCD - PPD -> Known.PPD - WEB -> Known.WEB - TEL -> Known.TEL - CIE -> Known.CIE - CTX -> Known.CTX - else -> throw LithicInvalidDataException("Unknown SecCode: $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 LithicInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): SecCode = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 SecCode && 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 AchMethodAttributes && - secCode == other.secCode && - addenda == other.addenda && - companyId == other.companyId && - receiptRoutingNumber == other.receiptRoutingNumber && - retries == other.retries && - returnReasonCode == other.returnReasonCode && - traceNumbers == other.traceNumbers && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - secCode, - addenda, - companyId, - receiptRoutingNumber, - retries, - returnReasonCode, - traceNumbers, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "AchMethodAttributes{secCode=$secCode, addenda=$addenda, companyId=$companyId, receiptRoutingNumber=$receiptRoutingNumber, retries=$retries, returnReasonCode=$returnReasonCode, traceNumbers=$traceNumbers, additionalProperties=$additionalProperties}" - } - - class WireMethodAttributes - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val wireNetwork: JsonField, - private val creditor: JsonField, - private val debtor: JsonField, - private val messageId: JsonField, - private val remittanceInformation: JsonField, - private val wireMessageType: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("wire_network") - @ExcludeMissing - wireNetwork: JsonField = JsonMissing.of(), - @JsonProperty("creditor") - @ExcludeMissing - creditor: JsonField = JsonMissing.of(), - @JsonProperty("debtor") - @ExcludeMissing - debtor: JsonField = JsonMissing.of(), - @JsonProperty("message_id") - @ExcludeMissing - messageId: JsonField = JsonMissing.of(), - @JsonProperty("remittance_information") - @ExcludeMissing - remittanceInformation: JsonField = JsonMissing.of(), - @JsonProperty("wire_message_type") - @ExcludeMissing - wireMessageType: JsonField = JsonMissing.of(), - ) : this( - wireNetwork, - creditor, - debtor, - messageId, - remittanceInformation, - wireMessageType, - mutableMapOf(), - ) - - /** - * Type of wire transfer - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun wireNetwork(): WireNetwork = wireNetwork.getRequired("wire_network") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun creditor(): Optional = creditor.getOptional("creditor") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun debtor(): Optional = debtor.getOptional("debtor") - - /** - * Point to point reference identifier, as assigned by the instructing party, used - * for tracking the message through the Fedwire system - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun messageId(): Optional = messageId.getOptional("message_id") - - /** - * Payment details or invoice reference - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun remittanceInformation(): Optional = - remittanceInformation.getOptional("remittance_information") - - /** - * Type of wire message - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun wireMessageType(): Optional = - wireMessageType.getOptional("wire_message_type") - - /** - * Returns the raw JSON value of [wireNetwork]. - * - * Unlike [wireNetwork], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("wire_network") - @ExcludeMissing - fun _wireNetwork(): JsonField = wireNetwork - - /** - * Returns the raw JSON value of [creditor]. - * - * Unlike [creditor], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("creditor") - @ExcludeMissing - fun _creditor(): JsonField = creditor - - /** - * Returns the raw JSON value of [debtor]. - * - * Unlike [debtor], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("debtor") - @ExcludeMissing - fun _debtor(): JsonField = debtor - - /** - * Returns the raw JSON value of [messageId]. - * - * Unlike [messageId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("message_id") - @ExcludeMissing - fun _messageId(): JsonField = messageId - - /** - * Returns the raw JSON value of [remittanceInformation]. - * - * Unlike [remittanceInformation], this method doesn't throw if the JSON field has - * an unexpected type. - */ - @JsonProperty("remittance_information") - @ExcludeMissing - fun _remittanceInformation(): JsonField = remittanceInformation - - /** - * Returns the raw JSON value of [wireMessageType]. - * - * Unlike [wireMessageType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("wire_message_type") - @ExcludeMissing - fun _wireMessageType(): JsonField = wireMessageType - - @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 - * [WireMethodAttributes]. - * - * The following fields are required: - * ```java - * .wireNetwork() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [WireMethodAttributes]. */ - class Builder internal constructor() { - - private var wireNetwork: JsonField? = null - private var creditor: JsonField = JsonMissing.of() - private var debtor: JsonField = JsonMissing.of() - private var messageId: JsonField = JsonMissing.of() - private var remittanceInformation: JsonField = JsonMissing.of() - private var wireMessageType: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(wireMethodAttributes: WireMethodAttributes) = apply { - wireNetwork = wireMethodAttributes.wireNetwork - creditor = wireMethodAttributes.creditor - debtor = wireMethodAttributes.debtor - messageId = wireMethodAttributes.messageId - remittanceInformation = wireMethodAttributes.remittanceInformation - wireMessageType = wireMethodAttributes.wireMessageType - additionalProperties = - wireMethodAttributes.additionalProperties.toMutableMap() - } - - /** Type of wire transfer */ - fun wireNetwork(wireNetwork: WireNetwork) = - wireNetwork(JsonField.of(wireNetwork)) - - /** - * Sets [Builder.wireNetwork] to an arbitrary JSON value. - * - * You should usually call [Builder.wireNetwork] with a well-typed [WireNetwork] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun wireNetwork(wireNetwork: JsonField) = apply { - this.wireNetwork = wireNetwork - } - - fun creditor(creditor: WirePartyDetails) = creditor(JsonField.of(creditor)) - - /** - * Sets [Builder.creditor] to an arbitrary JSON value. - * - * You should usually call [Builder.creditor] with a well-typed - * [WirePartyDetails] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun creditor(creditor: JsonField) = apply { - this.creditor = creditor - } - - fun debtor(debtor: WirePartyDetails) = debtor(JsonField.of(debtor)) - - /** - * Sets [Builder.debtor] to an arbitrary JSON value. - * - * You should usually call [Builder.debtor] with a well-typed [WirePartyDetails] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun debtor(debtor: JsonField) = apply { this.debtor = debtor } - - /** - * Point to point reference identifier, as assigned by the instructing party, - * used for tracking the message through the Fedwire system - */ - fun messageId(messageId: String?) = messageId(JsonField.ofNullable(messageId)) - - /** Alias for calling [Builder.messageId] with `messageId.orElse(null)`. */ - fun messageId(messageId: Optional) = messageId(messageId.getOrNull()) - - /** - * Sets [Builder.messageId] to an arbitrary JSON value. - * - * You should usually call [Builder.messageId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun messageId(messageId: JsonField) = apply { - this.messageId = messageId - } - - /** Payment details or invoice reference */ - fun remittanceInformation(remittanceInformation: String?) = - remittanceInformation(JsonField.ofNullable(remittanceInformation)) - - /** - * Alias for calling [Builder.remittanceInformation] with - * `remittanceInformation.orElse(null)`. - */ - fun remittanceInformation(remittanceInformation: Optional) = - remittanceInformation(remittanceInformation.getOrNull()) - - /** - * Sets [Builder.remittanceInformation] to an arbitrary JSON value. - * - * You should usually call [Builder.remittanceInformation] with a well-typed - * [String] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun remittanceInformation(remittanceInformation: JsonField) = apply { - this.remittanceInformation = remittanceInformation - } - - /** Type of wire message */ - fun wireMessageType(wireMessageType: String) = - wireMessageType(JsonField.of(wireMessageType)) - - /** - * Sets [Builder.wireMessageType] to an arbitrary JSON value. - * - * You should usually call [Builder.wireMessageType] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun wireMessageType(wireMessageType: JsonField) = apply { - this.wireMessageType = wireMessageType - } - - 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 [WireMethodAttributes]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .wireNetwork() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): WireMethodAttributes = - WireMethodAttributes( - checkRequired("wireNetwork", wireNetwork), - creditor, - debtor, - messageId, - remittanceInformation, - wireMessageType, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): WireMethodAttributes = apply { - if (validated) { - return@apply - } - - wireNetwork().validate() - creditor().ifPresent { it.validate() } - debtor().ifPresent { it.validate() } - messageId() - remittanceInformation() - wireMessageType() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 = - (wireNetwork.asKnown().getOrNull()?.validity() ?: 0) + - (creditor.asKnown().getOrNull()?.validity() ?: 0) + - (debtor.asKnown().getOrNull()?.validity() ?: 0) + - (if (messageId.asKnown().isPresent) 1 else 0) + - (if (remittanceInformation.asKnown().isPresent) 1 else 0) + - (if (wireMessageType.asKnown().isPresent) 1 else 0) - - /** Type of wire transfer */ - class WireNetwork - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val FEDWIRE = of("FEDWIRE") - - @JvmField val SWIFT = of("SWIFT") - - @JvmStatic fun of(value: String) = WireNetwork(JsonField.of(value)) - } - - /** An enum containing [WireNetwork]'s known values. */ - enum class Known { - FEDWIRE, - SWIFT, - } - - /** - * An enum containing [WireNetwork]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [WireNetwork] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then 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 { - FEDWIRE, - SWIFT, - /** - * An enum member indicating that [WireNetwork] 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) { - FEDWIRE -> Value.FEDWIRE - SWIFT -> Value.SWIFT - 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 LithicInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - FEDWIRE -> Known.FEDWIRE - SWIFT -> Known.SWIFT - else -> throw LithicInvalidDataException("Unknown WireNetwork: $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 LithicInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): WireNetwork = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 WireNetwork && 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 WireMethodAttributes && - wireNetwork == other.wireNetwork && - creditor == other.creditor && - debtor == other.debtor && - messageId == other.messageId && - remittanceInformation == other.remittanceInformation && - wireMessageType == other.wireMessageType && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - wireNetwork, - creditor, - debtor, - messageId, - remittanceInformation, - wireMessageType, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "WireMethodAttributes{wireNetwork=$wireNetwork, creditor=$creditor, debtor=$debtor, messageId=$messageId, remittanceInformation=$remittanceInformation, wireMessageType=$wireMessageType, additionalProperties=$additionalProperties}" - } - } - - /** Related account tokens for the transaction */ - class RelatedAccountTokens - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val accountToken: JsonField, - private val businessAccountToken: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("account_token") - @ExcludeMissing - accountToken: JsonField = JsonMissing.of(), - @JsonProperty("business_account_token") - @ExcludeMissing - businessAccountToken: JsonField = JsonMissing.of(), - ) : this(accountToken, businessAccountToken, mutableMapOf()) - - /** - * Globally unique identifier for the account - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun accountToken(): Optional = accountToken.getOptional("account_token") - - /** - * Globally unique identifier for the business account - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun businessAccountToken(): Optional = - businessAccountToken.getOptional("business_account_token") - - /** - * Returns the raw JSON value of [accountToken]. - * - * Unlike [accountToken], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("account_token") - @ExcludeMissing - fun _accountToken(): JsonField = accountToken - - /** - * Returns the raw JSON value of [businessAccountToken]. - * - * Unlike [businessAccountToken], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("business_account_token") - @ExcludeMissing - fun _businessAccountToken(): JsonField = businessAccountToken - - @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 [RelatedAccountTokens]. - * - * The following fields are required: - * ```java - * .accountToken() - * .businessAccountToken() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [RelatedAccountTokens]. */ - class Builder internal constructor() { - - private var accountToken: JsonField? = null - private var businessAccountToken: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(relatedAccountTokens: RelatedAccountTokens) = apply { - accountToken = relatedAccountTokens.accountToken - businessAccountToken = relatedAccountTokens.businessAccountToken - additionalProperties = relatedAccountTokens.additionalProperties.toMutableMap() - } - - /** Globally unique identifier for the account */ - fun accountToken(accountToken: String?) = - accountToken(JsonField.ofNullable(accountToken)) - - /** Alias for calling [Builder.accountToken] with `accountToken.orElse(null)`. */ - fun accountToken(accountToken: Optional) = - accountToken(accountToken.getOrNull()) - - /** - * Sets [Builder.accountToken] to an arbitrary JSON value. - * - * You should usually call [Builder.accountToken] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun accountToken(accountToken: JsonField) = apply { - this.accountToken = accountToken - } - - /** Globally unique identifier for the business account */ - fun businessAccountToken(businessAccountToken: String?) = - businessAccountToken(JsonField.ofNullable(businessAccountToken)) - - /** - * Alias for calling [Builder.businessAccountToken] with - * `businessAccountToken.orElse(null)`. - */ - fun businessAccountToken(businessAccountToken: Optional) = - businessAccountToken(businessAccountToken.getOrNull()) - - /** - * Sets [Builder.businessAccountToken] to an arbitrary JSON value. - * - * You should usually call [Builder.businessAccountToken] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun businessAccountToken(businessAccountToken: JsonField) = apply { - this.businessAccountToken = businessAccountToken - } - - 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 [RelatedAccountTokens]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .accountToken() - * .businessAccountToken() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): RelatedAccountTokens = - RelatedAccountTokens( - checkRequired("accountToken", accountToken), - checkRequired("businessAccountToken", businessAccountToken), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): RelatedAccountTokens = apply { - if (validated) { - return@apply - } - - accountToken() - businessAccountToken() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 (accountToken.asKnown().isPresent) 1 else 0) + - (if (businessAccountToken.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is RelatedAccountTokens && - accountToken == other.accountToken && - businessAccountToken == other.businessAccountToken && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(accountToken, businessAccountToken, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "RelatedAccountTokens{accountToken=$accountToken, businessAccountToken=$businessAccountToken, additionalProperties=$additionalProperties}" - } - - /** Transaction result */ - class TransactionResult - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** Alias for calling [Builder.network] with `network.orElse(null)`. */ + fun network(network: Optional) = network(network.getOrNull()) /** - * Returns this class instance's raw value. + * Sets [Builder.network] to an arbitrary JSON value. * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. + * You should usually call [Builder.network] with a well-typed [Transaction.Network] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val APPROVED = of("APPROVED") - - @JvmField val DECLINED = of("DECLINED") - - @JvmStatic fun of(value: String) = TransactionResult(JsonField.of(value)) - } - - /** An enum containing [TransactionResult]'s known values. */ - enum class Known { - APPROVED, - DECLINED, - } + fun network(network: JsonField) = apply { this.network = network } /** - * An enum containing [TransactionResult]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [TransactionResult] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. + * Network-provided score assessing risk level associated with a given authorization. + * Scores are on a range of 0-999, with 0 representing the lowest risk and 999 + * representing the highest risk. For Visa transactions, where the raw score has a range + * of 0-99, Lithic will normalize the score by multiplying the raw score by 10x. */ - enum class Value { - APPROVED, - DECLINED, - /** - * An enum member indicating that [TransactionResult] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } + fun networkRiskScore(networkRiskScore: Long?) = + networkRiskScore(JsonField.ofNullable(networkRiskScore)) /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * Alias for [Builder.networkRiskScore]. * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. + * This unboxed primitive overload exists for backwards compatibility. */ - fun value(): Value = - when (this) { - APPROVED -> Value.APPROVED - DECLINED -> Value.DECLINED - else -> Value._UNKNOWN - } + fun networkRiskScore(networkRiskScore: Long) = + networkRiskScore(networkRiskScore as Long?) /** - * 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 LithicInvalidDataException if this class instance's value is a not a known - * member. + * Alias for calling [Builder.networkRiskScore] with `networkRiskScore.orElse(null)`. */ - fun known(): Known = - when (this) { - APPROVED -> Known.APPROVED - DECLINED -> Known.DECLINED - else -> throw LithicInvalidDataException("Unknown TransactionResult: $value") - } + fun networkRiskScore(networkRiskScore: Optional) = + networkRiskScore(networkRiskScore.getOrNull()) /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. + * Sets [Builder.networkRiskScore] to an arbitrary JSON value. * - * @throws LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. + * 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 asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): TransactionResult = apply { - if (validated) { - return@apply - } - - known() - validated = true + fun networkRiskScore(networkRiskScore: JsonField) = apply { + this.networkRiskScore = networkRiskScore } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } + fun pos(pos: Transaction.Pos) = pos(JsonField.of(pos)) /** - * Returns a score indicating how many valid values are contained in this object - * recursively. + * Sets [Builder.pos] to an arbitrary JSON value. * - * Used for best match union deserialization. + * You should usually call [Builder.pos] with a well-typed [Transaction.Pos] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + fun pos(pos: JsonField) = apply { this.pos = pos } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun result(result: Transaction.DeclineResult) = result(JsonField.of(result)) - return other is TransactionResult && value == other.value + /** + * Sets [Builder.result] to an arbitrary JSON value. + * + * You should usually call [Builder.result] with a well-typed + * [Transaction.DeclineResult] 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 } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** Transaction source */ - class Source @JsonCreator private constructor(private val value: JsonField) : Enum { + /** The settled amount of the transaction in the settlement currency. */ + @Deprecated("deprecated") + fun settledAmount(settledAmount: Long) = settledAmount(JsonField.of(settledAmount)) /** - * Returns this class instance's raw value. + * Sets [Builder.settledAmount] to an arbitrary JSON value. * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. + * You should usually call [Builder.settledAmount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @Deprecated("deprecated") + fun settledAmount(settledAmount: JsonField) = apply { + this.settledAmount = settledAmount + } - companion object { + /** Status of the transaction. */ + fun status(status: Transaction.Status) = status(JsonField.of(status)) - @JvmField val LITHIC = of("LITHIC") + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Transaction.Status] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun status(status: JsonField) = apply { this.status = status } - @JvmField val EXTERNAL = of("EXTERNAL") + fun tokenInfo(tokenInfo: Transaction.TokenInfo?) = + tokenInfo(JsonField.ofNullable(tokenInfo)) - @JvmField val CUSTOMER = of("CUSTOMER") + /** Alias for calling [Builder.tokenInfo] with `tokenInfo.orElse(null)`. */ + fun tokenInfo(tokenInfo: Optional) = + tokenInfo(tokenInfo.getOrNull()) - @JvmStatic fun of(value: String) = Source(JsonField.of(value)) + /** + * Sets [Builder.tokenInfo] to an arbitrary JSON value. + * + * You should usually call [Builder.tokenInfo] with a well-typed [Transaction.TokenInfo] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun tokenInfo(tokenInfo: JsonField) = apply { + this.tokenInfo = tokenInfo } - /** An enum containing [Source]'s known values. */ - enum class Known { - LITHIC, - EXTERNAL, - CUSTOMER, - } + /** Date and time when the transaction last updated. UTC time zone. */ + fun updated(updated: OffsetDateTime) = updated(JsonField.of(updated)) /** - * An enum containing [Source]'s known values, as well as an [_UNKNOWN] member. + * Sets [Builder.updated] to an arbitrary JSON value. * - * An instance of [Source] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. + * You should usually call [Builder.updated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - enum class Value { - LITHIC, - EXTERNAL, - CUSTOMER, - /** - * An enum member indicating that [Source] was instantiated with an unknown value. - */ - _UNKNOWN, - } + fun updated(updated: JsonField) = apply { this.updated = updated } + + fun events(events: List) = events(JsonField.of(events)) /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * Sets [Builder.events] to an arbitrary JSON value. * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. + * You should usually call [Builder.events] with a well-typed + * `List` value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. */ - fun value(): Value = - when (this) { - LITHIC -> Value.LITHIC - EXTERNAL -> Value.EXTERNAL - CUSTOMER -> Value.CUSTOMER - else -> Value._UNKNOWN - } + fun events(events: JsonField>) = apply { + this.events = events.map { it.toMutableList() } + } /** - * 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. + * Adds a single [Transaction.TransactionEvent] to [events]. * - * @throws LithicInvalidDataException if this class instance's value is a not a known - * member. + * @throws IllegalStateException if the field was previously set to a non-list. */ - fun known(): Known = - when (this) { - LITHIC -> Known.LITHIC - EXTERNAL -> Known.EXTERNAL - CUSTOMER -> Known.CUSTOMER - else -> throw LithicInvalidDataException("Unknown Source: $value") - } + fun addEvent(event: Transaction.TransactionEvent) = apply { + events = + (events ?: JsonField.of(mutableListOf())).also { + checkKnown("events", it).add(event) + } + } + + /** CARD - Card Transaction */ + fun family(family: Family) = family(JsonField.of(family)) /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. + * Sets [Builder.family] to an arbitrary JSON value. * - * @throws LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. + * You should usually call [Builder.family] with a well-typed [Family] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } + fun family(family: JsonField) = apply { this.family = family } - private var validated: Boolean = false + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun validate(): Source = apply { - if (validated) { - return@apply - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - known() - validated = true + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } /** - * Returns a score indicating how many valid values are contained in this object - * recursively. + * Returns an immutable instance of [CardTransaction]. * - * Used for best match union deserialization. + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .token() + * .accountToken() + * .acquirerFee() + * .acquirerReferenceNumber() + * .amount() + * .amounts() + * .authorizationAmount() + * .authorizationCode() + * .avs() + * .cardToken() + * .cardholderAuthentication() + * .created() + * .financialAccountToken() + * .merchant() + * .merchantAmount() + * .merchantAuthorizationAmount() + * .merchantCurrency() + * .network() + * .networkRiskScore() + * .pos() + * .result() + * .settledAmount() + * .status() + * .tokenInfo() + * .updated() + * ``` + * + * @throws IllegalStateException if any required field is unset. */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + fun build(): CardTransaction = + CardTransaction( + checkRequired("token", token), + checkRequired("accountToken", accountToken), + checkRequired("acquirerFee", acquirerFee), + checkRequired("acquirerReferenceNumber", acquirerReferenceNumber), + checkRequired("amount", amount), + checkRequired("amounts", amounts), + checkRequired("authorizationAmount", authorizationAmount), + checkRequired("authorizationCode", authorizationCode), + checkRequired("avs", avs), + checkRequired("cardToken", cardToken), + checkRequired("cardholderAuthentication", cardholderAuthentication), + checkRequired("created", created), + checkRequired("financialAccountToken", financialAccountToken), + checkRequired("merchant", merchant), + checkRequired("merchantAmount", merchantAmount), + checkRequired("merchantAuthorizationAmount", merchantAuthorizationAmount), + checkRequired("merchantCurrency", merchantCurrency), + checkRequired("network", network), + checkRequired("networkRiskScore", networkRiskScore), + checkRequired("pos", pos), + checkRequired("result", result), + checkRequired("settledAmount", settledAmount), + checkRequired("status", status), + checkRequired("tokenInfo", tokenInfo), + checkRequired("updated", updated), + (events ?: JsonMissing.of()).map { it.toImmutable() }, + family, + additionalProperties.toMutableMap(), + ) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + private var validated: Boolean = false - return other is Source && value == other.value + fun validate(): CardTransaction = apply { + if (validated) { + return@apply } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() + token() + accountToken() + acquirerFee() + acquirerReferenceNumber() + amount() + amounts().validate() + authorizationAmount() + authorizationCode() + avs().ifPresent { it.validate() } + cardToken() + cardholderAuthentication().ifPresent { it.validate() } + created() + financialAccountToken() + merchant().validate() + merchantAmount() + merchantAuthorizationAmount() + merchantCurrency() + network().ifPresent { it.validate() } + networkRiskScore() + pos().validate() + result().validate() + settledAmount() + status().validate() + tokenInfo().ifPresent { it.validate() } + updated() + events().ifPresent { it.forEach { it.validate() } } + family().ifPresent { it.validate() } + validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 (token.asKnown().isPresent) 1 else 0) + + (if (accountToken.asKnown().isPresent) 1 else 0) + + (if (acquirerFee.asKnown().isPresent) 1 else 0) + + (if (acquirerReferenceNumber.asKnown().isPresent) 1 else 0) + + (if (amount.asKnown().isPresent) 1 else 0) + + (amounts.asKnown().getOrNull()?.validity() ?: 0) + + (if (authorizationAmount.asKnown().isPresent) 1 else 0) + + (if (authorizationCode.asKnown().isPresent) 1 else 0) + + (avs.asKnown().getOrNull()?.validity() ?: 0) + + (if (cardToken.asKnown().isPresent) 1 else 0) + + (cardholderAuthentication.asKnown().getOrNull()?.validity() ?: 0) + + (if (created.asKnown().isPresent) 1 else 0) + + (if (financialAccountToken.asKnown().isPresent) 1 else 0) + + (merchant.asKnown().getOrNull()?.validity() ?: 0) + + (if (merchantAmount.asKnown().isPresent) 1 else 0) + + (if (merchantAuthorizationAmount.asKnown().isPresent) 1 else 0) + + (if (merchantCurrency.asKnown().isPresent) 1 else 0) + + (network.asKnown().getOrNull()?.validity() ?: 0) + + (if (networkRiskScore.asKnown().isPresent) 1 else 0) + + (pos.asKnown().getOrNull()?.validity() ?: 0) + + (result.asKnown().getOrNull()?.validity() ?: 0) + + (if (settledAmount.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (tokenInfo.asKnown().getOrNull()?.validity() ?: 0) + + (if (updated.asKnown().isPresent) 1 else 0) + + (events.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (family.asKnown().getOrNull()?.validity() ?: 0) + /** The status of the transaction */ class TransactionStatus @JsonCreator @@ -12084,8 +4285,8 @@ private constructor( override fun toString() = value.toString() } - class TransferType @JsonCreator private constructor(private val value: JsonField) : - Enum { + /** CARD - Card Transaction */ + class Family @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -12099,58 +4300,29 @@ private constructor( companion object { - @JvmField val ORIGINATION_CREDIT = of("ORIGINATION_CREDIT") - - @JvmField val ORIGINATION_DEBIT = of("ORIGINATION_DEBIT") - - @JvmField val RECEIPT_CREDIT = of("RECEIPT_CREDIT") - - @JvmField val RECEIPT_DEBIT = of("RECEIPT_DEBIT") - - @JvmField val WIRE_INBOUND_PAYMENT = of("WIRE_INBOUND_PAYMENT") - - @JvmField val WIRE_INBOUND_ADMIN = of("WIRE_INBOUND_ADMIN") - - @JvmField val WIRE_OUTBOUND_PAYMENT = of("WIRE_OUTBOUND_PAYMENT") - - @JvmField val WIRE_OUTBOUND_ADMIN = of("WIRE_OUTBOUND_ADMIN") + @JvmField val CARD = of("CARD") - @JvmStatic fun of(value: String) = TransferType(JsonField.of(value)) + @JvmStatic fun of(value: String) = Family(JsonField.of(value)) } - /** An enum containing [TransferType]'s known values. */ + /** An enum containing [Family]'s known values. */ enum class Known { - ORIGINATION_CREDIT, - ORIGINATION_DEBIT, - RECEIPT_CREDIT, - RECEIPT_DEBIT, - WIRE_INBOUND_PAYMENT, - WIRE_INBOUND_ADMIN, - WIRE_OUTBOUND_PAYMENT, - WIRE_OUTBOUND_ADMIN, + CARD } /** - * An enum containing [TransferType]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [Family]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [TransferType] can contain an unknown value in a couple of cases: + * An instance of [Family] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, if * the SDK is on an older version than the API, then 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 { - ORIGINATION_CREDIT, - ORIGINATION_DEBIT, - RECEIPT_CREDIT, - RECEIPT_DEBIT, - WIRE_INBOUND_PAYMENT, - WIRE_INBOUND_ADMIN, - WIRE_OUTBOUND_PAYMENT, - WIRE_OUTBOUND_ADMIN, + CARD, /** - * An enum member indicating that [TransferType] was instantiated with an unknown - * value. + * An enum member indicating that [Family] was instantiated with an unknown value. */ _UNKNOWN, } @@ -12164,14 +4336,7 @@ private constructor( */ fun value(): Value = when (this) { - ORIGINATION_CREDIT -> Value.ORIGINATION_CREDIT - ORIGINATION_DEBIT -> Value.ORIGINATION_DEBIT - RECEIPT_CREDIT -> Value.RECEIPT_CREDIT - RECEIPT_DEBIT -> Value.RECEIPT_DEBIT - WIRE_INBOUND_PAYMENT -> Value.WIRE_INBOUND_PAYMENT - WIRE_INBOUND_ADMIN -> Value.WIRE_INBOUND_ADMIN - WIRE_OUTBOUND_PAYMENT -> Value.WIRE_OUTBOUND_PAYMENT - WIRE_OUTBOUND_ADMIN -> Value.WIRE_OUTBOUND_ADMIN + CARD -> Value.CARD else -> Value._UNKNOWN } @@ -12186,15 +4351,8 @@ private constructor( */ fun known(): Known = when (this) { - ORIGINATION_CREDIT -> Known.ORIGINATION_CREDIT - ORIGINATION_DEBIT -> Known.ORIGINATION_DEBIT - RECEIPT_CREDIT -> Known.RECEIPT_CREDIT - RECEIPT_DEBIT -> Known.RECEIPT_DEBIT - WIRE_INBOUND_PAYMENT -> Known.WIRE_INBOUND_PAYMENT - WIRE_INBOUND_ADMIN -> Known.WIRE_INBOUND_ADMIN - WIRE_OUTBOUND_PAYMENT -> Known.WIRE_OUTBOUND_PAYMENT - WIRE_OUTBOUND_ADMIN -> Known.WIRE_OUTBOUND_ADMIN - else -> throw LithicInvalidDataException("Unknown TransferType: $value") + CARD -> Known.CARD + else -> throw LithicInvalidDataException("Unknown Family: $value") } /** @@ -12213,7 +4371,7 @@ private constructor( private var validated: Boolean = false - fun validate(): TransferType = apply { + fun validate(): Family = apply { if (validated) { return@apply } @@ -12243,7 +4401,7 @@ private constructor( return true } - return other is TransferType && value == other.value + return other is Family && value == other.value } override fun hashCode() = value.hashCode() @@ -12256,56 +4414,66 @@ private constructor( return true } - return other is PaymentTransaction && + return other is CardTransaction && token == other.token && - category == other.category && + accountToken == other.accountToken && + acquirerFee == other.acquirerFee && + acquirerReferenceNumber == other.acquirerReferenceNumber && + amount == other.amount && + amounts == other.amounts && + authorizationAmount == other.authorizationAmount && + authorizationCode == other.authorizationCode && + avs == other.avs && + cardToken == other.cardToken && + cardholderAuthentication == other.cardholderAuthentication && created == other.created && - descriptor == other.descriptor && - direction == other.direction && - events == other.events && - family == other.family && financialAccountToken == other.financialAccountToken && - method == other.method && - methodAttributes == other.methodAttributes && - pendingAmount == other.pendingAmount && - relatedAccountTokens == other.relatedAccountTokens && + merchant == other.merchant && + merchantAmount == other.merchantAmount && + merchantAuthorizationAmount == other.merchantAuthorizationAmount && + merchantCurrency == other.merchantCurrency && + network == other.network && + networkRiskScore == other.networkRiskScore && + pos == other.pos && result == other.result && settledAmount == other.settledAmount && - source == other.source && status == other.status && + tokenInfo == other.tokenInfo && updated == other.updated && - currency == other.currency && - expectedReleaseDate == other.expectedReleaseDate && - externalBankAccountToken == other.externalBankAccountToken && - type == other.type && - userDefinedId == other.userDefinedId && + events == other.events && + family == other.family && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { Objects.hash( token, - category, + accountToken, + acquirerFee, + acquirerReferenceNumber, + amount, + amounts, + authorizationAmount, + authorizationCode, + avs, + cardToken, + cardholderAuthentication, created, - descriptor, - direction, - events, - family, financialAccountToken, - method, - methodAttributes, - pendingAmount, - relatedAccountTokens, + merchant, + merchantAmount, + merchantAuthorizationAmount, + merchantCurrency, + network, + networkRiskScore, + pos, result, settledAmount, - source, status, + tokenInfo, updated, - currency, - expectedReleaseDate, - externalBankAccountToken, - type, - userDefinedId, + events, + family, additionalProperties, ) } @@ -12313,6 +4481,6 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PaymentTransaction{token=$token, category=$category, created=$created, descriptor=$descriptor, direction=$direction, events=$events, family=$family, financialAccountToken=$financialAccountToken, method=$method, methodAttributes=$methodAttributes, pendingAmount=$pendingAmount, relatedAccountTokens=$relatedAccountTokens, result=$result, settledAmount=$settledAmount, source=$source, status=$status, updated=$updated, currency=$currency, expectedReleaseDate=$expectedReleaseDate, externalBankAccountToken=$externalBankAccountToken, type=$type, userDefinedId=$userDefinedId, additionalProperties=$additionalProperties}" + "CardTransaction{token=$token, accountToken=$accountToken, acquirerFee=$acquirerFee, acquirerReferenceNumber=$acquirerReferenceNumber, amount=$amount, amounts=$amounts, authorizationAmount=$authorizationAmount, authorizationCode=$authorizationCode, avs=$avs, cardToken=$cardToken, cardholderAuthentication=$cardholderAuthentication, created=$created, financialAccountToken=$financialAccountToken, merchant=$merchant, merchantAmount=$merchantAmount, merchantAuthorizationAmount=$merchantAuthorizationAmount, merchantCurrency=$merchantCurrency, network=$network, networkRiskScore=$networkRiskScore, pos=$pos, result=$result, settledAmount=$settledAmount, status=$status, tokenInfo=$tokenInfo, updated=$updated, events=$events, family=$family, additionalProperties=$additionalProperties}" } } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleCondition.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleCondition.kt index 3d64f8ddc..5bcc304e5 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleCondition.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleCondition.kt @@ -88,6 +88,9 @@ private constructor( * * `WALLET_TYPE`: For transactions using a digital wallet token, indicates the source of the * token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, * `OTHER`, `NONE`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address data with the + * cardholder KYC data if it exists. Valid values are `MATCH`, `MATCH_ADDRESS_ONLY`, + * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -210,6 +213,9 @@ private constructor( * * `WALLET_TYPE`: For transactions using a digital wallet token, indicates the source of * the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, `SAMSUNG_PAY`, `MASTERPASS`, * `MERCHANT`, `OTHER`, `NONE`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address data with + * the cardholder KYC data if it exists. Valid values are `MATCH`, `MATCH_ADDRESS_ONLY`, + * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ fun attribute(attribute: ConditionalAttribute) = attribute(JsonField.of(attribute)) diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2CreateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2CreateParams.kt index 6d268ea1d..c4fa7deaa 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2CreateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2CreateParams.kt @@ -1810,6 +1810,10 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's + * address data with the cardholder KYC data if it exists. Valid values + * are `MATCH`, `MATCH_ADDRESS_ONLY`, + * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. * * @throws LithicInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -1957,6 +1961,10 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's + * address data with the cardholder KYC data if it exists. Valid + * values are `MATCH`, `MATCH_ADDRESS_ONLY`, + * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ fun attribute(attribute: Attribute) = attribute(JsonField.of(attribute)) @@ -2134,6 +2142,10 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's + * address data with the cardholder KYC data if it exists. Valid values + * are `MATCH`, `MATCH_ADDRESS_ONLY`, + * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ class Attribute @JsonCreator @@ -2191,6 +2203,8 @@ private constructor( @JvmField val TRANSACTION_INITIATOR = of("TRANSACTION_INITIATOR") + @JvmField val ADDRESS_MATCH = of("ADDRESS_MATCH") + @JvmStatic fun of(value: String) = Attribute(JsonField.of(value)) } @@ -2214,6 +2228,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, } /** @@ -2246,6 +2261,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, /** * An enum member indicating that [Attribute] was instantiated with * an unknown value. @@ -2281,6 +2297,7 @@ private constructor( PIN_STATUS -> Value.PIN_STATUS WALLET_TYPE -> Value.WALLET_TYPE TRANSACTION_INITIATOR -> Value.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Value.ADDRESS_MATCH else -> Value._UNKNOWN } @@ -2313,6 +2330,7 @@ private constructor( PIN_STATUS -> Known.PIN_STATUS WALLET_TYPE -> Known.WALLET_TYPE TRANSACTION_INITIATOR -> Known.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Known.ADDRESS_MATCH else -> throw LithicInvalidDataException( "Unknown Attribute: $value" @@ -4319,6 +4337,10 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's + * address data with the cardholder KYC data if it exists. Valid values + * are `MATCH`, `MATCH_ADDRESS_ONLY`, + * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. * * @throws LithicInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -4466,6 +4488,10 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's + * address data with the cardholder KYC data if it exists. Valid + * values are `MATCH`, `MATCH_ADDRESS_ONLY`, + * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ fun attribute(attribute: Attribute) = attribute(JsonField.of(attribute)) @@ -4643,6 +4669,10 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's + * address data with the cardholder KYC data if it exists. Valid values + * are `MATCH`, `MATCH_ADDRESS_ONLY`, + * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ class Attribute @JsonCreator @@ -4700,6 +4730,8 @@ private constructor( @JvmField val TRANSACTION_INITIATOR = of("TRANSACTION_INITIATOR") + @JvmField val ADDRESS_MATCH = of("ADDRESS_MATCH") + @JvmStatic fun of(value: String) = Attribute(JsonField.of(value)) } @@ -4723,6 +4755,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, } /** @@ -4755,6 +4788,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, /** * An enum member indicating that [Attribute] was instantiated with * an unknown value. @@ -4790,6 +4824,7 @@ private constructor( PIN_STATUS -> Value.PIN_STATUS WALLET_TYPE -> Value.WALLET_TYPE TRANSACTION_INITIATOR -> Value.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Value.ADDRESS_MATCH else -> Value._UNKNOWN } @@ -4822,6 +4857,7 @@ private constructor( PIN_STATUS -> Known.PIN_STATUS WALLET_TYPE -> Known.WALLET_TYPE TRANSACTION_INITIATOR -> Known.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Known.ADDRESS_MATCH else -> throw LithicInvalidDataException( "Unknown Attribute: $value" @@ -6872,6 +6908,10 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's + * address data with the cardholder KYC data if it exists. Valid values + * are `MATCH`, `MATCH_ADDRESS_ONLY`, + * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. * * @throws LithicInvalidDataException if the JSON field has an unexpected * type (e.g. if the server responded with an unexpected value). @@ -7019,6 +7059,10 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's + * address data with the cardholder KYC data if it exists. Valid + * values are `MATCH`, `MATCH_ADDRESS_ONLY`, + * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ fun attribute(attribute: Attribute) = attribute(JsonField.of(attribute)) @@ -7196,6 +7240,10 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's + * address data with the cardholder KYC data if it exists. Valid values + * are `MATCH`, `MATCH_ADDRESS_ONLY`, + * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ class Attribute @JsonCreator @@ -7253,6 +7301,8 @@ private constructor( @JvmField val TRANSACTION_INITIATOR = of("TRANSACTION_INITIATOR") + @JvmField val ADDRESS_MATCH = of("ADDRESS_MATCH") + @JvmStatic fun of(value: String) = Attribute(JsonField.of(value)) } @@ -7276,6 +7326,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, } /** @@ -7308,6 +7359,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, /** * An enum member indicating that [Attribute] was instantiated with * an unknown value. @@ -7343,6 +7395,7 @@ private constructor( PIN_STATUS -> Value.PIN_STATUS WALLET_TYPE -> Value.WALLET_TYPE TRANSACTION_INITIATOR -> Value.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Value.ADDRESS_MATCH else -> Value._UNKNOWN } @@ -7375,6 +7428,7 @@ private constructor( PIN_STATUS -> Known.PIN_STATUS WALLET_TYPE -> Known.WALLET_TYPE TRANSACTION_INITIATOR -> Known.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Known.ADDRESS_MATCH else -> throw LithicInvalidDataException( "Unknown Attribute: $value" diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2DraftParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2DraftParams.kt index e19fa4aa5..ffbb84f7c 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2DraftParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2DraftParams.kt @@ -1213,6 +1213,9 @@ private constructor( * `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`. * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction indicates * the source of the token. Valid values are `CARDHOLDER`, `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -1349,6 +1352,9 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ fun attribute(attribute: Attribute) = attribute(JsonField.of(attribute)) @@ -1514,6 +1520,9 @@ private constructor( * `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`. * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction indicates * the source of the token. Valid values are `CARDHOLDER`, `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ class Attribute @JsonCreator @@ -1568,6 +1577,8 @@ private constructor( @JvmField val TRANSACTION_INITIATOR = of("TRANSACTION_INITIATOR") + @JvmField val ADDRESS_MATCH = of("ADDRESS_MATCH") + @JvmStatic fun of(value: String) = Attribute(JsonField.of(value)) } @@ -1591,6 +1602,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, } /** @@ -1622,6 +1634,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, /** * An enum member indicating that [Attribute] was instantiated with an * unknown value. @@ -1656,6 +1669,7 @@ private constructor( PIN_STATUS -> Value.PIN_STATUS WALLET_TYPE -> Value.WALLET_TYPE TRANSACTION_INITIATOR -> Value.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Value.ADDRESS_MATCH else -> Value._UNKNOWN } @@ -1688,6 +1702,7 @@ private constructor( PIN_STATUS -> Known.PIN_STATUS WALLET_TYPE -> Known.WALLET_TYPE TRANSACTION_INITIATOR -> Known.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Known.ADDRESS_MATCH else -> throw LithicInvalidDataException("Unknown Attribute: $value") } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ReportParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ReportParams.kt deleted file mode 100644 index 79fc2c43f..000000000 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ReportParams.kt +++ /dev/null @@ -1,281 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.lithic.api.models - -import com.lithic.api.core.JsonValue -import com.lithic.api.core.Params -import com.lithic.api.core.http.Headers -import com.lithic.api.core.http.QueryParams -import com.lithic.api.core.toImmutable -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** - * This endpoint is deprecated and will be removed in the future. Requests a performance report of - * an Auth rule to be asynchronously generated. Reports can only be run on rules in draft or active - * mode and will included approved and declined statistics as well as examples. The generated report - * will be delivered asynchronously through a webhook with `event_type` = - * `auth_rules.performance_report.created`. See the docs on setting up - * [webhook subscriptions](https://docs.lithic.com/docs/events-api). - * - * Reports are generated based on data collected by Lithic's processing system in the trailing week. - * The performance of the auth rule will be assessed on the configuration of the auth rule at the - * time the report is requested. This implies that if a performance report is requested, right after - * updating an auth rule, depending on the number of events processed for a card program, it may be - * the case that no data is available for the report. Therefore Lithic recommends to decouple making - * updates to an Auth Rule, and requesting performance reports. - * - * To make this concrete, consider the following example: - * 1. At time `t`, a new Auth Rule is created, and applies to all auth events on a card program. The - * Auth Rule has not yet been promoted, causing the draft version of the rule to be applied in - * shadow mode. - * 2. At time `t + 1 hour` a performance report is requested for the Auth Rule. This performance - * report will *only* contain data for the Auth Rule being executed in the window between `t` and - * `t + 1 hour`. This is because Lithic's transaction processing system will only start capturing - * data for the Auth Rule at the time it is created. - * 3. At time `t + 2 hours` the draft version of the Auth Rule is promoted to the active version of - * the Auth Rule by calling the `/v2/auth_rules/{auth_rule_token}/promote` endpoint. If a - * performance report is requested at this moment it will still only contain data for this - * version of the rule, but the window of available data will now span from `t` to `t + 2 hours`. - * 4. At time `t + 3 hours` a new version of the rule is drafted by calling the - * `/v2/auth_rules/{auth_rule_token}/draft` endpoint. If a performance report is requested right - * at this moment, it will only contain data for events to which both the active version and the - * draft version is applied. Lithic does this to ensure that performance reports represent a fair - * comparison between rules. Because there may be no events in this window, and because there may - * be some lag before data is available in a performance report, the requested performance report - * could contain no to little data. - * 5. At time `t + 4 hours` another performance report is requested: this time the performance - * report will contain data from the window between `t + 3 hours` and `t + 4 hours`, for any - * events to which both the current version of the Auth rule (in enforcing mode) and the draft - * version of the Auth rule (in shadow mode) applied. - * - * Note that generating a report may take up to 15 minutes and that delivery is not guaranteed. - * Customers are required to have created an event subscription to receive the webhook. - * Additionally, there is a delay of approximately 15 minutes between when Lithic's transaction - * processing systems have processed the transaction, and when a transaction will be included in the - * report. - */ -@Deprecated("deprecated") -class AuthRuleV2ReportParams -private constructor( - private val authRuleToken: String?, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, -) : Params { - - fun authRuleToken(): Optional = Optional.ofNullable(authRuleToken) - - /** Additional body properties to send with the request. */ - fun _additionalBodyProperties(): Map = additionalBodyProperties - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun none(): AuthRuleV2ReportParams = builder().build() - - /** Returns a mutable builder for constructing an instance of [AuthRuleV2ReportParams]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [AuthRuleV2ReportParams]. */ - class Builder internal constructor() { - - private var authRuleToken: String? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(authRuleV2ReportParams: AuthRuleV2ReportParams) = apply { - authRuleToken = authRuleV2ReportParams.authRuleToken - additionalHeaders = authRuleV2ReportParams.additionalHeaders.toBuilder() - additionalQueryParams = authRuleV2ReportParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - authRuleV2ReportParams.additionalBodyProperties.toMutableMap() - } - - fun authRuleToken(authRuleToken: String?) = apply { this.authRuleToken = authRuleToken } - - /** Alias for calling [Builder.authRuleToken] with `authRuleToken.orElse(null)`. */ - fun authRuleToken(authRuleToken: Optional) = - authRuleToken(authRuleToken.getOrNull()) - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) - } - - /** - * Returns an immutable instance of [AuthRuleV2ReportParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): AuthRuleV2ReportParams = - AuthRuleV2ReportParams( - authRuleToken, - additionalHeaders.build(), - additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), - ) - } - - fun _body(): Optional> = - Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - - fun _pathParam(index: Int): String = - when (index) { - 0 -> authRuleToken ?: "" - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is AuthRuleV2ReportParams && - authRuleToken == other.authRuleToken && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams && - additionalBodyProperties == other.additionalBodyProperties - } - - override fun hashCode(): Int = - Objects.hash( - authRuleToken, - additionalHeaders, - additionalQueryParams, - additionalBodyProperties, - ) - - override fun toString() = - "AuthRuleV2ReportParams{authRuleToken=$authRuleToken, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" -} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthenticationRetrieveResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthenticationRetrieveResponse.kt index 5a763ba2e..799e4c552 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthenticationRetrieveResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthenticationRetrieveResponse.kt @@ -1517,6 +1517,7 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val addressMatch: JsonField, + private val addressOnFileMatch: JsonField, private val billingAddress: JsonField, private val email: JsonField, private val name: JsonField, @@ -1532,6 +1533,9 @@ private constructor( @JsonProperty("address_match") @ExcludeMissing addressMatch: JsonField = JsonMissing.of(), + @JsonProperty("address_on_file_match") + @ExcludeMissing + addressOnFileMatch: JsonField = JsonMissing.of(), @JsonProperty("billing_address") @ExcludeMissing billingAddress: JsonField = JsonMissing.of(), @@ -1551,6 +1555,7 @@ private constructor( shippingAddress: JsonField = JsonMissing.of(), ) : this( addressMatch, + addressOnFileMatch, billingAddress, email, name, @@ -1572,6 +1577,17 @@ private constructor( */ fun addressMatch(): Optional = addressMatch.getOptional("address_match") + /** + * Lithic's evaluation result comparing the transaction's address data with the cardholder + * KYC data if it exists. In the event Lithic does not have any Cardholder KYC data, or the + * transaction does not contain any address data, NOT_PRESENT will be returned + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun addressOnFileMatch(): Optional = + addressOnFileMatch.getOptional("address_on_file_match") + /** * Object containing data on the billing address provided during the transaction. * @@ -1645,6 +1661,16 @@ private constructor( @ExcludeMissing fun _addressMatch(): JsonField = addressMatch + /** + * Returns the raw JSON value of [addressOnFileMatch]. + * + * Unlike [addressOnFileMatch], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("address_on_file_match") + @ExcludeMissing + fun _addressOnFileMatch(): JsonField = addressOnFileMatch + /** * Returns the raw JSON value of [billingAddress]. * @@ -1731,6 +1757,7 @@ private constructor( class Builder internal constructor() { private var addressMatch: JsonField = JsonMissing.of() + private var addressOnFileMatch: JsonField = JsonMissing.of() private var billingAddress: JsonField = JsonMissing.of() private var email: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() @@ -1743,6 +1770,7 @@ private constructor( @JvmSynthetic internal fun from(cardholder: Cardholder) = apply { addressMatch = cardholder.addressMatch + addressOnFileMatch = cardholder.addressOnFileMatch billingAddress = cardholder.billingAddress email = cardholder.email name = cardholder.name @@ -1784,6 +1812,26 @@ private constructor( this.addressMatch = addressMatch } + /** + * Lithic's evaluation result comparing the transaction's address data with the + * cardholder KYC data if it exists. In the event Lithic does not have any Cardholder + * KYC data, or the transaction does not contain any address data, NOT_PRESENT will be + * returned + */ + fun addressOnFileMatch(addressOnFileMatch: AddressMatchResult) = + addressOnFileMatch(JsonField.of(addressOnFileMatch)) + + /** + * Sets [Builder.addressOnFileMatch] to an arbitrary JSON value. + * + * You should usually call [Builder.addressOnFileMatch] with a well-typed + * [AddressMatchResult] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun addressOnFileMatch(addressOnFileMatch: JsonField) = apply { + this.addressOnFileMatch = addressOnFileMatch + } + /** Object containing data on the billing address provided during the transaction. */ fun billingAddress(billingAddress: BillingAddress) = billingAddress(JsonField.of(billingAddress)) @@ -1942,6 +1990,7 @@ private constructor( fun build(): Cardholder = Cardholder( addressMatch, + addressOnFileMatch, billingAddress, email, name, @@ -1961,6 +2010,7 @@ private constructor( } addressMatch() + addressOnFileMatch().ifPresent { it.validate() } billingAddress().ifPresent { it.validate() } email() name() @@ -1988,6 +2038,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (addressMatch.asKnown().isPresent) 1 else 0) + + (addressOnFileMatch.asKnown().getOrNull()?.validity() ?: 0) + (billingAddress.asKnown().getOrNull()?.validity() ?: 0) + (if (email.asKnown().isPresent) 1 else 0) + (if (name.asKnown().isPresent) 1 else 0) + @@ -1996,6 +2047,163 @@ private constructor( (if (phoneNumberWork.asKnown().isPresent) 1 else 0) + (shippingAddress.asKnown().getOrNull()?.validity() ?: 0) + /** + * Lithic's evaluation result comparing the transaction's address data with the cardholder + * KYC data if it exists. In the event Lithic does not have any Cardholder KYC data, or the + * transaction does not contain any address data, NOT_PRESENT will be returned + */ + class AddressMatchResult + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val MATCH = of("MATCH") + + @JvmField val MATCH_ADDRESS_ONLY = of("MATCH_ADDRESS_ONLY") + + @JvmField val MATCH_ZIP_ONLY = of("MATCH_ZIP_ONLY") + + @JvmField val MISMATCH = of("MISMATCH") + + @JvmField val NOT_PRESENT = of("NOT_PRESENT") + + @JvmStatic fun of(value: String) = AddressMatchResult(JsonField.of(value)) + } + + /** An enum containing [AddressMatchResult]'s known values. */ + enum class Known { + MATCH, + MATCH_ADDRESS_ONLY, + MATCH_ZIP_ONLY, + MISMATCH, + NOT_PRESENT, + } + + /** + * An enum containing [AddressMatchResult]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [AddressMatchResult] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then 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 { + MATCH, + MATCH_ADDRESS_ONLY, + MATCH_ZIP_ONLY, + MISMATCH, + NOT_PRESENT, + /** + * An enum member indicating that [AddressMatchResult] 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) { + MATCH -> Value.MATCH + MATCH_ADDRESS_ONLY -> Value.MATCH_ADDRESS_ONLY + MATCH_ZIP_ONLY -> Value.MATCH_ZIP_ONLY + MISMATCH -> Value.MISMATCH + NOT_PRESENT -> Value.NOT_PRESENT + 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 LithicInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + MATCH -> Known.MATCH + MATCH_ADDRESS_ONLY -> Known.MATCH_ADDRESS_ONLY + MATCH_ZIP_ONLY -> Known.MATCH_ZIP_ONLY + MISMATCH -> Known.MISMATCH + NOT_PRESENT -> Known.NOT_PRESENT + else -> throw LithicInvalidDataException("Unknown AddressMatchResult: $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 LithicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): AddressMatchResult = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 AddressMatchResult && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + /** Object containing data on the billing address provided during the transaction. */ class BillingAddress @JsonCreator(mode = JsonCreator.Mode.DISABLED) @@ -2755,6 +2963,7 @@ private constructor( return other is Cardholder && addressMatch == other.addressMatch && + addressOnFileMatch == other.addressOnFileMatch && billingAddress == other.billingAddress && email == other.email && name == other.name && @@ -2768,6 +2977,7 @@ private constructor( private val hashCode: Int by lazy { Objects.hash( addressMatch, + addressOnFileMatch, billingAddress, email, name, @@ -2782,7 +2992,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Cardholder{addressMatch=$addressMatch, billingAddress=$billingAddress, email=$email, name=$name, phoneNumberHome=$phoneNumberHome, phoneNumberMobile=$phoneNumberMobile, phoneNumberWork=$phoneNumberWork, shippingAddress=$shippingAddress, additionalProperties=$additionalProperties}" + "Cardholder{addressMatch=$addressMatch, addressOnFileMatch=$addressOnFileMatch, billingAddress=$billingAddress, email=$email, name=$name, phoneNumberHome=$phoneNumberHome, phoneNumberMobile=$phoneNumberMobile, phoneNumberWork=$phoneNumberWork, shippingAddress=$shippingAddress, additionalProperties=$additionalProperties}" } /** Channel in which the authentication occurs. Maps to EMV 3DS field `deviceChannel`. */ diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/BookTransferResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/BookTransferResponse.kt index 4c619f4e2..d261530e4 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/BookTransferResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/BookTransferResponse.kt @@ -21,6 +21,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull +/** Book transfer transaction */ class BookTransferResponse @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( @@ -29,16 +30,17 @@ private constructor( private val created: JsonField, private val currency: JsonField, private val events: JsonField>, - private val externalId: JsonField, - private val externalResource: JsonField, + private val family: JsonField, private val fromFinancialAccountToken: JsonField, private val pendingAmount: JsonField, private val result: JsonField, private val settledAmount: JsonField, - private val status: JsonField, + private val status: JsonField, private val toFinancialAccountToken: JsonField, - private val transactionSeries: JsonField, private val updated: JsonField, + private val externalId: JsonField, + private val externalResource: JsonField, + private val transactionSeries: JsonField, private val additionalProperties: MutableMap, ) { @@ -55,12 +57,7 @@ private constructor( @JsonProperty("events") @ExcludeMissing events: JsonField> = JsonMissing.of(), - @JsonProperty("external_id") - @ExcludeMissing - externalId: JsonField = JsonMissing.of(), - @JsonProperty("external_resource") - @ExcludeMissing - externalResource: JsonField = JsonMissing.of(), + @JsonProperty("family") @ExcludeMissing family: JsonField = JsonMissing.of(), @JsonProperty("from_financial_account_token") @ExcludeMissing fromFinancialAccountToken: JsonField = JsonMissing.of(), @@ -73,38 +70,46 @@ private constructor( @JsonProperty("settled_amount") @ExcludeMissing settledAmount: JsonField = JsonMissing.of(), - @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + status: JsonField = JsonMissing.of(), @JsonProperty("to_financial_account_token") @ExcludeMissing toFinancialAccountToken: JsonField = JsonMissing.of(), - @JsonProperty("transaction_series") - @ExcludeMissing - transactionSeries: JsonField = JsonMissing.of(), @JsonProperty("updated") @ExcludeMissing updated: JsonField = JsonMissing.of(), + @JsonProperty("external_id") + @ExcludeMissing + externalId: JsonField = JsonMissing.of(), + @JsonProperty("external_resource") + @ExcludeMissing + externalResource: JsonField = JsonMissing.of(), + @JsonProperty("transaction_series") + @ExcludeMissing + transactionSeries: JsonField = JsonMissing.of(), ) : this( token, category, created, currency, events, - externalId, - externalResource, + family, fromFinancialAccountToken, pendingAmount, result, settledAmount, status, toFinancialAccountToken, - transactionSeries, updated, + externalId, + externalResource, + transactionSeries, mutableMapOf(), ) /** - * Customer-provided token that will serve as an idempotency token. This token will become the - * transaction token. + * Unique identifier for the transaction * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -118,7 +123,7 @@ private constructor( fun category(): BookTransferCategory = category.getRequired("category") /** - * Date and time when the transfer occurred. UTC time zone. + * ISO 8601 timestamp of when the transaction was created * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -126,7 +131,7 @@ private constructor( fun created(): OffsetDateTime = created.getRequired("created") /** - * 3-character alphabetic ISO 4217 code for the settling currency of the transaction. + * 3-character alphabetic ISO 4217 code for the settling currency of the transaction * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -134,7 +139,7 @@ private constructor( fun currency(): String = currency.getRequired("currency") /** - * A list of all financial events that have modified this transfer. + * A list of all financial events that have modified this transfer * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -142,25 +147,16 @@ private constructor( fun events(): List = events.getRequired("events") /** - * External ID defined by the customer + * TRANSFER - Book Transfer Transaction * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun externalId(): Optional = externalId.getOptional("external_id") - - /** - * External resource associated with the management operation - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun externalResource(): Optional = - externalResource.getOptional("external_resource") + fun family(): Family = family.getRequired("family") /** * Globally unique identifier for the financial account or card that will send the funds. - * Accepted type dependent on the program's use case. + * Accepted type dependent on the program's use case * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -186,8 +182,7 @@ private constructor( fun result(): TransactionResult = result.getRequired("result") /** - * Amount of the transaction that has been settled in the currency's smallest unit (e.g., - * cents). + * Amount of the transaction that has been settled in the currency's smallest unit (e.g., cents) * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -195,19 +190,16 @@ private constructor( fun settledAmount(): Long = settledAmount.getRequired("settled_amount") /** - * Status types: - * * `DECLINED` - The transfer was declined. - * * `REVERSED` - The transfer was reversed - * * `SETTLED` - The transfer is completed. + * The status of the transaction * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun status(): Status = status.getRequired("status") + fun status(): TransactionStatus = status.getRequired("status") /** * Globally unique identifier for the financial account or card that will receive the funds. - * Accepted type dependent on the program's use case. + * Accepted type dependent on the program's use case * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -216,21 +208,38 @@ private constructor( toFinancialAccountToken.getRequired("to_financial_account_token") /** - * A series of transactions that are grouped together. + * ISO 8601 timestamp of when the transaction was last updated + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun updated(): OffsetDateTime = updated.getRequired("updated") + + /** + * External ID defined by the customer * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun transactionSeries(): Optional = - transactionSeries.getOptional("transaction_series") + fun externalId(): Optional = externalId.getOptional("external_id") /** - * Date and time when the financial transaction was last updated. UTC time zone. + * External resource associated with the management operation * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun updated(): OffsetDateTime = updated.getRequired("updated") + fun externalResource(): Optional = + externalResource.getOptional("external_resource") + + /** + * A series of transactions that are grouped together + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun transactionSeries(): Optional = + transactionSeries.getOptional("transaction_series") /** * Returns the raw JSON value of [token]. @@ -272,21 +281,11 @@ private constructor( fun _events(): JsonField> = events /** - * Returns the raw JSON value of [externalId]. + * Returns the raw JSON value of [family]. * - * Unlike [externalId], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [family], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("external_id") @ExcludeMissing fun _externalId(): JsonField = externalId - - /** - * Returns the raw JSON value of [externalResource]. - * - * Unlike [externalResource], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("external_resource") - @ExcludeMissing - fun _externalResource(): JsonField = externalResource + @JsonProperty("family") @ExcludeMissing fun _family(): JsonField = family /** * Returns the raw JSON value of [fromFinancialAccountToken]. @@ -328,7 +327,7 @@ private constructor( * * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status /** * Returns the raw JSON value of [toFinancialAccountToken]. @@ -341,21 +340,38 @@ private constructor( fun _toFinancialAccountToken(): JsonField = toFinancialAccountToken /** - * Returns the raw JSON value of [transactionSeries]. + * Returns the raw JSON value of [updated]. * - * Unlike [transactionSeries], this method doesn't throw if the JSON field has an unexpected + * Unlike [updated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("updated") @ExcludeMissing fun _updated(): JsonField = updated + + /** + * Returns the raw JSON value of [externalId]. + * + * Unlike [externalId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("external_id") @ExcludeMissing fun _externalId(): JsonField = externalId + + /** + * Returns the raw JSON value of [externalResource]. + * + * Unlike [externalResource], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("transaction_series") + @JsonProperty("external_resource") @ExcludeMissing - fun _transactionSeries(): JsonField = transactionSeries + fun _externalResource(): JsonField = externalResource /** - * Returns the raw JSON value of [updated]. + * Returns the raw JSON value of [transactionSeries]. * - * Unlike [updated], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [transactionSeries], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("updated") @ExcludeMissing fun _updated(): JsonField = updated + @JsonProperty("transaction_series") + @ExcludeMissing + fun _transactionSeries(): JsonField = transactionSeries @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -381,15 +397,13 @@ private constructor( * .created() * .currency() * .events() - * .externalId() - * .externalResource() + * .family() * .fromFinancialAccountToken() * .pendingAmount() * .result() * .settledAmount() * .status() * .toFinancialAccountToken() - * .transactionSeries() * .updated() * ``` */ @@ -404,16 +418,17 @@ private constructor( private var created: JsonField? = null private var currency: JsonField? = null private var events: JsonField>? = null - private var externalId: JsonField? = null - private var externalResource: JsonField? = null + private var family: JsonField? = null private var fromFinancialAccountToken: JsonField? = null private var pendingAmount: JsonField? = null private var result: JsonField? = null private var settledAmount: JsonField? = null - private var status: JsonField? = null + private var status: JsonField? = null private var toFinancialAccountToken: JsonField? = null - private var transactionSeries: JsonField? = null private var updated: JsonField? = null + private var externalId: JsonField = JsonMissing.of() + private var externalResource: JsonField = JsonMissing.of() + private var transactionSeries: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -423,23 +438,21 @@ private constructor( created = bookTransferResponse.created currency = bookTransferResponse.currency events = bookTransferResponse.events.map { it.toMutableList() } - externalId = bookTransferResponse.externalId - externalResource = bookTransferResponse.externalResource + family = bookTransferResponse.family fromFinancialAccountToken = bookTransferResponse.fromFinancialAccountToken pendingAmount = bookTransferResponse.pendingAmount result = bookTransferResponse.result settledAmount = bookTransferResponse.settledAmount status = bookTransferResponse.status toFinancialAccountToken = bookTransferResponse.toFinancialAccountToken - transactionSeries = bookTransferResponse.transactionSeries updated = bookTransferResponse.updated + externalId = bookTransferResponse.externalId + externalResource = bookTransferResponse.externalResource + transactionSeries = bookTransferResponse.transactionSeries additionalProperties = bookTransferResponse.additionalProperties.toMutableMap() } - /** - * Customer-provided token that will serve as an idempotency token. This token will become - * the transaction token. - */ + /** Unique identifier for the transaction */ fun token(token: String) = token(JsonField.of(token)) /** @@ -461,7 +474,7 @@ private constructor( */ fun category(category: JsonField) = apply { this.category = category } - /** Date and time when the transfer occurred. UTC time zone. */ + /** ISO 8601 timestamp of when the transaction was created */ fun created(created: OffsetDateTime) = created(JsonField.of(created)) /** @@ -473,7 +486,7 @@ private constructor( */ fun created(created: JsonField) = apply { this.created = created } - /** 3-character alphabetic ISO 4217 code for the settling currency of the transaction. */ + /** 3-character alphabetic ISO 4217 code for the settling currency of the transaction */ fun currency(currency: String) = currency(JsonField.of(currency)) /** @@ -484,7 +497,7 @@ private constructor( */ fun currency(currency: JsonField) = apply { this.currency = currency } - /** A list of all financial events that have modified this transfer. */ + /** A list of all financial events that have modified this transfer */ fun events(events: List) = events(JsonField.of(events)) /** @@ -510,43 +523,20 @@ private constructor( } } - /** External ID defined by the customer */ - fun externalId(externalId: String?) = externalId(JsonField.ofNullable(externalId)) - - /** Alias for calling [Builder.externalId] with `externalId.orElse(null)`. */ - fun externalId(externalId: Optional) = externalId(externalId.getOrNull()) + /** TRANSFER - Book Transfer Transaction */ + fun family(family: Family) = family(JsonField.of(family)) /** - * Sets [Builder.externalId] to an arbitrary JSON value. + * Sets [Builder.family] to an arbitrary JSON value. * - * You should usually call [Builder.externalId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun externalId(externalId: JsonField) = apply { this.externalId = externalId } - - /** External resource associated with the management operation */ - fun externalResource(externalResource: ExternalResource?) = - externalResource(JsonField.ofNullable(externalResource)) - - /** Alias for calling [Builder.externalResource] with `externalResource.orElse(null)`. */ - fun externalResource(externalResource: Optional) = - externalResource(externalResource.getOrNull()) - - /** - * Sets [Builder.externalResource] to an arbitrary JSON value. - * - * You should usually call [Builder.externalResource] with a well-typed [ExternalResource] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * You should usually call [Builder.family] with a well-typed [Family] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun externalResource(externalResource: JsonField) = apply { - this.externalResource = externalResource - } + fun family(family: JsonField) = apply { this.family = family } /** * Globally unique identifier for the financial account or card that will send the funds. - * Accepted type dependent on the program's use case. + * Accepted type dependent on the program's use case */ fun fromFinancialAccountToken(fromFinancialAccountToken: String) = fromFinancialAccountToken(JsonField.of(fromFinancialAccountToken)) @@ -595,7 +585,7 @@ private constructor( /** * Amount of the transaction that has been settled in the currency's smallest unit (e.g., - * cents). + * cents) */ fun settledAmount(settledAmount: Long) = settledAmount(JsonField.of(settledAmount)) @@ -610,25 +600,21 @@ private constructor( this.settledAmount = settledAmount } - /** - * Status types: - * * `DECLINED` - The transfer was declined. - * * `REVERSED` - The transfer was reversed - * * `SETTLED` - The transfer is completed. - */ - fun status(status: Status) = status(JsonField.of(status)) + /** The status of the transaction */ + fun status(status: TransactionStatus) = status(JsonField.of(status)) /** * Sets [Builder.status] to an arbitrary JSON value. * - * You should usually call [Builder.status] with a well-typed [Status] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. + * You should usually call [Builder.status] with a well-typed [TransactionStatus] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun status(status: JsonField) = apply { this.status = status } + fun status(status: JsonField) = apply { this.status = status } /** * Globally unique identifier for the financial account or card that will receive the funds. - * Accepted type dependent on the program's use case. + * Accepted type dependent on the program's use case */ fun toFinancialAccountToken(toFinancialAccountToken: String) = toFinancialAccountToken(JsonField.of(toFinancialAccountToken)) @@ -644,7 +630,53 @@ private constructor( this.toFinancialAccountToken = toFinancialAccountToken } - /** A series of transactions that are grouped together. */ + /** ISO 8601 timestamp of when the transaction was last updated */ + fun updated(updated: OffsetDateTime) = updated(JsonField.of(updated)) + + /** + * Sets [Builder.updated] to an arbitrary JSON value. + * + * You should usually call [Builder.updated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun updated(updated: JsonField) = apply { this.updated = updated } + + /** External ID defined by the customer */ + fun externalId(externalId: String?) = externalId(JsonField.ofNullable(externalId)) + + /** Alias for calling [Builder.externalId] with `externalId.orElse(null)`. */ + fun externalId(externalId: Optional) = externalId(externalId.getOrNull()) + + /** + * Sets [Builder.externalId] to an arbitrary JSON value. + * + * You should usually call [Builder.externalId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun externalId(externalId: JsonField) = apply { this.externalId = externalId } + + /** External resource associated with the management operation */ + fun externalResource(externalResource: ExternalResource?) = + externalResource(JsonField.ofNullable(externalResource)) + + /** Alias for calling [Builder.externalResource] with `externalResource.orElse(null)`. */ + fun externalResource(externalResource: Optional) = + externalResource(externalResource.getOrNull()) + + /** + * Sets [Builder.externalResource] to an arbitrary JSON value. + * + * You should usually call [Builder.externalResource] with a well-typed [ExternalResource] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun externalResource(externalResource: JsonField) = apply { + this.externalResource = externalResource + } + + /** A series of transactions that are grouped together */ fun transactionSeries(transactionSeries: TransactionSeries?) = transactionSeries(JsonField.ofNullable(transactionSeries)) @@ -663,18 +695,6 @@ private constructor( this.transactionSeries = transactionSeries } - /** Date and time when the financial transaction was last updated. UTC time zone. */ - fun updated(updated: OffsetDateTime) = updated(JsonField.of(updated)) - - /** - * Sets [Builder.updated] to an arbitrary JSON value. - * - * You should usually call [Builder.updated] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun updated(updated: JsonField) = apply { this.updated = updated } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -706,15 +726,13 @@ private constructor( * .created() * .currency() * .events() - * .externalId() - * .externalResource() + * .family() * .fromFinancialAccountToken() * .pendingAmount() * .result() * .settledAmount() * .status() * .toFinancialAccountToken() - * .transactionSeries() * .updated() * ``` * @@ -727,16 +745,17 @@ private constructor( checkRequired("created", created), checkRequired("currency", currency), checkRequired("events", events).map { it.toImmutable() }, - checkRequired("externalId", externalId), - checkRequired("externalResource", externalResource), + checkRequired("family", family), checkRequired("fromFinancialAccountToken", fromFinancialAccountToken), checkRequired("pendingAmount", pendingAmount), checkRequired("result", result), checkRequired("settledAmount", settledAmount), checkRequired("status", status), checkRequired("toFinancialAccountToken", toFinancialAccountToken), - checkRequired("transactionSeries", transactionSeries), checkRequired("updated", updated), + externalId, + externalResource, + transactionSeries, additionalProperties.toMutableMap(), ) } @@ -753,16 +772,17 @@ private constructor( created() currency() events().forEach { it.validate() } - externalId() - externalResource().ifPresent { it.validate() } + family().validate() fromFinancialAccountToken() pendingAmount() result().validate() settledAmount() status().validate() toFinancialAccountToken() - transactionSeries().ifPresent { it.validate() } updated() + externalId() + externalResource().ifPresent { it.validate() } + transactionSeries().ifPresent { it.validate() } validated = true } @@ -786,16 +806,17 @@ private constructor( (if (created.asKnown().isPresent) 1 else 0) + (if (currency.asKnown().isPresent) 1 else 0) + (events.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (if (externalId.asKnown().isPresent) 1 else 0) + - (externalResource.asKnown().getOrNull()?.validity() ?: 0) + + (family.asKnown().getOrNull()?.validity() ?: 0) + (if (fromFinancialAccountToken.asKnown().isPresent) 1 else 0) + (if (pendingAmount.asKnown().isPresent) 1 else 0) + (result.asKnown().getOrNull()?.validity() ?: 0) + (if (settledAmount.asKnown().isPresent) 1 else 0) + (status.asKnown().getOrNull()?.validity() ?: 0) + (if (toFinancialAccountToken.asKnown().isPresent) 1 else 0) + - (transactionSeries.asKnown().getOrNull()?.validity() ?: 0) + - (if (updated.asKnown().isPresent) 1 else 0) + (if (updated.asKnown().isPresent) 1 else 0) + + (if (externalId.asKnown().isPresent) 1 else 0) + + (externalResource.asKnown().getOrNull()?.validity() ?: 0) + + (transactionSeries.asKnown().getOrNull()?.validity() ?: 0) class BookTransferCategory @JsonCreator @@ -2033,6 +2054,126 @@ private constructor( "BookTransferEvent{token=$token, amount=$amount, created=$created, detailedResults=$detailedResults, memo=$memo, result=$result, subtype=$subtype, type=$type, additionalProperties=$additionalProperties}" } + /** TRANSFER - Book Transfer Transaction */ + class Family @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val TRANSFER = of("TRANSFER") + + @JvmStatic fun of(value: String) = Family(JsonField.of(value)) + } + + /** An enum containing [Family]'s known values. */ + enum class Known { + TRANSFER + } + + /** + * An enum containing [Family]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Family] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then 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 { + TRANSFER, + /** An enum member indicating that [Family] 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) { + TRANSFER -> Value.TRANSFER + 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 LithicInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + TRANSFER -> Known.TRANSFER + else -> throw LithicInvalidDataException("Unknown Family: $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 LithicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + fun validate(): Family = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 Family && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + class TransactionResult @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -2162,13 +2303,9 @@ private constructor( override fun toString() = value.toString() } - /** - * Status types: - * * `DECLINED` - The transfer was declined. - * * `REVERSED` - The transfer was reversed - * * `SETTLED` - The transfer is completed. - */ - class Status @JsonCreator private constructor(private val value: JsonField) : Enum { + /** The status of the transaction */ + class TransactionStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -2182,36 +2319,47 @@ private constructor( companion object { + @JvmField val PENDING = of("PENDING") + + @JvmField val SETTLED = of("SETTLED") + @JvmField val DECLINED = of("DECLINED") @JvmField val REVERSED = of("REVERSED") - @JvmField val SETTLED = of("SETTLED") + @JvmField val CANCELED = of("CANCELED") - @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + @JvmStatic fun of(value: String) = TransactionStatus(JsonField.of(value)) } - /** An enum containing [Status]'s known values. */ + /** An enum containing [TransactionStatus]'s known values. */ enum class Known { + PENDING, + SETTLED, DECLINED, REVERSED, - SETTLED, + CANCELED, } /** - * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [TransactionStatus]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [Status] can contain an unknown value in a couple of cases: + * An instance of [TransactionStatus] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, if the * SDK is on an older version than the API, then 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 { + PENDING, + SETTLED, DECLINED, REVERSED, - SETTLED, - /** An enum member indicating that [Status] was instantiated with an unknown value. */ + CANCELED, + /** + * An enum member indicating that [TransactionStatus] was instantiated with an unknown + * value. + */ _UNKNOWN, } @@ -2224,9 +2372,11 @@ private constructor( */ fun value(): Value = when (this) { + PENDING -> Value.PENDING + SETTLED -> Value.SETTLED DECLINED -> Value.DECLINED REVERSED -> Value.REVERSED - SETTLED -> Value.SETTLED + CANCELED -> Value.CANCELED else -> Value._UNKNOWN } @@ -2241,10 +2391,12 @@ private constructor( */ fun known(): Known = when (this) { + PENDING -> Known.PENDING + SETTLED -> Known.SETTLED DECLINED -> Known.DECLINED REVERSED -> Known.REVERSED - SETTLED -> Known.SETTLED - else -> throw LithicInvalidDataException("Unknown Status: $value") + CANCELED -> Known.CANCELED + else -> throw LithicInvalidDataException("Unknown TransactionStatus: $value") } /** @@ -2261,7 +2413,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Status = apply { + fun validate(): TransactionStatus = apply { if (validated) { return@apply } @@ -2291,7 +2443,7 @@ private constructor( return true } - return other is Status && value == other.value + return other is TransactionStatus && value == other.value } override fun hashCode() = value.hashCode() @@ -2299,7 +2451,7 @@ private constructor( override fun toString() = value.toString() } - /** A series of transactions that are grouped together. */ + /** A series of transactions that are grouped together */ class TransactionSeries @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( @@ -2577,16 +2729,17 @@ private constructor( created == other.created && currency == other.currency && events == other.events && - externalId == other.externalId && - externalResource == other.externalResource && + family == other.family && fromFinancialAccountToken == other.fromFinancialAccountToken && pendingAmount == other.pendingAmount && result == other.result && settledAmount == other.settledAmount && status == other.status && toFinancialAccountToken == other.toFinancialAccountToken && - transactionSeries == other.transactionSeries && updated == other.updated && + externalId == other.externalId && + externalResource == other.externalResource && + transactionSeries == other.transactionSeries && additionalProperties == other.additionalProperties } @@ -2597,16 +2750,17 @@ private constructor( created, currency, events, - externalId, - externalResource, + family, fromFinancialAccountToken, pendingAmount, result, settledAmount, status, toFinancialAccountToken, - transactionSeries, updated, + externalId, + externalResource, + transactionSeries, additionalProperties, ) } @@ -2614,5 +2768,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "BookTransferResponse{token=$token, category=$category, created=$created, currency=$currency, events=$events, externalId=$externalId, externalResource=$externalResource, fromFinancialAccountToken=$fromFinancialAccountToken, pendingAmount=$pendingAmount, result=$result, settledAmount=$settledAmount, status=$status, toFinancialAccountToken=$toFinancialAccountToken, transactionSeries=$transactionSeries, updated=$updated, additionalProperties=$additionalProperties}" + "BookTransferResponse{token=$token, category=$category, created=$created, currency=$currency, events=$events, family=$family, fromFinancialAccountToken=$fromFinancialAccountToken, pendingAmount=$pendingAmount, result=$result, settledAmount=$settledAmount, status=$status, toFinancialAccountToken=$toFinancialAccountToken, updated=$updated, externalId=$externalId, externalResource=$externalResource, transactionSeries=$transactionSeries, additionalProperties=$additionalProperties}" } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardProvisionResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardProvisionResponse.kt index 844c3ea09..bdbfb8a85 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardProvisionResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardProvisionResponse.kt @@ -6,19 +6,31 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.lithic.api.core.BaseDeserializer +import com.lithic.api.core.BaseSerializer import com.lithic.api.core.ExcludeMissing import com.lithic.api.core.JsonField import com.lithic.api.core.JsonMissing import com.lithic.api.core.JsonValue +import com.lithic.api.core.allMaxBy +import com.lithic.api.core.getOrThrow import com.lithic.api.errors.LithicInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull class CardProvisionResponse @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val provisioningPayload: JsonField, + private val provisioningPayload: JsonField, private val additionalProperties: MutableMap, ) { @@ -26,14 +38,17 @@ private constructor( private constructor( @JsonProperty("provisioning_payload") @ExcludeMissing - provisioningPayload: JsonField = JsonMissing.of() + provisioningPayload: JsonField = JsonMissing.of() ) : this(provisioningPayload, mutableMapOf()) /** + * Base64 encoded JSON payload representing a payment card that can be passed to a device's + * digital wallet. Applies to Google and Samsung Pay wallets. + * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun provisioningPayload(): Optional = + fun provisioningPayload(): Optional = provisioningPayload.getOptional("provisioning_payload") /** @@ -44,7 +59,7 @@ private constructor( */ @JsonProperty("provisioning_payload") @ExcludeMissing - fun _provisioningPayload(): JsonField = provisioningPayload + fun _provisioningPayload(): JsonField = provisioningPayload @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -67,7 +82,7 @@ private constructor( /** A builder for [CardProvisionResponse]. */ class Builder internal constructor() { - private var provisioningPayload: JsonField = JsonMissing.of() + private var provisioningPayload: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -76,20 +91,35 @@ private constructor( additionalProperties = cardProvisionResponse.additionalProperties.toMutableMap() } - fun provisioningPayload(provisioningPayload: String) = + /** + * Base64 encoded JSON payload representing a payment card that can be passed to a device's + * digital wallet. Applies to Google and Samsung Pay wallets. + */ + fun provisioningPayload(provisioningPayload: ProvisioningPayload) = provisioningPayload(JsonField.of(provisioningPayload)) /** * Sets [Builder.provisioningPayload] to an arbitrary JSON value. * - * You should usually call [Builder.provisioningPayload] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * You should usually call [Builder.provisioningPayload] with a well-typed + * [ProvisioningPayload] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ - fun provisioningPayload(provisioningPayload: JsonField) = apply { + fun provisioningPayload(provisioningPayload: JsonField) = apply { this.provisioningPayload = provisioningPayload } + /** Alias for calling [provisioningPayload] with `ProvisioningPayload.ofString(string)`. */ + fun provisioningPayload(string: String) = + provisioningPayload(ProvisioningPayload.ofString(string)) + + /** + * Alias for calling [provisioningPayload] with + * `ProvisioningPayload.ofProvisionResponse(provisionResponse)`. + */ + fun provisioningPayload(provisionResponse: ProvisionResponse) = + provisioningPayload(ProvisioningPayload.ofProvisionResponse(provisionResponse)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -125,7 +155,7 @@ private constructor( return@apply } - provisioningPayload() + provisioningPayload().ifPresent { it.validate() } validated = true } @@ -143,7 +173,226 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = (if (provisioningPayload.asKnown().isPresent) 1 else 0) + internal fun validity(): Int = (provisioningPayload.asKnown().getOrNull()?.validity() ?: 0) + + /** + * Base64 encoded JSON payload representing a payment card that can be passed to a device's + * digital wallet. Applies to Google and Samsung Pay wallets. + */ + @JsonDeserialize(using = ProvisioningPayload.Deserializer::class) + @JsonSerialize(using = ProvisioningPayload.Serializer::class) + class ProvisioningPayload + private constructor( + private val string: String? = null, + private val provisionResponse: ProvisionResponse? = null, + private val _json: JsonValue? = null, + ) { + + /** + * Base64 encoded JSON payload representing a payment card that can be passed to a device's + * digital wallet. Applies to Google and Samsung Pay wallets. + */ + fun string(): Optional = Optional.ofNullable(string) + + /** + * Object containing the fields required to add a card to Apple Pay. Applies only to Apple + * Pay wallet. + */ + fun provisionResponse(): Optional = + Optional.ofNullable(provisionResponse) + + fun isString(): Boolean = string != null + + fun isProvisionResponse(): Boolean = provisionResponse != null + + /** + * Base64 encoded JSON payload representing a payment card that can be passed to a device's + * digital wallet. Applies to Google and Samsung Pay wallets. + */ + fun asString(): String = string.getOrThrow("string") + + /** + * Object containing the fields required to add a card to Apple Pay. Applies only to Apple + * Pay wallet. + */ + fun asProvisionResponse(): ProvisionResponse = + provisionResponse.getOrThrow("provisionResponse") + + fun _json(): Optional = Optional.ofNullable(_json) + + fun accept(visitor: Visitor): T = + when { + string != null -> visitor.visitString(string) + provisionResponse != null -> visitor.visitProvisionResponse(provisionResponse) + else -> visitor.unknown(_json) + } + + private var validated: Boolean = false + + fun validate(): ProvisioningPayload = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitString(string: String) {} + + override fun visitProvisionResponse(provisionResponse: ProvisionResponse) { + provisionResponse.validate() + } + } + ) + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 = + accept( + object : Visitor { + override fun visitString(string: String) = 1 + + override fun visitProvisionResponse(provisionResponse: ProvisionResponse) = + provisionResponse.validity() + + override fun unknown(json: JsonValue?) = 0 + } + ) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProvisioningPayload && + string == other.string && + provisionResponse == other.provisionResponse + } + + override fun hashCode(): Int = Objects.hash(string, provisionResponse) + + override fun toString(): String = + when { + string != null -> "ProvisioningPayload{string=$string}" + provisionResponse != null -> + "ProvisioningPayload{provisionResponse=$provisionResponse}" + _json != null -> "ProvisioningPayload{_unknown=$_json}" + else -> throw IllegalStateException("Invalid ProvisioningPayload") + } + + companion object { + + /** + * Base64 encoded JSON payload representing a payment card that can be passed to a + * device's digital wallet. Applies to Google and Samsung Pay wallets. + */ + @JvmStatic fun ofString(string: String) = ProvisioningPayload(string = string) + + /** + * Object containing the fields required to add a card to Apple Pay. Applies only to + * Apple Pay wallet. + */ + @JvmStatic + fun ofProvisionResponse(provisionResponse: ProvisionResponse) = + ProvisioningPayload(provisionResponse = provisionResponse) + } + + /** + * An interface that defines how to map each variant of [ProvisioningPayload] to a value of + * type [T]. + */ + interface Visitor { + + /** + * Base64 encoded JSON payload representing a payment card that can be passed to a + * device's digital wallet. Applies to Google and Samsung Pay wallets. + */ + fun visitString(string: String): T + + /** + * Object containing the fields required to add a card to Apple Pay. Applies only to + * Apple Pay wallet. + */ + fun visitProvisionResponse(provisionResponse: ProvisionResponse): T + + /** + * Maps an unknown variant of [ProvisioningPayload] to a value of type [T]. + * + * An instance of [ProvisioningPayload] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, if the SDK + * is on an older version than the API, then the API may respond with new variants that + * the SDK is unaware of. + * + * @throws LithicInvalidDataException in the default implementation. + */ + fun unknown(json: JsonValue?): T { + throw LithicInvalidDataException("Unknown ProvisioningPayload: $json") + } + } + + internal class Deserializer : + BaseDeserializer(ProvisioningPayload::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): ProvisioningPayload { + val json = JsonValue.fromJsonNode(node) + + val bestMatches = + sequenceOf( + tryDeserialize(node, jacksonTypeRef())?.let { + ProvisioningPayload(provisionResponse = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + ProvisioningPayload(string = it, _json = json) + }, + ) + .filterNotNull() + .allMaxBy { it.validity() } + .toList() + return when (bestMatches.size) { + // This can happen if what we're deserializing is completely incompatible with + // all the possible variants (e.g. deserializing from array). + 0 -> ProvisioningPayload(_json = json) + 1 -> bestMatches.single() + // If there's more than one match with the highest validity, then use the first + // completely valid match, or simply the first match if none are completely + // valid. + else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first() + } + } + } + + internal class Serializer : + BaseSerializer(ProvisioningPayload::class) { + + override fun serialize( + value: ProvisioningPayload, + generator: JsonGenerator, + provider: SerializerProvider, + ) { + when { + value.string != null -> generator.writeObject(value.string) + value.provisionResponse != null -> + generator.writeObject(value.provisionResponse) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid ProvisioningPayload") + } + } + } + } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Conditional3dsActionParameters.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Conditional3dsActionParameters.kt index 8e4264dd0..ae6561d19 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Conditional3dsActionParameters.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Conditional3dsActionParameters.kt @@ -390,6 +390,9 @@ private constructor( * * `RISK_SCORE`: Mastercard only: Assessment by the network of the authentication risk * level, with a higher value indicating a higher amount of risk. * * `MESSAGE_CATEGORY`: The category of the authentication being processed. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address data with + * the cardholder KYC data if it exists. Valid values are `MATCH`, `MATCH_ADDRESS_ONLY`, + * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -492,6 +495,9 @@ private constructor( * * `RISK_SCORE`: Mastercard only: Assessment by the network of the authentication risk * level, with a higher value indicating a higher amount of risk. * * `MESSAGE_CATEGORY`: The category of the authentication being processed. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address data + * with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ fun attribute(attribute: Attribute) = attribute(JsonField.of(attribute)) @@ -618,6 +624,9 @@ private constructor( * * `RISK_SCORE`: Mastercard only: Assessment by the network of the authentication risk * level, with a higher value indicating a higher amount of risk. * * `MESSAGE_CATEGORY`: The category of the authentication being processed. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address data with + * the cardholder KYC data if it exists. Valid values are `MATCH`, `MATCH_ADDRESS_ONLY`, + * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ class Attribute @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -650,6 +659,8 @@ private constructor( @JvmField val MESSAGE_CATEGORY = of("MESSAGE_CATEGORY") + @JvmField val ADDRESS_MATCH = of("ADDRESS_MATCH") + @JvmStatic fun of(value: String) = Attribute(JsonField.of(value)) } @@ -663,6 +674,7 @@ private constructor( TRANSACTION_AMOUNT, RISK_SCORE, MESSAGE_CATEGORY, + ADDRESS_MATCH, } /** @@ -683,6 +695,7 @@ private constructor( TRANSACTION_AMOUNT, RISK_SCORE, MESSAGE_CATEGORY, + ADDRESS_MATCH, /** * An enum member indicating that [Attribute] was instantiated with an unknown * value. @@ -707,6 +720,7 @@ private constructor( TRANSACTION_AMOUNT -> Value.TRANSACTION_AMOUNT RISK_SCORE -> Value.RISK_SCORE MESSAGE_CATEGORY -> Value.MESSAGE_CATEGORY + ADDRESS_MATCH -> Value.ADDRESS_MATCH else -> Value._UNKNOWN } @@ -729,6 +743,7 @@ private constructor( TRANSACTION_AMOUNT -> Known.TRANSACTION_AMOUNT RISK_SCORE -> Known.RISK_SCORE MESSAGE_CATEGORY -> Known.MESSAGE_CATEGORY + ADDRESS_MATCH -> Known.ADDRESS_MATCH else -> throw LithicInvalidDataException("Unknown Attribute: $value") } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalAttribute.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalAttribute.kt index e524c2091..2acb37675 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalAttribute.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalAttribute.kt @@ -45,6 +45,9 @@ import com.lithic.api.errors.LithicInvalidDataException * * `WALLET_TYPE`: For transactions using a digital wallet token, indicates the source of the * token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, * `OTHER`, `NONE`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address data with the + * cardholder KYC data if it exists. Valid values are `MATCH`, `MATCH_ADDRESS_ONLY`, + * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ class ConditionalAttribute @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -92,6 +95,8 @@ class ConditionalAttribute @JsonCreator private constructor(private val value: J @JvmField val WALLET_TYPE = of("WALLET_TYPE") + @JvmField val ADDRESS_MATCH = of("ADDRESS_MATCH") + @JvmStatic fun of(value: String) = ConditionalAttribute(JsonField.of(value)) } @@ -113,6 +118,7 @@ class ConditionalAttribute @JsonCreator private constructor(private val value: J PIN_ENTERED, PIN_STATUS, WALLET_TYPE, + ADDRESS_MATCH, } /** @@ -141,6 +147,7 @@ class ConditionalAttribute @JsonCreator private constructor(private val value: J PIN_ENTERED, PIN_STATUS, WALLET_TYPE, + ADDRESS_MATCH, /** * An enum member indicating that [ConditionalAttribute] was instantiated with an unknown * value. @@ -173,6 +180,7 @@ class ConditionalAttribute @JsonCreator private constructor(private val value: J PIN_ENTERED -> Value.PIN_ENTERED PIN_STATUS -> Value.PIN_STATUS WALLET_TYPE -> Value.WALLET_TYPE + ADDRESS_MATCH -> Value.ADDRESS_MATCH else -> Value._UNKNOWN } @@ -202,6 +210,7 @@ class ConditionalAttribute @JsonCreator private constructor(private val value: J PIN_ENTERED -> Known.PIN_ENTERED PIN_STATUS -> Known.PIN_STATUS WALLET_TYPE -> Known.WALLET_TYPE + ADDRESS_MATCH -> Known.ADDRESS_MATCH else -> throw LithicInvalidDataException("Unknown ConditionalAttribute: $value") } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Event.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Event.kt index 2003b04f6..d009e5fab 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Event.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Event.kt @@ -383,9 +383,6 @@ private constructor( @JvmField val ACCOUNT_HOLDER_VERIFICATION = of("account_holder.verification") - @JvmField - val AUTH_RULES_PERFORMANCE_REPORT_CREATED = of("auth_rules.performance_report.created") - @JvmField val BALANCE_UPDATED = of("balance.updated") @JvmField @@ -493,7 +490,6 @@ private constructor( ACCOUNT_HOLDER_CREATED, ACCOUNT_HOLDER_UPDATED, ACCOUNT_HOLDER_VERIFICATION, - AUTH_RULES_PERFORMANCE_REPORT_CREATED, BALANCE_UPDATED, BOOK_TRANSFER_TRANSACTION_CREATED, CARD_CREATED, @@ -552,7 +548,6 @@ private constructor( ACCOUNT_HOLDER_CREATED, ACCOUNT_HOLDER_UPDATED, ACCOUNT_HOLDER_VERIFICATION, - AUTH_RULES_PERFORMANCE_REPORT_CREATED, BALANCE_UPDATED, BOOK_TRANSFER_TRANSACTION_CREATED, CARD_CREATED, @@ -614,7 +609,6 @@ private constructor( ACCOUNT_HOLDER_CREATED -> Value.ACCOUNT_HOLDER_CREATED ACCOUNT_HOLDER_UPDATED -> Value.ACCOUNT_HOLDER_UPDATED ACCOUNT_HOLDER_VERIFICATION -> Value.ACCOUNT_HOLDER_VERIFICATION - AUTH_RULES_PERFORMANCE_REPORT_CREATED -> Value.AUTH_RULES_PERFORMANCE_REPORT_CREATED BALANCE_UPDATED -> Value.BALANCE_UPDATED BOOK_TRANSFER_TRANSACTION_CREATED -> Value.BOOK_TRANSFER_TRANSACTION_CREATED CARD_CREATED -> Value.CARD_CREATED @@ -680,7 +674,6 @@ private constructor( ACCOUNT_HOLDER_CREATED -> Known.ACCOUNT_HOLDER_CREATED ACCOUNT_HOLDER_UPDATED -> Known.ACCOUNT_HOLDER_UPDATED ACCOUNT_HOLDER_VERIFICATION -> Known.ACCOUNT_HOLDER_VERIFICATION - AUTH_RULES_PERFORMANCE_REPORT_CREATED -> Known.AUTH_RULES_PERFORMANCE_REPORT_CREATED BALANCE_UPDATED -> Known.BALANCE_UPDATED BOOK_TRANSFER_TRANSACTION_CREATED -> Known.BOOK_TRANSFER_TRANSACTION_CREATED CARD_CREATED -> Known.CARD_CREATED diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventListParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventListParams.kt index d0f514aab..adbe806c8 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventListParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventListParams.kt @@ -338,9 +338,6 @@ private constructor( @JvmField val ACCOUNT_HOLDER_VERIFICATION = of("account_holder.verification") - @JvmField - val AUTH_RULES_PERFORMANCE_REPORT_CREATED = of("auth_rules.performance_report.created") - @JvmField val BALANCE_UPDATED = of("balance.updated") @JvmField @@ -448,7 +445,6 @@ private constructor( ACCOUNT_HOLDER_CREATED, ACCOUNT_HOLDER_UPDATED, ACCOUNT_HOLDER_VERIFICATION, - AUTH_RULES_PERFORMANCE_REPORT_CREATED, BALANCE_UPDATED, BOOK_TRANSFER_TRANSACTION_CREATED, CARD_CREATED, @@ -507,7 +503,6 @@ private constructor( ACCOUNT_HOLDER_CREATED, ACCOUNT_HOLDER_UPDATED, ACCOUNT_HOLDER_VERIFICATION, - AUTH_RULES_PERFORMANCE_REPORT_CREATED, BALANCE_UPDATED, BOOK_TRANSFER_TRANSACTION_CREATED, CARD_CREATED, @@ -569,7 +564,6 @@ private constructor( ACCOUNT_HOLDER_CREATED -> Value.ACCOUNT_HOLDER_CREATED ACCOUNT_HOLDER_UPDATED -> Value.ACCOUNT_HOLDER_UPDATED ACCOUNT_HOLDER_VERIFICATION -> Value.ACCOUNT_HOLDER_VERIFICATION - AUTH_RULES_PERFORMANCE_REPORT_CREATED -> Value.AUTH_RULES_PERFORMANCE_REPORT_CREATED BALANCE_UPDATED -> Value.BALANCE_UPDATED BOOK_TRANSFER_TRANSACTION_CREATED -> Value.BOOK_TRANSFER_TRANSACTION_CREATED CARD_CREATED -> Value.CARD_CREATED @@ -635,7 +629,6 @@ private constructor( ACCOUNT_HOLDER_CREATED -> Known.ACCOUNT_HOLDER_CREATED ACCOUNT_HOLDER_UPDATED -> Known.ACCOUNT_HOLDER_UPDATED ACCOUNT_HOLDER_VERIFICATION -> Known.ACCOUNT_HOLDER_VERIFICATION - AUTH_RULES_PERFORMANCE_REPORT_CREATED -> Known.AUTH_RULES_PERFORMANCE_REPORT_CREATED BALANCE_UPDATED -> Known.BALANCE_UPDATED BOOK_TRANSFER_TRANSACTION_CREATED -> Known.BOOK_TRANSFER_TRANSACTION_CREATED CARD_CREATED -> Known.CARD_CREATED diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscription.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscription.kt index c7ee22d26..dd1314d57 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscription.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscription.kt @@ -340,9 +340,6 @@ private constructor( @JvmField val ACCOUNT_HOLDER_VERIFICATION = of("account_holder.verification") - @JvmField - val AUTH_RULES_PERFORMANCE_REPORT_CREATED = of("auth_rules.performance_report.created") - @JvmField val BALANCE_UPDATED = of("balance.updated") @JvmField @@ -450,7 +447,6 @@ private constructor( ACCOUNT_HOLDER_CREATED, ACCOUNT_HOLDER_UPDATED, ACCOUNT_HOLDER_VERIFICATION, - AUTH_RULES_PERFORMANCE_REPORT_CREATED, BALANCE_UPDATED, BOOK_TRANSFER_TRANSACTION_CREATED, CARD_CREATED, @@ -509,7 +505,6 @@ private constructor( ACCOUNT_HOLDER_CREATED, ACCOUNT_HOLDER_UPDATED, ACCOUNT_HOLDER_VERIFICATION, - AUTH_RULES_PERFORMANCE_REPORT_CREATED, BALANCE_UPDATED, BOOK_TRANSFER_TRANSACTION_CREATED, CARD_CREATED, @@ -571,7 +566,6 @@ private constructor( ACCOUNT_HOLDER_CREATED -> Value.ACCOUNT_HOLDER_CREATED ACCOUNT_HOLDER_UPDATED -> Value.ACCOUNT_HOLDER_UPDATED ACCOUNT_HOLDER_VERIFICATION -> Value.ACCOUNT_HOLDER_VERIFICATION - AUTH_RULES_PERFORMANCE_REPORT_CREATED -> Value.AUTH_RULES_PERFORMANCE_REPORT_CREATED BALANCE_UPDATED -> Value.BALANCE_UPDATED BOOK_TRANSFER_TRANSACTION_CREATED -> Value.BOOK_TRANSFER_TRANSACTION_CREATED CARD_CREATED -> Value.CARD_CREATED @@ -637,7 +631,6 @@ private constructor( ACCOUNT_HOLDER_CREATED -> Known.ACCOUNT_HOLDER_CREATED ACCOUNT_HOLDER_UPDATED -> Known.ACCOUNT_HOLDER_UPDATED ACCOUNT_HOLDER_VERIFICATION -> Known.ACCOUNT_HOLDER_VERIFICATION - AUTH_RULES_PERFORMANCE_REPORT_CREATED -> Known.AUTH_RULES_PERFORMANCE_REPORT_CREATED BALANCE_UPDATED -> Known.BALANCE_UPDATED BOOK_TRANSFER_TRANSACTION_CREATED -> Known.BOOK_TRANSFER_TRANSACTION_CREATED CARD_CREATED -> Known.CARD_CREATED diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionCreateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionCreateParams.kt index 8efde311d..66b2ef36a 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionCreateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionCreateParams.kt @@ -662,9 +662,6 @@ private constructor( @JvmField val ACCOUNT_HOLDER_VERIFICATION = of("account_holder.verification") - @JvmField - val AUTH_RULES_PERFORMANCE_REPORT_CREATED = of("auth_rules.performance_report.created") - @JvmField val BALANCE_UPDATED = of("balance.updated") @JvmField @@ -772,7 +769,6 @@ private constructor( ACCOUNT_HOLDER_CREATED, ACCOUNT_HOLDER_UPDATED, ACCOUNT_HOLDER_VERIFICATION, - AUTH_RULES_PERFORMANCE_REPORT_CREATED, BALANCE_UPDATED, BOOK_TRANSFER_TRANSACTION_CREATED, CARD_CREATED, @@ -831,7 +827,6 @@ private constructor( ACCOUNT_HOLDER_CREATED, ACCOUNT_HOLDER_UPDATED, ACCOUNT_HOLDER_VERIFICATION, - AUTH_RULES_PERFORMANCE_REPORT_CREATED, BALANCE_UPDATED, BOOK_TRANSFER_TRANSACTION_CREATED, CARD_CREATED, @@ -893,7 +888,6 @@ private constructor( ACCOUNT_HOLDER_CREATED -> Value.ACCOUNT_HOLDER_CREATED ACCOUNT_HOLDER_UPDATED -> Value.ACCOUNT_HOLDER_UPDATED ACCOUNT_HOLDER_VERIFICATION -> Value.ACCOUNT_HOLDER_VERIFICATION - AUTH_RULES_PERFORMANCE_REPORT_CREATED -> Value.AUTH_RULES_PERFORMANCE_REPORT_CREATED BALANCE_UPDATED -> Value.BALANCE_UPDATED BOOK_TRANSFER_TRANSACTION_CREATED -> Value.BOOK_TRANSFER_TRANSACTION_CREATED CARD_CREATED -> Value.CARD_CREATED @@ -959,7 +953,6 @@ private constructor( ACCOUNT_HOLDER_CREATED -> Known.ACCOUNT_HOLDER_CREATED ACCOUNT_HOLDER_UPDATED -> Known.ACCOUNT_HOLDER_UPDATED ACCOUNT_HOLDER_VERIFICATION -> Known.ACCOUNT_HOLDER_VERIFICATION - AUTH_RULES_PERFORMANCE_REPORT_CREATED -> Known.AUTH_RULES_PERFORMANCE_REPORT_CREATED BALANCE_UPDATED -> Known.BALANCE_UPDATED BOOK_TRANSFER_TRANSACTION_CREATED -> Known.BOOK_TRANSFER_TRANSACTION_CREATED CARD_CREATED -> Known.CARD_CREATED diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionSendSimulatedExampleParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionSendSimulatedExampleParams.kt index a604115c0..3dfb9918c 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionSendSimulatedExampleParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionSendSimulatedExampleParams.kt @@ -430,9 +430,6 @@ private constructor( @JvmField val ACCOUNT_HOLDER_VERIFICATION = of("account_holder.verification") - @JvmField - val AUTH_RULES_PERFORMANCE_REPORT_CREATED = of("auth_rules.performance_report.created") - @JvmField val BALANCE_UPDATED = of("balance.updated") @JvmField @@ -540,7 +537,6 @@ private constructor( ACCOUNT_HOLDER_CREATED, ACCOUNT_HOLDER_UPDATED, ACCOUNT_HOLDER_VERIFICATION, - AUTH_RULES_PERFORMANCE_REPORT_CREATED, BALANCE_UPDATED, BOOK_TRANSFER_TRANSACTION_CREATED, CARD_CREATED, @@ -599,7 +595,6 @@ private constructor( ACCOUNT_HOLDER_CREATED, ACCOUNT_HOLDER_UPDATED, ACCOUNT_HOLDER_VERIFICATION, - AUTH_RULES_PERFORMANCE_REPORT_CREATED, BALANCE_UPDATED, BOOK_TRANSFER_TRANSACTION_CREATED, CARD_CREATED, @@ -661,7 +656,6 @@ private constructor( ACCOUNT_HOLDER_CREATED -> Value.ACCOUNT_HOLDER_CREATED ACCOUNT_HOLDER_UPDATED -> Value.ACCOUNT_HOLDER_UPDATED ACCOUNT_HOLDER_VERIFICATION -> Value.ACCOUNT_HOLDER_VERIFICATION - AUTH_RULES_PERFORMANCE_REPORT_CREATED -> Value.AUTH_RULES_PERFORMANCE_REPORT_CREATED BALANCE_UPDATED -> Value.BALANCE_UPDATED BOOK_TRANSFER_TRANSACTION_CREATED -> Value.BOOK_TRANSFER_TRANSACTION_CREATED CARD_CREATED -> Value.CARD_CREATED @@ -727,7 +721,6 @@ private constructor( ACCOUNT_HOLDER_CREATED -> Known.ACCOUNT_HOLDER_CREATED ACCOUNT_HOLDER_UPDATED -> Known.ACCOUNT_HOLDER_UPDATED ACCOUNT_HOLDER_VERIFICATION -> Known.ACCOUNT_HOLDER_VERIFICATION - AUTH_RULES_PERFORMANCE_REPORT_CREATED -> Known.AUTH_RULES_PERFORMANCE_REPORT_CREATED BALANCE_UPDATED -> Known.BALANCE_UPDATED BOOK_TRANSFER_TRANSACTION_CREATED -> Known.BOOK_TRANSFER_TRANSACTION_CREATED CARD_CREATED -> Known.CARD_CREATED diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionUpdateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionUpdateParams.kt index 62f4b96ab..378c3f5b6 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionUpdateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionUpdateParams.kt @@ -685,9 +685,6 @@ private constructor( @JvmField val ACCOUNT_HOLDER_VERIFICATION = of("account_holder.verification") - @JvmField - val AUTH_RULES_PERFORMANCE_REPORT_CREATED = of("auth_rules.performance_report.created") - @JvmField val BALANCE_UPDATED = of("balance.updated") @JvmField @@ -795,7 +792,6 @@ private constructor( ACCOUNT_HOLDER_CREATED, ACCOUNT_HOLDER_UPDATED, ACCOUNT_HOLDER_VERIFICATION, - AUTH_RULES_PERFORMANCE_REPORT_CREATED, BALANCE_UPDATED, BOOK_TRANSFER_TRANSACTION_CREATED, CARD_CREATED, @@ -854,7 +850,6 @@ private constructor( ACCOUNT_HOLDER_CREATED, ACCOUNT_HOLDER_UPDATED, ACCOUNT_HOLDER_VERIFICATION, - AUTH_RULES_PERFORMANCE_REPORT_CREATED, BALANCE_UPDATED, BOOK_TRANSFER_TRANSACTION_CREATED, CARD_CREATED, @@ -916,7 +911,6 @@ private constructor( ACCOUNT_HOLDER_CREATED -> Value.ACCOUNT_HOLDER_CREATED ACCOUNT_HOLDER_UPDATED -> Value.ACCOUNT_HOLDER_UPDATED ACCOUNT_HOLDER_VERIFICATION -> Value.ACCOUNT_HOLDER_VERIFICATION - AUTH_RULES_PERFORMANCE_REPORT_CREATED -> Value.AUTH_RULES_PERFORMANCE_REPORT_CREATED BALANCE_UPDATED -> Value.BALANCE_UPDATED BOOK_TRANSFER_TRANSACTION_CREATED -> Value.BOOK_TRANSFER_TRANSACTION_CREATED CARD_CREATED -> Value.CARD_CREATED @@ -982,7 +976,6 @@ private constructor( ACCOUNT_HOLDER_CREATED -> Known.ACCOUNT_HOLDER_CREATED ACCOUNT_HOLDER_UPDATED -> Known.ACCOUNT_HOLDER_UPDATED ACCOUNT_HOLDER_VERIFICATION -> Known.ACCOUNT_HOLDER_VERIFICATION - AUTH_RULES_PERFORMANCE_REPORT_CREATED -> Known.AUTH_RULES_PERFORMANCE_REPORT_CREATED BALANCE_UPDATED -> Known.BALANCE_UPDATED BOOK_TRANSFER_TRANSACTION_CREATED -> Known.BOOK_TRANSFER_TRANSACTION_CREATED CARD_CREATED -> Known.CARD_CREATED diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountCreateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountCreateParams.kt index 7c794dc30..b0ffa0759 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountCreateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountCreateParams.kt @@ -21,7 +21,6 @@ import com.lithic.api.core.JsonField import com.lithic.api.core.JsonMissing import com.lithic.api.core.JsonValue import com.lithic.api.core.Params -import com.lithic.api.core.allMaxBy import com.lithic.api.core.checkRequired import com.lithic.api.core.getOrThrow import com.lithic.api.core.http.Headers @@ -96,13 +95,6 @@ private constructor( ) ) - /** - * Alias for calling [body] with - * `Body.ofPlaidCreateBankAccountApiRequest(plaidCreateBankAccountApiRequest)`. - */ - fun body(plaidCreateBankAccountApiRequest: Body.PlaidCreateBankAccountApiRequest) = - body(Body.ofPlaidCreateBankAccountApiRequest(plaidCreateBankAccountApiRequest)) - /** Alias for calling [body] with `Body.ofExternallyVerified(externallyVerified)`. */ fun body(externallyVerified: Body.ExternallyVerifiedCreateBankAccountApiRequest) = body(Body.ofExternallyVerified(externallyVerified)) @@ -235,7 +227,6 @@ private constructor( private val bankVerifiedCreateBankAccountApiRequest: BankVerifiedCreateBankAccountApiRequest? = null, - private val plaidCreateBankAccountApiRequest: PlaidCreateBankAccountApiRequest? = null, private val externallyVerified: ExternallyVerifiedCreateBankAccountApiRequest? = null, private val unverified: UnverifiedCreateBankAccountApiRequest? = null, private val _json: JsonValue? = null, @@ -245,9 +236,6 @@ private constructor( Optional = Optional.ofNullable(bankVerifiedCreateBankAccountApiRequest) - fun plaidCreateBankAccountApiRequest(): Optional = - Optional.ofNullable(plaidCreateBankAccountApiRequest) - fun externallyVerified(): Optional = Optional.ofNullable(externallyVerified) @@ -257,8 +245,6 @@ private constructor( fun isBankVerifiedCreateBankAccountApiRequest(): Boolean = bankVerifiedCreateBankAccountApiRequest != null - fun isPlaidCreateBankAccountApiRequest(): Boolean = plaidCreateBankAccountApiRequest != null - fun isExternallyVerified(): Boolean = externallyVerified != null fun isUnverified(): Boolean = unverified != null @@ -268,9 +254,6 @@ private constructor( "bankVerifiedCreateBankAccountApiRequest" ) - fun asPlaidCreateBankAccountApiRequest(): PlaidCreateBankAccountApiRequest = - plaidCreateBankAccountApiRequest.getOrThrow("plaidCreateBankAccountApiRequest") - fun asExternallyVerified(): ExternallyVerifiedCreateBankAccountApiRequest = externallyVerified.getOrThrow("externallyVerified") @@ -285,8 +268,6 @@ private constructor( visitor.visitBankVerifiedCreateBankAccountApiRequest( bankVerifiedCreateBankAccountApiRequest ) - plaidCreateBankAccountApiRequest != null -> - visitor.visitPlaidCreateBankAccountApiRequest(plaidCreateBankAccountApiRequest) externallyVerified != null -> visitor.visitExternallyVerified(externallyVerified) unverified != null -> visitor.visitUnverified(unverified) else -> visitor.unknown(_json) @@ -308,12 +289,6 @@ private constructor( bankVerifiedCreateBankAccountApiRequest.validate() } - override fun visitPlaidCreateBankAccountApiRequest( - plaidCreateBankAccountApiRequest: PlaidCreateBankAccountApiRequest - ) { - plaidCreateBankAccountApiRequest.validate() - } - override fun visitExternallyVerified( externallyVerified: ExternallyVerifiedCreateBankAccountApiRequest ) { @@ -353,10 +328,6 @@ private constructor( BankVerifiedCreateBankAccountApiRequest ) = bankVerifiedCreateBankAccountApiRequest.validity() - override fun visitPlaidCreateBankAccountApiRequest( - plaidCreateBankAccountApiRequest: PlaidCreateBankAccountApiRequest - ) = plaidCreateBankAccountApiRequest.validity() - override fun visitExternallyVerified( externallyVerified: ExternallyVerifiedCreateBankAccountApiRequest ) = externallyVerified.validity() @@ -377,25 +348,17 @@ private constructor( return other is Body && bankVerifiedCreateBankAccountApiRequest == other.bankVerifiedCreateBankAccountApiRequest && - plaidCreateBankAccountApiRequest == other.plaidCreateBankAccountApiRequest && externallyVerified == other.externallyVerified && unverified == other.unverified } override fun hashCode(): Int = - Objects.hash( - bankVerifiedCreateBankAccountApiRequest, - plaidCreateBankAccountApiRequest, - externallyVerified, - unverified, - ) + Objects.hash(bankVerifiedCreateBankAccountApiRequest, externallyVerified, unverified) override fun toString(): String = when { bankVerifiedCreateBankAccountApiRequest != null -> "Body{bankVerifiedCreateBankAccountApiRequest=$bankVerifiedCreateBankAccountApiRequest}" - plaidCreateBankAccountApiRequest != null -> - "Body{plaidCreateBankAccountApiRequest=$plaidCreateBankAccountApiRequest}" externallyVerified != null -> "Body{externallyVerified=$externallyVerified}" unverified != null -> "Body{unverified=$unverified}" _json != null -> "Body{_unknown=$_json}" @@ -413,11 +376,6 @@ private constructor( bankVerifiedCreateBankAccountApiRequest ) - @JvmStatic - fun ofPlaidCreateBankAccountApiRequest( - plaidCreateBankAccountApiRequest: PlaidCreateBankAccountApiRequest - ) = Body(plaidCreateBankAccountApiRequest = plaidCreateBankAccountApiRequest) - @JvmStatic fun ofExternallyVerified( externallyVerified: ExternallyVerifiedCreateBankAccountApiRequest @@ -435,10 +393,6 @@ private constructor( bankVerifiedCreateBankAccountApiRequest: BankVerifiedCreateBankAccountApiRequest ): T - fun visitPlaidCreateBankAccountApiRequest( - plaidCreateBankAccountApiRequest: PlaidCreateBankAccountApiRequest - ): T - fun visitExternallyVerified( externallyVerified: ExternallyVerifiedCreateBankAccountApiRequest ): T @@ -484,31 +438,12 @@ private constructor( } } - val bestMatches = - sequenceOf( - tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Body(bankVerifiedCreateBankAccountApiRequest = it, _json = json) - }, - tryDeserialize(node, jacksonTypeRef()) - ?.let { Body(plaidCreateBankAccountApiRequest = it, _json = json) }, - ) - .filterNotNull() - .allMaxBy { it.validity() } - .toList() - return when (bestMatches.size) { - // This can happen if what we're deserializing is completely incompatible with - // all the possible variants (e.g. deserializing from boolean). - 0 -> Body(_json = json) - 1 -> bestMatches.single() - // If there's more than one match with the highest validity, then use the first - // completely valid match, or simply the first match if none are completely - // valid. - else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first() - } + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { Body(bankVerifiedCreateBankAccountApiRequest = it, _json = json) } + ?: Body(_json = json) } } @@ -522,8 +457,6 @@ private constructor( when { value.bankVerifiedCreateBankAccountApiRequest != null -> generator.writeObject(value.bankVerifiedCreateBankAccountApiRequest) - value.plaidCreateBankAccountApiRequest != null -> - generator.writeObject(value.plaidCreateBankAccountApiRequest) value.externallyVerified != null -> generator.writeObject(value.externallyVerified) value.unverified != null -> generator.writeObject(value.unverified) @@ -1566,548 +1499,6 @@ private constructor( "BankVerifiedCreateBankAccountApiRequest{accountNumber=$accountNumber, country=$country, currency=$currency, financialAccountToken=$financialAccountToken, owner=$owner, ownerType=$ownerType, routingNumber=$routingNumber, type=$type, verificationMethod=$verificationMethod, accountToken=$accountToken, address=$address, companyId=$companyId, dob=$dob, doingBusinessAs=$doingBusinessAs, name=$name, userDefinedId=$userDefinedId, verificationEnforcement=$verificationEnforcement, additionalProperties=$additionalProperties}" } - class PlaidCreateBankAccountApiRequest - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val owner: JsonField, - private val ownerType: JsonField, - private val processorToken: JsonField, - private val verificationMethod: JsonField, - private val accountToken: JsonField, - private val companyId: JsonField, - private val dob: JsonField, - private val doingBusinessAs: JsonField, - private val userDefinedId: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("owner") @ExcludeMissing owner: JsonField = JsonMissing.of(), - @JsonProperty("owner_type") - @ExcludeMissing - ownerType: JsonField = JsonMissing.of(), - @JsonProperty("processor_token") - @ExcludeMissing - processorToken: JsonField = JsonMissing.of(), - @JsonProperty("verification_method") - @ExcludeMissing - verificationMethod: JsonField = JsonMissing.of(), - @JsonProperty("account_token") - @ExcludeMissing - accountToken: JsonField = JsonMissing.of(), - @JsonProperty("company_id") - @ExcludeMissing - companyId: JsonField = JsonMissing.of(), - @JsonProperty("dob") @ExcludeMissing dob: JsonField = JsonMissing.of(), - @JsonProperty("doing_business_as") - @ExcludeMissing - doingBusinessAs: JsonField = JsonMissing.of(), - @JsonProperty("user_defined_id") - @ExcludeMissing - userDefinedId: JsonField = JsonMissing.of(), - ) : this( - owner, - ownerType, - processorToken, - verificationMethod, - accountToken, - companyId, - dob, - doingBusinessAs, - userDefinedId, - mutableMapOf(), - ) - - /** - * Legal Name of the business or individual who owns the external account. This will - * appear in statements - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun owner(): String = owner.getRequired("owner") - - /** - * Owner Type - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun ownerType(): OwnerType = ownerType.getRequired("owner_type") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun processorToken(): String = processorToken.getRequired("processor_token") - - /** - * Verification Method - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun verificationMethod(): VerificationMethod = - verificationMethod.getRequired("verification_method") - - /** - * Indicates which Lithic account the external account is associated with. For external - * accounts that are associated with the program, account_token field returned will be - * null - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun accountToken(): Optional = accountToken.getOptional("account_token") - - /** - * Optional field that helps identify bank accounts in receipts - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun companyId(): Optional = companyId.getOptional("company_id") - - /** - * Date of Birth of the Individual that owns the external bank account - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun dob(): Optional = dob.getOptional("dob") - - /** - * Doing Business As - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun doingBusinessAs(): Optional = - doingBusinessAs.getOptional("doing_business_as") - - /** - * User Defined ID - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun userDefinedId(): Optional = userDefinedId.getOptional("user_defined_id") - - /** - * Returns the raw JSON value of [owner]. - * - * Unlike [owner], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("owner") @ExcludeMissing fun _owner(): JsonField = owner - - /** - * Returns the raw JSON value of [ownerType]. - * - * Unlike [ownerType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("owner_type") - @ExcludeMissing - fun _ownerType(): JsonField = ownerType - - /** - * Returns the raw JSON value of [processorToken]. - * - * Unlike [processorToken], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("processor_token") - @ExcludeMissing - fun _processorToken(): JsonField = processorToken - - /** - * Returns the raw JSON value of [verificationMethod]. - * - * Unlike [verificationMethod], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("verification_method") - @ExcludeMissing - fun _verificationMethod(): JsonField = verificationMethod - - /** - * Returns the raw JSON value of [accountToken]. - * - * Unlike [accountToken], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("account_token") - @ExcludeMissing - fun _accountToken(): JsonField = accountToken - - /** - * Returns the raw JSON value of [companyId]. - * - * Unlike [companyId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("company_id") - @ExcludeMissing - fun _companyId(): JsonField = companyId - - /** - * Returns the raw JSON value of [dob]. - * - * Unlike [dob], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("dob") @ExcludeMissing fun _dob(): JsonField = dob - - /** - * Returns the raw JSON value of [doingBusinessAs]. - * - * Unlike [doingBusinessAs], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("doing_business_as") - @ExcludeMissing - fun _doingBusinessAs(): JsonField = doingBusinessAs - - /** - * Returns the raw JSON value of [userDefinedId]. - * - * Unlike [userDefinedId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("user_defined_id") - @ExcludeMissing - fun _userDefinedId(): JsonField = userDefinedId - - @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 - * [PlaidCreateBankAccountApiRequest]. - * - * The following fields are required: - * ```java - * .owner() - * .ownerType() - * .processorToken() - * .verificationMethod() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [PlaidCreateBankAccountApiRequest]. */ - class Builder internal constructor() { - - private var owner: JsonField? = null - private var ownerType: JsonField? = null - private var processorToken: JsonField? = null - private var verificationMethod: JsonField? = null - private var accountToken: JsonField = JsonMissing.of() - private var companyId: JsonField = JsonMissing.of() - private var dob: JsonField = JsonMissing.of() - private var doingBusinessAs: JsonField = JsonMissing.of() - private var userDefinedId: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from( - plaidCreateBankAccountApiRequest: PlaidCreateBankAccountApiRequest - ) = apply { - owner = plaidCreateBankAccountApiRequest.owner - ownerType = plaidCreateBankAccountApiRequest.ownerType - processorToken = plaidCreateBankAccountApiRequest.processorToken - verificationMethod = plaidCreateBankAccountApiRequest.verificationMethod - accountToken = plaidCreateBankAccountApiRequest.accountToken - companyId = plaidCreateBankAccountApiRequest.companyId - dob = plaidCreateBankAccountApiRequest.dob - doingBusinessAs = plaidCreateBankAccountApiRequest.doingBusinessAs - userDefinedId = plaidCreateBankAccountApiRequest.userDefinedId - additionalProperties = - plaidCreateBankAccountApiRequest.additionalProperties.toMutableMap() - } - - /** - * Legal Name of the business or individual who owns the external account. This will - * appear in statements - */ - fun owner(owner: String) = owner(JsonField.of(owner)) - - /** - * Sets [Builder.owner] to an arbitrary JSON value. - * - * You should usually call [Builder.owner] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun owner(owner: JsonField) = apply { this.owner = owner } - - /** Owner Type */ - fun ownerType(ownerType: OwnerType) = ownerType(JsonField.of(ownerType)) - - /** - * Sets [Builder.ownerType] to an arbitrary JSON value. - * - * You should usually call [Builder.ownerType] with a well-typed [OwnerType] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun ownerType(ownerType: JsonField) = apply { - this.ownerType = ownerType - } - - fun processorToken(processorToken: String) = - processorToken(JsonField.of(processorToken)) - - /** - * Sets [Builder.processorToken] to an arbitrary JSON value. - * - * You should usually call [Builder.processorToken] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun processorToken(processorToken: JsonField) = apply { - this.processorToken = processorToken - } - - /** Verification Method */ - fun verificationMethod(verificationMethod: VerificationMethod) = - verificationMethod(JsonField.of(verificationMethod)) - - /** - * Sets [Builder.verificationMethod] to an arbitrary JSON value. - * - * You should usually call [Builder.verificationMethod] with a well-typed - * [VerificationMethod] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun verificationMethod(verificationMethod: JsonField) = apply { - this.verificationMethod = verificationMethod - } - - /** - * Indicates which Lithic account the external account is associated with. For - * external accounts that are associated with the program, account_token field - * returned will be null - */ - fun accountToken(accountToken: String) = accountToken(JsonField.of(accountToken)) - - /** - * Sets [Builder.accountToken] to an arbitrary JSON value. - * - * You should usually call [Builder.accountToken] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun accountToken(accountToken: JsonField) = apply { - this.accountToken = accountToken - } - - /** Optional field that helps identify bank accounts in receipts */ - fun companyId(companyId: String) = companyId(JsonField.of(companyId)) - - /** - * Sets [Builder.companyId] to an arbitrary JSON value. - * - * You should usually call [Builder.companyId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun companyId(companyId: JsonField) = apply { this.companyId = companyId } - - /** Date of Birth of the Individual that owns the external bank account */ - fun dob(dob: LocalDate) = dob(JsonField.of(dob)) - - /** - * Sets [Builder.dob] to an arbitrary JSON value. - * - * You should usually call [Builder.dob] with a well-typed [LocalDate] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun dob(dob: JsonField) = apply { this.dob = dob } - - /** Doing Business As */ - fun doingBusinessAs(doingBusinessAs: String) = - doingBusinessAs(JsonField.of(doingBusinessAs)) - - /** - * Sets [Builder.doingBusinessAs] to an arbitrary JSON value. - * - * You should usually call [Builder.doingBusinessAs] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun doingBusinessAs(doingBusinessAs: JsonField) = apply { - this.doingBusinessAs = doingBusinessAs - } - - /** User Defined ID */ - fun userDefinedId(userDefinedId: String) = - userDefinedId(JsonField.of(userDefinedId)) - - /** - * Sets [Builder.userDefinedId] to an arbitrary JSON value. - * - * You should usually call [Builder.userDefinedId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun userDefinedId(userDefinedId: JsonField) = apply { - this.userDefinedId = userDefinedId - } - - 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 [PlaidCreateBankAccountApiRequest]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .owner() - * .ownerType() - * .processorToken() - * .verificationMethod() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): PlaidCreateBankAccountApiRequest = - PlaidCreateBankAccountApiRequest( - checkRequired("owner", owner), - checkRequired("ownerType", ownerType), - checkRequired("processorToken", processorToken), - checkRequired("verificationMethod", verificationMethod), - accountToken, - companyId, - dob, - doingBusinessAs, - userDefinedId, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): PlaidCreateBankAccountApiRequest = apply { - if (validated) { - return@apply - } - - owner() - ownerType().validate() - processorToken() - verificationMethod().validate() - accountToken() - companyId() - dob() - doingBusinessAs() - userDefinedId() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 (owner.asKnown().isPresent) 1 else 0) + - (ownerType.asKnown().getOrNull()?.validity() ?: 0) + - (if (processorToken.asKnown().isPresent) 1 else 0) + - (verificationMethod.asKnown().getOrNull()?.validity() ?: 0) + - (if (accountToken.asKnown().isPresent) 1 else 0) + - (if (companyId.asKnown().isPresent) 1 else 0) + - (if (dob.asKnown().isPresent) 1 else 0) + - (if (doingBusinessAs.asKnown().isPresent) 1 else 0) + - (if (userDefinedId.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is PlaidCreateBankAccountApiRequest && - owner == other.owner && - ownerType == other.ownerType && - processorToken == other.processorToken && - verificationMethod == other.verificationMethod && - accountToken == other.accountToken && - companyId == other.companyId && - dob == other.dob && - doingBusinessAs == other.doingBusinessAs && - userDefinedId == other.userDefinedId && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - owner, - ownerType, - processorToken, - verificationMethod, - accountToken, - companyId, - dob, - doingBusinessAs, - userDefinedId, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "PlaidCreateBankAccountApiRequest{owner=$owner, ownerType=$ownerType, processorToken=$processorToken, verificationMethod=$verificationMethod, accountToken=$accountToken, companyId=$companyId, dob=$dob, doingBusinessAs=$doingBusinessAs, userDefinedId=$userDefinedId, additionalProperties=$additionalProperties}" - } - class ExternallyVerifiedCreateBankAccountApiRequest @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalPayment.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalPayment.kt index 0f3451113..70df56882 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalPayment.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalPayment.kt @@ -27,12 +27,12 @@ class ExternalPayment private constructor( private val token: JsonField, private val created: JsonField, - private val family: JsonField, private val status: JsonField, private val updated: JsonField, private val category: JsonField, private val currency: JsonField, private val events: JsonField>, + private val family: JsonField, private val financialAccountToken: JsonField, private val paymentType: JsonField, private val pendingAmount: JsonField, @@ -48,9 +48,6 @@ private constructor( @JsonProperty("created") @ExcludeMissing created: JsonField = JsonMissing.of(), - @JsonProperty("family") - @ExcludeMissing - family: JsonField = JsonMissing.of(), @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), @@ -64,6 +61,7 @@ private constructor( @JsonProperty("events") @ExcludeMissing events: JsonField> = JsonMissing.of(), + @JsonProperty("family") @ExcludeMissing family: JsonField = JsonMissing.of(), @JsonProperty("financial_account_token") @ExcludeMissing financialAccountToken: JsonField = JsonMissing.of(), @@ -85,12 +83,12 @@ private constructor( ) : this( token, created, - family, status, updated, category, currency, events, + family, financialAccountToken, paymentType, pendingAmount, @@ -116,12 +114,6 @@ private constructor( */ fun created(): OffsetDateTime = created.getRequired("created") - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun family(): TransactionFamilyTypes = family.getRequired("family") - /** * The status of the transaction * @@ -156,6 +148,14 @@ private constructor( */ fun events(): Optional> = events.getOptional("events") + /** + * EXTERNAL_PAYMENT - External Payment Response + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun family(): Optional = family.getOptional("family") + /** * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -207,15 +207,6 @@ private constructor( */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created - /** - * Returns the raw JSON value of [family]. - * - * Unlike [family], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("family") - @ExcludeMissing - fun _family(): JsonField = family - /** * Returns the raw JSON value of [status]. * @@ -255,6 +246,13 @@ private constructor( @ExcludeMissing fun _events(): JsonField> = events + /** + * Returns the raw JSON value of [family]. + * + * Unlike [family], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("family") @ExcludeMissing fun _family(): JsonField = family + /** * Returns the raw JSON value of [financialAccountToken]. * @@ -329,7 +327,6 @@ private constructor( * ```java * .token() * .created() - * .family() * .status() * .updated() * ``` @@ -342,12 +339,12 @@ private constructor( private var token: JsonField? = null private var created: JsonField? = null - private var family: JsonField? = null private var status: JsonField? = null private var updated: JsonField? = null private var category: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() private var events: JsonField>? = null + private var family: JsonField = JsonMissing.of() private var financialAccountToken: JsonField = JsonMissing.of() private var paymentType: JsonField = JsonMissing.of() private var pendingAmount: JsonField = JsonMissing.of() @@ -360,12 +357,12 @@ private constructor( internal fun from(externalPayment: ExternalPayment) = apply { token = externalPayment.token created = externalPayment.created - family = externalPayment.family status = externalPayment.status updated = externalPayment.updated category = externalPayment.category currency = externalPayment.currency events = externalPayment.events.map { it.toMutableList() } + family = externalPayment.family financialAccountToken = externalPayment.financialAccountToken paymentType = externalPayment.paymentType pendingAmount = externalPayment.pendingAmount @@ -398,17 +395,6 @@ private constructor( */ fun created(created: JsonField) = apply { this.created = created } - fun family(family: TransactionFamilyTypes) = family(JsonField.of(family)) - - /** - * Sets [Builder.family] to an arbitrary JSON value. - * - * You should usually call [Builder.family] with a well-typed [TransactionFamilyTypes] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun family(family: JsonField) = apply { this.family = family } - /** The status of the transaction */ fun status(status: TransactionStatus) = status(JsonField.of(status)) @@ -481,6 +467,17 @@ private constructor( } } + /** EXTERNAL_PAYMENT - External Payment Response */ + fun family(family: Family) = family(JsonField.of(family)) + + /** + * Sets [Builder.family] to an arbitrary JSON value. + * + * You should usually call [Builder.family] with a well-typed [Family] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun family(family: JsonField) = apply { this.family = family } + fun financialAccountToken(financialAccountToken: String) = financialAccountToken(JsonField.of(financialAccountToken)) @@ -587,7 +584,6 @@ private constructor( * ```java * .token() * .created() - * .family() * .status() * .updated() * ``` @@ -598,12 +594,12 @@ private constructor( ExternalPayment( checkRequired("token", token), checkRequired("created", created), - checkRequired("family", family), checkRequired("status", status), checkRequired("updated", updated), category, currency, (events ?: JsonMissing.of()).map { it.toImmutable() }, + family, financialAccountToken, paymentType, pendingAmount, @@ -623,12 +619,12 @@ private constructor( token() created() - family().validate() status().validate() updated() category().ifPresent { it.validate() } currency() events().ifPresent { it.forEach { it.validate() } } + family().ifPresent { it.validate() } financialAccountToken() paymentType().ifPresent { it.validate() } pendingAmount() @@ -655,12 +651,12 @@ private constructor( internal fun validity(): Int = (if (token.asKnown().isPresent) 1 else 0) + (if (created.asKnown().isPresent) 1 else 0) + - (family.asKnown().getOrNull()?.validity() ?: 0) + (status.asKnown().getOrNull()?.validity() ?: 0) + (if (updated.asKnown().isPresent) 1 else 0) + (category.asKnown().getOrNull()?.validity() ?: 0) + (if (currency.asKnown().isPresent) 1 else 0) + (events.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (family.asKnown().getOrNull()?.validity() ?: 0) + (if (financialAccountToken.asKnown().isPresent) 1 else 0) + (paymentType.asKnown().getOrNull()?.validity() ?: 0) + (if (pendingAmount.asKnown().isPresent) 1 else 0) + @@ -668,162 +664,6 @@ private constructor( (if (settledAmount.asKnown().isPresent) 1 else 0) + (if (userDefinedId.asKnown().isPresent) 1 else 0) - class TransactionFamilyTypes - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CARD = of("CARD") - - @JvmField val PAYMENT = of("PAYMENT") - - @JvmField val TRANSFER = of("TRANSFER") - - @JvmField val INTERNAL = of("INTERNAL") - - @JvmField val EXTERNAL_PAYMENT = of("EXTERNAL_PAYMENT") - - @JvmField val MANAGEMENT_OPERATION = of("MANAGEMENT_OPERATION") - - @JvmStatic fun of(value: String) = TransactionFamilyTypes(JsonField.of(value)) - } - - /** An enum containing [TransactionFamilyTypes]'s known values. */ - enum class Known { - CARD, - PAYMENT, - TRANSFER, - INTERNAL, - EXTERNAL_PAYMENT, - MANAGEMENT_OPERATION, - } - - /** - * An enum containing [TransactionFamilyTypes]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [TransactionFamilyTypes] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CARD, - PAYMENT, - TRANSFER, - INTERNAL, - EXTERNAL_PAYMENT, - MANAGEMENT_OPERATION, - /** - * An enum member indicating that [TransactionFamilyTypes] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CARD -> Value.CARD - PAYMENT -> Value.PAYMENT - TRANSFER -> Value.TRANSFER - INTERNAL -> Value.INTERNAL - EXTERNAL_PAYMENT -> Value.EXTERNAL_PAYMENT - MANAGEMENT_OPERATION -> Value.MANAGEMENT_OPERATION - 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 LithicInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - CARD -> Known.CARD - PAYMENT -> Known.PAYMENT - TRANSFER -> Known.TRANSFER - INTERNAL -> Known.INTERNAL - EXTERNAL_PAYMENT -> Known.EXTERNAL_PAYMENT - MANAGEMENT_OPERATION -> Known.MANAGEMENT_OPERATION - else -> throw LithicInvalidDataException("Unknown TransactionFamilyTypes: $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 LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): TransactionFamilyTypes = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 TransactionFamilyTypes && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** The status of the transaction */ class TransactionStatus @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -2078,6 +1918,126 @@ private constructor( "ExternalPaymentEvent{token=$token, amount=$amount, created=$created, detailedResults=$detailedResults, effectiveDate=$effectiveDate, memo=$memo, result=$result, type=$type, additionalProperties=$additionalProperties}" } + /** EXTERNAL_PAYMENT - External Payment Response */ + class Family @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val EXTERNAL_PAYMENT = of("EXTERNAL_PAYMENT") + + @JvmStatic fun of(value: String) = Family(JsonField.of(value)) + } + + /** An enum containing [Family]'s known values. */ + enum class Known { + EXTERNAL_PAYMENT + } + + /** + * An enum containing [Family]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Family] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then 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 { + EXTERNAL_PAYMENT, + /** An enum member indicating that [Family] 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) { + EXTERNAL_PAYMENT -> Value.EXTERNAL_PAYMENT + 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 LithicInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + EXTERNAL_PAYMENT -> Known.EXTERNAL_PAYMENT + else -> throw LithicInvalidDataException("Unknown Family: $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 LithicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + fun validate(): Family = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 Family && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + class ExternalPaymentDirection @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -2347,12 +2307,12 @@ private constructor( return other is ExternalPayment && token == other.token && created == other.created && - family == other.family && status == other.status && updated == other.updated && category == other.category && currency == other.currency && events == other.events && + family == other.family && financialAccountToken == other.financialAccountToken && paymentType == other.paymentType && pendingAmount == other.pendingAmount && @@ -2366,12 +2326,12 @@ private constructor( Objects.hash( token, created, - family, status, updated, category, currency, events, + family, financialAccountToken, paymentType, pendingAmount, @@ -2385,5 +2345,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "ExternalPayment{token=$token, created=$created, family=$family, status=$status, updated=$updated, category=$category, currency=$currency, events=$events, financialAccountToken=$financialAccountToken, paymentType=$paymentType, pendingAmount=$pendingAmount, result=$result, settledAmount=$settledAmount, userDefinedId=$userDefinedId, additionalProperties=$additionalProperties}" + "ExternalPayment{token=$token, created=$created, status=$status, updated=$updated, category=$category, currency=$currency, events=$events, family=$family, financialAccountToken=$financialAccountToken, paymentType=$paymentType, pendingAmount=$pendingAmount, result=$result, settledAmount=$settledAmount, userDefinedId=$userDefinedId, additionalProperties=$additionalProperties}" } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccount.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccount.kt index 21e8c0110..8baafa20e 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccount.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccount.kt @@ -616,22 +616,23 @@ private constructor( class FinancialAccountCreditConfig @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val chargedOffReason: JsonField, + private val autoCollectionConfiguration: JsonField, private val creditLimit: JsonField, private val creditProductToken: JsonField, private val externalBankAccountToken: JsonField, + private val tier: JsonField, + private val chargedOffReason: JsonField, private val financialAccountState: JsonField, private val isSpendBlocked: JsonField, - private val tier: JsonField, - private val autoCollectionConfiguration: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("charged_off_reason") + @JsonProperty("auto_collection_configuration") @ExcludeMissing - chargedOffReason: JsonField = JsonMissing.of(), + autoCollectionConfiguration: JsonField = + JsonMissing.of(), @JsonProperty("credit_limit") @ExcludeMissing creditLimit: JsonField = JsonMissing.of(), @@ -641,37 +642,34 @@ private constructor( @JsonProperty("external_bank_account_token") @ExcludeMissing externalBankAccountToken: JsonField = JsonMissing.of(), + @JsonProperty("tier") @ExcludeMissing tier: JsonField = JsonMissing.of(), + @JsonProperty("charged_off_reason") + @ExcludeMissing + chargedOffReason: JsonField = JsonMissing.of(), @JsonProperty("financial_account_state") @ExcludeMissing financialAccountState: JsonField = JsonMissing.of(), @JsonProperty("is_spend_blocked") @ExcludeMissing isSpendBlocked: JsonField = JsonMissing.of(), - @JsonProperty("tier") @ExcludeMissing tier: JsonField = JsonMissing.of(), - @JsonProperty("auto_collection_configuration") - @ExcludeMissing - autoCollectionConfiguration: JsonField = - JsonMissing.of(), ) : this( - chargedOffReason, + autoCollectionConfiguration, creditLimit, creditProductToken, externalBankAccountToken, + tier, + chargedOffReason, financialAccountState, isSpendBlocked, - tier, - autoCollectionConfiguration, mutableMapOf(), ) /** - * Reason for the financial account being marked as Charged Off - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun chargedOffReason(): Optional = - chargedOffReason.getOptional("charged_off_reason") + fun autoCollectionConfiguration(): AutoCollectionConfigurationResponse = + autoCollectionConfiguration.getRequired("auto_collection_configuration") /** * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the @@ -696,44 +694,50 @@ private constructor( externalBankAccountToken.getOptional("external_bank_account_token") /** - * State of the financial account + * Tier assigned to the financial account * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun financialAccountState(): Optional = - financialAccountState.getOptional("financial_account_state") + fun tier(): Optional = tier.getOptional("tier") /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Reason for the financial account being marked as Charged Off + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun isSpendBlocked(): Boolean = isSpendBlocked.getRequired("is_spend_blocked") + @Deprecated("deprecated") + fun chargedOffReason(): Optional = + chargedOffReason.getOptional("charged_off_reason") /** - * Tier assigned to the financial account + * State of the financial account * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun tier(): Optional = tier.getOptional("tier") + @Deprecated("deprecated") + fun financialAccountState(): Optional = + financialAccountState.getOptional("financial_account_state") /** * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun autoCollectionConfiguration(): Optional = - autoCollectionConfiguration.getOptional("auto_collection_configuration") + @Deprecated("deprecated") + fun isSpendBlocked(): Optional = isSpendBlocked.getOptional("is_spend_blocked") /** - * Returns the raw JSON value of [chargedOffReason]. + * Returns the raw JSON value of [autoCollectionConfiguration]. * - * Unlike [chargedOffReason], this method doesn't throw if the JSON field has an unexpected - * type. + * Unlike [autoCollectionConfiguration], this method doesn't throw if the JSON field has an + * unexpected type. */ - @JsonProperty("charged_off_reason") + @JsonProperty("auto_collection_configuration") @ExcludeMissing - fun _chargedOffReason(): JsonField = chargedOffReason + fun _autoCollectionConfiguration(): JsonField = + autoCollectionConfiguration /** * Returns the raw JSON value of [creditLimit]. @@ -764,12 +768,31 @@ private constructor( @ExcludeMissing fun _externalBankAccountToken(): JsonField = externalBankAccountToken + /** + * Returns the raw JSON value of [tier]. + * + * Unlike [tier], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tier") @ExcludeMissing fun _tier(): JsonField = tier + + /** + * Returns the raw JSON value of [chargedOffReason]. + * + * Unlike [chargedOffReason], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @Deprecated("deprecated") + @JsonProperty("charged_off_reason") + @ExcludeMissing + fun _chargedOffReason(): JsonField = chargedOffReason + /** * Returns the raw JSON value of [financialAccountState]. * * Unlike [financialAccountState], this method doesn't throw if the JSON field has an * unexpected type. */ + @Deprecated("deprecated") @JsonProperty("financial_account_state") @ExcludeMissing fun _financialAccountState(): JsonField = financialAccountState @@ -780,28 +803,11 @@ private constructor( * Unlike [isSpendBlocked], this method doesn't throw if the JSON field has an unexpected * type. */ + @Deprecated("deprecated") @JsonProperty("is_spend_blocked") @ExcludeMissing fun _isSpendBlocked(): JsonField = isSpendBlocked - /** - * Returns the raw JSON value of [tier]. - * - * Unlike [tier], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("tier") @ExcludeMissing fun _tier(): JsonField = tier - - /** - * Returns the raw JSON value of [autoCollectionConfiguration]. - * - * Unlike [autoCollectionConfiguration], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("auto_collection_configuration") - @ExcludeMissing - fun _autoCollectionConfiguration(): JsonField = - autoCollectionConfiguration - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -822,12 +828,10 @@ private constructor( * * The following fields are required: * ```java - * .chargedOffReason() + * .autoCollectionConfiguration() * .creditLimit() * .creditProductToken() * .externalBankAccountToken() - * .financialAccountState() - * .isSpendBlocked() * .tier() * ``` */ @@ -837,53 +841,47 @@ private constructor( /** A builder for [FinancialAccountCreditConfig]. */ class Builder internal constructor() { - private var chargedOffReason: JsonField? = null + private var autoCollectionConfiguration: + JsonField? = + null private var creditLimit: JsonField? = null private var creditProductToken: JsonField? = null private var externalBankAccountToken: JsonField? = null - private var financialAccountState: JsonField? = null - private var isSpendBlocked: JsonField? = null private var tier: JsonField? = null - private var autoCollectionConfiguration: - JsonField = - JsonMissing.of() + private var chargedOffReason: JsonField = JsonMissing.of() + private var financialAccountState: JsonField = JsonMissing.of() + private var isSpendBlocked: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(financialAccountCreditConfig: FinancialAccountCreditConfig) = apply { - chargedOffReason = financialAccountCreditConfig.chargedOffReason + autoCollectionConfiguration = + financialAccountCreditConfig.autoCollectionConfiguration creditLimit = financialAccountCreditConfig.creditLimit creditProductToken = financialAccountCreditConfig.creditProductToken externalBankAccountToken = financialAccountCreditConfig.externalBankAccountToken + tier = financialAccountCreditConfig.tier + chargedOffReason = financialAccountCreditConfig.chargedOffReason financialAccountState = financialAccountCreditConfig.financialAccountState isSpendBlocked = financialAccountCreditConfig.isSpendBlocked - tier = financialAccountCreditConfig.tier - autoCollectionConfiguration = - financialAccountCreditConfig.autoCollectionConfiguration additionalProperties = financialAccountCreditConfig.additionalProperties.toMutableMap() } - /** Reason for the financial account being marked as Charged Off */ - fun chargedOffReason(chargedOffReason: ChargedOffReason?) = - chargedOffReason(JsonField.ofNullable(chargedOffReason)) - - /** - * Alias for calling [Builder.chargedOffReason] with `chargedOffReason.orElse(null)`. - */ - fun chargedOffReason(chargedOffReason: Optional) = - chargedOffReason(chargedOffReason.getOrNull()) + fun autoCollectionConfiguration( + autoCollectionConfiguration: AutoCollectionConfigurationResponse + ) = autoCollectionConfiguration(JsonField.of(autoCollectionConfiguration)) /** - * Sets [Builder.chargedOffReason] to an arbitrary JSON value. + * Sets [Builder.autoCollectionConfiguration] to an arbitrary JSON value. * - * You should usually call [Builder.chargedOffReason] with a well-typed - * [ChargedOffReason] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * You should usually call [Builder.autoCollectionConfiguration] with a well-typed + * [AutoCollectionConfigurationResponse] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. */ - fun chargedOffReason(chargedOffReason: JsonField) = apply { - this.chargedOffReason = chargedOffReason - } + fun autoCollectionConfiguration( + autoCollectionConfiguration: JsonField + ) = apply { this.autoCollectionConfiguration = autoCollectionConfiguration } fun creditLimit(creditLimit: Long?) = creditLimit(JsonField.ofNullable(creditLimit)) @@ -949,7 +947,47 @@ private constructor( this.externalBankAccountToken = externalBankAccountToken } + /** Tier assigned to the financial account */ + fun tier(tier: String?) = tier(JsonField.ofNullable(tier)) + + /** Alias for calling [Builder.tier] with `tier.orElse(null)`. */ + fun tier(tier: Optional) = tier(tier.getOrNull()) + + /** + * Sets [Builder.tier] to an arbitrary JSON value. + * + * You should usually call [Builder.tier] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun tier(tier: JsonField) = apply { this.tier = tier } + + /** Reason for the financial account being marked as Charged Off */ + @Deprecated("deprecated") + fun chargedOffReason(chargedOffReason: ChargedOffReason?) = + chargedOffReason(JsonField.ofNullable(chargedOffReason)) + + /** + * Alias for calling [Builder.chargedOffReason] with `chargedOffReason.orElse(null)`. + */ + @Deprecated("deprecated") + fun chargedOffReason(chargedOffReason: Optional) = + chargedOffReason(chargedOffReason.getOrNull()) + + /** + * Sets [Builder.chargedOffReason] to an arbitrary JSON value. + * + * You should usually call [Builder.chargedOffReason] with a well-typed + * [ChargedOffReason] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + @Deprecated("deprecated") + fun chargedOffReason(chargedOffReason: JsonField) = apply { + this.chargedOffReason = chargedOffReason + } + /** State of the financial account */ + @Deprecated("deprecated") fun financialAccountState(financialAccountState: FinancialAccountState?) = financialAccountState(JsonField.ofNullable(financialAccountState)) @@ -957,6 +995,7 @@ private constructor( * Alias for calling [Builder.financialAccountState] with * `financialAccountState.orElse(null)`. */ + @Deprecated("deprecated") fun financialAccountState(financialAccountState: Optional) = financialAccountState(financialAccountState.getOrNull()) @@ -967,11 +1006,13 @@ private constructor( * [FinancialAccountState] value instead. This method is primarily for setting the field * to an undocumented or not yet supported value. */ + @Deprecated("deprecated") fun financialAccountState(financialAccountState: JsonField) = apply { this.financialAccountState = financialAccountState } + @Deprecated("deprecated") fun isSpendBlocked(isSpendBlocked: Boolean) = isSpendBlocked(JsonField.of(isSpendBlocked)) @@ -982,40 +1023,11 @@ private constructor( * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ + @Deprecated("deprecated") fun isSpendBlocked(isSpendBlocked: JsonField) = apply { this.isSpendBlocked = isSpendBlocked } - /** Tier assigned to the financial account */ - fun tier(tier: String?) = tier(JsonField.ofNullable(tier)) - - /** Alias for calling [Builder.tier] with `tier.orElse(null)`. */ - fun tier(tier: Optional) = tier(tier.getOrNull()) - - /** - * Sets [Builder.tier] to an arbitrary JSON value. - * - * You should usually call [Builder.tier] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun tier(tier: JsonField) = apply { this.tier = tier } - - fun autoCollectionConfiguration( - autoCollectionConfiguration: AutoCollectionConfigurationResponse - ) = autoCollectionConfiguration(JsonField.of(autoCollectionConfiguration)) - - /** - * Sets [Builder.autoCollectionConfiguration] to an arbitrary JSON value. - * - * You should usually call [Builder.autoCollectionConfiguration] with a well-typed - * [AutoCollectionConfigurationResponse] value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. - */ - fun autoCollectionConfiguration( - autoCollectionConfiguration: JsonField - ) = apply { this.autoCollectionConfiguration = autoCollectionConfiguration } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1042,12 +1054,10 @@ private constructor( * * The following fields are required: * ```java - * .chargedOffReason() + * .autoCollectionConfiguration() * .creditLimit() * .creditProductToken() * .externalBankAccountToken() - * .financialAccountState() - * .isSpendBlocked() * .tier() * ``` * @@ -1055,14 +1065,14 @@ private constructor( */ fun build(): FinancialAccountCreditConfig = FinancialAccountCreditConfig( - checkRequired("chargedOffReason", chargedOffReason), + checkRequired("autoCollectionConfiguration", autoCollectionConfiguration), checkRequired("creditLimit", creditLimit), checkRequired("creditProductToken", creditProductToken), checkRequired("externalBankAccountToken", externalBankAccountToken), - checkRequired("financialAccountState", financialAccountState), - checkRequired("isSpendBlocked", isSpendBlocked), checkRequired("tier", tier), - autoCollectionConfiguration, + chargedOffReason, + financialAccountState, + isSpendBlocked, additionalProperties.toMutableMap(), ) } @@ -1074,14 +1084,14 @@ private constructor( return@apply } - chargedOffReason().ifPresent { it.validate() } + autoCollectionConfiguration().validate() creditLimit() creditProductToken() externalBankAccountToken() + tier() + chargedOffReason().ifPresent { it.validate() } financialAccountState().ifPresent { it.validate() } isSpendBlocked() - tier() - autoCollectionConfiguration().ifPresent { it.validate() } validated = true } @@ -1101,42 +1111,223 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (chargedOffReason.asKnown().getOrNull()?.validity() ?: 0) + + (autoCollectionConfiguration.asKnown().getOrNull()?.validity() ?: 0) + (if (creditLimit.asKnown().isPresent) 1 else 0) + (if (creditProductToken.asKnown().isPresent) 1 else 0) + (if (externalBankAccountToken.asKnown().isPresent) 1 else 0) + - (financialAccountState.asKnown().getOrNull()?.validity() ?: 0) + - (if (isSpendBlocked.asKnown().isPresent) 1 else 0) + (if (tier.asKnown().isPresent) 1 else 0) + - (autoCollectionConfiguration.asKnown().getOrNull()?.validity() ?: 0) + (chargedOffReason.asKnown().getOrNull()?.validity() ?: 0) + + (financialAccountState.asKnown().getOrNull()?.validity() ?: 0) + + (if (isSpendBlocked.asKnown().isPresent) 1 else 0) - /** Reason for the financial account being marked as Charged Off */ - class ChargedOffReason - @JsonCreator - private constructor(private val value: JsonField) : Enum { + class AutoCollectionConfigurationResponse + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val autoCollectionEnabled: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("auto_collection_enabled") + @ExcludeMissing + autoCollectionEnabled: JsonField = JsonMissing.of() + ) : this(autoCollectionEnabled, mutableMapOf()) /** - * Returns this class instance's raw value. + * If auto collection is enabled for this account * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if 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 LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val DELINQUENT = of("DELINQUENT") + fun autoCollectionEnabled(): Boolean = + autoCollectionEnabled.getRequired("auto_collection_enabled") - @JvmField val FRAUD = of("FRAUD") + /** + * Returns the raw JSON value of [autoCollectionEnabled]. + * + * Unlike [autoCollectionEnabled], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("auto_collection_enabled") + @ExcludeMissing + fun _autoCollectionEnabled(): JsonField = autoCollectionEnabled - @JvmStatic fun of(value: String) = ChargedOffReason(JsonField.of(value)) + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) } - /** An enum containing [ChargedOffReason]'s known values. */ - enum class Known { - DELINQUENT, + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [AutoCollectionConfigurationResponse]. + * + * The following fields are required: + * ```java + * .autoCollectionEnabled() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AutoCollectionConfigurationResponse]. */ + class Builder internal constructor() { + + private var autoCollectionEnabled: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + autoCollectionConfigurationResponse: AutoCollectionConfigurationResponse + ) = apply { + autoCollectionEnabled = + autoCollectionConfigurationResponse.autoCollectionEnabled + additionalProperties = + autoCollectionConfigurationResponse.additionalProperties.toMutableMap() + } + + /** If auto collection is enabled for this account */ + fun autoCollectionEnabled(autoCollectionEnabled: Boolean) = + autoCollectionEnabled(JsonField.of(autoCollectionEnabled)) + + /** + * Sets [Builder.autoCollectionEnabled] to an arbitrary JSON value. + * + * You should usually call [Builder.autoCollectionEnabled] with a well-typed + * [Boolean] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun autoCollectionEnabled(autoCollectionEnabled: JsonField) = apply { + this.autoCollectionEnabled = autoCollectionEnabled + } + + 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 [AutoCollectionConfigurationResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .autoCollectionEnabled() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): AutoCollectionConfigurationResponse = + AutoCollectionConfigurationResponse( + checkRequired("autoCollectionEnabled", autoCollectionEnabled), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): AutoCollectionConfigurationResponse = apply { + if (validated) { + return@apply + } + + autoCollectionEnabled() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 (autoCollectionEnabled.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AutoCollectionConfigurationResponse && + autoCollectionEnabled == other.autoCollectionEnabled && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(autoCollectionEnabled, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "AutoCollectionConfigurationResponse{autoCollectionEnabled=$autoCollectionEnabled, additionalProperties=$additionalProperties}" + } + + /** Reason for the financial account being marked as Charged Off */ + @Deprecated("deprecated") + class ChargedOffReason + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val DELINQUENT = of("DELINQUENT") + + @JvmField val FRAUD = of("FRAUD") + + @JvmStatic fun of(value: String) = ChargedOffReason(JsonField.of(value)) + } + + /** An enum containing [ChargedOffReason]'s known values. */ + enum class Known { + DELINQUENT, FRAUD, } @@ -1245,6 +1436,7 @@ private constructor( } /** State of the financial account */ + @Deprecated("deprecated") class FinancialAccountState @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1392,213 +1584,33 @@ private constructor( override fun toString() = value.toString() } - class AutoCollectionConfigurationResponse - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val autoCollectionEnabled: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("auto_collection_enabled") - @ExcludeMissing - autoCollectionEnabled: JsonField = JsonMissing.of() - ) : this(autoCollectionEnabled, mutableMapOf()) - - /** - * If auto collection is enabled for this account - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun autoCollectionEnabled(): Boolean = - autoCollectionEnabled.getRequired("auto_collection_enabled") - - /** - * Returns the raw JSON value of [autoCollectionEnabled]. - * - * Unlike [autoCollectionEnabled], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("auto_collection_enabled") - @ExcludeMissing - fun _autoCollectionEnabled(): JsonField = autoCollectionEnabled - - @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 - * [AutoCollectionConfigurationResponse]. - * - * The following fields are required: - * ```java - * .autoCollectionEnabled() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [AutoCollectionConfigurationResponse]. */ - class Builder internal constructor() { - - private var autoCollectionEnabled: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from( - autoCollectionConfigurationResponse: AutoCollectionConfigurationResponse - ) = apply { - autoCollectionEnabled = - autoCollectionConfigurationResponse.autoCollectionEnabled - additionalProperties = - autoCollectionConfigurationResponse.additionalProperties.toMutableMap() - } - - /** If auto collection is enabled for this account */ - fun autoCollectionEnabled(autoCollectionEnabled: Boolean) = - autoCollectionEnabled(JsonField.of(autoCollectionEnabled)) - - /** - * Sets [Builder.autoCollectionEnabled] to an arbitrary JSON value. - * - * You should usually call [Builder.autoCollectionEnabled] with a well-typed - * [Boolean] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun autoCollectionEnabled(autoCollectionEnabled: JsonField) = apply { - this.autoCollectionEnabled = autoCollectionEnabled - } - - 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 [AutoCollectionConfigurationResponse]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .autoCollectionEnabled() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): AutoCollectionConfigurationResponse = - AutoCollectionConfigurationResponse( - checkRequired("autoCollectionEnabled", autoCollectionEnabled), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): AutoCollectionConfigurationResponse = apply { - if (validated) { - return@apply - } - - autoCollectionEnabled() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 (autoCollectionEnabled.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is AutoCollectionConfigurationResponse && - autoCollectionEnabled == other.autoCollectionEnabled && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(autoCollectionEnabled, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "AutoCollectionConfigurationResponse{autoCollectionEnabled=$autoCollectionEnabled, additionalProperties=$additionalProperties}" - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } return other is FinancialAccountCreditConfig && - chargedOffReason == other.chargedOffReason && + autoCollectionConfiguration == other.autoCollectionConfiguration && creditLimit == other.creditLimit && creditProductToken == other.creditProductToken && externalBankAccountToken == other.externalBankAccountToken && + tier == other.tier && + chargedOffReason == other.chargedOffReason && financialAccountState == other.financialAccountState && isSpendBlocked == other.isSpendBlocked && - tier == other.tier && - autoCollectionConfiguration == other.autoCollectionConfiguration && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { Objects.hash( - chargedOffReason, + autoCollectionConfiguration, creditLimit, creditProductToken, externalBankAccountToken, + tier, + chargedOffReason, financialAccountState, isSpendBlocked, - tier, - autoCollectionConfiguration, additionalProperties, ) } @@ -1606,7 +1618,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "FinancialAccountCreditConfig{chargedOffReason=$chargedOffReason, creditLimit=$creditLimit, creditProductToken=$creditProductToken, externalBankAccountToken=$externalBankAccountToken, financialAccountState=$financialAccountState, isSpendBlocked=$isSpendBlocked, tier=$tier, autoCollectionConfiguration=$autoCollectionConfiguration, additionalProperties=$additionalProperties}" + "FinancialAccountCreditConfig{autoCollectionConfiguration=$autoCollectionConfiguration, creditLimit=$creditLimit, creditProductToken=$creditProductToken, externalBankAccountToken=$externalBankAccountToken, tier=$tier, chargedOffReason=$chargedOffReason, financialAccountState=$financialAccountState, isSpendBlocked=$isSpendBlocked, additionalProperties=$additionalProperties}" } /** Status of the financial account */ diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccountCreditConfig.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccountCreditConfig.kt index 0e2165be6..3a7d03272 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccountCreditConfig.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccountCreditConfig.kt @@ -23,13 +23,13 @@ class FinancialAccountCreditConfig private constructor( private val accountToken: JsonField, private val autoCollectionConfiguration: JsonField, - private val chargedOffReason: JsonField, private val creditLimit: JsonField, private val creditProductToken: JsonField, private val externalBankAccountToken: JsonField, + private val tier: JsonField, + private val chargedOffReason: JsonField, private val financialAccountState: JsonField, private val isSpendBlocked: JsonField, - private val tier: JsonField, private val additionalProperties: MutableMap, ) { @@ -42,9 +42,6 @@ private constructor( @ExcludeMissing autoCollectionConfiguration: JsonField = JsonMissing.of(), - @JsonProperty("charged_off_reason") - @ExcludeMissing - chargedOffReason: JsonField = JsonMissing.of(), @JsonProperty("credit_limit") @ExcludeMissing creditLimit: JsonField = JsonMissing.of(), @@ -54,23 +51,26 @@ private constructor( @JsonProperty("external_bank_account_token") @ExcludeMissing externalBankAccountToken: JsonField = JsonMissing.of(), + @JsonProperty("tier") @ExcludeMissing tier: JsonField = JsonMissing.of(), + @JsonProperty("charged_off_reason") + @ExcludeMissing + chargedOffReason: JsonField = JsonMissing.of(), @JsonProperty("financial_account_state") @ExcludeMissing financialAccountState: JsonField = JsonMissing.of(), @JsonProperty("is_spend_blocked") @ExcludeMissing isSpendBlocked: JsonField = JsonMissing.of(), - @JsonProperty("tier") @ExcludeMissing tier: JsonField = JsonMissing.of(), ) : this( accountToken, autoCollectionConfiguration, - chargedOffReason, creditLimit, creditProductToken, externalBankAccountToken, + tier, + chargedOffReason, financialAccountState, isSpendBlocked, - tier, mutableMapOf(), ) @@ -89,15 +89,6 @@ private constructor( fun autoCollectionConfiguration(): AutoCollectionConfigurationResponse = autoCollectionConfiguration.getRequired("auto_collection_configuration") - /** - * Reason for the financial account being marked as Charged Off - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun chargedOffReason(): Optional = - chargedOffReason.getOptional("charged_off_reason") - /** * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -121,27 +112,39 @@ private constructor( externalBankAccountToken.getOptional("external_bank_account_token") /** - * State of the financial account + * Tier assigned to the financial account * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun financialAccountState(): FinancialAccountState = - financialAccountState.getRequired("financial_account_state") + fun tier(): Optional = tier.getOptional("tier") /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Reason for the financial account being marked as Charged Off + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun isSpendBlocked(): Boolean = isSpendBlocked.getRequired("is_spend_blocked") + @Deprecated("deprecated") + fun chargedOffReason(): Optional = + chargedOffReason.getOptional("charged_off_reason") /** - * Tier assigned to the financial account + * State of the financial account * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun tier(): Optional = tier.getOptional("tier") + @Deprecated("deprecated") + fun financialAccountState(): Optional = + financialAccountState.getOptional("financial_account_state") + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + @Deprecated("deprecated") + fun isSpendBlocked(): Optional = isSpendBlocked.getOptional("is_spend_blocked") /** * Returns the raw JSON value of [accountToken]. @@ -163,16 +166,6 @@ private constructor( fun _autoCollectionConfiguration(): JsonField = autoCollectionConfiguration - /** - * Returns the raw JSON value of [chargedOffReason]. - * - * Unlike [chargedOffReason], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("charged_off_reason") - @ExcludeMissing - fun _chargedOffReason(): JsonField = chargedOffReason - /** * Returns the raw JSON value of [creditLimit]. * @@ -200,12 +193,31 @@ private constructor( @ExcludeMissing fun _externalBankAccountToken(): JsonField = externalBankAccountToken + /** + * Returns the raw JSON value of [tier]. + * + * Unlike [tier], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tier") @ExcludeMissing fun _tier(): JsonField = tier + + /** + * Returns the raw JSON value of [chargedOffReason]. + * + * Unlike [chargedOffReason], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @Deprecated("deprecated") + @JsonProperty("charged_off_reason") + @ExcludeMissing + fun _chargedOffReason(): JsonField = chargedOffReason + /** * Returns the raw JSON value of [financialAccountState]. * * Unlike [financialAccountState], this method doesn't throw if the JSON field has an unexpected * type. */ + @Deprecated("deprecated") @JsonProperty("financial_account_state") @ExcludeMissing fun _financialAccountState(): JsonField = financialAccountState @@ -215,17 +227,11 @@ private constructor( * * Unlike [isSpendBlocked], this method doesn't throw if the JSON field has an unexpected type. */ + @Deprecated("deprecated") @JsonProperty("is_spend_blocked") @ExcludeMissing fun _isSpendBlocked(): JsonField = isSpendBlocked - /** - * Returns the raw JSON value of [tier]. - * - * Unlike [tier], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("tier") @ExcludeMissing fun _tier(): JsonField = tier - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -247,12 +253,9 @@ private constructor( * ```java * .accountToken() * .autoCollectionConfiguration() - * .chargedOffReason() * .creditLimit() * .creditProductToken() * .externalBankAccountToken() - * .financialAccountState() - * .isSpendBlocked() * .tier() * ``` */ @@ -265,26 +268,26 @@ private constructor( private var accountToken: JsonField? = null private var autoCollectionConfiguration: JsonField? = null - private var chargedOffReason: JsonField? = null private var creditLimit: JsonField? = null private var creditProductToken: JsonField? = null private var externalBankAccountToken: JsonField? = null - private var financialAccountState: JsonField? = null - private var isSpendBlocked: JsonField? = null private var tier: JsonField? = null + private var chargedOffReason: JsonField = JsonMissing.of() + private var financialAccountState: JsonField = JsonMissing.of() + private var isSpendBlocked: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(financialAccountCreditConfig: FinancialAccountCreditConfig) = apply { accountToken = financialAccountCreditConfig.accountToken autoCollectionConfiguration = financialAccountCreditConfig.autoCollectionConfiguration - chargedOffReason = financialAccountCreditConfig.chargedOffReason creditLimit = financialAccountCreditConfig.creditLimit creditProductToken = financialAccountCreditConfig.creditProductToken externalBankAccountToken = financialAccountCreditConfig.externalBankAccountToken + tier = financialAccountCreditConfig.tier + chargedOffReason = financialAccountCreditConfig.chargedOffReason financialAccountState = financialAccountCreditConfig.financialAccountState isSpendBlocked = financialAccountCreditConfig.isSpendBlocked - tier = financialAccountCreditConfig.tier additionalProperties = financialAccountCreditConfig.additionalProperties.toMutableMap() } @@ -317,25 +320,6 @@ private constructor( autoCollectionConfiguration: JsonField ) = apply { this.autoCollectionConfiguration = autoCollectionConfiguration } - /** Reason for the financial account being marked as Charged Off */ - fun chargedOffReason(chargedOffReason: ChargedOffReason?) = - chargedOffReason(JsonField.ofNullable(chargedOffReason)) - - /** Alias for calling [Builder.chargedOffReason] with `chargedOffReason.orElse(null)`. */ - fun chargedOffReason(chargedOffReason: Optional) = - chargedOffReason(chargedOffReason.getOrNull()) - - /** - * Sets [Builder.chargedOffReason] to an arbitrary JSON value. - * - * You should usually call [Builder.chargedOffReason] with a well-typed [ChargedOffReason] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun chargedOffReason(chargedOffReason: JsonField) = apply { - this.chargedOffReason = chargedOffReason - } - fun creditLimit(creditLimit: Long?) = creditLimit(JsonField.ofNullable(creditLimit)) /** @@ -399,7 +383,44 @@ private constructor( this.externalBankAccountToken = externalBankAccountToken } + /** Tier assigned to the financial account */ + fun tier(tier: String?) = tier(JsonField.ofNullable(tier)) + + /** Alias for calling [Builder.tier] with `tier.orElse(null)`. */ + fun tier(tier: Optional) = tier(tier.getOrNull()) + + /** + * Sets [Builder.tier] to an arbitrary JSON value. + * + * You should usually call [Builder.tier] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun tier(tier: JsonField) = apply { this.tier = tier } + + /** Reason for the financial account being marked as Charged Off */ + @Deprecated("deprecated") + fun chargedOffReason(chargedOffReason: ChargedOffReason?) = + chargedOffReason(JsonField.ofNullable(chargedOffReason)) + + /** Alias for calling [Builder.chargedOffReason] with `chargedOffReason.orElse(null)`. */ + @Deprecated("deprecated") + fun chargedOffReason(chargedOffReason: Optional) = + chargedOffReason(chargedOffReason.getOrNull()) + + /** + * Sets [Builder.chargedOffReason] to an arbitrary JSON value. + * + * You should usually call [Builder.chargedOffReason] with a well-typed [ChargedOffReason] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + @Deprecated("deprecated") + fun chargedOffReason(chargedOffReason: JsonField) = apply { + this.chargedOffReason = chargedOffReason + } + /** State of the financial account */ + @Deprecated("deprecated") fun financialAccountState(financialAccountState: FinancialAccountState) = financialAccountState(JsonField.of(financialAccountState)) @@ -410,10 +431,12 @@ private constructor( * [FinancialAccountState] value instead. This method is primarily for setting the field to * an undocumented or not yet supported value. */ + @Deprecated("deprecated") fun financialAccountState(financialAccountState: JsonField) = apply { this.financialAccountState = financialAccountState } + @Deprecated("deprecated") fun isSpendBlocked(isSpendBlocked: Boolean) = isSpendBlocked(JsonField.of(isSpendBlocked)) /** @@ -423,24 +446,11 @@ private constructor( * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ + @Deprecated("deprecated") fun isSpendBlocked(isSpendBlocked: JsonField) = apply { this.isSpendBlocked = isSpendBlocked } - /** Tier assigned to the financial account */ - fun tier(tier: String?) = tier(JsonField.ofNullable(tier)) - - /** Alias for calling [Builder.tier] with `tier.orElse(null)`. */ - fun tier(tier: Optional) = tier(tier.getOrNull()) - - /** - * Sets [Builder.tier] to an arbitrary JSON value. - * - * You should usually call [Builder.tier] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun tier(tier: JsonField) = apply { this.tier = tier } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -469,12 +479,9 @@ private constructor( * ```java * .accountToken() * .autoCollectionConfiguration() - * .chargedOffReason() * .creditLimit() * .creditProductToken() * .externalBankAccountToken() - * .financialAccountState() - * .isSpendBlocked() * .tier() * ``` * @@ -484,13 +491,13 @@ private constructor( FinancialAccountCreditConfig( checkRequired("accountToken", accountToken), checkRequired("autoCollectionConfiguration", autoCollectionConfiguration), - checkRequired("chargedOffReason", chargedOffReason), checkRequired("creditLimit", creditLimit), checkRequired("creditProductToken", creditProductToken), checkRequired("externalBankAccountToken", externalBankAccountToken), - checkRequired("financialAccountState", financialAccountState), - checkRequired("isSpendBlocked", isSpendBlocked), checkRequired("tier", tier), + chargedOffReason, + financialAccountState, + isSpendBlocked, additionalProperties.toMutableMap(), ) } @@ -504,13 +511,13 @@ private constructor( accountToken() autoCollectionConfiguration().validate() - chargedOffReason().ifPresent { it.validate() } creditLimit() creditProductToken() externalBankAccountToken() - financialAccountState().validate() - isSpendBlocked() tier() + chargedOffReason().ifPresent { it.validate() } + financialAccountState().ifPresent { it.validate() } + isSpendBlocked() validated = true } @@ -531,13 +538,13 @@ private constructor( internal fun validity(): Int = (if (accountToken.asKnown().isPresent) 1 else 0) + (autoCollectionConfiguration.asKnown().getOrNull()?.validity() ?: 0) + - (chargedOffReason.asKnown().getOrNull()?.validity() ?: 0) + (if (creditLimit.asKnown().isPresent) 1 else 0) + (if (creditProductToken.asKnown().isPresent) 1 else 0) + (if (externalBankAccountToken.asKnown().isPresent) 1 else 0) + + (if (tier.asKnown().isPresent) 1 else 0) + + (chargedOffReason.asKnown().getOrNull()?.validity() ?: 0) + (financialAccountState.asKnown().getOrNull()?.validity() ?: 0) + - (if (isSpendBlocked.asKnown().isPresent) 1 else 0) + - (if (tier.asKnown().isPresent) 1 else 0) + (if (isSpendBlocked.asKnown().isPresent) 1 else 0) class AutoCollectionConfigurationResponse @JsonCreator(mode = JsonCreator.Mode.DISABLED) @@ -715,6 +722,7 @@ private constructor( } /** Reason for the financial account being marked as Charged Off */ + @Deprecated("deprecated") class ChargedOffReason @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -845,6 +853,7 @@ private constructor( } /** State of the financial account */ + @Deprecated("deprecated") class FinancialAccountState @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -996,13 +1005,13 @@ private constructor( return other is FinancialAccountCreditConfig && accountToken == other.accountToken && autoCollectionConfiguration == other.autoCollectionConfiguration && - chargedOffReason == other.chargedOffReason && creditLimit == other.creditLimit && creditProductToken == other.creditProductToken && externalBankAccountToken == other.externalBankAccountToken && + tier == other.tier && + chargedOffReason == other.chargedOffReason && financialAccountState == other.financialAccountState && isSpendBlocked == other.isSpendBlocked && - tier == other.tier && additionalProperties == other.additionalProperties } @@ -1010,13 +1019,13 @@ private constructor( Objects.hash( accountToken, autoCollectionConfiguration, - chargedOffReason, creditLimit, creditProductToken, externalBankAccountToken, + tier, + chargedOffReason, financialAccountState, isSpendBlocked, - tier, additionalProperties, ) } @@ -1024,5 +1033,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "FinancialAccountCreditConfig{accountToken=$accountToken, autoCollectionConfiguration=$autoCollectionConfiguration, chargedOffReason=$chargedOffReason, creditLimit=$creditLimit, creditProductToken=$creditProductToken, externalBankAccountToken=$externalBankAccountToken, financialAccountState=$financialAccountState, isSpendBlocked=$isSpendBlocked, tier=$tier, additionalProperties=$additionalProperties}" + "FinancialAccountCreditConfig{accountToken=$accountToken, autoCollectionConfiguration=$autoCollectionConfiguration, creditLimit=$creditLimit, creditProductToken=$creditProductToken, externalBankAccountToken=$externalBankAccountToken, tier=$tier, chargedOffReason=$chargedOffReason, financialAccountState=$financialAccountState, isSpendBlocked=$isSpendBlocked, additionalProperties=$additionalProperties}" } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ManagementOperationTransaction.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ManagementOperationTransaction.kt index 95f5eac2c..ac9f93ccd 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ManagementOperationTransaction.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ManagementOperationTransaction.kt @@ -27,7 +27,6 @@ class ManagementOperationTransaction private constructor( private val token: JsonField, private val created: JsonField, - private val family: JsonField, private val status: JsonField, private val updated: JsonField, private val category: JsonField, @@ -35,6 +34,7 @@ private constructor( private val direction: JsonField, private val events: JsonField>, private val externalResource: JsonField, + private val family: JsonField, private val financialAccountToken: JsonField, private val pendingAmount: JsonField, private val result: JsonField, @@ -50,9 +50,6 @@ private constructor( @JsonProperty("created") @ExcludeMissing created: JsonField = JsonMissing.of(), - @JsonProperty("family") - @ExcludeMissing - family: JsonField = JsonMissing.of(), @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), @@ -72,6 +69,7 @@ private constructor( @JsonProperty("external_resource") @ExcludeMissing externalResource: JsonField = JsonMissing.of(), + @JsonProperty("family") @ExcludeMissing family: JsonField = JsonMissing.of(), @JsonProperty("financial_account_token") @ExcludeMissing financialAccountToken: JsonField = JsonMissing.of(), @@ -93,7 +91,6 @@ private constructor( ) : this( token, created, - family, status, updated, category, @@ -101,6 +98,7 @@ private constructor( direction, events, externalResource, + family, financialAccountToken, pendingAmount, result, @@ -126,12 +124,6 @@ private constructor( */ fun created(): OffsetDateTime = created.getRequired("created") - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun family(): TransactionFamilyTypes = family.getRequired("family") - /** * The status of the transaction * @@ -181,6 +173,14 @@ private constructor( fun externalResource(): Optional = externalResource.getOptional("external_resource") + /** + * MANAGEMENT_OPERATION - Management Operation Transaction + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun family(): Optional = family.getOptional("family") + /** * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -233,15 +233,6 @@ private constructor( */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created - /** - * Returns the raw JSON value of [family]. - * - * Unlike [family], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("family") - @ExcludeMissing - fun _family(): JsonField = family - /** * Returns the raw JSON value of [status]. * @@ -300,6 +291,13 @@ private constructor( @ExcludeMissing fun _externalResource(): JsonField = externalResource + /** + * Returns the raw JSON value of [family]. + * + * Unlike [family], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("family") @ExcludeMissing fun _family(): JsonField = family + /** * Returns the raw JSON value of [financialAccountToken]. * @@ -376,7 +374,6 @@ private constructor( * ```java * .token() * .created() - * .family() * .status() * .updated() * ``` @@ -389,7 +386,6 @@ private constructor( private var token: JsonField? = null private var created: JsonField? = null - private var family: JsonField? = null private var status: JsonField? = null private var updated: JsonField? = null private var category: JsonField = JsonMissing.of() @@ -397,6 +393,7 @@ private constructor( private var direction: JsonField = JsonMissing.of() private var events: JsonField>? = null private var externalResource: JsonField = JsonMissing.of() + private var family: JsonField = JsonMissing.of() private var financialAccountToken: JsonField = JsonMissing.of() private var pendingAmount: JsonField = JsonMissing.of() private var result: JsonField = JsonMissing.of() @@ -409,7 +406,6 @@ private constructor( internal fun from(managementOperationTransaction: ManagementOperationTransaction) = apply { token = managementOperationTransaction.token created = managementOperationTransaction.created - family = managementOperationTransaction.family status = managementOperationTransaction.status updated = managementOperationTransaction.updated category = managementOperationTransaction.category @@ -417,6 +413,7 @@ private constructor( direction = managementOperationTransaction.direction events = managementOperationTransaction.events.map { it.toMutableList() } externalResource = managementOperationTransaction.externalResource + family = managementOperationTransaction.family financialAccountToken = managementOperationTransaction.financialAccountToken pendingAmount = managementOperationTransaction.pendingAmount result = managementOperationTransaction.result @@ -450,17 +447,6 @@ private constructor( */ fun created(created: JsonField) = apply { this.created = created } - fun family(family: TransactionFamilyTypes) = family(JsonField.of(family)) - - /** - * Sets [Builder.family] to an arbitrary JSON value. - * - * You should usually call [Builder.family] with a well-typed [TransactionFamilyTypes] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun family(family: JsonField) = apply { this.family = family } - /** The status of the transaction */ fun status(status: TransactionStatus) = status(JsonField.of(status)) @@ -565,6 +551,17 @@ private constructor( this.externalResource = externalResource } + /** MANAGEMENT_OPERATION - Management Operation Transaction */ + fun family(family: Family) = family(JsonField.of(family)) + + /** + * Sets [Builder.family] to an arbitrary JSON value. + * + * You should usually call [Builder.family] with a well-typed [Family] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun family(family: JsonField) = apply { this.family = family } + fun financialAccountToken(financialAccountToken: String) = financialAccountToken(JsonField.of(financialAccountToken)) @@ -675,7 +672,6 @@ private constructor( * ```java * .token() * .created() - * .family() * .status() * .updated() * ``` @@ -686,7 +682,6 @@ private constructor( ManagementOperationTransaction( checkRequired("token", token), checkRequired("created", created), - checkRequired("family", family), checkRequired("status", status), checkRequired("updated", updated), category, @@ -694,6 +689,7 @@ private constructor( direction, (events ?: JsonMissing.of()).map { it.toImmutable() }, externalResource, + family, financialAccountToken, pendingAmount, result, @@ -713,7 +709,6 @@ private constructor( token() created() - family().validate() status().validate() updated() category().ifPresent { it.validate() } @@ -721,6 +716,7 @@ private constructor( direction().ifPresent { it.validate() } events().ifPresent { it.forEach { it.validate() } } externalResource().ifPresent { it.validate() } + family().ifPresent { it.validate() } financialAccountToken() pendingAmount() result().ifPresent { it.validate() } @@ -747,7 +743,6 @@ private constructor( internal fun validity(): Int = (if (token.asKnown().isPresent) 1 else 0) + (if (created.asKnown().isPresent) 1 else 0) + - (family.asKnown().getOrNull()?.validity() ?: 0) + (status.asKnown().getOrNull()?.validity() ?: 0) + (if (updated.asKnown().isPresent) 1 else 0) + (category.asKnown().getOrNull()?.validity() ?: 0) + @@ -755,6 +750,7 @@ private constructor( (direction.asKnown().getOrNull()?.validity() ?: 0) + (events.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (externalResource.asKnown().getOrNull()?.validity() ?: 0) + + (family.asKnown().getOrNull()?.validity() ?: 0) + (if (financialAccountToken.asKnown().isPresent) 1 else 0) + (if (pendingAmount.asKnown().isPresent) 1 else 0) + (result.asKnown().getOrNull()?.validity() ?: 0) + @@ -762,162 +758,6 @@ private constructor( (transactionSeries.asKnown().getOrNull()?.validity() ?: 0) + (if (userDefinedId.asKnown().isPresent) 1 else 0) - class TransactionFamilyTypes - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CARD = of("CARD") - - @JvmField val PAYMENT = of("PAYMENT") - - @JvmField val TRANSFER = of("TRANSFER") - - @JvmField val INTERNAL = of("INTERNAL") - - @JvmField val EXTERNAL_PAYMENT = of("EXTERNAL_PAYMENT") - - @JvmField val MANAGEMENT_OPERATION = of("MANAGEMENT_OPERATION") - - @JvmStatic fun of(value: String) = TransactionFamilyTypes(JsonField.of(value)) - } - - /** An enum containing [TransactionFamilyTypes]'s known values. */ - enum class Known { - CARD, - PAYMENT, - TRANSFER, - INTERNAL, - EXTERNAL_PAYMENT, - MANAGEMENT_OPERATION, - } - - /** - * An enum containing [TransactionFamilyTypes]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [TransactionFamilyTypes] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CARD, - PAYMENT, - TRANSFER, - INTERNAL, - EXTERNAL_PAYMENT, - MANAGEMENT_OPERATION, - /** - * An enum member indicating that [TransactionFamilyTypes] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CARD -> Value.CARD - PAYMENT -> Value.PAYMENT - TRANSFER -> Value.TRANSFER - INTERNAL -> Value.INTERNAL - EXTERNAL_PAYMENT -> Value.EXTERNAL_PAYMENT - MANAGEMENT_OPERATION -> Value.MANAGEMENT_OPERATION - 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 LithicInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - CARD -> Known.CARD - PAYMENT -> Known.PAYMENT - TRANSFER -> Known.TRANSFER - INTERNAL -> Known.INTERNAL - EXTERNAL_PAYMENT -> Known.EXTERNAL_PAYMENT - MANAGEMENT_OPERATION -> Known.MANAGEMENT_OPERATION - else -> throw LithicInvalidDataException("Unknown TransactionFamilyTypes: $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 LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): TransactionFamilyTypes = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 TransactionFamilyTypes && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** The status of the transaction */ class TransactionStatus @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -2343,6 +2183,126 @@ private constructor( "ManagementOperationEvent{token=$token, amount=$amount, created=$created, detailedResults=$detailedResults, effectiveDate=$effectiveDate, memo=$memo, result=$result, type=$type, subtype=$subtype, additionalProperties=$additionalProperties}" } + /** MANAGEMENT_OPERATION - Management Operation Transaction */ + class Family @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val MANAGEMENT_OPERATION = of("MANAGEMENT_OPERATION") + + @JvmStatic fun of(value: String) = Family(JsonField.of(value)) + } + + /** An enum containing [Family]'s known values. */ + enum class Known { + MANAGEMENT_OPERATION + } + + /** + * An enum containing [Family]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Family] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then 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 { + MANAGEMENT_OPERATION, + /** An enum member indicating that [Family] 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) { + MANAGEMENT_OPERATION -> Value.MANAGEMENT_OPERATION + 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 LithicInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + MANAGEMENT_OPERATION -> Known.MANAGEMENT_OPERATION + else -> throw LithicInvalidDataException("Unknown Family: $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 LithicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + fun validate(): Family = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 Family && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + class TransactionResult @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -2746,7 +2706,6 @@ private constructor( return other is ManagementOperationTransaction && token == other.token && created == other.created && - family == other.family && status == other.status && updated == other.updated && category == other.category && @@ -2754,6 +2713,7 @@ private constructor( direction == other.direction && events == other.events && externalResource == other.externalResource && + family == other.family && financialAccountToken == other.financialAccountToken && pendingAmount == other.pendingAmount && result == other.result && @@ -2767,7 +2727,6 @@ private constructor( Objects.hash( token, created, - family, status, updated, category, @@ -2775,6 +2734,7 @@ private constructor( direction, events, externalResource, + family, financialAccountToken, pendingAmount, result, @@ -2788,5 +2748,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "ManagementOperationTransaction{token=$token, created=$created, family=$family, status=$status, updated=$updated, category=$category, currency=$currency, direction=$direction, events=$events, externalResource=$externalResource, financialAccountToken=$financialAccountToken, pendingAmount=$pendingAmount, result=$result, settledAmount=$settledAmount, transactionSeries=$transactionSeries, userDefinedId=$userDefinedId, additionalProperties=$additionalProperties}" + "ManagementOperationTransaction{token=$token, created=$created, status=$status, updated=$updated, category=$category, currency=$currency, direction=$direction, events=$events, externalResource=$externalResource, family=$family, financialAccountToken=$financialAccountToken, pendingAmount=$pendingAmount, result=$result, settledAmount=$settledAmount, transactionSeries=$transactionSeries, userDefinedId=$userDefinedId, additionalProperties=$additionalProperties}" } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Payment.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Payment.kt index ea90f8860..d2a96521a 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Payment.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Payment.kt @@ -6,13 +6,24 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.lithic.api.core.BaseDeserializer +import com.lithic.api.core.BaseSerializer import com.lithic.api.core.Enum import com.lithic.api.core.ExcludeMissing import com.lithic.api.core.JsonField import com.lithic.api.core.JsonMissing import com.lithic.api.core.JsonValue +import com.lithic.api.core.allMaxBy import com.lithic.api.core.checkKnown import com.lithic.api.core.checkRequired +import com.lithic.api.core.getOrThrow import com.lithic.api.core.toImmutable import com.lithic.api.errors.LithicInvalidDataException import java.time.LocalDate @@ -22,41 +33,44 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull +/** Payment transaction */ class Payment @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val token: JsonField, - private val category: JsonField, + private val category: JsonField, private val created: JsonField, - private val currency: JsonField, private val descriptor: JsonField, private val direction: JsonField, private val events: JsonField>, - private val externalBankAccountToken: JsonField, + private val family: JsonField, private val financialAccountToken: JsonField, private val method: JsonField, - private val methodAttributes: JsonField, + private val methodAttributes: JsonField, private val pendingAmount: JsonField, private val relatedAccountTokens: JsonField, - private val result: JsonField, + private val result: JsonField, private val settledAmount: JsonField, private val source: JsonField, - private val status: JsonField, + private val status: JsonField, private val updated: JsonField, - private val userDefinedId: JsonField, + private val currency: JsonField, private val expectedReleaseDate: JsonField, + private val externalBankAccountToken: JsonField, private val type: JsonField, + private val userDefinedId: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), - @JsonProperty("category") @ExcludeMissing category: JsonField = JsonMissing.of(), + @JsonProperty("category") + @ExcludeMissing + category: JsonField = JsonMissing.of(), @JsonProperty("created") @ExcludeMissing created: JsonField = JsonMissing.of(), - @JsonProperty("currency") @ExcludeMissing currency: JsonField = JsonMissing.of(), @JsonProperty("descriptor") @ExcludeMissing descriptor: JsonField = JsonMissing.of(), @@ -66,47 +80,52 @@ private constructor( @JsonProperty("events") @ExcludeMissing events: JsonField> = JsonMissing.of(), - @JsonProperty("external_bank_account_token") - @ExcludeMissing - externalBankAccountToken: JsonField = JsonMissing.of(), + @JsonProperty("family") @ExcludeMissing family: JsonField = JsonMissing.of(), @JsonProperty("financial_account_token") @ExcludeMissing financialAccountToken: JsonField = JsonMissing.of(), @JsonProperty("method") @ExcludeMissing method: JsonField = JsonMissing.of(), @JsonProperty("method_attributes") @ExcludeMissing - methodAttributes: JsonField = JsonMissing.of(), + methodAttributes: JsonField = JsonMissing.of(), @JsonProperty("pending_amount") @ExcludeMissing pendingAmount: JsonField = JsonMissing.of(), @JsonProperty("related_account_tokens") @ExcludeMissing relatedAccountTokens: JsonField = JsonMissing.of(), - @JsonProperty("result") @ExcludeMissing result: JsonField = JsonMissing.of(), + @JsonProperty("result") + @ExcludeMissing + result: JsonField = JsonMissing.of(), @JsonProperty("settled_amount") @ExcludeMissing settledAmount: JsonField = JsonMissing.of(), @JsonProperty("source") @ExcludeMissing source: JsonField = JsonMissing.of(), - @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + status: JsonField = JsonMissing.of(), @JsonProperty("updated") @ExcludeMissing updated: JsonField = JsonMissing.of(), - @JsonProperty("user_defined_id") - @ExcludeMissing - userDefinedId: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing currency: JsonField = JsonMissing.of(), @JsonProperty("expected_release_date") @ExcludeMissing expectedReleaseDate: JsonField = JsonMissing.of(), + @JsonProperty("external_bank_account_token") + @ExcludeMissing + externalBankAccountToken: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("user_defined_id") + @ExcludeMissing + userDefinedId: JsonField = JsonMissing.of(), ) : this( token, category, created, - currency, descriptor, direction, events, - externalBankAccountToken, + family, financialAccountToken, method, methodAttributes, @@ -117,14 +136,16 @@ private constructor( source, status, updated, - userDefinedId, + currency, expectedReleaseDate, + externalBankAccountToken, type, + userDefinedId, mutableMapOf(), ) /** - * Globally unique identifier. + * Unique identifier for the transaction * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -132,15 +153,15 @@ private constructor( fun token(): String = token.getRequired("token") /** - * Payment category + * Transaction category * * @throws LithicInvalidDataException if 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") + fun category(): TransactionCategory = category.getRequired("category") /** - * Date and time when the payment first occurred. UTC time zone. + * ISO 8601 timestamp of when the transaction was created * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -148,15 +169,7 @@ private constructor( fun created(): OffsetDateTime = created.getRequired("created") /** - * 3-character alphabetic ISO 4217 code for the settling currency of the payment. - * - * @throws LithicInvalidDataException if 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") - - /** - * A string that provides a description of the payment; may be useful to display to users. + * Transaction descriptor * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -164,13 +177,15 @@ private constructor( fun descriptor(): String = descriptor.getRequired("descriptor") /** + * Transfer direction + * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun direction(): Direction = direction.getRequired("direction") /** - * A list of all payment events that have modified this payment. + * List of transaction events * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -178,13 +193,16 @@ private constructor( fun events(): List = events.getRequired("events") /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * PAYMENT - Payment Transaction + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun externalBankAccountToken(): Optional = - externalBankAccountToken.getOptional("external_bank_account_token") + fun family(): Family = family.getRequired("family") /** + * Financial account token + * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ @@ -192,21 +210,23 @@ private constructor( financialAccountToken.getRequired("financial_account_token") /** + * Transfer method + * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun method(): Method = method.getRequired("method") /** + * Method-specific attributes + * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun methodAttributes(): PaymentMethodAttributes = - methodAttributes.getRequired("method_attributes") + fun methodAttributes(): MethodAttributes = methodAttributes.getRequired("method_attributes") /** - * Pending amount of the payment in the currency's smallest unit (e.g., cents). The value of - * this field will go to zero over time once the payment is settled. + * Pending amount in cents * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -214,7 +234,7 @@ private constructor( fun pendingAmount(): Long = pendingAmount.getRequired("pending_amount") /** - * Account tokens related to a payment transaction + * Related account tokens for the transaction * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -223,16 +243,15 @@ private constructor( relatedAccountTokens.getRequired("related_account_tokens") /** - * APPROVED payments were successful while DECLINED payments were declined by Lithic or - * returned. + * Transaction result * * @throws LithicInvalidDataException if 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") + fun result(): TransactionResult = result.getRequired("result") /** - * Amount of the payment that has been settled in the currency's smallest unit (e.g., cents). + * Settled amount in cents * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -240,26 +259,23 @@ private constructor( fun settledAmount(): Long = settledAmount.getRequired("settled_amount") /** + * Transaction source + * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun source(): Source = source.getRequired("source") /** - * Status types: - * * `DECLINED` - The payment was declined. - * * `PENDING` - The payment is being processed and has yet to settle or release (origination - * debit). - * * `RETURNED` - The payment has been returned. - * * `SETTLED` - The payment is completed. + * The status of the transaction * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun status(): Status = status.getRequired("status") + fun status(): TransactionStatus = status.getRequired("status") /** - * Date and time when the financial transaction was last updated. UTC time zone. + * ISO 8601 timestamp of when the transaction was last updated * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -267,13 +283,15 @@ private constructor( fun updated(): OffsetDateTime = updated.getRequired("updated") /** + * Currency of the transaction in ISO 4217 format + * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun userDefinedId(): Optional = userDefinedId.getOptional("user_defined_id") + fun currency(): Optional = currency.getOptional("currency") /** - * Date when the financial transaction expected to be released after settlement + * Expected release date for the transaction * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -282,13 +300,28 @@ private constructor( expectedReleaseDate.getOptional("expected_release_date") /** - * Payment type indicating the specific ACH message or Fedwire transfer type + * External bank account token * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ + fun externalBankAccountToken(): Optional = + externalBankAccountToken.getOptional("external_bank_account_token") + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = type.getOptional("type") + /** + * User-defined identifier + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun userDefinedId(): Optional = userDefinedId.getOptional("user_defined_id") + /** * Returns the raw JSON value of [token]. * @@ -301,7 +334,9 @@ private constructor( * * Unlike [category], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("category") @ExcludeMissing fun _category(): JsonField = category + @JsonProperty("category") + @ExcludeMissing + fun _category(): JsonField = category /** * Returns the raw JSON value of [created]. @@ -310,13 +345,6 @@ private constructor( */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created - /** - * Returns the raw JSON value of [currency]. - * - * Unlike [currency], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - /** * Returns the raw JSON value of [descriptor]. * @@ -339,14 +367,11 @@ private constructor( @JsonProperty("events") @ExcludeMissing fun _events(): JsonField> = events /** - * Returns the raw JSON value of [externalBankAccountToken]. + * Returns the raw JSON value of [family]. * - * Unlike [externalBankAccountToken], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [family], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("external_bank_account_token") - @ExcludeMissing - fun _externalBankAccountToken(): JsonField = externalBankAccountToken + @JsonProperty("family") @ExcludeMissing fun _family(): JsonField = family /** * Returns the raw JSON value of [financialAccountToken]. @@ -373,7 +398,7 @@ private constructor( */ @JsonProperty("method_attributes") @ExcludeMissing - fun _methodAttributes(): JsonField = methodAttributes + fun _methodAttributes(): JsonField = methodAttributes /** * Returns the raw JSON value of [pendingAmount]. @@ -399,7 +424,7 @@ private constructor( * * Unlike [result], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("result") @ExcludeMissing fun _result(): JsonField = result + @JsonProperty("result") @ExcludeMissing fun _result(): JsonField = result /** * Returns the raw JSON value of [settledAmount]. @@ -422,7 +447,7 @@ private constructor( * * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status /** * Returns the raw JSON value of [updated]. @@ -432,13 +457,11 @@ private constructor( @JsonProperty("updated") @ExcludeMissing fun _updated(): JsonField = updated /** - * Returns the raw JSON value of [userDefinedId]. + * Returns the raw JSON value of [currency]. * - * Unlike [userDefinedId], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("user_defined_id") - @ExcludeMissing - fun _userDefinedId(): JsonField = userDefinedId + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency /** * Returns the raw JSON value of [expectedReleaseDate]. @@ -450,6 +473,16 @@ private constructor( @ExcludeMissing fun _expectedReleaseDate(): JsonField = expectedReleaseDate + /** + * Returns the raw JSON value of [externalBankAccountToken]. + * + * Unlike [externalBankAccountToken], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("external_bank_account_token") + @ExcludeMissing + fun _externalBankAccountToken(): JsonField = externalBankAccountToken + /** * Returns the raw JSON value of [type]. * @@ -457,6 +490,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + /** + * Returns the raw JSON value of [userDefinedId]. + * + * Unlike [userDefinedId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("user_defined_id") + @ExcludeMissing + fun _userDefinedId(): JsonField = userDefinedId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -479,11 +521,10 @@ private constructor( * .token() * .category() * .created() - * .currency() * .descriptor() * .direction() * .events() - * .externalBankAccountToken() + * .family() * .financialAccountToken() * .method() * .methodAttributes() @@ -494,7 +535,6 @@ private constructor( * .source() * .status() * .updated() - * .userDefinedId() * ``` */ @JvmStatic fun builder() = Builder() @@ -504,26 +544,27 @@ private constructor( class Builder internal constructor() { private var token: JsonField? = null - private var category: JsonField? = null + private var category: JsonField? = null private var created: JsonField? = null - private var currency: JsonField? = null private var descriptor: JsonField? = null private var direction: JsonField? = null private var events: JsonField>? = null - private var externalBankAccountToken: JsonField? = null + private var family: JsonField? = null private var financialAccountToken: JsonField? = null private var method: JsonField? = null - private var methodAttributes: JsonField? = null + private var methodAttributes: JsonField? = null private var pendingAmount: JsonField? = null private var relatedAccountTokens: JsonField? = null - private var result: JsonField? = null + private var result: JsonField? = null private var settledAmount: JsonField? = null private var source: JsonField? = null - private var status: JsonField? = null + private var status: JsonField? = null private var updated: JsonField? = null - private var userDefinedId: JsonField? = null + private var currency: JsonField = JsonMissing.of() private var expectedReleaseDate: JsonField = JsonMissing.of() + private var externalBankAccountToken: JsonField = JsonMissing.of() private var type: JsonField = JsonMissing.of() + private var userDefinedId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -531,11 +572,10 @@ private constructor( token = payment.token category = payment.category created = payment.created - currency = payment.currency descriptor = payment.descriptor direction = payment.direction events = payment.events.map { it.toMutableList() } - externalBankAccountToken = payment.externalBankAccountToken + family = payment.family financialAccountToken = payment.financialAccountToken method = payment.method methodAttributes = payment.methodAttributes @@ -546,13 +586,15 @@ private constructor( source = payment.source status = payment.status updated = payment.updated - userDefinedId = payment.userDefinedId + currency = payment.currency expectedReleaseDate = payment.expectedReleaseDate + externalBankAccountToken = payment.externalBankAccountToken type = payment.type + userDefinedId = payment.userDefinedId additionalProperties = payment.additionalProperties.toMutableMap() } - /** Globally unique identifier. */ + /** Unique identifier for the transaction */ fun token(token: String) = token(JsonField.of(token)) /** @@ -563,19 +605,19 @@ private constructor( */ fun token(token: JsonField) = apply { this.token = token } - /** Payment category */ - fun category(category: Category) = category(JsonField.of(category)) + /** Transaction category */ + fun category(category: TransactionCategory) = 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. + * You should usually call [Builder.category] with a well-typed [TransactionCategory] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun category(category: JsonField) = apply { this.category = category } + fun category(category: JsonField) = apply { this.category = category } - /** Date and time when the payment first occurred. UTC time zone. */ + /** ISO 8601 timestamp of when the transaction was created */ fun created(created: OffsetDateTime) = created(JsonField.of(created)) /** @@ -587,20 +629,7 @@ private constructor( */ fun created(created: JsonField) = apply { this.created = created } - /** 3-character alphabetic ISO 4217 code for the settling currency of the payment. */ - 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 } - - /** - * A string that provides a description of the payment; may be useful to display to users. - */ + /** Transaction descriptor */ fun descriptor(descriptor: String) = descriptor(JsonField.of(descriptor)) /** @@ -612,6 +641,7 @@ private constructor( */ fun descriptor(descriptor: JsonField) = apply { this.descriptor = descriptor } + /** Transfer direction */ fun direction(direction: Direction) = direction(JsonField.of(direction)) /** @@ -623,7 +653,7 @@ private constructor( */ fun direction(direction: JsonField) = apply { this.direction = direction } - /** A list of all payment events that have modified this payment. */ + /** List of transaction events */ fun events(events: List) = events(JsonField.of(events)) /** @@ -649,27 +679,18 @@ private constructor( } } - fun externalBankAccountToken(externalBankAccountToken: String?) = - externalBankAccountToken(JsonField.ofNullable(externalBankAccountToken)) - - /** - * Alias for calling [Builder.externalBankAccountToken] with - * `externalBankAccountToken.orElse(null)`. - */ - fun externalBankAccountToken(externalBankAccountToken: Optional) = - externalBankAccountToken(externalBankAccountToken.getOrNull()) + /** PAYMENT - Payment Transaction */ + fun family(family: Family) = family(JsonField.of(family)) /** - * Sets [Builder.externalBankAccountToken] to an arbitrary JSON value. + * Sets [Builder.family] to an arbitrary JSON value. * - * You should usually call [Builder.externalBankAccountToken] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * You should usually call [Builder.family] with a well-typed [Family] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun externalBankAccountToken(externalBankAccountToken: JsonField) = apply { - this.externalBankAccountToken = externalBankAccountToken - } + fun family(family: JsonField) = apply { this.family = family } + /** Financial account token */ fun financialAccountToken(financialAccountToken: String) = financialAccountToken(JsonField.of(financialAccountToken)) @@ -684,6 +705,7 @@ private constructor( this.financialAccountToken = financialAccountToken } + /** Transfer method */ fun method(method: Method) = method(JsonField.of(method)) /** @@ -694,24 +716,30 @@ private constructor( */ fun method(method: JsonField) = apply { this.method = method } - fun methodAttributes(methodAttributes: PaymentMethodAttributes) = + /** Method-specific attributes */ + fun methodAttributes(methodAttributes: MethodAttributes) = methodAttributes(JsonField.of(methodAttributes)) /** * Sets [Builder.methodAttributes] to an arbitrary JSON value. * - * You should usually call [Builder.methodAttributes] with a well-typed - * [PaymentMethodAttributes] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. + * You should usually call [Builder.methodAttributes] with a well-typed [MethodAttributes] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun methodAttributes(methodAttributes: JsonField) = apply { + fun methodAttributes(methodAttributes: JsonField) = apply { this.methodAttributes = methodAttributes } - /** - * Pending amount of the payment in the currency's smallest unit (e.g., cents). The value of - * this field will go to zero over time once the payment is settled. - */ + /** Alias for calling [methodAttributes] with `MethodAttributes.ofAch(ach)`. */ + fun methodAttributes(ach: MethodAttributes.AchMethodAttributes) = + methodAttributes(MethodAttributes.ofAch(ach)) + + /** Alias for calling [methodAttributes] with `MethodAttributes.ofWire(wire)`. */ + fun methodAttributes(wire: MethodAttributes.WireMethodAttributes) = + methodAttributes(MethodAttributes.ofWire(wire)) + + /** Pending amount in cents */ fun pendingAmount(pendingAmount: Long) = pendingAmount(JsonField.of(pendingAmount)) /** @@ -725,7 +753,7 @@ private constructor( this.pendingAmount = pendingAmount } - /** Account tokens related to a payment transaction */ + /** Related account tokens for the transaction */ fun relatedAccountTokens(relatedAccountTokens: RelatedAccountTokens) = relatedAccountTokens(JsonField.of(relatedAccountTokens)) @@ -740,24 +768,19 @@ private constructor( this.relatedAccountTokens = relatedAccountTokens } - /** - * APPROVED payments were successful while DECLINED payments were declined by Lithic or - * returned. - */ - fun result(result: Result) = result(JsonField.of(result)) + /** Transaction result */ + fun result(result: TransactionResult) = 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. + * You should usually call [Builder.result] with a well-typed [TransactionResult] 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 result(result: JsonField) = apply { this.result = result } - /** - * Amount of the payment that has been settled in the currency's smallest unit (e.g., - * cents). - */ + /** Settled amount in cents */ fun settledAmount(settledAmount: Long) = settledAmount(JsonField.of(settledAmount)) /** @@ -771,6 +794,7 @@ private constructor( this.settledAmount = settledAmount } + /** Transaction source */ fun source(source: Source) = source(JsonField.of(source)) /** @@ -781,25 +805,19 @@ private constructor( */ fun source(source: JsonField) = apply { this.source = source } - /** - * Status types: - * * `DECLINED` - The payment was declined. - * * `PENDING` - The payment is being processed and has yet to settle or release - * (origination debit). - * * `RETURNED` - The payment has been returned. - * * `SETTLED` - The payment is completed. - */ - fun status(status: Status) = status(JsonField.of(status)) + /** The status of the transaction */ + fun status(status: TransactionStatus) = status(JsonField.of(status)) /** * Sets [Builder.status] to an arbitrary JSON value. * - * You should usually call [Builder.status] with a well-typed [Status] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. + * You should usually call [Builder.status] with a well-typed [TransactionStatus] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun status(status: JsonField) = apply { this.status = status } + fun status(status: JsonField) = apply { this.status = status } - /** Date and time when the financial transaction was last updated. UTC time zone. */ + /** ISO 8601 timestamp of when the transaction was last updated */ fun updated(updated: OffsetDateTime) = updated(JsonField.of(updated)) /** @@ -811,27 +829,26 @@ private constructor( */ fun updated(updated: JsonField) = apply { this.updated = updated } - fun userDefinedId(userDefinedId: String?) = - userDefinedId(JsonField.ofNullable(userDefinedId)) - - /** Alias for calling [Builder.userDefinedId] with `userDefinedId.orElse(null)`. */ - fun userDefinedId(userDefinedId: Optional) = - userDefinedId(userDefinedId.getOrNull()) + /** Currency of the transaction in ISO 4217 format */ + fun currency(currency: String) = currency(JsonField.of(currency)) /** - * Sets [Builder.userDefinedId] to an arbitrary JSON value. + * Sets [Builder.currency] to an arbitrary JSON value. * - * You should usually call [Builder.userDefinedId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * You should usually call [Builder.currency] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun userDefinedId(userDefinedId: JsonField) = apply { - this.userDefinedId = userDefinedId - } + fun currency(currency: JsonField) = apply { this.currency = currency } + + /** Expected release date for the transaction */ + fun expectedReleaseDate(expectedReleaseDate: LocalDate?) = + expectedReleaseDate(JsonField.ofNullable(expectedReleaseDate)) - /** Date when the financial transaction expected to be released after settlement */ - fun expectedReleaseDate(expectedReleaseDate: LocalDate) = - expectedReleaseDate(JsonField.of(expectedReleaseDate)) + /** + * Alias for calling [Builder.expectedReleaseDate] with `expectedReleaseDate.orElse(null)`. + */ + fun expectedReleaseDate(expectedReleaseDate: Optional) = + expectedReleaseDate(expectedReleaseDate.getOrNull()) /** * Sets [Builder.expectedReleaseDate] to an arbitrary JSON value. @@ -844,7 +861,28 @@ private constructor( this.expectedReleaseDate = expectedReleaseDate } - /** Payment type indicating the specific ACH message or Fedwire transfer type */ + /** External bank account token */ + fun externalBankAccountToken(externalBankAccountToken: String?) = + externalBankAccountToken(JsonField.ofNullable(externalBankAccountToken)) + + /** + * Alias for calling [Builder.externalBankAccountToken] with + * `externalBankAccountToken.orElse(null)`. + */ + fun externalBankAccountToken(externalBankAccountToken: Optional) = + externalBankAccountToken(externalBankAccountToken.getOrNull()) + + /** + * Sets [Builder.externalBankAccountToken] to an arbitrary JSON value. + * + * You should usually call [Builder.externalBankAccountToken] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun externalBankAccountToken(externalBankAccountToken: JsonField) = apply { + this.externalBankAccountToken = externalBankAccountToken + } + fun type(type: TransferType) = type(JsonField.of(type)) /** @@ -856,6 +894,25 @@ private constructor( */ fun type(type: JsonField) = apply { this.type = type } + /** User-defined identifier */ + fun userDefinedId(userDefinedId: String?) = + userDefinedId(JsonField.ofNullable(userDefinedId)) + + /** Alias for calling [Builder.userDefinedId] with `userDefinedId.orElse(null)`. */ + fun userDefinedId(userDefinedId: Optional) = + userDefinedId(userDefinedId.getOrNull()) + + /** + * Sets [Builder.userDefinedId] to an arbitrary JSON value. + * + * You should usually call [Builder.userDefinedId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun userDefinedId(userDefinedId: JsonField) = apply { + this.userDefinedId = userDefinedId + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -885,11 +942,10 @@ private constructor( * .token() * .category() * .created() - * .currency() * .descriptor() * .direction() * .events() - * .externalBankAccountToken() + * .family() * .financialAccountToken() * .method() * .methodAttributes() @@ -900,7 +956,6 @@ private constructor( * .source() * .status() * .updated() - * .userDefinedId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -910,11 +965,10 @@ private constructor( checkRequired("token", token), checkRequired("category", category), checkRequired("created", created), - checkRequired("currency", currency), checkRequired("descriptor", descriptor), checkRequired("direction", direction), checkRequired("events", events).map { it.toImmutable() }, - checkRequired("externalBankAccountToken", externalBankAccountToken), + checkRequired("family", family), checkRequired("financialAccountToken", financialAccountToken), checkRequired("method", method), checkRequired("methodAttributes", methodAttributes), @@ -925,9 +979,11 @@ private constructor( checkRequired("source", source), checkRequired("status", status), checkRequired("updated", updated), - checkRequired("userDefinedId", userDefinedId), + currency, expectedReleaseDate, + externalBankAccountToken, type, + userDefinedId, additionalProperties.toMutableMap(), ) } @@ -942,11 +998,10 @@ private constructor( token() category().validate() created() - currency() descriptor() direction().validate() events().forEach { it.validate() } - externalBankAccountToken() + family().validate() financialAccountToken() method().validate() methodAttributes().validate() @@ -957,9 +1012,11 @@ private constructor( source().validate() status().validate() updated() - userDefinedId() + currency() expectedReleaseDate() + externalBankAccountToken() type().ifPresent { it.validate() } + userDefinedId() validated = true } @@ -981,11 +1038,10 @@ private constructor( (if (token.asKnown().isPresent) 1 else 0) + (category.asKnown().getOrNull()?.validity() ?: 0) + (if (created.asKnown().isPresent) 1 else 0) + - (if (currency.asKnown().isPresent) 1 else 0) + (if (descriptor.asKnown().isPresent) 1 else 0) + (direction.asKnown().getOrNull()?.validity() ?: 0) + (events.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (if (externalBankAccountToken.asKnown().isPresent) 1 else 0) + + (family.asKnown().getOrNull()?.validity() ?: 0) + (if (financialAccountToken.asKnown().isPresent) 1 else 0) + (method.asKnown().getOrNull()?.validity() ?: 0) + (methodAttributes.asKnown().getOrNull()?.validity() ?: 0) + @@ -996,12 +1052,16 @@ private constructor( (source.asKnown().getOrNull()?.validity() ?: 0) + (status.asKnown().getOrNull()?.validity() ?: 0) + (if (updated.asKnown().isPresent) 1 else 0) + - (if (userDefinedId.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) + (if (expectedReleaseDate.asKnown().isPresent) 1 else 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) + (if (externalBankAccountToken.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (userDefinedId.asKnown().isPresent) 1 else 0) - /** Payment category */ - class Category @JsonCreator private constructor(private val value: JsonField) : Enum { + /** Transaction category */ + class TransactionCategory + @JsonCreator + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1017,18 +1077,69 @@ private constructor( @JvmField val ACH = of("ACH") - @JvmStatic fun of(value: String) = Category(JsonField.of(value)) + @JvmField val BALANCE_OR_FUNDING = of("BALANCE_OR_FUNDING") + + @JvmField val FEE = of("FEE") + + @JvmField val REWARD = of("REWARD") + + @JvmField val ADJUSTMENT = of("ADJUSTMENT") + + @JvmField val DERECOGNITION = of("DERECOGNITION") + + @JvmField val DISPUTE = of("DISPUTE") + + @JvmField val CARD = of("CARD") + + @JvmField val EXTERNAL_ACH = of("EXTERNAL_ACH") + + @JvmField val EXTERNAL_CHECK = of("EXTERNAL_CHECK") + + @JvmField val EXTERNAL_TRANSFER = of("EXTERNAL_TRANSFER") + + @JvmField val EXTERNAL_WIRE = of("EXTERNAL_WIRE") + + @JvmField val MANAGEMENT_ADJUSTMENT = of("MANAGEMENT_ADJUSTMENT") + + @JvmField val MANAGEMENT_DISPUTE = of("MANAGEMENT_DISPUTE") + + @JvmField val MANAGEMENT_FEE = of("MANAGEMENT_FEE") + + @JvmField val MANAGEMENT_REWARD = of("MANAGEMENT_REWARD") + + @JvmField val MANAGEMENT_DISBURSEMENT = of("MANAGEMENT_DISBURSEMENT") + + @JvmField val PROGRAM_FUNDING = of("PROGRAM_FUNDING") + + @JvmStatic fun of(value: String) = TransactionCategory(JsonField.of(value)) } - /** An enum containing [Category]'s known values. */ + /** An enum containing [TransactionCategory]'s known values. */ enum class Known { - ACH + ACH, + BALANCE_OR_FUNDING, + FEE, + REWARD, + ADJUSTMENT, + DERECOGNITION, + DISPUTE, + CARD, + EXTERNAL_ACH, + EXTERNAL_CHECK, + EXTERNAL_TRANSFER, + EXTERNAL_WIRE, + MANAGEMENT_ADJUSTMENT, + MANAGEMENT_DISPUTE, + MANAGEMENT_FEE, + MANAGEMENT_REWARD, + MANAGEMENT_DISBURSEMENT, + PROGRAM_FUNDING, } /** - * An enum containing [Category]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [TransactionCategory]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [Category] can contain an unknown value in a couple of cases: + * An instance of [TransactionCategory] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, if the * SDK is on an older version than the API, then the API may respond with new members that * the SDK is unaware of. @@ -1036,7 +1147,27 @@ private constructor( */ enum class Value { ACH, - /** An enum member indicating that [Category] was instantiated with an unknown value. */ + BALANCE_OR_FUNDING, + FEE, + REWARD, + ADJUSTMENT, + DERECOGNITION, + DISPUTE, + CARD, + EXTERNAL_ACH, + EXTERNAL_CHECK, + EXTERNAL_TRANSFER, + EXTERNAL_WIRE, + MANAGEMENT_ADJUSTMENT, + MANAGEMENT_DISPUTE, + MANAGEMENT_FEE, + MANAGEMENT_REWARD, + MANAGEMENT_DISBURSEMENT, + PROGRAM_FUNDING, + /** + * An enum member indicating that [TransactionCategory] was instantiated with an unknown + * value. + */ _UNKNOWN, } @@ -1050,6 +1181,23 @@ private constructor( fun value(): Value = when (this) { ACH -> Value.ACH + BALANCE_OR_FUNDING -> Value.BALANCE_OR_FUNDING + FEE -> Value.FEE + REWARD -> Value.REWARD + ADJUSTMENT -> Value.ADJUSTMENT + DERECOGNITION -> Value.DERECOGNITION + DISPUTE -> Value.DISPUTE + CARD -> Value.CARD + EXTERNAL_ACH -> Value.EXTERNAL_ACH + EXTERNAL_CHECK -> Value.EXTERNAL_CHECK + EXTERNAL_TRANSFER -> Value.EXTERNAL_TRANSFER + EXTERNAL_WIRE -> Value.EXTERNAL_WIRE + MANAGEMENT_ADJUSTMENT -> Value.MANAGEMENT_ADJUSTMENT + MANAGEMENT_DISPUTE -> Value.MANAGEMENT_DISPUTE + MANAGEMENT_FEE -> Value.MANAGEMENT_FEE + MANAGEMENT_REWARD -> Value.MANAGEMENT_REWARD + MANAGEMENT_DISBURSEMENT -> Value.MANAGEMENT_DISBURSEMENT + PROGRAM_FUNDING -> Value.PROGRAM_FUNDING else -> Value._UNKNOWN } @@ -1065,7 +1213,24 @@ private constructor( fun known(): Known = when (this) { ACH -> Known.ACH - else -> throw LithicInvalidDataException("Unknown Category: $value") + BALANCE_OR_FUNDING -> Known.BALANCE_OR_FUNDING + FEE -> Known.FEE + REWARD -> Known.REWARD + ADJUSTMENT -> Known.ADJUSTMENT + DERECOGNITION -> Known.DERECOGNITION + DISPUTE -> Known.DISPUTE + CARD -> Known.CARD + EXTERNAL_ACH -> Known.EXTERNAL_ACH + EXTERNAL_CHECK -> Known.EXTERNAL_CHECK + EXTERNAL_TRANSFER -> Known.EXTERNAL_TRANSFER + EXTERNAL_WIRE -> Known.EXTERNAL_WIRE + MANAGEMENT_ADJUSTMENT -> Known.MANAGEMENT_ADJUSTMENT + MANAGEMENT_DISPUTE -> Known.MANAGEMENT_DISPUTE + MANAGEMENT_FEE -> Known.MANAGEMENT_FEE + MANAGEMENT_REWARD -> Known.MANAGEMENT_REWARD + MANAGEMENT_DISBURSEMENT -> Known.MANAGEMENT_DISBURSEMENT + PROGRAM_FUNDING -> Known.PROGRAM_FUNDING + else -> throw LithicInvalidDataException("Unknown TransactionCategory: $value") } /** @@ -1082,7 +1247,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Category = apply { + fun validate(): TransactionCategory = apply { if (validated) { return@apply } @@ -1112,7 +1277,7 @@ private constructor( return true } - return other is Category && value == other.value + return other is TransactionCategory && value == other.value } override fun hashCode() = value.hashCode() @@ -1120,6 +1285,7 @@ private constructor( override fun toString() = value.toString() } + /** Transfer direction */ class Direction @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -2160,7 +2326,8 @@ private constructor( "PaymentEvent{token=$token, amount=$amount, created=$created, result=$result, type=$type, detailedResults=$detailedResults, additionalProperties=$additionalProperties}" } - class Method @JsonCreator private constructor(private val value: JsonField) : Enum { + /** PAYMENT - Payment Transaction */ + class Family @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2174,9 +2341,131 @@ private constructor( companion object { - @JvmField val ACH_NEXT_DAY = of("ACH_NEXT_DAY") + @JvmField val PAYMENT = of("PAYMENT") - @JvmField val ACH_SAME_DAY = of("ACH_SAME_DAY") + @JvmStatic fun of(value: String) = Family(JsonField.of(value)) + } + + /** An enum containing [Family]'s known values. */ + enum class Known { + PAYMENT + } + + /** + * An enum containing [Family]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Family] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then 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 { + PAYMENT, + /** An enum member indicating that [Family] 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) { + PAYMENT -> Value.PAYMENT + 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 LithicInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + PAYMENT -> Known.PAYMENT + else -> throw LithicInvalidDataException("Unknown Family: $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 LithicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + fun validate(): Family = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 Family && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Transfer method */ + class Method @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val ACH_NEXT_DAY = of("ACH_NEXT_DAY") + + @JvmField val ACH_SAME_DAY = of("ACH_SAME_DAY") + + @JvmField val WIRE = of("WIRE") @JvmStatic fun of(value: String) = Method(JsonField.of(value)) } @@ -2185,6 +2474,7 @@ private constructor( enum class Known { ACH_NEXT_DAY, ACH_SAME_DAY, + WIRE, } /** @@ -2199,6 +2489,7 @@ private constructor( enum class Value { ACH_NEXT_DAY, ACH_SAME_DAY, + WIRE, /** An enum member indicating that [Method] was instantiated with an unknown value. */ _UNKNOWN, } @@ -2214,6 +2505,7 @@ private constructor( when (this) { ACH_NEXT_DAY -> Value.ACH_NEXT_DAY ACH_SAME_DAY -> Value.ACH_SAME_DAY + WIRE -> Value.WIRE else -> Value._UNKNOWN } @@ -2230,6 +2522,7 @@ private constructor( when (this) { ACH_NEXT_DAY -> Known.ACH_NEXT_DAY ACH_SAME_DAY -> Known.ACH_SAME_DAY + WIRE -> Known.WIRE else -> throw LithicInvalidDataException("Unknown Method: $value") } @@ -2285,526 +2578,1158 @@ private constructor( override fun toString() = value.toString() } - class PaymentMethodAttributes - @JsonCreator(mode = JsonCreator.Mode.DISABLED) + /** Method-specific attributes */ + @JsonDeserialize(using = MethodAttributes.Deserializer::class) + @JsonSerialize(using = MethodAttributes.Serializer::class) + class MethodAttributes private constructor( - private val companyId: JsonField, - private val receiptRoutingNumber: JsonField, - private val retries: JsonField, - private val returnReasonCode: JsonField, - private val secCode: JsonField, - private val traceNumbers: JsonField>, - private val addenda: JsonField, - private val additionalProperties: MutableMap, + private val ach: AchMethodAttributes? = null, + private val wire: WireMethodAttributes? = null, + private val _json: JsonValue? = null, ) { - @JsonCreator - private constructor( - @JsonProperty("company_id") - @ExcludeMissing - companyId: JsonField = JsonMissing.of(), - @JsonProperty("receipt_routing_number") - @ExcludeMissing - receiptRoutingNumber: JsonField = JsonMissing.of(), - @JsonProperty("retries") @ExcludeMissing retries: JsonField = JsonMissing.of(), - @JsonProperty("return_reason_code") - @ExcludeMissing - returnReasonCode: JsonField = JsonMissing.of(), - @JsonProperty("sec_code") - @ExcludeMissing - secCode: JsonField = JsonMissing.of(), - @JsonProperty("trace_numbers") - @ExcludeMissing - traceNumbers: JsonField> = JsonMissing.of(), - @JsonProperty("addenda") @ExcludeMissing addenda: JsonField = JsonMissing.of(), - ) : this( - companyId, - receiptRoutingNumber, - retries, - returnReasonCode, - secCode, - traceNumbers, - addenda, - mutableMapOf(), - ) + fun ach(): Optional = Optional.ofNullable(ach) - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun companyId(): Optional = companyId.getOptional("company_id") + fun wire(): Optional = Optional.ofNullable(wire) - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun receiptRoutingNumber(): Optional = - receiptRoutingNumber.getOptional("receipt_routing_number") + fun isAch(): Boolean = ach != null - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun retries(): Optional = retries.getOptional("retries") + fun isWire(): Boolean = wire != null - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun returnReasonCode(): Optional = - returnReasonCode.getOptional("return_reason_code") + fun asAch(): AchMethodAttributes = ach.getOrThrow("ach") - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun secCode(): SecCode = secCode.getRequired("sec_code") + fun asWire(): WireMethodAttributes = wire.getOrThrow("wire") - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun traceNumbers(): List = traceNumbers.getRequired("trace_numbers") + fun _json(): Optional = Optional.ofNullable(_json) - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun addenda(): Optional = addenda.getOptional("addenda") + fun accept(visitor: Visitor): T = + when { + ach != null -> visitor.visitAch(ach) + wire != null -> visitor.visitWire(wire) + else -> visitor.unknown(_json) + } - /** - * Returns the raw JSON value of [companyId]. - * - * Unlike [companyId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("company_id") @ExcludeMissing fun _companyId(): JsonField = companyId + private var validated: Boolean = false - /** - * Returns the raw JSON value of [receiptRoutingNumber]. - * - * Unlike [receiptRoutingNumber], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("receipt_routing_number") - @ExcludeMissing - fun _receiptRoutingNumber(): JsonField = receiptRoutingNumber + fun validate(): MethodAttributes = apply { + if (validated) { + return@apply + } - /** - * Returns the raw JSON value of [retries]. - * - * Unlike [retries], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("retries") @ExcludeMissing fun _retries(): JsonField = retries + accept( + object : Visitor { + override fun visitAch(ach: AchMethodAttributes) { + ach.validate() + } - /** - * Returns the raw JSON value of [returnReasonCode]. - * - * Unlike [returnReasonCode], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("return_reason_code") - @ExcludeMissing - fun _returnReasonCode(): JsonField = returnReasonCode + override fun visitWire(wire: WireMethodAttributes) { + wire.validate() + } + } + ) + validated = true + } - /** - * Returns the raw JSON value of [secCode]. - * - * Unlike [secCode], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("sec_code") @ExcludeMissing fun _secCode(): JsonField = secCode + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } /** - * Returns the raw JSON value of [traceNumbers]. + * Returns a score indicating how many valid values are contained in this object + * recursively. * - * Unlike [traceNumbers], this method doesn't throw if the JSON field has an unexpected - * type. + * Used for best match union deserialization. */ - @JsonProperty("trace_numbers") - @ExcludeMissing - fun _traceNumbers(): JsonField> = traceNumbers + @JvmSynthetic + internal fun validity(): Int = + accept( + object : Visitor { + override fun visitAch(ach: AchMethodAttributes) = ach.validity() - /** - * Returns the raw JSON value of [addenda]. - * - * Unlike [addenda], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("addenda") @ExcludeMissing fun _addenda(): JsonField = addenda + override fun visitWire(wire: WireMethodAttributes) = wire.validity() - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) + override fun unknown(json: JsonValue?) = 0 + } + ) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is MethodAttributes && ach == other.ach && wire == other.wire } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + override fun hashCode(): Int = Objects.hash(ach, wire) - fun toBuilder() = Builder().from(this) + override fun toString(): String = + when { + ach != null -> "MethodAttributes{ach=$ach}" + wire != null -> "MethodAttributes{wire=$wire}" + _json != null -> "MethodAttributes{_unknown=$_json}" + else -> throw IllegalStateException("Invalid MethodAttributes") + } companion object { + @JvmStatic fun ofAch(ach: AchMethodAttributes) = MethodAttributes(ach = ach) + + @JvmStatic fun ofWire(wire: WireMethodAttributes) = MethodAttributes(wire = wire) + } + + /** + * An interface that defines how to map each variant of [MethodAttributes] to a value of + * type [T]. + */ + interface Visitor { + + fun visitAch(ach: AchMethodAttributes): T + + fun visitWire(wire: WireMethodAttributes): T + /** - * Returns a mutable builder for constructing an instance of [PaymentMethodAttributes]. + * Maps an unknown variant of [MethodAttributes] to a value of type [T]. * - * The following fields are required: - * ```java - * .companyId() - * .receiptRoutingNumber() - * .retries() - * .returnReasonCode() - * .secCode() - * .traceNumbers() - * ``` + * An instance of [MethodAttributes] can contain an unknown variant if it was + * deserialized from data that doesn't match any known variant. For example, if the SDK + * is on an older version than the API, then the API may respond with new variants that + * the SDK is unaware of. + * + * @throws LithicInvalidDataException in the default implementation. */ - @JvmStatic fun builder() = Builder() + fun unknown(json: JsonValue?): T { + throw LithicInvalidDataException("Unknown MethodAttributes: $json") + } } - /** A builder for [PaymentMethodAttributes]. */ - class Builder internal constructor() { - - private var companyId: JsonField? = null - private var receiptRoutingNumber: JsonField? = null - private var retries: JsonField? = null - private var returnReasonCode: JsonField? = null - private var secCode: JsonField? = null - private var traceNumbers: JsonField>? = null - private var addenda: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(paymentMethodAttributes: PaymentMethodAttributes) = apply { - companyId = paymentMethodAttributes.companyId - receiptRoutingNumber = paymentMethodAttributes.receiptRoutingNumber - retries = paymentMethodAttributes.retries - returnReasonCode = paymentMethodAttributes.returnReasonCode - secCode = paymentMethodAttributes.secCode - traceNumbers = paymentMethodAttributes.traceNumbers.map { it.toMutableList() } - addenda = paymentMethodAttributes.addenda - additionalProperties = paymentMethodAttributes.additionalProperties.toMutableMap() + internal class Deserializer : BaseDeserializer(MethodAttributes::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): MethodAttributes { + val json = JsonValue.fromJsonNode(node) + + val bestMatches = + sequenceOf( + tryDeserialize(node, jacksonTypeRef())?.let { + MethodAttributes(ach = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + MethodAttributes(wire = it, _json = json) + }, + ) + .filterNotNull() + .allMaxBy { it.validity() } + .toList() + return when (bestMatches.size) { + // This can happen if what we're deserializing is completely incompatible with + // all the possible variants (e.g. deserializing from boolean). + 0 -> MethodAttributes(_json = json) + 1 -> bestMatches.single() + // If there's more than one match with the highest validity, then use the first + // completely valid match, or simply the first match if none are completely + // valid. + else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first() + } } + } - fun companyId(companyId: String?) = companyId(JsonField.ofNullable(companyId)) + internal class Serializer : BaseSerializer(MethodAttributes::class) { + + override fun serialize( + value: MethodAttributes, + generator: JsonGenerator, + provider: SerializerProvider, + ) { + when { + value.ach != null -> generator.writeObject(value.ach) + value.wire != null -> generator.writeObject(value.wire) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid MethodAttributes") + } + } + } - /** Alias for calling [Builder.companyId] with `companyId.orElse(null)`. */ - fun companyId(companyId: Optional) = companyId(companyId.getOrNull()) + class AchMethodAttributes + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val secCode: JsonField, + private val addenda: JsonField, + private val companyId: JsonField, + private val receiptRoutingNumber: JsonField, + private val retries: JsonField, + private val returnReasonCode: JsonField, + private val traceNumbers: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("sec_code") + @ExcludeMissing + secCode: JsonField = JsonMissing.of(), + @JsonProperty("addenda") + @ExcludeMissing + addenda: JsonField = JsonMissing.of(), + @JsonProperty("company_id") + @ExcludeMissing + companyId: JsonField = JsonMissing.of(), + @JsonProperty("receipt_routing_number") + @ExcludeMissing + receiptRoutingNumber: JsonField = JsonMissing.of(), + @JsonProperty("retries") + @ExcludeMissing + retries: JsonField = JsonMissing.of(), + @JsonProperty("return_reason_code") + @ExcludeMissing + returnReasonCode: JsonField = JsonMissing.of(), + @JsonProperty("trace_numbers") + @ExcludeMissing + traceNumbers: JsonField> = JsonMissing.of(), + ) : this( + secCode, + addenda, + companyId, + receiptRoutingNumber, + retries, + returnReasonCode, + traceNumbers, + mutableMapOf(), + ) /** - * Sets [Builder.companyId] to an arbitrary JSON value. + * SEC code for ACH transaction * - * You should usually call [Builder.companyId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). */ - fun companyId(companyId: JsonField) = apply { this.companyId = companyId } - - fun receiptRoutingNumber(receiptRoutingNumber: String?) = - receiptRoutingNumber(JsonField.ofNullable(receiptRoutingNumber)) + fun secCode(): SecCode = secCode.getRequired("sec_code") /** - * Alias for calling [Builder.receiptRoutingNumber] with - * `receiptRoutingNumber.orElse(null)`. + * Addenda information + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ - fun receiptRoutingNumber(receiptRoutingNumber: Optional) = - receiptRoutingNumber(receiptRoutingNumber.getOrNull()) + fun addenda(): Optional = addenda.getOptional("addenda") /** - * Sets [Builder.receiptRoutingNumber] to an arbitrary JSON value. + * Company ID for the ACH transaction * - * You should usually call [Builder.receiptRoutingNumber] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ - fun receiptRoutingNumber(receiptRoutingNumber: JsonField) = apply { - this.receiptRoutingNumber = receiptRoutingNumber - } + fun companyId(): Optional = companyId.getOptional("company_id") - fun retries(retries: Long?) = retries(JsonField.ofNullable(retries)) + /** + * Receipt routing number + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun receiptRoutingNumber(): Optional = + receiptRoutingNumber.getOptional("receipt_routing_number") /** - * Alias for [Builder.retries]. + * Number of retries attempted * - * This unboxed primitive overload exists for backwards compatibility. + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ - fun retries(retries: Long) = retries(retries as Long?) + fun retries(): Optional = retries.getOptional("retries") - /** Alias for calling [Builder.retries] with `retries.orElse(null)`. */ - fun retries(retries: Optional) = retries(retries.getOrNull()) + /** + * Return reason code if the transaction was returned + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun returnReasonCode(): Optional = + returnReasonCode.getOptional("return_reason_code") /** - * Sets [Builder.retries] to an arbitrary JSON value. + * Trace numbers for the ACH transaction * - * You should usually call [Builder.retries] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ - fun retries(retries: JsonField) = apply { this.retries = retries } + fun traceNumbers(): Optional> = traceNumbers.getOptional("trace_numbers") - fun returnReasonCode(returnReasonCode: String?) = - returnReasonCode(JsonField.ofNullable(returnReasonCode)) + /** + * Returns the raw JSON value of [secCode]. + * + * Unlike [secCode], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("sec_code") @ExcludeMissing fun _secCode(): JsonField = secCode /** - * Alias for calling [Builder.returnReasonCode] with `returnReasonCode.orElse(null)`. + * Returns the raw JSON value of [addenda]. + * + * Unlike [addenda], this method doesn't throw if the JSON field has an unexpected type. */ - fun returnReasonCode(returnReasonCode: Optional) = - returnReasonCode(returnReasonCode.getOrNull()) + @JsonProperty("addenda") @ExcludeMissing fun _addenda(): JsonField = addenda /** - * Sets [Builder.returnReasonCode] to an arbitrary JSON value. + * Returns the raw JSON value of [companyId]. * - * You should usually call [Builder.returnReasonCode] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * Unlike [companyId], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun returnReasonCode(returnReasonCode: JsonField) = apply { - this.returnReasonCode = returnReasonCode - } + @JsonProperty("company_id") + @ExcludeMissing + fun _companyId(): JsonField = companyId - fun secCode(secCode: SecCode) = secCode(JsonField.of(secCode)) + /** + * Returns the raw JSON value of [receiptRoutingNumber]. + * + * Unlike [receiptRoutingNumber], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("receipt_routing_number") + @ExcludeMissing + fun _receiptRoutingNumber(): JsonField = receiptRoutingNumber /** - * Sets [Builder.secCode] to an arbitrary JSON value. + * Returns the raw JSON value of [retries]. * - * You should usually call [Builder.secCode] with a well-typed [SecCode] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. + * Unlike [retries], this method doesn't throw if the JSON field has an unexpected type. */ - fun secCode(secCode: JsonField) = apply { this.secCode = secCode } + @JsonProperty("retries") @ExcludeMissing fun _retries(): JsonField = retries - fun traceNumbers(traceNumbers: List) = traceNumbers(JsonField.of(traceNumbers)) + /** + * Returns the raw JSON value of [returnReasonCode]. + * + * Unlike [returnReasonCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("return_reason_code") + @ExcludeMissing + fun _returnReasonCode(): JsonField = returnReasonCode /** - * Sets [Builder.traceNumbers] to an arbitrary JSON value. + * Returns the raw JSON value of [traceNumbers]. * - * You should usually call [Builder.traceNumbers] with a well-typed `List` - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * Unlike [traceNumbers], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun traceNumbers(traceNumbers: JsonField>) = apply { - this.traceNumbers = traceNumbers.map { it.toMutableList() } + @JsonProperty("trace_numbers") + @ExcludeMissing + fun _traceNumbers(): JsonField> = traceNumbers + + @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 [AchMethodAttributes]. + * + * The following fields are required: + * ```java + * .secCode() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AchMethodAttributes]. */ + class Builder internal constructor() { + + private var secCode: JsonField? = null + private var addenda: JsonField = JsonMissing.of() + private var companyId: JsonField = JsonMissing.of() + private var receiptRoutingNumber: JsonField = JsonMissing.of() + private var retries: JsonField = JsonMissing.of() + private var returnReasonCode: JsonField = JsonMissing.of() + private var traceNumbers: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(achMethodAttributes: AchMethodAttributes) = apply { + secCode = achMethodAttributes.secCode + addenda = achMethodAttributes.addenda + companyId = achMethodAttributes.companyId + receiptRoutingNumber = achMethodAttributes.receiptRoutingNumber + retries = achMethodAttributes.retries + returnReasonCode = achMethodAttributes.returnReasonCode + traceNumbers = achMethodAttributes.traceNumbers.map { it.toMutableList() } + additionalProperties = achMethodAttributes.additionalProperties.toMutableMap() + } + + /** SEC code for ACH transaction */ + fun secCode(secCode: SecCode) = secCode(JsonField.of(secCode)) + + /** + * Sets [Builder.secCode] to an arbitrary JSON value. + * + * You should usually call [Builder.secCode] with a well-typed [SecCode] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun secCode(secCode: JsonField) = apply { this.secCode = secCode } + + /** Addenda information */ + fun addenda(addenda: String?) = addenda(JsonField.ofNullable(addenda)) + + /** Alias for calling [Builder.addenda] with `addenda.orElse(null)`. */ + fun addenda(addenda: Optional) = addenda(addenda.getOrNull()) + + /** + * Sets [Builder.addenda] to an arbitrary JSON value. + * + * You should usually call [Builder.addenda] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun addenda(addenda: JsonField) = apply { this.addenda = addenda } + + /** Company ID for the ACH transaction */ + fun companyId(companyId: String?) = companyId(JsonField.ofNullable(companyId)) + + /** Alias for calling [Builder.companyId] with `companyId.orElse(null)`. */ + fun companyId(companyId: Optional) = companyId(companyId.getOrNull()) + + /** + * Sets [Builder.companyId] to an arbitrary JSON value. + * + * You should usually call [Builder.companyId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun companyId(companyId: JsonField) = apply { this.companyId = companyId } + + /** Receipt routing number */ + fun receiptRoutingNumber(receiptRoutingNumber: String?) = + receiptRoutingNumber(JsonField.ofNullable(receiptRoutingNumber)) + + /** + * Alias for calling [Builder.receiptRoutingNumber] with + * `receiptRoutingNumber.orElse(null)`. + */ + fun receiptRoutingNumber(receiptRoutingNumber: Optional) = + receiptRoutingNumber(receiptRoutingNumber.getOrNull()) + + /** + * Sets [Builder.receiptRoutingNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.receiptRoutingNumber] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun receiptRoutingNumber(receiptRoutingNumber: JsonField) = apply { + this.receiptRoutingNumber = receiptRoutingNumber + } + + /** Number of retries attempted */ + fun retries(retries: Long?) = retries(JsonField.ofNullable(retries)) + + /** + * Alias for [Builder.retries]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun retries(retries: Long) = retries(retries as Long?) + + /** Alias for calling [Builder.retries] with `retries.orElse(null)`. */ + fun retries(retries: Optional) = retries(retries.getOrNull()) + + /** + * Sets [Builder.retries] to an arbitrary JSON value. + * + * You should usually call [Builder.retries] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun retries(retries: JsonField) = apply { this.retries = retries } + + /** Return reason code if the transaction was returned */ + fun returnReasonCode(returnReasonCode: String?) = + returnReasonCode(JsonField.ofNullable(returnReasonCode)) + + /** + * Alias for calling [Builder.returnReasonCode] with + * `returnReasonCode.orElse(null)`. + */ + fun returnReasonCode(returnReasonCode: Optional) = + returnReasonCode(returnReasonCode.getOrNull()) + + /** + * Sets [Builder.returnReasonCode] to an arbitrary JSON value. + * + * You should usually call [Builder.returnReasonCode] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun returnReasonCode(returnReasonCode: JsonField) = apply { + this.returnReasonCode = returnReasonCode + } + + /** Trace numbers for the ACH transaction */ + fun traceNumbers(traceNumbers: List) = + traceNumbers(JsonField.of(traceNumbers)) + + /** + * Sets [Builder.traceNumbers] to an arbitrary JSON value. + * + * You should usually call [Builder.traceNumbers] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun traceNumbers(traceNumbers: JsonField>) = apply { + this.traceNumbers = traceNumbers.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [traceNumbers]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTraceNumber(traceNumber: String) = apply { + traceNumbers = + (traceNumbers ?: JsonField.of(mutableListOf())).also { + checkKnown("traceNumbers", it).add(traceNumber) + } + } + + 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 [AchMethodAttributes]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .secCode() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): AchMethodAttributes = + AchMethodAttributes( + checkRequired("secCode", secCode), + addenda, + companyId, + receiptRoutingNumber, + retries, + returnReasonCode, + (traceNumbers ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): AchMethodAttributes = apply { + if (validated) { + return@apply + } + + secCode().validate() + addenda() + companyId() + receiptRoutingNumber() + retries() + returnReasonCode() + traceNumbers() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + /** - * Adds a single [String] to [traceNumbers]. + * Returns a score indicating how many valid values are contained in this object + * recursively. * - * @throws IllegalStateException if the field was previously set to a non-list. + * Used for best match union deserialization. */ - fun addTraceNumber(traceNumber: String) = apply { - traceNumbers = - (traceNumbers ?: JsonField.of(mutableListOf())).also { - checkKnown("traceNumbers", it).add(traceNumber) + @JvmSynthetic + internal fun validity(): Int = + (secCode.asKnown().getOrNull()?.validity() ?: 0) + + (if (addenda.asKnown().isPresent) 1 else 0) + + (if (companyId.asKnown().isPresent) 1 else 0) + + (if (receiptRoutingNumber.asKnown().isPresent) 1 else 0) + + (if (retries.asKnown().isPresent) 1 else 0) + + (if (returnReasonCode.asKnown().isPresent) 1 else 0) + + (traceNumbers.asKnown().getOrNull()?.size ?: 0) + + /** SEC code for ACH transaction */ + class SecCode @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val CCD = of("CCD") + + @JvmField val PPD = of("PPD") + + @JvmField val WEB = of("WEB") + + @JvmField val TEL = of("TEL") + + @JvmField val CIE = of("CIE") + + @JvmField val CTX = of("CTX") + + @JvmStatic fun of(value: String) = SecCode(JsonField.of(value)) + } + + /** An enum containing [SecCode]'s known values. */ + enum class Known { + CCD, + PPD, + WEB, + TEL, + CIE, + CTX, + } + + /** + * An enum containing [SecCode]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [SecCode] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then 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 { + CCD, + PPD, + WEB, + TEL, + CIE, + CTX, + /** + * An enum member indicating that [SecCode] 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) { + CCD -> Value.CCD + PPD -> Value.PPD + WEB -> Value.WEB + TEL -> Value.TEL + CIE -> Value.CIE + CTX -> Value.CTX + 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 LithicInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + CCD -> Known.CCD + PPD -> Known.PPD + WEB -> Known.WEB + TEL -> Known.TEL + CIE -> Known.CIE + CTX -> Known.CTX + else -> throw LithicInvalidDataException("Unknown SecCode: $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 LithicInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): SecCode = apply { + if (validated) { + return@apply } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 SecCode && 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 AchMethodAttributes && + secCode == other.secCode && + addenda == other.addenda && + companyId == other.companyId && + receiptRoutingNumber == other.receiptRoutingNumber && + retries == other.retries && + returnReasonCode == other.returnReasonCode && + traceNumbers == other.traceNumbers && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + secCode, + addenda, + companyId, + receiptRoutingNumber, + retries, + returnReasonCode, + traceNumbers, + additionalProperties, + ) } - fun addenda(addenda: String?) = addenda(JsonField.ofNullable(addenda)) + override fun hashCode(): Int = hashCode + + override fun toString() = + "AchMethodAttributes{secCode=$secCode, addenda=$addenda, companyId=$companyId, receiptRoutingNumber=$receiptRoutingNumber, retries=$retries, returnReasonCode=$returnReasonCode, traceNumbers=$traceNumbers, additionalProperties=$additionalProperties}" + } - /** Alias for calling [Builder.addenda] with `addenda.orElse(null)`. */ - fun addenda(addenda: Optional) = addenda(addenda.getOrNull()) + class WireMethodAttributes + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val wireNetwork: JsonField, + private val creditor: JsonField, + private val debtor: JsonField, + private val messageId: JsonField, + private val remittanceInformation: JsonField, + private val wireMessageType: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("wire_network") + @ExcludeMissing + wireNetwork: JsonField = JsonMissing.of(), + @JsonProperty("creditor") + @ExcludeMissing + creditor: JsonField = JsonMissing.of(), + @JsonProperty("debtor") + @ExcludeMissing + debtor: JsonField = JsonMissing.of(), + @JsonProperty("message_id") + @ExcludeMissing + messageId: JsonField = JsonMissing.of(), + @JsonProperty("remittance_information") + @ExcludeMissing + remittanceInformation: JsonField = JsonMissing.of(), + @JsonProperty("wire_message_type") + @ExcludeMissing + wireMessageType: JsonField = JsonMissing.of(), + ) : this( + wireNetwork, + creditor, + debtor, + messageId, + remittanceInformation, + wireMessageType, + mutableMapOf(), + ) /** - * Sets [Builder.addenda] to an arbitrary JSON value. + * Type of wire transfer * - * You should usually call [Builder.addenda] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). */ - fun addenda(addenda: JsonField) = apply { this.addenda = addenda } + fun wireNetwork(): WireNetwork = wireNetwork.getRequired("wire_network") - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun creditor(): Optional = creditor.getOptional("creditor") + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun debtor(): Optional = debtor.getOptional("debtor") + + /** + * Point to point reference identifier, as assigned by the instructing party, used for + * tracking the message through the Fedwire system + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun messageId(): Optional = messageId.getOptional("message_id") + + /** + * Payment details or invoice reference + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun remittanceInformation(): Optional = + remittanceInformation.getOptional("remittance_information") + + /** + * Type of wire message + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun wireMessageType(): Optional = + wireMessageType.getOptional("wire_message_type") + + /** + * Returns the raw JSON value of [wireNetwork]. + * + * Unlike [wireNetwork], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("wire_network") + @ExcludeMissing + fun _wireNetwork(): JsonField = wireNetwork + + /** + * Returns the raw JSON value of [creditor]. + * + * Unlike [creditor], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("creditor") + @ExcludeMissing + fun _creditor(): JsonField = creditor + + /** + * Returns the raw JSON value of [debtor]. + * + * Unlike [debtor], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("debtor") + @ExcludeMissing + fun _debtor(): JsonField = debtor + + /** + * Returns the raw JSON value of [messageId]. + * + * Unlike [messageId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("message_id") + @ExcludeMissing + fun _messageId(): JsonField = messageId + + /** + * Returns the raw JSON value of [remittanceInformation]. + * + * Unlike [remittanceInformation], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("remittance_information") + @ExcludeMissing + fun _remittanceInformation(): JsonField = remittanceInformation + + /** + * Returns the raw JSON value of [wireMessageType]. + * + * Unlike [wireMessageType], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("wire_message_type") + @ExcludeMissing + fun _wireMessageType(): JsonField = wireMessageType - fun putAdditionalProperty(key: String, value: JsonValue) = apply { + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + fun toBuilder() = Builder().from(this) - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + companion object { + + /** + * Returns a mutable builder for constructing an instance of [WireMethodAttributes]. + * + * The following fields are required: + * ```java + * .wireNetwork() + * ``` + */ + @JvmStatic fun builder() = Builder() } - /** - * Returns an immutable instance of [PaymentMethodAttributes]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .companyId() - * .receiptRoutingNumber() - * .retries() - * .returnReasonCode() - * .secCode() - * .traceNumbers() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): PaymentMethodAttributes = - PaymentMethodAttributes( - checkRequired("companyId", companyId), - checkRequired("receiptRoutingNumber", receiptRoutingNumber), - checkRequired("retries", retries), - checkRequired("returnReasonCode", returnReasonCode), - checkRequired("secCode", secCode), - checkRequired("traceNumbers", traceNumbers).map { it.toImmutable() }, - addenda, - additionalProperties.toMutableMap(), - ) - } + /** A builder for [WireMethodAttributes]. */ + class Builder internal constructor() { + + private var wireNetwork: JsonField? = null + private var creditor: JsonField = JsonMissing.of() + private var debtor: JsonField = JsonMissing.of() + private var messageId: JsonField = JsonMissing.of() + private var remittanceInformation: JsonField = JsonMissing.of() + private var wireMessageType: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(wireMethodAttributes: WireMethodAttributes) = apply { + wireNetwork = wireMethodAttributes.wireNetwork + creditor = wireMethodAttributes.creditor + debtor = wireMethodAttributes.debtor + messageId = wireMethodAttributes.messageId + remittanceInformation = wireMethodAttributes.remittanceInformation + wireMessageType = wireMethodAttributes.wireMessageType + additionalProperties = wireMethodAttributes.additionalProperties.toMutableMap() + } - private var validated: Boolean = false + /** Type of wire transfer */ + fun wireNetwork(wireNetwork: WireNetwork) = wireNetwork(JsonField.of(wireNetwork)) - fun validate(): PaymentMethodAttributes = apply { - if (validated) { - return@apply - } + /** + * Sets [Builder.wireNetwork] to an arbitrary JSON value. + * + * You should usually call [Builder.wireNetwork] with a well-typed [WireNetwork] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun wireNetwork(wireNetwork: JsonField) = apply { + this.wireNetwork = wireNetwork + } - companyId() - receiptRoutingNumber() - retries() - returnReasonCode() - secCode().validate() - traceNumbers() - addenda() - validated = true - } + fun creditor(creditor: WirePartyDetails) = creditor(JsonField.of(creditor)) - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } + /** + * Sets [Builder.creditor] to an arbitrary JSON value. + * + * You should usually call [Builder.creditor] with a well-typed [WirePartyDetails] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun creditor(creditor: JsonField) = apply { + this.creditor = creditor + } - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (companyId.asKnown().isPresent) 1 else 0) + - (if (receiptRoutingNumber.asKnown().isPresent) 1 else 0) + - (if (retries.asKnown().isPresent) 1 else 0) + - (if (returnReasonCode.asKnown().isPresent) 1 else 0) + - (secCode.asKnown().getOrNull()?.validity() ?: 0) + - (traceNumbers.asKnown().getOrNull()?.sumOf { (if (it == null) 0 else 1).toInt() } - ?: 0) + - (if (addenda.asKnown().isPresent) 1 else 0) + fun debtor(debtor: WirePartyDetails) = debtor(JsonField.of(debtor)) - class SecCode @JsonCreator private constructor(private val value: JsonField) : - Enum { + /** + * Sets [Builder.debtor] to an arbitrary JSON value. + * + * You should usually call [Builder.debtor] with a well-typed [WirePartyDetails] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun debtor(debtor: JsonField) = apply { this.debtor = debtor } - /** - * 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 + /** + * Point to point reference identifier, as assigned by the instructing party, used + * for tracking the message through the Fedwire system + */ + fun messageId(messageId: String?) = messageId(JsonField.ofNullable(messageId)) - companion object { + /** Alias for calling [Builder.messageId] with `messageId.orElse(null)`. */ + fun messageId(messageId: Optional) = messageId(messageId.getOrNull()) - @JvmField val CCD = of("CCD") + /** + * Sets [Builder.messageId] to an arbitrary JSON value. + * + * You should usually call [Builder.messageId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun messageId(messageId: JsonField) = apply { this.messageId = messageId } - @JvmField val PPD = of("PPD") + /** Payment details or invoice reference */ + fun remittanceInformation(remittanceInformation: String?) = + remittanceInformation(JsonField.ofNullable(remittanceInformation)) - @JvmField val WEB = of("WEB") + /** + * Alias for calling [Builder.remittanceInformation] with + * `remittanceInformation.orElse(null)`. + */ + fun remittanceInformation(remittanceInformation: Optional) = + remittanceInformation(remittanceInformation.getOrNull()) - @JvmStatic fun of(value: String) = SecCode(JsonField.of(value)) - } + /** + * Sets [Builder.remittanceInformation] to an arbitrary JSON value. + * + * You should usually call [Builder.remittanceInformation] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun remittanceInformation(remittanceInformation: JsonField) = apply { + this.remittanceInformation = remittanceInformation + } - /** An enum containing [SecCode]'s known values. */ - enum class Known { - CCD, - PPD, - WEB, - } + /** Type of wire message */ + fun wireMessageType(wireMessageType: String) = + wireMessageType(JsonField.of(wireMessageType)) - /** - * An enum containing [SecCode]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [SecCode] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then 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 { - CCD, - PPD, - WEB, /** - * An enum member indicating that [SecCode] was instantiated with an unknown value. + * Sets [Builder.wireMessageType] to an arbitrary JSON value. + * + * You should usually call [Builder.wireMessageType] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. */ - _UNKNOWN, - } + fun wireMessageType(wireMessageType: JsonField) = apply { + this.wireMessageType = wireMessageType + } - /** - * 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) { - CCD -> Value.CCD - PPD -> Value.PPD - WEB -> Value.WEB - else -> Value._UNKNOWN + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws LithicInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - CCD -> Known.CCD - PPD -> Known.PPD - WEB -> Known.WEB - else -> throw LithicInvalidDataException("Unknown SecCode: $value") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } + /** + * Returns an immutable instance of [WireMethodAttributes]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .wireNetwork() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): WireMethodAttributes = + WireMethodAttributes( + checkRequired("wireNetwork", wireNetwork), + creditor, + debtor, + messageId, + remittanceInformation, + wireMessageType, + additionalProperties.toMutableMap(), + ) + } + private var validated: Boolean = false - fun validate(): SecCode = apply { + fun validate(): WireMethodAttributes = apply { if (validated) { return@apply } - known() + wireNetwork().validate() + creditor().ifPresent { it.validate() } + debtor().ifPresent { it.validate() } + messageId() + remittanceInformation() + wireMessageType() validated = true } @@ -2822,57 +3747,183 @@ private constructor( * * Used for best match union deserialization. */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + @JvmSynthetic + internal fun validity(): Int = + (wireNetwork.asKnown().getOrNull()?.validity() ?: 0) + + (creditor.asKnown().getOrNull()?.validity() ?: 0) + + (debtor.asKnown().getOrNull()?.validity() ?: 0) + + (if (messageId.asKnown().isPresent) 1 else 0) + + (if (remittanceInformation.asKnown().isPresent) 1 else 0) + + (if (wireMessageType.asKnown().isPresent) 1 else 0) + + /** Type of wire transfer */ + class WireNetwork + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val FEDWIRE = of("FEDWIRE") + + @JvmField val SWIFT = of("SWIFT") + + @JvmStatic fun of(value: String) = WireNetwork(JsonField.of(value)) + } + + /** An enum containing [WireNetwork]'s known values. */ + enum class Known { + FEDWIRE, + SWIFT, + } + + /** + * An enum containing [WireNetwork]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [WireNetwork] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then 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 { + FEDWIRE, + SWIFT, + /** + * An enum member indicating that [WireNetwork] 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) { + FEDWIRE -> Value.FEDWIRE + SWIFT -> Value.SWIFT + 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 LithicInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + FEDWIRE -> Known.FEDWIRE + SWIFT -> Known.SWIFT + else -> throw LithicInvalidDataException("Unknown WireNetwork: $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 LithicInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): WireNetwork = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 WireNetwork && 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 SecCode && value == other.value + return other is WireMethodAttributes && + wireNetwork == other.wireNetwork && + creditor == other.creditor && + debtor == other.debtor && + messageId == other.messageId && + remittanceInformation == other.remittanceInformation && + wireMessageType == other.wireMessageType && + additionalProperties == other.additionalProperties } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + private val hashCode: Int by lazy { + Objects.hash( + wireNetwork, + creditor, + debtor, + messageId, + remittanceInformation, + wireMessageType, + additionalProperties, + ) } - return other is PaymentMethodAttributes && - companyId == other.companyId && - receiptRoutingNumber == other.receiptRoutingNumber && - retries == other.retries && - returnReasonCode == other.returnReasonCode && - secCode == other.secCode && - traceNumbers == other.traceNumbers && - addenda == other.addenda && - additionalProperties == other.additionalProperties - } + override fun hashCode(): Int = hashCode - private val hashCode: Int by lazy { - Objects.hash( - companyId, - receiptRoutingNumber, - retries, - returnReasonCode, - secCode, - traceNumbers, - addenda, - additionalProperties, - ) + override fun toString() = + "WireMethodAttributes{wireNetwork=$wireNetwork, creditor=$creditor, debtor=$debtor, messageId=$messageId, remittanceInformation=$remittanceInformation, wireMessageType=$wireMessageType, additionalProperties=$additionalProperties}" } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "PaymentMethodAttributes{companyId=$companyId, receiptRoutingNumber=$receiptRoutingNumber, retries=$retries, returnReasonCode=$returnReasonCode, secCode=$secCode, traceNumbers=$traceNumbers, addenda=$addenda, additionalProperties=$additionalProperties}" } - /** Account tokens related to a payment transaction */ + /** Related account tokens for the transaction */ class RelatedAccountTokens @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( @@ -3101,11 +4152,9 @@ private constructor( "RelatedAccountTokens{accountToken=$accountToken, businessAccountToken=$businessAccountToken, additionalProperties=$additionalProperties}" } - /** - * APPROVED payments were successful while DECLINED payments were declined by Lithic or - * returned. - */ - class Result @JsonCreator private constructor(private val value: JsonField) : Enum { + /** Transaction result */ + class TransactionResult @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -3123,19 +4172,19 @@ private constructor( @JvmField val DECLINED = of("DECLINED") - @JvmStatic fun of(value: String) = Result(JsonField.of(value)) + @JvmStatic fun of(value: String) = TransactionResult(JsonField.of(value)) } - /** An enum containing [Result]'s known values. */ + /** An enum containing [TransactionResult]'s known values. */ enum class Known { APPROVED, DECLINED, } /** - * An enum containing [Result]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [TransactionResult]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [Result] can contain an unknown value in a couple of cases: + * An instance of [TransactionResult] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, if the * SDK is on an older version than the API, then the API may respond with new members that * the SDK is unaware of. @@ -3144,7 +4193,10 @@ private constructor( enum class Value { APPROVED, DECLINED, - /** An enum member indicating that [Result] was instantiated with an unknown value. */ + /** + * An enum member indicating that [TransactionResult] was instantiated with an unknown + * value. + */ _UNKNOWN, } @@ -3175,7 +4227,7 @@ private constructor( when (this) { APPROVED -> Known.APPROVED DECLINED -> Known.DECLINED - else -> throw LithicInvalidDataException("Unknown Result: $value") + else -> throw LithicInvalidDataException("Unknown TransactionResult: $value") } /** @@ -3192,7 +4244,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Result = apply { + fun validate(): TransactionResult = apply { if (validated) { return@apply } @@ -3222,7 +4274,7 @@ private constructor( return true } - return other is Result && value == other.value + return other is TransactionResult && value == other.value } override fun hashCode() = value.hashCode() @@ -3230,6 +4282,7 @@ private constructor( override fun toString() = value.toString() } + /** Transaction source */ class Source @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -3244,17 +4297,20 @@ private constructor( companion object { - @JvmField val CUSTOMER = of("CUSTOMER") - @JvmField val LITHIC = of("LITHIC") + @JvmField val EXTERNAL = of("EXTERNAL") + + @JvmField val CUSTOMER = of("CUSTOMER") + @JvmStatic fun of(value: String) = Source(JsonField.of(value)) } /** An enum containing [Source]'s known values. */ enum class Known { - CUSTOMER, LITHIC, + EXTERNAL, + CUSTOMER, } /** @@ -3267,8 +4323,9 @@ private constructor( * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - CUSTOMER, LITHIC, + EXTERNAL, + CUSTOMER, /** An enum member indicating that [Source] was instantiated with an unknown value. */ _UNKNOWN, } @@ -3282,8 +4339,9 @@ private constructor( */ fun value(): Value = when (this) { - CUSTOMER -> Value.CUSTOMER LITHIC -> Value.LITHIC + EXTERNAL -> Value.EXTERNAL + CUSTOMER -> Value.CUSTOMER else -> Value._UNKNOWN } @@ -3298,8 +4356,9 @@ private constructor( */ fun known(): Known = when (this) { - CUSTOMER -> Known.CUSTOMER LITHIC -> Known.LITHIC + EXTERNAL -> Known.EXTERNAL + CUSTOMER -> Known.CUSTOMER else -> throw LithicInvalidDataException("Unknown Source: $value") } @@ -3355,15 +4414,9 @@ private constructor( override fun toString() = value.toString() } - /** - * Status types: - * * `DECLINED` - The payment was declined. - * * `PENDING` - The payment is being processed and has yet to settle or release (origination - * debit). - * * `RETURNED` - The payment has been returned. - * * `SETTLED` - The payment is completed. - */ - class Status @JsonCreator private constructor(private val value: JsonField) : Enum { + /** The status of the transaction */ + class TransactionStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -3377,40 +4430,47 @@ private constructor( companion object { - @JvmField val DECLINED = of("DECLINED") - @JvmField val PENDING = of("PENDING") - @JvmField val RETURNED = of("RETURNED") - @JvmField val SETTLED = of("SETTLED") - @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + @JvmField val DECLINED = of("DECLINED") + + @JvmField val REVERSED = of("REVERSED") + + @JvmField val CANCELED = of("CANCELED") + + @JvmStatic fun of(value: String) = TransactionStatus(JsonField.of(value)) } - /** An enum containing [Status]'s known values. */ + /** An enum containing [TransactionStatus]'s known values. */ enum class Known { - DECLINED, PENDING, - RETURNED, SETTLED, + DECLINED, + REVERSED, + CANCELED, } /** - * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [TransactionStatus]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [Status] can contain an unknown value in a couple of cases: + * An instance of [TransactionStatus] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, if the * SDK is on an older version than the API, then 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 { - DECLINED, PENDING, - RETURNED, SETTLED, - /** An enum member indicating that [Status] was instantiated with an unknown value. */ + DECLINED, + REVERSED, + CANCELED, + /** + * An enum member indicating that [TransactionStatus] was instantiated with an unknown + * value. + */ _UNKNOWN, } @@ -3423,10 +4483,11 @@ private constructor( */ fun value(): Value = when (this) { - DECLINED -> Value.DECLINED PENDING -> Value.PENDING - RETURNED -> Value.RETURNED SETTLED -> Value.SETTLED + DECLINED -> Value.DECLINED + REVERSED -> Value.REVERSED + CANCELED -> Value.CANCELED else -> Value._UNKNOWN } @@ -3441,11 +4502,12 @@ private constructor( */ fun known(): Known = when (this) { - DECLINED -> Known.DECLINED PENDING -> Known.PENDING - RETURNED -> Known.RETURNED SETTLED -> Known.SETTLED - else -> throw LithicInvalidDataException("Unknown Status: $value") + DECLINED -> Known.DECLINED + REVERSED -> Known.REVERSED + CANCELED -> Known.CANCELED + else -> throw LithicInvalidDataException("Unknown TransactionStatus: $value") } /** @@ -3462,7 +4524,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Status = apply { + fun validate(): TransactionStatus = apply { if (validated) { return@apply } @@ -3492,7 +4554,7 @@ private constructor( return true } - return other is Status && value == other.value + return other is TransactionStatus && value == other.value } override fun hashCode() = value.hashCode() @@ -3500,7 +4562,6 @@ private constructor( override fun toString() = value.toString() } - /** Payment type indicating the specific ACH message or Fedwire transfer type */ class TransferType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -3674,11 +4735,10 @@ private constructor( token == other.token && category == other.category && created == other.created && - currency == other.currency && descriptor == other.descriptor && direction == other.direction && events == other.events && - externalBankAccountToken == other.externalBankAccountToken && + family == other.family && financialAccountToken == other.financialAccountToken && method == other.method && methodAttributes == other.methodAttributes && @@ -3689,9 +4749,11 @@ private constructor( source == other.source && status == other.status && updated == other.updated && - userDefinedId == other.userDefinedId && + currency == other.currency && expectedReleaseDate == other.expectedReleaseDate && + externalBankAccountToken == other.externalBankAccountToken && type == other.type && + userDefinedId == other.userDefinedId && additionalProperties == other.additionalProperties } @@ -3700,11 +4762,10 @@ private constructor( token, category, created, - currency, descriptor, direction, events, - externalBankAccountToken, + family, financialAccountToken, method, methodAttributes, @@ -3715,9 +4776,11 @@ private constructor( source, status, updated, - userDefinedId, + currency, expectedReleaseDate, + externalBankAccountToken, type, + userDefinedId, additionalProperties, ) } @@ -3725,5 +4788,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Payment{token=$token, category=$category, created=$created, currency=$currency, descriptor=$descriptor, direction=$direction, events=$events, externalBankAccountToken=$externalBankAccountToken, financialAccountToken=$financialAccountToken, method=$method, methodAttributes=$methodAttributes, pendingAmount=$pendingAmount, relatedAccountTokens=$relatedAccountTokens, result=$result, settledAmount=$settledAmount, source=$source, status=$status, updated=$updated, userDefinedId=$userDefinedId, expectedReleaseDate=$expectedReleaseDate, type=$type, additionalProperties=$additionalProperties}" + "Payment{token=$token, category=$category, created=$created, descriptor=$descriptor, direction=$direction, events=$events, family=$family, financialAccountToken=$financialAccountToken, method=$method, methodAttributes=$methodAttributes, pendingAmount=$pendingAmount, relatedAccountTokens=$relatedAccountTokens, result=$result, settledAmount=$settledAmount, source=$source, status=$status, updated=$updated, currency=$currency, expectedReleaseDate=$expectedReleaseDate, externalBankAccountToken=$externalBankAccountToken, type=$type, userDefinedId=$userDefinedId, additionalProperties=$additionalProperties}" } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentCreateResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentCreateResponse.kt index c8a9ec26e..45bb37004 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentCreateResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentCreateResponse.kt @@ -21,30 +21,32 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull +/** Payment transaction */ class PaymentCreateResponse @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val token: JsonField, - private val category: JsonField, + private val category: JsonField, private val created: JsonField, - private val currency: JsonField, private val descriptor: JsonField, private val direction: JsonField, private val events: JsonField>, - private val externalBankAccountToken: JsonField, + private val family: JsonField, private val financialAccountToken: JsonField, private val method: JsonField, - private val methodAttributes: JsonField, + private val methodAttributes: JsonField, private val pendingAmount: JsonField, private val relatedAccountTokens: JsonField, - private val result: JsonField, + private val result: JsonField, private val settledAmount: JsonField, private val source: JsonField, - private val status: JsonField, + private val status: JsonField, private val updated: JsonField, - private val userDefinedId: JsonField, + private val currency: JsonField, private val expectedReleaseDate: JsonField, + private val externalBankAccountToken: JsonField, private val type: JsonField, + private val userDefinedId: JsonField, private val balance: JsonField, private val additionalProperties: MutableMap, ) { @@ -54,11 +56,10 @@ private constructor( @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), @JsonProperty("category") @ExcludeMissing - category: JsonField = JsonMissing.of(), + category: JsonField = JsonMissing.of(), @JsonProperty("created") @ExcludeMissing created: JsonField = JsonMissing.of(), - @JsonProperty("currency") @ExcludeMissing currency: JsonField = JsonMissing.of(), @JsonProperty("descriptor") @ExcludeMissing descriptor: JsonField = JsonMissing.of(), @@ -68,9 +69,9 @@ private constructor( @JsonProperty("events") @ExcludeMissing events: JsonField> = JsonMissing.of(), - @JsonProperty("external_bank_account_token") + @JsonProperty("family") @ExcludeMissing - externalBankAccountToken: JsonField = JsonMissing.of(), + family: JsonField = JsonMissing.of(), @JsonProperty("financial_account_token") @ExcludeMissing financialAccountToken: JsonField = JsonMissing.of(), @@ -79,7 +80,7 @@ private constructor( method: JsonField = JsonMissing.of(), @JsonProperty("method_attributes") @ExcludeMissing - methodAttributes: JsonField = JsonMissing.of(), + methodAttributes: JsonField = JsonMissing.of(), @JsonProperty("pending_amount") @ExcludeMissing pendingAmount: JsonField = JsonMissing.of(), @@ -88,7 +89,7 @@ private constructor( relatedAccountTokens: JsonField = JsonMissing.of(), @JsonProperty("result") @ExcludeMissing - result: JsonField = JsonMissing.of(), + result: JsonField = JsonMissing.of(), @JsonProperty("settled_amount") @ExcludeMissing settledAmount: JsonField = JsonMissing.of(), @@ -97,29 +98,32 @@ private constructor( source: JsonField = JsonMissing.of(), @JsonProperty("status") @ExcludeMissing - status: JsonField = JsonMissing.of(), + status: JsonField = JsonMissing.of(), @JsonProperty("updated") @ExcludeMissing updated: JsonField = JsonMissing.of(), - @JsonProperty("user_defined_id") - @ExcludeMissing - userDefinedId: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing currency: JsonField = JsonMissing.of(), @JsonProperty("expected_release_date") @ExcludeMissing expectedReleaseDate: JsonField = JsonMissing.of(), + @JsonProperty("external_bank_account_token") + @ExcludeMissing + externalBankAccountToken: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("user_defined_id") + @ExcludeMissing + userDefinedId: JsonField = JsonMissing.of(), @JsonProperty("balance") @ExcludeMissing balance: JsonField = JsonMissing.of(), ) : this( token, category, created, - currency, descriptor, direction, events, - externalBankAccountToken, + family, financialAccountToken, method, methodAttributes, @@ -130,9 +134,11 @@ private constructor( source, status, updated, - userDefinedId, + currency, expectedReleaseDate, + externalBankAccountToken, type, + userDefinedId, balance, mutableMapOf(), ) @@ -142,11 +148,10 @@ private constructor( .token(token) .category(category) .created(created) - .currency(currency) .descriptor(descriptor) .direction(direction) .events(events) - .externalBankAccountToken(externalBankAccountToken) + .family(family) .financialAccountToken(financialAccountToken) .method(method) .methodAttributes(methodAttributes) @@ -157,13 +162,15 @@ private constructor( .source(source) .status(status) .updated(updated) - .userDefinedId(userDefinedId) + .currency(currency) .expectedReleaseDate(expectedReleaseDate) + .externalBankAccountToken(externalBankAccountToken) .type(type) + .userDefinedId(userDefinedId) .build() /** - * Globally unique identifier. + * Unique identifier for the transaction * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -171,15 +178,15 @@ private constructor( fun token(): String = token.getRequired("token") /** - * Payment category + * Transaction category * * @throws LithicInvalidDataException if 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(): Payment.Category = category.getRequired("category") + fun category(): Payment.TransactionCategory = category.getRequired("category") /** - * Date and time when the payment first occurred. UTC time zone. + * ISO 8601 timestamp of when the transaction was created * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -187,15 +194,7 @@ private constructor( fun created(): OffsetDateTime = created.getRequired("created") /** - * 3-character alphabetic ISO 4217 code for the settling currency of the payment. - * - * @throws LithicInvalidDataException if 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") - - /** - * A string that provides a description of the payment; may be useful to display to users. + * Transaction descriptor * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -203,13 +202,15 @@ private constructor( fun descriptor(): String = descriptor.getRequired("descriptor") /** + * Transfer direction + * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun direction(): Payment.Direction = direction.getRequired("direction") /** - * A list of all payment events that have modified this payment. + * List of transaction events * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -217,13 +218,16 @@ private constructor( fun events(): List = events.getRequired("events") /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * PAYMENT - Payment Transaction + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun externalBankAccountToken(): Optional = - externalBankAccountToken.getOptional("external_bank_account_token") + fun family(): Payment.Family = family.getRequired("family") /** + * Financial account token + * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ @@ -231,21 +235,24 @@ private constructor( financialAccountToken.getRequired("financial_account_token") /** + * Transfer method + * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun method(): Payment.Method = method.getRequired("method") /** + * Method-specific attributes + * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun methodAttributes(): Payment.PaymentMethodAttributes = + fun methodAttributes(): Payment.MethodAttributes = methodAttributes.getRequired("method_attributes") /** - * Pending amount of the payment in the currency's smallest unit (e.g., cents). The value of - * this field will go to zero over time once the payment is settled. + * Pending amount in cents * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -253,7 +260,7 @@ private constructor( fun pendingAmount(): Long = pendingAmount.getRequired("pending_amount") /** - * Account tokens related to a payment transaction + * Related account tokens for the transaction * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -262,16 +269,15 @@ private constructor( relatedAccountTokens.getRequired("related_account_tokens") /** - * APPROVED payments were successful while DECLINED payments were declined by Lithic or - * returned. + * Transaction result * * @throws LithicInvalidDataException if 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(): Payment.Result = result.getRequired("result") + fun result(): Payment.TransactionResult = result.getRequired("result") /** - * Amount of the payment that has been settled in the currency's smallest unit (e.g., cents). + * Settled amount in cents * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -279,26 +285,23 @@ private constructor( fun settledAmount(): Long = settledAmount.getRequired("settled_amount") /** + * Transaction source + * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun source(): Payment.Source = source.getRequired("source") /** - * Status types: - * * `DECLINED` - The payment was declined. - * * `PENDING` - The payment is being processed and has yet to settle or release (origination - * debit). - * * `RETURNED` - The payment has been returned. - * * `SETTLED` - The payment is completed. + * The status of the transaction * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun status(): Payment.Status = status.getRequired("status") + fun status(): Payment.TransactionStatus = status.getRequired("status") /** - * Date and time when the financial transaction was last updated. UTC time zone. + * ISO 8601 timestamp of when the transaction was last updated * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -306,13 +309,15 @@ private constructor( fun updated(): OffsetDateTime = updated.getRequired("updated") /** + * Currency of the transaction in ISO 4217 format + * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun userDefinedId(): Optional = userDefinedId.getOptional("user_defined_id") + fun currency(): Optional = currency.getOptional("currency") /** - * Date when the financial transaction expected to be released after settlement + * Expected release date for the transaction * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -321,13 +326,28 @@ private constructor( expectedReleaseDate.getOptional("expected_release_date") /** - * Payment type indicating the specific ACH message or Fedwire transfer type + * External bank account token * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ + fun externalBankAccountToken(): Optional = + externalBankAccountToken.getOptional("external_bank_account_token") + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = type.getOptional("type") + /** + * User-defined identifier + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun userDefinedId(): Optional = userDefinedId.getOptional("user_defined_id") + /** * Balance * @@ -350,7 +370,7 @@ private constructor( */ @JsonProperty("category") @ExcludeMissing - fun _category(): JsonField = category + fun _category(): JsonField = category /** * Returns the raw JSON value of [created]. @@ -359,13 +379,6 @@ private constructor( */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created - /** - * Returns the raw JSON value of [currency]. - * - * Unlike [currency], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - /** * Returns the raw JSON value of [descriptor]. * @@ -392,14 +405,11 @@ private constructor( fun _events(): JsonField> = events /** - * Returns the raw JSON value of [externalBankAccountToken]. + * Returns the raw JSON value of [family]. * - * Unlike [externalBankAccountToken], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [family], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("external_bank_account_token") - @ExcludeMissing - fun _externalBankAccountToken(): JsonField = externalBankAccountToken + @JsonProperty("family") @ExcludeMissing fun _family(): JsonField = family /** * Returns the raw JSON value of [financialAccountToken]. @@ -426,7 +436,7 @@ private constructor( */ @JsonProperty("method_attributes") @ExcludeMissing - fun _methodAttributes(): JsonField = methodAttributes + fun _methodAttributes(): JsonField = methodAttributes /** * Returns the raw JSON value of [pendingAmount]. @@ -452,7 +462,9 @@ private constructor( * * Unlike [result], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("result") @ExcludeMissing fun _result(): JsonField = result + @JsonProperty("result") + @ExcludeMissing + fun _result(): JsonField = result /** * Returns the raw JSON value of [settledAmount]. @@ -475,7 +487,9 @@ private constructor( * * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + @JsonProperty("status") + @ExcludeMissing + fun _status(): JsonField = status /** * Returns the raw JSON value of [updated]. @@ -485,13 +499,11 @@ private constructor( @JsonProperty("updated") @ExcludeMissing fun _updated(): JsonField = updated /** - * Returns the raw JSON value of [userDefinedId]. + * Returns the raw JSON value of [currency]. * - * Unlike [userDefinedId], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("user_defined_id") - @ExcludeMissing - fun _userDefinedId(): JsonField = userDefinedId + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency /** * Returns the raw JSON value of [expectedReleaseDate]. @@ -503,6 +515,16 @@ private constructor( @ExcludeMissing fun _expectedReleaseDate(): JsonField = expectedReleaseDate + /** + * Returns the raw JSON value of [externalBankAccountToken]. + * + * Unlike [externalBankAccountToken], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("external_bank_account_token") + @ExcludeMissing + fun _externalBankAccountToken(): JsonField = externalBankAccountToken + /** * Returns the raw JSON value of [type]. * @@ -510,6 +532,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + /** + * Returns the raw JSON value of [userDefinedId]. + * + * Unlike [userDefinedId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("user_defined_id") + @ExcludeMissing + fun _userDefinedId(): JsonField = userDefinedId + /** * Returns the raw JSON value of [balance]. * @@ -539,11 +570,10 @@ private constructor( * .token() * .category() * .created() - * .currency() * .descriptor() * .direction() * .events() - * .externalBankAccountToken() + * .family() * .financialAccountToken() * .method() * .methodAttributes() @@ -554,7 +584,6 @@ private constructor( * .source() * .status() * .updated() - * .userDefinedId() * ``` */ @JvmStatic fun builder() = Builder() @@ -564,26 +593,27 @@ private constructor( class Builder internal constructor() { private var token: JsonField? = null - private var category: JsonField? = null + private var category: JsonField? = null private var created: JsonField? = null - private var currency: JsonField? = null private var descriptor: JsonField? = null private var direction: JsonField? = null private var events: JsonField>? = null - private var externalBankAccountToken: JsonField? = null + private var family: JsonField? = null private var financialAccountToken: JsonField? = null private var method: JsonField? = null - private var methodAttributes: JsonField? = null + private var methodAttributes: JsonField? = null private var pendingAmount: JsonField? = null private var relatedAccountTokens: JsonField? = null - private var result: JsonField? = null + private var result: JsonField? = null private var settledAmount: JsonField? = null private var source: JsonField? = null - private var status: JsonField? = null + private var status: JsonField? = null private var updated: JsonField? = null - private var userDefinedId: JsonField? = null + private var currency: JsonField = JsonMissing.of() private var expectedReleaseDate: JsonField = JsonMissing.of() + private var externalBankAccountToken: JsonField = JsonMissing.of() private var type: JsonField = JsonMissing.of() + private var userDefinedId: JsonField = JsonMissing.of() private var balance: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -592,11 +622,10 @@ private constructor( token = paymentCreateResponse.token category = paymentCreateResponse.category created = paymentCreateResponse.created - currency = paymentCreateResponse.currency descriptor = paymentCreateResponse.descriptor direction = paymentCreateResponse.direction events = paymentCreateResponse.events.map { it.toMutableList() } - externalBankAccountToken = paymentCreateResponse.externalBankAccountToken + family = paymentCreateResponse.family financialAccountToken = paymentCreateResponse.financialAccountToken method = paymentCreateResponse.method methodAttributes = paymentCreateResponse.methodAttributes @@ -607,14 +636,16 @@ private constructor( source = paymentCreateResponse.source status = paymentCreateResponse.status updated = paymentCreateResponse.updated - userDefinedId = paymentCreateResponse.userDefinedId + currency = paymentCreateResponse.currency expectedReleaseDate = paymentCreateResponse.expectedReleaseDate + externalBankAccountToken = paymentCreateResponse.externalBankAccountToken type = paymentCreateResponse.type + userDefinedId = paymentCreateResponse.userDefinedId balance = paymentCreateResponse.balance additionalProperties = paymentCreateResponse.additionalProperties.toMutableMap() } - /** Globally unique identifier. */ + /** Unique identifier for the transaction */ fun token(token: String) = token(JsonField.of(token)) /** @@ -625,19 +656,21 @@ private constructor( */ fun token(token: JsonField) = apply { this.token = token } - /** Payment category */ - fun category(category: Payment.Category) = category(JsonField.of(category)) + /** Transaction category */ + fun category(category: Payment.TransactionCategory) = category(JsonField.of(category)) /** * Sets [Builder.category] to an arbitrary JSON value. * - * You should usually call [Builder.category] with a well-typed [Payment.Category] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * You should usually call [Builder.category] with a well-typed + * [Payment.TransactionCategory] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - fun category(category: JsonField) = apply { this.category = category } + fun category(category: JsonField) = apply { + this.category = category + } - /** Date and time when the payment first occurred. UTC time zone. */ + /** ISO 8601 timestamp of when the transaction was created */ fun created(created: OffsetDateTime) = created(JsonField.of(created)) /** @@ -649,20 +682,7 @@ private constructor( */ fun created(created: JsonField) = apply { this.created = created } - /** 3-character alphabetic ISO 4217 code for the settling currency of the payment. */ - 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 } - - /** - * A string that provides a description of the payment; may be useful to display to users. - */ + /** Transaction descriptor */ fun descriptor(descriptor: String) = descriptor(JsonField.of(descriptor)) /** @@ -674,6 +694,7 @@ private constructor( */ fun descriptor(descriptor: JsonField) = apply { this.descriptor = descriptor } + /** Transfer direction */ fun direction(direction: Payment.Direction) = direction(JsonField.of(direction)) /** @@ -687,7 +708,7 @@ private constructor( this.direction = direction } - /** A list of all payment events that have modified this payment. */ + /** List of transaction events */ fun events(events: List) = events(JsonField.of(events)) /** @@ -713,27 +734,19 @@ private constructor( } } - fun externalBankAccountToken(externalBankAccountToken: String?) = - externalBankAccountToken(JsonField.ofNullable(externalBankAccountToken)) - - /** - * Alias for calling [Builder.externalBankAccountToken] with - * `externalBankAccountToken.orElse(null)`. - */ - fun externalBankAccountToken(externalBankAccountToken: Optional) = - externalBankAccountToken(externalBankAccountToken.getOrNull()) + /** PAYMENT - Payment Transaction */ + fun family(family: Payment.Family) = family(JsonField.of(family)) /** - * Sets [Builder.externalBankAccountToken] to an arbitrary JSON value. + * Sets [Builder.family] to an arbitrary JSON value. * - * You should usually call [Builder.externalBankAccountToken] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * You should usually call [Builder.family] with a well-typed [Payment.Family] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun externalBankAccountToken(externalBankAccountToken: JsonField) = apply { - this.externalBankAccountToken = externalBankAccountToken - } + fun family(family: JsonField) = apply { this.family = family } + /** Financial account token */ fun financialAccountToken(financialAccountToken: String) = financialAccountToken(JsonField.of(financialAccountToken)) @@ -748,6 +761,7 @@ private constructor( this.financialAccountToken = financialAccountToken } + /** Transfer method */ fun method(method: Payment.Method) = method(JsonField.of(method)) /** @@ -759,24 +773,30 @@ private constructor( */ fun method(method: JsonField) = apply { this.method = method } - fun methodAttributes(methodAttributes: Payment.PaymentMethodAttributes) = + /** Method-specific attributes */ + fun methodAttributes(methodAttributes: Payment.MethodAttributes) = methodAttributes(JsonField.of(methodAttributes)) /** * Sets [Builder.methodAttributes] to an arbitrary JSON value. * * You should usually call [Builder.methodAttributes] with a well-typed - * [Payment.PaymentMethodAttributes] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * [Payment.MethodAttributes] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. */ - fun methodAttributes(methodAttributes: JsonField) = apply { + fun methodAttributes(methodAttributes: JsonField) = apply { this.methodAttributes = methodAttributes } - /** - * Pending amount of the payment in the currency's smallest unit (e.g., cents). The value of - * this field will go to zero over time once the payment is settled. - */ + /** Alias for calling [methodAttributes] with `Payment.MethodAttributes.ofAch(ach)`. */ + fun methodAttributes(ach: Payment.MethodAttributes.AchMethodAttributes) = + methodAttributes(Payment.MethodAttributes.ofAch(ach)) + + /** Alias for calling [methodAttributes] with `Payment.MethodAttributes.ofWire(wire)`. */ + fun methodAttributes(wire: Payment.MethodAttributes.WireMethodAttributes) = + methodAttributes(Payment.MethodAttributes.ofWire(wire)) + + /** Pending amount in cents */ fun pendingAmount(pendingAmount: Long) = pendingAmount(JsonField.of(pendingAmount)) /** @@ -790,7 +810,7 @@ private constructor( this.pendingAmount = pendingAmount } - /** Account tokens related to a payment transaction */ + /** Related account tokens for the transaction */ fun relatedAccountTokens(relatedAccountTokens: Payment.RelatedAccountTokens) = relatedAccountTokens(JsonField.of(relatedAccountTokens)) @@ -806,25 +826,19 @@ private constructor( this.relatedAccountTokens = relatedAccountTokens } - /** - * APPROVED payments were successful while DECLINED payments were declined by Lithic or - * returned. - */ - fun result(result: Payment.Result) = result(JsonField.of(result)) + /** Transaction result */ + fun result(result: Payment.TransactionResult) = result(JsonField.of(result)) /** * Sets [Builder.result] to an arbitrary JSON value. * - * You should usually call [Builder.result] with a well-typed [Payment.Result] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * You should usually call [Builder.result] with a well-typed [Payment.TransactionResult] + * 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 result(result: JsonField) = apply { this.result = result } - /** - * Amount of the payment that has been settled in the currency's smallest unit (e.g., - * cents). - */ + /** Settled amount in cents */ fun settledAmount(settledAmount: Long) = settledAmount(JsonField.of(settledAmount)) /** @@ -838,6 +852,7 @@ private constructor( this.settledAmount = settledAmount } + /** Transaction source */ fun source(source: Payment.Source) = source(JsonField.of(source)) /** @@ -849,26 +864,19 @@ private constructor( */ fun source(source: JsonField) = apply { this.source = source } - /** - * Status types: - * * `DECLINED` - The payment was declined. - * * `PENDING` - The payment is being processed and has yet to settle or release - * (origination debit). - * * `RETURNED` - The payment has been returned. - * * `SETTLED` - The payment is completed. - */ - fun status(status: Payment.Status) = status(JsonField.of(status)) + /** The status of the transaction */ + fun status(status: Payment.TransactionStatus) = status(JsonField.of(status)) /** * Sets [Builder.status] to an arbitrary JSON value. * - * You should usually call [Builder.status] with a well-typed [Payment.Status] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * You should usually call [Builder.status] with a well-typed [Payment.TransactionStatus] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun status(status: JsonField) = apply { this.status = status } + fun status(status: JsonField) = apply { this.status = status } - /** Date and time when the financial transaction was last updated. UTC time zone. */ + /** ISO 8601 timestamp of when the transaction was last updated */ fun updated(updated: OffsetDateTime) = updated(JsonField.of(updated)) /** @@ -880,27 +888,26 @@ private constructor( */ fun updated(updated: JsonField) = apply { this.updated = updated } - fun userDefinedId(userDefinedId: String?) = - userDefinedId(JsonField.ofNullable(userDefinedId)) - - /** Alias for calling [Builder.userDefinedId] with `userDefinedId.orElse(null)`. */ - fun userDefinedId(userDefinedId: Optional) = - userDefinedId(userDefinedId.getOrNull()) + /** Currency of the transaction in ISO 4217 format */ + fun currency(currency: String) = currency(JsonField.of(currency)) /** - * Sets [Builder.userDefinedId] to an arbitrary JSON value. + * Sets [Builder.currency] to an arbitrary JSON value. * - * You should usually call [Builder.userDefinedId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * You should usually call [Builder.currency] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun userDefinedId(userDefinedId: JsonField) = apply { - this.userDefinedId = userDefinedId - } + fun currency(currency: JsonField) = apply { this.currency = currency } - /** Date when the financial transaction expected to be released after settlement */ - fun expectedReleaseDate(expectedReleaseDate: LocalDate) = - expectedReleaseDate(JsonField.of(expectedReleaseDate)) + /** Expected release date for the transaction */ + fun expectedReleaseDate(expectedReleaseDate: LocalDate?) = + expectedReleaseDate(JsonField.ofNullable(expectedReleaseDate)) + + /** + * Alias for calling [Builder.expectedReleaseDate] with `expectedReleaseDate.orElse(null)`. + */ + fun expectedReleaseDate(expectedReleaseDate: Optional) = + expectedReleaseDate(expectedReleaseDate.getOrNull()) /** * Sets [Builder.expectedReleaseDate] to an arbitrary JSON value. @@ -913,7 +920,28 @@ private constructor( this.expectedReleaseDate = expectedReleaseDate } - /** Payment type indicating the specific ACH message or Fedwire transfer type */ + /** External bank account token */ + fun externalBankAccountToken(externalBankAccountToken: String?) = + externalBankAccountToken(JsonField.ofNullable(externalBankAccountToken)) + + /** + * Alias for calling [Builder.externalBankAccountToken] with + * `externalBankAccountToken.orElse(null)`. + */ + fun externalBankAccountToken(externalBankAccountToken: Optional) = + externalBankAccountToken(externalBankAccountToken.getOrNull()) + + /** + * Sets [Builder.externalBankAccountToken] to an arbitrary JSON value. + * + * You should usually call [Builder.externalBankAccountToken] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun externalBankAccountToken(externalBankAccountToken: JsonField) = apply { + this.externalBankAccountToken = externalBankAccountToken + } + fun type(type: Payment.TransferType) = type(JsonField.of(type)) /** @@ -925,6 +953,25 @@ private constructor( */ fun type(type: JsonField) = apply { this.type = type } + /** User-defined identifier */ + fun userDefinedId(userDefinedId: String?) = + userDefinedId(JsonField.ofNullable(userDefinedId)) + + /** Alias for calling [Builder.userDefinedId] with `userDefinedId.orElse(null)`. */ + fun userDefinedId(userDefinedId: Optional) = + userDefinedId(userDefinedId.getOrNull()) + + /** + * Sets [Builder.userDefinedId] to an arbitrary JSON value. + * + * You should usually call [Builder.userDefinedId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun userDefinedId(userDefinedId: JsonField) = apply { + this.userDefinedId = userDefinedId + } + /** Balance */ fun balance(balance: Balance) = balance(JsonField.of(balance)) @@ -965,11 +1012,10 @@ private constructor( * .token() * .category() * .created() - * .currency() * .descriptor() * .direction() * .events() - * .externalBankAccountToken() + * .family() * .financialAccountToken() * .method() * .methodAttributes() @@ -980,7 +1026,6 @@ private constructor( * .source() * .status() * .updated() - * .userDefinedId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -990,11 +1035,10 @@ private constructor( checkRequired("token", token), checkRequired("category", category), checkRequired("created", created), - checkRequired("currency", currency), checkRequired("descriptor", descriptor), checkRequired("direction", direction), checkRequired("events", events).map { it.toImmutable() }, - checkRequired("externalBankAccountToken", externalBankAccountToken), + checkRequired("family", family), checkRequired("financialAccountToken", financialAccountToken), checkRequired("method", method), checkRequired("methodAttributes", methodAttributes), @@ -1005,9 +1049,11 @@ private constructor( checkRequired("source", source), checkRequired("status", status), checkRequired("updated", updated), - checkRequired("userDefinedId", userDefinedId), + currency, expectedReleaseDate, + externalBankAccountToken, type, + userDefinedId, balance, additionalProperties.toMutableMap(), ) @@ -1023,11 +1069,10 @@ private constructor( token() category().validate() created() - currency() descriptor() direction().validate() events().forEach { it.validate() } - externalBankAccountToken() + family().validate() financialAccountToken() method().validate() methodAttributes().validate() @@ -1038,9 +1083,11 @@ private constructor( source().validate() status().validate() updated() - userDefinedId() + currency() expectedReleaseDate() + externalBankAccountToken() type().ifPresent { it.validate() } + userDefinedId() balance().ifPresent { it.validate() } validated = true } @@ -1063,11 +1110,10 @@ private constructor( (if (token.asKnown().isPresent) 1 else 0) + (category.asKnown().getOrNull()?.validity() ?: 0) + (if (created.asKnown().isPresent) 1 else 0) + - (if (currency.asKnown().isPresent) 1 else 0) + (if (descriptor.asKnown().isPresent) 1 else 0) + (direction.asKnown().getOrNull()?.validity() ?: 0) + (events.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (if (externalBankAccountToken.asKnown().isPresent) 1 else 0) + + (family.asKnown().getOrNull()?.validity() ?: 0) + (if (financialAccountToken.asKnown().isPresent) 1 else 0) + (method.asKnown().getOrNull()?.validity() ?: 0) + (methodAttributes.asKnown().getOrNull()?.validity() ?: 0) + @@ -1078,9 +1124,11 @@ private constructor( (source.asKnown().getOrNull()?.validity() ?: 0) + (status.asKnown().getOrNull()?.validity() ?: 0) + (if (updated.asKnown().isPresent) 1 else 0) + - (if (userDefinedId.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) + (if (expectedReleaseDate.asKnown().isPresent) 1 else 0) + + (if (externalBankAccountToken.asKnown().isPresent) 1 else 0) + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (userDefinedId.asKnown().isPresent) 1 else 0) + (balance.asKnown().getOrNull()?.validity() ?: 0) override fun equals(other: Any?): Boolean { @@ -1092,11 +1140,10 @@ private constructor( token == other.token && category == other.category && created == other.created && - currency == other.currency && descriptor == other.descriptor && direction == other.direction && events == other.events && - externalBankAccountToken == other.externalBankAccountToken && + family == other.family && financialAccountToken == other.financialAccountToken && method == other.method && methodAttributes == other.methodAttributes && @@ -1107,9 +1154,11 @@ private constructor( source == other.source && status == other.status && updated == other.updated && - userDefinedId == other.userDefinedId && + currency == other.currency && expectedReleaseDate == other.expectedReleaseDate && + externalBankAccountToken == other.externalBankAccountToken && type == other.type && + userDefinedId == other.userDefinedId && balance == other.balance && additionalProperties == other.additionalProperties } @@ -1119,11 +1168,10 @@ private constructor( token, category, created, - currency, descriptor, direction, events, - externalBankAccountToken, + family, financialAccountToken, method, methodAttributes, @@ -1134,9 +1182,11 @@ private constructor( source, status, updated, - userDefinedId, + currency, expectedReleaseDate, + externalBankAccountToken, type, + userDefinedId, balance, additionalProperties, ) @@ -1145,5 +1195,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PaymentCreateResponse{token=$token, category=$category, created=$created, currency=$currency, descriptor=$descriptor, direction=$direction, events=$events, externalBankAccountToken=$externalBankAccountToken, financialAccountToken=$financialAccountToken, method=$method, methodAttributes=$methodAttributes, pendingAmount=$pendingAmount, relatedAccountTokens=$relatedAccountTokens, result=$result, settledAmount=$settledAmount, source=$source, status=$status, updated=$updated, userDefinedId=$userDefinedId, expectedReleaseDate=$expectedReleaseDate, type=$type, balance=$balance, additionalProperties=$additionalProperties}" + "PaymentCreateResponse{token=$token, category=$category, created=$created, descriptor=$descriptor, direction=$direction, events=$events, family=$family, financialAccountToken=$financialAccountToken, method=$method, methodAttributes=$methodAttributes, pendingAmount=$pendingAmount, relatedAccountTokens=$relatedAccountTokens, result=$result, settledAmount=$settledAmount, source=$source, status=$status, updated=$updated, currency=$currency, expectedReleaseDate=$expectedReleaseDate, externalBankAccountToken=$externalBankAccountToken, type=$type, userDefinedId=$userDefinedId, balance=$balance, additionalProperties=$additionalProperties}" } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentRetryResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentRetryResponse.kt index c72ba0fb7..f5ae80f5d 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentRetryResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentRetryResponse.kt @@ -21,30 +21,32 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull +/** Payment transaction */ class PaymentRetryResponse @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val token: JsonField, - private val category: JsonField, + private val category: JsonField, private val created: JsonField, - private val currency: JsonField, private val descriptor: JsonField, private val direction: JsonField, private val events: JsonField>, - private val externalBankAccountToken: JsonField, + private val family: JsonField, private val financialAccountToken: JsonField, private val method: JsonField, - private val methodAttributes: JsonField, + private val methodAttributes: JsonField, private val pendingAmount: JsonField, private val relatedAccountTokens: JsonField, - private val result: JsonField, + private val result: JsonField, private val settledAmount: JsonField, private val source: JsonField, - private val status: JsonField, + private val status: JsonField, private val updated: JsonField, - private val userDefinedId: JsonField, + private val currency: JsonField, private val expectedReleaseDate: JsonField, + private val externalBankAccountToken: JsonField, private val type: JsonField, + private val userDefinedId: JsonField, private val balance: JsonField, private val additionalProperties: MutableMap, ) { @@ -54,11 +56,10 @@ private constructor( @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), @JsonProperty("category") @ExcludeMissing - category: JsonField = JsonMissing.of(), + category: JsonField = JsonMissing.of(), @JsonProperty("created") @ExcludeMissing created: JsonField = JsonMissing.of(), - @JsonProperty("currency") @ExcludeMissing currency: JsonField = JsonMissing.of(), @JsonProperty("descriptor") @ExcludeMissing descriptor: JsonField = JsonMissing.of(), @@ -68,9 +69,9 @@ private constructor( @JsonProperty("events") @ExcludeMissing events: JsonField> = JsonMissing.of(), - @JsonProperty("external_bank_account_token") + @JsonProperty("family") @ExcludeMissing - externalBankAccountToken: JsonField = JsonMissing.of(), + family: JsonField = JsonMissing.of(), @JsonProperty("financial_account_token") @ExcludeMissing financialAccountToken: JsonField = JsonMissing.of(), @@ -79,7 +80,7 @@ private constructor( method: JsonField = JsonMissing.of(), @JsonProperty("method_attributes") @ExcludeMissing - methodAttributes: JsonField = JsonMissing.of(), + methodAttributes: JsonField = JsonMissing.of(), @JsonProperty("pending_amount") @ExcludeMissing pendingAmount: JsonField = JsonMissing.of(), @@ -88,7 +89,7 @@ private constructor( relatedAccountTokens: JsonField = JsonMissing.of(), @JsonProperty("result") @ExcludeMissing - result: JsonField = JsonMissing.of(), + result: JsonField = JsonMissing.of(), @JsonProperty("settled_amount") @ExcludeMissing settledAmount: JsonField = JsonMissing.of(), @@ -97,29 +98,32 @@ private constructor( source: JsonField = JsonMissing.of(), @JsonProperty("status") @ExcludeMissing - status: JsonField = JsonMissing.of(), + status: JsonField = JsonMissing.of(), @JsonProperty("updated") @ExcludeMissing updated: JsonField = JsonMissing.of(), - @JsonProperty("user_defined_id") - @ExcludeMissing - userDefinedId: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing currency: JsonField = JsonMissing.of(), @JsonProperty("expected_release_date") @ExcludeMissing expectedReleaseDate: JsonField = JsonMissing.of(), + @JsonProperty("external_bank_account_token") + @ExcludeMissing + externalBankAccountToken: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("user_defined_id") + @ExcludeMissing + userDefinedId: JsonField = JsonMissing.of(), @JsonProperty("balance") @ExcludeMissing balance: JsonField = JsonMissing.of(), ) : this( token, category, created, - currency, descriptor, direction, events, - externalBankAccountToken, + family, financialAccountToken, method, methodAttributes, @@ -130,9 +134,11 @@ private constructor( source, status, updated, - userDefinedId, + currency, expectedReleaseDate, + externalBankAccountToken, type, + userDefinedId, balance, mutableMapOf(), ) @@ -142,11 +148,10 @@ private constructor( .token(token) .category(category) .created(created) - .currency(currency) .descriptor(descriptor) .direction(direction) .events(events) - .externalBankAccountToken(externalBankAccountToken) + .family(family) .financialAccountToken(financialAccountToken) .method(method) .methodAttributes(methodAttributes) @@ -157,13 +162,15 @@ private constructor( .source(source) .status(status) .updated(updated) - .userDefinedId(userDefinedId) + .currency(currency) .expectedReleaseDate(expectedReleaseDate) + .externalBankAccountToken(externalBankAccountToken) .type(type) + .userDefinedId(userDefinedId) .build() /** - * Globally unique identifier. + * Unique identifier for the transaction * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -171,15 +178,15 @@ private constructor( fun token(): String = token.getRequired("token") /** - * Payment category + * Transaction category * * @throws LithicInvalidDataException if 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(): Payment.Category = category.getRequired("category") + fun category(): Payment.TransactionCategory = category.getRequired("category") /** - * Date and time when the payment first occurred. UTC time zone. + * ISO 8601 timestamp of when the transaction was created * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -187,15 +194,7 @@ private constructor( fun created(): OffsetDateTime = created.getRequired("created") /** - * 3-character alphabetic ISO 4217 code for the settling currency of the payment. - * - * @throws LithicInvalidDataException if 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") - - /** - * A string that provides a description of the payment; may be useful to display to users. + * Transaction descriptor * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -203,13 +202,15 @@ private constructor( fun descriptor(): String = descriptor.getRequired("descriptor") /** + * Transfer direction + * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun direction(): Payment.Direction = direction.getRequired("direction") /** - * A list of all payment events that have modified this payment. + * List of transaction events * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -217,13 +218,16 @@ private constructor( fun events(): List = events.getRequired("events") /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * PAYMENT - Payment Transaction + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun externalBankAccountToken(): Optional = - externalBankAccountToken.getOptional("external_bank_account_token") + fun family(): Payment.Family = family.getRequired("family") /** + * Financial account token + * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ @@ -231,21 +235,24 @@ private constructor( financialAccountToken.getRequired("financial_account_token") /** + * Transfer method + * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun method(): Payment.Method = method.getRequired("method") /** + * Method-specific attributes + * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun methodAttributes(): Payment.PaymentMethodAttributes = + fun methodAttributes(): Payment.MethodAttributes = methodAttributes.getRequired("method_attributes") /** - * Pending amount of the payment in the currency's smallest unit (e.g., cents). The value of - * this field will go to zero over time once the payment is settled. + * Pending amount in cents * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -253,7 +260,7 @@ private constructor( fun pendingAmount(): Long = pendingAmount.getRequired("pending_amount") /** - * Account tokens related to a payment transaction + * Related account tokens for the transaction * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -262,16 +269,15 @@ private constructor( relatedAccountTokens.getRequired("related_account_tokens") /** - * APPROVED payments were successful while DECLINED payments were declined by Lithic or - * returned. + * Transaction result * * @throws LithicInvalidDataException if 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(): Payment.Result = result.getRequired("result") + fun result(): Payment.TransactionResult = result.getRequired("result") /** - * Amount of the payment that has been settled in the currency's smallest unit (e.g., cents). + * Settled amount in cents * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -279,26 +285,23 @@ private constructor( fun settledAmount(): Long = settledAmount.getRequired("settled_amount") /** + * Transaction source + * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun source(): Payment.Source = source.getRequired("source") /** - * Status types: - * * `DECLINED` - The payment was declined. - * * `PENDING` - The payment is being processed and has yet to settle or release (origination - * debit). - * * `RETURNED` - The payment has been returned. - * * `SETTLED` - The payment is completed. + * The status of the transaction * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun status(): Payment.Status = status.getRequired("status") + fun status(): Payment.TransactionStatus = status.getRequired("status") /** - * Date and time when the financial transaction was last updated. UTC time zone. + * ISO 8601 timestamp of when the transaction was last updated * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -306,13 +309,15 @@ private constructor( fun updated(): OffsetDateTime = updated.getRequired("updated") /** + * Currency of the transaction in ISO 4217 format + * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun userDefinedId(): Optional = userDefinedId.getOptional("user_defined_id") + fun currency(): Optional = currency.getOptional("currency") /** - * Date when the financial transaction expected to be released after settlement + * Expected release date for the transaction * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -321,13 +326,28 @@ private constructor( expectedReleaseDate.getOptional("expected_release_date") /** - * Payment type indicating the specific ACH message or Fedwire transfer type + * External bank account token * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ + fun externalBankAccountToken(): Optional = + externalBankAccountToken.getOptional("external_bank_account_token") + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ fun type(): Optional = type.getOptional("type") + /** + * User-defined identifier + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun userDefinedId(): Optional = userDefinedId.getOptional("user_defined_id") + /** * Balance * @@ -350,7 +370,7 @@ private constructor( */ @JsonProperty("category") @ExcludeMissing - fun _category(): JsonField = category + fun _category(): JsonField = category /** * Returns the raw JSON value of [created]. @@ -359,13 +379,6 @@ private constructor( */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created - /** - * Returns the raw JSON value of [currency]. - * - * Unlike [currency], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - /** * Returns the raw JSON value of [descriptor]. * @@ -392,14 +405,11 @@ private constructor( fun _events(): JsonField> = events /** - * Returns the raw JSON value of [externalBankAccountToken]. + * Returns the raw JSON value of [family]. * - * Unlike [externalBankAccountToken], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [family], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("external_bank_account_token") - @ExcludeMissing - fun _externalBankAccountToken(): JsonField = externalBankAccountToken + @JsonProperty("family") @ExcludeMissing fun _family(): JsonField = family /** * Returns the raw JSON value of [financialAccountToken]. @@ -426,7 +436,7 @@ private constructor( */ @JsonProperty("method_attributes") @ExcludeMissing - fun _methodAttributes(): JsonField = methodAttributes + fun _methodAttributes(): JsonField = methodAttributes /** * Returns the raw JSON value of [pendingAmount]. @@ -452,7 +462,9 @@ private constructor( * * Unlike [result], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("result") @ExcludeMissing fun _result(): JsonField = result + @JsonProperty("result") + @ExcludeMissing + fun _result(): JsonField = result /** * Returns the raw JSON value of [settledAmount]. @@ -475,7 +487,9 @@ private constructor( * * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + @JsonProperty("status") + @ExcludeMissing + fun _status(): JsonField = status /** * Returns the raw JSON value of [updated]. @@ -485,13 +499,11 @@ private constructor( @JsonProperty("updated") @ExcludeMissing fun _updated(): JsonField = updated /** - * Returns the raw JSON value of [userDefinedId]. + * Returns the raw JSON value of [currency]. * - * Unlike [userDefinedId], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("user_defined_id") - @ExcludeMissing - fun _userDefinedId(): JsonField = userDefinedId + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency /** * Returns the raw JSON value of [expectedReleaseDate]. @@ -503,6 +515,16 @@ private constructor( @ExcludeMissing fun _expectedReleaseDate(): JsonField = expectedReleaseDate + /** + * Returns the raw JSON value of [externalBankAccountToken]. + * + * Unlike [externalBankAccountToken], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("external_bank_account_token") + @ExcludeMissing + fun _externalBankAccountToken(): JsonField = externalBankAccountToken + /** * Returns the raw JSON value of [type]. * @@ -510,6 +532,15 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + /** + * Returns the raw JSON value of [userDefinedId]. + * + * Unlike [userDefinedId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("user_defined_id") + @ExcludeMissing + fun _userDefinedId(): JsonField = userDefinedId + /** * Returns the raw JSON value of [balance]. * @@ -539,11 +570,10 @@ private constructor( * .token() * .category() * .created() - * .currency() * .descriptor() * .direction() * .events() - * .externalBankAccountToken() + * .family() * .financialAccountToken() * .method() * .methodAttributes() @@ -554,7 +584,6 @@ private constructor( * .source() * .status() * .updated() - * .userDefinedId() * ``` */ @JvmStatic fun builder() = Builder() @@ -564,26 +593,27 @@ private constructor( class Builder internal constructor() { private var token: JsonField? = null - private var category: JsonField? = null + private var category: JsonField? = null private var created: JsonField? = null - private var currency: JsonField? = null private var descriptor: JsonField? = null private var direction: JsonField? = null private var events: JsonField>? = null - private var externalBankAccountToken: JsonField? = null + private var family: JsonField? = null private var financialAccountToken: JsonField? = null private var method: JsonField? = null - private var methodAttributes: JsonField? = null + private var methodAttributes: JsonField? = null private var pendingAmount: JsonField? = null private var relatedAccountTokens: JsonField? = null - private var result: JsonField? = null + private var result: JsonField? = null private var settledAmount: JsonField? = null private var source: JsonField? = null - private var status: JsonField? = null + private var status: JsonField? = null private var updated: JsonField? = null - private var userDefinedId: JsonField? = null + private var currency: JsonField = JsonMissing.of() private var expectedReleaseDate: JsonField = JsonMissing.of() + private var externalBankAccountToken: JsonField = JsonMissing.of() private var type: JsonField = JsonMissing.of() + private var userDefinedId: JsonField = JsonMissing.of() private var balance: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -592,11 +622,10 @@ private constructor( token = paymentRetryResponse.token category = paymentRetryResponse.category created = paymentRetryResponse.created - currency = paymentRetryResponse.currency descriptor = paymentRetryResponse.descriptor direction = paymentRetryResponse.direction events = paymentRetryResponse.events.map { it.toMutableList() } - externalBankAccountToken = paymentRetryResponse.externalBankAccountToken + family = paymentRetryResponse.family financialAccountToken = paymentRetryResponse.financialAccountToken method = paymentRetryResponse.method methodAttributes = paymentRetryResponse.methodAttributes @@ -607,14 +636,16 @@ private constructor( source = paymentRetryResponse.source status = paymentRetryResponse.status updated = paymentRetryResponse.updated - userDefinedId = paymentRetryResponse.userDefinedId + currency = paymentRetryResponse.currency expectedReleaseDate = paymentRetryResponse.expectedReleaseDate + externalBankAccountToken = paymentRetryResponse.externalBankAccountToken type = paymentRetryResponse.type + userDefinedId = paymentRetryResponse.userDefinedId balance = paymentRetryResponse.balance additionalProperties = paymentRetryResponse.additionalProperties.toMutableMap() } - /** Globally unique identifier. */ + /** Unique identifier for the transaction */ fun token(token: String) = token(JsonField.of(token)) /** @@ -625,19 +656,21 @@ private constructor( */ fun token(token: JsonField) = apply { this.token = token } - /** Payment category */ - fun category(category: Payment.Category) = category(JsonField.of(category)) + /** Transaction category */ + fun category(category: Payment.TransactionCategory) = category(JsonField.of(category)) /** * Sets [Builder.category] to an arbitrary JSON value. * - * You should usually call [Builder.category] with a well-typed [Payment.Category] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * You should usually call [Builder.category] with a well-typed + * [Payment.TransactionCategory] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - fun category(category: JsonField) = apply { this.category = category } + fun category(category: JsonField) = apply { + this.category = category + } - /** Date and time when the payment first occurred. UTC time zone. */ + /** ISO 8601 timestamp of when the transaction was created */ fun created(created: OffsetDateTime) = created(JsonField.of(created)) /** @@ -649,20 +682,7 @@ private constructor( */ fun created(created: JsonField) = apply { this.created = created } - /** 3-character alphabetic ISO 4217 code for the settling currency of the payment. */ - 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 } - - /** - * A string that provides a description of the payment; may be useful to display to users. - */ + /** Transaction descriptor */ fun descriptor(descriptor: String) = descriptor(JsonField.of(descriptor)) /** @@ -674,6 +694,7 @@ private constructor( */ fun descriptor(descriptor: JsonField) = apply { this.descriptor = descriptor } + /** Transfer direction */ fun direction(direction: Payment.Direction) = direction(JsonField.of(direction)) /** @@ -687,7 +708,7 @@ private constructor( this.direction = direction } - /** A list of all payment events that have modified this payment. */ + /** List of transaction events */ fun events(events: List) = events(JsonField.of(events)) /** @@ -713,27 +734,19 @@ private constructor( } } - fun externalBankAccountToken(externalBankAccountToken: String?) = - externalBankAccountToken(JsonField.ofNullable(externalBankAccountToken)) - - /** - * Alias for calling [Builder.externalBankAccountToken] with - * `externalBankAccountToken.orElse(null)`. - */ - fun externalBankAccountToken(externalBankAccountToken: Optional) = - externalBankAccountToken(externalBankAccountToken.getOrNull()) + /** PAYMENT - Payment Transaction */ + fun family(family: Payment.Family) = family(JsonField.of(family)) /** - * Sets [Builder.externalBankAccountToken] to an arbitrary JSON value. + * Sets [Builder.family] to an arbitrary JSON value. * - * You should usually call [Builder.externalBankAccountToken] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * You should usually call [Builder.family] with a well-typed [Payment.Family] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun externalBankAccountToken(externalBankAccountToken: JsonField) = apply { - this.externalBankAccountToken = externalBankAccountToken - } + fun family(family: JsonField) = apply { this.family = family } + /** Financial account token */ fun financialAccountToken(financialAccountToken: String) = financialAccountToken(JsonField.of(financialAccountToken)) @@ -748,6 +761,7 @@ private constructor( this.financialAccountToken = financialAccountToken } + /** Transfer method */ fun method(method: Payment.Method) = method(JsonField.of(method)) /** @@ -759,24 +773,30 @@ private constructor( */ fun method(method: JsonField) = apply { this.method = method } - fun methodAttributes(methodAttributes: Payment.PaymentMethodAttributes) = + /** Method-specific attributes */ + fun methodAttributes(methodAttributes: Payment.MethodAttributes) = methodAttributes(JsonField.of(methodAttributes)) /** * Sets [Builder.methodAttributes] to an arbitrary JSON value. * * You should usually call [Builder.methodAttributes] with a well-typed - * [Payment.PaymentMethodAttributes] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * [Payment.MethodAttributes] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. */ - fun methodAttributes(methodAttributes: JsonField) = apply { + fun methodAttributes(methodAttributes: JsonField) = apply { this.methodAttributes = methodAttributes } - /** - * Pending amount of the payment in the currency's smallest unit (e.g., cents). The value of - * this field will go to zero over time once the payment is settled. - */ + /** Alias for calling [methodAttributes] with `Payment.MethodAttributes.ofAch(ach)`. */ + fun methodAttributes(ach: Payment.MethodAttributes.AchMethodAttributes) = + methodAttributes(Payment.MethodAttributes.ofAch(ach)) + + /** Alias for calling [methodAttributes] with `Payment.MethodAttributes.ofWire(wire)`. */ + fun methodAttributes(wire: Payment.MethodAttributes.WireMethodAttributes) = + methodAttributes(Payment.MethodAttributes.ofWire(wire)) + + /** Pending amount in cents */ fun pendingAmount(pendingAmount: Long) = pendingAmount(JsonField.of(pendingAmount)) /** @@ -790,7 +810,7 @@ private constructor( this.pendingAmount = pendingAmount } - /** Account tokens related to a payment transaction */ + /** Related account tokens for the transaction */ fun relatedAccountTokens(relatedAccountTokens: Payment.RelatedAccountTokens) = relatedAccountTokens(JsonField.of(relatedAccountTokens)) @@ -806,25 +826,19 @@ private constructor( this.relatedAccountTokens = relatedAccountTokens } - /** - * APPROVED payments were successful while DECLINED payments were declined by Lithic or - * returned. - */ - fun result(result: Payment.Result) = result(JsonField.of(result)) + /** Transaction result */ + fun result(result: Payment.TransactionResult) = result(JsonField.of(result)) /** * Sets [Builder.result] to an arbitrary JSON value. * - * You should usually call [Builder.result] with a well-typed [Payment.Result] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * You should usually call [Builder.result] with a well-typed [Payment.TransactionResult] + * 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 result(result: JsonField) = apply { this.result = result } - /** - * Amount of the payment that has been settled in the currency's smallest unit (e.g., - * cents). - */ + /** Settled amount in cents */ fun settledAmount(settledAmount: Long) = settledAmount(JsonField.of(settledAmount)) /** @@ -838,6 +852,7 @@ private constructor( this.settledAmount = settledAmount } + /** Transaction source */ fun source(source: Payment.Source) = source(JsonField.of(source)) /** @@ -849,26 +864,19 @@ private constructor( */ fun source(source: JsonField) = apply { this.source = source } - /** - * Status types: - * * `DECLINED` - The payment was declined. - * * `PENDING` - The payment is being processed and has yet to settle or release - * (origination debit). - * * `RETURNED` - The payment has been returned. - * * `SETTLED` - The payment is completed. - */ - fun status(status: Payment.Status) = status(JsonField.of(status)) + /** The status of the transaction */ + fun status(status: Payment.TransactionStatus) = status(JsonField.of(status)) /** * Sets [Builder.status] to an arbitrary JSON value. * - * You should usually call [Builder.status] with a well-typed [Payment.Status] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * You should usually call [Builder.status] with a well-typed [Payment.TransactionStatus] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun status(status: JsonField) = apply { this.status = status } + fun status(status: JsonField) = apply { this.status = status } - /** Date and time when the financial transaction was last updated. UTC time zone. */ + /** ISO 8601 timestamp of when the transaction was last updated */ fun updated(updated: OffsetDateTime) = updated(JsonField.of(updated)) /** @@ -880,27 +888,26 @@ private constructor( */ fun updated(updated: JsonField) = apply { this.updated = updated } - fun userDefinedId(userDefinedId: String?) = - userDefinedId(JsonField.ofNullable(userDefinedId)) - - /** Alias for calling [Builder.userDefinedId] with `userDefinedId.orElse(null)`. */ - fun userDefinedId(userDefinedId: Optional) = - userDefinedId(userDefinedId.getOrNull()) + /** Currency of the transaction in ISO 4217 format */ + fun currency(currency: String) = currency(JsonField.of(currency)) /** - * Sets [Builder.userDefinedId] to an arbitrary JSON value. + * Sets [Builder.currency] to an arbitrary JSON value. * - * You should usually call [Builder.userDefinedId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * You should usually call [Builder.currency] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun userDefinedId(userDefinedId: JsonField) = apply { - this.userDefinedId = userDefinedId - } + fun currency(currency: JsonField) = apply { this.currency = currency } - /** Date when the financial transaction expected to be released after settlement */ - fun expectedReleaseDate(expectedReleaseDate: LocalDate) = - expectedReleaseDate(JsonField.of(expectedReleaseDate)) + /** Expected release date for the transaction */ + fun expectedReleaseDate(expectedReleaseDate: LocalDate?) = + expectedReleaseDate(JsonField.ofNullable(expectedReleaseDate)) + + /** + * Alias for calling [Builder.expectedReleaseDate] with `expectedReleaseDate.orElse(null)`. + */ + fun expectedReleaseDate(expectedReleaseDate: Optional) = + expectedReleaseDate(expectedReleaseDate.getOrNull()) /** * Sets [Builder.expectedReleaseDate] to an arbitrary JSON value. @@ -913,7 +920,28 @@ private constructor( this.expectedReleaseDate = expectedReleaseDate } - /** Payment type indicating the specific ACH message or Fedwire transfer type */ + /** External bank account token */ + fun externalBankAccountToken(externalBankAccountToken: String?) = + externalBankAccountToken(JsonField.ofNullable(externalBankAccountToken)) + + /** + * Alias for calling [Builder.externalBankAccountToken] with + * `externalBankAccountToken.orElse(null)`. + */ + fun externalBankAccountToken(externalBankAccountToken: Optional) = + externalBankAccountToken(externalBankAccountToken.getOrNull()) + + /** + * Sets [Builder.externalBankAccountToken] to an arbitrary JSON value. + * + * You should usually call [Builder.externalBankAccountToken] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun externalBankAccountToken(externalBankAccountToken: JsonField) = apply { + this.externalBankAccountToken = externalBankAccountToken + } + fun type(type: Payment.TransferType) = type(JsonField.of(type)) /** @@ -925,6 +953,25 @@ private constructor( */ fun type(type: JsonField) = apply { this.type = type } + /** User-defined identifier */ + fun userDefinedId(userDefinedId: String?) = + userDefinedId(JsonField.ofNullable(userDefinedId)) + + /** Alias for calling [Builder.userDefinedId] with `userDefinedId.orElse(null)`. */ + fun userDefinedId(userDefinedId: Optional) = + userDefinedId(userDefinedId.getOrNull()) + + /** + * Sets [Builder.userDefinedId] to an arbitrary JSON value. + * + * You should usually call [Builder.userDefinedId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun userDefinedId(userDefinedId: JsonField) = apply { + this.userDefinedId = userDefinedId + } + /** Balance */ fun balance(balance: Balance) = balance(JsonField.of(balance)) @@ -965,11 +1012,10 @@ private constructor( * .token() * .category() * .created() - * .currency() * .descriptor() * .direction() * .events() - * .externalBankAccountToken() + * .family() * .financialAccountToken() * .method() * .methodAttributes() @@ -980,7 +1026,6 @@ private constructor( * .source() * .status() * .updated() - * .userDefinedId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -990,11 +1035,10 @@ private constructor( checkRequired("token", token), checkRequired("category", category), checkRequired("created", created), - checkRequired("currency", currency), checkRequired("descriptor", descriptor), checkRequired("direction", direction), checkRequired("events", events).map { it.toImmutable() }, - checkRequired("externalBankAccountToken", externalBankAccountToken), + checkRequired("family", family), checkRequired("financialAccountToken", financialAccountToken), checkRequired("method", method), checkRequired("methodAttributes", methodAttributes), @@ -1005,9 +1049,11 @@ private constructor( checkRequired("source", source), checkRequired("status", status), checkRequired("updated", updated), - checkRequired("userDefinedId", userDefinedId), + currency, expectedReleaseDate, + externalBankAccountToken, type, + userDefinedId, balance, additionalProperties.toMutableMap(), ) @@ -1023,11 +1069,10 @@ private constructor( token() category().validate() created() - currency() descriptor() direction().validate() events().forEach { it.validate() } - externalBankAccountToken() + family().validate() financialAccountToken() method().validate() methodAttributes().validate() @@ -1038,9 +1083,11 @@ private constructor( source().validate() status().validate() updated() - userDefinedId() + currency() expectedReleaseDate() + externalBankAccountToken() type().ifPresent { it.validate() } + userDefinedId() balance().ifPresent { it.validate() } validated = true } @@ -1063,11 +1110,10 @@ private constructor( (if (token.asKnown().isPresent) 1 else 0) + (category.asKnown().getOrNull()?.validity() ?: 0) + (if (created.asKnown().isPresent) 1 else 0) + - (if (currency.asKnown().isPresent) 1 else 0) + (if (descriptor.asKnown().isPresent) 1 else 0) + (direction.asKnown().getOrNull()?.validity() ?: 0) + (events.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (if (externalBankAccountToken.asKnown().isPresent) 1 else 0) + + (family.asKnown().getOrNull()?.validity() ?: 0) + (if (financialAccountToken.asKnown().isPresent) 1 else 0) + (method.asKnown().getOrNull()?.validity() ?: 0) + (methodAttributes.asKnown().getOrNull()?.validity() ?: 0) + @@ -1078,9 +1124,11 @@ private constructor( (source.asKnown().getOrNull()?.validity() ?: 0) + (status.asKnown().getOrNull()?.validity() ?: 0) + (if (updated.asKnown().isPresent) 1 else 0) + - (if (userDefinedId.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) + (if (expectedReleaseDate.asKnown().isPresent) 1 else 0) + + (if (externalBankAccountToken.asKnown().isPresent) 1 else 0) + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (userDefinedId.asKnown().isPresent) 1 else 0) + (balance.asKnown().getOrNull()?.validity() ?: 0) override fun equals(other: Any?): Boolean { @@ -1092,11 +1140,10 @@ private constructor( token == other.token && category == other.category && created == other.created && - currency == other.currency && descriptor == other.descriptor && direction == other.direction && events == other.events && - externalBankAccountToken == other.externalBankAccountToken && + family == other.family && financialAccountToken == other.financialAccountToken && method == other.method && methodAttributes == other.methodAttributes && @@ -1107,9 +1154,11 @@ private constructor( source == other.source && status == other.status && updated == other.updated && - userDefinedId == other.userDefinedId && + currency == other.currency && expectedReleaseDate == other.expectedReleaseDate && + externalBankAccountToken == other.externalBankAccountToken && type == other.type && + userDefinedId == other.userDefinedId && balance == other.balance && additionalProperties == other.additionalProperties } @@ -1119,11 +1168,10 @@ private constructor( token, category, created, - currency, descriptor, direction, events, - externalBankAccountToken, + family, financialAccountToken, method, methodAttributes, @@ -1134,9 +1182,11 @@ private constructor( source, status, updated, - userDefinedId, + currency, expectedReleaseDate, + externalBankAccountToken, type, + userDefinedId, balance, additionalProperties, ) @@ -1145,5 +1195,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PaymentRetryResponse{token=$token, category=$category, created=$created, currency=$currency, descriptor=$descriptor, direction=$direction, events=$events, externalBankAccountToken=$externalBankAccountToken, financialAccountToken=$financialAccountToken, method=$method, methodAttributes=$methodAttributes, pendingAmount=$pendingAmount, relatedAccountTokens=$relatedAccountTokens, result=$result, settledAmount=$settledAmount, source=$source, status=$status, updated=$updated, userDefinedId=$userDefinedId, expectedReleaseDate=$expectedReleaseDate, type=$type, balance=$balance, additionalProperties=$additionalProperties}" + "PaymentRetryResponse{token=$token, category=$category, created=$created, descriptor=$descriptor, direction=$direction, events=$events, family=$family, financialAccountToken=$financialAccountToken, method=$method, methodAttributes=$methodAttributes, pendingAmount=$pendingAmount, relatedAccountTokens=$relatedAccountTokens, result=$result, settledAmount=$settledAmount, source=$source, status=$status, updated=$updated, currency=$currency, expectedReleaseDate=$expectedReleaseDate, externalBankAccountToken=$externalBankAccountToken, type=$type, userDefinedId=$userDefinedId, balance=$balance, additionalProperties=$additionalProperties}" } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ProvisionResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ProvisionResponse.kt new file mode 100644 index 000000000..3cdb92ccd --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ProvisionResponse.kt @@ -0,0 +1,250 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.lithic.api.core.ExcludeMissing +import com.lithic.api.core.JsonField +import com.lithic.api.core.JsonMissing +import com.lithic.api.core.JsonValue +import com.lithic.api.errors.LithicInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional + +/** + * Object containing the fields required to add a card to Apple Pay. Applies only to Apple Pay + * wallet. + */ +class ProvisionResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val activationData: JsonField, + private val encryptedData: JsonField, + private val ephemeralPublicKey: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("activationData") + @ExcludeMissing + activationData: JsonField = JsonMissing.of(), + @JsonProperty("encryptedData") + @ExcludeMissing + encryptedData: JsonField = JsonMissing.of(), + @JsonProperty("ephemeralPublicKey") + @ExcludeMissing + ephemeralPublicKey: JsonField = JsonMissing.of(), + ) : this(activationData, encryptedData, ephemeralPublicKey, mutableMapOf()) + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun activationData(): Optional = activationData.getOptional("activationData") + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun encryptedData(): Optional = encryptedData.getOptional("encryptedData") + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun ephemeralPublicKey(): Optional = + ephemeralPublicKey.getOptional("ephemeralPublicKey") + + /** + * Returns the raw JSON value of [activationData]. + * + * Unlike [activationData], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("activationData") + @ExcludeMissing + fun _activationData(): JsonField = activationData + + /** + * Returns the raw JSON value of [encryptedData]. + * + * Unlike [encryptedData], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("encryptedData") + @ExcludeMissing + fun _encryptedData(): JsonField = encryptedData + + /** + * Returns the raw JSON value of [ephemeralPublicKey]. + * + * Unlike [ephemeralPublicKey], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("ephemeralPublicKey") + @ExcludeMissing + fun _ephemeralPublicKey(): JsonField = ephemeralPublicKey + + @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 [ProvisionResponse]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ProvisionResponse]. */ + class Builder internal constructor() { + + private var activationData: JsonField = JsonMissing.of() + private var encryptedData: JsonField = JsonMissing.of() + private var ephemeralPublicKey: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(provisionResponse: ProvisionResponse) = apply { + activationData = provisionResponse.activationData + encryptedData = provisionResponse.encryptedData + ephemeralPublicKey = provisionResponse.ephemeralPublicKey + additionalProperties = provisionResponse.additionalProperties.toMutableMap() + } + + fun activationData(activationData: String) = activationData(JsonField.of(activationData)) + + /** + * Sets [Builder.activationData] to an arbitrary JSON value. + * + * You should usually call [Builder.activationData] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun activationData(activationData: JsonField) = apply { + this.activationData = activationData + } + + fun encryptedData(encryptedData: String) = encryptedData(JsonField.of(encryptedData)) + + /** + * Sets [Builder.encryptedData] to an arbitrary JSON value. + * + * You should usually call [Builder.encryptedData] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun encryptedData(encryptedData: JsonField) = apply { + this.encryptedData = encryptedData + } + + fun ephemeralPublicKey(ephemeralPublicKey: String) = + ephemeralPublicKey(JsonField.of(ephemeralPublicKey)) + + /** + * Sets [Builder.ephemeralPublicKey] to an arbitrary JSON value. + * + * You should usually call [Builder.ephemeralPublicKey] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun ephemeralPublicKey(ephemeralPublicKey: JsonField) = apply { + this.ephemeralPublicKey = ephemeralPublicKey + } + + 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 [ProvisionResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ProvisionResponse = + ProvisionResponse( + activationData, + encryptedData, + ephemeralPublicKey, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): ProvisionResponse = apply { + if (validated) { + return@apply + } + + activationData() + encryptedData() + ephemeralPublicKey() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 (activationData.asKnown().isPresent) 1 else 0) + + (if (encryptedData.asKnown().isPresent) 1 else 0) + + (if (ephemeralPublicKey.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProvisionResponse && + activationData == other.activationData && + encryptedData == other.encryptedData && + ephemeralPublicKey == other.ephemeralPublicKey && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(activationData, encryptedData, ephemeralPublicKey, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ProvisionResponse{activationData=$activationData, encryptedData=$encryptedData, ephemeralPublicKey=$ephemeralPublicKey, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Tokenization.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Tokenization.kt index 419d989ca..0e8a840c1 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Tokenization.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Tokenization.kt @@ -1210,7 +1210,7 @@ private constructor( private constructor( private val token: JsonField, private val createdAt: JsonField, - private val result: JsonField, + private val result: JsonField, private val type: JsonField, private val additionalProperties: MutableMap, ) { @@ -1221,7 +1221,9 @@ private constructor( @JsonProperty("created_at") @ExcludeMissing createdAt: JsonField = JsonMissing.of(), - @JsonProperty("result") @ExcludeMissing result: JsonField = JsonMissing.of(), + @JsonProperty("result") + @ExcludeMissing + result: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), ) : this(token, createdAt, result, type, mutableMapOf()) @@ -1247,7 +1249,7 @@ private constructor( * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun result(): Optional = result.getOptional("result") + fun result(): Optional = result.getOptional("result") /** * Enum representing the type of tokenization event that occurred @@ -1278,7 +1280,9 @@ private constructor( * * Unlike [result], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("result") @ExcludeMissing fun _result(): JsonField = result + @JsonProperty("result") + @ExcludeMissing + fun _result(): JsonField = result /** * Returns the raw JSON value of [type]. @@ -1310,7 +1314,7 @@ private constructor( private var token: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var result: JsonField = JsonMissing.of() + private var result: JsonField = JsonMissing.of() private var type: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -1350,16 +1354,16 @@ private constructor( } /** Enum representing the result of the tokenization event */ - fun result(result: Result) = result(JsonField.of(result)) + fun result(result: TokenizationEventOutcome) = 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. + * You should usually call [Builder.result] with a well-typed [TokenizationEventOutcome] + * 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 result(result: JsonField) = apply { this.result = result } /** Enum representing the type of tokenization event that occurred */ fun type(type: Type) = type(JsonField.of(type)) @@ -1443,7 +1447,9 @@ private constructor( (type.asKnown().getOrNull()?.validity() ?: 0) /** Enum representing the result of the tokenization event */ - class Result @JsonCreator private constructor(private val value: JsonField) : Enum { + class TokenizationEventOutcome + @JsonCreator + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1472,6 +1478,9 @@ private constructor( @JvmField val TOKEN_DEACTIVATED = of("TOKEN_DEACTIVATED") + @JvmField + val TOKEN_DELETED_FROM_CONSUMER_APP = of("TOKEN_DELETED_FROM_CONSUMER_APP") + @JvmField val TOKEN_INACTIVE = of("TOKEN_INACTIVE") @JvmField val TOKEN_STATE_UNKNOWN = of("TOKEN_STATE_UNKNOWN") @@ -1480,10 +1489,10 @@ private constructor( @JvmField val TOKEN_UPDATED = of("TOKEN_UPDATED") - @JvmStatic fun of(value: String) = Result(JsonField.of(value)) + @JvmStatic fun of(value: String) = TokenizationEventOutcome(JsonField.of(value)) } - /** An enum containing [Result]'s known values. */ + /** An enum containing [TokenizationEventOutcome]'s known values. */ enum class Known { APPROVED, DECLINED, @@ -1492,6 +1501,7 @@ private constructor( TOKEN_ACTIVATED, TOKEN_CREATED, TOKEN_DEACTIVATED, + TOKEN_DELETED_FROM_CONSUMER_APP, TOKEN_INACTIVE, TOKEN_STATE_UNKNOWN, TOKEN_SUSPENDED, @@ -1499,9 +1509,11 @@ private constructor( } /** - * An enum containing [Result]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [TokenizationEventOutcome]'s known values, as well as an + * [_UNKNOWN] member. * - * An instance of [Result] can contain an unknown value in a couple of cases: + * An instance of [TokenizationEventOutcome] can contain an unknown value in a couple of + * cases: * - It was deserialized from data that doesn't match any known member. For example, if * the SDK is on an older version than the API, then the API may respond with new * members that the SDK is unaware of. @@ -1515,12 +1527,14 @@ private constructor( TOKEN_ACTIVATED, TOKEN_CREATED, TOKEN_DEACTIVATED, + TOKEN_DELETED_FROM_CONSUMER_APP, TOKEN_INACTIVE, TOKEN_STATE_UNKNOWN, TOKEN_SUSPENDED, TOKEN_UPDATED, /** - * An enum member indicating that [Result] was instantiated with an unknown value. + * An enum member indicating that [TokenizationEventOutcome] was instantiated with + * an unknown value. */ _UNKNOWN, } @@ -1541,6 +1555,7 @@ private constructor( TOKEN_ACTIVATED -> Value.TOKEN_ACTIVATED TOKEN_CREATED -> Value.TOKEN_CREATED TOKEN_DEACTIVATED -> Value.TOKEN_DEACTIVATED + TOKEN_DELETED_FROM_CONSUMER_APP -> Value.TOKEN_DELETED_FROM_CONSUMER_APP TOKEN_INACTIVE -> Value.TOKEN_INACTIVE TOKEN_STATE_UNKNOWN -> Value.TOKEN_STATE_UNKNOWN TOKEN_SUSPENDED -> Value.TOKEN_SUSPENDED @@ -1566,11 +1581,13 @@ private constructor( TOKEN_ACTIVATED -> Known.TOKEN_ACTIVATED TOKEN_CREATED -> Known.TOKEN_CREATED TOKEN_DEACTIVATED -> Known.TOKEN_DEACTIVATED + TOKEN_DELETED_FROM_CONSUMER_APP -> Known.TOKEN_DELETED_FROM_CONSUMER_APP TOKEN_INACTIVE -> Known.TOKEN_INACTIVE TOKEN_STATE_UNKNOWN -> Known.TOKEN_STATE_UNKNOWN TOKEN_SUSPENDED -> Known.TOKEN_SUSPENDED TOKEN_UPDATED -> Known.TOKEN_UPDATED - else -> throw LithicInvalidDataException("Unknown Result: $value") + else -> + throw LithicInvalidDataException("Unknown TokenizationEventOutcome: $value") } /** @@ -1589,7 +1606,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Result = apply { + fun validate(): TokenizationEventOutcome = apply { if (validated) { return@apply } @@ -1619,7 +1636,7 @@ private constructor( return true } - return other is Result && value == other.value + return other is TokenizationEventOutcome && value == other.value } override fun hashCode() = value.hashCode() diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Transaction.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Transaction.kt index b02ff7c36..c6eab6b1f 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Transaction.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Transaction.kt @@ -9603,6 +9603,10 @@ private constructor( @JvmField val VEHICLE_NUMBER_INVALID = of("VEHICLE_NUMBER_INVALID") + @JvmField val CARDHOLDER_CHALLENGED = of("CARDHOLDER_CHALLENGED") + + @JvmField val CARDHOLDER_CHALLENGE_FAILED = of("CARDHOLDER_CHALLENGE_FAILED") + @JvmStatic fun of(value: String) = DetailedResult(JsonField.of(value)) } @@ -9662,6 +9666,8 @@ private constructor( TRANSACTION_PREVIOUSLY_COMPLETED, UNAUTHORIZED_MERCHANT, VEHICLE_NUMBER_INVALID, + CARDHOLDER_CHALLENGED, + CARDHOLDER_CHALLENGE_FAILED, } /** @@ -9728,6 +9734,8 @@ private constructor( TRANSACTION_PREVIOUSLY_COMPLETED, UNAUTHORIZED_MERCHANT, VEHICLE_NUMBER_INVALID, + CARDHOLDER_CHALLENGED, + CARDHOLDER_CHALLENGE_FAILED, /** * An enum member indicating that [DetailedResult] was instantiated with an unknown * value. @@ -9803,6 +9811,8 @@ private constructor( TRANSACTION_PREVIOUSLY_COMPLETED -> Value.TRANSACTION_PREVIOUSLY_COMPLETED UNAUTHORIZED_MERCHANT -> Value.UNAUTHORIZED_MERCHANT VEHICLE_NUMBER_INVALID -> Value.VEHICLE_NUMBER_INVALID + CARDHOLDER_CHALLENGED -> Value.CARDHOLDER_CHALLENGED + CARDHOLDER_CHALLENGE_FAILED -> Value.CARDHOLDER_CHALLENGE_FAILED else -> Value._UNKNOWN } @@ -9876,6 +9886,8 @@ private constructor( TRANSACTION_PREVIOUSLY_COMPLETED -> Known.TRANSACTION_PREVIOUSLY_COMPLETED UNAUTHORIZED_MERCHANT -> Known.UNAUTHORIZED_MERCHANT VEHICLE_NUMBER_INVALID -> Known.VEHICLE_NUMBER_INVALID + CARDHOLDER_CHALLENGED -> Known.CARDHOLDER_CHALLENGED + CARDHOLDER_CHALLENGE_FAILED -> Known.CARDHOLDER_CHALLENGE_FAILED else -> throw LithicInvalidDataException("Unknown DetailedResult: $value") } @@ -12218,6 +12230,10 @@ private constructor( @JvmField val VEHICLE_NUMBER_INVALID = of("VEHICLE_NUMBER_INVALID") + @JvmField val CARDHOLDER_CHALLENGED = of("CARDHOLDER_CHALLENGED") + + @JvmField val CARDHOLDER_CHALLENGE_FAILED = of("CARDHOLDER_CHALLENGE_FAILED") + @JvmStatic fun of(value: String) = DetailedResult(JsonField.of(value)) } @@ -12277,6 +12293,8 @@ private constructor( TRANSACTION_PREVIOUSLY_COMPLETED, UNAUTHORIZED_MERCHANT, VEHICLE_NUMBER_INVALID, + CARDHOLDER_CHALLENGED, + CARDHOLDER_CHALLENGE_FAILED, } /** @@ -12345,6 +12363,8 @@ private constructor( TRANSACTION_PREVIOUSLY_COMPLETED, UNAUTHORIZED_MERCHANT, VEHICLE_NUMBER_INVALID, + CARDHOLDER_CHALLENGED, + CARDHOLDER_CHALLENGE_FAILED, /** * An enum member indicating that [DetailedResult] was instantiated with an * unknown value. @@ -12423,6 +12443,8 @@ private constructor( TRANSACTION_PREVIOUSLY_COMPLETED -> Value.TRANSACTION_PREVIOUSLY_COMPLETED UNAUTHORIZED_MERCHANT -> Value.UNAUTHORIZED_MERCHANT VEHICLE_NUMBER_INVALID -> Value.VEHICLE_NUMBER_INVALID + CARDHOLDER_CHALLENGED -> Value.CARDHOLDER_CHALLENGED + CARDHOLDER_CHALLENGE_FAILED -> Value.CARDHOLDER_CHALLENGE_FAILED else -> Value._UNKNOWN } @@ -12499,6 +12521,8 @@ private constructor( TRANSACTION_PREVIOUSLY_COMPLETED -> Known.TRANSACTION_PREVIOUSLY_COMPLETED UNAUTHORIZED_MERCHANT -> Known.UNAUTHORIZED_MERCHANT VEHICLE_NUMBER_INVALID -> Known.VEHICLE_NUMBER_INVALID + CARDHOLDER_CHALLENGED -> Known.CARDHOLDER_CHALLENGED + CARDHOLDER_CHALLENGE_FAILED -> Known.CARDHOLDER_CHALLENGE_FAILED else -> throw LithicInvalidDataException("Unknown DetailedResult: $value") } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ApplyResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ApplyResponse.kt index 319a3451b..730b52874 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ApplyResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ApplyResponse.kt @@ -1710,6 +1710,9 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -1851,6 +1854,10 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's + * address data with the cardholder KYC data if it exists. Valid values + * are `MATCH`, `MATCH_ADDRESS_ONLY`, + * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ fun attribute(attribute: Attribute) = attribute(JsonField.of(attribute)) @@ -2024,6 +2031,9 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ class Attribute @JsonCreator @@ -2081,6 +2091,8 @@ private constructor( @JvmField val TRANSACTION_INITIATOR = of("TRANSACTION_INITIATOR") + @JvmField val ADDRESS_MATCH = of("ADDRESS_MATCH") + @JvmStatic fun of(value: String) = Attribute(JsonField.of(value)) } @@ -2104,6 +2116,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, } /** @@ -2136,6 +2149,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, /** * An enum member indicating that [Attribute] was instantiated with an * unknown value. @@ -2170,6 +2184,7 @@ private constructor( PIN_STATUS -> Value.PIN_STATUS WALLET_TYPE -> Value.WALLET_TYPE TRANSACTION_INITIATOR -> Value.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Value.ADDRESS_MATCH else -> Value._UNKNOWN } @@ -2202,6 +2217,7 @@ private constructor( PIN_STATUS -> Known.PIN_STATUS WALLET_TYPE -> Known.WALLET_TYPE TRANSACTION_INITIATOR -> Known.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Known.ADDRESS_MATCH else -> throw LithicInvalidDataException("Unknown Attribute: $value") } @@ -3707,6 +3723,9 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -3848,6 +3867,10 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's + * address data with the cardholder KYC data if it exists. Valid values + * are `MATCH`, `MATCH_ADDRESS_ONLY`, + * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ fun attribute(attribute: Attribute) = attribute(JsonField.of(attribute)) @@ -4021,6 +4044,9 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ class Attribute @JsonCreator @@ -4078,6 +4104,8 @@ private constructor( @JvmField val TRANSACTION_INITIATOR = of("TRANSACTION_INITIATOR") + @JvmField val ADDRESS_MATCH = of("ADDRESS_MATCH") + @JvmStatic fun of(value: String) = Attribute(JsonField.of(value)) } @@ -4101,6 +4129,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, } /** @@ -4133,6 +4162,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, /** * An enum member indicating that [Attribute] was instantiated with an * unknown value. @@ -4167,6 +4197,7 @@ private constructor( PIN_STATUS -> Value.PIN_STATUS WALLET_TYPE -> Value.WALLET_TYPE TRANSACTION_INITIATOR -> Value.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Value.ADDRESS_MATCH else -> Value._UNKNOWN } @@ -4199,6 +4230,7 @@ private constructor( PIN_STATUS -> Known.PIN_STATUS WALLET_TYPE -> Known.WALLET_TYPE TRANSACTION_INITIATOR -> Known.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Known.ADDRESS_MATCH else -> throw LithicInvalidDataException("Unknown Attribute: $value") } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2CreateResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2CreateResponse.kt index 471517066..328237213 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2CreateResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2CreateResponse.kt @@ -1711,6 +1711,9 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -1852,6 +1855,10 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's + * address data with the cardholder KYC data if it exists. Valid values + * are `MATCH`, `MATCH_ADDRESS_ONLY`, + * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ fun attribute(attribute: Attribute) = attribute(JsonField.of(attribute)) @@ -2025,6 +2032,9 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ class Attribute @JsonCreator @@ -2082,6 +2092,8 @@ private constructor( @JvmField val TRANSACTION_INITIATOR = of("TRANSACTION_INITIATOR") + @JvmField val ADDRESS_MATCH = of("ADDRESS_MATCH") + @JvmStatic fun of(value: String) = Attribute(JsonField.of(value)) } @@ -2105,6 +2117,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, } /** @@ -2137,6 +2150,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, /** * An enum member indicating that [Attribute] was instantiated with an * unknown value. @@ -2171,6 +2185,7 @@ private constructor( PIN_STATUS -> Value.PIN_STATUS WALLET_TYPE -> Value.WALLET_TYPE TRANSACTION_INITIATOR -> Value.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Value.ADDRESS_MATCH else -> Value._UNKNOWN } @@ -2203,6 +2218,7 @@ private constructor( PIN_STATUS -> Known.PIN_STATUS WALLET_TYPE -> Known.WALLET_TYPE TRANSACTION_INITIATOR -> Known.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Known.ADDRESS_MATCH else -> throw LithicInvalidDataException("Unknown Attribute: $value") } @@ -3708,6 +3724,9 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -3849,6 +3868,10 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's + * address data with the cardholder KYC data if it exists. Valid values + * are `MATCH`, `MATCH_ADDRESS_ONLY`, + * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ fun attribute(attribute: Attribute) = attribute(JsonField.of(attribute)) @@ -4022,6 +4045,9 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ class Attribute @JsonCreator @@ -4079,6 +4105,8 @@ private constructor( @JvmField val TRANSACTION_INITIATOR = of("TRANSACTION_INITIATOR") + @JvmField val ADDRESS_MATCH = of("ADDRESS_MATCH") + @JvmStatic fun of(value: String) = Attribute(JsonField.of(value)) } @@ -4102,6 +4130,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, } /** @@ -4134,6 +4163,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, /** * An enum member indicating that [Attribute] was instantiated with an * unknown value. @@ -4168,6 +4198,7 @@ private constructor( PIN_STATUS -> Value.PIN_STATUS WALLET_TYPE -> Value.WALLET_TYPE TRANSACTION_INITIATOR -> Value.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Value.ADDRESS_MATCH else -> Value._UNKNOWN } @@ -4200,6 +4231,7 @@ private constructor( PIN_STATUS -> Known.PIN_STATUS WALLET_TYPE -> Known.WALLET_TYPE TRANSACTION_INITIATOR -> Known.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Known.ADDRESS_MATCH else -> throw LithicInvalidDataException("Unknown Attribute: $value") } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2DraftResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2DraftResponse.kt index c4f079fea..33af66f42 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2DraftResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2DraftResponse.kt @@ -1710,6 +1710,9 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -1851,6 +1854,10 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's + * address data with the cardholder KYC data if it exists. Valid values + * are `MATCH`, `MATCH_ADDRESS_ONLY`, + * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ fun attribute(attribute: Attribute) = attribute(JsonField.of(attribute)) @@ -2024,6 +2031,9 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ class Attribute @JsonCreator @@ -2081,6 +2091,8 @@ private constructor( @JvmField val TRANSACTION_INITIATOR = of("TRANSACTION_INITIATOR") + @JvmField val ADDRESS_MATCH = of("ADDRESS_MATCH") + @JvmStatic fun of(value: String) = Attribute(JsonField.of(value)) } @@ -2104,6 +2116,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, } /** @@ -2136,6 +2149,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, /** * An enum member indicating that [Attribute] was instantiated with an * unknown value. @@ -2170,6 +2184,7 @@ private constructor( PIN_STATUS -> Value.PIN_STATUS WALLET_TYPE -> Value.WALLET_TYPE TRANSACTION_INITIATOR -> Value.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Value.ADDRESS_MATCH else -> Value._UNKNOWN } @@ -2202,6 +2217,7 @@ private constructor( PIN_STATUS -> Known.PIN_STATUS WALLET_TYPE -> Known.WALLET_TYPE TRANSACTION_INITIATOR -> Known.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Known.ADDRESS_MATCH else -> throw LithicInvalidDataException("Unknown Attribute: $value") } @@ -3707,6 +3723,9 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -3848,6 +3867,10 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's + * address data with the cardholder KYC data if it exists. Valid values + * are `MATCH`, `MATCH_ADDRESS_ONLY`, + * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ fun attribute(attribute: Attribute) = attribute(JsonField.of(attribute)) @@ -4021,6 +4044,9 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ class Attribute @JsonCreator @@ -4078,6 +4104,8 @@ private constructor( @JvmField val TRANSACTION_INITIATOR = of("TRANSACTION_INITIATOR") + @JvmField val ADDRESS_MATCH = of("ADDRESS_MATCH") + @JvmStatic fun of(value: String) = Attribute(JsonField.of(value)) } @@ -4101,6 +4129,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, } /** @@ -4133,6 +4162,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, /** * An enum member indicating that [Attribute] was instantiated with an * unknown value. @@ -4167,6 +4197,7 @@ private constructor( PIN_STATUS -> Value.PIN_STATUS WALLET_TYPE -> Value.WALLET_TYPE TRANSACTION_INITIATOR -> Value.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Value.ADDRESS_MATCH else -> Value._UNKNOWN } @@ -4199,6 +4230,7 @@ private constructor( PIN_STATUS -> Known.PIN_STATUS WALLET_TYPE -> Known.WALLET_TYPE TRANSACTION_INITIATOR -> Known.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Known.ADDRESS_MATCH else -> throw LithicInvalidDataException("Unknown Attribute: $value") } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ListResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ListResponse.kt index c19983004..714f142ac 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ListResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ListResponse.kt @@ -1710,6 +1710,9 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -1851,6 +1854,10 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's + * address data with the cardholder KYC data if it exists. Valid values + * are `MATCH`, `MATCH_ADDRESS_ONLY`, + * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ fun attribute(attribute: Attribute) = attribute(JsonField.of(attribute)) @@ -2024,6 +2031,9 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ class Attribute @JsonCreator @@ -2081,6 +2091,8 @@ private constructor( @JvmField val TRANSACTION_INITIATOR = of("TRANSACTION_INITIATOR") + @JvmField val ADDRESS_MATCH = of("ADDRESS_MATCH") + @JvmStatic fun of(value: String) = Attribute(JsonField.of(value)) } @@ -2104,6 +2116,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, } /** @@ -2136,6 +2149,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, /** * An enum member indicating that [Attribute] was instantiated with an * unknown value. @@ -2170,6 +2184,7 @@ private constructor( PIN_STATUS -> Value.PIN_STATUS WALLET_TYPE -> Value.WALLET_TYPE TRANSACTION_INITIATOR -> Value.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Value.ADDRESS_MATCH else -> Value._UNKNOWN } @@ -2202,6 +2217,7 @@ private constructor( PIN_STATUS -> Known.PIN_STATUS WALLET_TYPE -> Known.WALLET_TYPE TRANSACTION_INITIATOR -> Known.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Known.ADDRESS_MATCH else -> throw LithicInvalidDataException("Unknown Attribute: $value") } @@ -3707,6 +3723,9 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -3848,6 +3867,10 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's + * address data with the cardholder KYC data if it exists. Valid values + * are `MATCH`, `MATCH_ADDRESS_ONLY`, + * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ fun attribute(attribute: Attribute) = attribute(JsonField.of(attribute)) @@ -4021,6 +4044,9 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ class Attribute @JsonCreator @@ -4078,6 +4104,8 @@ private constructor( @JvmField val TRANSACTION_INITIATOR = of("TRANSACTION_INITIATOR") + @JvmField val ADDRESS_MATCH = of("ADDRESS_MATCH") + @JvmStatic fun of(value: String) = Attribute(JsonField.of(value)) } @@ -4101,6 +4129,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, } /** @@ -4133,6 +4162,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, /** * An enum member indicating that [Attribute] was instantiated with an * unknown value. @@ -4167,6 +4197,7 @@ private constructor( PIN_STATUS -> Value.PIN_STATUS WALLET_TYPE -> Value.WALLET_TYPE TRANSACTION_INITIATOR -> Value.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Value.ADDRESS_MATCH else -> Value._UNKNOWN } @@ -4199,6 +4230,7 @@ private constructor( PIN_STATUS -> Known.PIN_STATUS WALLET_TYPE -> Known.WALLET_TYPE TRANSACTION_INITIATOR -> Known.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Known.ADDRESS_MATCH else -> throw LithicInvalidDataException("Unknown Attribute: $value") } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2PromoteResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2PromoteResponse.kt index 53317c571..2463f121b 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2PromoteResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2PromoteResponse.kt @@ -1711,6 +1711,9 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -1852,6 +1855,10 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's + * address data with the cardholder KYC data if it exists. Valid values + * are `MATCH`, `MATCH_ADDRESS_ONLY`, + * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ fun attribute(attribute: Attribute) = attribute(JsonField.of(attribute)) @@ -2025,6 +2032,9 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ class Attribute @JsonCreator @@ -2082,6 +2092,8 @@ private constructor( @JvmField val TRANSACTION_INITIATOR = of("TRANSACTION_INITIATOR") + @JvmField val ADDRESS_MATCH = of("ADDRESS_MATCH") + @JvmStatic fun of(value: String) = Attribute(JsonField.of(value)) } @@ -2105,6 +2117,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, } /** @@ -2137,6 +2150,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, /** * An enum member indicating that [Attribute] was instantiated with an * unknown value. @@ -2171,6 +2185,7 @@ private constructor( PIN_STATUS -> Value.PIN_STATUS WALLET_TYPE -> Value.WALLET_TYPE TRANSACTION_INITIATOR -> Value.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Value.ADDRESS_MATCH else -> Value._UNKNOWN } @@ -2203,6 +2218,7 @@ private constructor( PIN_STATUS -> Known.PIN_STATUS WALLET_TYPE -> Known.WALLET_TYPE TRANSACTION_INITIATOR -> Known.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Known.ADDRESS_MATCH else -> throw LithicInvalidDataException("Unknown Attribute: $value") } @@ -3708,6 +3724,9 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -3849,6 +3868,10 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's + * address data with the cardholder KYC data if it exists. Valid values + * are `MATCH`, `MATCH_ADDRESS_ONLY`, + * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ fun attribute(attribute: Attribute) = attribute(JsonField.of(attribute)) @@ -4022,6 +4045,9 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ class Attribute @JsonCreator @@ -4079,6 +4105,8 @@ private constructor( @JvmField val TRANSACTION_INITIATOR = of("TRANSACTION_INITIATOR") + @JvmField val ADDRESS_MATCH = of("ADDRESS_MATCH") + @JvmStatic fun of(value: String) = Attribute(JsonField.of(value)) } @@ -4102,6 +4130,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, } /** @@ -4134,6 +4163,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, /** * An enum member indicating that [Attribute] was instantiated with an * unknown value. @@ -4168,6 +4198,7 @@ private constructor( PIN_STATUS -> Value.PIN_STATUS WALLET_TYPE -> Value.WALLET_TYPE TRANSACTION_INITIATOR -> Value.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Value.ADDRESS_MATCH else -> Value._UNKNOWN } @@ -4200,6 +4231,7 @@ private constructor( PIN_STATUS -> Known.PIN_STATUS WALLET_TYPE -> Known.WALLET_TYPE TRANSACTION_INITIATOR -> Known.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Known.ADDRESS_MATCH else -> throw LithicInvalidDataException("Unknown Attribute: $value") } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ReportResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ReportResponse.kt deleted file mode 100644 index 20600201b..000000000 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ReportResponse.kt +++ /dev/null @@ -1,158 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.lithic.api.models - -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import com.lithic.api.core.ExcludeMissing -import com.lithic.api.core.JsonField -import com.lithic.api.core.JsonMissing -import com.lithic.api.core.JsonValue -import com.lithic.api.errors.LithicInvalidDataException -import java.util.Collections -import java.util.Objects -import java.util.Optional - -class V2ReportResponse -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val reportToken: JsonField, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("report_token") - @ExcludeMissing - reportToken: JsonField = JsonMissing.of() - ) : this(reportToken, mutableMapOf()) - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun reportToken(): Optional = reportToken.getOptional("report_token") - - /** - * Returns the raw JSON value of [reportToken]. - * - * Unlike [reportToken], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("report_token") - @ExcludeMissing - fun _reportToken(): JsonField = reportToken - - @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 [V2ReportResponse]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [V2ReportResponse]. */ - class Builder internal constructor() { - - private var reportToken: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(v2ReportResponse: V2ReportResponse) = apply { - reportToken = v2ReportResponse.reportToken - additionalProperties = v2ReportResponse.additionalProperties.toMutableMap() - } - - fun reportToken(reportToken: String) = reportToken(JsonField.of(reportToken)) - - /** - * Sets [Builder.reportToken] to an arbitrary JSON value. - * - * You should usually call [Builder.reportToken] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun reportToken(reportToken: JsonField) = apply { this.reportToken = reportToken } - - 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 [V2ReportResponse]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): V2ReportResponse = - V2ReportResponse(reportToken, additionalProperties.toMutableMap()) - } - - private var validated: Boolean = false - - fun validate(): V2ReportResponse = apply { - if (validated) { - return@apply - } - - reportToken() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - 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 (reportToken.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is V2ReportResponse && - reportToken == other.reportToken && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(reportToken, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "V2ReportResponse{reportToken=$reportToken, additionalProperties=$additionalProperties}" -} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveResponse.kt index a5a95d447..a373ac299 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveResponse.kt @@ -1711,6 +1711,9 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -1852,6 +1855,10 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's + * address data with the cardholder KYC data if it exists. Valid values + * are `MATCH`, `MATCH_ADDRESS_ONLY`, + * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ fun attribute(attribute: Attribute) = attribute(JsonField.of(attribute)) @@ -2025,6 +2032,9 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ class Attribute @JsonCreator @@ -2082,6 +2092,8 @@ private constructor( @JvmField val TRANSACTION_INITIATOR = of("TRANSACTION_INITIATOR") + @JvmField val ADDRESS_MATCH = of("ADDRESS_MATCH") + @JvmStatic fun of(value: String) = Attribute(JsonField.of(value)) } @@ -2105,6 +2117,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, } /** @@ -2137,6 +2150,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, /** * An enum member indicating that [Attribute] was instantiated with an * unknown value. @@ -2171,6 +2185,7 @@ private constructor( PIN_STATUS -> Value.PIN_STATUS WALLET_TYPE -> Value.WALLET_TYPE TRANSACTION_INITIATOR -> Value.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Value.ADDRESS_MATCH else -> Value._UNKNOWN } @@ -2203,6 +2218,7 @@ private constructor( PIN_STATUS -> Known.PIN_STATUS WALLET_TYPE -> Known.WALLET_TYPE TRANSACTION_INITIATOR -> Known.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Known.ADDRESS_MATCH else -> throw LithicInvalidDataException("Unknown Attribute: $value") } @@ -3708,6 +3724,9 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -3849,6 +3868,10 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's + * address data with the cardholder KYC data if it exists. Valid values + * are `MATCH`, `MATCH_ADDRESS_ONLY`, + * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ fun attribute(attribute: Attribute) = attribute(JsonField.of(attribute)) @@ -4022,6 +4045,9 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ class Attribute @JsonCreator @@ -4079,6 +4105,8 @@ private constructor( @JvmField val TRANSACTION_INITIATOR = of("TRANSACTION_INITIATOR") + @JvmField val ADDRESS_MATCH = of("ADDRESS_MATCH") + @JvmStatic fun of(value: String) = Attribute(JsonField.of(value)) } @@ -4102,6 +4130,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, } /** @@ -4134,6 +4163,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, /** * An enum member indicating that [Attribute] was instantiated with an * unknown value. @@ -4168,6 +4198,7 @@ private constructor( PIN_STATUS -> Value.PIN_STATUS WALLET_TYPE -> Value.WALLET_TYPE TRANSACTION_INITIATOR -> Value.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Value.ADDRESS_MATCH else -> Value._UNKNOWN } @@ -4200,6 +4231,7 @@ private constructor( PIN_STATUS -> Known.PIN_STATUS WALLET_TYPE -> Known.WALLET_TYPE TRANSACTION_INITIATOR -> Known.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Known.ADDRESS_MATCH else -> throw LithicInvalidDataException("Unknown Attribute: $value") } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2UpdateResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2UpdateResponse.kt index 689e7ef03..1bca16546 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2UpdateResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2UpdateResponse.kt @@ -1711,6 +1711,9 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -1852,6 +1855,10 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's + * address data with the cardholder KYC data if it exists. Valid values + * are `MATCH`, `MATCH_ADDRESS_ONLY`, + * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ fun attribute(attribute: Attribute) = attribute(JsonField.of(attribute)) @@ -2025,6 +2032,9 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ class Attribute @JsonCreator @@ -2082,6 +2092,8 @@ private constructor( @JvmField val TRANSACTION_INITIATOR = of("TRANSACTION_INITIATOR") + @JvmField val ADDRESS_MATCH = of("ADDRESS_MATCH") + @JvmStatic fun of(value: String) = Attribute(JsonField.of(value)) } @@ -2105,6 +2117,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, } /** @@ -2137,6 +2150,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, /** * An enum member indicating that [Attribute] was instantiated with an * unknown value. @@ -2171,6 +2185,7 @@ private constructor( PIN_STATUS -> Value.PIN_STATUS WALLET_TYPE -> Value.WALLET_TYPE TRANSACTION_INITIATOR -> Value.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Value.ADDRESS_MATCH else -> Value._UNKNOWN } @@ -2203,6 +2218,7 @@ private constructor( PIN_STATUS -> Known.PIN_STATUS WALLET_TYPE -> Known.WALLET_TYPE TRANSACTION_INITIATOR -> Known.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Known.ADDRESS_MATCH else -> throw LithicInvalidDataException("Unknown Attribute: $value") } @@ -3708,6 +3724,9 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -3849,6 +3868,10 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's + * address data with the cardholder KYC data if it exists. Valid values + * are `MATCH`, `MATCH_ADDRESS_ONLY`, + * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ fun attribute(attribute: Attribute) = attribute(JsonField.of(attribute)) @@ -4022,6 +4045,9 @@ private constructor( * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction * indicates the source of the token. Valid values are `CARDHOLDER`, * `MERCHANT`, `UNKNOWN`. + * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address + * data with the cardholder KYC data if it exists. Valid values are `MATCH`, + * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. */ class Attribute @JsonCreator @@ -4079,6 +4105,8 @@ private constructor( @JvmField val TRANSACTION_INITIATOR = of("TRANSACTION_INITIATOR") + @JvmField val ADDRESS_MATCH = of("ADDRESS_MATCH") + @JvmStatic fun of(value: String) = Attribute(JsonField.of(value)) } @@ -4102,6 +4130,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, } /** @@ -4134,6 +4163,7 @@ private constructor( PIN_STATUS, WALLET_TYPE, TRANSACTION_INITIATOR, + ADDRESS_MATCH, /** * An enum member indicating that [Attribute] was instantiated with an * unknown value. @@ -4168,6 +4198,7 @@ private constructor( PIN_STATUS -> Value.PIN_STATUS WALLET_TYPE -> Value.WALLET_TYPE TRANSACTION_INITIATOR -> Value.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Value.ADDRESS_MATCH else -> Value._UNKNOWN } @@ -4200,6 +4231,7 @@ private constructor( PIN_STATUS -> Known.PIN_STATUS WALLET_TYPE -> Known.WALLET_TYPE TRANSACTION_INITIATOR -> Known.TRANSACTION_INITIATOR + ADDRESS_MATCH -> Known.ADDRESS_MATCH else -> throw LithicInvalidDataException("Unknown Attribute: $value") } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/VerificationMethod.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/VerificationMethod.kt index 0b22ace64..c284b1450 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/VerificationMethod.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/VerificationMethod.kt @@ -25,8 +25,6 @@ class VerificationMethod @JsonCreator private constructor(private val value: Jso @JvmField val MICRO_DEPOSIT = of("MICRO_DEPOSIT") - @JvmField val PLAID = of("PLAID") - @JvmField val PRENOTE = of("PRENOTE") @JvmField val EXTERNALLY_VERIFIED = of("EXTERNALLY_VERIFIED") @@ -40,7 +38,6 @@ class VerificationMethod @JsonCreator private constructor(private val value: Jso enum class Known { MANUAL, MICRO_DEPOSIT, - PLAID, PRENOTE, EXTERNALLY_VERIFIED, UNVERIFIED, @@ -58,7 +55,6 @@ class VerificationMethod @JsonCreator private constructor(private val value: Jso enum class Value { MANUAL, MICRO_DEPOSIT, - PLAID, PRENOTE, EXTERNALLY_VERIFIED, UNVERIFIED, @@ -80,7 +76,6 @@ class VerificationMethod @JsonCreator private constructor(private val value: Jso when (this) { MANUAL -> Value.MANUAL MICRO_DEPOSIT -> Value.MICRO_DEPOSIT - PLAID -> Value.PLAID PRENOTE -> Value.PRENOTE EXTERNALLY_VERIFIED -> Value.EXTERNALLY_VERIFIED UNVERIFIED -> Value.UNVERIFIED @@ -99,7 +94,6 @@ class VerificationMethod @JsonCreator private constructor(private val value: Jso when (this) { MANUAL -> Known.MANUAL MICRO_DEPOSIT -> Known.MICRO_DEPOSIT - PLAID -> Known.PLAID PRENOTE -> Known.PRENOTE EXTERNALLY_VERIFIED -> Known.EXTERNALLY_VERIFIED UNVERIFIED -> Known.UNVERIFIED diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/authRules/V2ServiceAsync.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/authRules/V2ServiceAsync.kt index fd4635809..000e1f869 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/authRules/V2ServiceAsync.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/authRules/V2ServiceAsync.kt @@ -13,7 +13,6 @@ import com.lithic.api.models.AuthRuleV2DraftParams import com.lithic.api.models.AuthRuleV2ListPageAsync import com.lithic.api.models.AuthRuleV2ListParams import com.lithic.api.models.AuthRuleV2PromoteParams -import com.lithic.api.models.AuthRuleV2ReportParams import com.lithic.api.models.AuthRuleV2RetrieveFeaturesParams import com.lithic.api.models.AuthRuleV2RetrieveParams import com.lithic.api.models.AuthRuleV2RetrieveReportParams @@ -22,7 +21,6 @@ import com.lithic.api.models.V2ApplyResponse import com.lithic.api.models.V2CreateResponse import com.lithic.api.models.V2DraftResponse import com.lithic.api.models.V2PromoteResponse -import com.lithic.api.models.V2ReportResponse import com.lithic.api.models.V2RetrieveFeaturesResponse import com.lithic.api.models.V2RetrieveReportResponse import com.lithic.api.models.V2RetrieveResponse @@ -282,92 +280,6 @@ interface V2ServiceAsync { ): CompletableFuture = promote(authRuleToken, AuthRuleV2PromoteParams.none(), requestOptions) - /** - * This endpoint is deprecated and will be removed in the future. Requests a performance report - * of an Auth rule to be asynchronously generated. Reports can only be run on rules in draft or - * active mode and will included approved and declined statistics as well as examples. The - * generated report will be delivered asynchronously through a webhook with `event_type` = - * `auth_rules.performance_report.created`. See the docs on setting up - * [webhook subscriptions](https://docs.lithic.com/docs/events-api). - * - * Reports are generated based on data collected by Lithic's processing system in the trailing - * week. The performance of the auth rule will be assessed on the configuration of the auth rule - * at the time the report is requested. This implies that if a performance report is requested, - * right after updating an auth rule, depending on the number of events processed for a card - * program, it may be the case that no data is available for the report. Therefore Lithic - * recommends to decouple making updates to an Auth Rule, and requesting performance reports. - * - * To make this concrete, consider the following example: - * 1. At time `t`, a new Auth Rule is created, and applies to all auth events on a card program. - * The Auth Rule has not yet been promoted, causing the draft version of the rule to be - * applied in shadow mode. - * 2. At time `t + 1 hour` a performance report is requested for the Auth Rule. This performance - * report will *only* contain data for the Auth Rule being executed in the window between `t` - * and `t + 1 hour`. This is because Lithic's transaction processing system will only start - * capturing data for the Auth Rule at the time it is created. - * 3. At time `t + 2 hours` the draft version of the Auth Rule is promoted to the active version - * of the Auth Rule by calling the `/v2/auth_rules/{auth_rule_token}/promote` endpoint. If a - * performance report is requested at this moment it will still only contain data for this - * version of the rule, but the window of available data will now span from `t` to `t + 2 - * hours`. - * 4. At time `t + 3 hours` a new version of the rule is drafted by calling the - * `/v2/auth_rules/{auth_rule_token}/draft` endpoint. If a performance report is requested - * right at this moment, it will only contain data for events to which both the active - * version and the draft version is applied. Lithic does this to ensure that performance - * reports represent a fair comparison between rules. Because there may be no events in this - * window, and because there may be some lag before data is available in a performance - * report, the requested performance report could contain no to little data. - * 5. At time `t + 4 hours` another performance report is requested: this time the performance - * report will contain data from the window between `t + 3 hours` and `t + 4 hours`, for any - * events to which both the current version of the Auth rule (in enforcing mode) and the - * draft version of the Auth rule (in shadow mode) applied. - * - * Note that generating a report may take up to 15 minutes and that delivery is not guaranteed. - * Customers are required to have created an event subscription to receive the webhook. - * Additionally, there is a delay of approximately 15 minutes between when Lithic's transaction - * processing systems have processed the transaction, and when a transaction will be included in - * the report. - */ - @Deprecated("deprecated") - fun report(authRuleToken: String): CompletableFuture = - report(authRuleToken, AuthRuleV2ReportParams.none()) - - /** @see report */ - @Deprecated("deprecated") - fun report( - authRuleToken: String, - params: AuthRuleV2ReportParams = AuthRuleV2ReportParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - report(params.toBuilder().authRuleToken(authRuleToken).build(), requestOptions) - - /** @see report */ - @Deprecated("deprecated") - fun report( - authRuleToken: String, - params: AuthRuleV2ReportParams = AuthRuleV2ReportParams.none(), - ): CompletableFuture = report(authRuleToken, params, RequestOptions.none()) - - /** @see report */ - @Deprecated("deprecated") - fun report( - params: AuthRuleV2ReportParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see report */ - @Deprecated("deprecated") - fun report(params: AuthRuleV2ReportParams): CompletableFuture = - report(params, RequestOptions.none()) - - /** @see report */ - @Deprecated("deprecated") - fun report( - authRuleToken: String, - requestOptions: RequestOptions, - ): CompletableFuture = - report(authRuleToken, AuthRuleV2ReportParams.none(), requestOptions) - /** * Fetches the current calculated Feature values for the given Auth Rule * @@ -731,53 +643,6 @@ interface V2ServiceAsync { ): CompletableFuture> = promote(authRuleToken, AuthRuleV2PromoteParams.none(), requestOptions) - /** - * Returns a raw HTTP response for `post /v2/auth_rules/{auth_rule_token}/report`, but is - * otherwise the same as [V2ServiceAsync.report]. - */ - @Deprecated("deprecated") - fun report(authRuleToken: String): CompletableFuture> = - report(authRuleToken, AuthRuleV2ReportParams.none()) - - /** @see report */ - @Deprecated("deprecated") - fun report( - authRuleToken: String, - params: AuthRuleV2ReportParams = AuthRuleV2ReportParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = - report(params.toBuilder().authRuleToken(authRuleToken).build(), requestOptions) - - /** @see report */ - @Deprecated("deprecated") - fun report( - authRuleToken: String, - params: AuthRuleV2ReportParams = AuthRuleV2ReportParams.none(), - ): CompletableFuture> = - report(authRuleToken, params, RequestOptions.none()) - - /** @see report */ - @Deprecated("deprecated") - fun report( - params: AuthRuleV2ReportParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see report */ - @Deprecated("deprecated") - fun report( - params: AuthRuleV2ReportParams - ): CompletableFuture> = - report(params, RequestOptions.none()) - - /** @see report */ - @Deprecated("deprecated") - fun report( - authRuleToken: String, - requestOptions: RequestOptions, - ): CompletableFuture> = - report(authRuleToken, AuthRuleV2ReportParams.none(), requestOptions) - /** * Returns a raw HTTP response for `get /v2/auth_rules/{auth_rule_token}/features`, but is * otherwise the same as [V2ServiceAsync.retrieveFeatures]. diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/authRules/V2ServiceAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/authRules/V2ServiceAsyncImpl.kt index 177ec0090..1204cef84 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/authRules/V2ServiceAsyncImpl.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/authRules/V2ServiceAsyncImpl.kt @@ -25,7 +25,6 @@ import com.lithic.api.models.AuthRuleV2ListPageAsync import com.lithic.api.models.AuthRuleV2ListPageResponse import com.lithic.api.models.AuthRuleV2ListParams import com.lithic.api.models.AuthRuleV2PromoteParams -import com.lithic.api.models.AuthRuleV2ReportParams import com.lithic.api.models.AuthRuleV2RetrieveFeaturesParams import com.lithic.api.models.AuthRuleV2RetrieveParams import com.lithic.api.models.AuthRuleV2RetrieveReportParams @@ -34,7 +33,6 @@ import com.lithic.api.models.V2ApplyResponse import com.lithic.api.models.V2CreateResponse import com.lithic.api.models.V2DraftResponse import com.lithic.api.models.V2PromoteResponse -import com.lithic.api.models.V2ReportResponse import com.lithic.api.models.V2RetrieveFeaturesResponse import com.lithic.api.models.V2RetrieveReportResponse import com.lithic.api.models.V2RetrieveResponse @@ -118,14 +116,6 @@ class V2ServiceAsyncImpl internal constructor(private val clientOptions: ClientO // post /v2/auth_rules/{auth_rule_token}/promote withRawResponse().promote(params, requestOptions).thenApply { it.parse() } - @Deprecated("deprecated") - override fun report( - params: AuthRuleV2ReportParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // post /v2/auth_rules/{auth_rule_token}/report - withRawResponse().report(params, requestOptions).thenApply { it.parse() } - override fun retrieveFeatures( params: AuthRuleV2RetrieveFeaturesParams, requestOptions: RequestOptions, @@ -425,41 +415,6 @@ class V2ServiceAsyncImpl internal constructor(private val clientOptions: ClientO } } - private val reportHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - @Deprecated("deprecated") - override fun report( - params: AuthRuleV2ReportParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("authRuleToken", params.authRuleToken().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("v2", "auth_rules", params._pathParam(0), "report") - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { reportHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } - private val retrieveFeaturesHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/authRules/V2Service.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/authRules/V2Service.kt index 67719951e..f1cd90503 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/authRules/V2Service.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/authRules/V2Service.kt @@ -14,7 +14,6 @@ import com.lithic.api.models.AuthRuleV2DraftParams import com.lithic.api.models.AuthRuleV2ListPage import com.lithic.api.models.AuthRuleV2ListParams import com.lithic.api.models.AuthRuleV2PromoteParams -import com.lithic.api.models.AuthRuleV2ReportParams import com.lithic.api.models.AuthRuleV2RetrieveFeaturesParams import com.lithic.api.models.AuthRuleV2RetrieveParams import com.lithic.api.models.AuthRuleV2RetrieveReportParams @@ -23,7 +22,6 @@ import com.lithic.api.models.V2ApplyResponse import com.lithic.api.models.V2CreateResponse import com.lithic.api.models.V2DraftResponse import com.lithic.api.models.V2PromoteResponse -import com.lithic.api.models.V2ReportResponse import com.lithic.api.models.V2RetrieveFeaturesResponse import com.lithic.api.models.V2RetrieveReportResponse import com.lithic.api.models.V2RetrieveResponse @@ -262,89 +260,6 @@ interface V2Service { fun promote(authRuleToken: String, requestOptions: RequestOptions): V2PromoteResponse = promote(authRuleToken, AuthRuleV2PromoteParams.none(), requestOptions) - /** - * This endpoint is deprecated and will be removed in the future. Requests a performance report - * of an Auth rule to be asynchronously generated. Reports can only be run on rules in draft or - * active mode and will included approved and declined statistics as well as examples. The - * generated report will be delivered asynchronously through a webhook with `event_type` = - * `auth_rules.performance_report.created`. See the docs on setting up - * [webhook subscriptions](https://docs.lithic.com/docs/events-api). - * - * Reports are generated based on data collected by Lithic's processing system in the trailing - * week. The performance of the auth rule will be assessed on the configuration of the auth rule - * at the time the report is requested. This implies that if a performance report is requested, - * right after updating an auth rule, depending on the number of events processed for a card - * program, it may be the case that no data is available for the report. Therefore Lithic - * recommends to decouple making updates to an Auth Rule, and requesting performance reports. - * - * To make this concrete, consider the following example: - * 1. At time `t`, a new Auth Rule is created, and applies to all auth events on a card program. - * The Auth Rule has not yet been promoted, causing the draft version of the rule to be - * applied in shadow mode. - * 2. At time `t + 1 hour` a performance report is requested for the Auth Rule. This performance - * report will *only* contain data for the Auth Rule being executed in the window between `t` - * and `t + 1 hour`. This is because Lithic's transaction processing system will only start - * capturing data for the Auth Rule at the time it is created. - * 3. At time `t + 2 hours` the draft version of the Auth Rule is promoted to the active version - * of the Auth Rule by calling the `/v2/auth_rules/{auth_rule_token}/promote` endpoint. If a - * performance report is requested at this moment it will still only contain data for this - * version of the rule, but the window of available data will now span from `t` to `t + 2 - * hours`. - * 4. At time `t + 3 hours` a new version of the rule is drafted by calling the - * `/v2/auth_rules/{auth_rule_token}/draft` endpoint. If a performance report is requested - * right at this moment, it will only contain data for events to which both the active - * version and the draft version is applied. Lithic does this to ensure that performance - * reports represent a fair comparison between rules. Because there may be no events in this - * window, and because there may be some lag before data is available in a performance - * report, the requested performance report could contain no to little data. - * 5. At time `t + 4 hours` another performance report is requested: this time the performance - * report will contain data from the window between `t + 3 hours` and `t + 4 hours`, for any - * events to which both the current version of the Auth rule (in enforcing mode) and the - * draft version of the Auth rule (in shadow mode) applied. - * - * Note that generating a report may take up to 15 minutes and that delivery is not guaranteed. - * Customers are required to have created an event subscription to receive the webhook. - * Additionally, there is a delay of approximately 15 minutes between when Lithic's transaction - * processing systems have processed the transaction, and when a transaction will be included in - * the report. - */ - @Deprecated("deprecated") - fun report(authRuleToken: String): V2ReportResponse = - report(authRuleToken, AuthRuleV2ReportParams.none()) - - /** @see report */ - @Deprecated("deprecated") - fun report( - authRuleToken: String, - params: AuthRuleV2ReportParams = AuthRuleV2ReportParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): V2ReportResponse = - report(params.toBuilder().authRuleToken(authRuleToken).build(), requestOptions) - - /** @see report */ - @Deprecated("deprecated") - fun report( - authRuleToken: String, - params: AuthRuleV2ReportParams = AuthRuleV2ReportParams.none(), - ): V2ReportResponse = report(authRuleToken, params, RequestOptions.none()) - - /** @see report */ - @Deprecated("deprecated") - fun report( - params: AuthRuleV2ReportParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): V2ReportResponse - - /** @see report */ - @Deprecated("deprecated") - fun report(params: AuthRuleV2ReportParams): V2ReportResponse = - report(params, RequestOptions.none()) - - /** @see report */ - @Deprecated("deprecated") - fun report(authRuleToken: String, requestOptions: RequestOptions): V2ReportResponse = - report(authRuleToken, AuthRuleV2ReportParams.none(), requestOptions) - /** * Fetches the current calculated Feature values for the given Auth Rule * @@ -717,56 +632,6 @@ interface V2Service { ): HttpResponseFor = promote(authRuleToken, AuthRuleV2PromoteParams.none(), requestOptions) - /** - * Returns a raw HTTP response for `post /v2/auth_rules/{auth_rule_token}/report`, but is - * otherwise the same as [V2Service.report]. - */ - @Deprecated("deprecated") - @MustBeClosed - fun report(authRuleToken: String): HttpResponseFor = - report(authRuleToken, AuthRuleV2ReportParams.none()) - - /** @see report */ - @Deprecated("deprecated") - @MustBeClosed - fun report( - authRuleToken: String, - params: AuthRuleV2ReportParams = AuthRuleV2ReportParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = - report(params.toBuilder().authRuleToken(authRuleToken).build(), requestOptions) - - /** @see report */ - @Deprecated("deprecated") - @MustBeClosed - fun report( - authRuleToken: String, - params: AuthRuleV2ReportParams = AuthRuleV2ReportParams.none(), - ): HttpResponseFor = report(authRuleToken, params, RequestOptions.none()) - - /** @see report */ - @Deprecated("deprecated") - @MustBeClosed - fun report( - params: AuthRuleV2ReportParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see report */ - @Deprecated("deprecated") - @MustBeClosed - fun report(params: AuthRuleV2ReportParams): HttpResponseFor = - report(params, RequestOptions.none()) - - /** @see report */ - @Deprecated("deprecated") - @MustBeClosed - fun report( - authRuleToken: String, - requestOptions: RequestOptions, - ): HttpResponseFor = - report(authRuleToken, AuthRuleV2ReportParams.none(), requestOptions) - /** * Returns a raw HTTP response for `get /v2/auth_rules/{auth_rule_token}/features`, but is * otherwise the same as [V2Service.retrieveFeatures]. diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/authRules/V2ServiceImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/authRules/V2ServiceImpl.kt index 2d8faa681..3175bb2b4 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/authRules/V2ServiceImpl.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/authRules/V2ServiceImpl.kt @@ -25,7 +25,6 @@ import com.lithic.api.models.AuthRuleV2ListPage import com.lithic.api.models.AuthRuleV2ListPageResponse import com.lithic.api.models.AuthRuleV2ListParams import com.lithic.api.models.AuthRuleV2PromoteParams -import com.lithic.api.models.AuthRuleV2ReportParams import com.lithic.api.models.AuthRuleV2RetrieveFeaturesParams import com.lithic.api.models.AuthRuleV2RetrieveParams import com.lithic.api.models.AuthRuleV2RetrieveReportParams @@ -34,7 +33,6 @@ import com.lithic.api.models.V2ApplyResponse import com.lithic.api.models.V2CreateResponse import com.lithic.api.models.V2DraftResponse import com.lithic.api.models.V2PromoteResponse -import com.lithic.api.models.V2ReportResponse import com.lithic.api.models.V2RetrieveFeaturesResponse import com.lithic.api.models.V2RetrieveReportResponse import com.lithic.api.models.V2RetrieveResponse @@ -114,14 +112,6 @@ class V2ServiceImpl internal constructor(private val clientOptions: ClientOption // post /v2/auth_rules/{auth_rule_token}/promote withRawResponse().promote(params, requestOptions).parse() - @Deprecated("deprecated") - override fun report( - params: AuthRuleV2ReportParams, - requestOptions: RequestOptions, - ): V2ReportResponse = - // post /v2/auth_rules/{auth_rule_token}/report - withRawResponse().report(params, requestOptions).parse() - override fun retrieveFeatures( params: AuthRuleV2RetrieveFeaturesParams, requestOptions: RequestOptions, @@ -396,38 +386,6 @@ class V2ServiceImpl internal constructor(private val clientOptions: ClientOption } } - private val reportHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - @Deprecated("deprecated") - override fun report( - params: AuthRuleV2ReportParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("authRuleToken", params.authRuleToken().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("v2", "auth_rules", params._pathParam(0), "report") - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { reportHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - private val retrieveFeaturesHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityListPageResponseTest.kt index 66224beb1..ae69ba112 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityListPageResponseTest.kt @@ -42,10 +42,7 @@ internal class AccountActivityListPageResponseTest { ) .build() ) - .family( - AccountActivityListResponse.FinancialTransaction.TransactionFamilyTypes - .CARD - ) + .family(AccountActivityListResponse.FinancialTransaction.Family.INTERNAL) .financialAccountToken("0cc87075-57cf-4607-8722-f42e2cb2c0cd") .pendingAmount(500L) .result( @@ -65,7 +62,7 @@ internal class AccountActivityListPageResponseTest { assertThat(accountActivityListPageResponse.data().getOrNull()) .containsExactly( - AccountActivityListResponse.ofFinancialTransaction( + AccountActivityListResponse.ofInternal( AccountActivityListResponse.FinancialTransaction.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .category( @@ -92,10 +89,7 @@ internal class AccountActivityListPageResponseTest { ) .build() ) - .family( - AccountActivityListResponse.FinancialTransaction.TransactionFamilyTypes - .CARD - ) + .family(AccountActivityListResponse.FinancialTransaction.Family.INTERNAL) .financialAccountToken("0cc87075-57cf-4607-8722-f42e2cb2c0cd") .pendingAmount(500L) .result( @@ -146,10 +140,7 @@ internal class AccountActivityListPageResponseTest { ) .build() ) - .family( - AccountActivityListResponse.FinancialTransaction.TransactionFamilyTypes - .CARD - ) + .family(AccountActivityListResponse.FinancialTransaction.Family.INTERNAL) .financialAccountToken("0cc87075-57cf-4607-8722-f42e2cb2c0cd") .pendingAmount(500L) .result( diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityListResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityListResponseTest.kt index b0ee4b5c5..cd0f72465 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityListResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityListResponseTest.kt @@ -17,8 +17,8 @@ import org.junit.jupiter.params.provider.EnumSource internal class AccountActivityListResponseTest { @Test - fun ofFinancialTransaction() { - val financialTransaction = + fun ofInternal() { + val internal_ = AccountActivityListResponse.FinancialTransaction.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .category(AccountActivityListResponse.FinancialTransaction.TransactionCategory.ACH) @@ -41,9 +41,7 @@ internal class AccountActivityListResponseTest { ) .build() ) - .family( - AccountActivityListResponse.FinancialTransaction.TransactionFamilyTypes.CARD - ) + .family(AccountActivityListResponse.FinancialTransaction.Family.INTERNAL) .financialAccountToken("0cc87075-57cf-4607-8722-f42e2cb2c0cd") .pendingAmount(500L) .result(AccountActivityListResponse.FinancialTransaction.TransactionResult.APPROVED) @@ -52,23 +50,21 @@ internal class AccountActivityListResponseTest { .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() - val accountActivityListResponse = - AccountActivityListResponse.ofFinancialTransaction(financialTransaction) + val accountActivityListResponse = AccountActivityListResponse.ofInternal(internal_) - assertThat(accountActivityListResponse.financialTransaction()) - .contains(financialTransaction) - assertThat(accountActivityListResponse.bookTransferTransaction()).isEmpty - assertThat(accountActivityListResponse.cardTransaction()).isEmpty - assertThat(accountActivityListResponse.paymentTransaction()).isEmpty + assertThat(accountActivityListResponse.internal_()).contains(internal_) + assertThat(accountActivityListResponse.transfer()).isEmpty + assertThat(accountActivityListResponse.card()).isEmpty + assertThat(accountActivityListResponse.payment()).isEmpty assertThat(accountActivityListResponse.externalPayment()).isEmpty - assertThat(accountActivityListResponse.managementOperationTransaction()).isEmpty + assertThat(accountActivityListResponse.managementOperation()).isEmpty } @Test - fun ofFinancialTransactionRoundtrip() { + fun ofInternalRoundtrip() { val jsonMapper = jsonMapper() val accountActivityListResponse = - AccountActivityListResponse.ofFinancialTransaction( + AccountActivityListResponse.ofInternal( AccountActivityListResponse.FinancialTransaction.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .category( @@ -94,9 +90,7 @@ internal class AccountActivityListResponseTest { ) .build() ) - .family( - AccountActivityListResponse.FinancialTransaction.TransactionFamilyTypes.CARD - ) + .family(AccountActivityListResponse.FinancialTransaction.Family.INTERNAL) .financialAccountToken("0cc87075-57cf-4607-8722-f42e2cb2c0cd") .pendingAmount(500L) .result( @@ -120,52 +114,37 @@ internal class AccountActivityListResponseTest { } @Test - fun ofBookTransferTransaction() { - val bookTransferTransaction = - AccountActivityListResponse.BookTransferTransaction.builder() + fun ofTransfer() { + val transfer = + BookTransferResponse.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .category( - AccountActivityListResponse.BookTransferTransaction.BookTransferCategory - .ADJUSTMENT - ) + .category(BookTransferResponse.BookTransferCategory.ADJUSTMENT) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .currency("USD") .addEvent( - AccountActivityListResponse.BookTransferTransaction.BookTransferEvent.builder() + BookTransferResponse.BookTransferEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .detailedResults( - AccountActivityListResponse.BookTransferTransaction.BookTransferEvent - .BookTransferDetailedResults + BookTransferResponse.BookTransferEvent.BookTransferDetailedResults .APPROVED ) .memo("memo") - .result( - AccountActivityListResponse.BookTransferTransaction.BookTransferEvent - .Result - .APPROVED - ) + .result(BookTransferResponse.BookTransferEvent.Result.APPROVED) .subtype("subtype") .type( - AccountActivityListResponse.BookTransferTransaction.BookTransferEvent - .BookTransferType + BookTransferResponse.BookTransferEvent.BookTransferType .ATM_BALANCE_INQUIRY ) .build() ) - .family( - AccountActivityListResponse.BookTransferTransaction.TransactionFamilyTypes.CARD - ) + .family(BookTransferResponse.Family.TRANSFER) .fromFinancialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .pendingAmount(1000L) - .result( - AccountActivityListResponse.BookTransferTransaction.TransactionResult.APPROVED - ) + .result(BookTransferResponse.TransactionResult.APPROVED) .settledAmount(500L) - .status( - AccountActivityListResponse.BookTransferTransaction.TransactionStatus.PENDING - ) + .status(BookTransferResponse.TransactionStatus.PENDING) .toFinancialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .externalId("external_id") @@ -177,7 +156,7 @@ internal class AccountActivityListResponseTest { .build() ) .transactionSeries( - AccountActivityListResponse.BookTransferTransaction.TransactionSeries.builder() + BookTransferResponse.TransactionSeries.builder() .relatedTransactionEventToken("123e4567-e89b-12d3-a456-426614174000") .relatedTransactionToken("123e4567-e89b-12d3-a456-426614174000") .type("FEE") @@ -185,74 +164,50 @@ internal class AccountActivityListResponseTest { ) .build() - val accountActivityListResponse = - AccountActivityListResponse.ofBookTransferTransaction(bookTransferTransaction) + val accountActivityListResponse = AccountActivityListResponse.ofTransfer(transfer) - assertThat(accountActivityListResponse.financialTransaction()).isEmpty - assertThat(accountActivityListResponse.bookTransferTransaction()) - .contains(bookTransferTransaction) - assertThat(accountActivityListResponse.cardTransaction()).isEmpty - assertThat(accountActivityListResponse.paymentTransaction()).isEmpty + assertThat(accountActivityListResponse.internal_()).isEmpty + assertThat(accountActivityListResponse.transfer()).contains(transfer) + assertThat(accountActivityListResponse.card()).isEmpty + assertThat(accountActivityListResponse.payment()).isEmpty assertThat(accountActivityListResponse.externalPayment()).isEmpty - assertThat(accountActivityListResponse.managementOperationTransaction()).isEmpty + assertThat(accountActivityListResponse.managementOperation()).isEmpty } @Test - fun ofBookTransferTransactionRoundtrip() { + fun ofTransferRoundtrip() { val jsonMapper = jsonMapper() val accountActivityListResponse = - AccountActivityListResponse.ofBookTransferTransaction( - AccountActivityListResponse.BookTransferTransaction.builder() + AccountActivityListResponse.ofTransfer( + BookTransferResponse.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .category( - AccountActivityListResponse.BookTransferTransaction.BookTransferCategory - .ADJUSTMENT - ) + .category(BookTransferResponse.BookTransferCategory.ADJUSTMENT) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .currency("USD") .addEvent( - AccountActivityListResponse.BookTransferTransaction.BookTransferEvent - .builder() + BookTransferResponse.BookTransferEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .detailedResults( - AccountActivityListResponse.BookTransferTransaction - .BookTransferEvent - .BookTransferDetailedResults + BookTransferResponse.BookTransferEvent.BookTransferDetailedResults .APPROVED ) .memo("memo") - .result( - AccountActivityListResponse.BookTransferTransaction - .BookTransferEvent - .Result - .APPROVED - ) + .result(BookTransferResponse.BookTransferEvent.Result.APPROVED) .subtype("subtype") .type( - AccountActivityListResponse.BookTransferTransaction - .BookTransferEvent - .BookTransferType + BookTransferResponse.BookTransferEvent.BookTransferType .ATM_BALANCE_INQUIRY ) .build() ) - .family( - AccountActivityListResponse.BookTransferTransaction.TransactionFamilyTypes - .CARD - ) + .family(BookTransferResponse.Family.TRANSFER) .fromFinancialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .pendingAmount(1000L) - .result( - AccountActivityListResponse.BookTransferTransaction.TransactionResult - .APPROVED - ) + .result(BookTransferResponse.TransactionResult.APPROVED) .settledAmount(500L) - .status( - AccountActivityListResponse.BookTransferTransaction.TransactionStatus - .PENDING - ) + .status(BookTransferResponse.TransactionStatus.PENDING) .toFinancialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .externalId("external_id") @@ -264,8 +219,7 @@ internal class AccountActivityListResponseTest { .build() ) .transactionSeries( - AccountActivityListResponse.BookTransferTransaction.TransactionSeries - .builder() + BookTransferResponse.TransactionSeries.builder() .relatedTransactionEventToken("123e4567-e89b-12d3-a456-426614174000") .relatedTransactionToken("123e4567-e89b-12d3-a456-426614174000") .type("FEE") @@ -284,8 +238,8 @@ internal class AccountActivityListResponseTest { } @Test - fun ofCardTransaction() { - val cardTransaction = + fun ofCard() { + val card = AccountActivityListResponse.CardTransaction.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .accountToken("bd5e5649-1be8-4117-9bc5-3268258d1417") @@ -515,25 +469,24 @@ internal class AccountActivityListResponseTest { ) .build() ) - .family(AccountActivityListResponse.CardTransaction.TransactionFamilyTypes.CARD) + .family(AccountActivityListResponse.CardTransaction.Family.CARD) .build() - val accountActivityListResponse = - AccountActivityListResponse.ofCardTransaction(cardTransaction) + val accountActivityListResponse = AccountActivityListResponse.ofCard(card) - assertThat(accountActivityListResponse.financialTransaction()).isEmpty - assertThat(accountActivityListResponse.bookTransferTransaction()).isEmpty - assertThat(accountActivityListResponse.cardTransaction()).contains(cardTransaction) - assertThat(accountActivityListResponse.paymentTransaction()).isEmpty + assertThat(accountActivityListResponse.internal_()).isEmpty + assertThat(accountActivityListResponse.transfer()).isEmpty + assertThat(accountActivityListResponse.card()).contains(card) + assertThat(accountActivityListResponse.payment()).isEmpty assertThat(accountActivityListResponse.externalPayment()).isEmpty - assertThat(accountActivityListResponse.managementOperationTransaction()).isEmpty + assertThat(accountActivityListResponse.managementOperation()).isEmpty } @Test - fun ofCardTransactionRoundtrip() { + fun ofCardRoundtrip() { val jsonMapper = jsonMapper() val accountActivityListResponse = - AccountActivityListResponse.ofCardTransaction( + AccountActivityListResponse.ofCard( AccountActivityListResponse.CardTransaction.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .accountToken("bd5e5649-1be8-4117-9bc5-3268258d1417") @@ -774,7 +727,7 @@ internal class AccountActivityListResponseTest { ) .build() ) - .family(AccountActivityListResponse.CardTransaction.TransactionFamilyTypes.CARD) + .family(AccountActivityListResponse.CardTransaction.Family.CARD) .build() ) @@ -788,47 +741,30 @@ internal class AccountActivityListResponseTest { } @Test - fun ofPaymentTransaction() { - val paymentTransaction = - AccountActivityListResponse.PaymentTransaction.builder() + fun ofPayment() { + val payment = + Payment.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .category(AccountActivityListResponse.PaymentTransaction.TransactionCategory.ACH) + .category(Payment.TransactionCategory.ACH) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .descriptor("descriptor") - .direction(AccountActivityListResponse.PaymentTransaction.Direction.CREDIT) + .direction(Payment.Direction.CREDIT) .addEvent( - AccountActivityListResponse.PaymentTransaction.PaymentEvent.builder() + Payment.PaymentEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result( - AccountActivityListResponse.PaymentTransaction.PaymentEvent.Result - .APPROVED - ) - .type( - AccountActivityListResponse.PaymentTransaction.PaymentEvent.Type - .ACH_ORIGINATION_CANCELLED - ) - .addDetailedResult( - AccountActivityListResponse.PaymentTransaction.PaymentEvent - .DetailedResult - .APPROVED - ) + .result(Payment.PaymentEvent.Result.APPROVED) + .type(Payment.PaymentEvent.Type.ACH_ORIGINATION_CANCELLED) + .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) - .family(AccountActivityListResponse.PaymentTransaction.TransactionFamilyTypes.CARD) + .family(Payment.Family.PAYMENT) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .method(AccountActivityListResponse.PaymentTransaction.Method.ACH_NEXT_DAY) + .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( - AccountActivityListResponse.PaymentTransaction.MethodAttributes - .AchMethodAttributes - .builder() - .secCode( - AccountActivityListResponse.PaymentTransaction.MethodAttributes - .AchMethodAttributes - .SecCode - .CCD - ) + Payment.MethodAttributes.AchMethodAttributes.builder() + .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) .addenda("addenda") .companyId("company_id") .receiptRoutingNumber("receipt_routing_number") @@ -839,84 +775,60 @@ internal class AccountActivityListResponseTest { ) .pendingAmount(200L) .relatedAccountTokens( - AccountActivityListResponse.PaymentTransaction.RelatedAccountTokens.builder() + Payment.RelatedAccountTokens.builder() .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) - .result(AccountActivityListResponse.PaymentTransaction.TransactionResult.APPROVED) + .result(Payment.TransactionResult.APPROVED) .settledAmount(500L) - .source(AccountActivityListResponse.PaymentTransaction.Source.LITHIC) - .status(AccountActivityListResponse.PaymentTransaction.TransactionStatus.PENDING) + .source(Payment.Source.LITHIC) + .status(Payment.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .currency("USD") .expectedReleaseDate(LocalDate.parse("2019-12-27")) .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .type( - AccountActivityListResponse.PaymentTransaction.TransferType.ORIGINATION_CREDIT - ) + .type(Payment.TransferType.ORIGINATION_CREDIT) .userDefinedId("user_defined_id") .build() - val accountActivityListResponse = - AccountActivityListResponse.ofPaymentTransaction(paymentTransaction) + val accountActivityListResponse = AccountActivityListResponse.ofPayment(payment) - assertThat(accountActivityListResponse.financialTransaction()).isEmpty - assertThat(accountActivityListResponse.bookTransferTransaction()).isEmpty - assertThat(accountActivityListResponse.cardTransaction()).isEmpty - assertThat(accountActivityListResponse.paymentTransaction()).contains(paymentTransaction) + assertThat(accountActivityListResponse.internal_()).isEmpty + assertThat(accountActivityListResponse.transfer()).isEmpty + assertThat(accountActivityListResponse.card()).isEmpty + assertThat(accountActivityListResponse.payment()).contains(payment) assertThat(accountActivityListResponse.externalPayment()).isEmpty - assertThat(accountActivityListResponse.managementOperationTransaction()).isEmpty + assertThat(accountActivityListResponse.managementOperation()).isEmpty } @Test - fun ofPaymentTransactionRoundtrip() { + fun ofPaymentRoundtrip() { val jsonMapper = jsonMapper() val accountActivityListResponse = - AccountActivityListResponse.ofPaymentTransaction( - AccountActivityListResponse.PaymentTransaction.builder() + AccountActivityListResponse.ofPayment( + Payment.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .category( - AccountActivityListResponse.PaymentTransaction.TransactionCategory.ACH - ) + .category(Payment.TransactionCategory.ACH) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .descriptor("descriptor") - .direction(AccountActivityListResponse.PaymentTransaction.Direction.CREDIT) + .direction(Payment.Direction.CREDIT) .addEvent( - AccountActivityListResponse.PaymentTransaction.PaymentEvent.builder() + Payment.PaymentEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result( - AccountActivityListResponse.PaymentTransaction.PaymentEvent.Result - .APPROVED - ) - .type( - AccountActivityListResponse.PaymentTransaction.PaymentEvent.Type - .ACH_ORIGINATION_CANCELLED - ) - .addDetailedResult( - AccountActivityListResponse.PaymentTransaction.PaymentEvent - .DetailedResult - .APPROVED - ) + .result(Payment.PaymentEvent.Result.APPROVED) + .type(Payment.PaymentEvent.Type.ACH_ORIGINATION_CANCELLED) + .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) - .family( - AccountActivityListResponse.PaymentTransaction.TransactionFamilyTypes.CARD - ) + .family(Payment.Family.PAYMENT) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .method(AccountActivityListResponse.PaymentTransaction.Method.ACH_NEXT_DAY) + .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( - AccountActivityListResponse.PaymentTransaction.MethodAttributes - .AchMethodAttributes - .builder() - .secCode( - AccountActivityListResponse.PaymentTransaction.MethodAttributes - .AchMethodAttributes - .SecCode - .CCD - ) + Payment.MethodAttributes.AchMethodAttributes.builder() + .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) .addenda("addenda") .companyId("company_id") .receiptRoutingNumber("receipt_routing_number") @@ -927,28 +839,20 @@ internal class AccountActivityListResponseTest { ) .pendingAmount(200L) .relatedAccountTokens( - AccountActivityListResponse.PaymentTransaction.RelatedAccountTokens - .builder() + Payment.RelatedAccountTokens.builder() .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) - .result( - AccountActivityListResponse.PaymentTransaction.TransactionResult.APPROVED - ) + .result(Payment.TransactionResult.APPROVED) .settledAmount(500L) - .source(AccountActivityListResponse.PaymentTransaction.Source.LITHIC) - .status( - AccountActivityListResponse.PaymentTransaction.TransactionStatus.PENDING - ) + .source(Payment.Source.LITHIC) + .status(Payment.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .currency("USD") .expectedReleaseDate(LocalDate.parse("2019-12-27")) .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .type( - AccountActivityListResponse.PaymentTransaction.TransferType - .ORIGINATION_CREDIT - ) + .type(Payment.TransferType.ORIGINATION_CREDIT) .userDefinedId("user_defined_id") .build() ) @@ -968,7 +872,6 @@ internal class AccountActivityListResponseTest { ExternalPayment.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .family(ExternalPayment.TransactionFamilyTypes.CARD) .status(ExternalPayment.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .category(ExternalPayment.ExternalPaymentCategory.EXTERNAL_WIRE) @@ -990,6 +893,7 @@ internal class AccountActivityListResponseTest { ) .build() ) + .family(ExternalPayment.Family.EXTERNAL_PAYMENT) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .paymentType(ExternalPayment.ExternalPaymentDirection.DEPOSIT) .pendingAmount(0L) @@ -1001,12 +905,12 @@ internal class AccountActivityListResponseTest { val accountActivityListResponse = AccountActivityListResponse.ofExternalPayment(externalPayment) - assertThat(accountActivityListResponse.financialTransaction()).isEmpty - assertThat(accountActivityListResponse.bookTransferTransaction()).isEmpty - assertThat(accountActivityListResponse.cardTransaction()).isEmpty - assertThat(accountActivityListResponse.paymentTransaction()).isEmpty + assertThat(accountActivityListResponse.internal_()).isEmpty + assertThat(accountActivityListResponse.transfer()).isEmpty + assertThat(accountActivityListResponse.card()).isEmpty + assertThat(accountActivityListResponse.payment()).isEmpty assertThat(accountActivityListResponse.externalPayment()).contains(externalPayment) - assertThat(accountActivityListResponse.managementOperationTransaction()).isEmpty + assertThat(accountActivityListResponse.managementOperation()).isEmpty } @Test @@ -1017,7 +921,6 @@ internal class AccountActivityListResponseTest { ExternalPayment.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .family(ExternalPayment.TransactionFamilyTypes.CARD) .status(ExternalPayment.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .category(ExternalPayment.ExternalPaymentCategory.EXTERNAL_WIRE) @@ -1039,6 +942,7 @@ internal class AccountActivityListResponseTest { ) .build() ) + .family(ExternalPayment.Family.EXTERNAL_PAYMENT) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .paymentType(ExternalPayment.ExternalPaymentDirection.DEPOSIT) .pendingAmount(0L) @@ -1058,12 +962,11 @@ internal class AccountActivityListResponseTest { } @Test - fun ofManagementOperationTransaction() { - val managementOperationTransaction = + fun ofManagementOperation() { + val managementOperation = ManagementOperationTransaction.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .family(ManagementOperationTransaction.TransactionFamilyTypes.CARD) .status(ManagementOperationTransaction.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .category(ManagementOperationTransaction.ManagementOperationCategory.MANAGEMENT_FEE) @@ -1100,6 +1003,7 @@ internal class AccountActivityListResponseTest { .externalResourceSubToken("external_resource_sub_token") .build() ) + .family(ManagementOperationTransaction.Family.MANAGEMENT_OPERATION) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .pendingAmount(0L) .result(ManagementOperationTransaction.TransactionResult.APPROVED) @@ -1115,28 +1019,24 @@ internal class AccountActivityListResponseTest { .build() val accountActivityListResponse = - AccountActivityListResponse.ofManagementOperationTransaction( - managementOperationTransaction - ) + AccountActivityListResponse.ofManagementOperation(managementOperation) - assertThat(accountActivityListResponse.financialTransaction()).isEmpty - assertThat(accountActivityListResponse.bookTransferTransaction()).isEmpty - assertThat(accountActivityListResponse.cardTransaction()).isEmpty - assertThat(accountActivityListResponse.paymentTransaction()).isEmpty + assertThat(accountActivityListResponse.internal_()).isEmpty + assertThat(accountActivityListResponse.transfer()).isEmpty + assertThat(accountActivityListResponse.card()).isEmpty + assertThat(accountActivityListResponse.payment()).isEmpty assertThat(accountActivityListResponse.externalPayment()).isEmpty - assertThat(accountActivityListResponse.managementOperationTransaction()) - .contains(managementOperationTransaction) + assertThat(accountActivityListResponse.managementOperation()).contains(managementOperation) } @Test - fun ofManagementOperationTransactionRoundtrip() { + fun ofManagementOperationRoundtrip() { val jsonMapper = jsonMapper() val accountActivityListResponse = - AccountActivityListResponse.ofManagementOperationTransaction( + AccountActivityListResponse.ofManagementOperation( ManagementOperationTransaction.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .family(ManagementOperationTransaction.TransactionFamilyTypes.CARD) .status(ManagementOperationTransaction.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .category( @@ -1176,6 +1076,7 @@ internal class AccountActivityListResponseTest { .externalResourceSubToken("external_resource_sub_token") .build() ) + .family(ManagementOperationTransaction.Family.MANAGEMENT_OPERATION) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .pendingAmount(0L) .result(ManagementOperationTransaction.TransactionResult.APPROVED) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityRetrieveTransactionResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityRetrieveTransactionResponseTest.kt index 56825a8e4..8ac38f28b 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityRetrieveTransactionResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityRetrieveTransactionResponseTest.kt @@ -17,8 +17,8 @@ import org.junit.jupiter.params.provider.EnumSource internal class AccountActivityRetrieveTransactionResponseTest { @Test - fun ofFinancialTransaction() { - val financialTransaction = + fun ofInternal() { + val internal_ = AccountActivityRetrieveTransactionResponse.FinancialTransaction.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .category( @@ -50,9 +50,7 @@ internal class AccountActivityRetrieveTransactionResponseTest { .build() ) .family( - AccountActivityRetrieveTransactionResponse.FinancialTransaction - .TransactionFamilyTypes - .CARD + AccountActivityRetrieveTransactionResponse.FinancialTransaction.Family.INTERNAL ) .financialAccountToken("0cc87075-57cf-4607-8722-f42e2cb2c0cd") .pendingAmount(500L) @@ -71,23 +69,21 @@ internal class AccountActivityRetrieveTransactionResponseTest { .build() val accountActivityRetrieveTransactionResponse = - AccountActivityRetrieveTransactionResponse.ofFinancialTransaction(financialTransaction) + AccountActivityRetrieveTransactionResponse.ofInternal(internal_) - assertThat(accountActivityRetrieveTransactionResponse.financialTransaction()) - .contains(financialTransaction) - assertThat(accountActivityRetrieveTransactionResponse.bookTransferTransaction()).isEmpty - assertThat(accountActivityRetrieveTransactionResponse.cardTransaction()).isEmpty - assertThat(accountActivityRetrieveTransactionResponse.paymentTransaction()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.internal_()).contains(internal_) + assertThat(accountActivityRetrieveTransactionResponse.transfer()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.card()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.payment()).isEmpty assertThat(accountActivityRetrieveTransactionResponse.externalPayment()).isEmpty - assertThat(accountActivityRetrieveTransactionResponse.managementOperationTransaction()) - .isEmpty + assertThat(accountActivityRetrieveTransactionResponse.managementOperation()).isEmpty } @Test - fun ofFinancialTransactionRoundtrip() { + fun ofInternalRoundtrip() { val jsonMapper = jsonMapper() val accountActivityRetrieveTransactionResponse = - AccountActivityRetrieveTransactionResponse.ofFinancialTransaction( + AccountActivityRetrieveTransactionResponse.ofInternal( AccountActivityRetrieveTransactionResponse.FinancialTransaction.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .category( @@ -120,9 +116,8 @@ internal class AccountActivityRetrieveTransactionResponseTest { .build() ) .family( - AccountActivityRetrieveTransactionResponse.FinancialTransaction - .TransactionFamilyTypes - .CARD + AccountActivityRetrieveTransactionResponse.FinancialTransaction.Family + .INTERNAL ) .financialAccountToken("0cc87075-57cf-4607-8722-f42e2cb2c0cd") .pendingAmount(500L) @@ -152,64 +147,37 @@ internal class AccountActivityRetrieveTransactionResponseTest { } @Test - fun ofBookTransferTransaction() { - val bookTransferTransaction = - AccountActivityRetrieveTransactionResponse.BookTransferTransaction.builder() + fun ofTransfer() { + val transfer = + BookTransferResponse.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .category( - AccountActivityRetrieveTransactionResponse.BookTransferTransaction - .BookTransferCategory - .ADJUSTMENT - ) + .category(BookTransferResponse.BookTransferCategory.ADJUSTMENT) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .currency("USD") .addEvent( - AccountActivityRetrieveTransactionResponse.BookTransferTransaction - .BookTransferEvent - .builder() + BookTransferResponse.BookTransferEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .detailedResults( - AccountActivityRetrieveTransactionResponse.BookTransferTransaction - .BookTransferEvent - .BookTransferDetailedResults + BookTransferResponse.BookTransferEvent.BookTransferDetailedResults .APPROVED ) .memo("memo") - .result( - AccountActivityRetrieveTransactionResponse.BookTransferTransaction - .BookTransferEvent - .Result - .APPROVED - ) + .result(BookTransferResponse.BookTransferEvent.Result.APPROVED) .subtype("subtype") .type( - AccountActivityRetrieveTransactionResponse.BookTransferTransaction - .BookTransferEvent - .BookTransferType + BookTransferResponse.BookTransferEvent.BookTransferType .ATM_BALANCE_INQUIRY ) .build() ) - .family( - AccountActivityRetrieveTransactionResponse.BookTransferTransaction - .TransactionFamilyTypes - .CARD - ) + .family(BookTransferResponse.Family.TRANSFER) .fromFinancialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .pendingAmount(1000L) - .result( - AccountActivityRetrieveTransactionResponse.BookTransferTransaction - .TransactionResult - .APPROVED - ) + .result(BookTransferResponse.TransactionResult.APPROVED) .settledAmount(500L) - .status( - AccountActivityRetrieveTransactionResponse.BookTransferTransaction - .TransactionStatus - .PENDING - ) + .status(BookTransferResponse.TransactionStatus.PENDING) .toFinancialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .externalId("external_id") @@ -221,9 +189,7 @@ internal class AccountActivityRetrieveTransactionResponseTest { .build() ) .transactionSeries( - AccountActivityRetrieveTransactionResponse.BookTransferTransaction - .TransactionSeries - .builder() + BookTransferResponse.TransactionSeries.builder() .relatedTransactionEventToken("123e4567-e89b-12d3-a456-426614174000") .relatedTransactionToken("123e4567-e89b-12d3-a456-426614174000") .type("FEE") @@ -232,81 +198,50 @@ internal class AccountActivityRetrieveTransactionResponseTest { .build() val accountActivityRetrieveTransactionResponse = - AccountActivityRetrieveTransactionResponse.ofBookTransferTransaction( - bookTransferTransaction - ) + AccountActivityRetrieveTransactionResponse.ofTransfer(transfer) - assertThat(accountActivityRetrieveTransactionResponse.financialTransaction()).isEmpty - assertThat(accountActivityRetrieveTransactionResponse.bookTransferTransaction()) - .contains(bookTransferTransaction) - assertThat(accountActivityRetrieveTransactionResponse.cardTransaction()).isEmpty - assertThat(accountActivityRetrieveTransactionResponse.paymentTransaction()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.internal_()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.transfer()).contains(transfer) + assertThat(accountActivityRetrieveTransactionResponse.card()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.payment()).isEmpty assertThat(accountActivityRetrieveTransactionResponse.externalPayment()).isEmpty - assertThat(accountActivityRetrieveTransactionResponse.managementOperationTransaction()) - .isEmpty + assertThat(accountActivityRetrieveTransactionResponse.managementOperation()).isEmpty } @Test - fun ofBookTransferTransactionRoundtrip() { + fun ofTransferRoundtrip() { val jsonMapper = jsonMapper() val accountActivityRetrieveTransactionResponse = - AccountActivityRetrieveTransactionResponse.ofBookTransferTransaction( - AccountActivityRetrieveTransactionResponse.BookTransferTransaction.builder() + AccountActivityRetrieveTransactionResponse.ofTransfer( + BookTransferResponse.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .category( - AccountActivityRetrieveTransactionResponse.BookTransferTransaction - .BookTransferCategory - .ADJUSTMENT - ) + .category(BookTransferResponse.BookTransferCategory.ADJUSTMENT) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .currency("USD") .addEvent( - AccountActivityRetrieveTransactionResponse.BookTransferTransaction - .BookTransferEvent - .builder() + BookTransferResponse.BookTransferEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .detailedResults( - AccountActivityRetrieveTransactionResponse.BookTransferTransaction - .BookTransferEvent - .BookTransferDetailedResults + BookTransferResponse.BookTransferEvent.BookTransferDetailedResults .APPROVED ) .memo("memo") - .result( - AccountActivityRetrieveTransactionResponse.BookTransferTransaction - .BookTransferEvent - .Result - .APPROVED - ) + .result(BookTransferResponse.BookTransferEvent.Result.APPROVED) .subtype("subtype") .type( - AccountActivityRetrieveTransactionResponse.BookTransferTransaction - .BookTransferEvent - .BookTransferType + BookTransferResponse.BookTransferEvent.BookTransferType .ATM_BALANCE_INQUIRY ) .build() ) - .family( - AccountActivityRetrieveTransactionResponse.BookTransferTransaction - .TransactionFamilyTypes - .CARD - ) + .family(BookTransferResponse.Family.TRANSFER) .fromFinancialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .pendingAmount(1000L) - .result( - AccountActivityRetrieveTransactionResponse.BookTransferTransaction - .TransactionResult - .APPROVED - ) + .result(BookTransferResponse.TransactionResult.APPROVED) .settledAmount(500L) - .status( - AccountActivityRetrieveTransactionResponse.BookTransferTransaction - .TransactionStatus - .PENDING - ) + .status(BookTransferResponse.TransactionStatus.PENDING) .toFinancialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .externalId("external_id") @@ -318,9 +253,7 @@ internal class AccountActivityRetrieveTransactionResponseTest { .build() ) .transactionSeries( - AccountActivityRetrieveTransactionResponse.BookTransferTransaction - .TransactionSeries - .builder() + BookTransferResponse.TransactionSeries.builder() .relatedTransactionEventToken("123e4567-e89b-12d3-a456-426614174000") .relatedTransactionToken("123e4567-e89b-12d3-a456-426614174000") .type("FEE") @@ -340,8 +273,8 @@ internal class AccountActivityRetrieveTransactionResponseTest { } @Test - fun ofCardTransaction() { - val cardTransaction = + fun ofCard() { + val card = AccountActivityRetrieveTransactionResponse.CardTransaction.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .accountToken("bd5e5649-1be8-4117-9bc5-3268258d1417") @@ -571,31 +504,25 @@ internal class AccountActivityRetrieveTransactionResponseTest { ) .build() ) - .family( - AccountActivityRetrieveTransactionResponse.CardTransaction - .TransactionFamilyTypes - .CARD - ) + .family(AccountActivityRetrieveTransactionResponse.CardTransaction.Family.CARD) .build() val accountActivityRetrieveTransactionResponse = - AccountActivityRetrieveTransactionResponse.ofCardTransaction(cardTransaction) + AccountActivityRetrieveTransactionResponse.ofCard(card) - assertThat(accountActivityRetrieveTransactionResponse.financialTransaction()).isEmpty - assertThat(accountActivityRetrieveTransactionResponse.bookTransferTransaction()).isEmpty - assertThat(accountActivityRetrieveTransactionResponse.cardTransaction()) - .contains(cardTransaction) - assertThat(accountActivityRetrieveTransactionResponse.paymentTransaction()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.internal_()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.transfer()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.card()).contains(card) + assertThat(accountActivityRetrieveTransactionResponse.payment()).isEmpty assertThat(accountActivityRetrieveTransactionResponse.externalPayment()).isEmpty - assertThat(accountActivityRetrieveTransactionResponse.managementOperationTransaction()) - .isEmpty + assertThat(accountActivityRetrieveTransactionResponse.managementOperation()).isEmpty } @Test - fun ofCardTransactionRoundtrip() { + fun ofCardRoundtrip() { val jsonMapper = jsonMapper() val accountActivityRetrieveTransactionResponse = - AccountActivityRetrieveTransactionResponse.ofCardTransaction( + AccountActivityRetrieveTransactionResponse.ofCard( AccountActivityRetrieveTransactionResponse.CardTransaction.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .accountToken("bd5e5649-1be8-4117-9bc5-3268258d1417") @@ -836,11 +763,7 @@ internal class AccountActivityRetrieveTransactionResponseTest { ) .build() ) - .family( - AccountActivityRetrieveTransactionResponse.CardTransaction - .TransactionFamilyTypes - .CARD - ) + .family(AccountActivityRetrieveTransactionResponse.CardTransaction.Family.CARD) .build() ) @@ -855,67 +778,30 @@ internal class AccountActivityRetrieveTransactionResponseTest { } @Test - fun ofPaymentTransaction() { - val paymentTransaction = - AccountActivityRetrieveTransactionResponse.PaymentTransaction.builder() + fun ofPayment() { + val payment = + Payment.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .category( - AccountActivityRetrieveTransactionResponse.PaymentTransaction - .TransactionCategory - .ACH - ) + .category(Payment.TransactionCategory.ACH) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .descriptor("descriptor") - .direction( - AccountActivityRetrieveTransactionResponse.PaymentTransaction.Direction.CREDIT - ) + .direction(Payment.Direction.CREDIT) .addEvent( - AccountActivityRetrieveTransactionResponse.PaymentTransaction.PaymentEvent - .builder() + Payment.PaymentEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result( - AccountActivityRetrieveTransactionResponse.PaymentTransaction - .PaymentEvent - .Result - .APPROVED - ) - .type( - AccountActivityRetrieveTransactionResponse.PaymentTransaction - .PaymentEvent - .Type - .ACH_ORIGINATION_CANCELLED - ) - .addDetailedResult( - AccountActivityRetrieveTransactionResponse.PaymentTransaction - .PaymentEvent - .DetailedResult - .APPROVED - ) + .result(Payment.PaymentEvent.Result.APPROVED) + .type(Payment.PaymentEvent.Type.ACH_ORIGINATION_CANCELLED) + .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) - .family( - AccountActivityRetrieveTransactionResponse.PaymentTransaction - .TransactionFamilyTypes - .CARD - ) + .family(Payment.Family.PAYMENT) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .method( - AccountActivityRetrieveTransactionResponse.PaymentTransaction.Method - .ACH_NEXT_DAY - ) + .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( - AccountActivityRetrieveTransactionResponse.PaymentTransaction.MethodAttributes - .AchMethodAttributes - .builder() - .secCode( - AccountActivityRetrieveTransactionResponse.PaymentTransaction - .MethodAttributes - .AchMethodAttributes - .SecCode - .CCD - ) + Payment.MethodAttributes.AchMethodAttributes.builder() + .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) .addenda("addenda") .companyId("company_id") .receiptRoutingNumber("receipt_routing_number") @@ -926,113 +812,61 @@ internal class AccountActivityRetrieveTransactionResponseTest { ) .pendingAmount(200L) .relatedAccountTokens( - AccountActivityRetrieveTransactionResponse.PaymentTransaction - .RelatedAccountTokens - .builder() + Payment.RelatedAccountTokens.builder() .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) - .result( - AccountActivityRetrieveTransactionResponse.PaymentTransaction.TransactionResult - .APPROVED - ) + .result(Payment.TransactionResult.APPROVED) .settledAmount(500L) - .source(AccountActivityRetrieveTransactionResponse.PaymentTransaction.Source.LITHIC) - .status( - AccountActivityRetrieveTransactionResponse.PaymentTransaction.TransactionStatus - .PENDING - ) + .source(Payment.Source.LITHIC) + .status(Payment.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .currency("USD") .expectedReleaseDate(LocalDate.parse("2019-12-27")) .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .type( - AccountActivityRetrieveTransactionResponse.PaymentTransaction.TransferType - .ORIGINATION_CREDIT - ) + .type(Payment.TransferType.ORIGINATION_CREDIT) .userDefinedId("user_defined_id") .build() val accountActivityRetrieveTransactionResponse = - AccountActivityRetrieveTransactionResponse.ofPaymentTransaction(paymentTransaction) + AccountActivityRetrieveTransactionResponse.ofPayment(payment) - assertThat(accountActivityRetrieveTransactionResponse.financialTransaction()).isEmpty - assertThat(accountActivityRetrieveTransactionResponse.bookTransferTransaction()).isEmpty - assertThat(accountActivityRetrieveTransactionResponse.cardTransaction()).isEmpty - assertThat(accountActivityRetrieveTransactionResponse.paymentTransaction()) - .contains(paymentTransaction) + assertThat(accountActivityRetrieveTransactionResponse.internal_()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.transfer()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.card()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.payment()).contains(payment) assertThat(accountActivityRetrieveTransactionResponse.externalPayment()).isEmpty - assertThat(accountActivityRetrieveTransactionResponse.managementOperationTransaction()) - .isEmpty + assertThat(accountActivityRetrieveTransactionResponse.managementOperation()).isEmpty } @Test - fun ofPaymentTransactionRoundtrip() { + fun ofPaymentRoundtrip() { val jsonMapper = jsonMapper() val accountActivityRetrieveTransactionResponse = - AccountActivityRetrieveTransactionResponse.ofPaymentTransaction( - AccountActivityRetrieveTransactionResponse.PaymentTransaction.builder() + AccountActivityRetrieveTransactionResponse.ofPayment( + Payment.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .category( - AccountActivityRetrieveTransactionResponse.PaymentTransaction - .TransactionCategory - .ACH - ) + .category(Payment.TransactionCategory.ACH) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .descriptor("descriptor") - .direction( - AccountActivityRetrieveTransactionResponse.PaymentTransaction.Direction - .CREDIT - ) + .direction(Payment.Direction.CREDIT) .addEvent( - AccountActivityRetrieveTransactionResponse.PaymentTransaction.PaymentEvent - .builder() + Payment.PaymentEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result( - AccountActivityRetrieveTransactionResponse.PaymentTransaction - .PaymentEvent - .Result - .APPROVED - ) - .type( - AccountActivityRetrieveTransactionResponse.PaymentTransaction - .PaymentEvent - .Type - .ACH_ORIGINATION_CANCELLED - ) - .addDetailedResult( - AccountActivityRetrieveTransactionResponse.PaymentTransaction - .PaymentEvent - .DetailedResult - .APPROVED - ) + .result(Payment.PaymentEvent.Result.APPROVED) + .type(Payment.PaymentEvent.Type.ACH_ORIGINATION_CANCELLED) + .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) - .family( - AccountActivityRetrieveTransactionResponse.PaymentTransaction - .TransactionFamilyTypes - .CARD - ) + .family(Payment.Family.PAYMENT) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .method( - AccountActivityRetrieveTransactionResponse.PaymentTransaction.Method - .ACH_NEXT_DAY - ) + .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( - AccountActivityRetrieveTransactionResponse.PaymentTransaction - .MethodAttributes - .AchMethodAttributes - .builder() - .secCode( - AccountActivityRetrieveTransactionResponse.PaymentTransaction - .MethodAttributes - .AchMethodAttributes - .SecCode - .CCD - ) + Payment.MethodAttributes.AchMethodAttributes.builder() + .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) .addenda("addenda") .companyId("company_id") .receiptRoutingNumber("receipt_routing_number") @@ -1043,35 +877,20 @@ internal class AccountActivityRetrieveTransactionResponseTest { ) .pendingAmount(200L) .relatedAccountTokens( - AccountActivityRetrieveTransactionResponse.PaymentTransaction - .RelatedAccountTokens - .builder() + Payment.RelatedAccountTokens.builder() .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) - .result( - AccountActivityRetrieveTransactionResponse.PaymentTransaction - .TransactionResult - .APPROVED - ) + .result(Payment.TransactionResult.APPROVED) .settledAmount(500L) - .source( - AccountActivityRetrieveTransactionResponse.PaymentTransaction.Source.LITHIC - ) - .status( - AccountActivityRetrieveTransactionResponse.PaymentTransaction - .TransactionStatus - .PENDING - ) + .source(Payment.Source.LITHIC) + .status(Payment.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .currency("USD") .expectedReleaseDate(LocalDate.parse("2019-12-27")) .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .type( - AccountActivityRetrieveTransactionResponse.PaymentTransaction.TransferType - .ORIGINATION_CREDIT - ) + .type(Payment.TransferType.ORIGINATION_CREDIT) .userDefinedId("user_defined_id") .build() ) @@ -1092,7 +911,6 @@ internal class AccountActivityRetrieveTransactionResponseTest { ExternalPayment.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .family(ExternalPayment.TransactionFamilyTypes.CARD) .status(ExternalPayment.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .category(ExternalPayment.ExternalPaymentCategory.EXTERNAL_WIRE) @@ -1114,6 +932,7 @@ internal class AccountActivityRetrieveTransactionResponseTest { ) .build() ) + .family(ExternalPayment.Family.EXTERNAL_PAYMENT) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .paymentType(ExternalPayment.ExternalPaymentDirection.DEPOSIT) .pendingAmount(0L) @@ -1125,14 +944,13 @@ internal class AccountActivityRetrieveTransactionResponseTest { val accountActivityRetrieveTransactionResponse = AccountActivityRetrieveTransactionResponse.ofExternalPayment(externalPayment) - assertThat(accountActivityRetrieveTransactionResponse.financialTransaction()).isEmpty - assertThat(accountActivityRetrieveTransactionResponse.bookTransferTransaction()).isEmpty - assertThat(accountActivityRetrieveTransactionResponse.cardTransaction()).isEmpty - assertThat(accountActivityRetrieveTransactionResponse.paymentTransaction()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.internal_()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.transfer()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.card()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.payment()).isEmpty assertThat(accountActivityRetrieveTransactionResponse.externalPayment()) .contains(externalPayment) - assertThat(accountActivityRetrieveTransactionResponse.managementOperationTransaction()) - .isEmpty + assertThat(accountActivityRetrieveTransactionResponse.managementOperation()).isEmpty } @Test @@ -1143,7 +961,6 @@ internal class AccountActivityRetrieveTransactionResponseTest { ExternalPayment.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .family(ExternalPayment.TransactionFamilyTypes.CARD) .status(ExternalPayment.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .category(ExternalPayment.ExternalPaymentCategory.EXTERNAL_WIRE) @@ -1165,6 +982,7 @@ internal class AccountActivityRetrieveTransactionResponseTest { ) .build() ) + .family(ExternalPayment.Family.EXTERNAL_PAYMENT) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .paymentType(ExternalPayment.ExternalPaymentDirection.DEPOSIT) .pendingAmount(0L) @@ -1185,12 +1003,11 @@ internal class AccountActivityRetrieveTransactionResponseTest { } @Test - fun ofManagementOperationTransaction() { - val managementOperationTransaction = + fun ofManagementOperation() { + val managementOperation = ManagementOperationTransaction.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .family(ManagementOperationTransaction.TransactionFamilyTypes.CARD) .status(ManagementOperationTransaction.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .category(ManagementOperationTransaction.ManagementOperationCategory.MANAGEMENT_FEE) @@ -1227,6 +1044,7 @@ internal class AccountActivityRetrieveTransactionResponseTest { .externalResourceSubToken("external_resource_sub_token") .build() ) + .family(ManagementOperationTransaction.Family.MANAGEMENT_OPERATION) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .pendingAmount(0L) .result(ManagementOperationTransaction.TransactionResult.APPROVED) @@ -1242,28 +1060,25 @@ internal class AccountActivityRetrieveTransactionResponseTest { .build() val accountActivityRetrieveTransactionResponse = - AccountActivityRetrieveTransactionResponse.ofManagementOperationTransaction( - managementOperationTransaction - ) + AccountActivityRetrieveTransactionResponse.ofManagementOperation(managementOperation) - assertThat(accountActivityRetrieveTransactionResponse.financialTransaction()).isEmpty - assertThat(accountActivityRetrieveTransactionResponse.bookTransferTransaction()).isEmpty - assertThat(accountActivityRetrieveTransactionResponse.cardTransaction()).isEmpty - assertThat(accountActivityRetrieveTransactionResponse.paymentTransaction()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.internal_()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.transfer()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.card()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.payment()).isEmpty assertThat(accountActivityRetrieveTransactionResponse.externalPayment()).isEmpty - assertThat(accountActivityRetrieveTransactionResponse.managementOperationTransaction()) - .contains(managementOperationTransaction) + assertThat(accountActivityRetrieveTransactionResponse.managementOperation()) + .contains(managementOperation) } @Test - fun ofManagementOperationTransactionRoundtrip() { + fun ofManagementOperationRoundtrip() { val jsonMapper = jsonMapper() val accountActivityRetrieveTransactionResponse = - AccountActivityRetrieveTransactionResponse.ofManagementOperationTransaction( + AccountActivityRetrieveTransactionResponse.ofManagementOperation( ManagementOperationTransaction.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .family(ManagementOperationTransaction.TransactionFamilyTypes.CARD) .status(ManagementOperationTransaction.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .category( @@ -1303,6 +1118,7 @@ internal class AccountActivityRetrieveTransactionResponseTest { .externalResourceSubToken("external_resource_sub_token") .build() ) + .family(ManagementOperationTransaction.Family.MANAGEMENT_OPERATION) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .pendingAmount(0L) .result(ManagementOperationTransaction.TransactionResult.APPROVED) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ReportParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ReportParamsTest.kt deleted file mode 100644 index 66ed184c0..000000000 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ReportParamsTest.kt +++ /dev/null @@ -1,28 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.lithic.api.models - -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class AuthRuleV2ReportParamsTest { - - @Test - fun create() { - AuthRuleV2ReportParams.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - } - - @Test - fun pathParams() { - val params = - AuthRuleV2ReportParams.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - - assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - // out-of-bound path param - assertThat(params._pathParam(1)).isEqualTo("") - } -} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthenticationRetrieveResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthenticationRetrieveResponseTest.kt index fe059edde..bcda66924 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthenticationRetrieveResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthenticationRetrieveResponseTest.kt @@ -22,6 +22,9 @@ internal class AuthenticationRetrieveResponseTest { .cardholder( AuthenticationRetrieveResponse.Cardholder.builder() .addressMatch(true) + .addressOnFileMatch( + AuthenticationRetrieveResponse.Cardholder.AddressMatchResult.MATCH + ) .billingAddress( AuthenticationRetrieveResponse.Cardholder.BillingAddress.builder() .address1("address1") @@ -175,6 +178,9 @@ internal class AuthenticationRetrieveResponseTest { .isEqualTo( AuthenticationRetrieveResponse.Cardholder.builder() .addressMatch(true) + .addressOnFileMatch( + AuthenticationRetrieveResponse.Cardholder.AddressMatchResult.MATCH + ) .billingAddress( AuthenticationRetrieveResponse.Cardholder.BillingAddress.builder() .address1("address1") @@ -327,6 +333,9 @@ internal class AuthenticationRetrieveResponseTest { .cardholder( AuthenticationRetrieveResponse.Cardholder.builder() .addressMatch(true) + .addressOnFileMatch( + AuthenticationRetrieveResponse.Cardholder.AddressMatchResult.MATCH + ) .billingAddress( AuthenticationRetrieveResponse.Cardholder.BillingAddress.builder() .address1("address1") diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/BookTransferListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/BookTransferListPageResponseTest.kt index 29208d328..8fb37fba6 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/BookTransferListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/BookTransferListPageResponseTest.kt @@ -19,7 +19,7 @@ internal class BookTransferListPageResponseTest { .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .category(BookTransferResponse.BookTransferCategory.ADJUSTMENT) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .currency("currency") + .currency("USD") .addEvent( BookTransferResponse.BookTransferEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -39,6 +39,14 @@ internal class BookTransferListPageResponseTest { ) .build() ) + .family(BookTransferResponse.Family.TRANSFER) + .fromFinancialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .pendingAmount(1000L) + .result(BookTransferResponse.TransactionResult.APPROVED) + .settledAmount(500L) + .status(BookTransferResponse.TransactionStatus.PENDING) + .toFinancialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .externalId("external_id") .externalResource( ExternalResource.builder() @@ -47,12 +55,6 @@ internal class BookTransferListPageResponseTest { .externalResourceSubToken("external_resource_sub_token") .build() ) - .fromFinancialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .pendingAmount(0L) - .result(BookTransferResponse.TransactionResult.APPROVED) - .settledAmount(0L) - .status(BookTransferResponse.Status.DECLINED) - .toFinancialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .transactionSeries( BookTransferResponse.TransactionSeries.builder() .relatedTransactionEventToken( @@ -62,7 +64,6 @@ internal class BookTransferListPageResponseTest { .type("FEE") .build() ) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) .hasMore(true) @@ -74,7 +75,7 @@ internal class BookTransferListPageResponseTest { .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .category(BookTransferResponse.BookTransferCategory.ADJUSTMENT) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .currency("currency") + .currency("USD") .addEvent( BookTransferResponse.BookTransferEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -93,6 +94,14 @@ internal class BookTransferListPageResponseTest { ) .build() ) + .family(BookTransferResponse.Family.TRANSFER) + .fromFinancialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .pendingAmount(1000L) + .result(BookTransferResponse.TransactionResult.APPROVED) + .settledAmount(500L) + .status(BookTransferResponse.TransactionStatus.PENDING) + .toFinancialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .externalId("external_id") .externalResource( ExternalResource.builder() @@ -101,12 +110,6 @@ internal class BookTransferListPageResponseTest { .externalResourceSubToken("external_resource_sub_token") .build() ) - .fromFinancialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .pendingAmount(0L) - .result(BookTransferResponse.TransactionResult.APPROVED) - .settledAmount(0L) - .status(BookTransferResponse.Status.DECLINED) - .toFinancialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .transactionSeries( BookTransferResponse.TransactionSeries.builder() .relatedTransactionEventToken("123e4567-e89b-12d3-a456-426614174000") @@ -114,7 +117,6 @@ internal class BookTransferListPageResponseTest { .type("FEE") .build() ) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) assertThat(bookTransferListPageResponse.hasMore()).isEqualTo(true) @@ -130,7 +132,7 @@ internal class BookTransferListPageResponseTest { .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .category(BookTransferResponse.BookTransferCategory.ADJUSTMENT) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .currency("currency") + .currency("USD") .addEvent( BookTransferResponse.BookTransferEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -150,6 +152,14 @@ internal class BookTransferListPageResponseTest { ) .build() ) + .family(BookTransferResponse.Family.TRANSFER) + .fromFinancialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .pendingAmount(1000L) + .result(BookTransferResponse.TransactionResult.APPROVED) + .settledAmount(500L) + .status(BookTransferResponse.TransactionStatus.PENDING) + .toFinancialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .externalId("external_id") .externalResource( ExternalResource.builder() @@ -158,12 +168,6 @@ internal class BookTransferListPageResponseTest { .externalResourceSubToken("external_resource_sub_token") .build() ) - .fromFinancialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .pendingAmount(0L) - .result(BookTransferResponse.TransactionResult.APPROVED) - .settledAmount(0L) - .status(BookTransferResponse.Status.DECLINED) - .toFinancialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .transactionSeries( BookTransferResponse.TransactionSeries.builder() .relatedTransactionEventToken( @@ -173,7 +177,6 @@ internal class BookTransferListPageResponseTest { .type("FEE") .build() ) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) .hasMore(true) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/BookTransferResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/BookTransferResponseTest.kt index 01be7fb4f..b873733ff 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/BookTransferResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/BookTransferResponseTest.kt @@ -17,7 +17,7 @@ internal class BookTransferResponseTest { .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .category(BookTransferResponse.BookTransferCategory.ADJUSTMENT) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .currency("currency") + .currency("USD") .addEvent( BookTransferResponse.BookTransferEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -36,6 +36,14 @@ internal class BookTransferResponseTest { ) .build() ) + .family(BookTransferResponse.Family.TRANSFER) + .fromFinancialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .pendingAmount(1000L) + .result(BookTransferResponse.TransactionResult.APPROVED) + .settledAmount(500L) + .status(BookTransferResponse.TransactionStatus.PENDING) + .toFinancialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .externalId("external_id") .externalResource( ExternalResource.builder() @@ -44,12 +52,6 @@ internal class BookTransferResponseTest { .externalResourceSubToken("external_resource_sub_token") .build() ) - .fromFinancialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .pendingAmount(0L) - .result(BookTransferResponse.TransactionResult.APPROVED) - .settledAmount(0L) - .status(BookTransferResponse.Status.DECLINED) - .toFinancialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .transactionSeries( BookTransferResponse.TransactionSeries.builder() .relatedTransactionEventToken("123e4567-e89b-12d3-a456-426614174000") @@ -57,7 +59,6 @@ internal class BookTransferResponseTest { .type("FEE") .build() ) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() assertThat(bookTransferResponse.token()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -65,7 +66,7 @@ internal class BookTransferResponseTest { .isEqualTo(BookTransferResponse.BookTransferCategory.ADJUSTMENT) assertThat(bookTransferResponse.created()) .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(bookTransferResponse.currency()).isEqualTo("currency") + assertThat(bookTransferResponse.currency()).isEqualTo("USD") assertThat(bookTransferResponse.events()) .containsExactly( BookTransferResponse.BookTransferEvent.builder() @@ -83,6 +84,19 @@ internal class BookTransferResponseTest { ) .build() ) + assertThat(bookTransferResponse.family()).isEqualTo(BookTransferResponse.Family.TRANSFER) + assertThat(bookTransferResponse.fromFinancialAccountToken()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(bookTransferResponse.pendingAmount()).isEqualTo(1000L) + assertThat(bookTransferResponse.result()) + .isEqualTo(BookTransferResponse.TransactionResult.APPROVED) + assertThat(bookTransferResponse.settledAmount()).isEqualTo(500L) + assertThat(bookTransferResponse.status()) + .isEqualTo(BookTransferResponse.TransactionStatus.PENDING) + assertThat(bookTransferResponse.toFinancialAccountToken()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(bookTransferResponse.updated()) + .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) assertThat(bookTransferResponse.externalId()).contains("external_id") assertThat(bookTransferResponse.externalResource()) .contains( @@ -92,15 +106,6 @@ internal class BookTransferResponseTest { .externalResourceSubToken("external_resource_sub_token") .build() ) - assertThat(bookTransferResponse.fromFinancialAccountToken()) - .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(bookTransferResponse.pendingAmount()).isEqualTo(0L) - assertThat(bookTransferResponse.result()) - .isEqualTo(BookTransferResponse.TransactionResult.APPROVED) - assertThat(bookTransferResponse.settledAmount()).isEqualTo(0L) - assertThat(bookTransferResponse.status()).isEqualTo(BookTransferResponse.Status.DECLINED) - assertThat(bookTransferResponse.toFinancialAccountToken()) - .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(bookTransferResponse.transactionSeries()) .contains( BookTransferResponse.TransactionSeries.builder() @@ -109,8 +114,6 @@ internal class BookTransferResponseTest { .type("FEE") .build() ) - assertThat(bookTransferResponse.updated()) - .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) } @Test @@ -121,7 +124,7 @@ internal class BookTransferResponseTest { .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .category(BookTransferResponse.BookTransferCategory.ADJUSTMENT) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .currency("currency") + .currency("USD") .addEvent( BookTransferResponse.BookTransferEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -140,6 +143,14 @@ internal class BookTransferResponseTest { ) .build() ) + .family(BookTransferResponse.Family.TRANSFER) + .fromFinancialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .pendingAmount(1000L) + .result(BookTransferResponse.TransactionResult.APPROVED) + .settledAmount(500L) + .status(BookTransferResponse.TransactionStatus.PENDING) + .toFinancialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .externalId("external_id") .externalResource( ExternalResource.builder() @@ -148,12 +159,6 @@ internal class BookTransferResponseTest { .externalResourceSubToken("external_resource_sub_token") .build() ) - .fromFinancialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .pendingAmount(0L) - .result(BookTransferResponse.TransactionResult.APPROVED) - .settledAmount(0L) - .status(BookTransferResponse.Status.DECLINED) - .toFinancialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .transactionSeries( BookTransferResponse.TransactionSeries.builder() .relatedTransactionEventToken("123e4567-e89b-12d3-a456-426614174000") @@ -161,7 +166,6 @@ internal class BookTransferResponseTest { .type("FEE") .build() ) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() val roundtrippedBookTransferResponse = diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/CardProvisionResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/CardProvisionResponseTest.kt index c3941b2ab..03ede1589 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/CardProvisionResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/CardProvisionResponseTest.kt @@ -12,16 +12,17 @@ internal class CardProvisionResponseTest { @Test fun create() { val cardProvisionResponse = - CardProvisionResponse.builder().provisioningPayload("provisioning_payload").build() + CardProvisionResponse.builder().provisioningPayload("string").build() - assertThat(cardProvisionResponse.provisioningPayload()).contains("provisioning_payload") + assertThat(cardProvisionResponse.provisioningPayload()) + .contains(CardProvisionResponse.ProvisioningPayload.ofString("string")) } @Test fun roundtrip() { val jsonMapper = jsonMapper() val cardProvisionResponse = - CardProvisionResponse.builder().provisioningPayload("provisioning_payload").build() + CardProvisionResponse.builder().provisioningPayload("string").build() val roundtrippedCardProvisionResponse = jsonMapper.readValue( diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ExternalPaymentListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ExternalPaymentListPageResponseTest.kt index 777abc1d6..5ccceda0e 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ExternalPaymentListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ExternalPaymentListPageResponseTest.kt @@ -19,7 +19,6 @@ internal class ExternalPaymentListPageResponseTest { ExternalPayment.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .family(ExternalPayment.TransactionFamilyTypes.CARD) .status(ExternalPayment.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .category(ExternalPayment.ExternalPaymentCategory.EXTERNAL_WIRE) @@ -43,6 +42,7 @@ internal class ExternalPaymentListPageResponseTest { ) .build() ) + .family(ExternalPayment.Family.EXTERNAL_PAYMENT) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .paymentType(ExternalPayment.ExternalPaymentDirection.DEPOSIT) .pendingAmount(0L) @@ -59,7 +59,6 @@ internal class ExternalPaymentListPageResponseTest { ExternalPayment.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .family(ExternalPayment.TransactionFamilyTypes.CARD) .status(ExternalPayment.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .category(ExternalPayment.ExternalPaymentCategory.EXTERNAL_WIRE) @@ -81,6 +80,7 @@ internal class ExternalPaymentListPageResponseTest { ) .build() ) + .family(ExternalPayment.Family.EXTERNAL_PAYMENT) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .paymentType(ExternalPayment.ExternalPaymentDirection.DEPOSIT) .pendingAmount(0L) @@ -101,7 +101,6 @@ internal class ExternalPaymentListPageResponseTest { ExternalPayment.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .family(ExternalPayment.TransactionFamilyTypes.CARD) .status(ExternalPayment.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .category(ExternalPayment.ExternalPaymentCategory.EXTERNAL_WIRE) @@ -125,6 +124,7 @@ internal class ExternalPaymentListPageResponseTest { ) .build() ) + .family(ExternalPayment.Family.EXTERNAL_PAYMENT) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .paymentType(ExternalPayment.ExternalPaymentDirection.DEPOSIT) .pendingAmount(0L) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ExternalPaymentTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ExternalPaymentTest.kt index 70c159d99..668c7bea8 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ExternalPaymentTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ExternalPaymentTest.kt @@ -18,7 +18,6 @@ internal class ExternalPaymentTest { ExternalPayment.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .family(ExternalPayment.TransactionFamilyTypes.CARD) .status(ExternalPayment.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .category(ExternalPayment.ExternalPaymentCategory.EXTERNAL_WIRE) @@ -40,6 +39,7 @@ internal class ExternalPaymentTest { ) .build() ) + .family(ExternalPayment.Family.EXTERNAL_PAYMENT) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .paymentType(ExternalPayment.ExternalPaymentDirection.DEPOSIT) .pendingAmount(0L) @@ -51,7 +51,6 @@ internal class ExternalPaymentTest { assertThat(externalPayment.token()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(externalPayment.created()) .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(externalPayment.family()).isEqualTo(ExternalPayment.TransactionFamilyTypes.CARD) assertThat(externalPayment.status()).isEqualTo(ExternalPayment.TransactionStatus.PENDING) assertThat(externalPayment.updated()) .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -76,6 +75,7 @@ internal class ExternalPaymentTest { ) .build() ) + assertThat(externalPayment.family()).contains(ExternalPayment.Family.EXTERNAL_PAYMENT) assertThat(externalPayment.financialAccountToken()) .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(externalPayment.paymentType()) @@ -93,7 +93,6 @@ internal class ExternalPaymentTest { ExternalPayment.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .family(ExternalPayment.TransactionFamilyTypes.CARD) .status(ExternalPayment.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .category(ExternalPayment.ExternalPaymentCategory.EXTERNAL_WIRE) @@ -115,6 +114,7 @@ internal class ExternalPaymentTest { ) .build() ) + .family(ExternalPayment.Family.EXTERNAL_PAYMENT) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .paymentType(ExternalPayment.ExternalPaymentDirection.DEPOSIT) .pendingAmount(0L) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountCreditConfigTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountCreditConfigTest.kt index 9f9780a5b..7997a31fd 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountCreditConfigTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountCreditConfigTest.kt @@ -19,13 +19,13 @@ internal class FinancialAccountCreditConfigTest { .autoCollectionEnabled(true) .build() ) - .chargedOffReason(FinancialAccountCreditConfig.ChargedOffReason.DELINQUENT) .creditLimit(0L) .creditProductToken("credit_product_token") .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .tier("tier") + .chargedOffReason(FinancialAccountCreditConfig.ChargedOffReason.DELINQUENT) .financialAccountState(FinancialAccountCreditConfig.FinancialAccountState.PENDING) .isSpendBlocked(true) - .tier("tier") .build() assertThat(financialAccountCreditConfig.accountToken()) @@ -36,17 +36,17 @@ internal class FinancialAccountCreditConfigTest { .autoCollectionEnabled(true) .build() ) - assertThat(financialAccountCreditConfig.chargedOffReason()) - .contains(FinancialAccountCreditConfig.ChargedOffReason.DELINQUENT) assertThat(financialAccountCreditConfig.creditLimit()).contains(0L) assertThat(financialAccountCreditConfig.creditProductToken()) .contains("credit_product_token") assertThat(financialAccountCreditConfig.externalBankAccountToken()) .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(financialAccountCreditConfig.financialAccountState()) - .isEqualTo(FinancialAccountCreditConfig.FinancialAccountState.PENDING) - assertThat(financialAccountCreditConfig.isSpendBlocked()).isEqualTo(true) assertThat(financialAccountCreditConfig.tier()).contains("tier") + assertThat(financialAccountCreditConfig.chargedOffReason()) + .contains(FinancialAccountCreditConfig.ChargedOffReason.DELINQUENT) + assertThat(financialAccountCreditConfig.financialAccountState()) + .contains(FinancialAccountCreditConfig.FinancialAccountState.PENDING) + assertThat(financialAccountCreditConfig.isSpendBlocked()).contains(true) } @Test @@ -60,13 +60,13 @@ internal class FinancialAccountCreditConfigTest { .autoCollectionEnabled(true) .build() ) - .chargedOffReason(FinancialAccountCreditConfig.ChargedOffReason.DELINQUENT) .creditLimit(0L) .creditProductToken("credit_product_token") .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .tier("tier") + .chargedOffReason(FinancialAccountCreditConfig.ChargedOffReason.DELINQUENT) .financialAccountState(FinancialAccountCreditConfig.FinancialAccountState.PENDING) .isSpendBlocked(true) - .tier("tier") .build() val roundtrippedFinancialAccountCreditConfig = diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountListPageResponseTest.kt index 1fae22055..3fb5e0366 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountListPageResponseTest.kt @@ -21,27 +21,27 @@ internal class FinancialAccountListPageResponseTest { .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditConfiguration( FinancialAccount.FinancialAccountCreditConfig.builder() - .chargedOffReason( - FinancialAccount.FinancialAccountCreditConfig.ChargedOffReason - .DELINQUENT + .autoCollectionConfiguration( + FinancialAccount.FinancialAccountCreditConfig + .AutoCollectionConfigurationResponse + .builder() + .autoCollectionEnabled(true) + .build() ) .creditLimit(0L) .creditProductToken("credit_product_token") .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .tier("tier") + .chargedOffReason( + FinancialAccount.FinancialAccountCreditConfig.ChargedOffReason + .DELINQUENT + ) .financialAccountState( FinancialAccount.FinancialAccountCreditConfig .FinancialAccountState .PENDING ) .isSpendBlocked(true) - .tier("tier") - .autoCollectionConfiguration( - FinancialAccount.FinancialAccountCreditConfig - .AutoCollectionConfigurationResponse - .builder() - .autoCollectionEnabled(true) - .build() - ) .build() ) .isForBenefitOf(true) @@ -67,26 +67,26 @@ internal class FinancialAccountListPageResponseTest { .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditConfiguration( FinancialAccount.FinancialAccountCreditConfig.builder() - .chargedOffReason( - FinancialAccount.FinancialAccountCreditConfig.ChargedOffReason - .DELINQUENT + .autoCollectionConfiguration( + FinancialAccount.FinancialAccountCreditConfig + .AutoCollectionConfigurationResponse + .builder() + .autoCollectionEnabled(true) + .build() ) .creditLimit(0L) .creditProductToken("credit_product_token") .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .tier("tier") + .chargedOffReason( + FinancialAccount.FinancialAccountCreditConfig.ChargedOffReason + .DELINQUENT + ) .financialAccountState( FinancialAccount.FinancialAccountCreditConfig.FinancialAccountState .PENDING ) .isSpendBlocked(true) - .tier("tier") - .autoCollectionConfiguration( - FinancialAccount.FinancialAccountCreditConfig - .AutoCollectionConfigurationResponse - .builder() - .autoCollectionEnabled(true) - .build() - ) .build() ) .isForBenefitOf(true) @@ -114,27 +114,27 @@ internal class FinancialAccountListPageResponseTest { .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditConfiguration( FinancialAccount.FinancialAccountCreditConfig.builder() - .chargedOffReason( - FinancialAccount.FinancialAccountCreditConfig.ChargedOffReason - .DELINQUENT + .autoCollectionConfiguration( + FinancialAccount.FinancialAccountCreditConfig + .AutoCollectionConfigurationResponse + .builder() + .autoCollectionEnabled(true) + .build() ) .creditLimit(0L) .creditProductToken("credit_product_token") .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .tier("tier") + .chargedOffReason( + FinancialAccount.FinancialAccountCreditConfig.ChargedOffReason + .DELINQUENT + ) .financialAccountState( FinancialAccount.FinancialAccountCreditConfig .FinancialAccountState .PENDING ) .isSpendBlocked(true) - .tier("tier") - .autoCollectionConfiguration( - FinancialAccount.FinancialAccountCreditConfig - .AutoCollectionConfigurationResponse - .builder() - .autoCollectionEnabled(true) - .build() - ) .build() ) .isForBenefitOf(true) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountTest.kt index 5cde2dc49..0b10da071 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountTest.kt @@ -19,26 +19,26 @@ internal class FinancialAccountTest { .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditConfiguration( FinancialAccount.FinancialAccountCreditConfig.builder() - .chargedOffReason( - FinancialAccount.FinancialAccountCreditConfig.ChargedOffReason - .DELINQUENT + .autoCollectionConfiguration( + FinancialAccount.FinancialAccountCreditConfig + .AutoCollectionConfigurationResponse + .builder() + .autoCollectionEnabled(true) + .build() ) .creditLimit(0L) .creditProductToken("credit_product_token") .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .tier("tier") + .chargedOffReason( + FinancialAccount.FinancialAccountCreditConfig.ChargedOffReason + .DELINQUENT + ) .financialAccountState( FinancialAccount.FinancialAccountCreditConfig.FinancialAccountState .PENDING ) .isSpendBlocked(true) - .tier("tier") - .autoCollectionConfiguration( - FinancialAccount.FinancialAccountCreditConfig - .AutoCollectionConfigurationResponse - .builder() - .autoCollectionEnabled(true) - .build() - ) .build() ) .isForBenefitOf(true) @@ -58,24 +58,24 @@ internal class FinancialAccountTest { assertThat(financialAccount.creditConfiguration()) .contains( FinancialAccount.FinancialAccountCreditConfig.builder() - .chargedOffReason( - FinancialAccount.FinancialAccountCreditConfig.ChargedOffReason.DELINQUENT + .autoCollectionConfiguration( + FinancialAccount.FinancialAccountCreditConfig + .AutoCollectionConfigurationResponse + .builder() + .autoCollectionEnabled(true) + .build() ) .creditLimit(0L) .creditProductToken("credit_product_token") .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .tier("tier") + .chargedOffReason( + FinancialAccount.FinancialAccountCreditConfig.ChargedOffReason.DELINQUENT + ) .financialAccountState( FinancialAccount.FinancialAccountCreditConfig.FinancialAccountState.PENDING ) .isSpendBlocked(true) - .tier("tier") - .autoCollectionConfiguration( - FinancialAccount.FinancialAccountCreditConfig - .AutoCollectionConfigurationResponse - .builder() - .autoCollectionEnabled(true) - .build() - ) .build() ) assertThat(financialAccount.isForBenefitOf()).isEqualTo(true) @@ -101,26 +101,26 @@ internal class FinancialAccountTest { .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .creditConfiguration( FinancialAccount.FinancialAccountCreditConfig.builder() - .chargedOffReason( - FinancialAccount.FinancialAccountCreditConfig.ChargedOffReason - .DELINQUENT + .autoCollectionConfiguration( + FinancialAccount.FinancialAccountCreditConfig + .AutoCollectionConfigurationResponse + .builder() + .autoCollectionEnabled(true) + .build() ) .creditLimit(0L) .creditProductToken("credit_product_token") .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .tier("tier") + .chargedOffReason( + FinancialAccount.FinancialAccountCreditConfig.ChargedOffReason + .DELINQUENT + ) .financialAccountState( FinancialAccount.FinancialAccountCreditConfig.FinancialAccountState .PENDING ) .isSpendBlocked(true) - .tier("tier") - .autoCollectionConfiguration( - FinancialAccount.FinancialAccountCreditConfig - .AutoCollectionConfigurationResponse - .builder() - .autoCollectionEnabled(true) - .build() - ) .build() ) .isForBenefitOf(true) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ManagementOperationListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ManagementOperationListPageResponseTest.kt index 13f22a9b9..f8bd0a9b2 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ManagementOperationListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ManagementOperationListPageResponseTest.kt @@ -19,7 +19,6 @@ internal class ManagementOperationListPageResponseTest { ManagementOperationTransaction.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .family(ManagementOperationTransaction.TransactionFamilyTypes.CARD) .status(ManagementOperationTransaction.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .category( @@ -62,6 +61,7 @@ internal class ManagementOperationListPageResponseTest { .externalResourceSubToken("external_resource_sub_token") .build() ) + .family(ManagementOperationTransaction.Family.MANAGEMENT_OPERATION) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .pendingAmount(0L) .result(ManagementOperationTransaction.TransactionResult.APPROVED) @@ -86,7 +86,6 @@ internal class ManagementOperationListPageResponseTest { ManagementOperationTransaction.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .family(ManagementOperationTransaction.TransactionFamilyTypes.CARD) .status(ManagementOperationTransaction.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .category( @@ -126,6 +125,7 @@ internal class ManagementOperationListPageResponseTest { .externalResourceSubToken("external_resource_sub_token") .build() ) + .family(ManagementOperationTransaction.Family.MANAGEMENT_OPERATION) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .pendingAmount(0L) .result(ManagementOperationTransaction.TransactionResult.APPROVED) @@ -152,7 +152,6 @@ internal class ManagementOperationListPageResponseTest { ManagementOperationTransaction.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .family(ManagementOperationTransaction.TransactionFamilyTypes.CARD) .status(ManagementOperationTransaction.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .category( @@ -195,6 +194,7 @@ internal class ManagementOperationListPageResponseTest { .externalResourceSubToken("external_resource_sub_token") .build() ) + .family(ManagementOperationTransaction.Family.MANAGEMENT_OPERATION) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .pendingAmount(0L) .result(ManagementOperationTransaction.TransactionResult.APPROVED) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ManagementOperationTransactionTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ManagementOperationTransactionTest.kt index f9510a462..14cf00743 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ManagementOperationTransactionTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ManagementOperationTransactionTest.kt @@ -18,7 +18,6 @@ internal class ManagementOperationTransactionTest { ManagementOperationTransaction.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .family(ManagementOperationTransaction.TransactionFamilyTypes.CARD) .status(ManagementOperationTransaction.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .category(ManagementOperationTransaction.ManagementOperationCategory.MANAGEMENT_FEE) @@ -55,6 +54,7 @@ internal class ManagementOperationTransactionTest { .externalResourceSubToken("external_resource_sub_token") .build() ) + .family(ManagementOperationTransaction.Family.MANAGEMENT_OPERATION) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .pendingAmount(0L) .result(ManagementOperationTransaction.TransactionResult.APPROVED) @@ -73,8 +73,6 @@ internal class ManagementOperationTransactionTest { .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(managementOperationTransaction.created()) .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(managementOperationTransaction.family()) - .isEqualTo(ManagementOperationTransaction.TransactionFamilyTypes.CARD) assertThat(managementOperationTransaction.status()) .isEqualTo(ManagementOperationTransaction.TransactionStatus.PENDING) assertThat(managementOperationTransaction.updated()) @@ -116,6 +114,8 @@ internal class ManagementOperationTransactionTest { .externalResourceSubToken("external_resource_sub_token") .build() ) + assertThat(managementOperationTransaction.family()) + .contains(ManagementOperationTransaction.Family.MANAGEMENT_OPERATION) assertThat(managementOperationTransaction.financialAccountToken()) .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(managementOperationTransaction.pendingAmount()).contains(0L) @@ -140,7 +140,6 @@ internal class ManagementOperationTransactionTest { ManagementOperationTransaction.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .family(ManagementOperationTransaction.TransactionFamilyTypes.CARD) .status(ManagementOperationTransaction.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .category(ManagementOperationTransaction.ManagementOperationCategory.MANAGEMENT_FEE) @@ -177,6 +176,7 @@ internal class ManagementOperationTransactionTest { .externalResourceSubToken("external_resource_sub_token") .build() ) + .family(ManagementOperationTransaction.Family.MANAGEMENT_OPERATION) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .pendingAmount(0L) .result(ManagementOperationTransaction.TransactionResult.APPROVED) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentCreateResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentCreateResponseTest.kt index d27739de5..c083391b0 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentCreateResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentCreateResponseTest.kt @@ -16,9 +16,8 @@ internal class PaymentCreateResponseTest { val paymentCreateResponse = PaymentCreateResponse.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .category(Payment.Category.ACH) + .category(Payment.TransactionCategory.ACH) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .currency("currency") .descriptor("descriptor") .direction(Payment.Direction.CREDIT) .addEvent( @@ -31,35 +30,37 @@ internal class PaymentCreateResponseTest { .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) - .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .family(Payment.Family.PAYMENT) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( - Payment.PaymentMethodAttributes.builder() + Payment.MethodAttributes.AchMethodAttributes.builder() + .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) + .addenda("addenda") .companyId("company_id") .receiptRoutingNumber("receipt_routing_number") .retries(0L) .returnReasonCode("return_reason_code") - .secCode(Payment.PaymentMethodAttributes.SecCode.CCD) .addTraceNumber("string") - .addenda("addenda") .build() ) - .pendingAmount(0L) + .pendingAmount(200L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) - .result(Payment.Result.APPROVED) - .settledAmount(0L) - .source(Payment.Source.CUSTOMER) - .status(Payment.Status.DECLINED) + .result(Payment.TransactionResult.APPROVED) + .settledAmount(500L) + .source(Payment.Source.LITHIC) + .status(Payment.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .userDefinedId("user_defined_id") + .currency("USD") .expectedReleaseDate(LocalDate.parse("2019-12-27")) + .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .type(Payment.TransferType.ORIGINATION_CREDIT) + .userDefinedId("user_defined_id") .balance( Balance.builder() .availableAmount(0L) @@ -77,10 +78,9 @@ internal class PaymentCreateResponseTest { .build() assertThat(paymentCreateResponse.token()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(paymentCreateResponse.category()).isEqualTo(Payment.Category.ACH) + assertThat(paymentCreateResponse.category()).isEqualTo(Payment.TransactionCategory.ACH) assertThat(paymentCreateResponse.created()) .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(paymentCreateResponse.currency()).isEqualTo("currency") assertThat(paymentCreateResponse.descriptor()).isEqualTo("descriptor") assertThat(paymentCreateResponse.direction()).isEqualTo(Payment.Direction.CREDIT) assertThat(paymentCreateResponse.events()) @@ -94,24 +94,25 @@ internal class PaymentCreateResponseTest { .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) - assertThat(paymentCreateResponse.externalBankAccountToken()) - .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(paymentCreateResponse.family()).isEqualTo(Payment.Family.PAYMENT) assertThat(paymentCreateResponse.financialAccountToken()) .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(paymentCreateResponse.method()).isEqualTo(Payment.Method.ACH_NEXT_DAY) assertThat(paymentCreateResponse.methodAttributes()) .isEqualTo( - Payment.PaymentMethodAttributes.builder() - .companyId("company_id") - .receiptRoutingNumber("receipt_routing_number") - .retries(0L) - .returnReasonCode("return_reason_code") - .secCode(Payment.PaymentMethodAttributes.SecCode.CCD) - .addTraceNumber("string") - .addenda("addenda") - .build() + Payment.MethodAttributes.ofAch( + Payment.MethodAttributes.AchMethodAttributes.builder() + .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) + .addenda("addenda") + .companyId("company_id") + .receiptRoutingNumber("receipt_routing_number") + .retries(0L) + .returnReasonCode("return_reason_code") + .addTraceNumber("string") + .build() + ) ) - assertThat(paymentCreateResponse.pendingAmount()).isEqualTo(0L) + assertThat(paymentCreateResponse.pendingAmount()).isEqualTo(200L) assertThat(paymentCreateResponse.relatedAccountTokens()) .isEqualTo( Payment.RelatedAccountTokens.builder() @@ -119,16 +120,19 @@ internal class PaymentCreateResponseTest { .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) - assertThat(paymentCreateResponse.result()).isEqualTo(Payment.Result.APPROVED) - assertThat(paymentCreateResponse.settledAmount()).isEqualTo(0L) - assertThat(paymentCreateResponse.source()).isEqualTo(Payment.Source.CUSTOMER) - assertThat(paymentCreateResponse.status()).isEqualTo(Payment.Status.DECLINED) + assertThat(paymentCreateResponse.result()).isEqualTo(Payment.TransactionResult.APPROVED) + assertThat(paymentCreateResponse.settledAmount()).isEqualTo(500L) + assertThat(paymentCreateResponse.source()).isEqualTo(Payment.Source.LITHIC) + assertThat(paymentCreateResponse.status()).isEqualTo(Payment.TransactionStatus.PENDING) assertThat(paymentCreateResponse.updated()) .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(paymentCreateResponse.userDefinedId()).contains("user_defined_id") + assertThat(paymentCreateResponse.currency()).contains("USD") assertThat(paymentCreateResponse.expectedReleaseDate()) .contains(LocalDate.parse("2019-12-27")) + assertThat(paymentCreateResponse.externalBankAccountToken()) + .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(paymentCreateResponse.type()).contains(Payment.TransferType.ORIGINATION_CREDIT) + assertThat(paymentCreateResponse.userDefinedId()).contains("user_defined_id") assertThat(paymentCreateResponse.balance()) .contains( Balance.builder() @@ -152,9 +156,8 @@ internal class PaymentCreateResponseTest { val paymentCreateResponse = PaymentCreateResponse.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .category(Payment.Category.ACH) + .category(Payment.TransactionCategory.ACH) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .currency("currency") .descriptor("descriptor") .direction(Payment.Direction.CREDIT) .addEvent( @@ -167,35 +170,37 @@ internal class PaymentCreateResponseTest { .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) - .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .family(Payment.Family.PAYMENT) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( - Payment.PaymentMethodAttributes.builder() + Payment.MethodAttributes.AchMethodAttributes.builder() + .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) + .addenda("addenda") .companyId("company_id") .receiptRoutingNumber("receipt_routing_number") .retries(0L) .returnReasonCode("return_reason_code") - .secCode(Payment.PaymentMethodAttributes.SecCode.CCD) .addTraceNumber("string") - .addenda("addenda") .build() ) - .pendingAmount(0L) + .pendingAmount(200L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) - .result(Payment.Result.APPROVED) - .settledAmount(0L) - .source(Payment.Source.CUSTOMER) - .status(Payment.Status.DECLINED) + .result(Payment.TransactionResult.APPROVED) + .settledAmount(500L) + .source(Payment.Source.LITHIC) + .status(Payment.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .userDefinedId("user_defined_id") + .currency("USD") .expectedReleaseDate(LocalDate.parse("2019-12-27")) + .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .type(Payment.TransferType.ORIGINATION_CREDIT) + .userDefinedId("user_defined_id") .balance( Balance.builder() .availableAmount(0L) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentListPageResponseTest.kt index a6941305d..17fa1c26c 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentListPageResponseTest.kt @@ -18,9 +18,8 @@ internal class PaymentListPageResponseTest { .addData( Payment.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .category(Payment.Category.ACH) + .category(Payment.TransactionCategory.ACH) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .currency("currency") .descriptor("descriptor") .direction(Payment.Direction.CREDIT) .addEvent( @@ -33,35 +32,37 @@ internal class PaymentListPageResponseTest { .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) - .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .family(Payment.Family.PAYMENT) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( - Payment.PaymentMethodAttributes.builder() + Payment.MethodAttributes.AchMethodAttributes.builder() + .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) + .addenda("addenda") .companyId("company_id") .receiptRoutingNumber("receipt_routing_number") .retries(0L) .returnReasonCode("return_reason_code") - .secCode(Payment.PaymentMethodAttributes.SecCode.CCD) .addTraceNumber("string") - .addenda("addenda") .build() ) - .pendingAmount(0L) + .pendingAmount(200L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) - .result(Payment.Result.APPROVED) - .settledAmount(0L) - .source(Payment.Source.CUSTOMER) - .status(Payment.Status.DECLINED) + .result(Payment.TransactionResult.APPROVED) + .settledAmount(500L) + .source(Payment.Source.LITHIC) + .status(Payment.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .userDefinedId("user_defined_id") + .currency("USD") .expectedReleaseDate(LocalDate.parse("2019-12-27")) + .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .type(Payment.TransferType.ORIGINATION_CREDIT) + .userDefinedId("user_defined_id") .build() ) .hasMore(true) @@ -71,9 +72,8 @@ internal class PaymentListPageResponseTest { .containsExactly( Payment.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .category(Payment.Category.ACH) + .category(Payment.TransactionCategory.ACH) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .currency("currency") .descriptor("descriptor") .direction(Payment.Direction.CREDIT) .addEvent( @@ -86,35 +86,37 @@ internal class PaymentListPageResponseTest { .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) - .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .family(Payment.Family.PAYMENT) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( - Payment.PaymentMethodAttributes.builder() + Payment.MethodAttributes.AchMethodAttributes.builder() + .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) + .addenda("addenda") .companyId("company_id") .receiptRoutingNumber("receipt_routing_number") .retries(0L) .returnReasonCode("return_reason_code") - .secCode(Payment.PaymentMethodAttributes.SecCode.CCD) .addTraceNumber("string") - .addenda("addenda") .build() ) - .pendingAmount(0L) + .pendingAmount(200L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) - .result(Payment.Result.APPROVED) - .settledAmount(0L) - .source(Payment.Source.CUSTOMER) - .status(Payment.Status.DECLINED) + .result(Payment.TransactionResult.APPROVED) + .settledAmount(500L) + .source(Payment.Source.LITHIC) + .status(Payment.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .userDefinedId("user_defined_id") + .currency("USD") .expectedReleaseDate(LocalDate.parse("2019-12-27")) + .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .type(Payment.TransferType.ORIGINATION_CREDIT) + .userDefinedId("user_defined_id") .build() ) assertThat(paymentListPageResponse.hasMore()).isEqualTo(true) @@ -128,9 +130,8 @@ internal class PaymentListPageResponseTest { .addData( Payment.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .category(Payment.Category.ACH) + .category(Payment.TransactionCategory.ACH) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .currency("currency") .descriptor("descriptor") .direction(Payment.Direction.CREDIT) .addEvent( @@ -143,35 +144,37 @@ internal class PaymentListPageResponseTest { .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) - .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .family(Payment.Family.PAYMENT) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( - Payment.PaymentMethodAttributes.builder() + Payment.MethodAttributes.AchMethodAttributes.builder() + .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) + .addenda("addenda") .companyId("company_id") .receiptRoutingNumber("receipt_routing_number") .retries(0L) .returnReasonCode("return_reason_code") - .secCode(Payment.PaymentMethodAttributes.SecCode.CCD) .addTraceNumber("string") - .addenda("addenda") .build() ) - .pendingAmount(0L) + .pendingAmount(200L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) - .result(Payment.Result.APPROVED) - .settledAmount(0L) - .source(Payment.Source.CUSTOMER) - .status(Payment.Status.DECLINED) + .result(Payment.TransactionResult.APPROVED) + .settledAmount(500L) + .source(Payment.Source.LITHIC) + .status(Payment.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .userDefinedId("user_defined_id") + .currency("USD") .expectedReleaseDate(LocalDate.parse("2019-12-27")) + .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .type(Payment.TransferType.ORIGINATION_CREDIT) + .userDefinedId("user_defined_id") .build() ) .hasMore(true) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentRetryResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentRetryResponseTest.kt index 1a1e87dad..428d80cce 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentRetryResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentRetryResponseTest.kt @@ -16,9 +16,8 @@ internal class PaymentRetryResponseTest { val paymentRetryResponse = PaymentRetryResponse.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .category(Payment.Category.ACH) + .category(Payment.TransactionCategory.ACH) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .currency("currency") .descriptor("descriptor") .direction(Payment.Direction.CREDIT) .addEvent( @@ -31,35 +30,37 @@ internal class PaymentRetryResponseTest { .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) - .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .family(Payment.Family.PAYMENT) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( - Payment.PaymentMethodAttributes.builder() + Payment.MethodAttributes.AchMethodAttributes.builder() + .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) + .addenda("addenda") .companyId("company_id") .receiptRoutingNumber("receipt_routing_number") .retries(0L) .returnReasonCode("return_reason_code") - .secCode(Payment.PaymentMethodAttributes.SecCode.CCD) .addTraceNumber("string") - .addenda("addenda") .build() ) - .pendingAmount(0L) + .pendingAmount(200L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) - .result(Payment.Result.APPROVED) - .settledAmount(0L) - .source(Payment.Source.CUSTOMER) - .status(Payment.Status.DECLINED) + .result(Payment.TransactionResult.APPROVED) + .settledAmount(500L) + .source(Payment.Source.LITHIC) + .status(Payment.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .userDefinedId("user_defined_id") + .currency("USD") .expectedReleaseDate(LocalDate.parse("2019-12-27")) + .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .type(Payment.TransferType.ORIGINATION_CREDIT) + .userDefinedId("user_defined_id") .balance( Balance.builder() .availableAmount(0L) @@ -77,10 +78,9 @@ internal class PaymentRetryResponseTest { .build() assertThat(paymentRetryResponse.token()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(paymentRetryResponse.category()).isEqualTo(Payment.Category.ACH) + assertThat(paymentRetryResponse.category()).isEqualTo(Payment.TransactionCategory.ACH) assertThat(paymentRetryResponse.created()) .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(paymentRetryResponse.currency()).isEqualTo("currency") assertThat(paymentRetryResponse.descriptor()).isEqualTo("descriptor") assertThat(paymentRetryResponse.direction()).isEqualTo(Payment.Direction.CREDIT) assertThat(paymentRetryResponse.events()) @@ -94,24 +94,25 @@ internal class PaymentRetryResponseTest { .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) - assertThat(paymentRetryResponse.externalBankAccountToken()) - .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(paymentRetryResponse.family()).isEqualTo(Payment.Family.PAYMENT) assertThat(paymentRetryResponse.financialAccountToken()) .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(paymentRetryResponse.method()).isEqualTo(Payment.Method.ACH_NEXT_DAY) assertThat(paymentRetryResponse.methodAttributes()) .isEqualTo( - Payment.PaymentMethodAttributes.builder() - .companyId("company_id") - .receiptRoutingNumber("receipt_routing_number") - .retries(0L) - .returnReasonCode("return_reason_code") - .secCode(Payment.PaymentMethodAttributes.SecCode.CCD) - .addTraceNumber("string") - .addenda("addenda") - .build() + Payment.MethodAttributes.ofAch( + Payment.MethodAttributes.AchMethodAttributes.builder() + .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) + .addenda("addenda") + .companyId("company_id") + .receiptRoutingNumber("receipt_routing_number") + .retries(0L) + .returnReasonCode("return_reason_code") + .addTraceNumber("string") + .build() + ) ) - assertThat(paymentRetryResponse.pendingAmount()).isEqualTo(0L) + assertThat(paymentRetryResponse.pendingAmount()).isEqualTo(200L) assertThat(paymentRetryResponse.relatedAccountTokens()) .isEqualTo( Payment.RelatedAccountTokens.builder() @@ -119,16 +120,19 @@ internal class PaymentRetryResponseTest { .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) - assertThat(paymentRetryResponse.result()).isEqualTo(Payment.Result.APPROVED) - assertThat(paymentRetryResponse.settledAmount()).isEqualTo(0L) - assertThat(paymentRetryResponse.source()).isEqualTo(Payment.Source.CUSTOMER) - assertThat(paymentRetryResponse.status()).isEqualTo(Payment.Status.DECLINED) + assertThat(paymentRetryResponse.result()).isEqualTo(Payment.TransactionResult.APPROVED) + assertThat(paymentRetryResponse.settledAmount()).isEqualTo(500L) + assertThat(paymentRetryResponse.source()).isEqualTo(Payment.Source.LITHIC) + assertThat(paymentRetryResponse.status()).isEqualTo(Payment.TransactionStatus.PENDING) assertThat(paymentRetryResponse.updated()) .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(paymentRetryResponse.userDefinedId()).contains("user_defined_id") + assertThat(paymentRetryResponse.currency()).contains("USD") assertThat(paymentRetryResponse.expectedReleaseDate()) .contains(LocalDate.parse("2019-12-27")) + assertThat(paymentRetryResponse.externalBankAccountToken()) + .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(paymentRetryResponse.type()).contains(Payment.TransferType.ORIGINATION_CREDIT) + assertThat(paymentRetryResponse.userDefinedId()).contains("user_defined_id") assertThat(paymentRetryResponse.balance()) .contains( Balance.builder() @@ -152,9 +156,8 @@ internal class PaymentRetryResponseTest { val paymentRetryResponse = PaymentRetryResponse.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .category(Payment.Category.ACH) + .category(Payment.TransactionCategory.ACH) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .currency("currency") .descriptor("descriptor") .direction(Payment.Direction.CREDIT) .addEvent( @@ -167,35 +170,37 @@ internal class PaymentRetryResponseTest { .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) - .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .family(Payment.Family.PAYMENT) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( - Payment.PaymentMethodAttributes.builder() + Payment.MethodAttributes.AchMethodAttributes.builder() + .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) + .addenda("addenda") .companyId("company_id") .receiptRoutingNumber("receipt_routing_number") .retries(0L) .returnReasonCode("return_reason_code") - .secCode(Payment.PaymentMethodAttributes.SecCode.CCD) .addTraceNumber("string") - .addenda("addenda") .build() ) - .pendingAmount(0L) + .pendingAmount(200L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) - .result(Payment.Result.APPROVED) - .settledAmount(0L) - .source(Payment.Source.CUSTOMER) - .status(Payment.Status.DECLINED) + .result(Payment.TransactionResult.APPROVED) + .settledAmount(500L) + .source(Payment.Source.LITHIC) + .status(Payment.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .userDefinedId("user_defined_id") + .currency("USD") .expectedReleaseDate(LocalDate.parse("2019-12-27")) + .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .type(Payment.TransferType.ORIGINATION_CREDIT) + .userDefinedId("user_defined_id") .balance( Balance.builder() .availableAmount(0L) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentTest.kt index bc488895d..c781f31bb 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentTest.kt @@ -16,9 +16,8 @@ internal class PaymentTest { val payment = Payment.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .category(Payment.Category.ACH) + .category(Payment.TransactionCategory.ACH) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .currency("currency") .descriptor("descriptor") .direction(Payment.Direction.CREDIT) .addEvent( @@ -31,41 +30,42 @@ internal class PaymentTest { .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) - .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .family(Payment.Family.PAYMENT) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( - Payment.PaymentMethodAttributes.builder() + Payment.MethodAttributes.AchMethodAttributes.builder() + .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) + .addenda("addenda") .companyId("company_id") .receiptRoutingNumber("receipt_routing_number") .retries(0L) .returnReasonCode("return_reason_code") - .secCode(Payment.PaymentMethodAttributes.SecCode.CCD) .addTraceNumber("string") - .addenda("addenda") .build() ) - .pendingAmount(0L) + .pendingAmount(200L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) - .result(Payment.Result.APPROVED) - .settledAmount(0L) - .source(Payment.Source.CUSTOMER) - .status(Payment.Status.DECLINED) + .result(Payment.TransactionResult.APPROVED) + .settledAmount(500L) + .source(Payment.Source.LITHIC) + .status(Payment.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .userDefinedId("user_defined_id") + .currency("USD") .expectedReleaseDate(LocalDate.parse("2019-12-27")) + .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .type(Payment.TransferType.ORIGINATION_CREDIT) + .userDefinedId("user_defined_id") .build() assertThat(payment.token()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(payment.category()).isEqualTo(Payment.Category.ACH) + assertThat(payment.category()).isEqualTo(Payment.TransactionCategory.ACH) assertThat(payment.created()).isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(payment.currency()).isEqualTo("currency") assertThat(payment.descriptor()).isEqualTo("descriptor") assertThat(payment.direction()).isEqualTo(Payment.Direction.CREDIT) assertThat(payment.events()) @@ -79,24 +79,25 @@ internal class PaymentTest { .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) - assertThat(payment.externalBankAccountToken()) - .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(payment.family()).isEqualTo(Payment.Family.PAYMENT) assertThat(payment.financialAccountToken()) .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(payment.method()).isEqualTo(Payment.Method.ACH_NEXT_DAY) assertThat(payment.methodAttributes()) .isEqualTo( - Payment.PaymentMethodAttributes.builder() - .companyId("company_id") - .receiptRoutingNumber("receipt_routing_number") - .retries(0L) - .returnReasonCode("return_reason_code") - .secCode(Payment.PaymentMethodAttributes.SecCode.CCD) - .addTraceNumber("string") - .addenda("addenda") - .build() + Payment.MethodAttributes.ofAch( + Payment.MethodAttributes.AchMethodAttributes.builder() + .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) + .addenda("addenda") + .companyId("company_id") + .receiptRoutingNumber("receipt_routing_number") + .retries(0L) + .returnReasonCode("return_reason_code") + .addTraceNumber("string") + .build() + ) ) - assertThat(payment.pendingAmount()).isEqualTo(0L) + assertThat(payment.pendingAmount()).isEqualTo(200L) assertThat(payment.relatedAccountTokens()) .isEqualTo( Payment.RelatedAccountTokens.builder() @@ -104,14 +105,17 @@ internal class PaymentTest { .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) - assertThat(payment.result()).isEqualTo(Payment.Result.APPROVED) - assertThat(payment.settledAmount()).isEqualTo(0L) - assertThat(payment.source()).isEqualTo(Payment.Source.CUSTOMER) - assertThat(payment.status()).isEqualTo(Payment.Status.DECLINED) + assertThat(payment.result()).isEqualTo(Payment.TransactionResult.APPROVED) + assertThat(payment.settledAmount()).isEqualTo(500L) + assertThat(payment.source()).isEqualTo(Payment.Source.LITHIC) + assertThat(payment.status()).isEqualTo(Payment.TransactionStatus.PENDING) assertThat(payment.updated()).isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(payment.userDefinedId()).contains("user_defined_id") + assertThat(payment.currency()).contains("USD") assertThat(payment.expectedReleaseDate()).contains(LocalDate.parse("2019-12-27")) + assertThat(payment.externalBankAccountToken()) + .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(payment.type()).contains(Payment.TransferType.ORIGINATION_CREDIT) + assertThat(payment.userDefinedId()).contains("user_defined_id") } @Test @@ -120,9 +124,8 @@ internal class PaymentTest { val payment = Payment.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .category(Payment.Category.ACH) + .category(Payment.TransactionCategory.ACH) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .currency("currency") .descriptor("descriptor") .direction(Payment.Direction.CREDIT) .addEvent( @@ -135,35 +138,37 @@ internal class PaymentTest { .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) - .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .family(Payment.Family.PAYMENT) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( - Payment.PaymentMethodAttributes.builder() + Payment.MethodAttributes.AchMethodAttributes.builder() + .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) + .addenda("addenda") .companyId("company_id") .receiptRoutingNumber("receipt_routing_number") .retries(0L) .returnReasonCode("return_reason_code") - .secCode(Payment.PaymentMethodAttributes.SecCode.CCD) .addTraceNumber("string") - .addenda("addenda") .build() ) - .pendingAmount(0L) + .pendingAmount(200L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) - .result(Payment.Result.APPROVED) - .settledAmount(0L) - .source(Payment.Source.CUSTOMER) - .status(Payment.Status.DECLINED) + .result(Payment.TransactionResult.APPROVED) + .settledAmount(500L) + .source(Payment.Source.LITHIC) + .status(Payment.TransactionStatus.PENDING) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .userDefinedId("user_defined_id") + .currency("USD") .expectedReleaseDate(LocalDate.parse("2019-12-27")) + .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .type(Payment.TransferType.ORIGINATION_CREDIT) + .userDefinedId("user_defined_id") .build() val roundtrippedPayment = diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ProvisionResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ProvisionResponseTest.kt new file mode 100644 index 000000000..78cfd5770 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ProvisionResponseTest.kt @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.lithic.api.core.jsonMapper +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class ProvisionResponseTest { + + @Test + fun create() { + val provisionResponse = + ProvisionResponse.builder() + .activationData("activationData") + .encryptedData("encryptedData") + .ephemeralPublicKey("ephemeralPublicKey") + .build() + + assertThat(provisionResponse.activationData()).contains("activationData") + assertThat(provisionResponse.encryptedData()).contains("encryptedData") + assertThat(provisionResponse.ephemeralPublicKey()).contains("ephemeralPublicKey") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val provisionResponse = + ProvisionResponse.builder() + .activationData("activationData") + .encryptedData("encryptedData") + .ephemeralPublicKey("ephemeralPublicKey") + .build() + + val roundtrippedProvisionResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(provisionResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedProvisionResponse).isEqualTo(provisionResponse) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationListPageResponseTest.kt index 47d4f1a77..dedc49584 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationListPageResponseTest.kt @@ -33,7 +33,9 @@ internal class TokenizationListPageResponseTest { Tokenization.TokenizationEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result(Tokenization.TokenizationEvent.Result.APPROVED) + .result( + Tokenization.TokenizationEvent.TokenizationEventOutcome.APPROVED + ) .type(Tokenization.TokenizationEvent.Type.TOKENIZATION_2_FA) .build() ) @@ -62,7 +64,9 @@ internal class TokenizationListPageResponseTest { Tokenization.TokenizationEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result(Tokenization.TokenizationEvent.Result.APPROVED) + .result( + Tokenization.TokenizationEvent.TokenizationEventOutcome.APPROVED + ) .type(Tokenization.TokenizationEvent.Type.TOKENIZATION_2_FA) .build() ) @@ -95,7 +99,9 @@ internal class TokenizationListPageResponseTest { Tokenization.TokenizationEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result(Tokenization.TokenizationEvent.Result.APPROVED) + .result( + Tokenization.TokenizationEvent.TokenizationEventOutcome.APPROVED + ) .type(Tokenization.TokenizationEvent.Type.TOKENIZATION_2_FA) .build() ) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationSimulateResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationSimulateResponseTest.kt index 8e2befbee..ea8b7471c 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationSimulateResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationSimulateResponseTest.kt @@ -33,7 +33,9 @@ internal class TokenizationSimulateResponseTest { Tokenization.TokenizationEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result(Tokenization.TokenizationEvent.Result.APPROVED) + .result( + Tokenization.TokenizationEvent.TokenizationEventOutcome.APPROVED + ) .type(Tokenization.TokenizationEvent.Type.TOKENIZATION_2_FA) .build() ) @@ -61,7 +63,9 @@ internal class TokenizationSimulateResponseTest { Tokenization.TokenizationEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result(Tokenization.TokenizationEvent.Result.APPROVED) + .result( + Tokenization.TokenizationEvent.TokenizationEventOutcome.APPROVED + ) .type(Tokenization.TokenizationEvent.Type.TOKENIZATION_2_FA) .build() ) @@ -93,7 +97,9 @@ internal class TokenizationSimulateResponseTest { Tokenization.TokenizationEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result(Tokenization.TokenizationEvent.Result.APPROVED) + .result( + Tokenization.TokenizationEvent.TokenizationEventOutcome.APPROVED + ) .type(Tokenization.TokenizationEvent.Type.TOKENIZATION_2_FA) .build() ) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationTest.kt index d623ffc60..056335676 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationTest.kt @@ -31,7 +31,7 @@ internal class TokenizationTest { Tokenization.TokenizationEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result(Tokenization.TokenizationEvent.Result.APPROVED) + .result(Tokenization.TokenizationEvent.TokenizationEventOutcome.APPROVED) .type(Tokenization.TokenizationEvent.Type.TOKENIZATION_2_FA) .build() ) @@ -60,7 +60,7 @@ internal class TokenizationTest { Tokenization.TokenizationEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result(Tokenization.TokenizationEvent.Result.APPROVED) + .result(Tokenization.TokenizationEvent.TokenizationEventOutcome.APPROVED) .type(Tokenization.TokenizationEvent.Type.TOKENIZATION_2_FA) .build() ) @@ -89,7 +89,7 @@ internal class TokenizationTest { Tokenization.TokenizationEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result(Tokenization.TokenizationEvent.Result.APPROVED) + .result(Tokenization.TokenizationEvent.TokenizationEventOutcome.APPROVED) .type(Tokenization.TokenizationEvent.Type.TOKENIZATION_2_FA) .build() ) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationUpdateDigitalCardArtResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationUpdateDigitalCardArtResponseTest.kt index 62a06c374..f908378fc 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationUpdateDigitalCardArtResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationUpdateDigitalCardArtResponseTest.kt @@ -32,7 +32,9 @@ internal class TokenizationUpdateDigitalCardArtResponseTest { Tokenization.TokenizationEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result(Tokenization.TokenizationEvent.Result.APPROVED) + .result( + Tokenization.TokenizationEvent.TokenizationEventOutcome.APPROVED + ) .type(Tokenization.TokenizationEvent.Type.TOKENIZATION_2_FA) .build() ) @@ -60,7 +62,9 @@ internal class TokenizationUpdateDigitalCardArtResponseTest { Tokenization.TokenizationEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result(Tokenization.TokenizationEvent.Result.APPROVED) + .result( + Tokenization.TokenizationEvent.TokenizationEventOutcome.APPROVED + ) .type(Tokenization.TokenizationEvent.Type.TOKENIZATION_2_FA) .build() ) @@ -92,7 +96,9 @@ internal class TokenizationUpdateDigitalCardArtResponseTest { Tokenization.TokenizationEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result(Tokenization.TokenizationEvent.Result.APPROVED) + .result( + Tokenization.TokenizationEvent.TokenizationEventOutcome.APPROVED + ) .type(Tokenization.TokenizationEvent.Type.TOKENIZATION_2_FA) .build() ) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2ReportResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2ReportResponseTest.kt deleted file mode 100644 index af8ab2f3a..000000000 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2ReportResponseTest.kt +++ /dev/null @@ -1,34 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.lithic.api.models - -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.lithic.api.core.jsonMapper -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class V2ReportResponseTest { - - @Test - fun create() { - val v2ReportResponse = - V2ReportResponse.builder().reportToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() - - assertThat(v2ReportResponse.reportToken()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val v2ReportResponse = - V2ReportResponse.builder().reportToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() - - val roundtrippedV2ReportResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(v2ReportResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedV2ReportResponse).isEqualTo(v2ReportResponse) - } -} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/authRules/V2ServiceAsyncTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/authRules/V2ServiceAsyncTest.kt index 418f6cdfa..de8e8d6e6 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/authRules/V2ServiceAsyncTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/authRules/V2ServiceAsyncTest.kt @@ -211,21 +211,6 @@ internal class V2ServiceAsyncTest { response.validate() } - @Test - fun report() { - val client = - LithicOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My Lithic API Key") - .build() - val v2ServiceAsync = client.authRules().v2() - - val responseFuture = v2ServiceAsync.report("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - - val response = responseFuture.get() - response.validate() - } - @Test fun retrieveFeatures() { val client = diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/authRules/V2ServiceTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/authRules/V2ServiceTest.kt index b1973b847..3a212100b 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/authRules/V2ServiceTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/authRules/V2ServiceTest.kt @@ -202,20 +202,6 @@ internal class V2ServiceTest { response.validate() } - @Test - fun report() { - val client = - LithicOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My Lithic API Key") - .build() - val v2Service = client.authRules().v2() - - val response = v2Service.report("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - - response.validate() - } - @Test fun retrieveFeatures() { val client = From 9c36cb3b738ca362c351818a37db5f27cc542d9c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 23 Oct 2025 18:23:46 +0000 Subject: [PATCH 2/2] release: 0.109.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 3e05ae562..3ca49358e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.108.0" + ".": "0.109.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 332f39e8d..f56c9c95f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.109.0 (2025-10-23) + +Full Changelog: [v0.108.0...v0.109.0](https://github.com/lithic-com/lithic-java/compare/v0.108.0...v0.109.0) + +### Features + +* **api:** updates to Auth Rules and Card provisioning ([f6866cc](https://github.com/lithic-com/lithic-java/commit/f6866ccb2402a93cad1dd152bd47cc7ffa74cb81)) + ## 0.108.0 (2025-10-08) Full Changelog: [v0.107.0...v0.108.0](https://github.com/lithic-com/lithic-java/compare/v0.107.0...v0.108.0) diff --git a/README.md b/README.md index 968f5f15f..55f8ed5a9 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.lithic.api/lithic-java)](https://central.sonatype.com/artifact/com.lithic.api/lithic-java/0.108.0) -[![javadoc](https://javadoc.io/badge2/com.lithic.api/lithic-java/0.108.0/javadoc.svg)](https://javadoc.io/doc/com.lithic.api/lithic-java/0.108.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.lithic.api/lithic-java)](https://central.sonatype.com/artifact/com.lithic.api/lithic-java/0.109.0) +[![javadoc](https://javadoc.io/badge2/com.lithic.api/lithic-java/0.109.0/javadoc.svg)](https://javadoc.io/doc/com.lithic.api/lithic-java/0.109.0) @@ -13,7 +13,7 @@ The Lithic Java SDK is similar to the Lithic Kotlin SDK but with minor differenc -The REST API documentation can be found on [docs.lithic.com](https://docs.lithic.com). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.lithic.api/lithic-java/0.108.0). +The REST API documentation can be found on [docs.lithic.com](https://docs.lithic.com). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.lithic.api/lithic-java/0.109.0). @@ -24,7 +24,7 @@ The REST API documentation can be found on [docs.lithic.com](https://docs.lithic ### Gradle ```kotlin -implementation("com.lithic.api:lithic-java:0.108.0") +implementation("com.lithic.api:lithic-java:0.109.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.lithic.api:lithic-java:0.108.0") com.lithic.api lithic-java - 0.108.0 + 0.109.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 49e10140c..0a4bbd131 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.lithic.api" - version = "0.108.0" // x-release-please-version + version = "0.109.0" // x-release-please-version } subprojects {